UNPKG

1.5 MBJavaScriptView Raw
1(function webpackUniversalModuleDefinition(root, factory) {
2 if(typeof exports === 'object' && typeof module === 'object')
3 module.exports = factory();
4 else if(typeof define === 'function' && define.amd)
5 define([], factory);
6 else if(typeof exports === 'object')
7 exports["AV"] = factory();
8 else
9 root["AV"] = factory();
10})(typeof self !== 'undefined' ? self : this, function() {
11return /******/ (function(modules) { // webpackBootstrap
12/******/ // The module cache
13/******/ var installedModules = {};
14/******/
15/******/ // The require function
16/******/ function __webpack_require__(moduleId) {
17/******/
18/******/ // Check if module is in cache
19/******/ if(installedModules[moduleId]) {
20/******/ return installedModules[moduleId].exports;
21/******/ }
22/******/ // Create a new module (and put it into the cache)
23/******/ var module = installedModules[moduleId] = {
24/******/ i: moduleId,
25/******/ l: false,
26/******/ exports: {}
27/******/ };
28/******/
29/******/ // Execute the module function
30/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
31/******/
32/******/ // Flag the module as loaded
33/******/ module.l = true;
34/******/
35/******/ // Return the exports of the module
36/******/ return module.exports;
37/******/ }
38/******/
39/******/
40/******/ // expose the modules object (__webpack_modules__)
41/******/ __webpack_require__.m = modules;
42/******/
43/******/ // expose the module cache
44/******/ __webpack_require__.c = installedModules;
45/******/
46/******/ // define getter function for harmony exports
47/******/ __webpack_require__.d = function(exports, name, getter) {
48/******/ if(!__webpack_require__.o(exports, name)) {
49/******/ Object.defineProperty(exports, name, {
50/******/ configurable: false,
51/******/ enumerable: true,
52/******/ get: getter
53/******/ });
54/******/ }
55/******/ };
56/******/
57/******/ // getDefaultExport function for compatibility with non-harmony modules
58/******/ __webpack_require__.n = function(module) {
59/******/ var getter = module && module.__esModule ?
60/******/ function getDefault() { return module['default']; } :
61/******/ function getModuleExports() { return module; };
62/******/ __webpack_require__.d(getter, 'a', getter);
63/******/ return getter;
64/******/ };
65/******/
66/******/ // Object.prototype.hasOwnProperty.call
67/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
68/******/
69/******/ // __webpack_public_path__
70/******/ __webpack_require__.p = "";
71/******/
72/******/ // Load entry module and return exports
73/******/ return __webpack_require__(__webpack_require__.s = 281);
74/******/ })
75/************************************************************************/
76/******/ ([
77/* 0 */
78/***/ (function(module, exports, __webpack_require__) {
79
80"use strict";
81
82var global = __webpack_require__(8);
83var apply = __webpack_require__(79);
84var uncurryThis = __webpack_require__(4);
85var isCallable = __webpack_require__(9);
86var getOwnPropertyDescriptor = __webpack_require__(64).f;
87var isForced = __webpack_require__(159);
88var path = __webpack_require__(7);
89var bind = __webpack_require__(52);
90var createNonEnumerableProperty = __webpack_require__(39);
91var hasOwn = __webpack_require__(13);
92
93var wrapConstructor = function (NativeConstructor) {
94 var Wrapper = function (a, b, c) {
95 if (this instanceof Wrapper) {
96 switch (arguments.length) {
97 case 0: return new NativeConstructor();
98 case 1: return new NativeConstructor(a);
99 case 2: return new NativeConstructor(a, b);
100 } return new NativeConstructor(a, b, c);
101 } return apply(NativeConstructor, this, arguments);
102 };
103 Wrapper.prototype = NativeConstructor.prototype;
104 return Wrapper;
105};
106
107/*
108 options.target - name of the target object
109 options.global - target is the global object
110 options.stat - export as static methods of target
111 options.proto - export as prototype methods of target
112 options.real - real prototype method for the `pure` version
113 options.forced - export even if the native feature is available
114 options.bind - bind methods to the target, required for the `pure` version
115 options.wrap - wrap constructors to preventing global pollution, required for the `pure` version
116 options.unsafe - use the simple assignment of property instead of delete + defineProperty
117 options.sham - add a flag to not completely full polyfills
118 options.enumerable - export as enumerable property
119 options.dontCallGetSet - prevent calling a getter on target
120 options.name - the .name of the function if it does not match the key
121*/
122module.exports = function (options, source) {
123 var TARGET = options.target;
124 var GLOBAL = options.global;
125 var STATIC = options.stat;
126 var PROTO = options.proto;
127
128 var nativeSource = GLOBAL ? global : STATIC ? global[TARGET] : (global[TARGET] || {}).prototype;
129
130 var target = GLOBAL ? path : path[TARGET] || createNonEnumerableProperty(path, TARGET, {})[TARGET];
131 var targetPrototype = target.prototype;
132
133 var FORCED, USE_NATIVE, VIRTUAL_PROTOTYPE;
134 var key, sourceProperty, targetProperty, nativeProperty, resultProperty, descriptor;
135
136 for (key in source) {
137 FORCED = isForced(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);
138 // contains in native
139 USE_NATIVE = !FORCED && nativeSource && hasOwn(nativeSource, key);
140
141 targetProperty = target[key];
142
143 if (USE_NATIVE) if (options.dontCallGetSet) {
144 descriptor = getOwnPropertyDescriptor(nativeSource, key);
145 nativeProperty = descriptor && descriptor.value;
146 } else nativeProperty = nativeSource[key];
147
148 // export native or implementation
149 sourceProperty = (USE_NATIVE && nativeProperty) ? nativeProperty : source[key];
150
151 if (USE_NATIVE && typeof targetProperty == typeof sourceProperty) continue;
152
153 // bind timers to global for call from export context
154 if (options.bind && USE_NATIVE) resultProperty = bind(sourceProperty, global);
155 // wrap global constructors for prevent changs in this version
156 else if (options.wrap && USE_NATIVE) resultProperty = wrapConstructor(sourceProperty);
157 // make static versions for prototype methods
158 else if (PROTO && isCallable(sourceProperty)) resultProperty = uncurryThis(sourceProperty);
159 // default case
160 else resultProperty = sourceProperty;
161
162 // add a flag to not completely full polyfills
163 if (options.sham || (sourceProperty && sourceProperty.sham) || (targetProperty && targetProperty.sham)) {
164 createNonEnumerableProperty(resultProperty, 'sham', true);
165 }
166
167 createNonEnumerableProperty(target, key, resultProperty);
168
169 if (PROTO) {
170 VIRTUAL_PROTOTYPE = TARGET + 'Prototype';
171 if (!hasOwn(path, VIRTUAL_PROTOTYPE)) {
172 createNonEnumerableProperty(path, VIRTUAL_PROTOTYPE, {});
173 }
174 // export virtual prototype methods
175 createNonEnumerableProperty(path[VIRTUAL_PROTOTYPE], key, sourceProperty);
176 // export real prototype methods
177 if (options.real && targetPrototype && !targetPrototype[key]) {
178 createNonEnumerableProperty(targetPrototype, key, sourceProperty);
179 }
180 }
181 }
182};
183
184
185/***/ }),
186/* 1 */
187/***/ (function(module, exports) {
188
189function _interopRequireDefault(obj) {
190 return obj && obj.__esModule ? obj : {
191 "default": obj
192 };
193}
194
195module.exports = _interopRequireDefault, module.exports.__esModule = true, module.exports["default"] = module.exports;
196
197/***/ }),
198/* 2 */
199/***/ (function(module, exports) {
200
201module.exports = function (exec) {
202 try {
203 return !!exec();
204 } catch (error) {
205 return true;
206 }
207};
208
209
210/***/ }),
211/* 3 */
212/***/ (function(module, __webpack_exports__, __webpack_require__) {
213
214"use strict";
215Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
216/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__index_default_js__ = __webpack_require__(321);
217/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return __WEBPACK_IMPORTED_MODULE_0__index_default_js__["a"]; });
218/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__index_js__ = __webpack_require__(134);
219/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "VERSION", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["VERSION"]; });
220/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "restArguments", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["restArguments"]; });
221/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isObject", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isObject"]; });
222/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isNull", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isNull"]; });
223/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isUndefined", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isUndefined"]; });
224/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isBoolean", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isBoolean"]; });
225/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isElement", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isElement"]; });
226/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isString", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isString"]; });
227/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isNumber", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isNumber"]; });
228/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isDate", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isDate"]; });
229/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isRegExp", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isRegExp"]; });
230/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isError", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isError"]; });
231/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isSymbol", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isSymbol"]; });
232/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isArrayBuffer", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isArrayBuffer"]; });
233/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isDataView", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isDataView"]; });
234/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isArray", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isArray"]; });
235/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isFunction", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isFunction"]; });
236/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isArguments", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isArguments"]; });
237/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isFinite", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isFinite"]; });
238/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isNaN", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isNaN"]; });
239/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isTypedArray", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isTypedArray"]; });
240/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isEmpty", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isEmpty"]; });
241/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isMatch", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isMatch"]; });
242/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isEqual", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isEqual"]; });
243/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isMap", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isMap"]; });
244/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isWeakMap", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isWeakMap"]; });
245/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isSet", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isSet"]; });
246/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isWeakSet", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isWeakSet"]; });
247/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "keys", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["keys"]; });
248/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "allKeys", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["allKeys"]; });
249/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "values", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["values"]; });
250/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "pairs", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["pairs"]; });
251/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "invert", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["invert"]; });
252/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "functions", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["functions"]; });
253/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "methods", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["methods"]; });
254/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "extend", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["extend"]; });
255/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "extendOwn", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["extendOwn"]; });
256/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "assign", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["assign"]; });
257/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "defaults", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["defaults"]; });
258/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "create", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["create"]; });
259/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "clone", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["clone"]; });
260/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "tap", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["tap"]; });
261/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "get", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["get"]; });
262/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "has", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["has"]; });
263/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "mapObject", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["mapObject"]; });
264/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "identity", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["identity"]; });
265/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "constant", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["constant"]; });
266/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "noop", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["noop"]; });
267/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "toPath", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["toPath"]; });
268/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "property", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["property"]; });
269/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "propertyOf", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["propertyOf"]; });
270/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "matcher", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["matcher"]; });
271/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "matches", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["matches"]; });
272/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "times", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["times"]; });
273/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "random", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["random"]; });
274/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "now", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["now"]; });
275/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "escape", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["escape"]; });
276/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "unescape", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["unescape"]; });
277/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "templateSettings", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["templateSettings"]; });
278/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "template", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["template"]; });
279/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "result", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["result"]; });
280/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "uniqueId", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["uniqueId"]; });
281/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "chain", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["chain"]; });
282/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "iteratee", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["iteratee"]; });
283/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "partial", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["partial"]; });
284/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "bind", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["bind"]; });
285/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "bindAll", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["bindAll"]; });
286/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "memoize", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["memoize"]; });
287/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "delay", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["delay"]; });
288/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "defer", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["defer"]; });
289/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "throttle", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["throttle"]; });
290/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "debounce", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["debounce"]; });
291/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "wrap", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["wrap"]; });
292/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "negate", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["negate"]; });
293/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "compose", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["compose"]; });
294/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "after", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["after"]; });
295/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "before", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["before"]; });
296/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "once", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["once"]; });
297/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "findKey", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["findKey"]; });
298/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "findIndex", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["findIndex"]; });
299/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "findLastIndex", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["findLastIndex"]; });
300/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "sortedIndex", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["sortedIndex"]; });
301/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "indexOf", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["indexOf"]; });
302/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "lastIndexOf", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["lastIndexOf"]; });
303/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "find", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["find"]; });
304/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "detect", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["detect"]; });
305/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "findWhere", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["findWhere"]; });
306/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "each", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["each"]; });
307/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "forEach", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["forEach"]; });
308/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "map", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["map"]; });
309/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "collect", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["collect"]; });
310/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "reduce", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["reduce"]; });
311/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "foldl", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["foldl"]; });
312/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "inject", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["inject"]; });
313/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "reduceRight", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["reduceRight"]; });
314/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "foldr", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["foldr"]; });
315/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "filter", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["filter"]; });
316/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "select", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["select"]; });
317/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "reject", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["reject"]; });
318/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "every", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["every"]; });
319/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "all", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["all"]; });
320/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "some", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["some"]; });
321/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "any", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["any"]; });
322/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "contains", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["contains"]; });
323/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "includes", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["includes"]; });
324/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "include", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["include"]; });
325/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "invoke", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["invoke"]; });
326/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "pluck", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["pluck"]; });
327/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "where", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["where"]; });
328/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "max", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["max"]; });
329/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "min", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["min"]; });
330/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "shuffle", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["shuffle"]; });
331/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "sample", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["sample"]; });
332/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "sortBy", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["sortBy"]; });
333/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "groupBy", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["groupBy"]; });
334/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "indexBy", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["indexBy"]; });
335/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "countBy", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["countBy"]; });
336/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "partition", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["partition"]; });
337/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "toArray", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["toArray"]; });
338/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "size", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["size"]; });
339/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "pick", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["pick"]; });
340/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "omit", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["omit"]; });
341/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "first", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["first"]; });
342/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "head", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["head"]; });
343/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "take", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["take"]; });
344/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "initial", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["initial"]; });
345/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "last", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["last"]; });
346/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "rest", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["rest"]; });
347/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "tail", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["tail"]; });
348/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "drop", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["drop"]; });
349/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "compact", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["compact"]; });
350/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "flatten", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["flatten"]; });
351/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "without", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["without"]; });
352/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "uniq", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["uniq"]; });
353/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "unique", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["unique"]; });
354/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "union", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["union"]; });
355/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "intersection", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["intersection"]; });
356/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "difference", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["difference"]; });
357/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "unzip", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["unzip"]; });
358/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "transpose", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["transpose"]; });
359/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "zip", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["zip"]; });
360/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "object", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["object"]; });
361/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "range", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["range"]; });
362/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "chunk", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["chunk"]; });
363/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "mixin", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["mixin"]; });
364// ESM Exports
365// ===========
366// This module is the package entry point for ES module users. In other words,
367// it is the module they are interfacing with when they import from the whole
368// package instead of from a submodule, like this:
369//
370// ```js
371// import { map } from 'underscore';
372// ```
373//
374// The difference with `./index-default`, which is the package entry point for
375// CommonJS, AMD and UMD users, is purely technical. In ES modules, named and
376// default exports are considered to be siblings, so when you have a default
377// export, its properties are not automatically available as named exports. For
378// this reason, we re-export the named exports in addition to providing the same
379// default export as in `./index-default`.
380
381
382
383
384/***/ }),
385/* 4 */
386/***/ (function(module, exports, __webpack_require__) {
387
388var NATIVE_BIND = __webpack_require__(80);
389
390var FunctionPrototype = Function.prototype;
391var bind = FunctionPrototype.bind;
392var call = FunctionPrototype.call;
393var uncurryThis = NATIVE_BIND && bind.bind(call, call);
394
395module.exports = NATIVE_BIND ? function (fn) {
396 return fn && uncurryThis(fn);
397} : function (fn) {
398 return fn && function () {
399 return call.apply(fn, arguments);
400 };
401};
402
403
404/***/ }),
405/* 5 */
406/***/ (function(module, exports, __webpack_require__) {
407
408var global = __webpack_require__(8);
409var shared = __webpack_require__(82);
410var hasOwn = __webpack_require__(13);
411var uid = __webpack_require__(101);
412var NATIVE_SYMBOL = __webpack_require__(65);
413var USE_SYMBOL_AS_UID = __webpack_require__(157);
414
415var WellKnownSymbolsStore = shared('wks');
416var Symbol = global.Symbol;
417var symbolFor = Symbol && Symbol['for'];
418var createWellKnownSymbol = USE_SYMBOL_AS_UID ? Symbol : Symbol && Symbol.withoutSetter || uid;
419
420module.exports = function (name) {
421 if (!hasOwn(WellKnownSymbolsStore, name) || !(NATIVE_SYMBOL || typeof WellKnownSymbolsStore[name] == 'string')) {
422 var description = 'Symbol.' + name;
423 if (NATIVE_SYMBOL && hasOwn(Symbol, name)) {
424 WellKnownSymbolsStore[name] = Symbol[name];
425 } else if (USE_SYMBOL_AS_UID && symbolFor) {
426 WellKnownSymbolsStore[name] = symbolFor(description);
427 } else {
428 WellKnownSymbolsStore[name] = createWellKnownSymbol(description);
429 }
430 } return WellKnownSymbolsStore[name];
431};
432
433
434/***/ }),
435/* 6 */
436/***/ (function(module, __webpack_exports__, __webpack_require__) {
437
438"use strict";
439/* WEBPACK VAR INJECTION */(function(global) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return VERSION; });
440/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "p", function() { return root; });
441/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return ArrayProto; });
442/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return ObjProto; });
443/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return SymbolProto; });
444/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "o", function() { return push; });
445/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "q", function() { return slice; });
446/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "t", function() { return toString; });
447/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i", function() { return hasOwnProperty; });
448/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "r", function() { return supportsArrayBuffer; });
449/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "s", function() { return supportsDataView; });
450/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "k", function() { return nativeIsArray; });
451/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "m", function() { return nativeKeys; });
452/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "j", function() { return nativeCreate; });
453/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "l", function() { return nativeIsView; });
454/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return _isNaN; });
455/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return _isFinite; });
456/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return hasEnumBug; });
457/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "n", function() { return nonEnumerableProps; });
458/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return MAX_ARRAY_INDEX; });
459// Current version.
460var VERSION = '1.12.1';
461
462// Establish the root object, `window` (`self`) in the browser, `global`
463// on the server, or `this` in some virtual machines. We use `self`
464// instead of `window` for `WebWorker` support.
465var root = typeof self == 'object' && self.self === self && self ||
466 typeof global == 'object' && global.global === global && global ||
467 Function('return this')() ||
468 {};
469
470// Save bytes in the minified (but not gzipped) version:
471var ArrayProto = Array.prototype, ObjProto = Object.prototype;
472var SymbolProto = typeof Symbol !== 'undefined' ? Symbol.prototype : null;
473
474// Create quick reference variables for speed access to core prototypes.
475var push = ArrayProto.push,
476 slice = ArrayProto.slice,
477 toString = ObjProto.toString,
478 hasOwnProperty = ObjProto.hasOwnProperty;
479
480// Modern feature detection.
481var supportsArrayBuffer = typeof ArrayBuffer !== 'undefined',
482 supportsDataView = typeof DataView !== 'undefined';
483
484// All **ECMAScript 5+** native function implementations that we hope to use
485// are declared here.
486var nativeIsArray = Array.isArray,
487 nativeKeys = Object.keys,
488 nativeCreate = Object.create,
489 nativeIsView = supportsArrayBuffer && ArrayBuffer.isView;
490
491// Create references to these builtin functions because we override them.
492var _isNaN = isNaN,
493 _isFinite = isFinite;
494
495// Keys in IE < 9 that won't be iterated by `for key in ...` and thus missed.
496var hasEnumBug = !{toString: null}.propertyIsEnumerable('toString');
497var nonEnumerableProps = ['valueOf', 'isPrototypeOf', 'toString',
498 'propertyIsEnumerable', 'hasOwnProperty', 'toLocaleString'];
499
500// The largest integer that can be represented exactly.
501var MAX_ARRAY_INDEX = Math.pow(2, 53) - 1;
502
503/* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__(78)))
504
505/***/ }),
506/* 7 */
507/***/ (function(module, exports) {
508
509module.exports = {};
510
511
512/***/ }),
513/* 8 */
514/***/ (function(module, exports, __webpack_require__) {
515
516/* WEBPACK VAR INJECTION */(function(global) {var check = function (it) {
517 return it && it.Math == Math && it;
518};
519
520// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
521module.exports =
522 // eslint-disable-next-line es-x/no-global-this -- safe
523 check(typeof globalThis == 'object' && globalThis) ||
524 check(typeof window == 'object' && window) ||
525 // eslint-disable-next-line no-restricted-globals -- safe
526 check(typeof self == 'object' && self) ||
527 check(typeof global == 'object' && global) ||
528 // eslint-disable-next-line no-new-func -- fallback
529 (function () { return this; })() || Function('return this')();
530
531/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(78)))
532
533/***/ }),
534/* 9 */
535/***/ (function(module, exports) {
536
537// `IsCallable` abstract operation
538// https://tc39.es/ecma262/#sec-iscallable
539module.exports = function (argument) {
540 return typeof argument == 'function';
541};
542
543
544/***/ }),
545/* 10 */
546/***/ (function(module, exports, __webpack_require__) {
547
548var path = __webpack_require__(7);
549var hasOwn = __webpack_require__(13);
550var wrappedWellKnownSymbolModule = __webpack_require__(151);
551var defineProperty = __webpack_require__(23).f;
552
553module.exports = function (NAME) {
554 var Symbol = path.Symbol || (path.Symbol = {});
555 if (!hasOwn(Symbol, NAME)) defineProperty(Symbol, NAME, {
556 value: wrappedWellKnownSymbolModule.f(NAME)
557 });
558};
559
560
561/***/ }),
562/* 11 */
563/***/ (function(module, exports, __webpack_require__) {
564
565var isCallable = __webpack_require__(9);
566
567module.exports = function (it) {
568 return typeof it == 'object' ? it !== null : isCallable(it);
569};
570
571
572/***/ }),
573/* 12 */
574/***/ (function(module, exports, __webpack_require__) {
575
576module.exports = __webpack_require__(285);
577
578/***/ }),
579/* 13 */
580/***/ (function(module, exports, __webpack_require__) {
581
582var uncurryThis = __webpack_require__(4);
583var toObject = __webpack_require__(33);
584
585var hasOwnProperty = uncurryThis({}.hasOwnProperty);
586
587// `HasOwnProperty` abstract operation
588// https://tc39.es/ecma262/#sec-hasownproperty
589// eslint-disable-next-line es-x/no-object-hasown -- safe
590module.exports = Object.hasOwn || function hasOwn(it, key) {
591 return hasOwnProperty(toObject(it), key);
592};
593
594
595/***/ }),
596/* 14 */
597/***/ (function(module, exports, __webpack_require__) {
598
599var fails = __webpack_require__(2);
600
601// Detect IE8's incomplete defineProperty implementation
602module.exports = !fails(function () {
603 // eslint-disable-next-line es-x/no-object-defineproperty -- required for testing
604 return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] != 7;
605});
606
607
608/***/ }),
609/* 15 */
610/***/ (function(module, exports, __webpack_require__) {
611
612var NATIVE_BIND = __webpack_require__(80);
613
614var call = Function.prototype.call;
615
616module.exports = NATIVE_BIND ? call.bind(call) : function () {
617 return call.apply(call, arguments);
618};
619
620
621/***/ }),
622/* 16 */
623/***/ (function(module, exports, __webpack_require__) {
624
625var uncurryThis = __webpack_require__(4);
626
627module.exports = uncurryThis({}.isPrototypeOf);
628
629
630/***/ }),
631/* 17 */
632/***/ (function(module, __webpack_exports__, __webpack_require__) {
633
634"use strict";
635/* harmony export (immutable) */ __webpack_exports__["a"] = keys;
636/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isObject_js__ = __webpack_require__(58);
637/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__setup_js__ = __webpack_require__(6);
638/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__has_js__ = __webpack_require__(47);
639/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__collectNonEnumProps_js__ = __webpack_require__(189);
640
641
642
643
644
645// Retrieve the names of an object's own properties.
646// Delegates to **ECMAScript 5**'s native `Object.keys`.
647function keys(obj) {
648 if (!Object(__WEBPACK_IMPORTED_MODULE_0__isObject_js__["a" /* default */])(obj)) return [];
649 if (__WEBPACK_IMPORTED_MODULE_1__setup_js__["m" /* nativeKeys */]) return Object(__WEBPACK_IMPORTED_MODULE_1__setup_js__["m" /* nativeKeys */])(obj);
650 var keys = [];
651 for (var key in obj) if (Object(__WEBPACK_IMPORTED_MODULE_2__has_js__["a" /* default */])(obj, key)) keys.push(key);
652 // Ahem, IE < 9.
653 if (__WEBPACK_IMPORTED_MODULE_1__setup_js__["h" /* hasEnumBug */]) Object(__WEBPACK_IMPORTED_MODULE_3__collectNonEnumProps_js__["a" /* default */])(obj, keys);
654 return keys;
655}
656
657
658/***/ }),
659/* 18 */
660/***/ (function(module, __webpack_exports__, __webpack_require__) {
661
662"use strict";
663/* harmony export (immutable) */ __webpack_exports__["a"] = tagTester;
664/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(6);
665
666
667// Internal function for creating a `toString`-based type tester.
668function tagTester(name) {
669 var tag = '[object ' + name + ']';
670 return function(obj) {
671 return __WEBPACK_IMPORTED_MODULE_0__setup_js__["t" /* toString */].call(obj) === tag;
672 };
673}
674
675
676/***/ }),
677/* 19 */
678/***/ (function(module, exports, __webpack_require__) {
679
680module.exports = __webpack_require__(393);
681
682/***/ }),
683/* 20 */
684/***/ (function(module, exports, __webpack_require__) {
685
686var path = __webpack_require__(7);
687var global = __webpack_require__(8);
688var isCallable = __webpack_require__(9);
689
690var aFunction = function (variable) {
691 return isCallable(variable) ? variable : undefined;
692};
693
694module.exports = function (namespace, method) {
695 return arguments.length < 2 ? aFunction(path[namespace]) || aFunction(global[namespace])
696 : path[namespace] && path[namespace][method] || global[namespace] && global[namespace][method];
697};
698
699
700/***/ }),
701/* 21 */
702/***/ (function(module, exports, __webpack_require__) {
703
704var isObject = __webpack_require__(11);
705
706var $String = String;
707var $TypeError = TypeError;
708
709// `Assert: Type(argument) is Object`
710module.exports = function (argument) {
711 if (isObject(argument)) return argument;
712 throw $TypeError($String(argument) + ' is not an object');
713};
714
715
716/***/ }),
717/* 22 */
718/***/ (function(module, __webpack_exports__, __webpack_require__) {
719
720"use strict";
721/* harmony export (immutable) */ __webpack_exports__["a"] = cb;
722/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__underscore_js__ = __webpack_require__(25);
723/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__baseIteratee_js__ = __webpack_require__(199);
724/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__iteratee_js__ = __webpack_require__(200);
725
726
727
728
729// The function we call internally to generate a callback. It invokes
730// `_.iteratee` if overridden, otherwise `baseIteratee`.
731function cb(value, context, argCount) {
732 if (__WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */].iteratee !== __WEBPACK_IMPORTED_MODULE_2__iteratee_js__["a" /* default */]) return __WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */].iteratee(value, context);
733 return Object(__WEBPACK_IMPORTED_MODULE_1__baseIteratee_js__["a" /* default */])(value, context, argCount);
734}
735
736
737/***/ }),
738/* 23 */
739/***/ (function(module, exports, __webpack_require__) {
740
741var DESCRIPTORS = __webpack_require__(14);
742var IE8_DOM_DEFINE = __webpack_require__(158);
743var V8_PROTOTYPE_DEFINE_BUG = __webpack_require__(160);
744var anObject = __webpack_require__(21);
745var toPropertyKey = __webpack_require__(99);
746
747var $TypeError = TypeError;
748// eslint-disable-next-line es-x/no-object-defineproperty -- safe
749var $defineProperty = Object.defineProperty;
750// eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
751var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
752var ENUMERABLE = 'enumerable';
753var CONFIGURABLE = 'configurable';
754var WRITABLE = 'writable';
755
756// `Object.defineProperty` method
757// https://tc39.es/ecma262/#sec-object.defineproperty
758exports.f = DESCRIPTORS ? V8_PROTOTYPE_DEFINE_BUG ? function defineProperty(O, P, Attributes) {
759 anObject(O);
760 P = toPropertyKey(P);
761 anObject(Attributes);
762 if (typeof O === 'function' && P === 'prototype' && 'value' in Attributes && WRITABLE in Attributes && !Attributes[WRITABLE]) {
763 var current = $getOwnPropertyDescriptor(O, P);
764 if (current && current[WRITABLE]) {
765 O[P] = Attributes.value;
766 Attributes = {
767 configurable: CONFIGURABLE in Attributes ? Attributes[CONFIGURABLE] : current[CONFIGURABLE],
768 enumerable: ENUMERABLE in Attributes ? Attributes[ENUMERABLE] : current[ENUMERABLE],
769 writable: false
770 };
771 }
772 } return $defineProperty(O, P, Attributes);
773} : $defineProperty : function defineProperty(O, P, Attributes) {
774 anObject(O);
775 P = toPropertyKey(P);
776 anObject(Attributes);
777 if (IE8_DOM_DEFINE) try {
778 return $defineProperty(O, P, Attributes);
779 } catch (error) { /* empty */ }
780 if ('get' in Attributes || 'set' in Attributes) throw $TypeError('Accessors not supported');
781 if ('value' in Attributes) O[P] = Attributes.value;
782 return O;
783};
784
785
786/***/ }),
787/* 24 */
788/***/ (function(module, __webpack_exports__, __webpack_require__) {
789
790"use strict";
791/* harmony export (immutable) */ __webpack_exports__["a"] = restArguments;
792// Some functions take a variable number of arguments, or a few expected
793// arguments at the beginning and then a variable number of values to operate
794// on. This helper accumulates all remaining arguments past the function’s
795// argument length (or an explicit `startIndex`), into an array that becomes
796// the last argument. Similar to ES6’s "rest parameter".
797function restArguments(func, startIndex) {
798 startIndex = startIndex == null ? func.length - 1 : +startIndex;
799 return function() {
800 var length = Math.max(arguments.length - startIndex, 0),
801 rest = Array(length),
802 index = 0;
803 for (; index < length; index++) {
804 rest[index] = arguments[index + startIndex];
805 }
806 switch (startIndex) {
807 case 0: return func.call(this, rest);
808 case 1: return func.call(this, arguments[0], rest);
809 case 2: return func.call(this, arguments[0], arguments[1], rest);
810 }
811 var args = Array(startIndex + 1);
812 for (index = 0; index < startIndex; index++) {
813 args[index] = arguments[index];
814 }
815 args[startIndex] = rest;
816 return func.apply(this, args);
817 };
818}
819
820
821/***/ }),
822/* 25 */
823/***/ (function(module, __webpack_exports__, __webpack_require__) {
824
825"use strict";
826/* harmony export (immutable) */ __webpack_exports__["a"] = _;
827/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(6);
828
829
830// If Underscore is called as a function, it returns a wrapped object that can
831// be used OO-style. This wrapper holds altered versions of all functions added
832// through `_.mixin`. Wrapped objects may be chained.
833function _(obj) {
834 if (obj instanceof _) return obj;
835 if (!(this instanceof _)) return new _(obj);
836 this._wrapped = obj;
837}
838
839_.VERSION = __WEBPACK_IMPORTED_MODULE_0__setup_js__["e" /* VERSION */];
840
841// Extracts the result from a wrapped and chained object.
842_.prototype.value = function() {
843 return this._wrapped;
844};
845
846// Provide unwrapping proxies for some methods used in engine operations
847// such as arithmetic and JSON stringification.
848_.prototype.valueOf = _.prototype.toJSON = _.prototype.value;
849
850_.prototype.toString = function() {
851 return String(this._wrapped);
852};
853
854
855/***/ }),
856/* 26 */
857/***/ (function(module, __webpack_exports__, __webpack_require__) {
858
859"use strict";
860/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createSizePropertyCheck_js__ = __webpack_require__(187);
861/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__getLength_js__ = __webpack_require__(31);
862
863
864
865// Internal helper for collection methods to determine whether a collection
866// should be iterated as an array or as an object.
867// Related: https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength
868// Avoids a very nasty iOS 8 JIT bug on ARM-64. #2094
869/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createSizePropertyCheck_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__getLength_js__["a" /* default */]));
870
871
872/***/ }),
873/* 27 */
874/***/ (function(module, exports, __webpack_require__) {
875
876var path = __webpack_require__(7);
877
878module.exports = function (CONSTRUCTOR) {
879 return path[CONSTRUCTOR + 'Prototype'];
880};
881
882
883/***/ }),
884/* 28 */
885/***/ (function(module, exports, __webpack_require__) {
886
887"use strict";
888
889
890var _interopRequireDefault = __webpack_require__(1);
891
892var _concat = _interopRequireDefault(__webpack_require__(19));
893
894var _promise = _interopRequireDefault(__webpack_require__(12));
895
896var _ = __webpack_require__(3);
897
898var md5 = __webpack_require__(529);
899
900var _require = __webpack_require__(3),
901 extend = _require.extend;
902
903var AV = __webpack_require__(74);
904
905var AVError = __webpack_require__(48);
906
907var _require2 = __webpack_require__(32),
908 getSessionToken = _require2.getSessionToken;
909
910var ajax = __webpack_require__(117); // 计算 X-LC-Sign 的签名方法
911
912
913var sign = function sign(key, isMasterKey) {
914 var _context2;
915
916 var now = new Date().getTime();
917 var signature = md5(now + key);
918
919 if (isMasterKey) {
920 var _context;
921
922 return (0, _concat.default)(_context = "".concat(signature, ",")).call(_context, now, ",master");
923 }
924
925 return (0, _concat.default)(_context2 = "".concat(signature, ",")).call(_context2, now);
926};
927
928var setAppKey = function setAppKey(headers, signKey) {
929 if (signKey) {
930 headers['X-LC-Sign'] = sign(AV.applicationKey);
931 } else {
932 headers['X-LC-Key'] = AV.applicationKey;
933 }
934};
935
936var setHeaders = function setHeaders() {
937 var authOptions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
938 var signKey = arguments.length > 1 ? arguments[1] : undefined;
939 var headers = {
940 'X-LC-Id': AV.applicationId,
941 'Content-Type': 'application/json;charset=UTF-8'
942 };
943 var useMasterKey = false;
944
945 if (typeof authOptions.useMasterKey === 'boolean') {
946 useMasterKey = authOptions.useMasterKey;
947 } else if (typeof AV._config.useMasterKey === 'boolean') {
948 useMasterKey = AV._config.useMasterKey;
949 }
950
951 if (useMasterKey) {
952 if (AV.masterKey) {
953 if (signKey) {
954 headers['X-LC-Sign'] = sign(AV.masterKey, true);
955 } else {
956 headers['X-LC-Key'] = "".concat(AV.masterKey, ",master");
957 }
958 } else {
959 console.warn('masterKey is not set, fall back to use appKey');
960 setAppKey(headers, signKey);
961 }
962 } else {
963 setAppKey(headers, signKey);
964 }
965
966 if (AV.hookKey) {
967 headers['X-LC-Hook-Key'] = AV.hookKey;
968 }
969
970 if (AV._config.production !== null) {
971 headers['X-LC-Prod'] = String(AV._config.production);
972 }
973
974 headers[ false ? 'User-Agent' : 'X-LC-UA'] = AV._sharedConfig.userAgent;
975 return _promise.default.resolve().then(function () {
976 // Pass the session token
977 var sessionToken = getSessionToken(authOptions);
978
979 if (sessionToken) {
980 headers['X-LC-Session'] = sessionToken;
981 } else if (!AV._config.disableCurrentUser) {
982 return AV.User.currentAsync().then(function (currentUser) {
983 if (currentUser && currentUser._sessionToken) {
984 headers['X-LC-Session'] = currentUser._sessionToken;
985 }
986
987 return headers;
988 });
989 }
990
991 return headers;
992 });
993};
994
995var createApiUrl = function createApiUrl(_ref) {
996 var _ref$service = _ref.service,
997 service = _ref$service === void 0 ? 'api' : _ref$service,
998 _ref$version = _ref.version,
999 version = _ref$version === void 0 ? '1.1' : _ref$version,
1000 path = _ref.path;
1001 var apiURL = AV._config.serverURLs[service];
1002 if (!apiURL) throw new Error("undefined server URL for ".concat(service));
1003
1004 if (apiURL.charAt(apiURL.length - 1) !== '/') {
1005 apiURL += '/';
1006 }
1007
1008 apiURL += version;
1009
1010 if (path) {
1011 apiURL += path;
1012 }
1013
1014 return apiURL;
1015};
1016/**
1017 * Low level REST API client. Call REST endpoints with authorization headers.
1018 * @function AV.request
1019 * @since 3.0.0
1020 * @param {Object} options
1021 * @param {String} options.method HTTP method
1022 * @param {String} options.path endpoint path, e.g. `/classes/Test/55759577e4b029ae6015ac20`
1023 * @param {Object} [options.query] query string dict
1024 * @param {Object} [options.data] HTTP body
1025 * @param {AuthOptions} [options.authOptions]
1026 * @param {String} [options.service = 'api']
1027 * @param {String} [options.version = '1.1']
1028 */
1029
1030
1031var request = function request(_ref2) {
1032 var service = _ref2.service,
1033 version = _ref2.version,
1034 method = _ref2.method,
1035 path = _ref2.path,
1036 query = _ref2.query,
1037 data = _ref2.data,
1038 authOptions = _ref2.authOptions,
1039 _ref2$signKey = _ref2.signKey,
1040 signKey = _ref2$signKey === void 0 ? true : _ref2$signKey;
1041
1042 if (!(AV.applicationId && (AV.applicationKey || AV.masterKey))) {
1043 throw new Error('Not initialized');
1044 }
1045
1046 if (AV._appRouter) {
1047 AV._appRouter.refresh();
1048 }
1049
1050 var timeout = AV._config.requestTimeout;
1051 var url = createApiUrl({
1052 service: service,
1053 path: path,
1054 version: version
1055 });
1056 return setHeaders(authOptions, signKey).then(function (headers) {
1057 return ajax({
1058 method: method,
1059 url: url,
1060 query: query,
1061 data: data,
1062 headers: headers,
1063 timeout: timeout
1064 }).catch(function (error) {
1065 var errorJSON = {
1066 code: error.code || -1,
1067 error: error.message || error.responseText
1068 };
1069
1070 if (error.response && error.response.code) {
1071 errorJSON = error.response;
1072 } else if (error.responseText) {
1073 try {
1074 errorJSON = JSON.parse(error.responseText);
1075 } catch (e) {// If we fail to parse the error text, that's okay.
1076 }
1077 }
1078
1079 errorJSON.rawMessage = errorJSON.rawMessage || errorJSON.error;
1080
1081 if (!AV._sharedConfig.keepErrorRawMessage) {
1082 var _context3, _context4;
1083
1084 errorJSON.error += (0, _concat.default)(_context3 = (0, _concat.default)(_context4 = " [".concat(error.statusCode || 'N/A', " ")).call(_context4, method, " ")).call(_context3, url, "]");
1085 } // Transform the error into an instance of AVError by trying to parse
1086 // the error string as JSON.
1087
1088
1089 var err = new AVError(errorJSON.code, errorJSON.error);
1090 delete errorJSON.error;
1091 throw _.extend(err, errorJSON);
1092 });
1093 });
1094}; // lagecy request
1095
1096
1097var _request = function _request(route, className, objectId, method, data, authOptions, query) {
1098 var path = '';
1099 if (route) path += "/".concat(route);
1100 if (className) path += "/".concat(className);
1101 if (objectId) path += "/".concat(objectId); // for migeration
1102
1103 if (data && data._fetchWhenSave) throw new Error('_fetchWhenSave should be in the query');
1104 if (data && data._where) throw new Error('_where should be in the query');
1105
1106 if (method && method.toLowerCase() === 'get') {
1107 query = extend({}, query, data);
1108 data = null;
1109 }
1110
1111 return request({
1112 method: method,
1113 path: path,
1114 query: query,
1115 data: data,
1116 authOptions: authOptions
1117 });
1118};
1119
1120AV.request = request;
1121module.exports = {
1122 _request: _request,
1123 request: request
1124};
1125
1126/***/ }),
1127/* 29 */
1128/***/ (function(module, exports, __webpack_require__) {
1129
1130var isCallable = __webpack_require__(9);
1131var tryToString = __webpack_require__(67);
1132
1133var $TypeError = TypeError;
1134
1135// `Assert: IsCallable(argument) is true`
1136module.exports = function (argument) {
1137 if (isCallable(argument)) return argument;
1138 throw $TypeError(tryToString(argument) + ' is not a function');
1139};
1140
1141
1142/***/ }),
1143/* 30 */
1144/***/ (function(module, __webpack_exports__, __webpack_require__) {
1145
1146"use strict";
1147/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(18);
1148/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__setup_js__ = __webpack_require__(6);
1149
1150
1151
1152var isFunction = Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('Function');
1153
1154// Optimize `isFunction` if appropriate. Work around some `typeof` bugs in old
1155// v8, IE 11 (#1621), Safari 8 (#1929), and PhantomJS (#2236).
1156var nodelist = __WEBPACK_IMPORTED_MODULE_1__setup_js__["p" /* root */].document && __WEBPACK_IMPORTED_MODULE_1__setup_js__["p" /* root */].document.childNodes;
1157if (typeof /./ != 'function' && typeof Int8Array != 'object' && typeof nodelist != 'function') {
1158 isFunction = function(obj) {
1159 return typeof obj == 'function' || false;
1160 };
1161}
1162
1163/* harmony default export */ __webpack_exports__["a"] = (isFunction);
1164
1165
1166/***/ }),
1167/* 31 */
1168/***/ (function(module, __webpack_exports__, __webpack_require__) {
1169
1170"use strict";
1171/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__shallowProperty_js__ = __webpack_require__(188);
1172
1173
1174// Internal helper to obtain the `length` property of an object.
1175/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__shallowProperty_js__["a" /* default */])('length'));
1176
1177
1178/***/ }),
1179/* 32 */
1180/***/ (function(module, exports, __webpack_require__) {
1181
1182"use strict";
1183
1184
1185var _interopRequireDefault = __webpack_require__(1);
1186
1187var _keys = _interopRequireDefault(__webpack_require__(62));
1188
1189var _getPrototypeOf = _interopRequireDefault(__webpack_require__(231));
1190
1191var _promise = _interopRequireDefault(__webpack_require__(12));
1192
1193var _ = __webpack_require__(3); // Helper function to check null or undefined.
1194
1195
1196var isNullOrUndefined = function isNullOrUndefined(x) {
1197 return _.isNull(x) || _.isUndefined(x);
1198};
1199
1200var ensureArray = function ensureArray(target) {
1201 if (_.isArray(target)) {
1202 return target;
1203 }
1204
1205 if (target === undefined || target === null) {
1206 return [];
1207 }
1208
1209 return [target];
1210};
1211
1212var transformFetchOptions = function transformFetchOptions() {
1213 var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
1214 keys = (0, _keys.default)(_ref),
1215 include = _ref.include,
1216 includeACL = _ref.includeACL;
1217
1218 var fetchOptions = {};
1219
1220 if (keys) {
1221 fetchOptions.keys = ensureArray(keys).join(',');
1222 }
1223
1224 if (include) {
1225 fetchOptions.include = ensureArray(include).join(',');
1226 }
1227
1228 if (includeACL) {
1229 fetchOptions.returnACL = includeACL;
1230 }
1231
1232 return fetchOptions;
1233};
1234
1235var getSessionToken = function getSessionToken(authOptions) {
1236 if (authOptions.sessionToken) {
1237 return authOptions.sessionToken;
1238 }
1239
1240 if (authOptions.user && typeof authOptions.user.getSessionToken === 'function') {
1241 return authOptions.user.getSessionToken();
1242 }
1243};
1244
1245var tap = function tap(interceptor) {
1246 return function (value) {
1247 return interceptor(value), value;
1248 };
1249}; // Shared empty constructor function to aid in prototype-chain creation.
1250
1251
1252var EmptyConstructor = function EmptyConstructor() {}; // Helper function to correctly set up the prototype chain, for subclasses.
1253// Similar to `goog.inherits`, but uses a hash of prototype properties and
1254// class properties to be extended.
1255
1256
1257var inherits = function inherits(parent, protoProps, staticProps) {
1258 var child; // The constructor function for the new subclass is either defined by you
1259 // (the "constructor" property in your `extend` definition), or defaulted
1260 // by us to simply call the parent's constructor.
1261
1262 if (protoProps && protoProps.hasOwnProperty('constructor')) {
1263 child = protoProps.constructor;
1264 } else {
1265 /** @ignore */
1266 child = function child() {
1267 parent.apply(this, arguments);
1268 };
1269 } // Inherit class (static) properties from parent.
1270
1271
1272 _.extend(child, parent); // Set the prototype chain to inherit from `parent`, without calling
1273 // `parent`'s constructor function.
1274
1275
1276 EmptyConstructor.prototype = parent.prototype;
1277 child.prototype = new EmptyConstructor(); // Add prototype properties (instance properties) to the subclass,
1278 // if supplied.
1279
1280 if (protoProps) {
1281 _.extend(child.prototype, protoProps);
1282 } // Add static properties to the constructor function, if supplied.
1283
1284
1285 if (staticProps) {
1286 _.extend(child, staticProps);
1287 } // Correctly set child's `prototype.constructor`.
1288
1289
1290 child.prototype.constructor = child; // Set a convenience property in case the parent's prototype is
1291 // needed later.
1292
1293 child.__super__ = parent.prototype;
1294 return child;
1295};
1296
1297var parseDate = function parseDate(iso8601) {
1298 return new Date(iso8601);
1299};
1300
1301var setValue = function setValue(target, key, value) {
1302 // '.' is not allowed in Class keys, escaping is not in concern now.
1303 var segs = key.split('.');
1304 var lastSeg = segs.pop();
1305 var currentTarget = target;
1306 segs.forEach(function (seg) {
1307 if (currentTarget[seg] === undefined) currentTarget[seg] = {};
1308 currentTarget = currentTarget[seg];
1309 });
1310 currentTarget[lastSeg] = value;
1311 return target;
1312};
1313
1314var findValue = function findValue(target, key) {
1315 var segs = key.split('.');
1316 var firstSeg = segs[0];
1317 var lastSeg = segs.pop();
1318 var currentTarget = target;
1319
1320 for (var i = 0; i < segs.length; i++) {
1321 currentTarget = currentTarget[segs[i]];
1322
1323 if (currentTarget === undefined) {
1324 return [undefined, undefined, lastSeg];
1325 }
1326 }
1327
1328 var value = currentTarget[lastSeg];
1329 return [value, currentTarget, lastSeg, firstSeg];
1330};
1331
1332var isPlainObject = function isPlainObject(obj) {
1333 return _.isObject(obj) && (0, _getPrototypeOf.default)(obj) === Object.prototype;
1334};
1335
1336var continueWhile = function continueWhile(predicate, asyncFunction) {
1337 if (predicate()) {
1338 return asyncFunction().then(function () {
1339 return continueWhile(predicate, asyncFunction);
1340 });
1341 }
1342
1343 return _promise.default.resolve();
1344};
1345
1346module.exports = {
1347 isNullOrUndefined: isNullOrUndefined,
1348 ensureArray: ensureArray,
1349 transformFetchOptions: transformFetchOptions,
1350 getSessionToken: getSessionToken,
1351 tap: tap,
1352 inherits: inherits,
1353 parseDate: parseDate,
1354 setValue: setValue,
1355 findValue: findValue,
1356 isPlainObject: isPlainObject,
1357 continueWhile: continueWhile
1358};
1359
1360/***/ }),
1361/* 33 */
1362/***/ (function(module, exports, __webpack_require__) {
1363
1364var requireObjectCoercible = __webpack_require__(81);
1365
1366var $Object = Object;
1367
1368// `ToObject` abstract operation
1369// https://tc39.es/ecma262/#sec-toobject
1370module.exports = function (argument) {
1371 return $Object(requireObjectCoercible(argument));
1372};
1373
1374
1375/***/ }),
1376/* 34 */
1377/***/ (function(module, exports, __webpack_require__) {
1378
1379module.exports = __webpack_require__(238);
1380
1381/***/ }),
1382/* 35 */
1383/***/ (function(module, exports, __webpack_require__) {
1384
1385// toObject with fallback for non-array-like ES3 strings
1386var IndexedObject = __webpack_require__(98);
1387var requireObjectCoercible = __webpack_require__(81);
1388
1389module.exports = function (it) {
1390 return IndexedObject(requireObjectCoercible(it));
1391};
1392
1393
1394/***/ }),
1395/* 36 */
1396/***/ (function(module, exports) {
1397
1398module.exports = true;
1399
1400
1401/***/ }),
1402/* 37 */
1403/***/ (function(module, exports, __webpack_require__) {
1404
1405module.exports = __webpack_require__(398);
1406
1407/***/ }),
1408/* 38 */
1409/***/ (function(module, exports, __webpack_require__) {
1410
1411module.exports = __webpack_require__(405);
1412
1413/***/ }),
1414/* 39 */
1415/***/ (function(module, exports, __webpack_require__) {
1416
1417var DESCRIPTORS = __webpack_require__(14);
1418var definePropertyModule = __webpack_require__(23);
1419var createPropertyDescriptor = __webpack_require__(49);
1420
1421module.exports = DESCRIPTORS ? function (object, key, value) {
1422 return definePropertyModule.f(object, key, createPropertyDescriptor(1, value));
1423} : function (object, key, value) {
1424 object[key] = value;
1425 return object;
1426};
1427
1428
1429/***/ }),
1430/* 40 */
1431/***/ (function(module, exports, __webpack_require__) {
1432
1433var toLength = __webpack_require__(295);
1434
1435// `LengthOfArrayLike` abstract operation
1436// https://tc39.es/ecma262/#sec-lengthofarraylike
1437module.exports = function (obj) {
1438 return toLength(obj.length);
1439};
1440
1441
1442/***/ }),
1443/* 41 */
1444/***/ (function(module, exports, __webpack_require__) {
1445
1446var bind = __webpack_require__(52);
1447var call = __webpack_require__(15);
1448var anObject = __webpack_require__(21);
1449var tryToString = __webpack_require__(67);
1450var isArrayIteratorMethod = __webpack_require__(165);
1451var lengthOfArrayLike = __webpack_require__(40);
1452var isPrototypeOf = __webpack_require__(16);
1453var getIterator = __webpack_require__(166);
1454var getIteratorMethod = __webpack_require__(108);
1455var iteratorClose = __webpack_require__(167);
1456
1457var $TypeError = TypeError;
1458
1459var Result = function (stopped, result) {
1460 this.stopped = stopped;
1461 this.result = result;
1462};
1463
1464var ResultPrototype = Result.prototype;
1465
1466module.exports = function (iterable, unboundFunction, options) {
1467 var that = options && options.that;
1468 var AS_ENTRIES = !!(options && options.AS_ENTRIES);
1469 var IS_ITERATOR = !!(options && options.IS_ITERATOR);
1470 var INTERRUPTED = !!(options && options.INTERRUPTED);
1471 var fn = bind(unboundFunction, that);
1472 var iterator, iterFn, index, length, result, next, step;
1473
1474 var stop = function (condition) {
1475 if (iterator) iteratorClose(iterator, 'normal', condition);
1476 return new Result(true, condition);
1477 };
1478
1479 var callFn = function (value) {
1480 if (AS_ENTRIES) {
1481 anObject(value);
1482 return INTERRUPTED ? fn(value[0], value[1], stop) : fn(value[0], value[1]);
1483 } return INTERRUPTED ? fn(value, stop) : fn(value);
1484 };
1485
1486 if (IS_ITERATOR) {
1487 iterator = iterable;
1488 } else {
1489 iterFn = getIteratorMethod(iterable);
1490 if (!iterFn) throw $TypeError(tryToString(iterable) + ' is not iterable');
1491 // optimisation for array iterators
1492 if (isArrayIteratorMethod(iterFn)) {
1493 for (index = 0, length = lengthOfArrayLike(iterable); length > index; index++) {
1494 result = callFn(iterable[index]);
1495 if (result && isPrototypeOf(ResultPrototype, result)) return result;
1496 } return new Result(false);
1497 }
1498 iterator = getIterator(iterable, iterFn);
1499 }
1500
1501 next = iterator.next;
1502 while (!(step = call(next, iterator)).done) {
1503 try {
1504 result = callFn(step.value);
1505 } catch (error) {
1506 iteratorClose(iterator, 'throw', error);
1507 }
1508 if (typeof result == 'object' && result && isPrototypeOf(ResultPrototype, result)) return result;
1509 } return new Result(false);
1510};
1511
1512
1513/***/ }),
1514/* 42 */
1515/***/ (function(module, exports, __webpack_require__) {
1516
1517var classof = __webpack_require__(55);
1518
1519var $String = String;
1520
1521module.exports = function (argument) {
1522 if (classof(argument) === 'Symbol') throw TypeError('Cannot convert a Symbol value to a string');
1523 return $String(argument);
1524};
1525
1526
1527/***/ }),
1528/* 43 */
1529/***/ (function(module, exports, __webpack_require__) {
1530
1531"use strict";
1532
1533var toIndexedObject = __webpack_require__(35);
1534var addToUnscopables = __webpack_require__(131);
1535var Iterators = __webpack_require__(54);
1536var InternalStateModule = __webpack_require__(44);
1537var defineProperty = __webpack_require__(23).f;
1538var defineIterator = __webpack_require__(133);
1539var IS_PURE = __webpack_require__(36);
1540var DESCRIPTORS = __webpack_require__(14);
1541
1542var ARRAY_ITERATOR = 'Array Iterator';
1543var setInternalState = InternalStateModule.set;
1544var getInternalState = InternalStateModule.getterFor(ARRAY_ITERATOR);
1545
1546// `Array.prototype.entries` method
1547// https://tc39.es/ecma262/#sec-array.prototype.entries
1548// `Array.prototype.keys` method
1549// https://tc39.es/ecma262/#sec-array.prototype.keys
1550// `Array.prototype.values` method
1551// https://tc39.es/ecma262/#sec-array.prototype.values
1552// `Array.prototype[@@iterator]` method
1553// https://tc39.es/ecma262/#sec-array.prototype-@@iterator
1554// `CreateArrayIterator` internal method
1555// https://tc39.es/ecma262/#sec-createarrayiterator
1556module.exports = defineIterator(Array, 'Array', function (iterated, kind) {
1557 setInternalState(this, {
1558 type: ARRAY_ITERATOR,
1559 target: toIndexedObject(iterated), // target
1560 index: 0, // next index
1561 kind: kind // kind
1562 });
1563// `%ArrayIteratorPrototype%.next` method
1564// https://tc39.es/ecma262/#sec-%arrayiteratorprototype%.next
1565}, function () {
1566 var state = getInternalState(this);
1567 var target = state.target;
1568 var kind = state.kind;
1569 var index = state.index++;
1570 if (!target || index >= target.length) {
1571 state.target = undefined;
1572 return { value: undefined, done: true };
1573 }
1574 if (kind == 'keys') return { value: index, done: false };
1575 if (kind == 'values') return { value: target[index], done: false };
1576 return { value: [index, target[index]], done: false };
1577}, 'values');
1578
1579// argumentsList[@@iterator] is %ArrayProto_values%
1580// https://tc39.es/ecma262/#sec-createunmappedargumentsobject
1581// https://tc39.es/ecma262/#sec-createmappedargumentsobject
1582var values = Iterators.Arguments = Iterators.Array;
1583
1584// https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
1585addToUnscopables('keys');
1586addToUnscopables('values');
1587addToUnscopables('entries');
1588
1589// V8 ~ Chrome 45- bug
1590if (!IS_PURE && DESCRIPTORS && values.name !== 'values') try {
1591 defineProperty(values, 'name', { value: 'values' });
1592} catch (error) { /* empty */ }
1593
1594
1595/***/ }),
1596/* 44 */
1597/***/ (function(module, exports, __webpack_require__) {
1598
1599var NATIVE_WEAK_MAP = __webpack_require__(168);
1600var global = __webpack_require__(8);
1601var uncurryThis = __webpack_require__(4);
1602var isObject = __webpack_require__(11);
1603var createNonEnumerableProperty = __webpack_require__(39);
1604var hasOwn = __webpack_require__(13);
1605var shared = __webpack_require__(123);
1606var sharedKey = __webpack_require__(103);
1607var hiddenKeys = __webpack_require__(83);
1608
1609var OBJECT_ALREADY_INITIALIZED = 'Object already initialized';
1610var TypeError = global.TypeError;
1611var WeakMap = global.WeakMap;
1612var set, get, has;
1613
1614var enforce = function (it) {
1615 return has(it) ? get(it) : set(it, {});
1616};
1617
1618var getterFor = function (TYPE) {
1619 return function (it) {
1620 var state;
1621 if (!isObject(it) || (state = get(it)).type !== TYPE) {
1622 throw TypeError('Incompatible receiver, ' + TYPE + ' required');
1623 } return state;
1624 };
1625};
1626
1627if (NATIVE_WEAK_MAP || shared.state) {
1628 var store = shared.state || (shared.state = new WeakMap());
1629 var wmget = uncurryThis(store.get);
1630 var wmhas = uncurryThis(store.has);
1631 var wmset = uncurryThis(store.set);
1632 set = function (it, metadata) {
1633 if (wmhas(store, it)) throw new TypeError(OBJECT_ALREADY_INITIALIZED);
1634 metadata.facade = it;
1635 wmset(store, it, metadata);
1636 return metadata;
1637 };
1638 get = function (it) {
1639 return wmget(store, it) || {};
1640 };
1641 has = function (it) {
1642 return wmhas(store, it);
1643 };
1644} else {
1645 var STATE = sharedKey('state');
1646 hiddenKeys[STATE] = true;
1647 set = function (it, metadata) {
1648 if (hasOwn(it, STATE)) throw new TypeError(OBJECT_ALREADY_INITIALIZED);
1649 metadata.facade = it;
1650 createNonEnumerableProperty(it, STATE, metadata);
1651 return metadata;
1652 };
1653 get = function (it) {
1654 return hasOwn(it, STATE) ? it[STATE] : {};
1655 };
1656 has = function (it) {
1657 return hasOwn(it, STATE);
1658 };
1659}
1660
1661module.exports = {
1662 set: set,
1663 get: get,
1664 has: has,
1665 enforce: enforce,
1666 getterFor: getterFor
1667};
1668
1669
1670/***/ }),
1671/* 45 */
1672/***/ (function(module, exports, __webpack_require__) {
1673
1674var createNonEnumerableProperty = __webpack_require__(39);
1675
1676module.exports = function (target, key, value, options) {
1677 if (options && options.enumerable) target[key] = value;
1678 else createNonEnumerableProperty(target, key, value);
1679 return target;
1680};
1681
1682
1683/***/ }),
1684/* 46 */
1685/***/ (function(module, exports, __webpack_require__) {
1686
1687__webpack_require__(43);
1688var DOMIterables = __webpack_require__(320);
1689var global = __webpack_require__(8);
1690var classof = __webpack_require__(55);
1691var createNonEnumerableProperty = __webpack_require__(39);
1692var Iterators = __webpack_require__(54);
1693var wellKnownSymbol = __webpack_require__(5);
1694
1695var TO_STRING_TAG = wellKnownSymbol('toStringTag');
1696
1697for (var COLLECTION_NAME in DOMIterables) {
1698 var Collection = global[COLLECTION_NAME];
1699 var CollectionPrototype = Collection && Collection.prototype;
1700 if (CollectionPrototype && classof(CollectionPrototype) !== TO_STRING_TAG) {
1701 createNonEnumerableProperty(CollectionPrototype, TO_STRING_TAG, COLLECTION_NAME);
1702 }
1703 Iterators[COLLECTION_NAME] = Iterators.Array;
1704}
1705
1706
1707/***/ }),
1708/* 47 */
1709/***/ (function(module, __webpack_exports__, __webpack_require__) {
1710
1711"use strict";
1712/* harmony export (immutable) */ __webpack_exports__["a"] = has;
1713/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(6);
1714
1715
1716// Internal function to check whether `key` is an own property name of `obj`.
1717function has(obj, key) {
1718 return obj != null && __WEBPACK_IMPORTED_MODULE_0__setup_js__["i" /* hasOwnProperty */].call(obj, key);
1719}
1720
1721
1722/***/ }),
1723/* 48 */
1724/***/ (function(module, exports, __webpack_require__) {
1725
1726"use strict";
1727
1728
1729var _interopRequireDefault = __webpack_require__(1);
1730
1731var _setPrototypeOf = _interopRequireDefault(__webpack_require__(420));
1732
1733var _getPrototypeOf = _interopRequireDefault(__webpack_require__(231));
1734
1735var _ = __webpack_require__(3);
1736/**
1737 * @class AV.Error
1738 */
1739
1740
1741function AVError(code, message) {
1742 if (this instanceof AVError ? this.constructor : void 0) {
1743 var error = new Error(message);
1744 (0, _setPrototypeOf.default)(error, (0, _getPrototypeOf.default)(this));
1745 error.code = code;
1746 return error;
1747 }
1748
1749 return new AVError(code, message);
1750}
1751
1752AVError.prototype = Object.create(Error.prototype, {
1753 constructor: {
1754 value: Error,
1755 enumerable: false,
1756 writable: true,
1757 configurable: true
1758 }
1759});
1760(0, _setPrototypeOf.default)(AVError, Error);
1761
1762_.extend(AVError,
1763/** @lends AV.Error */
1764{
1765 /**
1766 * Error code indicating some error other than those enumerated here.
1767 * @constant
1768 */
1769 OTHER_CAUSE: -1,
1770
1771 /**
1772 * Error code indicating that something has gone wrong with the server.
1773 * If you get this error code, it is AV's fault.
1774 * @constant
1775 */
1776 INTERNAL_SERVER_ERROR: 1,
1777
1778 /**
1779 * Error code indicating the connection to the AV servers failed.
1780 * @constant
1781 */
1782 CONNECTION_FAILED: 100,
1783
1784 /**
1785 * Error code indicating the specified object doesn't exist.
1786 * @constant
1787 */
1788 OBJECT_NOT_FOUND: 101,
1789
1790 /**
1791 * Error code indicating you tried to query with a datatype that doesn't
1792 * support it, like exact matching an array or object.
1793 * @constant
1794 */
1795 INVALID_QUERY: 102,
1796
1797 /**
1798 * Error code indicating a missing or invalid classname. Classnames are
1799 * case-sensitive. They must start with a letter, and a-zA-Z0-9_ are the
1800 * only valid characters.
1801 * @constant
1802 */
1803 INVALID_CLASS_NAME: 103,
1804
1805 /**
1806 * Error code indicating an unspecified object id.
1807 * @constant
1808 */
1809 MISSING_OBJECT_ID: 104,
1810
1811 /**
1812 * Error code indicating an invalid key name. Keys are case-sensitive. They
1813 * must start with a letter, and a-zA-Z0-9_ are the only valid characters.
1814 * @constant
1815 */
1816 INVALID_KEY_NAME: 105,
1817
1818 /**
1819 * Error code indicating a malformed pointer. You should not see this unless
1820 * you have been mucking about changing internal AV code.
1821 * @constant
1822 */
1823 INVALID_POINTER: 106,
1824
1825 /**
1826 * Error code indicating that badly formed JSON was received upstream. This
1827 * either indicates you have done something unusual with modifying how
1828 * things encode to JSON, or the network is failing badly.
1829 * @constant
1830 */
1831 INVALID_JSON: 107,
1832
1833 /**
1834 * Error code indicating that the feature you tried to access is only
1835 * available internally for testing purposes.
1836 * @constant
1837 */
1838 COMMAND_UNAVAILABLE: 108,
1839
1840 /**
1841 * You must call AV.initialize before using the AV library.
1842 * @constant
1843 */
1844 NOT_INITIALIZED: 109,
1845
1846 /**
1847 * Error code indicating that a field was set to an inconsistent type.
1848 * @constant
1849 */
1850 INCORRECT_TYPE: 111,
1851
1852 /**
1853 * Error code indicating an invalid channel name. A channel name is either
1854 * an empty string (the broadcast channel) or contains only a-zA-Z0-9_
1855 * characters.
1856 * @constant
1857 */
1858 INVALID_CHANNEL_NAME: 112,
1859
1860 /**
1861 * Error code indicating that push is misconfigured.
1862 * @constant
1863 */
1864 PUSH_MISCONFIGURED: 115,
1865
1866 /**
1867 * Error code indicating that the object is too large.
1868 * @constant
1869 */
1870 OBJECT_TOO_LARGE: 116,
1871
1872 /**
1873 * Error code indicating that the operation isn't allowed for clients.
1874 * @constant
1875 */
1876 OPERATION_FORBIDDEN: 119,
1877
1878 /**
1879 * Error code indicating the result was not found in the cache.
1880 * @constant
1881 */
1882 CACHE_MISS: 120,
1883
1884 /**
1885 * Error code indicating that an invalid key was used in a nested
1886 * JSONObject.
1887 * @constant
1888 */
1889 INVALID_NESTED_KEY: 121,
1890
1891 /**
1892 * Error code indicating that an invalid filename was used for AVFile.
1893 * A valid file name contains only a-zA-Z0-9_. characters and is between 1
1894 * and 128 characters.
1895 * @constant
1896 */
1897 INVALID_FILE_NAME: 122,
1898
1899 /**
1900 * Error code indicating an invalid ACL was provided.
1901 * @constant
1902 */
1903 INVALID_ACL: 123,
1904
1905 /**
1906 * Error code indicating that the request timed out on the server. Typically
1907 * this indicates that the request is too expensive to run.
1908 * @constant
1909 */
1910 TIMEOUT: 124,
1911
1912 /**
1913 * Error code indicating that the email address was invalid.
1914 * @constant
1915 */
1916 INVALID_EMAIL_ADDRESS: 125,
1917
1918 /**
1919 * Error code indicating a missing content type.
1920 * @constant
1921 */
1922 MISSING_CONTENT_TYPE: 126,
1923
1924 /**
1925 * Error code indicating a missing content length.
1926 * @constant
1927 */
1928 MISSING_CONTENT_LENGTH: 127,
1929
1930 /**
1931 * Error code indicating an invalid content length.
1932 * @constant
1933 */
1934 INVALID_CONTENT_LENGTH: 128,
1935
1936 /**
1937 * Error code indicating a file that was too large.
1938 * @constant
1939 */
1940 FILE_TOO_LARGE: 129,
1941
1942 /**
1943 * Error code indicating an error saving a file.
1944 * @constant
1945 */
1946 FILE_SAVE_ERROR: 130,
1947
1948 /**
1949 * Error code indicating an error deleting a file.
1950 * @constant
1951 */
1952 FILE_DELETE_ERROR: 153,
1953
1954 /**
1955 * Error code indicating that a unique field was given a value that is
1956 * already taken.
1957 * @constant
1958 */
1959 DUPLICATE_VALUE: 137,
1960
1961 /**
1962 * Error code indicating that a role's name is invalid.
1963 * @constant
1964 */
1965 INVALID_ROLE_NAME: 139,
1966
1967 /**
1968 * Error code indicating that an application quota was exceeded. Upgrade to
1969 * resolve.
1970 * @constant
1971 */
1972 EXCEEDED_QUOTA: 140,
1973
1974 /**
1975 * Error code indicating that a Cloud Code script failed.
1976 * @constant
1977 */
1978 SCRIPT_FAILED: 141,
1979
1980 /**
1981 * Error code indicating that a Cloud Code validation failed.
1982 * @constant
1983 */
1984 VALIDATION_ERROR: 142,
1985
1986 /**
1987 * Error code indicating that invalid image data was provided.
1988 * @constant
1989 */
1990 INVALID_IMAGE_DATA: 150,
1991
1992 /**
1993 * Error code indicating an unsaved file.
1994 * @constant
1995 */
1996 UNSAVED_FILE_ERROR: 151,
1997
1998 /**
1999 * Error code indicating an invalid push time.
2000 * @constant
2001 */
2002 INVALID_PUSH_TIME_ERROR: 152,
2003
2004 /**
2005 * Error code indicating that the username is missing or empty.
2006 * @constant
2007 */
2008 USERNAME_MISSING: 200,
2009
2010 /**
2011 * Error code indicating that the password is missing or empty.
2012 * @constant
2013 */
2014 PASSWORD_MISSING: 201,
2015
2016 /**
2017 * Error code indicating that the username has already been taken.
2018 * @constant
2019 */
2020 USERNAME_TAKEN: 202,
2021
2022 /**
2023 * Error code indicating that the email has already been taken.
2024 * @constant
2025 */
2026 EMAIL_TAKEN: 203,
2027
2028 /**
2029 * Error code indicating that the email is missing, but must be specified.
2030 * @constant
2031 */
2032 EMAIL_MISSING: 204,
2033
2034 /**
2035 * Error code indicating that a user with the specified email was not found.
2036 * @constant
2037 */
2038 EMAIL_NOT_FOUND: 205,
2039
2040 /**
2041 * Error code indicating that a user object without a valid session could
2042 * not be altered.
2043 * @constant
2044 */
2045 SESSION_MISSING: 206,
2046
2047 /**
2048 * Error code indicating that a user can only be created through signup.
2049 * @constant
2050 */
2051 MUST_CREATE_USER_THROUGH_SIGNUP: 207,
2052
2053 /**
2054 * Error code indicating that an an account being linked is already linked
2055 * to another user.
2056 * @constant
2057 */
2058 ACCOUNT_ALREADY_LINKED: 208,
2059
2060 /**
2061 * Error code indicating that a user cannot be linked to an account because
2062 * that account's id could not be found.
2063 * @constant
2064 */
2065 LINKED_ID_MISSING: 250,
2066
2067 /**
2068 * Error code indicating that a user with a linked (e.g. Facebook) account
2069 * has an invalid session.
2070 * @constant
2071 */
2072 INVALID_LINKED_SESSION: 251,
2073
2074 /**
2075 * Error code indicating that a service being linked (e.g. Facebook or
2076 * Twitter) is unsupported.
2077 * @constant
2078 */
2079 UNSUPPORTED_SERVICE: 252,
2080
2081 /**
2082 * Error code indicating a real error code is unavailable because
2083 * we had to use an XDomainRequest object to allow CORS requests in
2084 * Internet Explorer, which strips the body from HTTP responses that have
2085 * a non-2XX status code.
2086 * @constant
2087 */
2088 X_DOMAIN_REQUEST: 602
2089});
2090
2091module.exports = AVError;
2092
2093/***/ }),
2094/* 49 */
2095/***/ (function(module, exports) {
2096
2097module.exports = function (bitmap, value) {
2098 return {
2099 enumerable: !(bitmap & 1),
2100 configurable: !(bitmap & 2),
2101 writable: !(bitmap & 4),
2102 value: value
2103 };
2104};
2105
2106
2107/***/ }),
2108/* 50 */
2109/***/ (function(module, exports, __webpack_require__) {
2110
2111var uncurryThis = __webpack_require__(4);
2112
2113var toString = uncurryThis({}.toString);
2114var stringSlice = uncurryThis(''.slice);
2115
2116module.exports = function (it) {
2117 return stringSlice(toString(it), 8, -1);
2118};
2119
2120
2121/***/ }),
2122/* 51 */
2123/***/ (function(module, exports, __webpack_require__) {
2124
2125var getBuiltIn = __webpack_require__(20);
2126
2127module.exports = getBuiltIn('navigator', 'userAgent') || '';
2128
2129
2130/***/ }),
2131/* 52 */
2132/***/ (function(module, exports, __webpack_require__) {
2133
2134var uncurryThis = __webpack_require__(4);
2135var aCallable = __webpack_require__(29);
2136var NATIVE_BIND = __webpack_require__(80);
2137
2138var bind = uncurryThis(uncurryThis.bind);
2139
2140// optional / simple context binding
2141module.exports = function (fn, that) {
2142 aCallable(fn);
2143 return that === undefined ? fn : NATIVE_BIND ? bind(fn, that) : function (/* ...args */) {
2144 return fn.apply(that, arguments);
2145 };
2146};
2147
2148
2149/***/ }),
2150/* 53 */
2151/***/ (function(module, exports, __webpack_require__) {
2152
2153/* global ActiveXObject -- old IE, WSH */
2154var anObject = __webpack_require__(21);
2155var definePropertiesModule = __webpack_require__(129);
2156var enumBugKeys = __webpack_require__(128);
2157var hiddenKeys = __webpack_require__(83);
2158var html = __webpack_require__(164);
2159var documentCreateElement = __webpack_require__(124);
2160var sharedKey = __webpack_require__(103);
2161
2162var GT = '>';
2163var LT = '<';
2164var PROTOTYPE = 'prototype';
2165var SCRIPT = 'script';
2166var IE_PROTO = sharedKey('IE_PROTO');
2167
2168var EmptyConstructor = function () { /* empty */ };
2169
2170var scriptTag = function (content) {
2171 return LT + SCRIPT + GT + content + LT + '/' + SCRIPT + GT;
2172};
2173
2174// Create object with fake `null` prototype: use ActiveX Object with cleared prototype
2175var NullProtoObjectViaActiveX = function (activeXDocument) {
2176 activeXDocument.write(scriptTag(''));
2177 activeXDocument.close();
2178 var temp = activeXDocument.parentWindow.Object;
2179 activeXDocument = null; // avoid memory leak
2180 return temp;
2181};
2182
2183// Create object with fake `null` prototype: use iframe Object with cleared prototype
2184var NullProtoObjectViaIFrame = function () {
2185 // Thrash, waste and sodomy: IE GC bug
2186 var iframe = documentCreateElement('iframe');
2187 var JS = 'java' + SCRIPT + ':';
2188 var iframeDocument;
2189 iframe.style.display = 'none';
2190 html.appendChild(iframe);
2191 // https://github.com/zloirock/core-js/issues/475
2192 iframe.src = String(JS);
2193 iframeDocument = iframe.contentWindow.document;
2194 iframeDocument.open();
2195 iframeDocument.write(scriptTag('document.F=Object'));
2196 iframeDocument.close();
2197 return iframeDocument.F;
2198};
2199
2200// Check for document.domain and active x support
2201// No need to use active x approach when document.domain is not set
2202// see https://github.com/es-shims/es5-shim/issues/150
2203// variation of https://github.com/kitcambridge/es5-shim/commit/4f738ac066346
2204// avoid IE GC bug
2205var activeXDocument;
2206var NullProtoObject = function () {
2207 try {
2208 activeXDocument = new ActiveXObject('htmlfile');
2209 } catch (error) { /* ignore */ }
2210 NullProtoObject = typeof document != 'undefined'
2211 ? document.domain && activeXDocument
2212 ? NullProtoObjectViaActiveX(activeXDocument) // old IE
2213 : NullProtoObjectViaIFrame()
2214 : NullProtoObjectViaActiveX(activeXDocument); // WSH
2215 var length = enumBugKeys.length;
2216 while (length--) delete NullProtoObject[PROTOTYPE][enumBugKeys[length]];
2217 return NullProtoObject();
2218};
2219
2220hiddenKeys[IE_PROTO] = true;
2221
2222// `Object.create` method
2223// https://tc39.es/ecma262/#sec-object.create
2224// eslint-disable-next-line es-x/no-object-create -- safe
2225module.exports = Object.create || function create(O, Properties) {
2226 var result;
2227 if (O !== null) {
2228 EmptyConstructor[PROTOTYPE] = anObject(O);
2229 result = new EmptyConstructor();
2230 EmptyConstructor[PROTOTYPE] = null;
2231 // add "__proto__" for Object.getPrototypeOf polyfill
2232 result[IE_PROTO] = O;
2233 } else result = NullProtoObject();
2234 return Properties === undefined ? result : definePropertiesModule.f(result, Properties);
2235};
2236
2237
2238/***/ }),
2239/* 54 */
2240/***/ (function(module, exports) {
2241
2242module.exports = {};
2243
2244
2245/***/ }),
2246/* 55 */
2247/***/ (function(module, exports, __webpack_require__) {
2248
2249var TO_STRING_TAG_SUPPORT = __webpack_require__(130);
2250var isCallable = __webpack_require__(9);
2251var classofRaw = __webpack_require__(50);
2252var wellKnownSymbol = __webpack_require__(5);
2253
2254var TO_STRING_TAG = wellKnownSymbol('toStringTag');
2255var $Object = Object;
2256
2257// ES3 wrong here
2258var CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) == 'Arguments';
2259
2260// fallback for IE11 Script Access Denied error
2261var tryGet = function (it, key) {
2262 try {
2263 return it[key];
2264 } catch (error) { /* empty */ }
2265};
2266
2267// getting tag from ES6+ `Object.prototype.toString`
2268module.exports = TO_STRING_TAG_SUPPORT ? classofRaw : function (it) {
2269 var O, tag, result;
2270 return it === undefined ? 'Undefined' : it === null ? 'Null'
2271 // @@toStringTag case
2272 : typeof (tag = tryGet(O = $Object(it), TO_STRING_TAG)) == 'string' ? tag
2273 // builtinTag case
2274 : CORRECT_ARGUMENTS ? classofRaw(O)
2275 // ES3 arguments fallback
2276 : (result = classofRaw(O)) == 'Object' && isCallable(O.callee) ? 'Arguments' : result;
2277};
2278
2279
2280/***/ }),
2281/* 56 */
2282/***/ (function(module, exports, __webpack_require__) {
2283
2284var TO_STRING_TAG_SUPPORT = __webpack_require__(130);
2285var defineProperty = __webpack_require__(23).f;
2286var createNonEnumerableProperty = __webpack_require__(39);
2287var hasOwn = __webpack_require__(13);
2288var toString = __webpack_require__(301);
2289var wellKnownSymbol = __webpack_require__(5);
2290
2291var TO_STRING_TAG = wellKnownSymbol('toStringTag');
2292
2293module.exports = function (it, TAG, STATIC, SET_METHOD) {
2294 if (it) {
2295 var target = STATIC ? it : it.prototype;
2296 if (!hasOwn(target, TO_STRING_TAG)) {
2297 defineProperty(target, TO_STRING_TAG, { configurable: true, value: TAG });
2298 }
2299 if (SET_METHOD && !TO_STRING_TAG_SUPPORT) {
2300 createNonEnumerableProperty(target, 'toString', toString);
2301 }
2302 }
2303};
2304
2305
2306/***/ }),
2307/* 57 */
2308/***/ (function(module, exports, __webpack_require__) {
2309
2310"use strict";
2311
2312var aCallable = __webpack_require__(29);
2313
2314var PromiseCapability = function (C) {
2315 var resolve, reject;
2316 this.promise = new C(function ($$resolve, $$reject) {
2317 if (resolve !== undefined || reject !== undefined) throw TypeError('Bad Promise constructor');
2318 resolve = $$resolve;
2319 reject = $$reject;
2320 });
2321 this.resolve = aCallable(resolve);
2322 this.reject = aCallable(reject);
2323};
2324
2325// `NewPromiseCapability` abstract operation
2326// https://tc39.es/ecma262/#sec-newpromisecapability
2327module.exports.f = function (C) {
2328 return new PromiseCapability(C);
2329};
2330
2331
2332/***/ }),
2333/* 58 */
2334/***/ (function(module, __webpack_exports__, __webpack_require__) {
2335
2336"use strict";
2337/* harmony export (immutable) */ __webpack_exports__["a"] = isObject;
2338// Is a given variable an object?
2339function isObject(obj) {
2340 var type = typeof obj;
2341 return type === 'function' || type === 'object' && !!obj;
2342}
2343
2344
2345/***/ }),
2346/* 59 */
2347/***/ (function(module, __webpack_exports__, __webpack_require__) {
2348
2349"use strict";
2350/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(6);
2351/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__tagTester_js__ = __webpack_require__(18);
2352
2353
2354
2355// Is a given value an array?
2356// Delegates to ECMA5's native `Array.isArray`.
2357/* harmony default export */ __webpack_exports__["a"] = (__WEBPACK_IMPORTED_MODULE_0__setup_js__["k" /* nativeIsArray */] || Object(__WEBPACK_IMPORTED_MODULE_1__tagTester_js__["a" /* default */])('Array'));
2358
2359
2360/***/ }),
2361/* 60 */
2362/***/ (function(module, __webpack_exports__, __webpack_require__) {
2363
2364"use strict";
2365/* harmony export (immutable) */ __webpack_exports__["a"] = each;
2366/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__optimizeCb_js__ = __webpack_require__(89);
2367/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isArrayLike_js__ = __webpack_require__(26);
2368/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__keys_js__ = __webpack_require__(17);
2369
2370
2371
2372
2373// The cornerstone for collection functions, an `each`
2374// implementation, aka `forEach`.
2375// Handles raw objects in addition to array-likes. Treats all
2376// sparse array-likes as if they were dense.
2377function each(obj, iteratee, context) {
2378 iteratee = Object(__WEBPACK_IMPORTED_MODULE_0__optimizeCb_js__["a" /* default */])(iteratee, context);
2379 var i, length;
2380 if (Object(__WEBPACK_IMPORTED_MODULE_1__isArrayLike_js__["a" /* default */])(obj)) {
2381 for (i = 0, length = obj.length; i < length; i++) {
2382 iteratee(obj[i], i, obj);
2383 }
2384 } else {
2385 var _keys = Object(__WEBPACK_IMPORTED_MODULE_2__keys_js__["a" /* default */])(obj);
2386 for (i = 0, length = _keys.length; i < length; i++) {
2387 iteratee(obj[_keys[i]], _keys[i], obj);
2388 }
2389 }
2390 return obj;
2391}
2392
2393
2394/***/ }),
2395/* 61 */
2396/***/ (function(module, exports, __webpack_require__) {
2397
2398module.exports = __webpack_require__(407);
2399
2400/***/ }),
2401/* 62 */
2402/***/ (function(module, exports, __webpack_require__) {
2403
2404module.exports = __webpack_require__(411);
2405
2406/***/ }),
2407/* 63 */
2408/***/ (function(module, exports, __webpack_require__) {
2409
2410"use strict";
2411
2412
2413function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
2414
2415/* eslint-env browser */
2416
2417/**
2418 * This is the web browser implementation of `debug()`.
2419 */
2420exports.log = log;
2421exports.formatArgs = formatArgs;
2422exports.save = save;
2423exports.load = load;
2424exports.useColors = useColors;
2425exports.storage = localstorage();
2426/**
2427 * Colors.
2428 */
2429
2430exports.colors = ['#0000CC', '#0000FF', '#0033CC', '#0033FF', '#0066CC', '#0066FF', '#0099CC', '#0099FF', '#00CC00', '#00CC33', '#00CC66', '#00CC99', '#00CCCC', '#00CCFF', '#3300CC', '#3300FF', '#3333CC', '#3333FF', '#3366CC', '#3366FF', '#3399CC', '#3399FF', '#33CC00', '#33CC33', '#33CC66', '#33CC99', '#33CCCC', '#33CCFF', '#6600CC', '#6600FF', '#6633CC', '#6633FF', '#66CC00', '#66CC33', '#9900CC', '#9900FF', '#9933CC', '#9933FF', '#99CC00', '#99CC33', '#CC0000', '#CC0033', '#CC0066', '#CC0099', '#CC00CC', '#CC00FF', '#CC3300', '#CC3333', '#CC3366', '#CC3399', '#CC33CC', '#CC33FF', '#CC6600', '#CC6633', '#CC9900', '#CC9933', '#CCCC00', '#CCCC33', '#FF0000', '#FF0033', '#FF0066', '#FF0099', '#FF00CC', '#FF00FF', '#FF3300', '#FF3333', '#FF3366', '#FF3399', '#FF33CC', '#FF33FF', '#FF6600', '#FF6633', '#FF9900', '#FF9933', '#FFCC00', '#FFCC33'];
2431/**
2432 * Currently only WebKit-based Web Inspectors, Firefox >= v31,
2433 * and the Firebug extension (any Firefox version) are known
2434 * to support "%c" CSS customizations.
2435 *
2436 * TODO: add a `localStorage` variable to explicitly enable/disable colors
2437 */
2438// eslint-disable-next-line complexity
2439
2440function useColors() {
2441 // NB: In an Electron preload script, document will be defined but not fully
2442 // initialized. Since we know we're in Chrome, we'll just detect this case
2443 // explicitly
2444 if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) {
2445 return true;
2446 } // Internet Explorer and Edge do not support colors.
2447
2448
2449 if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
2450 return false;
2451 } // Is webkit? http://stackoverflow.com/a/16459606/376773
2452 // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
2453
2454
2455 return typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || // Is firebug? http://stackoverflow.com/a/398120/376773
2456 typeof window !== 'undefined' && window.console && (window.console.firebug || window.console.exception && window.console.table) || // Is firefox >= v31?
2457 // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
2458 typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31 || // Double check webkit in userAgent just in case we are in a worker
2459 typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/);
2460}
2461/**
2462 * Colorize log arguments if enabled.
2463 *
2464 * @api public
2465 */
2466
2467
2468function formatArgs(args) {
2469 args[0] = (this.useColors ? '%c' : '') + this.namespace + (this.useColors ? ' %c' : ' ') + args[0] + (this.useColors ? '%c ' : ' ') + '+' + module.exports.humanize(this.diff);
2470
2471 if (!this.useColors) {
2472 return;
2473 }
2474
2475 var c = 'color: ' + this.color;
2476 args.splice(1, 0, c, 'color: inherit'); // The final "%c" is somewhat tricky, because there could be other
2477 // arguments passed either before or after the %c, so we need to
2478 // figure out the correct index to insert the CSS into
2479
2480 var index = 0;
2481 var lastC = 0;
2482 args[0].replace(/%[a-zA-Z%]/g, function (match) {
2483 if (match === '%%') {
2484 return;
2485 }
2486
2487 index++;
2488
2489 if (match === '%c') {
2490 // We only are interested in the *last* %c
2491 // (the user may have provided their own)
2492 lastC = index;
2493 }
2494 });
2495 args.splice(lastC, 0, c);
2496}
2497/**
2498 * Invokes `console.log()` when available.
2499 * No-op when `console.log` is not a "function".
2500 *
2501 * @api public
2502 */
2503
2504
2505function log() {
2506 var _console;
2507
2508 // This hackery is required for IE8/9, where
2509 // the `console.log` function doesn't have 'apply'
2510 return (typeof console === "undefined" ? "undefined" : _typeof(console)) === 'object' && console.log && (_console = console).log.apply(_console, arguments);
2511}
2512/**
2513 * Save `namespaces`.
2514 *
2515 * @param {String} namespaces
2516 * @api private
2517 */
2518
2519
2520function save(namespaces) {
2521 try {
2522 if (namespaces) {
2523 exports.storage.setItem('debug', namespaces);
2524 } else {
2525 exports.storage.removeItem('debug');
2526 }
2527 } catch (error) {// Swallow
2528 // XXX (@Qix-) should we be logging these?
2529 }
2530}
2531/**
2532 * Load `namespaces`.
2533 *
2534 * @return {String} returns the previously persisted debug modes
2535 * @api private
2536 */
2537
2538
2539function load() {
2540 var r;
2541
2542 try {
2543 r = exports.storage.getItem('debug');
2544 } catch (error) {} // Swallow
2545 // XXX (@Qix-) should we be logging these?
2546 // If debug isn't set in LS, and we're in Electron, try to load $DEBUG
2547
2548
2549 if (!r && typeof process !== 'undefined' && 'env' in process) {
2550 r = process.env.DEBUG;
2551 }
2552
2553 return r;
2554}
2555/**
2556 * Localstorage attempts to return the localstorage.
2557 *
2558 * This is necessary because safari throws
2559 * when a user disables cookies/localstorage
2560 * and you attempt to access it.
2561 *
2562 * @return {LocalStorage}
2563 * @api private
2564 */
2565
2566
2567function localstorage() {
2568 try {
2569 // TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context
2570 // The Browser also has localStorage in the global context.
2571 return localStorage;
2572 } catch (error) {// Swallow
2573 // XXX (@Qix-) should we be logging these?
2574 }
2575}
2576
2577module.exports = __webpack_require__(416)(exports);
2578var formatters = module.exports.formatters;
2579/**
2580 * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
2581 */
2582
2583formatters.j = function (v) {
2584 try {
2585 return JSON.stringify(v);
2586 } catch (error) {
2587 return '[UnexpectedJSONParseError]: ' + error.message;
2588 }
2589};
2590
2591
2592
2593/***/ }),
2594/* 64 */
2595/***/ (function(module, exports, __webpack_require__) {
2596
2597var DESCRIPTORS = __webpack_require__(14);
2598var call = __webpack_require__(15);
2599var propertyIsEnumerableModule = __webpack_require__(121);
2600var createPropertyDescriptor = __webpack_require__(49);
2601var toIndexedObject = __webpack_require__(35);
2602var toPropertyKey = __webpack_require__(99);
2603var hasOwn = __webpack_require__(13);
2604var IE8_DOM_DEFINE = __webpack_require__(158);
2605
2606// eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
2607var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
2608
2609// `Object.getOwnPropertyDescriptor` method
2610// https://tc39.es/ecma262/#sec-object.getownpropertydescriptor
2611exports.f = DESCRIPTORS ? $getOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {
2612 O = toIndexedObject(O);
2613 P = toPropertyKey(P);
2614 if (IE8_DOM_DEFINE) try {
2615 return $getOwnPropertyDescriptor(O, P);
2616 } catch (error) { /* empty */ }
2617 if (hasOwn(O, P)) return createPropertyDescriptor(!call(propertyIsEnumerableModule.f, O, P), O[P]);
2618};
2619
2620
2621/***/ }),
2622/* 65 */
2623/***/ (function(module, exports, __webpack_require__) {
2624
2625/* eslint-disable es-x/no-symbol -- required for testing */
2626var V8_VERSION = __webpack_require__(66);
2627var fails = __webpack_require__(2);
2628
2629// eslint-disable-next-line es-x/no-object-getownpropertysymbols -- required for testing
2630module.exports = !!Object.getOwnPropertySymbols && !fails(function () {
2631 var symbol = Symbol();
2632 // Chrome 38 Symbol has incorrect toString conversion
2633 // `get-own-property-symbols` polyfill symbols converted to object are not Symbol instances
2634 return !String(symbol) || !(Object(symbol) instanceof Symbol) ||
2635 // Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances
2636 !Symbol.sham && V8_VERSION && V8_VERSION < 41;
2637});
2638
2639
2640/***/ }),
2641/* 66 */
2642/***/ (function(module, exports, __webpack_require__) {
2643
2644var global = __webpack_require__(8);
2645var userAgent = __webpack_require__(51);
2646
2647var process = global.process;
2648var Deno = global.Deno;
2649var versions = process && process.versions || Deno && Deno.version;
2650var v8 = versions && versions.v8;
2651var match, version;
2652
2653if (v8) {
2654 match = v8.split('.');
2655 // in old Chrome, versions of V8 isn't V8 = Chrome / 10
2656 // but their correct versions are not interesting for us
2657 version = match[0] > 0 && match[0] < 4 ? 1 : +(match[0] + match[1]);
2658}
2659
2660// BrowserFS NodeJS `process` polyfill incorrectly set `.v8` to `0.0`
2661// so check `userAgent` even if `.v8` exists, but 0
2662if (!version && userAgent) {
2663 match = userAgent.match(/Edge\/(\d+)/);
2664 if (!match || match[1] >= 74) {
2665 match = userAgent.match(/Chrome\/(\d+)/);
2666 if (match) version = +match[1];
2667 }
2668}
2669
2670module.exports = version;
2671
2672
2673/***/ }),
2674/* 67 */
2675/***/ (function(module, exports) {
2676
2677var $String = String;
2678
2679module.exports = function (argument) {
2680 try {
2681 return $String(argument);
2682 } catch (error) {
2683 return 'Object';
2684 }
2685};
2686
2687
2688/***/ }),
2689/* 68 */
2690/***/ (function(module, exports) {
2691
2692// empty
2693
2694
2695/***/ }),
2696/* 69 */
2697/***/ (function(module, exports, __webpack_require__) {
2698
2699var global = __webpack_require__(8);
2700
2701module.exports = global.Promise;
2702
2703
2704/***/ }),
2705/* 70 */
2706/***/ (function(module, exports, __webpack_require__) {
2707
2708"use strict";
2709
2710var charAt = __webpack_require__(319).charAt;
2711var toString = __webpack_require__(42);
2712var InternalStateModule = __webpack_require__(44);
2713var defineIterator = __webpack_require__(133);
2714
2715var STRING_ITERATOR = 'String Iterator';
2716var setInternalState = InternalStateModule.set;
2717var getInternalState = InternalStateModule.getterFor(STRING_ITERATOR);
2718
2719// `String.prototype[@@iterator]` method
2720// https://tc39.es/ecma262/#sec-string.prototype-@@iterator
2721defineIterator(String, 'String', function (iterated) {
2722 setInternalState(this, {
2723 type: STRING_ITERATOR,
2724 string: toString(iterated),
2725 index: 0
2726 });
2727// `%StringIteratorPrototype%.next` method
2728// https://tc39.es/ecma262/#sec-%stringiteratorprototype%.next
2729}, function next() {
2730 var state = getInternalState(this);
2731 var string = state.string;
2732 var index = state.index;
2733 var point;
2734 if (index >= string.length) return { value: undefined, done: true };
2735 point = charAt(string, index);
2736 state.index += point.length;
2737 return { value: point, done: false };
2738});
2739
2740
2741/***/ }),
2742/* 71 */
2743/***/ (function(module, __webpack_exports__, __webpack_require__) {
2744
2745"use strict";
2746/* harmony export (immutable) */ __webpack_exports__["a"] = values;
2747/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__keys_js__ = __webpack_require__(17);
2748
2749
2750// Retrieve the values of an object's properties.
2751function values(obj) {
2752 var _keys = Object(__WEBPACK_IMPORTED_MODULE_0__keys_js__["a" /* default */])(obj);
2753 var length = _keys.length;
2754 var values = Array(length);
2755 for (var i = 0; i < length; i++) {
2756 values[i] = obj[_keys[i]];
2757 }
2758 return values;
2759}
2760
2761
2762/***/ }),
2763/* 72 */
2764/***/ (function(module, __webpack_exports__, __webpack_require__) {
2765
2766"use strict";
2767/* harmony export (immutable) */ __webpack_exports__["a"] = flatten;
2768/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__getLength_js__ = __webpack_require__(31);
2769/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isArrayLike_js__ = __webpack_require__(26);
2770/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__isArray_js__ = __webpack_require__(59);
2771/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__isArguments_js__ = __webpack_require__(137);
2772
2773
2774
2775
2776
2777// Internal implementation of a recursive `flatten` function.
2778function flatten(input, depth, strict, output) {
2779 output = output || [];
2780 if (!depth && depth !== 0) {
2781 depth = Infinity;
2782 } else if (depth <= 0) {
2783 return output.concat(input);
2784 }
2785 var idx = output.length;
2786 for (var i = 0, length = Object(__WEBPACK_IMPORTED_MODULE_0__getLength_js__["a" /* default */])(input); i < length; i++) {
2787 var value = input[i];
2788 if (Object(__WEBPACK_IMPORTED_MODULE_1__isArrayLike_js__["a" /* default */])(value) && (Object(__WEBPACK_IMPORTED_MODULE_2__isArray_js__["a" /* default */])(value) || Object(__WEBPACK_IMPORTED_MODULE_3__isArguments_js__["a" /* default */])(value))) {
2789 // Flatten current level of array or arguments object.
2790 if (depth > 1) {
2791 flatten(value, depth - 1, strict, output);
2792 idx = output.length;
2793 } else {
2794 var j = 0, len = value.length;
2795 while (j < len) output[idx++] = value[j++];
2796 }
2797 } else if (!strict) {
2798 output[idx++] = value;
2799 }
2800 }
2801 return output;
2802}
2803
2804
2805/***/ }),
2806/* 73 */
2807/***/ (function(module, __webpack_exports__, __webpack_require__) {
2808
2809"use strict";
2810/* harmony export (immutable) */ __webpack_exports__["a"] = map;
2811/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(22);
2812/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isArrayLike_js__ = __webpack_require__(26);
2813/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__keys_js__ = __webpack_require__(17);
2814
2815
2816
2817
2818// Return the results of applying the iteratee to each element.
2819function map(obj, iteratee, context) {
2820 iteratee = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(iteratee, context);
2821 var _keys = !Object(__WEBPACK_IMPORTED_MODULE_1__isArrayLike_js__["a" /* default */])(obj) && Object(__WEBPACK_IMPORTED_MODULE_2__keys_js__["a" /* default */])(obj),
2822 length = (_keys || obj).length,
2823 results = Array(length);
2824 for (var index = 0; index < length; index++) {
2825 var currentKey = _keys ? _keys[index] : index;
2826 results[index] = iteratee(obj[currentKey], currentKey, obj);
2827 }
2828 return results;
2829}
2830
2831
2832/***/ }),
2833/* 74 */
2834/***/ (function(module, exports, __webpack_require__) {
2835
2836"use strict";
2837/* WEBPACK VAR INJECTION */(function(global) {
2838
2839var _interopRequireDefault = __webpack_require__(1);
2840
2841var _promise = _interopRequireDefault(__webpack_require__(12));
2842
2843var _concat = _interopRequireDefault(__webpack_require__(19));
2844
2845var _map = _interopRequireDefault(__webpack_require__(37));
2846
2847var _keys = _interopRequireDefault(__webpack_require__(149));
2848
2849var _stringify = _interopRequireDefault(__webpack_require__(38));
2850
2851var _indexOf = _interopRequireDefault(__webpack_require__(61));
2852
2853var _keys2 = _interopRequireDefault(__webpack_require__(62));
2854
2855var _ = __webpack_require__(3);
2856
2857var uuid = __webpack_require__(230);
2858
2859var debug = __webpack_require__(63);
2860
2861var _require = __webpack_require__(32),
2862 inherits = _require.inherits,
2863 parseDate = _require.parseDate;
2864
2865var version = __webpack_require__(233);
2866
2867var _require2 = __webpack_require__(76),
2868 setAdapters = _require2.setAdapters,
2869 adapterManager = _require2.adapterManager;
2870
2871var AV = global.AV || {}; // All internal configuration items
2872
2873AV._config = {
2874 serverURLs: {},
2875 useMasterKey: false,
2876 production: null,
2877 realtime: null,
2878 requestTimeout: null
2879};
2880var initialUserAgent = "LeanCloud-JS-SDK/".concat(version); // configs shared by all AV instances
2881
2882AV._sharedConfig = {
2883 userAgent: initialUserAgent,
2884 liveQueryRealtime: null
2885};
2886adapterManager.on('platformInfo', function (platformInfo) {
2887 var ua = initialUserAgent;
2888
2889 if (platformInfo) {
2890 if (platformInfo.userAgent) {
2891 ua = platformInfo.userAgent;
2892 } else {
2893 var comments = platformInfo.name;
2894
2895 if (platformInfo.version) {
2896 comments += "/".concat(platformInfo.version);
2897 }
2898
2899 if (platformInfo.extra) {
2900 comments += "; ".concat(platformInfo.extra);
2901 }
2902
2903 ua += " (".concat(comments, ")");
2904 }
2905 }
2906
2907 AV._sharedConfig.userAgent = ua;
2908});
2909/**
2910 * Contains all AV API classes and functions.
2911 * @namespace AV
2912 */
2913
2914/**
2915 * Returns prefix for localStorage keys used by this instance of AV.
2916 * @param {String} path The relative suffix to append to it.
2917 * null or undefined is treated as the empty string.
2918 * @return {String} The full key name.
2919 * @private
2920 */
2921
2922AV._getAVPath = function (path) {
2923 if (!AV.applicationId) {
2924 throw new Error('You need to call AV.initialize before using AV.');
2925 }
2926
2927 if (!path) {
2928 path = '';
2929 }
2930
2931 if (!_.isString(path)) {
2932 throw new Error("Tried to get a localStorage path that wasn't a String.");
2933 }
2934
2935 if (path[0] === '/') {
2936 path = path.substring(1);
2937 }
2938
2939 return 'AV/' + AV.applicationId + '/' + path;
2940};
2941/**
2942 * Returns the unique string for this app on this machine.
2943 * Gets reset when localStorage is cleared.
2944 * @private
2945 */
2946
2947
2948AV._installationId = null;
2949
2950AV._getInstallationId = function () {
2951 // See if it's cached in RAM.
2952 if (AV._installationId) {
2953 return _promise.default.resolve(AV._installationId);
2954 } // Try to get it from localStorage.
2955
2956
2957 var path = AV._getAVPath('installationId');
2958
2959 return AV.localStorage.getItemAsync(path).then(function (_installationId) {
2960 AV._installationId = _installationId;
2961
2962 if (!AV._installationId) {
2963 // It wasn't in localStorage, so create a new one.
2964 AV._installationId = _installationId = uuid();
2965 return AV.localStorage.setItemAsync(path, _installationId).then(function () {
2966 return _installationId;
2967 });
2968 }
2969
2970 return _installationId;
2971 });
2972};
2973
2974AV._subscriptionId = null;
2975
2976AV._refreshSubscriptionId = function () {
2977 var path = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : AV._getAVPath('subscriptionId');
2978 var subscriptionId = AV._subscriptionId = uuid();
2979 return AV.localStorage.setItemAsync(path, subscriptionId).then(function () {
2980 return subscriptionId;
2981 });
2982};
2983
2984AV._getSubscriptionId = function () {
2985 // See if it's cached in RAM.
2986 if (AV._subscriptionId) {
2987 return _promise.default.resolve(AV._subscriptionId);
2988 } // Try to get it from localStorage.
2989
2990
2991 var path = AV._getAVPath('subscriptionId');
2992
2993 return AV.localStorage.getItemAsync(path).then(function (_subscriptionId) {
2994 AV._subscriptionId = _subscriptionId;
2995
2996 if (!AV._subscriptionId) {
2997 // It wasn't in localStorage, so create a new one.
2998 _subscriptionId = AV._refreshSubscriptionId(path);
2999 }
3000
3001 return _subscriptionId;
3002 });
3003};
3004
3005AV._parseDate = parseDate; // A self-propagating extend function.
3006
3007AV._extend = function (protoProps, classProps) {
3008 var child = inherits(this, protoProps, classProps);
3009 child.extend = this.extend;
3010 return child;
3011};
3012/**
3013 * Converts a value in a AV Object into the appropriate representation.
3014 * This is the JS equivalent of Java's AV.maybeReferenceAndEncode(Object)
3015 * if seenObjects is falsey. Otherwise any AV.Objects not in
3016 * seenObjects will be fully embedded rather than encoded
3017 * as a pointer. This array will be used to prevent going into an infinite
3018 * loop because we have circular references. If <seenObjects>
3019 * is set, then none of the AV Objects that are serialized can be dirty.
3020 * @private
3021 */
3022
3023
3024AV._encode = function (value, seenObjects, disallowObjects) {
3025 var full = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
3026
3027 if (value instanceof AV.Object) {
3028 if (disallowObjects) {
3029 throw new Error('AV.Objects not allowed here');
3030 }
3031
3032 if (!seenObjects || _.include(seenObjects, value) || !value._hasData) {
3033 return value._toPointer();
3034 }
3035
3036 return value._toFullJSON((0, _concat.default)(seenObjects).call(seenObjects, value), full);
3037 }
3038
3039 if (value instanceof AV.ACL) {
3040 return value.toJSON();
3041 }
3042
3043 if (_.isDate(value)) {
3044 return full ? {
3045 __type: 'Date',
3046 iso: value.toJSON()
3047 } : value.toJSON();
3048 }
3049
3050 if (value instanceof AV.GeoPoint) {
3051 return value.toJSON();
3052 }
3053
3054 if (_.isArray(value)) {
3055 return (0, _map.default)(_).call(_, value, function (x) {
3056 return AV._encode(x, seenObjects, disallowObjects, full);
3057 });
3058 }
3059
3060 if (_.isRegExp(value)) {
3061 return value.source;
3062 }
3063
3064 if (value instanceof AV.Relation) {
3065 return value.toJSON();
3066 }
3067
3068 if (value instanceof AV.Op) {
3069 return value.toJSON();
3070 }
3071
3072 if (value instanceof AV.File) {
3073 if (!value.url() && !value.id) {
3074 throw new Error('Tried to save an object containing an unsaved file.');
3075 }
3076
3077 return value._toFullJSON(seenObjects, full);
3078 }
3079
3080 if (_.isObject(value)) {
3081 return _.mapObject(value, function (v, k) {
3082 return AV._encode(v, seenObjects, disallowObjects, full);
3083 });
3084 }
3085
3086 return value;
3087};
3088/**
3089 * The inverse function of AV._encode.
3090 * @private
3091 */
3092
3093
3094AV._decode = function (value, key) {
3095 if (!_.isObject(value) || _.isDate(value)) {
3096 return value;
3097 }
3098
3099 if (_.isArray(value)) {
3100 return (0, _map.default)(_).call(_, value, function (v) {
3101 return AV._decode(v);
3102 });
3103 }
3104
3105 if (value instanceof AV.Object) {
3106 return value;
3107 }
3108
3109 if (value instanceof AV.File) {
3110 return value;
3111 }
3112
3113 if (value instanceof AV.Op) {
3114 return value;
3115 }
3116
3117 if (value instanceof AV.GeoPoint) {
3118 return value;
3119 }
3120
3121 if (value instanceof AV.ACL) {
3122 return value;
3123 }
3124
3125 if (key === 'ACL') {
3126 return new AV.ACL(value);
3127 }
3128
3129 if (value.__op) {
3130 return AV.Op._decode(value);
3131 }
3132
3133 var className;
3134
3135 if (value.__type === 'Pointer') {
3136 className = value.className;
3137
3138 var pointer = AV.Object._create(className);
3139
3140 if ((0, _keys.default)(value).length > 3) {
3141 var v = _.clone(value);
3142
3143 delete v.__type;
3144 delete v.className;
3145
3146 pointer._finishFetch(v, true);
3147 } else {
3148 pointer._finishFetch({
3149 objectId: value.objectId
3150 }, false);
3151 }
3152
3153 return pointer;
3154 }
3155
3156 if (value.__type === 'Object') {
3157 // It's an Object included in a query result.
3158 className = value.className;
3159
3160 var _v = _.clone(value);
3161
3162 delete _v.__type;
3163 delete _v.className;
3164
3165 var object = AV.Object._create(className);
3166
3167 object._finishFetch(_v, true);
3168
3169 return object;
3170 }
3171
3172 if (value.__type === 'Date') {
3173 return AV._parseDate(value.iso);
3174 }
3175
3176 if (value.__type === 'GeoPoint') {
3177 return new AV.GeoPoint({
3178 latitude: value.latitude,
3179 longitude: value.longitude
3180 });
3181 }
3182
3183 if (value.__type === 'Relation') {
3184 if (!key) throw new Error('key missing decoding a Relation');
3185 var relation = new AV.Relation(null, key);
3186 relation.targetClassName = value.className;
3187 return relation;
3188 }
3189
3190 if (value.__type === 'File') {
3191 var file = new AV.File(value.name);
3192
3193 var _v2 = _.clone(value);
3194
3195 delete _v2.__type;
3196
3197 file._finishFetch(_v2);
3198
3199 return file;
3200 }
3201
3202 return _.mapObject(value, AV._decode);
3203};
3204/**
3205 * The inverse function of {@link AV.Object#toFullJSON}.
3206 * @since 3.0.0
3207 * @method
3208 * @param {Object}
3209 * return {AV.Object|AV.File|any}
3210 */
3211
3212
3213AV.parseJSON = AV._decode;
3214/**
3215 * Similar to JSON.parse, except that AV internal types will be used if possible.
3216 * Inverse to {@link AV.stringify}
3217 * @since 3.14.0
3218 * @param {string} text the string to parse.
3219 * @return {AV.Object|AV.File|any}
3220 */
3221
3222AV.parse = function (text) {
3223 return AV.parseJSON(JSON.parse(text));
3224};
3225/**
3226 * Serialize a target containing AV.Object, similar to JSON.stringify.
3227 * Inverse to {@link AV.parse}
3228 * @since 3.14.0
3229 * @return {string}
3230 */
3231
3232
3233AV.stringify = function (target) {
3234 return (0, _stringify.default)(AV._encode(target, [], false, true));
3235};
3236
3237AV._encodeObjectOrArray = function (value) {
3238 var encodeAVObject = function encodeAVObject(object) {
3239 if (object && object._toFullJSON) {
3240 object = object._toFullJSON([]);
3241 }
3242
3243 return _.mapObject(object, function (value) {
3244 return AV._encode(value, []);
3245 });
3246 };
3247
3248 if (_.isArray(value)) {
3249 return (0, _map.default)(value).call(value, function (object) {
3250 return encodeAVObject(object);
3251 });
3252 } else {
3253 return encodeAVObject(value);
3254 }
3255};
3256
3257AV._arrayEach = _.each;
3258/**
3259 * Does a deep traversal of every item in object, calling func on every one.
3260 * @param {Object} object The object or array to traverse deeply.
3261 * @param {Function} func The function to call for every item. It will
3262 * be passed the item as an argument. If it returns a truthy value, that
3263 * value will replace the item in its parent container.
3264 * @returns {} the result of calling func on the top-level object itself.
3265 * @private
3266 */
3267
3268AV._traverse = function (object, func, seen) {
3269 if (object instanceof AV.Object) {
3270 seen = seen || [];
3271
3272 if ((0, _indexOf.default)(_).call(_, seen, object) >= 0) {
3273 // We've already visited this object in this call.
3274 return;
3275 }
3276
3277 seen.push(object);
3278
3279 AV._traverse(object.attributes, func, seen);
3280
3281 return func(object);
3282 }
3283
3284 if (object instanceof AV.Relation || object instanceof AV.File) {
3285 // Nothing needs to be done, but we don't want to recurse into the
3286 // object's parent infinitely, so we catch this case.
3287 return func(object);
3288 }
3289
3290 if (_.isArray(object)) {
3291 _.each(object, function (child, index) {
3292 var newChild = AV._traverse(child, func, seen);
3293
3294 if (newChild) {
3295 object[index] = newChild;
3296 }
3297 });
3298
3299 return func(object);
3300 }
3301
3302 if (_.isObject(object)) {
3303 AV._each(object, function (child, key) {
3304 var newChild = AV._traverse(child, func, seen);
3305
3306 if (newChild) {
3307 object[key] = newChild;
3308 }
3309 });
3310
3311 return func(object);
3312 }
3313
3314 return func(object);
3315};
3316/**
3317 * This is like _.each, except:
3318 * * it doesn't work for so-called array-like objects,
3319 * * it does work for dictionaries with a "length" attribute.
3320 * @private
3321 */
3322
3323
3324AV._objectEach = AV._each = function (obj, callback) {
3325 if (_.isObject(obj)) {
3326 _.each((0, _keys2.default)(_).call(_, obj), function (key) {
3327 callback(obj[key], key);
3328 });
3329 } else {
3330 _.each(obj, callback);
3331 }
3332};
3333/**
3334 * @namespace
3335 * @since 3.14.0
3336 */
3337
3338
3339AV.debug = {
3340 /**
3341 * Enable debug
3342 */
3343 enable: function enable() {
3344 var namespaces = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'leancloud*';
3345 return debug.enable(namespaces);
3346 },
3347
3348 /**
3349 * Disable debug
3350 */
3351 disable: debug.disable
3352};
3353/**
3354 * Specify Adapters
3355 * @since 4.4.0
3356 * @function
3357 * @param {Adapters} newAdapters See {@link https://url.leanapp.cn/adapter-type-definitions @leancloud/adapter-types} for detailed definitions.
3358 */
3359
3360AV.setAdapters = setAdapters;
3361module.exports = AV;
3362/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(78)))
3363
3364/***/ }),
3365/* 75 */
3366/***/ (function(module, exports, __webpack_require__) {
3367
3368var bind = __webpack_require__(52);
3369var uncurryThis = __webpack_require__(4);
3370var IndexedObject = __webpack_require__(98);
3371var toObject = __webpack_require__(33);
3372var lengthOfArrayLike = __webpack_require__(40);
3373var arraySpeciesCreate = __webpack_require__(228);
3374
3375var push = uncurryThis([].push);
3376
3377// `Array.prototype.{ forEach, map, filter, some, every, find, findIndex, filterReject }` methods implementation
3378var createMethod = function (TYPE) {
3379 var IS_MAP = TYPE == 1;
3380 var IS_FILTER = TYPE == 2;
3381 var IS_SOME = TYPE == 3;
3382 var IS_EVERY = TYPE == 4;
3383 var IS_FIND_INDEX = TYPE == 6;
3384 var IS_FILTER_REJECT = TYPE == 7;
3385 var NO_HOLES = TYPE == 5 || IS_FIND_INDEX;
3386 return function ($this, callbackfn, that, specificCreate) {
3387 var O = toObject($this);
3388 var self = IndexedObject(O);
3389 var boundFunction = bind(callbackfn, that);
3390 var length = lengthOfArrayLike(self);
3391 var index = 0;
3392 var create = specificCreate || arraySpeciesCreate;
3393 var target = IS_MAP ? create($this, length) : IS_FILTER || IS_FILTER_REJECT ? create($this, 0) : undefined;
3394 var value, result;
3395 for (;length > index; index++) if (NO_HOLES || index in self) {
3396 value = self[index];
3397 result = boundFunction(value, index, O);
3398 if (TYPE) {
3399 if (IS_MAP) target[index] = result; // map
3400 else if (result) switch (TYPE) {
3401 case 3: return true; // some
3402 case 5: return value; // find
3403 case 6: return index; // findIndex
3404 case 2: push(target, value); // filter
3405 } else switch (TYPE) {
3406 case 4: return false; // every
3407 case 7: push(target, value); // filterReject
3408 }
3409 }
3410 }
3411 return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : target;
3412 };
3413};
3414
3415module.exports = {
3416 // `Array.prototype.forEach` method
3417 // https://tc39.es/ecma262/#sec-array.prototype.foreach
3418 forEach: createMethod(0),
3419 // `Array.prototype.map` method
3420 // https://tc39.es/ecma262/#sec-array.prototype.map
3421 map: createMethod(1),
3422 // `Array.prototype.filter` method
3423 // https://tc39.es/ecma262/#sec-array.prototype.filter
3424 filter: createMethod(2),
3425 // `Array.prototype.some` method
3426 // https://tc39.es/ecma262/#sec-array.prototype.some
3427 some: createMethod(3),
3428 // `Array.prototype.every` method
3429 // https://tc39.es/ecma262/#sec-array.prototype.every
3430 every: createMethod(4),
3431 // `Array.prototype.find` method
3432 // https://tc39.es/ecma262/#sec-array.prototype.find
3433 find: createMethod(5),
3434 // `Array.prototype.findIndex` method
3435 // https://tc39.es/ecma262/#sec-array.prototype.findIndex
3436 findIndex: createMethod(6),
3437 // `Array.prototype.filterReject` method
3438 // https://github.com/tc39/proposal-array-filtering
3439 filterReject: createMethod(7)
3440};
3441
3442
3443/***/ }),
3444/* 76 */
3445/***/ (function(module, exports, __webpack_require__) {
3446
3447"use strict";
3448
3449
3450var _interopRequireDefault = __webpack_require__(1);
3451
3452var _keys = _interopRequireDefault(__webpack_require__(62));
3453
3454var _ = __webpack_require__(3);
3455
3456var EventEmitter = __webpack_require__(234);
3457
3458var _require = __webpack_require__(32),
3459 inherits = _require.inherits;
3460
3461var AdapterManager = inherits(EventEmitter, {
3462 constructor: function constructor() {
3463 EventEmitter.apply(this);
3464 this._adapters = {};
3465 },
3466 getAdapter: function getAdapter(name) {
3467 var adapter = this._adapters[name];
3468
3469 if (adapter === undefined) {
3470 throw new Error("".concat(name, " adapter is not configured"));
3471 }
3472
3473 return adapter;
3474 },
3475 setAdapters: function setAdapters(newAdapters) {
3476 var _this = this;
3477
3478 _.extend(this._adapters, newAdapters);
3479
3480 (0, _keys.default)(_).call(_, newAdapters).forEach(function (name) {
3481 return _this.emit(name, newAdapters[name]);
3482 });
3483 }
3484});
3485var adapterManager = new AdapterManager();
3486module.exports = {
3487 getAdapter: adapterManager.getAdapter.bind(adapterManager),
3488 setAdapters: adapterManager.setAdapters.bind(adapterManager),
3489 adapterManager: adapterManager
3490};
3491
3492/***/ }),
3493/* 77 */
3494/***/ (function(module, exports, __webpack_require__) {
3495
3496module.exports = __webpack_require__(241);
3497
3498/***/ }),
3499/* 78 */
3500/***/ (function(module, exports) {
3501
3502var g;
3503
3504// This works in non-strict mode
3505g = (function() {
3506 return this;
3507})();
3508
3509try {
3510 // This works if eval is allowed (see CSP)
3511 g = g || Function("return this")() || (1,eval)("this");
3512} catch(e) {
3513 // This works if the window reference is available
3514 if(typeof window === "object")
3515 g = window;
3516}
3517
3518// g can still be undefined, but nothing to do about it...
3519// We return undefined, instead of nothing here, so it's
3520// easier to handle this case. if(!global) { ...}
3521
3522module.exports = g;
3523
3524
3525/***/ }),
3526/* 79 */
3527/***/ (function(module, exports, __webpack_require__) {
3528
3529var NATIVE_BIND = __webpack_require__(80);
3530
3531var FunctionPrototype = Function.prototype;
3532var apply = FunctionPrototype.apply;
3533var call = FunctionPrototype.call;
3534
3535// eslint-disable-next-line es-x/no-reflect -- safe
3536module.exports = typeof Reflect == 'object' && Reflect.apply || (NATIVE_BIND ? call.bind(apply) : function () {
3537 return call.apply(apply, arguments);
3538});
3539
3540
3541/***/ }),
3542/* 80 */
3543/***/ (function(module, exports, __webpack_require__) {
3544
3545var fails = __webpack_require__(2);
3546
3547module.exports = !fails(function () {
3548 // eslint-disable-next-line es-x/no-function-prototype-bind -- safe
3549 var test = (function () { /* empty */ }).bind();
3550 // eslint-disable-next-line no-prototype-builtins -- safe
3551 return typeof test != 'function' || test.hasOwnProperty('prototype');
3552});
3553
3554
3555/***/ }),
3556/* 81 */
3557/***/ (function(module, exports) {
3558
3559var $TypeError = TypeError;
3560
3561// `RequireObjectCoercible` abstract operation
3562// https://tc39.es/ecma262/#sec-requireobjectcoercible
3563module.exports = function (it) {
3564 if (it == undefined) throw $TypeError("Can't call method on " + it);
3565 return it;
3566};
3567
3568
3569/***/ }),
3570/* 82 */
3571/***/ (function(module, exports, __webpack_require__) {
3572
3573var IS_PURE = __webpack_require__(36);
3574var store = __webpack_require__(123);
3575
3576(module.exports = function (key, value) {
3577 return store[key] || (store[key] = value !== undefined ? value : {});
3578})('versions', []).push({
3579 version: '3.23.3',
3580 mode: IS_PURE ? 'pure' : 'global',
3581 copyright: '© 2014-2022 Denis Pushkarev (zloirock.ru)',
3582 license: 'https://github.com/zloirock/core-js/blob/v3.23.3/LICENSE',
3583 source: 'https://github.com/zloirock/core-js'
3584});
3585
3586
3587/***/ }),
3588/* 83 */
3589/***/ (function(module, exports) {
3590
3591module.exports = {};
3592
3593
3594/***/ }),
3595/* 84 */
3596/***/ (function(module, exports) {
3597
3598module.exports = function (exec) {
3599 try {
3600 return { error: false, value: exec() };
3601 } catch (error) {
3602 return { error: true, value: error };
3603 }
3604};
3605
3606
3607/***/ }),
3608/* 85 */
3609/***/ (function(module, exports, __webpack_require__) {
3610
3611var global = __webpack_require__(8);
3612var NativePromiseConstructor = __webpack_require__(69);
3613var isCallable = __webpack_require__(9);
3614var isForced = __webpack_require__(159);
3615var inspectSource = __webpack_require__(132);
3616var wellKnownSymbol = __webpack_require__(5);
3617var IS_BROWSER = __webpack_require__(310);
3618var IS_PURE = __webpack_require__(36);
3619var V8_VERSION = __webpack_require__(66);
3620
3621var NativePromisePrototype = NativePromiseConstructor && NativePromiseConstructor.prototype;
3622var SPECIES = wellKnownSymbol('species');
3623var SUBCLASSING = false;
3624var NATIVE_PROMISE_REJECTION_EVENT = isCallable(global.PromiseRejectionEvent);
3625
3626var FORCED_PROMISE_CONSTRUCTOR = isForced('Promise', function () {
3627 var PROMISE_CONSTRUCTOR_SOURCE = inspectSource(NativePromiseConstructor);
3628 var GLOBAL_CORE_JS_PROMISE = PROMISE_CONSTRUCTOR_SOURCE !== String(NativePromiseConstructor);
3629 // V8 6.6 (Node 10 and Chrome 66) have a bug with resolving custom thenables
3630 // https://bugs.chromium.org/p/chromium/issues/detail?id=830565
3631 // We can't detect it synchronously, so just check versions
3632 if (!GLOBAL_CORE_JS_PROMISE && V8_VERSION === 66) return true;
3633 // We need Promise#{ catch, finally } in the pure version for preventing prototype pollution
3634 if (IS_PURE && !(NativePromisePrototype['catch'] && NativePromisePrototype['finally'])) return true;
3635 // We can't use @@species feature detection in V8 since it causes
3636 // deoptimization and performance degradation
3637 // https://github.com/zloirock/core-js/issues/679
3638 if (V8_VERSION >= 51 && /native code/.test(PROMISE_CONSTRUCTOR_SOURCE)) return false;
3639 // Detect correctness of subclassing with @@species support
3640 var promise = new NativePromiseConstructor(function (resolve) { resolve(1); });
3641 var FakePromise = function (exec) {
3642 exec(function () { /* empty */ }, function () { /* empty */ });
3643 };
3644 var constructor = promise.constructor = {};
3645 constructor[SPECIES] = FakePromise;
3646 SUBCLASSING = promise.then(function () { /* empty */ }) instanceof FakePromise;
3647 if (!SUBCLASSING) return true;
3648 // Unhandled rejections tracking support, NodeJS Promise without it fails @@species test
3649 return !GLOBAL_CORE_JS_PROMISE && IS_BROWSER && !NATIVE_PROMISE_REJECTION_EVENT;
3650});
3651
3652module.exports = {
3653 CONSTRUCTOR: FORCED_PROMISE_CONSTRUCTOR,
3654 REJECTION_EVENT: NATIVE_PROMISE_REJECTION_EVENT,
3655 SUBCLASSING: SUBCLASSING
3656};
3657
3658
3659/***/ }),
3660/* 86 */
3661/***/ (function(module, __webpack_exports__, __webpack_require__) {
3662
3663"use strict";
3664/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return hasStringTagBug; });
3665/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return isIE11; });
3666/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(6);
3667/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__hasObjectTag_js__ = __webpack_require__(327);
3668
3669
3670
3671// In IE 10 - Edge 13, `DataView` has string tag `'[object Object]'`.
3672// In IE 11, the most common among them, this problem also applies to
3673// `Map`, `WeakMap` and `Set`.
3674var hasStringTagBug = (
3675 __WEBPACK_IMPORTED_MODULE_0__setup_js__["s" /* supportsDataView */] && Object(__WEBPACK_IMPORTED_MODULE_1__hasObjectTag_js__["a" /* default */])(new DataView(new ArrayBuffer(8)))
3676 ),
3677 isIE11 = (typeof Map !== 'undefined' && Object(__WEBPACK_IMPORTED_MODULE_1__hasObjectTag_js__["a" /* default */])(new Map));
3678
3679
3680/***/ }),
3681/* 87 */
3682/***/ (function(module, __webpack_exports__, __webpack_require__) {
3683
3684"use strict";
3685/* harmony export (immutable) */ __webpack_exports__["a"] = allKeys;
3686/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isObject_js__ = __webpack_require__(58);
3687/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__setup_js__ = __webpack_require__(6);
3688/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__collectNonEnumProps_js__ = __webpack_require__(189);
3689
3690
3691
3692
3693// Retrieve all the enumerable property names of an object.
3694function allKeys(obj) {
3695 if (!Object(__WEBPACK_IMPORTED_MODULE_0__isObject_js__["a" /* default */])(obj)) return [];
3696 var keys = [];
3697 for (var key in obj) keys.push(key);
3698 // Ahem, IE < 9.
3699 if (__WEBPACK_IMPORTED_MODULE_1__setup_js__["h" /* hasEnumBug */]) Object(__WEBPACK_IMPORTED_MODULE_2__collectNonEnumProps_js__["a" /* default */])(obj, keys);
3700 return keys;
3701}
3702
3703
3704/***/ }),
3705/* 88 */
3706/***/ (function(module, __webpack_exports__, __webpack_require__) {
3707
3708"use strict";
3709/* harmony export (immutable) */ __webpack_exports__["a"] = toPath;
3710/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__underscore_js__ = __webpack_require__(25);
3711/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__toPath_js__ = __webpack_require__(198);
3712
3713
3714
3715// Internal wrapper for `_.toPath` to enable minification.
3716// Similar to `cb` for `_.iteratee`.
3717function toPath(path) {
3718 return __WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */].toPath(path);
3719}
3720
3721
3722/***/ }),
3723/* 89 */
3724/***/ (function(module, __webpack_exports__, __webpack_require__) {
3725
3726"use strict";
3727/* harmony export (immutable) */ __webpack_exports__["a"] = optimizeCb;
3728// Internal function that returns an efficient (for current engines) version
3729// of the passed-in callback, to be repeatedly applied in other Underscore
3730// functions.
3731function optimizeCb(func, context, argCount) {
3732 if (context === void 0) return func;
3733 switch (argCount == null ? 3 : argCount) {
3734 case 1: return function(value) {
3735 return func.call(context, value);
3736 };
3737 // The 2-argument case is omitted because we’re not using it.
3738 case 3: return function(value, index, collection) {
3739 return func.call(context, value, index, collection);
3740 };
3741 case 4: return function(accumulator, value, index, collection) {
3742 return func.call(context, accumulator, value, index, collection);
3743 };
3744 }
3745 return function() {
3746 return func.apply(context, arguments);
3747 };
3748}
3749
3750
3751/***/ }),
3752/* 90 */
3753/***/ (function(module, __webpack_exports__, __webpack_require__) {
3754
3755"use strict";
3756/* harmony export (immutable) */ __webpack_exports__["a"] = filter;
3757/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(22);
3758/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__each_js__ = __webpack_require__(60);
3759
3760
3761
3762// Return all the elements that pass a truth test.
3763function filter(obj, predicate, context) {
3764 var results = [];
3765 predicate = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(predicate, context);
3766 Object(__WEBPACK_IMPORTED_MODULE_1__each_js__["a" /* default */])(obj, function(value, index, list) {
3767 if (predicate(value, index, list)) results.push(value);
3768 });
3769 return results;
3770}
3771
3772
3773/***/ }),
3774/* 91 */
3775/***/ (function(module, __webpack_exports__, __webpack_require__) {
3776
3777"use strict";
3778/* harmony export (immutable) */ __webpack_exports__["a"] = contains;
3779/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__ = __webpack_require__(26);
3780/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__values_js__ = __webpack_require__(71);
3781/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__indexOf_js__ = __webpack_require__(214);
3782
3783
3784
3785
3786// Determine if the array or object contains a given item (using `===`).
3787function contains(obj, item, fromIndex, guard) {
3788 if (!Object(__WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__["a" /* default */])(obj)) obj = Object(__WEBPACK_IMPORTED_MODULE_1__values_js__["a" /* default */])(obj);
3789 if (typeof fromIndex != 'number' || guard) fromIndex = 0;
3790 return Object(__WEBPACK_IMPORTED_MODULE_2__indexOf_js__["a" /* default */])(obj, item, fromIndex) >= 0;
3791}
3792
3793
3794/***/ }),
3795/* 92 */
3796/***/ (function(module, exports, __webpack_require__) {
3797
3798var classof = __webpack_require__(50);
3799
3800// `IsArray` abstract operation
3801// https://tc39.es/ecma262/#sec-isarray
3802// eslint-disable-next-line es-x/no-array-isarray -- safe
3803module.exports = Array.isArray || function isArray(argument) {
3804 return classof(argument) == 'Array';
3805};
3806
3807
3808/***/ }),
3809/* 93 */
3810/***/ (function(module, exports, __webpack_require__) {
3811
3812"use strict";
3813
3814var toPropertyKey = __webpack_require__(99);
3815var definePropertyModule = __webpack_require__(23);
3816var createPropertyDescriptor = __webpack_require__(49);
3817
3818module.exports = function (object, key, value) {
3819 var propertyKey = toPropertyKey(key);
3820 if (propertyKey in object) definePropertyModule.f(object, propertyKey, createPropertyDescriptor(0, value));
3821 else object[propertyKey] = value;
3822};
3823
3824
3825/***/ }),
3826/* 94 */
3827/***/ (function(module, exports, __webpack_require__) {
3828
3829module.exports = __webpack_require__(239);
3830
3831/***/ }),
3832/* 95 */
3833/***/ (function(module, exports, __webpack_require__) {
3834
3835var _Symbol = __webpack_require__(240);
3836
3837var _Symbol$iterator = __webpack_require__(462);
3838
3839function _typeof(obj) {
3840 "@babel/helpers - typeof";
3841
3842 return (module.exports = _typeof = "function" == typeof _Symbol && "symbol" == typeof _Symbol$iterator ? function (obj) {
3843 return typeof obj;
3844 } : function (obj) {
3845 return obj && "function" == typeof _Symbol && obj.constructor === _Symbol && obj !== _Symbol.prototype ? "symbol" : typeof obj;
3846 }, module.exports.__esModule = true, module.exports["default"] = module.exports), _typeof(obj);
3847}
3848
3849module.exports = _typeof, module.exports.__esModule = true, module.exports["default"] = module.exports;
3850
3851/***/ }),
3852/* 96 */
3853/***/ (function(module, exports, __webpack_require__) {
3854
3855module.exports = __webpack_require__(475);
3856
3857/***/ }),
3858/* 97 */
3859/***/ (function(module, exports, __webpack_require__) {
3860
3861var $ = __webpack_require__(0);
3862var uncurryThis = __webpack_require__(4);
3863var hiddenKeys = __webpack_require__(83);
3864var isObject = __webpack_require__(11);
3865var hasOwn = __webpack_require__(13);
3866var defineProperty = __webpack_require__(23).f;
3867var getOwnPropertyNamesModule = __webpack_require__(105);
3868var getOwnPropertyNamesExternalModule = __webpack_require__(243);
3869var isExtensible = __webpack_require__(264);
3870var uid = __webpack_require__(101);
3871var FREEZING = __webpack_require__(263);
3872
3873var REQUIRED = false;
3874var METADATA = uid('meta');
3875var id = 0;
3876
3877var setMetadata = function (it) {
3878 defineProperty(it, METADATA, { value: {
3879 objectID: 'O' + id++, // object ID
3880 weakData: {} // weak collections IDs
3881 } });
3882};
3883
3884var fastKey = function (it, create) {
3885 // return a primitive with prefix
3886 if (!isObject(it)) return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it;
3887 if (!hasOwn(it, METADATA)) {
3888 // can't set metadata to uncaught frozen object
3889 if (!isExtensible(it)) return 'F';
3890 // not necessary to add metadata
3891 if (!create) return 'E';
3892 // add missing metadata
3893 setMetadata(it);
3894 // return object ID
3895 } return it[METADATA].objectID;
3896};
3897
3898var getWeakData = function (it, create) {
3899 if (!hasOwn(it, METADATA)) {
3900 // can't set metadata to uncaught frozen object
3901 if (!isExtensible(it)) return true;
3902 // not necessary to add metadata
3903 if (!create) return false;
3904 // add missing metadata
3905 setMetadata(it);
3906 // return the store of weak collections IDs
3907 } return it[METADATA].weakData;
3908};
3909
3910// add metadata on freeze-family methods calling
3911var onFreeze = function (it) {
3912 if (FREEZING && REQUIRED && isExtensible(it) && !hasOwn(it, METADATA)) setMetadata(it);
3913 return it;
3914};
3915
3916var enable = function () {
3917 meta.enable = function () { /* empty */ };
3918 REQUIRED = true;
3919 var getOwnPropertyNames = getOwnPropertyNamesModule.f;
3920 var splice = uncurryThis([].splice);
3921 var test = {};
3922 test[METADATA] = 1;
3923
3924 // prevent exposing of metadata key
3925 if (getOwnPropertyNames(test).length) {
3926 getOwnPropertyNamesModule.f = function (it) {
3927 var result = getOwnPropertyNames(it);
3928 for (var i = 0, length = result.length; i < length; i++) {
3929 if (result[i] === METADATA) {
3930 splice(result, i, 1);
3931 break;
3932 }
3933 } return result;
3934 };
3935
3936 $({ target: 'Object', stat: true, forced: true }, {
3937 getOwnPropertyNames: getOwnPropertyNamesExternalModule.f
3938 });
3939 }
3940};
3941
3942var meta = module.exports = {
3943 enable: enable,
3944 fastKey: fastKey,
3945 getWeakData: getWeakData,
3946 onFreeze: onFreeze
3947};
3948
3949hiddenKeys[METADATA] = true;
3950
3951
3952/***/ }),
3953/* 98 */
3954/***/ (function(module, exports, __webpack_require__) {
3955
3956var uncurryThis = __webpack_require__(4);
3957var fails = __webpack_require__(2);
3958var classof = __webpack_require__(50);
3959
3960var $Object = Object;
3961var split = uncurryThis(''.split);
3962
3963// fallback for non-array-like ES3 and non-enumerable old V8 strings
3964module.exports = fails(function () {
3965 // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
3966 // eslint-disable-next-line no-prototype-builtins -- safe
3967 return !$Object('z').propertyIsEnumerable(0);
3968}) ? function (it) {
3969 return classof(it) == 'String' ? split(it, '') : $Object(it);
3970} : $Object;
3971
3972
3973/***/ }),
3974/* 99 */
3975/***/ (function(module, exports, __webpack_require__) {
3976
3977var toPrimitive = __webpack_require__(289);
3978var isSymbol = __webpack_require__(100);
3979
3980// `ToPropertyKey` abstract operation
3981// https://tc39.es/ecma262/#sec-topropertykey
3982module.exports = function (argument) {
3983 var key = toPrimitive(argument, 'string');
3984 return isSymbol(key) ? key : key + '';
3985};
3986
3987
3988/***/ }),
3989/* 100 */
3990/***/ (function(module, exports, __webpack_require__) {
3991
3992var getBuiltIn = __webpack_require__(20);
3993var isCallable = __webpack_require__(9);
3994var isPrototypeOf = __webpack_require__(16);
3995var USE_SYMBOL_AS_UID = __webpack_require__(157);
3996
3997var $Object = Object;
3998
3999module.exports = USE_SYMBOL_AS_UID ? function (it) {
4000 return typeof it == 'symbol';
4001} : function (it) {
4002 var $Symbol = getBuiltIn('Symbol');
4003 return isCallable($Symbol) && isPrototypeOf($Symbol.prototype, $Object(it));
4004};
4005
4006
4007/***/ }),
4008/* 101 */
4009/***/ (function(module, exports, __webpack_require__) {
4010
4011var uncurryThis = __webpack_require__(4);
4012
4013var id = 0;
4014var postfix = Math.random();
4015var toString = uncurryThis(1.0.toString);
4016
4017module.exports = function (key) {
4018 return 'Symbol(' + (key === undefined ? '' : key) + ')_' + toString(++id + postfix, 36);
4019};
4020
4021
4022/***/ }),
4023/* 102 */
4024/***/ (function(module, exports, __webpack_require__) {
4025
4026var hasOwn = __webpack_require__(13);
4027var isCallable = __webpack_require__(9);
4028var toObject = __webpack_require__(33);
4029var sharedKey = __webpack_require__(103);
4030var CORRECT_PROTOTYPE_GETTER = __webpack_require__(161);
4031
4032var IE_PROTO = sharedKey('IE_PROTO');
4033var $Object = Object;
4034var ObjectPrototype = $Object.prototype;
4035
4036// `Object.getPrototypeOf` method
4037// https://tc39.es/ecma262/#sec-object.getprototypeof
4038// eslint-disable-next-line es-x/no-object-getprototypeof -- safe
4039module.exports = CORRECT_PROTOTYPE_GETTER ? $Object.getPrototypeOf : function (O) {
4040 var object = toObject(O);
4041 if (hasOwn(object, IE_PROTO)) return object[IE_PROTO];
4042 var constructor = object.constructor;
4043 if (isCallable(constructor) && object instanceof constructor) {
4044 return constructor.prototype;
4045 } return object instanceof $Object ? ObjectPrototype : null;
4046};
4047
4048
4049/***/ }),
4050/* 103 */
4051/***/ (function(module, exports, __webpack_require__) {
4052
4053var shared = __webpack_require__(82);
4054var uid = __webpack_require__(101);
4055
4056var keys = shared('keys');
4057
4058module.exports = function (key) {
4059 return keys[key] || (keys[key] = uid(key));
4060};
4061
4062
4063/***/ }),
4064/* 104 */
4065/***/ (function(module, exports, __webpack_require__) {
4066
4067/* eslint-disable no-proto -- safe */
4068var uncurryThis = __webpack_require__(4);
4069var anObject = __webpack_require__(21);
4070var aPossiblePrototype = __webpack_require__(292);
4071
4072// `Object.setPrototypeOf` method
4073// https://tc39.es/ecma262/#sec-object.setprototypeof
4074// Works with __proto__ only. Old v8 can't work with null proto objects.
4075// eslint-disable-next-line es-x/no-object-setprototypeof -- safe
4076module.exports = Object.setPrototypeOf || ('__proto__' in {} ? function () {
4077 var CORRECT_SETTER = false;
4078 var test = {};
4079 var setter;
4080 try {
4081 // eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
4082 setter = uncurryThis(Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set);
4083 setter(test, []);
4084 CORRECT_SETTER = test instanceof Array;
4085 } catch (error) { /* empty */ }
4086 return function setPrototypeOf(O, proto) {
4087 anObject(O);
4088 aPossiblePrototype(proto);
4089 if (CORRECT_SETTER) setter(O, proto);
4090 else O.__proto__ = proto;
4091 return O;
4092 };
4093}() : undefined);
4094
4095
4096/***/ }),
4097/* 105 */
4098/***/ (function(module, exports, __webpack_require__) {
4099
4100var internalObjectKeys = __webpack_require__(163);
4101var enumBugKeys = __webpack_require__(128);
4102
4103var hiddenKeys = enumBugKeys.concat('length', 'prototype');
4104
4105// `Object.getOwnPropertyNames` method
4106// https://tc39.es/ecma262/#sec-object.getownpropertynames
4107// eslint-disable-next-line es-x/no-object-getownpropertynames -- safe
4108exports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
4109 return internalObjectKeys(O, hiddenKeys);
4110};
4111
4112
4113/***/ }),
4114/* 106 */
4115/***/ (function(module, exports) {
4116
4117// eslint-disable-next-line es-x/no-object-getownpropertysymbols -- safe
4118exports.f = Object.getOwnPropertySymbols;
4119
4120
4121/***/ }),
4122/* 107 */
4123/***/ (function(module, exports, __webpack_require__) {
4124
4125var internalObjectKeys = __webpack_require__(163);
4126var enumBugKeys = __webpack_require__(128);
4127
4128// `Object.keys` method
4129// https://tc39.es/ecma262/#sec-object.keys
4130// eslint-disable-next-line es-x/no-object-keys -- safe
4131module.exports = Object.keys || function keys(O) {
4132 return internalObjectKeys(O, enumBugKeys);
4133};
4134
4135
4136/***/ }),
4137/* 108 */
4138/***/ (function(module, exports, __webpack_require__) {
4139
4140var classof = __webpack_require__(55);
4141var getMethod = __webpack_require__(122);
4142var Iterators = __webpack_require__(54);
4143var wellKnownSymbol = __webpack_require__(5);
4144
4145var ITERATOR = wellKnownSymbol('iterator');
4146
4147module.exports = function (it) {
4148 if (it != undefined) return getMethod(it, ITERATOR)
4149 || getMethod(it, '@@iterator')
4150 || Iterators[classof(it)];
4151};
4152
4153
4154/***/ }),
4155/* 109 */
4156/***/ (function(module, exports, __webpack_require__) {
4157
4158var classof = __webpack_require__(50);
4159var global = __webpack_require__(8);
4160
4161module.exports = classof(global.process) == 'process';
4162
4163
4164/***/ }),
4165/* 110 */
4166/***/ (function(module, exports, __webpack_require__) {
4167
4168var isPrototypeOf = __webpack_require__(16);
4169
4170var $TypeError = TypeError;
4171
4172module.exports = function (it, Prototype) {
4173 if (isPrototypeOf(Prototype, it)) return it;
4174 throw $TypeError('Incorrect invocation');
4175};
4176
4177
4178/***/ }),
4179/* 111 */
4180/***/ (function(module, exports, __webpack_require__) {
4181
4182var uncurryThis = __webpack_require__(4);
4183var fails = __webpack_require__(2);
4184var isCallable = __webpack_require__(9);
4185var classof = __webpack_require__(55);
4186var getBuiltIn = __webpack_require__(20);
4187var inspectSource = __webpack_require__(132);
4188
4189var noop = function () { /* empty */ };
4190var empty = [];
4191var construct = getBuiltIn('Reflect', 'construct');
4192var constructorRegExp = /^\s*(?:class|function)\b/;
4193var exec = uncurryThis(constructorRegExp.exec);
4194var INCORRECT_TO_STRING = !constructorRegExp.exec(noop);
4195
4196var isConstructorModern = function isConstructor(argument) {
4197 if (!isCallable(argument)) return false;
4198 try {
4199 construct(noop, empty, argument);
4200 return true;
4201 } catch (error) {
4202 return false;
4203 }
4204};
4205
4206var isConstructorLegacy = function isConstructor(argument) {
4207 if (!isCallable(argument)) return false;
4208 switch (classof(argument)) {
4209 case 'AsyncFunction':
4210 case 'GeneratorFunction':
4211 case 'AsyncGeneratorFunction': return false;
4212 }
4213 try {
4214 // we can't check .prototype since constructors produced by .bind haven't it
4215 // `Function#toString` throws on some built-it function in some legacy engines
4216 // (for example, `DOMQuad` and similar in FF41-)
4217 return INCORRECT_TO_STRING || !!exec(constructorRegExp, inspectSource(argument));
4218 } catch (error) {
4219 return true;
4220 }
4221};
4222
4223isConstructorLegacy.sham = true;
4224
4225// `IsConstructor` abstract operation
4226// https://tc39.es/ecma262/#sec-isconstructor
4227module.exports = !construct || fails(function () {
4228 var called;
4229 return isConstructorModern(isConstructorModern.call)
4230 || !isConstructorModern(Object)
4231 || !isConstructorModern(function () { called = true; })
4232 || called;
4233}) ? isConstructorLegacy : isConstructorModern;
4234
4235
4236/***/ }),
4237/* 112 */
4238/***/ (function(module, exports, __webpack_require__) {
4239
4240var uncurryThis = __webpack_require__(4);
4241
4242module.exports = uncurryThis([].slice);
4243
4244
4245/***/ }),
4246/* 113 */
4247/***/ (function(module, __webpack_exports__, __webpack_require__) {
4248
4249"use strict";
4250/* harmony export (immutable) */ __webpack_exports__["a"] = matcher;
4251/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__extendOwn_js__ = __webpack_require__(141);
4252/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isMatch_js__ = __webpack_require__(190);
4253
4254
4255
4256// Returns a predicate for checking whether an object has a given set of
4257// `key:value` pairs.
4258function matcher(attrs) {
4259 attrs = Object(__WEBPACK_IMPORTED_MODULE_0__extendOwn_js__["a" /* default */])({}, attrs);
4260 return function(obj) {
4261 return Object(__WEBPACK_IMPORTED_MODULE_1__isMatch_js__["a" /* default */])(obj, attrs);
4262 };
4263}
4264
4265
4266/***/ }),
4267/* 114 */
4268/***/ (function(module, __webpack_exports__, __webpack_require__) {
4269
4270"use strict";
4271/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(24);
4272/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__executeBound_js__ = __webpack_require__(206);
4273/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__underscore_js__ = __webpack_require__(25);
4274
4275
4276
4277
4278// Partially apply a function by creating a version that has had some of its
4279// arguments pre-filled, without changing its dynamic `this` context. `_` acts
4280// as a placeholder by default, allowing any combination of arguments to be
4281// pre-filled. Set `_.partial.placeholder` for a custom placeholder argument.
4282var partial = Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(func, boundArgs) {
4283 var placeholder = partial.placeholder;
4284 var bound = function() {
4285 var position = 0, length = boundArgs.length;
4286 var args = Array(length);
4287 for (var i = 0; i < length; i++) {
4288 args[i] = boundArgs[i] === placeholder ? arguments[position++] : boundArgs[i];
4289 }
4290 while (position < arguments.length) args.push(arguments[position++]);
4291 return Object(__WEBPACK_IMPORTED_MODULE_1__executeBound_js__["a" /* default */])(func, bound, this, this, args);
4292 };
4293 return bound;
4294});
4295
4296partial.placeholder = __WEBPACK_IMPORTED_MODULE_2__underscore_js__["a" /* default */];
4297/* harmony default export */ __webpack_exports__["a"] = (partial);
4298
4299
4300/***/ }),
4301/* 115 */
4302/***/ (function(module, __webpack_exports__, __webpack_require__) {
4303
4304"use strict";
4305/* harmony export (immutable) */ __webpack_exports__["a"] = group;
4306/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(22);
4307/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__each_js__ = __webpack_require__(60);
4308
4309
4310
4311// An internal function used for aggregate "group by" operations.
4312function group(behavior, partition) {
4313 return function(obj, iteratee, context) {
4314 var result = partition ? [[], []] : {};
4315 iteratee = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(iteratee, context);
4316 Object(__WEBPACK_IMPORTED_MODULE_1__each_js__["a" /* default */])(obj, function(value, index) {
4317 var key = iteratee(value, index, obj);
4318 behavior(result, value, key);
4319 });
4320 return result;
4321 };
4322}
4323
4324
4325/***/ }),
4326/* 116 */
4327/***/ (function(module, exports, __webpack_require__) {
4328
4329var fails = __webpack_require__(2);
4330var wellKnownSymbol = __webpack_require__(5);
4331var V8_VERSION = __webpack_require__(66);
4332
4333var SPECIES = wellKnownSymbol('species');
4334
4335module.exports = function (METHOD_NAME) {
4336 // We can't use this feature detection in V8 since it causes
4337 // deoptimization and serious performance degradation
4338 // https://github.com/zloirock/core-js/issues/677
4339 return V8_VERSION >= 51 || !fails(function () {
4340 var array = [];
4341 var constructor = array.constructor = {};
4342 constructor[SPECIES] = function () {
4343 return { foo: 1 };
4344 };
4345 return array[METHOD_NAME](Boolean).foo !== 1;
4346 });
4347};
4348
4349
4350/***/ }),
4351/* 117 */
4352/***/ (function(module, exports, __webpack_require__) {
4353
4354"use strict";
4355
4356
4357var _interopRequireDefault = __webpack_require__(1);
4358
4359var _typeof2 = _interopRequireDefault(__webpack_require__(95));
4360
4361var _filter = _interopRequireDefault(__webpack_require__(249));
4362
4363var _map = _interopRequireDefault(__webpack_require__(37));
4364
4365var _keys = _interopRequireDefault(__webpack_require__(149));
4366
4367var _stringify = _interopRequireDefault(__webpack_require__(38));
4368
4369var _concat = _interopRequireDefault(__webpack_require__(19));
4370
4371var _ = __webpack_require__(3);
4372
4373var _require = __webpack_require__(250),
4374 timeout = _require.timeout;
4375
4376var debug = __webpack_require__(63);
4377
4378var debugRequest = debug('leancloud:request');
4379var debugRequestError = debug('leancloud:request:error');
4380
4381var _require2 = __webpack_require__(76),
4382 getAdapter = _require2.getAdapter;
4383
4384var requestsCount = 0;
4385
4386var ajax = function ajax(_ref) {
4387 var method = _ref.method,
4388 url = _ref.url,
4389 query = _ref.query,
4390 data = _ref.data,
4391 _ref$headers = _ref.headers,
4392 headers = _ref$headers === void 0 ? {} : _ref$headers,
4393 time = _ref.timeout,
4394 onprogress = _ref.onprogress;
4395
4396 if (query) {
4397 var _context, _context2, _context4;
4398
4399 var queryString = (0, _filter.default)(_context = (0, _map.default)(_context2 = (0, _keys.default)(query)).call(_context2, function (key) {
4400 var _context3;
4401
4402 var value = query[key];
4403 if (value === undefined) return undefined;
4404 var v = (0, _typeof2.default)(value) === 'object' ? (0, _stringify.default)(value) : value;
4405 return (0, _concat.default)(_context3 = "".concat(encodeURIComponent(key), "=")).call(_context3, encodeURIComponent(v));
4406 })).call(_context, function (qs) {
4407 return qs;
4408 }).join('&');
4409 url = (0, _concat.default)(_context4 = "".concat(url, "?")).call(_context4, queryString);
4410 }
4411
4412 var count = requestsCount++;
4413 debugRequest('request(%d) %s %s %o %o %o', count, method, url, query, data, headers);
4414 var request = getAdapter('request');
4415 var promise = request(url, {
4416 method: method,
4417 headers: headers,
4418 data: data,
4419 onprogress: onprogress
4420 }).then(function (response) {
4421 debugRequest('response(%d) %d %O %o', count, response.status, response.data || response.text, response.header);
4422
4423 if (response.ok === false) {
4424 var error = new Error();
4425 error.response = response;
4426 throw error;
4427 }
4428
4429 return response.data;
4430 }).catch(function (error) {
4431 if (error.response) {
4432 if (!debug.enabled('leancloud:request')) {
4433 debugRequestError('request(%d) %s %s %o %o %o', count, method, url, query, data, headers);
4434 }
4435
4436 debugRequestError('response(%d) %d %O %o', count, error.response.status, error.response.data || error.response.text, error.response.header);
4437 error.statusCode = error.response.status;
4438 error.responseText = error.response.text;
4439 error.response = error.response.data;
4440 }
4441
4442 throw error;
4443 });
4444 return time ? timeout(promise, time) : promise;
4445};
4446
4447module.exports = ajax;
4448
4449/***/ }),
4450/* 118 */
4451/***/ (function(module, exports) {
4452
4453/* (ignored) */
4454
4455/***/ }),
4456/* 119 */
4457/***/ (function(module, exports, __webpack_require__) {
4458
4459var Symbol = __webpack_require__(274),
4460 getRawTag = __webpack_require__(680),
4461 objectToString = __webpack_require__(681);
4462
4463/** `Object#toString` result references. */
4464var nullTag = '[object Null]',
4465 undefinedTag = '[object Undefined]';
4466
4467/** Built-in value references. */
4468var symToStringTag = Symbol ? Symbol.toStringTag : undefined;
4469
4470/**
4471 * The base implementation of `getTag` without fallbacks for buggy environments.
4472 *
4473 * @private
4474 * @param {*} value The value to query.
4475 * @returns {string} Returns the `toStringTag`.
4476 */
4477function baseGetTag(value) {
4478 if (value == null) {
4479 return value === undefined ? undefinedTag : nullTag;
4480 }
4481 return (symToStringTag && symToStringTag in Object(value))
4482 ? getRawTag(value)
4483 : objectToString(value);
4484}
4485
4486module.exports = baseGetTag;
4487
4488
4489/***/ }),
4490/* 120 */
4491/***/ (function(module, exports) {
4492
4493/**
4494 * Checks if `value` is object-like. A value is object-like if it's not `null`
4495 * and has a `typeof` result of "object".
4496 *
4497 * @static
4498 * @memberOf _
4499 * @since 4.0.0
4500 * @category Lang
4501 * @param {*} value The value to check.
4502 * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
4503 * @example
4504 *
4505 * _.isObjectLike({});
4506 * // => true
4507 *
4508 * _.isObjectLike([1, 2, 3]);
4509 * // => true
4510 *
4511 * _.isObjectLike(_.noop);
4512 * // => false
4513 *
4514 * _.isObjectLike(null);
4515 * // => false
4516 */
4517function isObjectLike(value) {
4518 return value != null && typeof value == 'object';
4519}
4520
4521module.exports = isObjectLike;
4522
4523
4524/***/ }),
4525/* 121 */
4526/***/ (function(module, exports, __webpack_require__) {
4527
4528"use strict";
4529
4530var $propertyIsEnumerable = {}.propertyIsEnumerable;
4531// eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
4532var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
4533
4534// Nashorn ~ JDK8 bug
4535var NASHORN_BUG = getOwnPropertyDescriptor && !$propertyIsEnumerable.call({ 1: 2 }, 1);
4536
4537// `Object.prototype.propertyIsEnumerable` method implementation
4538// https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable
4539exports.f = NASHORN_BUG ? function propertyIsEnumerable(V) {
4540 var descriptor = getOwnPropertyDescriptor(this, V);
4541 return !!descriptor && descriptor.enumerable;
4542} : $propertyIsEnumerable;
4543
4544
4545/***/ }),
4546/* 122 */
4547/***/ (function(module, exports, __webpack_require__) {
4548
4549var aCallable = __webpack_require__(29);
4550
4551// `GetMethod` abstract operation
4552// https://tc39.es/ecma262/#sec-getmethod
4553module.exports = function (V, P) {
4554 var func = V[P];
4555 return func == null ? undefined : aCallable(func);
4556};
4557
4558
4559/***/ }),
4560/* 123 */
4561/***/ (function(module, exports, __webpack_require__) {
4562
4563var global = __webpack_require__(8);
4564var defineGlobalProperty = __webpack_require__(291);
4565
4566var SHARED = '__core-js_shared__';
4567var store = global[SHARED] || defineGlobalProperty(SHARED, {});
4568
4569module.exports = store;
4570
4571
4572/***/ }),
4573/* 124 */
4574/***/ (function(module, exports, __webpack_require__) {
4575
4576var global = __webpack_require__(8);
4577var isObject = __webpack_require__(11);
4578
4579var document = global.document;
4580// typeof document.createElement is 'object' in old IE
4581var EXISTS = isObject(document) && isObject(document.createElement);
4582
4583module.exports = function (it) {
4584 return EXISTS ? document.createElement(it) : {};
4585};
4586
4587
4588/***/ }),
4589/* 125 */
4590/***/ (function(module, exports, __webpack_require__) {
4591
4592var toIndexedObject = __webpack_require__(35);
4593var toAbsoluteIndex = __webpack_require__(126);
4594var lengthOfArrayLike = __webpack_require__(40);
4595
4596// `Array.prototype.{ indexOf, includes }` methods implementation
4597var createMethod = function (IS_INCLUDES) {
4598 return function ($this, el, fromIndex) {
4599 var O = toIndexedObject($this);
4600 var length = lengthOfArrayLike(O);
4601 var index = toAbsoluteIndex(fromIndex, length);
4602 var value;
4603 // Array#includes uses SameValueZero equality algorithm
4604 // eslint-disable-next-line no-self-compare -- NaN check
4605 if (IS_INCLUDES && el != el) while (length > index) {
4606 value = O[index++];
4607 // eslint-disable-next-line no-self-compare -- NaN check
4608 if (value != value) return true;
4609 // Array#indexOf ignores holes, Array#includes - not
4610 } else for (;length > index; index++) {
4611 if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;
4612 } return !IS_INCLUDES && -1;
4613 };
4614};
4615
4616module.exports = {
4617 // `Array.prototype.includes` method
4618 // https://tc39.es/ecma262/#sec-array.prototype.includes
4619 includes: createMethod(true),
4620 // `Array.prototype.indexOf` method
4621 // https://tc39.es/ecma262/#sec-array.prototype.indexof
4622 indexOf: createMethod(false)
4623};
4624
4625
4626/***/ }),
4627/* 126 */
4628/***/ (function(module, exports, __webpack_require__) {
4629
4630var toIntegerOrInfinity = __webpack_require__(127);
4631
4632var max = Math.max;
4633var min = Math.min;
4634
4635// Helper for a popular repeating case of the spec:
4636// Let integer be ? ToInteger(index).
4637// If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length).
4638module.exports = function (index, length) {
4639 var integer = toIntegerOrInfinity(index);
4640 return integer < 0 ? max(integer + length, 0) : min(integer, length);
4641};
4642
4643
4644/***/ }),
4645/* 127 */
4646/***/ (function(module, exports, __webpack_require__) {
4647
4648var trunc = __webpack_require__(294);
4649
4650// `ToIntegerOrInfinity` abstract operation
4651// https://tc39.es/ecma262/#sec-tointegerorinfinity
4652module.exports = function (argument) {
4653 var number = +argument;
4654 // eslint-disable-next-line no-self-compare -- NaN check
4655 return number !== number || number === 0 ? 0 : trunc(number);
4656};
4657
4658
4659/***/ }),
4660/* 128 */
4661/***/ (function(module, exports) {
4662
4663// IE8- don't enum bug keys
4664module.exports = [
4665 'constructor',
4666 'hasOwnProperty',
4667 'isPrototypeOf',
4668 'propertyIsEnumerable',
4669 'toLocaleString',
4670 'toString',
4671 'valueOf'
4672];
4673
4674
4675/***/ }),
4676/* 129 */
4677/***/ (function(module, exports, __webpack_require__) {
4678
4679var DESCRIPTORS = __webpack_require__(14);
4680var V8_PROTOTYPE_DEFINE_BUG = __webpack_require__(160);
4681var definePropertyModule = __webpack_require__(23);
4682var anObject = __webpack_require__(21);
4683var toIndexedObject = __webpack_require__(35);
4684var objectKeys = __webpack_require__(107);
4685
4686// `Object.defineProperties` method
4687// https://tc39.es/ecma262/#sec-object.defineproperties
4688// eslint-disable-next-line es-x/no-object-defineproperties -- safe
4689exports.f = DESCRIPTORS && !V8_PROTOTYPE_DEFINE_BUG ? Object.defineProperties : function defineProperties(O, Properties) {
4690 anObject(O);
4691 var props = toIndexedObject(Properties);
4692 var keys = objectKeys(Properties);
4693 var length = keys.length;
4694 var index = 0;
4695 var key;
4696 while (length > index) definePropertyModule.f(O, key = keys[index++], props[key]);
4697 return O;
4698};
4699
4700
4701/***/ }),
4702/* 130 */
4703/***/ (function(module, exports, __webpack_require__) {
4704
4705var wellKnownSymbol = __webpack_require__(5);
4706
4707var TO_STRING_TAG = wellKnownSymbol('toStringTag');
4708var test = {};
4709
4710test[TO_STRING_TAG] = 'z';
4711
4712module.exports = String(test) === '[object z]';
4713
4714
4715/***/ }),
4716/* 131 */
4717/***/ (function(module, exports) {
4718
4719module.exports = function () { /* empty */ };
4720
4721
4722/***/ }),
4723/* 132 */
4724/***/ (function(module, exports, __webpack_require__) {
4725
4726var uncurryThis = __webpack_require__(4);
4727var isCallable = __webpack_require__(9);
4728var store = __webpack_require__(123);
4729
4730var functionToString = uncurryThis(Function.toString);
4731
4732// this helper broken in `core-js@3.4.1-3.4.4`, so we can't use `shared` helper
4733if (!isCallable(store.inspectSource)) {
4734 store.inspectSource = function (it) {
4735 return functionToString(it);
4736 };
4737}
4738
4739module.exports = store.inspectSource;
4740
4741
4742/***/ }),
4743/* 133 */
4744/***/ (function(module, exports, __webpack_require__) {
4745
4746"use strict";
4747
4748var $ = __webpack_require__(0);
4749var call = __webpack_require__(15);
4750var IS_PURE = __webpack_require__(36);
4751var FunctionName = __webpack_require__(169);
4752var isCallable = __webpack_require__(9);
4753var createIteratorConstructor = __webpack_require__(300);
4754var getPrototypeOf = __webpack_require__(102);
4755var setPrototypeOf = __webpack_require__(104);
4756var setToStringTag = __webpack_require__(56);
4757var createNonEnumerableProperty = __webpack_require__(39);
4758var defineBuiltIn = __webpack_require__(45);
4759var wellKnownSymbol = __webpack_require__(5);
4760var Iterators = __webpack_require__(54);
4761var IteratorsCore = __webpack_require__(170);
4762
4763var PROPER_FUNCTION_NAME = FunctionName.PROPER;
4764var CONFIGURABLE_FUNCTION_NAME = FunctionName.CONFIGURABLE;
4765var IteratorPrototype = IteratorsCore.IteratorPrototype;
4766var BUGGY_SAFARI_ITERATORS = IteratorsCore.BUGGY_SAFARI_ITERATORS;
4767var ITERATOR = wellKnownSymbol('iterator');
4768var KEYS = 'keys';
4769var VALUES = 'values';
4770var ENTRIES = 'entries';
4771
4772var returnThis = function () { return this; };
4773
4774module.exports = function (Iterable, NAME, IteratorConstructor, next, DEFAULT, IS_SET, FORCED) {
4775 createIteratorConstructor(IteratorConstructor, NAME, next);
4776
4777 var getIterationMethod = function (KIND) {
4778 if (KIND === DEFAULT && defaultIterator) return defaultIterator;
4779 if (!BUGGY_SAFARI_ITERATORS && KIND in IterablePrototype) return IterablePrototype[KIND];
4780 switch (KIND) {
4781 case KEYS: return function keys() { return new IteratorConstructor(this, KIND); };
4782 case VALUES: return function values() { return new IteratorConstructor(this, KIND); };
4783 case ENTRIES: return function entries() { return new IteratorConstructor(this, KIND); };
4784 } return function () { return new IteratorConstructor(this); };
4785 };
4786
4787 var TO_STRING_TAG = NAME + ' Iterator';
4788 var INCORRECT_VALUES_NAME = false;
4789 var IterablePrototype = Iterable.prototype;
4790 var nativeIterator = IterablePrototype[ITERATOR]
4791 || IterablePrototype['@@iterator']
4792 || DEFAULT && IterablePrototype[DEFAULT];
4793 var defaultIterator = !BUGGY_SAFARI_ITERATORS && nativeIterator || getIterationMethod(DEFAULT);
4794 var anyNativeIterator = NAME == 'Array' ? IterablePrototype.entries || nativeIterator : nativeIterator;
4795 var CurrentIteratorPrototype, methods, KEY;
4796
4797 // fix native
4798 if (anyNativeIterator) {
4799 CurrentIteratorPrototype = getPrototypeOf(anyNativeIterator.call(new Iterable()));
4800 if (CurrentIteratorPrototype !== Object.prototype && CurrentIteratorPrototype.next) {
4801 if (!IS_PURE && getPrototypeOf(CurrentIteratorPrototype) !== IteratorPrototype) {
4802 if (setPrototypeOf) {
4803 setPrototypeOf(CurrentIteratorPrototype, IteratorPrototype);
4804 } else if (!isCallable(CurrentIteratorPrototype[ITERATOR])) {
4805 defineBuiltIn(CurrentIteratorPrototype, ITERATOR, returnThis);
4806 }
4807 }
4808 // Set @@toStringTag to native iterators
4809 setToStringTag(CurrentIteratorPrototype, TO_STRING_TAG, true, true);
4810 if (IS_PURE) Iterators[TO_STRING_TAG] = returnThis;
4811 }
4812 }
4813
4814 // fix Array.prototype.{ values, @@iterator }.name in V8 / FF
4815 if (PROPER_FUNCTION_NAME && DEFAULT == VALUES && nativeIterator && nativeIterator.name !== VALUES) {
4816 if (!IS_PURE && CONFIGURABLE_FUNCTION_NAME) {
4817 createNonEnumerableProperty(IterablePrototype, 'name', VALUES);
4818 } else {
4819 INCORRECT_VALUES_NAME = true;
4820 defaultIterator = function values() { return call(nativeIterator, this); };
4821 }
4822 }
4823
4824 // export additional methods
4825 if (DEFAULT) {
4826 methods = {
4827 values: getIterationMethod(VALUES),
4828 keys: IS_SET ? defaultIterator : getIterationMethod(KEYS),
4829 entries: getIterationMethod(ENTRIES)
4830 };
4831 if (FORCED) for (KEY in methods) {
4832 if (BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME || !(KEY in IterablePrototype)) {
4833 defineBuiltIn(IterablePrototype, KEY, methods[KEY]);
4834 }
4835 } else $({ target: NAME, proto: true, forced: BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME }, methods);
4836 }
4837
4838 // define iterator
4839 if ((!IS_PURE || FORCED) && IterablePrototype[ITERATOR] !== defaultIterator) {
4840 defineBuiltIn(IterablePrototype, ITERATOR, defaultIterator, { name: DEFAULT });
4841 }
4842 Iterators[NAME] = defaultIterator;
4843
4844 return methods;
4845};
4846
4847
4848/***/ }),
4849/* 134 */
4850/***/ (function(module, __webpack_exports__, __webpack_require__) {
4851
4852"use strict";
4853Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
4854/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(6);
4855/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "VERSION", function() { return __WEBPACK_IMPORTED_MODULE_0__setup_js__["e"]; });
4856/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__restArguments_js__ = __webpack_require__(24);
4857/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "restArguments", function() { return __WEBPACK_IMPORTED_MODULE_1__restArguments_js__["a"]; });
4858/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__isObject_js__ = __webpack_require__(58);
4859/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isObject", function() { return __WEBPACK_IMPORTED_MODULE_2__isObject_js__["a"]; });
4860/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__isNull_js__ = __webpack_require__(322);
4861/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isNull", function() { return __WEBPACK_IMPORTED_MODULE_3__isNull_js__["a"]; });
4862/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__isUndefined_js__ = __webpack_require__(179);
4863/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isUndefined", function() { return __WEBPACK_IMPORTED_MODULE_4__isUndefined_js__["a"]; });
4864/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__isBoolean_js__ = __webpack_require__(180);
4865/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isBoolean", function() { return __WEBPACK_IMPORTED_MODULE_5__isBoolean_js__["a"]; });
4866/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__isElement_js__ = __webpack_require__(323);
4867/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isElement", function() { return __WEBPACK_IMPORTED_MODULE_6__isElement_js__["a"]; });
4868/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__isString_js__ = __webpack_require__(135);
4869/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isString", function() { return __WEBPACK_IMPORTED_MODULE_7__isString_js__["a"]; });
4870/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__isNumber_js__ = __webpack_require__(181);
4871/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isNumber", function() { return __WEBPACK_IMPORTED_MODULE_8__isNumber_js__["a"]; });
4872/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__isDate_js__ = __webpack_require__(324);
4873/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isDate", function() { return __WEBPACK_IMPORTED_MODULE_9__isDate_js__["a"]; });
4874/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__isRegExp_js__ = __webpack_require__(325);
4875/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isRegExp", function() { return __WEBPACK_IMPORTED_MODULE_10__isRegExp_js__["a"]; });
4876/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__isError_js__ = __webpack_require__(326);
4877/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isError", function() { return __WEBPACK_IMPORTED_MODULE_11__isError_js__["a"]; });
4878/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__isSymbol_js__ = __webpack_require__(182);
4879/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isSymbol", function() { return __WEBPACK_IMPORTED_MODULE_12__isSymbol_js__["a"]; });
4880/* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__isArrayBuffer_js__ = __webpack_require__(183);
4881/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isArrayBuffer", function() { return __WEBPACK_IMPORTED_MODULE_13__isArrayBuffer_js__["a"]; });
4882/* harmony import */ var __WEBPACK_IMPORTED_MODULE_14__isDataView_js__ = __webpack_require__(136);
4883/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isDataView", function() { return __WEBPACK_IMPORTED_MODULE_14__isDataView_js__["a"]; });
4884/* harmony import */ var __WEBPACK_IMPORTED_MODULE_15__isArray_js__ = __webpack_require__(59);
4885/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isArray", function() { return __WEBPACK_IMPORTED_MODULE_15__isArray_js__["a"]; });
4886/* harmony import */ var __WEBPACK_IMPORTED_MODULE_16__isFunction_js__ = __webpack_require__(30);
4887/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isFunction", function() { return __WEBPACK_IMPORTED_MODULE_16__isFunction_js__["a"]; });
4888/* harmony import */ var __WEBPACK_IMPORTED_MODULE_17__isArguments_js__ = __webpack_require__(137);
4889/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isArguments", function() { return __WEBPACK_IMPORTED_MODULE_17__isArguments_js__["a"]; });
4890/* harmony import */ var __WEBPACK_IMPORTED_MODULE_18__isFinite_js__ = __webpack_require__(328);
4891/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isFinite", function() { return __WEBPACK_IMPORTED_MODULE_18__isFinite_js__["a"]; });
4892/* harmony import */ var __WEBPACK_IMPORTED_MODULE_19__isNaN_js__ = __webpack_require__(184);
4893/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isNaN", function() { return __WEBPACK_IMPORTED_MODULE_19__isNaN_js__["a"]; });
4894/* harmony import */ var __WEBPACK_IMPORTED_MODULE_20__isTypedArray_js__ = __webpack_require__(185);
4895/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isTypedArray", function() { return __WEBPACK_IMPORTED_MODULE_20__isTypedArray_js__["a"]; });
4896/* harmony import */ var __WEBPACK_IMPORTED_MODULE_21__isEmpty_js__ = __webpack_require__(330);
4897/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isEmpty", function() { return __WEBPACK_IMPORTED_MODULE_21__isEmpty_js__["a"]; });
4898/* harmony import */ var __WEBPACK_IMPORTED_MODULE_22__isMatch_js__ = __webpack_require__(190);
4899/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isMatch", function() { return __WEBPACK_IMPORTED_MODULE_22__isMatch_js__["a"]; });
4900/* harmony import */ var __WEBPACK_IMPORTED_MODULE_23__isEqual_js__ = __webpack_require__(331);
4901/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isEqual", function() { return __WEBPACK_IMPORTED_MODULE_23__isEqual_js__["a"]; });
4902/* harmony import */ var __WEBPACK_IMPORTED_MODULE_24__isMap_js__ = __webpack_require__(333);
4903/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isMap", function() { return __WEBPACK_IMPORTED_MODULE_24__isMap_js__["a"]; });
4904/* harmony import */ var __WEBPACK_IMPORTED_MODULE_25__isWeakMap_js__ = __webpack_require__(334);
4905/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isWeakMap", function() { return __WEBPACK_IMPORTED_MODULE_25__isWeakMap_js__["a"]; });
4906/* harmony import */ var __WEBPACK_IMPORTED_MODULE_26__isSet_js__ = __webpack_require__(335);
4907/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isSet", function() { return __WEBPACK_IMPORTED_MODULE_26__isSet_js__["a"]; });
4908/* harmony import */ var __WEBPACK_IMPORTED_MODULE_27__isWeakSet_js__ = __webpack_require__(336);
4909/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isWeakSet", function() { return __WEBPACK_IMPORTED_MODULE_27__isWeakSet_js__["a"]; });
4910/* harmony import */ var __WEBPACK_IMPORTED_MODULE_28__keys_js__ = __webpack_require__(17);
4911/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "keys", function() { return __WEBPACK_IMPORTED_MODULE_28__keys_js__["a"]; });
4912/* harmony import */ var __WEBPACK_IMPORTED_MODULE_29__allKeys_js__ = __webpack_require__(87);
4913/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "allKeys", function() { return __WEBPACK_IMPORTED_MODULE_29__allKeys_js__["a"]; });
4914/* harmony import */ var __WEBPACK_IMPORTED_MODULE_30__values_js__ = __webpack_require__(71);
4915/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "values", function() { return __WEBPACK_IMPORTED_MODULE_30__values_js__["a"]; });
4916/* harmony import */ var __WEBPACK_IMPORTED_MODULE_31__pairs_js__ = __webpack_require__(337);
4917/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "pairs", function() { return __WEBPACK_IMPORTED_MODULE_31__pairs_js__["a"]; });
4918/* harmony import */ var __WEBPACK_IMPORTED_MODULE_32__invert_js__ = __webpack_require__(191);
4919/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "invert", function() { return __WEBPACK_IMPORTED_MODULE_32__invert_js__["a"]; });
4920/* harmony import */ var __WEBPACK_IMPORTED_MODULE_33__functions_js__ = __webpack_require__(192);
4921/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "functions", function() { return __WEBPACK_IMPORTED_MODULE_33__functions_js__["a"]; });
4922/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "methods", function() { return __WEBPACK_IMPORTED_MODULE_33__functions_js__["a"]; });
4923/* harmony import */ var __WEBPACK_IMPORTED_MODULE_34__extend_js__ = __webpack_require__(193);
4924/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "extend", function() { return __WEBPACK_IMPORTED_MODULE_34__extend_js__["a"]; });
4925/* harmony import */ var __WEBPACK_IMPORTED_MODULE_35__extendOwn_js__ = __webpack_require__(141);
4926/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "extendOwn", function() { return __WEBPACK_IMPORTED_MODULE_35__extendOwn_js__["a"]; });
4927/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "assign", function() { return __WEBPACK_IMPORTED_MODULE_35__extendOwn_js__["a"]; });
4928/* harmony import */ var __WEBPACK_IMPORTED_MODULE_36__defaults_js__ = __webpack_require__(194);
4929/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "defaults", function() { return __WEBPACK_IMPORTED_MODULE_36__defaults_js__["a"]; });
4930/* harmony import */ var __WEBPACK_IMPORTED_MODULE_37__create_js__ = __webpack_require__(338);
4931/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "create", function() { return __WEBPACK_IMPORTED_MODULE_37__create_js__["a"]; });
4932/* harmony import */ var __WEBPACK_IMPORTED_MODULE_38__clone_js__ = __webpack_require__(196);
4933/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "clone", function() { return __WEBPACK_IMPORTED_MODULE_38__clone_js__["a"]; });
4934/* harmony import */ var __WEBPACK_IMPORTED_MODULE_39__tap_js__ = __webpack_require__(339);
4935/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "tap", function() { return __WEBPACK_IMPORTED_MODULE_39__tap_js__["a"]; });
4936/* harmony import */ var __WEBPACK_IMPORTED_MODULE_40__get_js__ = __webpack_require__(197);
4937/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "get", function() { return __WEBPACK_IMPORTED_MODULE_40__get_js__["a"]; });
4938/* harmony import */ var __WEBPACK_IMPORTED_MODULE_41__has_js__ = __webpack_require__(340);
4939/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "has", function() { return __WEBPACK_IMPORTED_MODULE_41__has_js__["a"]; });
4940/* harmony import */ var __WEBPACK_IMPORTED_MODULE_42__mapObject_js__ = __webpack_require__(341);
4941/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "mapObject", function() { return __WEBPACK_IMPORTED_MODULE_42__mapObject_js__["a"]; });
4942/* harmony import */ var __WEBPACK_IMPORTED_MODULE_43__identity_js__ = __webpack_require__(143);
4943/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "identity", function() { return __WEBPACK_IMPORTED_MODULE_43__identity_js__["a"]; });
4944/* harmony import */ var __WEBPACK_IMPORTED_MODULE_44__constant_js__ = __webpack_require__(186);
4945/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "constant", function() { return __WEBPACK_IMPORTED_MODULE_44__constant_js__["a"]; });
4946/* harmony import */ var __WEBPACK_IMPORTED_MODULE_45__noop_js__ = __webpack_require__(201);
4947/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "noop", function() { return __WEBPACK_IMPORTED_MODULE_45__noop_js__["a"]; });
4948/* harmony import */ var __WEBPACK_IMPORTED_MODULE_46__toPath_js__ = __webpack_require__(198);
4949/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "toPath", function() { return __WEBPACK_IMPORTED_MODULE_46__toPath_js__["a"]; });
4950/* harmony import */ var __WEBPACK_IMPORTED_MODULE_47__property_js__ = __webpack_require__(144);
4951/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "property", function() { return __WEBPACK_IMPORTED_MODULE_47__property_js__["a"]; });
4952/* harmony import */ var __WEBPACK_IMPORTED_MODULE_48__propertyOf_js__ = __webpack_require__(342);
4953/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "propertyOf", function() { return __WEBPACK_IMPORTED_MODULE_48__propertyOf_js__["a"]; });
4954/* harmony import */ var __WEBPACK_IMPORTED_MODULE_49__matcher_js__ = __webpack_require__(113);
4955/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "matcher", function() { return __WEBPACK_IMPORTED_MODULE_49__matcher_js__["a"]; });
4956/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "matches", function() { return __WEBPACK_IMPORTED_MODULE_49__matcher_js__["a"]; });
4957/* harmony import */ var __WEBPACK_IMPORTED_MODULE_50__times_js__ = __webpack_require__(343);
4958/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "times", function() { return __WEBPACK_IMPORTED_MODULE_50__times_js__["a"]; });
4959/* harmony import */ var __WEBPACK_IMPORTED_MODULE_51__random_js__ = __webpack_require__(202);
4960/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "random", function() { return __WEBPACK_IMPORTED_MODULE_51__random_js__["a"]; });
4961/* harmony import */ var __WEBPACK_IMPORTED_MODULE_52__now_js__ = __webpack_require__(145);
4962/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "now", function() { return __WEBPACK_IMPORTED_MODULE_52__now_js__["a"]; });
4963/* harmony import */ var __WEBPACK_IMPORTED_MODULE_53__escape_js__ = __webpack_require__(344);
4964/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "escape", function() { return __WEBPACK_IMPORTED_MODULE_53__escape_js__["a"]; });
4965/* harmony import */ var __WEBPACK_IMPORTED_MODULE_54__unescape_js__ = __webpack_require__(345);
4966/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "unescape", function() { return __WEBPACK_IMPORTED_MODULE_54__unescape_js__["a"]; });
4967/* harmony import */ var __WEBPACK_IMPORTED_MODULE_55__templateSettings_js__ = __webpack_require__(205);
4968/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "templateSettings", function() { return __WEBPACK_IMPORTED_MODULE_55__templateSettings_js__["a"]; });
4969/* harmony import */ var __WEBPACK_IMPORTED_MODULE_56__template_js__ = __webpack_require__(347);
4970/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "template", function() { return __WEBPACK_IMPORTED_MODULE_56__template_js__["a"]; });
4971/* harmony import */ var __WEBPACK_IMPORTED_MODULE_57__result_js__ = __webpack_require__(348);
4972/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "result", function() { return __WEBPACK_IMPORTED_MODULE_57__result_js__["a"]; });
4973/* harmony import */ var __WEBPACK_IMPORTED_MODULE_58__uniqueId_js__ = __webpack_require__(349);
4974/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "uniqueId", function() { return __WEBPACK_IMPORTED_MODULE_58__uniqueId_js__["a"]; });
4975/* harmony import */ var __WEBPACK_IMPORTED_MODULE_59__chain_js__ = __webpack_require__(350);
4976/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "chain", function() { return __WEBPACK_IMPORTED_MODULE_59__chain_js__["a"]; });
4977/* harmony import */ var __WEBPACK_IMPORTED_MODULE_60__iteratee_js__ = __webpack_require__(200);
4978/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "iteratee", function() { return __WEBPACK_IMPORTED_MODULE_60__iteratee_js__["a"]; });
4979/* harmony import */ var __WEBPACK_IMPORTED_MODULE_61__partial_js__ = __webpack_require__(114);
4980/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "partial", function() { return __WEBPACK_IMPORTED_MODULE_61__partial_js__["a"]; });
4981/* harmony import */ var __WEBPACK_IMPORTED_MODULE_62__bind_js__ = __webpack_require__(207);
4982/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "bind", function() { return __WEBPACK_IMPORTED_MODULE_62__bind_js__["a"]; });
4983/* harmony import */ var __WEBPACK_IMPORTED_MODULE_63__bindAll_js__ = __webpack_require__(351);
4984/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "bindAll", function() { return __WEBPACK_IMPORTED_MODULE_63__bindAll_js__["a"]; });
4985/* harmony import */ var __WEBPACK_IMPORTED_MODULE_64__memoize_js__ = __webpack_require__(352);
4986/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "memoize", function() { return __WEBPACK_IMPORTED_MODULE_64__memoize_js__["a"]; });
4987/* harmony import */ var __WEBPACK_IMPORTED_MODULE_65__delay_js__ = __webpack_require__(208);
4988/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "delay", function() { return __WEBPACK_IMPORTED_MODULE_65__delay_js__["a"]; });
4989/* harmony import */ var __WEBPACK_IMPORTED_MODULE_66__defer_js__ = __webpack_require__(353);
4990/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "defer", function() { return __WEBPACK_IMPORTED_MODULE_66__defer_js__["a"]; });
4991/* harmony import */ var __WEBPACK_IMPORTED_MODULE_67__throttle_js__ = __webpack_require__(354);
4992/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "throttle", function() { return __WEBPACK_IMPORTED_MODULE_67__throttle_js__["a"]; });
4993/* harmony import */ var __WEBPACK_IMPORTED_MODULE_68__debounce_js__ = __webpack_require__(355);
4994/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "debounce", function() { return __WEBPACK_IMPORTED_MODULE_68__debounce_js__["a"]; });
4995/* harmony import */ var __WEBPACK_IMPORTED_MODULE_69__wrap_js__ = __webpack_require__(356);
4996/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "wrap", function() { return __WEBPACK_IMPORTED_MODULE_69__wrap_js__["a"]; });
4997/* harmony import */ var __WEBPACK_IMPORTED_MODULE_70__negate_js__ = __webpack_require__(146);
4998/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "negate", function() { return __WEBPACK_IMPORTED_MODULE_70__negate_js__["a"]; });
4999/* harmony import */ var __WEBPACK_IMPORTED_MODULE_71__compose_js__ = __webpack_require__(357);
5000/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "compose", function() { return __WEBPACK_IMPORTED_MODULE_71__compose_js__["a"]; });
5001/* harmony import */ var __WEBPACK_IMPORTED_MODULE_72__after_js__ = __webpack_require__(358);
5002/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "after", function() { return __WEBPACK_IMPORTED_MODULE_72__after_js__["a"]; });
5003/* harmony import */ var __WEBPACK_IMPORTED_MODULE_73__before_js__ = __webpack_require__(209);
5004/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "before", function() { return __WEBPACK_IMPORTED_MODULE_73__before_js__["a"]; });
5005/* harmony import */ var __WEBPACK_IMPORTED_MODULE_74__once_js__ = __webpack_require__(359);
5006/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "once", function() { return __WEBPACK_IMPORTED_MODULE_74__once_js__["a"]; });
5007/* harmony import */ var __WEBPACK_IMPORTED_MODULE_75__findKey_js__ = __webpack_require__(210);
5008/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "findKey", function() { return __WEBPACK_IMPORTED_MODULE_75__findKey_js__["a"]; });
5009/* harmony import */ var __WEBPACK_IMPORTED_MODULE_76__findIndex_js__ = __webpack_require__(147);
5010/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "findIndex", function() { return __WEBPACK_IMPORTED_MODULE_76__findIndex_js__["a"]; });
5011/* harmony import */ var __WEBPACK_IMPORTED_MODULE_77__findLastIndex_js__ = __webpack_require__(212);
5012/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "findLastIndex", function() { return __WEBPACK_IMPORTED_MODULE_77__findLastIndex_js__["a"]; });
5013/* harmony import */ var __WEBPACK_IMPORTED_MODULE_78__sortedIndex_js__ = __webpack_require__(213);
5014/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "sortedIndex", function() { return __WEBPACK_IMPORTED_MODULE_78__sortedIndex_js__["a"]; });
5015/* harmony import */ var __WEBPACK_IMPORTED_MODULE_79__indexOf_js__ = __webpack_require__(214);
5016/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "indexOf", function() { return __WEBPACK_IMPORTED_MODULE_79__indexOf_js__["a"]; });
5017/* harmony import */ var __WEBPACK_IMPORTED_MODULE_80__lastIndexOf_js__ = __webpack_require__(360);
5018/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "lastIndexOf", function() { return __WEBPACK_IMPORTED_MODULE_80__lastIndexOf_js__["a"]; });
5019/* harmony import */ var __WEBPACK_IMPORTED_MODULE_81__find_js__ = __webpack_require__(216);
5020/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "find", function() { return __WEBPACK_IMPORTED_MODULE_81__find_js__["a"]; });
5021/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "detect", function() { return __WEBPACK_IMPORTED_MODULE_81__find_js__["a"]; });
5022/* harmony import */ var __WEBPACK_IMPORTED_MODULE_82__findWhere_js__ = __webpack_require__(361);
5023/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "findWhere", function() { return __WEBPACK_IMPORTED_MODULE_82__findWhere_js__["a"]; });
5024/* harmony import */ var __WEBPACK_IMPORTED_MODULE_83__each_js__ = __webpack_require__(60);
5025/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "each", function() { return __WEBPACK_IMPORTED_MODULE_83__each_js__["a"]; });
5026/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "forEach", function() { return __WEBPACK_IMPORTED_MODULE_83__each_js__["a"]; });
5027/* harmony import */ var __WEBPACK_IMPORTED_MODULE_84__map_js__ = __webpack_require__(73);
5028/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "map", function() { return __WEBPACK_IMPORTED_MODULE_84__map_js__["a"]; });
5029/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "collect", function() { return __WEBPACK_IMPORTED_MODULE_84__map_js__["a"]; });
5030/* harmony import */ var __WEBPACK_IMPORTED_MODULE_85__reduce_js__ = __webpack_require__(362);
5031/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "reduce", function() { return __WEBPACK_IMPORTED_MODULE_85__reduce_js__["a"]; });
5032/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "foldl", function() { return __WEBPACK_IMPORTED_MODULE_85__reduce_js__["a"]; });
5033/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "inject", function() { return __WEBPACK_IMPORTED_MODULE_85__reduce_js__["a"]; });
5034/* harmony import */ var __WEBPACK_IMPORTED_MODULE_86__reduceRight_js__ = __webpack_require__(363);
5035/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "reduceRight", function() { return __WEBPACK_IMPORTED_MODULE_86__reduceRight_js__["a"]; });
5036/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "foldr", function() { return __WEBPACK_IMPORTED_MODULE_86__reduceRight_js__["a"]; });
5037/* harmony import */ var __WEBPACK_IMPORTED_MODULE_87__filter_js__ = __webpack_require__(90);
5038/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "filter", function() { return __WEBPACK_IMPORTED_MODULE_87__filter_js__["a"]; });
5039/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "select", function() { return __WEBPACK_IMPORTED_MODULE_87__filter_js__["a"]; });
5040/* harmony import */ var __WEBPACK_IMPORTED_MODULE_88__reject_js__ = __webpack_require__(364);
5041/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "reject", function() { return __WEBPACK_IMPORTED_MODULE_88__reject_js__["a"]; });
5042/* harmony import */ var __WEBPACK_IMPORTED_MODULE_89__every_js__ = __webpack_require__(365);
5043/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "every", function() { return __WEBPACK_IMPORTED_MODULE_89__every_js__["a"]; });
5044/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "all", function() { return __WEBPACK_IMPORTED_MODULE_89__every_js__["a"]; });
5045/* harmony import */ var __WEBPACK_IMPORTED_MODULE_90__some_js__ = __webpack_require__(366);
5046/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "some", function() { return __WEBPACK_IMPORTED_MODULE_90__some_js__["a"]; });
5047/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "any", function() { return __WEBPACK_IMPORTED_MODULE_90__some_js__["a"]; });
5048/* harmony import */ var __WEBPACK_IMPORTED_MODULE_91__contains_js__ = __webpack_require__(91);
5049/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "contains", function() { return __WEBPACK_IMPORTED_MODULE_91__contains_js__["a"]; });
5050/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "includes", function() { return __WEBPACK_IMPORTED_MODULE_91__contains_js__["a"]; });
5051/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "include", function() { return __WEBPACK_IMPORTED_MODULE_91__contains_js__["a"]; });
5052/* harmony import */ var __WEBPACK_IMPORTED_MODULE_92__invoke_js__ = __webpack_require__(367);
5053/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "invoke", function() { return __WEBPACK_IMPORTED_MODULE_92__invoke_js__["a"]; });
5054/* harmony import */ var __WEBPACK_IMPORTED_MODULE_93__pluck_js__ = __webpack_require__(148);
5055/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "pluck", function() { return __WEBPACK_IMPORTED_MODULE_93__pluck_js__["a"]; });
5056/* harmony import */ var __WEBPACK_IMPORTED_MODULE_94__where_js__ = __webpack_require__(368);
5057/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "where", function() { return __WEBPACK_IMPORTED_MODULE_94__where_js__["a"]; });
5058/* harmony import */ var __WEBPACK_IMPORTED_MODULE_95__max_js__ = __webpack_require__(218);
5059/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "max", function() { return __WEBPACK_IMPORTED_MODULE_95__max_js__["a"]; });
5060/* harmony import */ var __WEBPACK_IMPORTED_MODULE_96__min_js__ = __webpack_require__(369);
5061/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "min", function() { return __WEBPACK_IMPORTED_MODULE_96__min_js__["a"]; });
5062/* harmony import */ var __WEBPACK_IMPORTED_MODULE_97__shuffle_js__ = __webpack_require__(370);
5063/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "shuffle", function() { return __WEBPACK_IMPORTED_MODULE_97__shuffle_js__["a"]; });
5064/* harmony import */ var __WEBPACK_IMPORTED_MODULE_98__sample_js__ = __webpack_require__(219);
5065/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "sample", function() { return __WEBPACK_IMPORTED_MODULE_98__sample_js__["a"]; });
5066/* harmony import */ var __WEBPACK_IMPORTED_MODULE_99__sortBy_js__ = __webpack_require__(371);
5067/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "sortBy", function() { return __WEBPACK_IMPORTED_MODULE_99__sortBy_js__["a"]; });
5068/* harmony import */ var __WEBPACK_IMPORTED_MODULE_100__groupBy_js__ = __webpack_require__(372);
5069/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "groupBy", function() { return __WEBPACK_IMPORTED_MODULE_100__groupBy_js__["a"]; });
5070/* harmony import */ var __WEBPACK_IMPORTED_MODULE_101__indexBy_js__ = __webpack_require__(373);
5071/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "indexBy", function() { return __WEBPACK_IMPORTED_MODULE_101__indexBy_js__["a"]; });
5072/* harmony import */ var __WEBPACK_IMPORTED_MODULE_102__countBy_js__ = __webpack_require__(374);
5073/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "countBy", function() { return __WEBPACK_IMPORTED_MODULE_102__countBy_js__["a"]; });
5074/* harmony import */ var __WEBPACK_IMPORTED_MODULE_103__partition_js__ = __webpack_require__(375);
5075/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "partition", function() { return __WEBPACK_IMPORTED_MODULE_103__partition_js__["a"]; });
5076/* harmony import */ var __WEBPACK_IMPORTED_MODULE_104__toArray_js__ = __webpack_require__(376);
5077/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "toArray", function() { return __WEBPACK_IMPORTED_MODULE_104__toArray_js__["a"]; });
5078/* harmony import */ var __WEBPACK_IMPORTED_MODULE_105__size_js__ = __webpack_require__(377);
5079/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "size", function() { return __WEBPACK_IMPORTED_MODULE_105__size_js__["a"]; });
5080/* harmony import */ var __WEBPACK_IMPORTED_MODULE_106__pick_js__ = __webpack_require__(220);
5081/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "pick", function() { return __WEBPACK_IMPORTED_MODULE_106__pick_js__["a"]; });
5082/* harmony import */ var __WEBPACK_IMPORTED_MODULE_107__omit_js__ = __webpack_require__(379);
5083/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "omit", function() { return __WEBPACK_IMPORTED_MODULE_107__omit_js__["a"]; });
5084/* harmony import */ var __WEBPACK_IMPORTED_MODULE_108__first_js__ = __webpack_require__(380);
5085/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "first", function() { return __WEBPACK_IMPORTED_MODULE_108__first_js__["a"]; });
5086/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "head", function() { return __WEBPACK_IMPORTED_MODULE_108__first_js__["a"]; });
5087/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "take", function() { return __WEBPACK_IMPORTED_MODULE_108__first_js__["a"]; });
5088/* harmony import */ var __WEBPACK_IMPORTED_MODULE_109__initial_js__ = __webpack_require__(221);
5089/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "initial", function() { return __WEBPACK_IMPORTED_MODULE_109__initial_js__["a"]; });
5090/* harmony import */ var __WEBPACK_IMPORTED_MODULE_110__last_js__ = __webpack_require__(381);
5091/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "last", function() { return __WEBPACK_IMPORTED_MODULE_110__last_js__["a"]; });
5092/* harmony import */ var __WEBPACK_IMPORTED_MODULE_111__rest_js__ = __webpack_require__(222);
5093/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "rest", function() { return __WEBPACK_IMPORTED_MODULE_111__rest_js__["a"]; });
5094/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "tail", function() { return __WEBPACK_IMPORTED_MODULE_111__rest_js__["a"]; });
5095/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "drop", function() { return __WEBPACK_IMPORTED_MODULE_111__rest_js__["a"]; });
5096/* harmony import */ var __WEBPACK_IMPORTED_MODULE_112__compact_js__ = __webpack_require__(382);
5097/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "compact", function() { return __WEBPACK_IMPORTED_MODULE_112__compact_js__["a"]; });
5098/* harmony import */ var __WEBPACK_IMPORTED_MODULE_113__flatten_js__ = __webpack_require__(383);
5099/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "flatten", function() { return __WEBPACK_IMPORTED_MODULE_113__flatten_js__["a"]; });
5100/* harmony import */ var __WEBPACK_IMPORTED_MODULE_114__without_js__ = __webpack_require__(384);
5101/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "without", function() { return __WEBPACK_IMPORTED_MODULE_114__without_js__["a"]; });
5102/* harmony import */ var __WEBPACK_IMPORTED_MODULE_115__uniq_js__ = __webpack_require__(224);
5103/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "uniq", function() { return __WEBPACK_IMPORTED_MODULE_115__uniq_js__["a"]; });
5104/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "unique", function() { return __WEBPACK_IMPORTED_MODULE_115__uniq_js__["a"]; });
5105/* harmony import */ var __WEBPACK_IMPORTED_MODULE_116__union_js__ = __webpack_require__(385);
5106/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "union", function() { return __WEBPACK_IMPORTED_MODULE_116__union_js__["a"]; });
5107/* harmony import */ var __WEBPACK_IMPORTED_MODULE_117__intersection_js__ = __webpack_require__(386);
5108/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "intersection", function() { return __WEBPACK_IMPORTED_MODULE_117__intersection_js__["a"]; });
5109/* harmony import */ var __WEBPACK_IMPORTED_MODULE_118__difference_js__ = __webpack_require__(223);
5110/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "difference", function() { return __WEBPACK_IMPORTED_MODULE_118__difference_js__["a"]; });
5111/* harmony import */ var __WEBPACK_IMPORTED_MODULE_119__unzip_js__ = __webpack_require__(225);
5112/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "unzip", function() { return __WEBPACK_IMPORTED_MODULE_119__unzip_js__["a"]; });
5113/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "transpose", function() { return __WEBPACK_IMPORTED_MODULE_119__unzip_js__["a"]; });
5114/* harmony import */ var __WEBPACK_IMPORTED_MODULE_120__zip_js__ = __webpack_require__(387);
5115/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "zip", function() { return __WEBPACK_IMPORTED_MODULE_120__zip_js__["a"]; });
5116/* harmony import */ var __WEBPACK_IMPORTED_MODULE_121__object_js__ = __webpack_require__(388);
5117/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "object", function() { return __WEBPACK_IMPORTED_MODULE_121__object_js__["a"]; });
5118/* harmony import */ var __WEBPACK_IMPORTED_MODULE_122__range_js__ = __webpack_require__(389);
5119/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "range", function() { return __WEBPACK_IMPORTED_MODULE_122__range_js__["a"]; });
5120/* harmony import */ var __WEBPACK_IMPORTED_MODULE_123__chunk_js__ = __webpack_require__(390);
5121/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "chunk", function() { return __WEBPACK_IMPORTED_MODULE_123__chunk_js__["a"]; });
5122/* harmony import */ var __WEBPACK_IMPORTED_MODULE_124__mixin_js__ = __webpack_require__(391);
5123/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "mixin", function() { return __WEBPACK_IMPORTED_MODULE_124__mixin_js__["a"]; });
5124/* harmony import */ var __WEBPACK_IMPORTED_MODULE_125__underscore_array_methods_js__ = __webpack_require__(392);
5125/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return __WEBPACK_IMPORTED_MODULE_125__underscore_array_methods_js__["a"]; });
5126// Named Exports
5127// =============
5128
5129// Underscore.js 1.12.1
5130// https://underscorejs.org
5131// (c) 2009-2020 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
5132// Underscore may be freely distributed under the MIT license.
5133
5134// Baseline setup.
5135
5136
5137
5138// Object Functions
5139// ----------------
5140// Our most fundamental functions operate on any JavaScript object.
5141// Most functions in Underscore depend on at least one function in this section.
5142
5143// A group of functions that check the types of core JavaScript values.
5144// These are often informally referred to as the "isType" functions.
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172// Functions that treat an object as a dictionary of key-value pairs.
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189// Utility Functions
5190// -----------------
5191// A bit of a grab bag: Predicate-generating functions for use with filters and
5192// loops, string escaping and templating, create random numbers and unique ids,
5193// and functions that facilitate Underscore's chaining and iteration conventions.
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213// Function (ahem) Functions
5214// -------------------------
5215// These functions take a function as an argument and return a new function
5216// as the result. Also known as higher-order functions.
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232// Finders
5233// -------
5234// Functions that extract (the position of) a single element from an object
5235// or array based on some criterion.
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245// Collection Functions
5246// --------------------
5247// Functions that work on any collection of elements: either an array, or
5248// an object of key-value pairs.
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273// `_.pick` and `_.omit` are actually object functions, but we put
5274// them here in order to create a more natural reading order in the
5275// monolithic build as they depend on `_.contains`.
5276
5277
5278
5279// Array Functions
5280// ---------------
5281// Functions that operate on arrays (and array-likes) only, because they’re
5282// expressed in terms of operations on an ordered list of values.
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300// OOP
5301// ---
5302// These modules support the "object-oriented" calling style. See also
5303// `underscore.js` and `index-default.js`.
5304
5305
5306
5307
5308/***/ }),
5309/* 135 */
5310/***/ (function(module, __webpack_exports__, __webpack_require__) {
5311
5312"use strict";
5313/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(18);
5314
5315
5316/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('String'));
5317
5318
5319/***/ }),
5320/* 136 */
5321/***/ (function(module, __webpack_exports__, __webpack_require__) {
5322
5323"use strict";
5324/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(18);
5325/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isFunction_js__ = __webpack_require__(30);
5326/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__isArrayBuffer_js__ = __webpack_require__(183);
5327/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__stringTagBug_js__ = __webpack_require__(86);
5328
5329
5330
5331
5332
5333var isDataView = Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('DataView');
5334
5335// In IE 10 - Edge 13, we need a different heuristic
5336// to determine whether an object is a `DataView`.
5337function ie10IsDataView(obj) {
5338 return obj != null && Object(__WEBPACK_IMPORTED_MODULE_1__isFunction_js__["a" /* default */])(obj.getInt8) && Object(__WEBPACK_IMPORTED_MODULE_2__isArrayBuffer_js__["a" /* default */])(obj.buffer);
5339}
5340
5341/* harmony default export */ __webpack_exports__["a"] = (__WEBPACK_IMPORTED_MODULE_3__stringTagBug_js__["a" /* hasStringTagBug */] ? ie10IsDataView : isDataView);
5342
5343
5344/***/ }),
5345/* 137 */
5346/***/ (function(module, __webpack_exports__, __webpack_require__) {
5347
5348"use strict";
5349/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(18);
5350/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__has_js__ = __webpack_require__(47);
5351
5352
5353
5354var isArguments = Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('Arguments');
5355
5356// Define a fallback version of the method in browsers (ahem, IE < 9), where
5357// there isn't any inspectable "Arguments" type.
5358(function() {
5359 if (!isArguments(arguments)) {
5360 isArguments = function(obj) {
5361 return Object(__WEBPACK_IMPORTED_MODULE_1__has_js__["a" /* default */])(obj, 'callee');
5362 };
5363 }
5364}());
5365
5366/* harmony default export */ __webpack_exports__["a"] = (isArguments);
5367
5368
5369/***/ }),
5370/* 138 */
5371/***/ (function(module, __webpack_exports__, __webpack_require__) {
5372
5373"use strict";
5374/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__shallowProperty_js__ = __webpack_require__(188);
5375
5376
5377// Internal helper to obtain the `byteLength` property of an object.
5378/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__shallowProperty_js__["a" /* default */])('byteLength'));
5379
5380
5381/***/ }),
5382/* 139 */
5383/***/ (function(module, __webpack_exports__, __webpack_require__) {
5384
5385"use strict";
5386/* harmony export (immutable) */ __webpack_exports__["a"] = ie11fingerprint;
5387/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return mapMethods; });
5388/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return weakMapMethods; });
5389/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return setMethods; });
5390/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__getLength_js__ = __webpack_require__(31);
5391/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isFunction_js__ = __webpack_require__(30);
5392/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__allKeys_js__ = __webpack_require__(87);
5393
5394
5395
5396
5397// Since the regular `Object.prototype.toString` type tests don't work for
5398// some types in IE 11, we use a fingerprinting heuristic instead, based
5399// on the methods. It's not great, but it's the best we got.
5400// The fingerprint method lists are defined below.
5401function ie11fingerprint(methods) {
5402 var length = Object(__WEBPACK_IMPORTED_MODULE_0__getLength_js__["a" /* default */])(methods);
5403 return function(obj) {
5404 if (obj == null) return false;
5405 // `Map`, `WeakMap` and `Set` have no enumerable keys.
5406 var keys = Object(__WEBPACK_IMPORTED_MODULE_2__allKeys_js__["a" /* default */])(obj);
5407 if (Object(__WEBPACK_IMPORTED_MODULE_0__getLength_js__["a" /* default */])(keys)) return false;
5408 for (var i = 0; i < length; i++) {
5409 if (!Object(__WEBPACK_IMPORTED_MODULE_1__isFunction_js__["a" /* default */])(obj[methods[i]])) return false;
5410 }
5411 // If we are testing against `WeakMap`, we need to ensure that
5412 // `obj` doesn't have a `forEach` method in order to distinguish
5413 // it from a regular `Map`.
5414 return methods !== weakMapMethods || !Object(__WEBPACK_IMPORTED_MODULE_1__isFunction_js__["a" /* default */])(obj[forEachName]);
5415 };
5416}
5417
5418// In the interest of compact minification, we write
5419// each string in the fingerprints only once.
5420var forEachName = 'forEach',
5421 hasName = 'has',
5422 commonInit = ['clear', 'delete'],
5423 mapTail = ['get', hasName, 'set'];
5424
5425// `Map`, `WeakMap` and `Set` each have slightly different
5426// combinations of the above sublists.
5427var mapMethods = commonInit.concat(forEachName, mapTail),
5428 weakMapMethods = commonInit.concat(mapTail),
5429 setMethods = ['add'].concat(commonInit, forEachName, hasName);
5430
5431
5432/***/ }),
5433/* 140 */
5434/***/ (function(module, __webpack_exports__, __webpack_require__) {
5435
5436"use strict";
5437/* harmony export (immutable) */ __webpack_exports__["a"] = createAssigner;
5438// An internal function for creating assigner functions.
5439function createAssigner(keysFunc, defaults) {
5440 return function(obj) {
5441 var length = arguments.length;
5442 if (defaults) obj = Object(obj);
5443 if (length < 2 || obj == null) return obj;
5444 for (var index = 1; index < length; index++) {
5445 var source = arguments[index],
5446 keys = keysFunc(source),
5447 l = keys.length;
5448 for (var i = 0; i < l; i++) {
5449 var key = keys[i];
5450 if (!defaults || obj[key] === void 0) obj[key] = source[key];
5451 }
5452 }
5453 return obj;
5454 };
5455}
5456
5457
5458/***/ }),
5459/* 141 */
5460/***/ (function(module, __webpack_exports__, __webpack_require__) {
5461
5462"use strict";
5463/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createAssigner_js__ = __webpack_require__(140);
5464/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__keys_js__ = __webpack_require__(17);
5465
5466
5467
5468// Assigns a given object with all the own properties in the passed-in
5469// object(s).
5470// (https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object/assign)
5471/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createAssigner_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__keys_js__["a" /* default */]));
5472
5473
5474/***/ }),
5475/* 142 */
5476/***/ (function(module, __webpack_exports__, __webpack_require__) {
5477
5478"use strict";
5479/* harmony export (immutable) */ __webpack_exports__["a"] = deepGet;
5480// Internal function to obtain a nested property in `obj` along `path`.
5481function deepGet(obj, path) {
5482 var length = path.length;
5483 for (var i = 0; i < length; i++) {
5484 if (obj == null) return void 0;
5485 obj = obj[path[i]];
5486 }
5487 return length ? obj : void 0;
5488}
5489
5490
5491/***/ }),
5492/* 143 */
5493/***/ (function(module, __webpack_exports__, __webpack_require__) {
5494
5495"use strict";
5496/* harmony export (immutable) */ __webpack_exports__["a"] = identity;
5497// Keep the identity function around for default iteratees.
5498function identity(value) {
5499 return value;
5500}
5501
5502
5503/***/ }),
5504/* 144 */
5505/***/ (function(module, __webpack_exports__, __webpack_require__) {
5506
5507"use strict";
5508/* harmony export (immutable) */ __webpack_exports__["a"] = property;
5509/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__deepGet_js__ = __webpack_require__(142);
5510/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__toPath_js__ = __webpack_require__(88);
5511
5512
5513
5514// Creates a function that, when passed an object, will traverse that object’s
5515// properties down the given `path`, specified as an array of keys or indices.
5516function property(path) {
5517 path = Object(__WEBPACK_IMPORTED_MODULE_1__toPath_js__["a" /* default */])(path);
5518 return function(obj) {
5519 return Object(__WEBPACK_IMPORTED_MODULE_0__deepGet_js__["a" /* default */])(obj, path);
5520 };
5521}
5522
5523
5524/***/ }),
5525/* 145 */
5526/***/ (function(module, __webpack_exports__, __webpack_require__) {
5527
5528"use strict";
5529// A (possibly faster) way to get the current timestamp as an integer.
5530/* harmony default export */ __webpack_exports__["a"] = (Date.now || function() {
5531 return new Date().getTime();
5532});
5533
5534
5535/***/ }),
5536/* 146 */
5537/***/ (function(module, __webpack_exports__, __webpack_require__) {
5538
5539"use strict";
5540/* harmony export (immutable) */ __webpack_exports__["a"] = negate;
5541// Returns a negated version of the passed-in predicate.
5542function negate(predicate) {
5543 return function() {
5544 return !predicate.apply(this, arguments);
5545 };
5546}
5547
5548
5549/***/ }),
5550/* 147 */
5551/***/ (function(module, __webpack_exports__, __webpack_require__) {
5552
5553"use strict";
5554/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createPredicateIndexFinder_js__ = __webpack_require__(211);
5555
5556
5557// Returns the first index on an array-like that passes a truth test.
5558/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createPredicateIndexFinder_js__["a" /* default */])(1));
5559
5560
5561/***/ }),
5562/* 148 */
5563/***/ (function(module, __webpack_exports__, __webpack_require__) {
5564
5565"use strict";
5566/* harmony export (immutable) */ __webpack_exports__["a"] = pluck;
5567/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__map_js__ = __webpack_require__(73);
5568/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__property_js__ = __webpack_require__(144);
5569
5570
5571
5572// Convenience version of a common use case of `_.map`: fetching a property.
5573function pluck(obj, key) {
5574 return Object(__WEBPACK_IMPORTED_MODULE_0__map_js__["a" /* default */])(obj, Object(__WEBPACK_IMPORTED_MODULE_1__property_js__["a" /* default */])(key));
5575}
5576
5577
5578/***/ }),
5579/* 149 */
5580/***/ (function(module, exports, __webpack_require__) {
5581
5582module.exports = __webpack_require__(402);
5583
5584/***/ }),
5585/* 150 */
5586/***/ (function(module, exports, __webpack_require__) {
5587
5588"use strict";
5589
5590var fails = __webpack_require__(2);
5591
5592module.exports = function (METHOD_NAME, argument) {
5593 var method = [][METHOD_NAME];
5594 return !!method && fails(function () {
5595 // eslint-disable-next-line no-useless-call -- required for testing
5596 method.call(null, argument || function () { return 1; }, 1);
5597 });
5598};
5599
5600
5601/***/ }),
5602/* 151 */
5603/***/ (function(module, exports, __webpack_require__) {
5604
5605var wellKnownSymbol = __webpack_require__(5);
5606
5607exports.f = wellKnownSymbol;
5608
5609
5610/***/ }),
5611/* 152 */
5612/***/ (function(module, exports, __webpack_require__) {
5613
5614module.exports = __webpack_require__(251);
5615
5616/***/ }),
5617/* 153 */
5618/***/ (function(module, exports, __webpack_require__) {
5619
5620module.exports = __webpack_require__(504);
5621
5622/***/ }),
5623/* 154 */
5624/***/ (function(module, exports, __webpack_require__) {
5625
5626module.exports = __webpack_require__(248);
5627
5628/***/ }),
5629/* 155 */
5630/***/ (function(module, exports, __webpack_require__) {
5631
5632"use strict";
5633
5634
5635module.exports = __webpack_require__(621);
5636
5637/***/ }),
5638/* 156 */
5639/***/ (function(module, exports, __webpack_require__) {
5640
5641var defineBuiltIn = __webpack_require__(45);
5642
5643module.exports = function (target, src, options) {
5644 for (var key in src) {
5645 if (options && options.unsafe && target[key]) target[key] = src[key];
5646 else defineBuiltIn(target, key, src[key], options);
5647 } return target;
5648};
5649
5650
5651/***/ }),
5652/* 157 */
5653/***/ (function(module, exports, __webpack_require__) {
5654
5655/* eslint-disable es-x/no-symbol -- required for testing */
5656var NATIVE_SYMBOL = __webpack_require__(65);
5657
5658module.exports = NATIVE_SYMBOL
5659 && !Symbol.sham
5660 && typeof Symbol.iterator == 'symbol';
5661
5662
5663/***/ }),
5664/* 158 */
5665/***/ (function(module, exports, __webpack_require__) {
5666
5667var DESCRIPTORS = __webpack_require__(14);
5668var fails = __webpack_require__(2);
5669var createElement = __webpack_require__(124);
5670
5671// Thanks to IE8 for its funny defineProperty
5672module.exports = !DESCRIPTORS && !fails(function () {
5673 // eslint-disable-next-line es-x/no-object-defineproperty -- required for testing
5674 return Object.defineProperty(createElement('div'), 'a', {
5675 get: function () { return 7; }
5676 }).a != 7;
5677});
5678
5679
5680/***/ }),
5681/* 159 */
5682/***/ (function(module, exports, __webpack_require__) {
5683
5684var fails = __webpack_require__(2);
5685var isCallable = __webpack_require__(9);
5686
5687var replacement = /#|\.prototype\./;
5688
5689var isForced = function (feature, detection) {
5690 var value = data[normalize(feature)];
5691 return value == POLYFILL ? true
5692 : value == NATIVE ? false
5693 : isCallable(detection) ? fails(detection)
5694 : !!detection;
5695};
5696
5697var normalize = isForced.normalize = function (string) {
5698 return String(string).replace(replacement, '.').toLowerCase();
5699};
5700
5701var data = isForced.data = {};
5702var NATIVE = isForced.NATIVE = 'N';
5703var POLYFILL = isForced.POLYFILL = 'P';
5704
5705module.exports = isForced;
5706
5707
5708/***/ }),
5709/* 160 */
5710/***/ (function(module, exports, __webpack_require__) {
5711
5712var DESCRIPTORS = __webpack_require__(14);
5713var fails = __webpack_require__(2);
5714
5715// V8 ~ Chrome 36-
5716// https://bugs.chromium.org/p/v8/issues/detail?id=3334
5717module.exports = DESCRIPTORS && fails(function () {
5718 // eslint-disable-next-line es-x/no-object-defineproperty -- required for testing
5719 return Object.defineProperty(function () { /* empty */ }, 'prototype', {
5720 value: 42,
5721 writable: false
5722 }).prototype != 42;
5723});
5724
5725
5726/***/ }),
5727/* 161 */
5728/***/ (function(module, exports, __webpack_require__) {
5729
5730var fails = __webpack_require__(2);
5731
5732module.exports = !fails(function () {
5733 function F() { /* empty */ }
5734 F.prototype.constructor = null;
5735 // eslint-disable-next-line es-x/no-object-getprototypeof -- required for testing
5736 return Object.getPrototypeOf(new F()) !== F.prototype;
5737});
5738
5739
5740/***/ }),
5741/* 162 */
5742/***/ (function(module, exports, __webpack_require__) {
5743
5744var getBuiltIn = __webpack_require__(20);
5745var uncurryThis = __webpack_require__(4);
5746var getOwnPropertyNamesModule = __webpack_require__(105);
5747var getOwnPropertySymbolsModule = __webpack_require__(106);
5748var anObject = __webpack_require__(21);
5749
5750var concat = uncurryThis([].concat);
5751
5752// all object keys, includes non-enumerable and symbols
5753module.exports = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) {
5754 var keys = getOwnPropertyNamesModule.f(anObject(it));
5755 var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;
5756 return getOwnPropertySymbols ? concat(keys, getOwnPropertySymbols(it)) : keys;
5757};
5758
5759
5760/***/ }),
5761/* 163 */
5762/***/ (function(module, exports, __webpack_require__) {
5763
5764var uncurryThis = __webpack_require__(4);
5765var hasOwn = __webpack_require__(13);
5766var toIndexedObject = __webpack_require__(35);
5767var indexOf = __webpack_require__(125).indexOf;
5768var hiddenKeys = __webpack_require__(83);
5769
5770var push = uncurryThis([].push);
5771
5772module.exports = function (object, names) {
5773 var O = toIndexedObject(object);
5774 var i = 0;
5775 var result = [];
5776 var key;
5777 for (key in O) !hasOwn(hiddenKeys, key) && hasOwn(O, key) && push(result, key);
5778 // Don't enum bug & hidden keys
5779 while (names.length > i) if (hasOwn(O, key = names[i++])) {
5780 ~indexOf(result, key) || push(result, key);
5781 }
5782 return result;
5783};
5784
5785
5786/***/ }),
5787/* 164 */
5788/***/ (function(module, exports, __webpack_require__) {
5789
5790var getBuiltIn = __webpack_require__(20);
5791
5792module.exports = getBuiltIn('document', 'documentElement');
5793
5794
5795/***/ }),
5796/* 165 */
5797/***/ (function(module, exports, __webpack_require__) {
5798
5799var wellKnownSymbol = __webpack_require__(5);
5800var Iterators = __webpack_require__(54);
5801
5802var ITERATOR = wellKnownSymbol('iterator');
5803var ArrayPrototype = Array.prototype;
5804
5805// check on default Array iterator
5806module.exports = function (it) {
5807 return it !== undefined && (Iterators.Array === it || ArrayPrototype[ITERATOR] === it);
5808};
5809
5810
5811/***/ }),
5812/* 166 */
5813/***/ (function(module, exports, __webpack_require__) {
5814
5815var call = __webpack_require__(15);
5816var aCallable = __webpack_require__(29);
5817var anObject = __webpack_require__(21);
5818var tryToString = __webpack_require__(67);
5819var getIteratorMethod = __webpack_require__(108);
5820
5821var $TypeError = TypeError;
5822
5823module.exports = function (argument, usingIterator) {
5824 var iteratorMethod = arguments.length < 2 ? getIteratorMethod(argument) : usingIterator;
5825 if (aCallable(iteratorMethod)) return anObject(call(iteratorMethod, argument));
5826 throw $TypeError(tryToString(argument) + ' is not iterable');
5827};
5828
5829
5830/***/ }),
5831/* 167 */
5832/***/ (function(module, exports, __webpack_require__) {
5833
5834var call = __webpack_require__(15);
5835var anObject = __webpack_require__(21);
5836var getMethod = __webpack_require__(122);
5837
5838module.exports = function (iterator, kind, value) {
5839 var innerResult, innerError;
5840 anObject(iterator);
5841 try {
5842 innerResult = getMethod(iterator, 'return');
5843 if (!innerResult) {
5844 if (kind === 'throw') throw value;
5845 return value;
5846 }
5847 innerResult = call(innerResult, iterator);
5848 } catch (error) {
5849 innerError = true;
5850 innerResult = error;
5851 }
5852 if (kind === 'throw') throw value;
5853 if (innerError) throw innerResult;
5854 anObject(innerResult);
5855 return value;
5856};
5857
5858
5859/***/ }),
5860/* 168 */
5861/***/ (function(module, exports, __webpack_require__) {
5862
5863var global = __webpack_require__(8);
5864var isCallable = __webpack_require__(9);
5865var inspectSource = __webpack_require__(132);
5866
5867var WeakMap = global.WeakMap;
5868
5869module.exports = isCallable(WeakMap) && /native code/.test(inspectSource(WeakMap));
5870
5871
5872/***/ }),
5873/* 169 */
5874/***/ (function(module, exports, __webpack_require__) {
5875
5876var DESCRIPTORS = __webpack_require__(14);
5877var hasOwn = __webpack_require__(13);
5878
5879var FunctionPrototype = Function.prototype;
5880// eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
5881var getDescriptor = DESCRIPTORS && Object.getOwnPropertyDescriptor;
5882
5883var EXISTS = hasOwn(FunctionPrototype, 'name');
5884// additional protection from minified / mangled / dropped function names
5885var PROPER = EXISTS && (function something() { /* empty */ }).name === 'something';
5886var CONFIGURABLE = EXISTS && (!DESCRIPTORS || (DESCRIPTORS && getDescriptor(FunctionPrototype, 'name').configurable));
5887
5888module.exports = {
5889 EXISTS: EXISTS,
5890 PROPER: PROPER,
5891 CONFIGURABLE: CONFIGURABLE
5892};
5893
5894
5895/***/ }),
5896/* 170 */
5897/***/ (function(module, exports, __webpack_require__) {
5898
5899"use strict";
5900
5901var fails = __webpack_require__(2);
5902var isCallable = __webpack_require__(9);
5903var create = __webpack_require__(53);
5904var getPrototypeOf = __webpack_require__(102);
5905var defineBuiltIn = __webpack_require__(45);
5906var wellKnownSymbol = __webpack_require__(5);
5907var IS_PURE = __webpack_require__(36);
5908
5909var ITERATOR = wellKnownSymbol('iterator');
5910var BUGGY_SAFARI_ITERATORS = false;
5911
5912// `%IteratorPrototype%` object
5913// https://tc39.es/ecma262/#sec-%iteratorprototype%-object
5914var IteratorPrototype, PrototypeOfArrayIteratorPrototype, arrayIterator;
5915
5916/* eslint-disable es-x/no-array-prototype-keys -- safe */
5917if ([].keys) {
5918 arrayIterator = [].keys();
5919 // Safari 8 has buggy iterators w/o `next`
5920 if (!('next' in arrayIterator)) BUGGY_SAFARI_ITERATORS = true;
5921 else {
5922 PrototypeOfArrayIteratorPrototype = getPrototypeOf(getPrototypeOf(arrayIterator));
5923 if (PrototypeOfArrayIteratorPrototype !== Object.prototype) IteratorPrototype = PrototypeOfArrayIteratorPrototype;
5924 }
5925}
5926
5927var NEW_ITERATOR_PROTOTYPE = IteratorPrototype == undefined || fails(function () {
5928 var test = {};
5929 // FF44- legacy iterators case
5930 return IteratorPrototype[ITERATOR].call(test) !== test;
5931});
5932
5933if (NEW_ITERATOR_PROTOTYPE) IteratorPrototype = {};
5934else if (IS_PURE) IteratorPrototype = create(IteratorPrototype);
5935
5936// `%IteratorPrototype%[@@iterator]()` method
5937// https://tc39.es/ecma262/#sec-%iteratorprototype%-@@iterator
5938if (!isCallable(IteratorPrototype[ITERATOR])) {
5939 defineBuiltIn(IteratorPrototype, ITERATOR, function () {
5940 return this;
5941 });
5942}
5943
5944module.exports = {
5945 IteratorPrototype: IteratorPrototype,
5946 BUGGY_SAFARI_ITERATORS: BUGGY_SAFARI_ITERATORS
5947};
5948
5949
5950/***/ }),
5951/* 171 */
5952/***/ (function(module, exports, __webpack_require__) {
5953
5954"use strict";
5955
5956var getBuiltIn = __webpack_require__(20);
5957var definePropertyModule = __webpack_require__(23);
5958var wellKnownSymbol = __webpack_require__(5);
5959var DESCRIPTORS = __webpack_require__(14);
5960
5961var SPECIES = wellKnownSymbol('species');
5962
5963module.exports = function (CONSTRUCTOR_NAME) {
5964 var Constructor = getBuiltIn(CONSTRUCTOR_NAME);
5965 var defineProperty = definePropertyModule.f;
5966
5967 if (DESCRIPTORS && Constructor && !Constructor[SPECIES]) {
5968 defineProperty(Constructor, SPECIES, {
5969 configurable: true,
5970 get: function () { return this; }
5971 });
5972 }
5973};
5974
5975
5976/***/ }),
5977/* 172 */
5978/***/ (function(module, exports, __webpack_require__) {
5979
5980var anObject = __webpack_require__(21);
5981var aConstructor = __webpack_require__(173);
5982var wellKnownSymbol = __webpack_require__(5);
5983
5984var SPECIES = wellKnownSymbol('species');
5985
5986// `SpeciesConstructor` abstract operation
5987// https://tc39.es/ecma262/#sec-speciesconstructor
5988module.exports = function (O, defaultConstructor) {
5989 var C = anObject(O).constructor;
5990 var S;
5991 return C === undefined || (S = anObject(C)[SPECIES]) == undefined ? defaultConstructor : aConstructor(S);
5992};
5993
5994
5995/***/ }),
5996/* 173 */
5997/***/ (function(module, exports, __webpack_require__) {
5998
5999var isConstructor = __webpack_require__(111);
6000var tryToString = __webpack_require__(67);
6001
6002var $TypeError = TypeError;
6003
6004// `Assert: IsConstructor(argument) is true`
6005module.exports = function (argument) {
6006 if (isConstructor(argument)) return argument;
6007 throw $TypeError(tryToString(argument) + ' is not a constructor');
6008};
6009
6010
6011/***/ }),
6012/* 174 */
6013/***/ (function(module, exports, __webpack_require__) {
6014
6015var global = __webpack_require__(8);
6016var apply = __webpack_require__(79);
6017var bind = __webpack_require__(52);
6018var isCallable = __webpack_require__(9);
6019var hasOwn = __webpack_require__(13);
6020var fails = __webpack_require__(2);
6021var html = __webpack_require__(164);
6022var arraySlice = __webpack_require__(112);
6023var createElement = __webpack_require__(124);
6024var validateArgumentsLength = __webpack_require__(304);
6025var IS_IOS = __webpack_require__(175);
6026var IS_NODE = __webpack_require__(109);
6027
6028var set = global.setImmediate;
6029var clear = global.clearImmediate;
6030var process = global.process;
6031var Dispatch = global.Dispatch;
6032var Function = global.Function;
6033var MessageChannel = global.MessageChannel;
6034var String = global.String;
6035var counter = 0;
6036var queue = {};
6037var ONREADYSTATECHANGE = 'onreadystatechange';
6038var location, defer, channel, port;
6039
6040try {
6041 // Deno throws a ReferenceError on `location` access without `--location` flag
6042 location = global.location;
6043} catch (error) { /* empty */ }
6044
6045var run = function (id) {
6046 if (hasOwn(queue, id)) {
6047 var fn = queue[id];
6048 delete queue[id];
6049 fn();
6050 }
6051};
6052
6053var runner = function (id) {
6054 return function () {
6055 run(id);
6056 };
6057};
6058
6059var listener = function (event) {
6060 run(event.data);
6061};
6062
6063var post = function (id) {
6064 // old engines have not location.origin
6065 global.postMessage(String(id), location.protocol + '//' + location.host);
6066};
6067
6068// Node.js 0.9+ & IE10+ has setImmediate, otherwise:
6069if (!set || !clear) {
6070 set = function setImmediate(handler) {
6071 validateArgumentsLength(arguments.length, 1);
6072 var fn = isCallable(handler) ? handler : Function(handler);
6073 var args = arraySlice(arguments, 1);
6074 queue[++counter] = function () {
6075 apply(fn, undefined, args);
6076 };
6077 defer(counter);
6078 return counter;
6079 };
6080 clear = function clearImmediate(id) {
6081 delete queue[id];
6082 };
6083 // Node.js 0.8-
6084 if (IS_NODE) {
6085 defer = function (id) {
6086 process.nextTick(runner(id));
6087 };
6088 // Sphere (JS game engine) Dispatch API
6089 } else if (Dispatch && Dispatch.now) {
6090 defer = function (id) {
6091 Dispatch.now(runner(id));
6092 };
6093 // Browsers with MessageChannel, includes WebWorkers
6094 // except iOS - https://github.com/zloirock/core-js/issues/624
6095 } else if (MessageChannel && !IS_IOS) {
6096 channel = new MessageChannel();
6097 port = channel.port2;
6098 channel.port1.onmessage = listener;
6099 defer = bind(port.postMessage, port);
6100 // Browsers with postMessage, skip WebWorkers
6101 // IE8 has postMessage, but it's sync & typeof its postMessage is 'object'
6102 } else if (
6103 global.addEventListener &&
6104 isCallable(global.postMessage) &&
6105 !global.importScripts &&
6106 location && location.protocol !== 'file:' &&
6107 !fails(post)
6108 ) {
6109 defer = post;
6110 global.addEventListener('message', listener, false);
6111 // IE8-
6112 } else if (ONREADYSTATECHANGE in createElement('script')) {
6113 defer = function (id) {
6114 html.appendChild(createElement('script'))[ONREADYSTATECHANGE] = function () {
6115 html.removeChild(this);
6116 run(id);
6117 };
6118 };
6119 // Rest old browsers
6120 } else {
6121 defer = function (id) {
6122 setTimeout(runner(id), 0);
6123 };
6124 }
6125}
6126
6127module.exports = {
6128 set: set,
6129 clear: clear
6130};
6131
6132
6133/***/ }),
6134/* 175 */
6135/***/ (function(module, exports, __webpack_require__) {
6136
6137var userAgent = __webpack_require__(51);
6138
6139module.exports = /(?:ipad|iphone|ipod).*applewebkit/i.test(userAgent);
6140
6141
6142/***/ }),
6143/* 176 */
6144/***/ (function(module, exports, __webpack_require__) {
6145
6146var NativePromiseConstructor = __webpack_require__(69);
6147var checkCorrectnessOfIteration = __webpack_require__(177);
6148var FORCED_PROMISE_CONSTRUCTOR = __webpack_require__(85).CONSTRUCTOR;
6149
6150module.exports = FORCED_PROMISE_CONSTRUCTOR || !checkCorrectnessOfIteration(function (iterable) {
6151 NativePromiseConstructor.all(iterable).then(undefined, function () { /* empty */ });
6152});
6153
6154
6155/***/ }),
6156/* 177 */
6157/***/ (function(module, exports, __webpack_require__) {
6158
6159var wellKnownSymbol = __webpack_require__(5);
6160
6161var ITERATOR = wellKnownSymbol('iterator');
6162var SAFE_CLOSING = false;
6163
6164try {
6165 var called = 0;
6166 var iteratorWithReturn = {
6167 next: function () {
6168 return { done: !!called++ };
6169 },
6170 'return': function () {
6171 SAFE_CLOSING = true;
6172 }
6173 };
6174 iteratorWithReturn[ITERATOR] = function () {
6175 return this;
6176 };
6177 // eslint-disable-next-line es-x/no-array-from, no-throw-literal -- required for testing
6178 Array.from(iteratorWithReturn, function () { throw 2; });
6179} catch (error) { /* empty */ }
6180
6181module.exports = function (exec, SKIP_CLOSING) {
6182 if (!SKIP_CLOSING && !SAFE_CLOSING) return false;
6183 var ITERATION_SUPPORT = false;
6184 try {
6185 var object = {};
6186 object[ITERATOR] = function () {
6187 return {
6188 next: function () {
6189 return { done: ITERATION_SUPPORT = true };
6190 }
6191 };
6192 };
6193 exec(object);
6194 } catch (error) { /* empty */ }
6195 return ITERATION_SUPPORT;
6196};
6197
6198
6199/***/ }),
6200/* 178 */
6201/***/ (function(module, exports, __webpack_require__) {
6202
6203var anObject = __webpack_require__(21);
6204var isObject = __webpack_require__(11);
6205var newPromiseCapability = __webpack_require__(57);
6206
6207module.exports = function (C, x) {
6208 anObject(C);
6209 if (isObject(x) && x.constructor === C) return x;
6210 var promiseCapability = newPromiseCapability.f(C);
6211 var resolve = promiseCapability.resolve;
6212 resolve(x);
6213 return promiseCapability.promise;
6214};
6215
6216
6217/***/ }),
6218/* 179 */
6219/***/ (function(module, __webpack_exports__, __webpack_require__) {
6220
6221"use strict";
6222/* harmony export (immutable) */ __webpack_exports__["a"] = isUndefined;
6223// Is a given variable undefined?
6224function isUndefined(obj) {
6225 return obj === void 0;
6226}
6227
6228
6229/***/ }),
6230/* 180 */
6231/***/ (function(module, __webpack_exports__, __webpack_require__) {
6232
6233"use strict";
6234/* harmony export (immutable) */ __webpack_exports__["a"] = isBoolean;
6235/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(6);
6236
6237
6238// Is a given value a boolean?
6239function isBoolean(obj) {
6240 return obj === true || obj === false || __WEBPACK_IMPORTED_MODULE_0__setup_js__["t" /* toString */].call(obj) === '[object Boolean]';
6241}
6242
6243
6244/***/ }),
6245/* 181 */
6246/***/ (function(module, __webpack_exports__, __webpack_require__) {
6247
6248"use strict";
6249/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(18);
6250
6251
6252/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('Number'));
6253
6254
6255/***/ }),
6256/* 182 */
6257/***/ (function(module, __webpack_exports__, __webpack_require__) {
6258
6259"use strict";
6260/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(18);
6261
6262
6263/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('Symbol'));
6264
6265
6266/***/ }),
6267/* 183 */
6268/***/ (function(module, __webpack_exports__, __webpack_require__) {
6269
6270"use strict";
6271/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(18);
6272
6273
6274/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('ArrayBuffer'));
6275
6276
6277/***/ }),
6278/* 184 */
6279/***/ (function(module, __webpack_exports__, __webpack_require__) {
6280
6281"use strict";
6282/* harmony export (immutable) */ __webpack_exports__["a"] = isNaN;
6283/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(6);
6284/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isNumber_js__ = __webpack_require__(181);
6285
6286
6287
6288// Is the given value `NaN`?
6289function isNaN(obj) {
6290 return Object(__WEBPACK_IMPORTED_MODULE_1__isNumber_js__["a" /* default */])(obj) && Object(__WEBPACK_IMPORTED_MODULE_0__setup_js__["g" /* _isNaN */])(obj);
6291}
6292
6293
6294/***/ }),
6295/* 185 */
6296/***/ (function(module, __webpack_exports__, __webpack_require__) {
6297
6298"use strict";
6299/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(6);
6300/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isDataView_js__ = __webpack_require__(136);
6301/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__constant_js__ = __webpack_require__(186);
6302/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__isBufferLike_js__ = __webpack_require__(329);
6303
6304
6305
6306
6307
6308// Is a given value a typed array?
6309var typedArrayPattern = /\[object ((I|Ui)nt(8|16|32)|Float(32|64)|Uint8Clamped|Big(I|Ui)nt64)Array\]/;
6310function isTypedArray(obj) {
6311 // `ArrayBuffer.isView` is the most future-proof, so use it when available.
6312 // Otherwise, fall back on the above regular expression.
6313 return __WEBPACK_IMPORTED_MODULE_0__setup_js__["l" /* nativeIsView */] ? (Object(__WEBPACK_IMPORTED_MODULE_0__setup_js__["l" /* nativeIsView */])(obj) && !Object(__WEBPACK_IMPORTED_MODULE_1__isDataView_js__["a" /* default */])(obj)) :
6314 Object(__WEBPACK_IMPORTED_MODULE_3__isBufferLike_js__["a" /* default */])(obj) && typedArrayPattern.test(__WEBPACK_IMPORTED_MODULE_0__setup_js__["t" /* toString */].call(obj));
6315}
6316
6317/* harmony default export */ __webpack_exports__["a"] = (__WEBPACK_IMPORTED_MODULE_0__setup_js__["r" /* supportsArrayBuffer */] ? isTypedArray : Object(__WEBPACK_IMPORTED_MODULE_2__constant_js__["a" /* default */])(false));
6318
6319
6320/***/ }),
6321/* 186 */
6322/***/ (function(module, __webpack_exports__, __webpack_require__) {
6323
6324"use strict";
6325/* harmony export (immutable) */ __webpack_exports__["a"] = constant;
6326// Predicate-generating function. Often useful outside of Underscore.
6327function constant(value) {
6328 return function() {
6329 return value;
6330 };
6331}
6332
6333
6334/***/ }),
6335/* 187 */
6336/***/ (function(module, __webpack_exports__, __webpack_require__) {
6337
6338"use strict";
6339/* harmony export (immutable) */ __webpack_exports__["a"] = createSizePropertyCheck;
6340/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(6);
6341
6342
6343// Common internal logic for `isArrayLike` and `isBufferLike`.
6344function createSizePropertyCheck(getSizeProperty) {
6345 return function(collection) {
6346 var sizeProperty = getSizeProperty(collection);
6347 return typeof sizeProperty == 'number' && sizeProperty >= 0 && sizeProperty <= __WEBPACK_IMPORTED_MODULE_0__setup_js__["b" /* MAX_ARRAY_INDEX */];
6348 }
6349}
6350
6351
6352/***/ }),
6353/* 188 */
6354/***/ (function(module, __webpack_exports__, __webpack_require__) {
6355
6356"use strict";
6357/* harmony export (immutable) */ __webpack_exports__["a"] = shallowProperty;
6358// Internal helper to generate a function to obtain property `key` from `obj`.
6359function shallowProperty(key) {
6360 return function(obj) {
6361 return obj == null ? void 0 : obj[key];
6362 };
6363}
6364
6365
6366/***/ }),
6367/* 189 */
6368/***/ (function(module, __webpack_exports__, __webpack_require__) {
6369
6370"use strict";
6371/* harmony export (immutable) */ __webpack_exports__["a"] = collectNonEnumProps;
6372/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(6);
6373/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isFunction_js__ = __webpack_require__(30);
6374/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__has_js__ = __webpack_require__(47);
6375
6376
6377
6378
6379// Internal helper to create a simple lookup structure.
6380// `collectNonEnumProps` used to depend on `_.contains`, but this led to
6381// circular imports. `emulatedSet` is a one-off solution that only works for
6382// arrays of strings.
6383function emulatedSet(keys) {
6384 var hash = {};
6385 for (var l = keys.length, i = 0; i < l; ++i) hash[keys[i]] = true;
6386 return {
6387 contains: function(key) { return hash[key]; },
6388 push: function(key) {
6389 hash[key] = true;
6390 return keys.push(key);
6391 }
6392 };
6393}
6394
6395// Internal helper. Checks `keys` for the presence of keys in IE < 9 that won't
6396// be iterated by `for key in ...` and thus missed. Extends `keys` in place if
6397// needed.
6398function collectNonEnumProps(obj, keys) {
6399 keys = emulatedSet(keys);
6400 var nonEnumIdx = __WEBPACK_IMPORTED_MODULE_0__setup_js__["n" /* nonEnumerableProps */].length;
6401 var constructor = obj.constructor;
6402 var proto = Object(__WEBPACK_IMPORTED_MODULE_1__isFunction_js__["a" /* default */])(constructor) && constructor.prototype || __WEBPACK_IMPORTED_MODULE_0__setup_js__["c" /* ObjProto */];
6403
6404 // Constructor is a special case.
6405 var prop = 'constructor';
6406 if (Object(__WEBPACK_IMPORTED_MODULE_2__has_js__["a" /* default */])(obj, prop) && !keys.contains(prop)) keys.push(prop);
6407
6408 while (nonEnumIdx--) {
6409 prop = __WEBPACK_IMPORTED_MODULE_0__setup_js__["n" /* nonEnumerableProps */][nonEnumIdx];
6410 if (prop in obj && obj[prop] !== proto[prop] && !keys.contains(prop)) {
6411 keys.push(prop);
6412 }
6413 }
6414}
6415
6416
6417/***/ }),
6418/* 190 */
6419/***/ (function(module, __webpack_exports__, __webpack_require__) {
6420
6421"use strict";
6422/* harmony export (immutable) */ __webpack_exports__["a"] = isMatch;
6423/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__keys_js__ = __webpack_require__(17);
6424
6425
6426// Returns whether an object has a given set of `key:value` pairs.
6427function isMatch(object, attrs) {
6428 var _keys = Object(__WEBPACK_IMPORTED_MODULE_0__keys_js__["a" /* default */])(attrs), length = _keys.length;
6429 if (object == null) return !length;
6430 var obj = Object(object);
6431 for (var i = 0; i < length; i++) {
6432 var key = _keys[i];
6433 if (attrs[key] !== obj[key] || !(key in obj)) return false;
6434 }
6435 return true;
6436}
6437
6438
6439/***/ }),
6440/* 191 */
6441/***/ (function(module, __webpack_exports__, __webpack_require__) {
6442
6443"use strict";
6444/* harmony export (immutable) */ __webpack_exports__["a"] = invert;
6445/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__keys_js__ = __webpack_require__(17);
6446
6447
6448// Invert the keys and values of an object. The values must be serializable.
6449function invert(obj) {
6450 var result = {};
6451 var _keys = Object(__WEBPACK_IMPORTED_MODULE_0__keys_js__["a" /* default */])(obj);
6452 for (var i = 0, length = _keys.length; i < length; i++) {
6453 result[obj[_keys[i]]] = _keys[i];
6454 }
6455 return result;
6456}
6457
6458
6459/***/ }),
6460/* 192 */
6461/***/ (function(module, __webpack_exports__, __webpack_require__) {
6462
6463"use strict";
6464/* harmony export (immutable) */ __webpack_exports__["a"] = functions;
6465/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isFunction_js__ = __webpack_require__(30);
6466
6467
6468// Return a sorted list of the function names available on the object.
6469function functions(obj) {
6470 var names = [];
6471 for (var key in obj) {
6472 if (Object(__WEBPACK_IMPORTED_MODULE_0__isFunction_js__["a" /* default */])(obj[key])) names.push(key);
6473 }
6474 return names.sort();
6475}
6476
6477
6478/***/ }),
6479/* 193 */
6480/***/ (function(module, __webpack_exports__, __webpack_require__) {
6481
6482"use strict";
6483/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createAssigner_js__ = __webpack_require__(140);
6484/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__allKeys_js__ = __webpack_require__(87);
6485
6486
6487
6488// Extend a given object with all the properties in passed-in object(s).
6489/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createAssigner_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__allKeys_js__["a" /* default */]));
6490
6491
6492/***/ }),
6493/* 194 */
6494/***/ (function(module, __webpack_exports__, __webpack_require__) {
6495
6496"use strict";
6497/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createAssigner_js__ = __webpack_require__(140);
6498/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__allKeys_js__ = __webpack_require__(87);
6499
6500
6501
6502// Fill in a given object with default properties.
6503/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createAssigner_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__allKeys_js__["a" /* default */], true));
6504
6505
6506/***/ }),
6507/* 195 */
6508/***/ (function(module, __webpack_exports__, __webpack_require__) {
6509
6510"use strict";
6511/* harmony export (immutable) */ __webpack_exports__["a"] = baseCreate;
6512/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isObject_js__ = __webpack_require__(58);
6513/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__setup_js__ = __webpack_require__(6);
6514
6515
6516
6517// Create a naked function reference for surrogate-prototype-swapping.
6518function ctor() {
6519 return function(){};
6520}
6521
6522// An internal function for creating a new object that inherits from another.
6523function baseCreate(prototype) {
6524 if (!Object(__WEBPACK_IMPORTED_MODULE_0__isObject_js__["a" /* default */])(prototype)) return {};
6525 if (__WEBPACK_IMPORTED_MODULE_1__setup_js__["j" /* nativeCreate */]) return Object(__WEBPACK_IMPORTED_MODULE_1__setup_js__["j" /* nativeCreate */])(prototype);
6526 var Ctor = ctor();
6527 Ctor.prototype = prototype;
6528 var result = new Ctor;
6529 Ctor.prototype = null;
6530 return result;
6531}
6532
6533
6534/***/ }),
6535/* 196 */
6536/***/ (function(module, __webpack_exports__, __webpack_require__) {
6537
6538"use strict";
6539/* harmony export (immutable) */ __webpack_exports__["a"] = clone;
6540/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isObject_js__ = __webpack_require__(58);
6541/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isArray_js__ = __webpack_require__(59);
6542/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__extend_js__ = __webpack_require__(193);
6543
6544
6545
6546
6547// Create a (shallow-cloned) duplicate of an object.
6548function clone(obj) {
6549 if (!Object(__WEBPACK_IMPORTED_MODULE_0__isObject_js__["a" /* default */])(obj)) return obj;
6550 return Object(__WEBPACK_IMPORTED_MODULE_1__isArray_js__["a" /* default */])(obj) ? obj.slice() : Object(__WEBPACK_IMPORTED_MODULE_2__extend_js__["a" /* default */])({}, obj);
6551}
6552
6553
6554/***/ }),
6555/* 197 */
6556/***/ (function(module, __webpack_exports__, __webpack_require__) {
6557
6558"use strict";
6559/* harmony export (immutable) */ __webpack_exports__["a"] = get;
6560/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__toPath_js__ = __webpack_require__(88);
6561/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__deepGet_js__ = __webpack_require__(142);
6562/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__isUndefined_js__ = __webpack_require__(179);
6563
6564
6565
6566
6567// Get the value of the (deep) property on `path` from `object`.
6568// If any property in `path` does not exist or if the value is
6569// `undefined`, return `defaultValue` instead.
6570// The `path` is normalized through `_.toPath`.
6571function get(object, path, defaultValue) {
6572 var value = Object(__WEBPACK_IMPORTED_MODULE_1__deepGet_js__["a" /* default */])(object, Object(__WEBPACK_IMPORTED_MODULE_0__toPath_js__["a" /* default */])(path));
6573 return Object(__WEBPACK_IMPORTED_MODULE_2__isUndefined_js__["a" /* default */])(value) ? defaultValue : value;
6574}
6575
6576
6577/***/ }),
6578/* 198 */
6579/***/ (function(module, __webpack_exports__, __webpack_require__) {
6580
6581"use strict";
6582/* harmony export (immutable) */ __webpack_exports__["a"] = toPath;
6583/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__underscore_js__ = __webpack_require__(25);
6584/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isArray_js__ = __webpack_require__(59);
6585
6586
6587
6588// Normalize a (deep) property `path` to array.
6589// Like `_.iteratee`, this function can be customized.
6590function toPath(path) {
6591 return Object(__WEBPACK_IMPORTED_MODULE_1__isArray_js__["a" /* default */])(path) ? path : [path];
6592}
6593__WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */].toPath = toPath;
6594
6595
6596/***/ }),
6597/* 199 */
6598/***/ (function(module, __webpack_exports__, __webpack_require__) {
6599
6600"use strict";
6601/* harmony export (immutable) */ __webpack_exports__["a"] = baseIteratee;
6602/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__identity_js__ = __webpack_require__(143);
6603/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isFunction_js__ = __webpack_require__(30);
6604/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__isObject_js__ = __webpack_require__(58);
6605/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__isArray_js__ = __webpack_require__(59);
6606/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__matcher_js__ = __webpack_require__(113);
6607/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__property_js__ = __webpack_require__(144);
6608/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__optimizeCb_js__ = __webpack_require__(89);
6609
6610
6611
6612
6613
6614
6615
6616
6617// An internal function to generate callbacks that can be applied to each
6618// element in a collection, returning the desired result — either `_.identity`,
6619// an arbitrary callback, a property matcher, or a property accessor.
6620function baseIteratee(value, context, argCount) {
6621 if (value == null) return __WEBPACK_IMPORTED_MODULE_0__identity_js__["a" /* default */];
6622 if (Object(__WEBPACK_IMPORTED_MODULE_1__isFunction_js__["a" /* default */])(value)) return Object(__WEBPACK_IMPORTED_MODULE_6__optimizeCb_js__["a" /* default */])(value, context, argCount);
6623 if (Object(__WEBPACK_IMPORTED_MODULE_2__isObject_js__["a" /* default */])(value) && !Object(__WEBPACK_IMPORTED_MODULE_3__isArray_js__["a" /* default */])(value)) return Object(__WEBPACK_IMPORTED_MODULE_4__matcher_js__["a" /* default */])(value);
6624 return Object(__WEBPACK_IMPORTED_MODULE_5__property_js__["a" /* default */])(value);
6625}
6626
6627
6628/***/ }),
6629/* 200 */
6630/***/ (function(module, __webpack_exports__, __webpack_require__) {
6631
6632"use strict";
6633/* harmony export (immutable) */ __webpack_exports__["a"] = iteratee;
6634/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__underscore_js__ = __webpack_require__(25);
6635/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__baseIteratee_js__ = __webpack_require__(199);
6636
6637
6638
6639// External wrapper for our callback generator. Users may customize
6640// `_.iteratee` if they want additional predicate/iteratee shorthand styles.
6641// This abstraction hides the internal-only `argCount` argument.
6642function iteratee(value, context) {
6643 return Object(__WEBPACK_IMPORTED_MODULE_1__baseIteratee_js__["a" /* default */])(value, context, Infinity);
6644}
6645__WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */].iteratee = iteratee;
6646
6647
6648/***/ }),
6649/* 201 */
6650/***/ (function(module, __webpack_exports__, __webpack_require__) {
6651
6652"use strict";
6653/* harmony export (immutable) */ __webpack_exports__["a"] = noop;
6654// Predicate-generating function. Often useful outside of Underscore.
6655function noop(){}
6656
6657
6658/***/ }),
6659/* 202 */
6660/***/ (function(module, __webpack_exports__, __webpack_require__) {
6661
6662"use strict";
6663/* harmony export (immutable) */ __webpack_exports__["a"] = random;
6664// Return a random integer between `min` and `max` (inclusive).
6665function random(min, max) {
6666 if (max == null) {
6667 max = min;
6668 min = 0;
6669 }
6670 return min + Math.floor(Math.random() * (max - min + 1));
6671}
6672
6673
6674/***/ }),
6675/* 203 */
6676/***/ (function(module, __webpack_exports__, __webpack_require__) {
6677
6678"use strict";
6679/* harmony export (immutable) */ __webpack_exports__["a"] = createEscaper;
6680/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__keys_js__ = __webpack_require__(17);
6681
6682
6683// Internal helper to generate functions for escaping and unescaping strings
6684// to/from HTML interpolation.
6685function createEscaper(map) {
6686 var escaper = function(match) {
6687 return map[match];
6688 };
6689 // Regexes for identifying a key that needs to be escaped.
6690 var source = '(?:' + Object(__WEBPACK_IMPORTED_MODULE_0__keys_js__["a" /* default */])(map).join('|') + ')';
6691 var testRegexp = RegExp(source);
6692 var replaceRegexp = RegExp(source, 'g');
6693 return function(string) {
6694 string = string == null ? '' : '' + string;
6695 return testRegexp.test(string) ? string.replace(replaceRegexp, escaper) : string;
6696 };
6697}
6698
6699
6700/***/ }),
6701/* 204 */
6702/***/ (function(module, __webpack_exports__, __webpack_require__) {
6703
6704"use strict";
6705// Internal list of HTML entities for escaping.
6706/* harmony default export */ __webpack_exports__["a"] = ({
6707 '&': '&amp;',
6708 '<': '&lt;',
6709 '>': '&gt;',
6710 '"': '&quot;',
6711 "'": '&#x27;',
6712 '`': '&#x60;'
6713});
6714
6715
6716/***/ }),
6717/* 205 */
6718/***/ (function(module, __webpack_exports__, __webpack_require__) {
6719
6720"use strict";
6721/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__underscore_js__ = __webpack_require__(25);
6722
6723
6724// By default, Underscore uses ERB-style template delimiters. Change the
6725// following template settings to use alternative delimiters.
6726/* harmony default export */ __webpack_exports__["a"] = (__WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */].templateSettings = {
6727 evaluate: /<%([\s\S]+?)%>/g,
6728 interpolate: /<%=([\s\S]+?)%>/g,
6729 escape: /<%-([\s\S]+?)%>/g
6730});
6731
6732
6733/***/ }),
6734/* 206 */
6735/***/ (function(module, __webpack_exports__, __webpack_require__) {
6736
6737"use strict";
6738/* harmony export (immutable) */ __webpack_exports__["a"] = executeBound;
6739/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__baseCreate_js__ = __webpack_require__(195);
6740/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isObject_js__ = __webpack_require__(58);
6741
6742
6743
6744// Internal function to execute `sourceFunc` bound to `context` with optional
6745// `args`. Determines whether to execute a function as a constructor or as a
6746// normal function.
6747function executeBound(sourceFunc, boundFunc, context, callingContext, args) {
6748 if (!(callingContext instanceof boundFunc)) return sourceFunc.apply(context, args);
6749 var self = Object(__WEBPACK_IMPORTED_MODULE_0__baseCreate_js__["a" /* default */])(sourceFunc.prototype);
6750 var result = sourceFunc.apply(self, args);
6751 if (Object(__WEBPACK_IMPORTED_MODULE_1__isObject_js__["a" /* default */])(result)) return result;
6752 return self;
6753}
6754
6755
6756/***/ }),
6757/* 207 */
6758/***/ (function(module, __webpack_exports__, __webpack_require__) {
6759
6760"use strict";
6761/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(24);
6762/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isFunction_js__ = __webpack_require__(30);
6763/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__executeBound_js__ = __webpack_require__(206);
6764
6765
6766
6767
6768// Create a function bound to a given object (assigning `this`, and arguments,
6769// optionally).
6770/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(func, context, args) {
6771 if (!Object(__WEBPACK_IMPORTED_MODULE_1__isFunction_js__["a" /* default */])(func)) throw new TypeError('Bind must be called on a function');
6772 var bound = Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(callArgs) {
6773 return Object(__WEBPACK_IMPORTED_MODULE_2__executeBound_js__["a" /* default */])(func, bound, context, this, args.concat(callArgs));
6774 });
6775 return bound;
6776}));
6777
6778
6779/***/ }),
6780/* 208 */
6781/***/ (function(module, __webpack_exports__, __webpack_require__) {
6782
6783"use strict";
6784/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(24);
6785
6786
6787// Delays a function for the given number of milliseconds, and then calls
6788// it with the arguments supplied.
6789/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(func, wait, args) {
6790 return setTimeout(function() {
6791 return func.apply(null, args);
6792 }, wait);
6793}));
6794
6795
6796/***/ }),
6797/* 209 */
6798/***/ (function(module, __webpack_exports__, __webpack_require__) {
6799
6800"use strict";
6801/* harmony export (immutable) */ __webpack_exports__["a"] = before;
6802// Returns a function that will only be executed up to (but not including) the
6803// Nth call.
6804function before(times, func) {
6805 var memo;
6806 return function() {
6807 if (--times > 0) {
6808 memo = func.apply(this, arguments);
6809 }
6810 if (times <= 1) func = null;
6811 return memo;
6812 };
6813}
6814
6815
6816/***/ }),
6817/* 210 */
6818/***/ (function(module, __webpack_exports__, __webpack_require__) {
6819
6820"use strict";
6821/* harmony export (immutable) */ __webpack_exports__["a"] = findKey;
6822/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(22);
6823/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__keys_js__ = __webpack_require__(17);
6824
6825
6826
6827// Returns the first key on an object that passes a truth test.
6828function findKey(obj, predicate, context) {
6829 predicate = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(predicate, context);
6830 var _keys = Object(__WEBPACK_IMPORTED_MODULE_1__keys_js__["a" /* default */])(obj), key;
6831 for (var i = 0, length = _keys.length; i < length; i++) {
6832 key = _keys[i];
6833 if (predicate(obj[key], key, obj)) return key;
6834 }
6835}
6836
6837
6838/***/ }),
6839/* 211 */
6840/***/ (function(module, __webpack_exports__, __webpack_require__) {
6841
6842"use strict";
6843/* harmony export (immutable) */ __webpack_exports__["a"] = createPredicateIndexFinder;
6844/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(22);
6845/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__getLength_js__ = __webpack_require__(31);
6846
6847
6848
6849// Internal function to generate `_.findIndex` and `_.findLastIndex`.
6850function createPredicateIndexFinder(dir) {
6851 return function(array, predicate, context) {
6852 predicate = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(predicate, context);
6853 var length = Object(__WEBPACK_IMPORTED_MODULE_1__getLength_js__["a" /* default */])(array);
6854 var index = dir > 0 ? 0 : length - 1;
6855 for (; index >= 0 && index < length; index += dir) {
6856 if (predicate(array[index], index, array)) return index;
6857 }
6858 return -1;
6859 };
6860}
6861
6862
6863/***/ }),
6864/* 212 */
6865/***/ (function(module, __webpack_exports__, __webpack_require__) {
6866
6867"use strict";
6868/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createPredicateIndexFinder_js__ = __webpack_require__(211);
6869
6870
6871// Returns the last index on an array-like that passes a truth test.
6872/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createPredicateIndexFinder_js__["a" /* default */])(-1));
6873
6874
6875/***/ }),
6876/* 213 */
6877/***/ (function(module, __webpack_exports__, __webpack_require__) {
6878
6879"use strict";
6880/* harmony export (immutable) */ __webpack_exports__["a"] = sortedIndex;
6881/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(22);
6882/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__getLength_js__ = __webpack_require__(31);
6883
6884
6885
6886// Use a comparator function to figure out the smallest index at which
6887// an object should be inserted so as to maintain order. Uses binary search.
6888function sortedIndex(array, obj, iteratee, context) {
6889 iteratee = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(iteratee, context, 1);
6890 var value = iteratee(obj);
6891 var low = 0, high = Object(__WEBPACK_IMPORTED_MODULE_1__getLength_js__["a" /* default */])(array);
6892 while (low < high) {
6893 var mid = Math.floor((low + high) / 2);
6894 if (iteratee(array[mid]) < value) low = mid + 1; else high = mid;
6895 }
6896 return low;
6897}
6898
6899
6900/***/ }),
6901/* 214 */
6902/***/ (function(module, __webpack_exports__, __webpack_require__) {
6903
6904"use strict";
6905/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__sortedIndex_js__ = __webpack_require__(213);
6906/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__findIndex_js__ = __webpack_require__(147);
6907/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__createIndexFinder_js__ = __webpack_require__(215);
6908
6909
6910
6911
6912// Return the position of the first occurrence of an item in an array,
6913// or -1 if the item is not included in the array.
6914// If the array is large and already in sort order, pass `true`
6915// for **isSorted** to use binary search.
6916/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_2__createIndexFinder_js__["a" /* default */])(1, __WEBPACK_IMPORTED_MODULE_1__findIndex_js__["a" /* default */], __WEBPACK_IMPORTED_MODULE_0__sortedIndex_js__["a" /* default */]));
6917
6918
6919/***/ }),
6920/* 215 */
6921/***/ (function(module, __webpack_exports__, __webpack_require__) {
6922
6923"use strict";
6924/* harmony export (immutable) */ __webpack_exports__["a"] = createIndexFinder;
6925/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__getLength_js__ = __webpack_require__(31);
6926/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__setup_js__ = __webpack_require__(6);
6927/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__isNaN_js__ = __webpack_require__(184);
6928
6929
6930
6931
6932// Internal function to generate the `_.indexOf` and `_.lastIndexOf` functions.
6933function createIndexFinder(dir, predicateFind, sortedIndex) {
6934 return function(array, item, idx) {
6935 var i = 0, length = Object(__WEBPACK_IMPORTED_MODULE_0__getLength_js__["a" /* default */])(array);
6936 if (typeof idx == 'number') {
6937 if (dir > 0) {
6938 i = idx >= 0 ? idx : Math.max(idx + length, i);
6939 } else {
6940 length = idx >= 0 ? Math.min(idx + 1, length) : idx + length + 1;
6941 }
6942 } else if (sortedIndex && idx && length) {
6943 idx = sortedIndex(array, item);
6944 return array[idx] === item ? idx : -1;
6945 }
6946 if (item !== item) {
6947 idx = predicateFind(__WEBPACK_IMPORTED_MODULE_1__setup_js__["q" /* slice */].call(array, i, length), __WEBPACK_IMPORTED_MODULE_2__isNaN_js__["a" /* default */]);
6948 return idx >= 0 ? idx + i : -1;
6949 }
6950 for (idx = dir > 0 ? i : length - 1; idx >= 0 && idx < length; idx += dir) {
6951 if (array[idx] === item) return idx;
6952 }
6953 return -1;
6954 };
6955}
6956
6957
6958/***/ }),
6959/* 216 */
6960/***/ (function(module, __webpack_exports__, __webpack_require__) {
6961
6962"use strict";
6963/* harmony export (immutable) */ __webpack_exports__["a"] = find;
6964/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__ = __webpack_require__(26);
6965/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__findIndex_js__ = __webpack_require__(147);
6966/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__findKey_js__ = __webpack_require__(210);
6967
6968
6969
6970
6971// Return the first value which passes a truth test.
6972function find(obj, predicate, context) {
6973 var keyFinder = Object(__WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__["a" /* default */])(obj) ? __WEBPACK_IMPORTED_MODULE_1__findIndex_js__["a" /* default */] : __WEBPACK_IMPORTED_MODULE_2__findKey_js__["a" /* default */];
6974 var key = keyFinder(obj, predicate, context);
6975 if (key !== void 0 && key !== -1) return obj[key];
6976}
6977
6978
6979/***/ }),
6980/* 217 */
6981/***/ (function(module, __webpack_exports__, __webpack_require__) {
6982
6983"use strict";
6984/* harmony export (immutable) */ __webpack_exports__["a"] = createReduce;
6985/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__ = __webpack_require__(26);
6986/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__keys_js__ = __webpack_require__(17);
6987/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__optimizeCb_js__ = __webpack_require__(89);
6988
6989
6990
6991
6992// Internal helper to create a reducing function, iterating left or right.
6993function createReduce(dir) {
6994 // Wrap code that reassigns argument variables in a separate function than
6995 // the one that accesses `arguments.length` to avoid a perf hit. (#1991)
6996 var reducer = function(obj, iteratee, memo, initial) {
6997 var _keys = !Object(__WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__["a" /* default */])(obj) && Object(__WEBPACK_IMPORTED_MODULE_1__keys_js__["a" /* default */])(obj),
6998 length = (_keys || obj).length,
6999 index = dir > 0 ? 0 : length - 1;
7000 if (!initial) {
7001 memo = obj[_keys ? _keys[index] : index];
7002 index += dir;
7003 }
7004 for (; index >= 0 && index < length; index += dir) {
7005 var currentKey = _keys ? _keys[index] : index;
7006 memo = iteratee(memo, obj[currentKey], currentKey, obj);
7007 }
7008 return memo;
7009 };
7010
7011 return function(obj, iteratee, memo, context) {
7012 var initial = arguments.length >= 3;
7013 return reducer(obj, Object(__WEBPACK_IMPORTED_MODULE_2__optimizeCb_js__["a" /* default */])(iteratee, context, 4), memo, initial);
7014 };
7015}
7016
7017
7018/***/ }),
7019/* 218 */
7020/***/ (function(module, __webpack_exports__, __webpack_require__) {
7021
7022"use strict";
7023/* harmony export (immutable) */ __webpack_exports__["a"] = max;
7024/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__ = __webpack_require__(26);
7025/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__values_js__ = __webpack_require__(71);
7026/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__cb_js__ = __webpack_require__(22);
7027/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__each_js__ = __webpack_require__(60);
7028
7029
7030
7031
7032
7033// Return the maximum element (or element-based computation).
7034function max(obj, iteratee, context) {
7035 var result = -Infinity, lastComputed = -Infinity,
7036 value, computed;
7037 if (iteratee == null || typeof iteratee == 'number' && typeof obj[0] != 'object' && obj != null) {
7038 obj = Object(__WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__["a" /* default */])(obj) ? obj : Object(__WEBPACK_IMPORTED_MODULE_1__values_js__["a" /* default */])(obj);
7039 for (var i = 0, length = obj.length; i < length; i++) {
7040 value = obj[i];
7041 if (value != null && value > result) {
7042 result = value;
7043 }
7044 }
7045 } else {
7046 iteratee = Object(__WEBPACK_IMPORTED_MODULE_2__cb_js__["a" /* default */])(iteratee, context);
7047 Object(__WEBPACK_IMPORTED_MODULE_3__each_js__["a" /* default */])(obj, function(v, index, list) {
7048 computed = iteratee(v, index, list);
7049 if (computed > lastComputed || computed === -Infinity && result === -Infinity) {
7050 result = v;
7051 lastComputed = computed;
7052 }
7053 });
7054 }
7055 return result;
7056}
7057
7058
7059/***/ }),
7060/* 219 */
7061/***/ (function(module, __webpack_exports__, __webpack_require__) {
7062
7063"use strict";
7064/* harmony export (immutable) */ __webpack_exports__["a"] = sample;
7065/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__ = __webpack_require__(26);
7066/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__clone_js__ = __webpack_require__(196);
7067/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__values_js__ = __webpack_require__(71);
7068/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__getLength_js__ = __webpack_require__(31);
7069/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__random_js__ = __webpack_require__(202);
7070
7071
7072
7073
7074
7075
7076// Sample **n** random values from a collection using the modern version of the
7077// [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher–Yates_shuffle).
7078// If **n** is not specified, returns a single random element.
7079// The internal `guard` argument allows it to work with `_.map`.
7080function sample(obj, n, guard) {
7081 if (n == null || guard) {
7082 if (!Object(__WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__["a" /* default */])(obj)) obj = Object(__WEBPACK_IMPORTED_MODULE_2__values_js__["a" /* default */])(obj);
7083 return obj[Object(__WEBPACK_IMPORTED_MODULE_4__random_js__["a" /* default */])(obj.length - 1)];
7084 }
7085 var sample = Object(__WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__["a" /* default */])(obj) ? Object(__WEBPACK_IMPORTED_MODULE_1__clone_js__["a" /* default */])(obj) : Object(__WEBPACK_IMPORTED_MODULE_2__values_js__["a" /* default */])(obj);
7086 var length = Object(__WEBPACK_IMPORTED_MODULE_3__getLength_js__["a" /* default */])(sample);
7087 n = Math.max(Math.min(n, length), 0);
7088 var last = length - 1;
7089 for (var index = 0; index < n; index++) {
7090 var rand = Object(__WEBPACK_IMPORTED_MODULE_4__random_js__["a" /* default */])(index, last);
7091 var temp = sample[index];
7092 sample[index] = sample[rand];
7093 sample[rand] = temp;
7094 }
7095 return sample.slice(0, n);
7096}
7097
7098
7099/***/ }),
7100/* 220 */
7101/***/ (function(module, __webpack_exports__, __webpack_require__) {
7102
7103"use strict";
7104/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(24);
7105/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isFunction_js__ = __webpack_require__(30);
7106/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__optimizeCb_js__ = __webpack_require__(89);
7107/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__allKeys_js__ = __webpack_require__(87);
7108/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__keyInObj_js__ = __webpack_require__(378);
7109/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__flatten_js__ = __webpack_require__(72);
7110
7111
7112
7113
7114
7115
7116
7117// Return a copy of the object only containing the allowed properties.
7118/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(obj, keys) {
7119 var result = {}, iteratee = keys[0];
7120 if (obj == null) return result;
7121 if (Object(__WEBPACK_IMPORTED_MODULE_1__isFunction_js__["a" /* default */])(iteratee)) {
7122 if (keys.length > 1) iteratee = Object(__WEBPACK_IMPORTED_MODULE_2__optimizeCb_js__["a" /* default */])(iteratee, keys[1]);
7123 keys = Object(__WEBPACK_IMPORTED_MODULE_3__allKeys_js__["a" /* default */])(obj);
7124 } else {
7125 iteratee = __WEBPACK_IMPORTED_MODULE_4__keyInObj_js__["a" /* default */];
7126 keys = Object(__WEBPACK_IMPORTED_MODULE_5__flatten_js__["a" /* default */])(keys, false, false);
7127 obj = Object(obj);
7128 }
7129 for (var i = 0, length = keys.length; i < length; i++) {
7130 var key = keys[i];
7131 var value = obj[key];
7132 if (iteratee(value, key, obj)) result[key] = value;
7133 }
7134 return result;
7135}));
7136
7137
7138/***/ }),
7139/* 221 */
7140/***/ (function(module, __webpack_exports__, __webpack_require__) {
7141
7142"use strict";
7143/* harmony export (immutable) */ __webpack_exports__["a"] = initial;
7144/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(6);
7145
7146
7147// Returns everything but the last entry of the array. Especially useful on
7148// the arguments object. Passing **n** will return all the values in
7149// the array, excluding the last N.
7150function initial(array, n, guard) {
7151 return __WEBPACK_IMPORTED_MODULE_0__setup_js__["q" /* slice */].call(array, 0, Math.max(0, array.length - (n == null || guard ? 1 : n)));
7152}
7153
7154
7155/***/ }),
7156/* 222 */
7157/***/ (function(module, __webpack_exports__, __webpack_require__) {
7158
7159"use strict";
7160/* harmony export (immutable) */ __webpack_exports__["a"] = rest;
7161/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(6);
7162
7163
7164// Returns everything but the first entry of the `array`. Especially useful on
7165// the `arguments` object. Passing an **n** will return the rest N values in the
7166// `array`.
7167function rest(array, n, guard) {
7168 return __WEBPACK_IMPORTED_MODULE_0__setup_js__["q" /* slice */].call(array, n == null || guard ? 1 : n);
7169}
7170
7171
7172/***/ }),
7173/* 223 */
7174/***/ (function(module, __webpack_exports__, __webpack_require__) {
7175
7176"use strict";
7177/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(24);
7178/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__flatten_js__ = __webpack_require__(72);
7179/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__filter_js__ = __webpack_require__(90);
7180/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__contains_js__ = __webpack_require__(91);
7181
7182
7183
7184
7185
7186// Take the difference between one array and a number of other arrays.
7187// Only the elements present in just the first array will remain.
7188/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(array, rest) {
7189 rest = Object(__WEBPACK_IMPORTED_MODULE_1__flatten_js__["a" /* default */])(rest, true, true);
7190 return Object(__WEBPACK_IMPORTED_MODULE_2__filter_js__["a" /* default */])(array, function(value){
7191 return !Object(__WEBPACK_IMPORTED_MODULE_3__contains_js__["a" /* default */])(rest, value);
7192 });
7193}));
7194
7195
7196/***/ }),
7197/* 224 */
7198/***/ (function(module, __webpack_exports__, __webpack_require__) {
7199
7200"use strict";
7201/* harmony export (immutable) */ __webpack_exports__["a"] = uniq;
7202/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isBoolean_js__ = __webpack_require__(180);
7203/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__cb_js__ = __webpack_require__(22);
7204/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__getLength_js__ = __webpack_require__(31);
7205/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__contains_js__ = __webpack_require__(91);
7206
7207
7208
7209
7210
7211// Produce a duplicate-free version of the array. If the array has already
7212// been sorted, you have the option of using a faster algorithm.
7213// The faster algorithm will not work with an iteratee if the iteratee
7214// is not a one-to-one function, so providing an iteratee will disable
7215// the faster algorithm.
7216function uniq(array, isSorted, iteratee, context) {
7217 if (!Object(__WEBPACK_IMPORTED_MODULE_0__isBoolean_js__["a" /* default */])(isSorted)) {
7218 context = iteratee;
7219 iteratee = isSorted;
7220 isSorted = false;
7221 }
7222 if (iteratee != null) iteratee = Object(__WEBPACK_IMPORTED_MODULE_1__cb_js__["a" /* default */])(iteratee, context);
7223 var result = [];
7224 var seen = [];
7225 for (var i = 0, length = Object(__WEBPACK_IMPORTED_MODULE_2__getLength_js__["a" /* default */])(array); i < length; i++) {
7226 var value = array[i],
7227 computed = iteratee ? iteratee(value, i, array) : value;
7228 if (isSorted && !iteratee) {
7229 if (!i || seen !== computed) result.push(value);
7230 seen = computed;
7231 } else if (iteratee) {
7232 if (!Object(__WEBPACK_IMPORTED_MODULE_3__contains_js__["a" /* default */])(seen, computed)) {
7233 seen.push(computed);
7234 result.push(value);
7235 }
7236 } else if (!Object(__WEBPACK_IMPORTED_MODULE_3__contains_js__["a" /* default */])(result, value)) {
7237 result.push(value);
7238 }
7239 }
7240 return result;
7241}
7242
7243
7244/***/ }),
7245/* 225 */
7246/***/ (function(module, __webpack_exports__, __webpack_require__) {
7247
7248"use strict";
7249/* harmony export (immutable) */ __webpack_exports__["a"] = unzip;
7250/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__max_js__ = __webpack_require__(218);
7251/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__getLength_js__ = __webpack_require__(31);
7252/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__pluck_js__ = __webpack_require__(148);
7253
7254
7255
7256
7257// Complement of zip. Unzip accepts an array of arrays and groups
7258// each array's elements on shared indices.
7259function unzip(array) {
7260 var length = array && Object(__WEBPACK_IMPORTED_MODULE_0__max_js__["a" /* default */])(array, __WEBPACK_IMPORTED_MODULE_1__getLength_js__["a" /* default */]).length || 0;
7261 var result = Array(length);
7262
7263 for (var index = 0; index < length; index++) {
7264 result[index] = Object(__WEBPACK_IMPORTED_MODULE_2__pluck_js__["a" /* default */])(array, index);
7265 }
7266 return result;
7267}
7268
7269
7270/***/ }),
7271/* 226 */
7272/***/ (function(module, __webpack_exports__, __webpack_require__) {
7273
7274"use strict";
7275/* harmony export (immutable) */ __webpack_exports__["a"] = chainResult;
7276/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__underscore_js__ = __webpack_require__(25);
7277
7278
7279// Helper function to continue chaining intermediate results.
7280function chainResult(instance, obj) {
7281 return instance._chain ? Object(__WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */])(obj).chain() : obj;
7282}
7283
7284
7285/***/ }),
7286/* 227 */
7287/***/ (function(module, exports, __webpack_require__) {
7288
7289"use strict";
7290
7291var $ = __webpack_require__(0);
7292var fails = __webpack_require__(2);
7293var isArray = __webpack_require__(92);
7294var isObject = __webpack_require__(11);
7295var toObject = __webpack_require__(33);
7296var lengthOfArrayLike = __webpack_require__(40);
7297var doesNotExceedSafeInteger = __webpack_require__(396);
7298var createProperty = __webpack_require__(93);
7299var arraySpeciesCreate = __webpack_require__(228);
7300var arrayMethodHasSpeciesSupport = __webpack_require__(116);
7301var wellKnownSymbol = __webpack_require__(5);
7302var V8_VERSION = __webpack_require__(66);
7303
7304var IS_CONCAT_SPREADABLE = wellKnownSymbol('isConcatSpreadable');
7305
7306// We can't use this feature detection in V8 since it causes
7307// deoptimization and serious performance degradation
7308// https://github.com/zloirock/core-js/issues/679
7309var IS_CONCAT_SPREADABLE_SUPPORT = V8_VERSION >= 51 || !fails(function () {
7310 var array = [];
7311 array[IS_CONCAT_SPREADABLE] = false;
7312 return array.concat()[0] !== array;
7313});
7314
7315var SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('concat');
7316
7317var isConcatSpreadable = function (O) {
7318 if (!isObject(O)) return false;
7319 var spreadable = O[IS_CONCAT_SPREADABLE];
7320 return spreadable !== undefined ? !!spreadable : isArray(O);
7321};
7322
7323var FORCED = !IS_CONCAT_SPREADABLE_SUPPORT || !SPECIES_SUPPORT;
7324
7325// `Array.prototype.concat` method
7326// https://tc39.es/ecma262/#sec-array.prototype.concat
7327// with adding support of @@isConcatSpreadable and @@species
7328$({ target: 'Array', proto: true, arity: 1, forced: FORCED }, {
7329 // eslint-disable-next-line no-unused-vars -- required for `.length`
7330 concat: function concat(arg) {
7331 var O = toObject(this);
7332 var A = arraySpeciesCreate(O, 0);
7333 var n = 0;
7334 var i, k, length, len, E;
7335 for (i = -1, length = arguments.length; i < length; i++) {
7336 E = i === -1 ? O : arguments[i];
7337 if (isConcatSpreadable(E)) {
7338 len = lengthOfArrayLike(E);
7339 doesNotExceedSafeInteger(n + len);
7340 for (k = 0; k < len; k++, n++) if (k in E) createProperty(A, n, E[k]);
7341 } else {
7342 doesNotExceedSafeInteger(n + 1);
7343 createProperty(A, n++, E);
7344 }
7345 }
7346 A.length = n;
7347 return A;
7348 }
7349});
7350
7351
7352/***/ }),
7353/* 228 */
7354/***/ (function(module, exports, __webpack_require__) {
7355
7356var arraySpeciesConstructor = __webpack_require__(397);
7357
7358// `ArraySpeciesCreate` abstract operation
7359// https://tc39.es/ecma262/#sec-arrayspeciescreate
7360module.exports = function (originalArray, length) {
7361 return new (arraySpeciesConstructor(originalArray))(length === 0 ? 0 : length);
7362};
7363
7364
7365/***/ }),
7366/* 229 */
7367/***/ (function(module, exports, __webpack_require__) {
7368
7369var $ = __webpack_require__(0);
7370var getBuiltIn = __webpack_require__(20);
7371var apply = __webpack_require__(79);
7372var call = __webpack_require__(15);
7373var uncurryThis = __webpack_require__(4);
7374var fails = __webpack_require__(2);
7375var isArray = __webpack_require__(92);
7376var isCallable = __webpack_require__(9);
7377var isObject = __webpack_require__(11);
7378var isSymbol = __webpack_require__(100);
7379var arraySlice = __webpack_require__(112);
7380var NATIVE_SYMBOL = __webpack_require__(65);
7381
7382var $stringify = getBuiltIn('JSON', 'stringify');
7383var exec = uncurryThis(/./.exec);
7384var charAt = uncurryThis(''.charAt);
7385var charCodeAt = uncurryThis(''.charCodeAt);
7386var replace = uncurryThis(''.replace);
7387var numberToString = uncurryThis(1.0.toString);
7388
7389var tester = /[\uD800-\uDFFF]/g;
7390var low = /^[\uD800-\uDBFF]$/;
7391var hi = /^[\uDC00-\uDFFF]$/;
7392
7393var WRONG_SYMBOLS_CONVERSION = !NATIVE_SYMBOL || fails(function () {
7394 var symbol = getBuiltIn('Symbol')();
7395 // MS Edge converts symbol values to JSON as {}
7396 return $stringify([symbol]) != '[null]'
7397 // WebKit converts symbol values to JSON as null
7398 || $stringify({ a: symbol }) != '{}'
7399 // V8 throws on boxed symbols
7400 || $stringify(Object(symbol)) != '{}';
7401});
7402
7403// https://github.com/tc39/proposal-well-formed-stringify
7404var ILL_FORMED_UNICODE = fails(function () {
7405 return $stringify('\uDF06\uD834') !== '"\\udf06\\ud834"'
7406 || $stringify('\uDEAD') !== '"\\udead"';
7407});
7408
7409var stringifyWithSymbolsFix = function (it, replacer) {
7410 var args = arraySlice(arguments);
7411 var $replacer = replacer;
7412 if (!isObject(replacer) && it === undefined || isSymbol(it)) return; // IE8 returns string on undefined
7413 if (!isArray(replacer)) replacer = function (key, value) {
7414 if (isCallable($replacer)) value = call($replacer, this, key, value);
7415 if (!isSymbol(value)) return value;
7416 };
7417 args[1] = replacer;
7418 return apply($stringify, null, args);
7419};
7420
7421var fixIllFormed = function (match, offset, string) {
7422 var prev = charAt(string, offset - 1);
7423 var next = charAt(string, offset + 1);
7424 if ((exec(low, match) && !exec(hi, next)) || (exec(hi, match) && !exec(low, prev))) {
7425 return '\\u' + numberToString(charCodeAt(match, 0), 16);
7426 } return match;
7427};
7428
7429if ($stringify) {
7430 // `JSON.stringify` method
7431 // https://tc39.es/ecma262/#sec-json.stringify
7432 $({ target: 'JSON', stat: true, arity: 3, forced: WRONG_SYMBOLS_CONVERSION || ILL_FORMED_UNICODE }, {
7433 // eslint-disable-next-line no-unused-vars -- required for `.length`
7434 stringify: function stringify(it, replacer, space) {
7435 var args = arraySlice(arguments);
7436 var result = apply(WRONG_SYMBOLS_CONVERSION ? stringifyWithSymbolsFix : $stringify, null, args);
7437 return ILL_FORMED_UNICODE && typeof result == 'string' ? replace(result, tester, fixIllFormed) : result;
7438 }
7439 });
7440}
7441
7442
7443/***/ }),
7444/* 230 */
7445/***/ (function(module, exports, __webpack_require__) {
7446
7447var rng = __webpack_require__(414);
7448var bytesToUuid = __webpack_require__(415);
7449
7450function v4(options, buf, offset) {
7451 var i = buf && offset || 0;
7452
7453 if (typeof(options) == 'string') {
7454 buf = options === 'binary' ? new Array(16) : null;
7455 options = null;
7456 }
7457 options = options || {};
7458
7459 var rnds = options.random || (options.rng || rng)();
7460
7461 // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
7462 rnds[6] = (rnds[6] & 0x0f) | 0x40;
7463 rnds[8] = (rnds[8] & 0x3f) | 0x80;
7464
7465 // Copy bytes to buffer, if provided
7466 if (buf) {
7467 for (var ii = 0; ii < 16; ++ii) {
7468 buf[i + ii] = rnds[ii];
7469 }
7470 }
7471
7472 return buf || bytesToUuid(rnds);
7473}
7474
7475module.exports = v4;
7476
7477
7478/***/ }),
7479/* 231 */
7480/***/ (function(module, exports, __webpack_require__) {
7481
7482module.exports = __webpack_require__(232);
7483
7484/***/ }),
7485/* 232 */
7486/***/ (function(module, exports, __webpack_require__) {
7487
7488var parent = __webpack_require__(418);
7489
7490module.exports = parent;
7491
7492
7493/***/ }),
7494/* 233 */
7495/***/ (function(module, exports, __webpack_require__) {
7496
7497"use strict";
7498
7499
7500module.exports = '4.13.3';
7501
7502/***/ }),
7503/* 234 */
7504/***/ (function(module, exports, __webpack_require__) {
7505
7506"use strict";
7507
7508
7509var has = Object.prototype.hasOwnProperty
7510 , prefix = '~';
7511
7512/**
7513 * Constructor to create a storage for our `EE` objects.
7514 * An `Events` instance is a plain object whose properties are event names.
7515 *
7516 * @constructor
7517 * @api private
7518 */
7519function Events() {}
7520
7521//
7522// We try to not inherit from `Object.prototype`. In some engines creating an
7523// instance in this way is faster than calling `Object.create(null)` directly.
7524// If `Object.create(null)` is not supported we prefix the event names with a
7525// character to make sure that the built-in object properties are not
7526// overridden or used as an attack vector.
7527//
7528if (Object.create) {
7529 Events.prototype = Object.create(null);
7530
7531 //
7532 // This hack is needed because the `__proto__` property is still inherited in
7533 // some old browsers like Android 4, iPhone 5.1, Opera 11 and Safari 5.
7534 //
7535 if (!new Events().__proto__) prefix = false;
7536}
7537
7538/**
7539 * Representation of a single event listener.
7540 *
7541 * @param {Function} fn The listener function.
7542 * @param {Mixed} context The context to invoke the listener with.
7543 * @param {Boolean} [once=false] Specify if the listener is a one-time listener.
7544 * @constructor
7545 * @api private
7546 */
7547function EE(fn, context, once) {
7548 this.fn = fn;
7549 this.context = context;
7550 this.once = once || false;
7551}
7552
7553/**
7554 * Minimal `EventEmitter` interface that is molded against the Node.js
7555 * `EventEmitter` interface.
7556 *
7557 * @constructor
7558 * @api public
7559 */
7560function EventEmitter() {
7561 this._events = new Events();
7562 this._eventsCount = 0;
7563}
7564
7565/**
7566 * Return an array listing the events for which the emitter has registered
7567 * listeners.
7568 *
7569 * @returns {Array}
7570 * @api public
7571 */
7572EventEmitter.prototype.eventNames = function eventNames() {
7573 var names = []
7574 , events
7575 , name;
7576
7577 if (this._eventsCount === 0) return names;
7578
7579 for (name in (events = this._events)) {
7580 if (has.call(events, name)) names.push(prefix ? name.slice(1) : name);
7581 }
7582
7583 if (Object.getOwnPropertySymbols) {
7584 return names.concat(Object.getOwnPropertySymbols(events));
7585 }
7586
7587 return names;
7588};
7589
7590/**
7591 * Return the listeners registered for a given event.
7592 *
7593 * @param {String|Symbol} event The event name.
7594 * @param {Boolean} exists Only check if there are listeners.
7595 * @returns {Array|Boolean}
7596 * @api public
7597 */
7598EventEmitter.prototype.listeners = function listeners(event, exists) {
7599 var evt = prefix ? prefix + event : event
7600 , available = this._events[evt];
7601
7602 if (exists) return !!available;
7603 if (!available) return [];
7604 if (available.fn) return [available.fn];
7605
7606 for (var i = 0, l = available.length, ee = new Array(l); i < l; i++) {
7607 ee[i] = available[i].fn;
7608 }
7609
7610 return ee;
7611};
7612
7613/**
7614 * Calls each of the listeners registered for a given event.
7615 *
7616 * @param {String|Symbol} event The event name.
7617 * @returns {Boolean} `true` if the event had listeners, else `false`.
7618 * @api public
7619 */
7620EventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {
7621 var evt = prefix ? prefix + event : event;
7622
7623 if (!this._events[evt]) return false;
7624
7625 var listeners = this._events[evt]
7626 , len = arguments.length
7627 , args
7628 , i;
7629
7630 if (listeners.fn) {
7631 if (listeners.once) this.removeListener(event, listeners.fn, undefined, true);
7632
7633 switch (len) {
7634 case 1: return listeners.fn.call(listeners.context), true;
7635 case 2: return listeners.fn.call(listeners.context, a1), true;
7636 case 3: return listeners.fn.call(listeners.context, a1, a2), true;
7637 case 4: return listeners.fn.call(listeners.context, a1, a2, a3), true;
7638 case 5: return listeners.fn.call(listeners.context, a1, a2, a3, a4), true;
7639 case 6: return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true;
7640 }
7641
7642 for (i = 1, args = new Array(len -1); i < len; i++) {
7643 args[i - 1] = arguments[i];
7644 }
7645
7646 listeners.fn.apply(listeners.context, args);
7647 } else {
7648 var length = listeners.length
7649 , j;
7650
7651 for (i = 0; i < length; i++) {
7652 if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true);
7653
7654 switch (len) {
7655 case 1: listeners[i].fn.call(listeners[i].context); break;
7656 case 2: listeners[i].fn.call(listeners[i].context, a1); break;
7657 case 3: listeners[i].fn.call(listeners[i].context, a1, a2); break;
7658 case 4: listeners[i].fn.call(listeners[i].context, a1, a2, a3); break;
7659 default:
7660 if (!args) for (j = 1, args = new Array(len -1); j < len; j++) {
7661 args[j - 1] = arguments[j];
7662 }
7663
7664 listeners[i].fn.apply(listeners[i].context, args);
7665 }
7666 }
7667 }
7668
7669 return true;
7670};
7671
7672/**
7673 * Add a listener for a given event.
7674 *
7675 * @param {String|Symbol} event The event name.
7676 * @param {Function} fn The listener function.
7677 * @param {Mixed} [context=this] The context to invoke the listener with.
7678 * @returns {EventEmitter} `this`.
7679 * @api public
7680 */
7681EventEmitter.prototype.on = function on(event, fn, context) {
7682 var listener = new EE(fn, context || this)
7683 , evt = prefix ? prefix + event : event;
7684
7685 if (!this._events[evt]) this._events[evt] = listener, this._eventsCount++;
7686 else if (!this._events[evt].fn) this._events[evt].push(listener);
7687 else this._events[evt] = [this._events[evt], listener];
7688
7689 return this;
7690};
7691
7692/**
7693 * Add a one-time listener for a given event.
7694 *
7695 * @param {String|Symbol} event The event name.
7696 * @param {Function} fn The listener function.
7697 * @param {Mixed} [context=this] The context to invoke the listener with.
7698 * @returns {EventEmitter} `this`.
7699 * @api public
7700 */
7701EventEmitter.prototype.once = function once(event, fn, context) {
7702 var listener = new EE(fn, context || this, true)
7703 , evt = prefix ? prefix + event : event;
7704
7705 if (!this._events[evt]) this._events[evt] = listener, this._eventsCount++;
7706 else if (!this._events[evt].fn) this._events[evt].push(listener);
7707 else this._events[evt] = [this._events[evt], listener];
7708
7709 return this;
7710};
7711
7712/**
7713 * Remove the listeners of a given event.
7714 *
7715 * @param {String|Symbol} event The event name.
7716 * @param {Function} fn Only remove the listeners that match this function.
7717 * @param {Mixed} context Only remove the listeners that have this context.
7718 * @param {Boolean} once Only remove one-time listeners.
7719 * @returns {EventEmitter} `this`.
7720 * @api public
7721 */
7722EventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) {
7723 var evt = prefix ? prefix + event : event;
7724
7725 if (!this._events[evt]) return this;
7726 if (!fn) {
7727 if (--this._eventsCount === 0) this._events = new Events();
7728 else delete this._events[evt];
7729 return this;
7730 }
7731
7732 var listeners = this._events[evt];
7733
7734 if (listeners.fn) {
7735 if (
7736 listeners.fn === fn
7737 && (!once || listeners.once)
7738 && (!context || listeners.context === context)
7739 ) {
7740 if (--this._eventsCount === 0) this._events = new Events();
7741 else delete this._events[evt];
7742 }
7743 } else {
7744 for (var i = 0, events = [], length = listeners.length; i < length; i++) {
7745 if (
7746 listeners[i].fn !== fn
7747 || (once && !listeners[i].once)
7748 || (context && listeners[i].context !== context)
7749 ) {
7750 events.push(listeners[i]);
7751 }
7752 }
7753
7754 //
7755 // Reset the array, or remove it completely if we have no more listeners.
7756 //
7757 if (events.length) this._events[evt] = events.length === 1 ? events[0] : events;
7758 else if (--this._eventsCount === 0) this._events = new Events();
7759 else delete this._events[evt];
7760 }
7761
7762 return this;
7763};
7764
7765/**
7766 * Remove all listeners, or those of the specified event.
7767 *
7768 * @param {String|Symbol} [event] The event name.
7769 * @returns {EventEmitter} `this`.
7770 * @api public
7771 */
7772EventEmitter.prototype.removeAllListeners = function removeAllListeners(event) {
7773 var evt;
7774
7775 if (event) {
7776 evt = prefix ? prefix + event : event;
7777 if (this._events[evt]) {
7778 if (--this._eventsCount === 0) this._events = new Events();
7779 else delete this._events[evt];
7780 }
7781 } else {
7782 this._events = new Events();
7783 this._eventsCount = 0;
7784 }
7785
7786 return this;
7787};
7788
7789//
7790// Alias methods names because people roll like that.
7791//
7792EventEmitter.prototype.off = EventEmitter.prototype.removeListener;
7793EventEmitter.prototype.addListener = EventEmitter.prototype.on;
7794
7795//
7796// This function doesn't apply anymore.
7797//
7798EventEmitter.prototype.setMaxListeners = function setMaxListeners() {
7799 return this;
7800};
7801
7802//
7803// Expose the prefix.
7804//
7805EventEmitter.prefixed = prefix;
7806
7807//
7808// Allow `EventEmitter` to be imported as module namespace.
7809//
7810EventEmitter.EventEmitter = EventEmitter;
7811
7812//
7813// Expose the module.
7814//
7815if (true) {
7816 module.exports = EventEmitter;
7817}
7818
7819
7820/***/ }),
7821/* 235 */
7822/***/ (function(module, exports, __webpack_require__) {
7823
7824"use strict";
7825
7826
7827var _interopRequireDefault = __webpack_require__(1);
7828
7829var _promise = _interopRequireDefault(__webpack_require__(12));
7830
7831var _require = __webpack_require__(76),
7832 getAdapter = _require.getAdapter;
7833
7834var syncApiNames = ['getItem', 'setItem', 'removeItem', 'clear'];
7835var localStorage = {
7836 get async() {
7837 return getAdapter('storage').async;
7838 }
7839
7840}; // wrap sync apis with async ones.
7841
7842syncApiNames.forEach(function (apiName) {
7843 localStorage[apiName + 'Async'] = function () {
7844 var storage = getAdapter('storage');
7845 return _promise.default.resolve(storage[apiName].apply(storage, arguments));
7846 };
7847
7848 localStorage[apiName] = function () {
7849 var storage = getAdapter('storage');
7850
7851 if (!storage.async) {
7852 return storage[apiName].apply(storage, arguments);
7853 }
7854
7855 var error = new Error('Synchronous API [' + apiName + '] is not available in this runtime.');
7856 error.code = 'SYNC_API_NOT_AVAILABLE';
7857 throw error;
7858 };
7859});
7860module.exports = localStorage;
7861
7862/***/ }),
7863/* 236 */
7864/***/ (function(module, exports, __webpack_require__) {
7865
7866"use strict";
7867
7868
7869var _interopRequireDefault = __webpack_require__(1);
7870
7871var _concat = _interopRequireDefault(__webpack_require__(19));
7872
7873var _stringify = _interopRequireDefault(__webpack_require__(38));
7874
7875var storage = __webpack_require__(235);
7876
7877var AV = __webpack_require__(74);
7878
7879var removeAsync = exports.removeAsync = storage.removeItemAsync.bind(storage);
7880
7881var getCacheData = function getCacheData(cacheData, key) {
7882 try {
7883 cacheData = JSON.parse(cacheData);
7884 } catch (e) {
7885 return null;
7886 }
7887
7888 if (cacheData) {
7889 var expired = cacheData.expiredAt && cacheData.expiredAt < Date.now();
7890
7891 if (!expired) {
7892 return cacheData.value;
7893 }
7894
7895 return removeAsync(key).then(function () {
7896 return null;
7897 });
7898 }
7899
7900 return null;
7901};
7902
7903exports.getAsync = function (key) {
7904 var _context;
7905
7906 key = (0, _concat.default)(_context = "AV/".concat(AV.applicationId, "/")).call(_context, key);
7907 return storage.getItemAsync(key).then(function (cache) {
7908 return getCacheData(cache, key);
7909 });
7910};
7911
7912exports.setAsync = function (key, value, ttl) {
7913 var _context2;
7914
7915 var cache = {
7916 value: value
7917 };
7918
7919 if (typeof ttl === 'number') {
7920 cache.expiredAt = Date.now() + ttl;
7921 }
7922
7923 return storage.setItemAsync((0, _concat.default)(_context2 = "AV/".concat(AV.applicationId, "/")).call(_context2, key), (0, _stringify.default)(cache));
7924};
7925
7926/***/ }),
7927/* 237 */
7928/***/ (function(module, exports, __webpack_require__) {
7929
7930var parent = __webpack_require__(421);
7931
7932module.exports = parent;
7933
7934
7935/***/ }),
7936/* 238 */
7937/***/ (function(module, exports, __webpack_require__) {
7938
7939var parent = __webpack_require__(424);
7940
7941module.exports = parent;
7942
7943
7944/***/ }),
7945/* 239 */
7946/***/ (function(module, exports, __webpack_require__) {
7947
7948var parent = __webpack_require__(427);
7949
7950module.exports = parent;
7951
7952
7953/***/ }),
7954/* 240 */
7955/***/ (function(module, exports, __webpack_require__) {
7956
7957module.exports = __webpack_require__(430);
7958
7959/***/ }),
7960/* 241 */
7961/***/ (function(module, exports, __webpack_require__) {
7962
7963var parent = __webpack_require__(433);
7964__webpack_require__(46);
7965
7966module.exports = parent;
7967
7968
7969/***/ }),
7970/* 242 */
7971/***/ (function(module, exports, __webpack_require__) {
7972
7973// TODO: Remove this module from `core-js@4` since it's split to modules listed below
7974__webpack_require__(434);
7975__webpack_require__(435);
7976__webpack_require__(436);
7977__webpack_require__(229);
7978__webpack_require__(437);
7979
7980
7981/***/ }),
7982/* 243 */
7983/***/ (function(module, exports, __webpack_require__) {
7984
7985/* eslint-disable es-x/no-object-getownpropertynames -- safe */
7986var classof = __webpack_require__(50);
7987var toIndexedObject = __webpack_require__(35);
7988var $getOwnPropertyNames = __webpack_require__(105).f;
7989var arraySlice = __webpack_require__(244);
7990
7991var windowNames = typeof window == 'object' && window && Object.getOwnPropertyNames
7992 ? Object.getOwnPropertyNames(window) : [];
7993
7994var getWindowNames = function (it) {
7995 try {
7996 return $getOwnPropertyNames(it);
7997 } catch (error) {
7998 return arraySlice(windowNames);
7999 }
8000};
8001
8002// fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window
8003module.exports.f = function getOwnPropertyNames(it) {
8004 return windowNames && classof(it) == 'Window'
8005 ? getWindowNames(it)
8006 : $getOwnPropertyNames(toIndexedObject(it));
8007};
8008
8009
8010/***/ }),
8011/* 244 */
8012/***/ (function(module, exports, __webpack_require__) {
8013
8014var toAbsoluteIndex = __webpack_require__(126);
8015var lengthOfArrayLike = __webpack_require__(40);
8016var createProperty = __webpack_require__(93);
8017
8018var $Array = Array;
8019var max = Math.max;
8020
8021module.exports = function (O, start, end) {
8022 var length = lengthOfArrayLike(O);
8023 var k = toAbsoluteIndex(start, length);
8024 var fin = toAbsoluteIndex(end === undefined ? length : end, length);
8025 var result = $Array(max(fin - k, 0));
8026 for (var n = 0; k < fin; k++, n++) createProperty(result, n, O[k]);
8027 result.length = n;
8028 return result;
8029};
8030
8031
8032/***/ }),
8033/* 245 */
8034/***/ (function(module, exports, __webpack_require__) {
8035
8036var call = __webpack_require__(15);
8037var getBuiltIn = __webpack_require__(20);
8038var wellKnownSymbol = __webpack_require__(5);
8039var defineBuiltIn = __webpack_require__(45);
8040
8041module.exports = function () {
8042 var Symbol = getBuiltIn('Symbol');
8043 var SymbolPrototype = Symbol && Symbol.prototype;
8044 var valueOf = SymbolPrototype && SymbolPrototype.valueOf;
8045 var TO_PRIMITIVE = wellKnownSymbol('toPrimitive');
8046
8047 if (SymbolPrototype && !SymbolPrototype[TO_PRIMITIVE]) {
8048 // `Symbol.prototype[@@toPrimitive]` method
8049 // https://tc39.es/ecma262/#sec-symbol.prototype-@@toprimitive
8050 // eslint-disable-next-line no-unused-vars -- required for .length
8051 defineBuiltIn(SymbolPrototype, TO_PRIMITIVE, function (hint) {
8052 return call(valueOf, this);
8053 }, { arity: 1 });
8054 }
8055};
8056
8057
8058/***/ }),
8059/* 246 */
8060/***/ (function(module, exports, __webpack_require__) {
8061
8062var NATIVE_SYMBOL = __webpack_require__(65);
8063
8064/* eslint-disable es-x/no-symbol -- safe */
8065module.exports = NATIVE_SYMBOL && !!Symbol['for'] && !!Symbol.keyFor;
8066
8067
8068/***/ }),
8069/* 247 */
8070/***/ (function(module, exports, __webpack_require__) {
8071
8072var defineWellKnownSymbol = __webpack_require__(10);
8073
8074// `Symbol.iterator` well-known symbol
8075// https://tc39.es/ecma262/#sec-symbol.iterator
8076defineWellKnownSymbol('iterator');
8077
8078
8079/***/ }),
8080/* 248 */
8081/***/ (function(module, exports, __webpack_require__) {
8082
8083var parent = __webpack_require__(466);
8084__webpack_require__(46);
8085
8086module.exports = parent;
8087
8088
8089/***/ }),
8090/* 249 */
8091/***/ (function(module, exports, __webpack_require__) {
8092
8093module.exports = __webpack_require__(467);
8094
8095/***/ }),
8096/* 250 */
8097/***/ (function(module, exports, __webpack_require__) {
8098
8099"use strict";
8100// Copyright (c) 2015-2017 David M. Lee, II
8101
8102
8103/**
8104 * Local reference to TimeoutError
8105 * @private
8106 */
8107var TimeoutError;
8108
8109/**
8110 * Rejects a promise with a {@link TimeoutError} if it does not settle within
8111 * the specified timeout.
8112 *
8113 * @param {Promise} promise The promise.
8114 * @param {number} timeoutMillis Number of milliseconds to wait on settling.
8115 * @returns {Promise} Either resolves/rejects with `promise`, or rejects with
8116 * `TimeoutError`, whichever settles first.
8117 */
8118var timeout = module.exports.timeout = function(promise, timeoutMillis) {
8119 var error = new TimeoutError(),
8120 timeout;
8121
8122 return Promise.race([
8123 promise,
8124 new Promise(function(resolve, reject) {
8125 timeout = setTimeout(function() {
8126 reject(error);
8127 }, timeoutMillis);
8128 }),
8129 ]).then(function(v) {
8130 clearTimeout(timeout);
8131 return v;
8132 }, function(err) {
8133 clearTimeout(timeout);
8134 throw err;
8135 });
8136};
8137
8138/**
8139 * Exception indicating that the timeout expired.
8140 */
8141TimeoutError = module.exports.TimeoutError = function() {
8142 Error.call(this)
8143 this.stack = Error().stack
8144 this.message = 'Timeout';
8145};
8146
8147TimeoutError.prototype = Object.create(Error.prototype);
8148TimeoutError.prototype.name = "TimeoutError";
8149
8150
8151/***/ }),
8152/* 251 */
8153/***/ (function(module, exports, __webpack_require__) {
8154
8155var parent = __webpack_require__(483);
8156
8157module.exports = parent;
8158
8159
8160/***/ }),
8161/* 252 */
8162/***/ (function(module, exports, __webpack_require__) {
8163
8164module.exports = __webpack_require__(487);
8165
8166/***/ }),
8167/* 253 */
8168/***/ (function(module, exports, __webpack_require__) {
8169
8170"use strict";
8171
8172var uncurryThis = __webpack_require__(4);
8173var aCallable = __webpack_require__(29);
8174var isObject = __webpack_require__(11);
8175var hasOwn = __webpack_require__(13);
8176var arraySlice = __webpack_require__(112);
8177var NATIVE_BIND = __webpack_require__(80);
8178
8179var $Function = Function;
8180var concat = uncurryThis([].concat);
8181var join = uncurryThis([].join);
8182var factories = {};
8183
8184var construct = function (C, argsLength, args) {
8185 if (!hasOwn(factories, argsLength)) {
8186 for (var list = [], i = 0; i < argsLength; i++) list[i] = 'a[' + i + ']';
8187 factories[argsLength] = $Function('C,a', 'return new C(' + join(list, ',') + ')');
8188 } return factories[argsLength](C, args);
8189};
8190
8191// `Function.prototype.bind` method implementation
8192// https://tc39.es/ecma262/#sec-function.prototype.bind
8193module.exports = NATIVE_BIND ? $Function.bind : function bind(that /* , ...args */) {
8194 var F = aCallable(this);
8195 var Prototype = F.prototype;
8196 var partArgs = arraySlice(arguments, 1);
8197 var boundFunction = function bound(/* args... */) {
8198 var args = concat(partArgs, arraySlice(arguments));
8199 return this instanceof boundFunction ? construct(F, args.length, args) : F.apply(that, args);
8200 };
8201 if (isObject(Prototype)) boundFunction.prototype = Prototype;
8202 return boundFunction;
8203};
8204
8205
8206/***/ }),
8207/* 254 */
8208/***/ (function(module, exports, __webpack_require__) {
8209
8210module.exports = __webpack_require__(508);
8211
8212/***/ }),
8213/* 255 */
8214/***/ (function(module, exports, __webpack_require__) {
8215
8216module.exports = __webpack_require__(511);
8217
8218/***/ }),
8219/* 256 */
8220/***/ (function(module, exports) {
8221
8222var charenc = {
8223 // UTF-8 encoding
8224 utf8: {
8225 // Convert a string to a byte array
8226 stringToBytes: function(str) {
8227 return charenc.bin.stringToBytes(unescape(encodeURIComponent(str)));
8228 },
8229
8230 // Convert a byte array to a string
8231 bytesToString: function(bytes) {
8232 return decodeURIComponent(escape(charenc.bin.bytesToString(bytes)));
8233 }
8234 },
8235
8236 // Binary encoding
8237 bin: {
8238 // Convert a string to a byte array
8239 stringToBytes: function(str) {
8240 for (var bytes = [], i = 0; i < str.length; i++)
8241 bytes.push(str.charCodeAt(i) & 0xFF);
8242 return bytes;
8243 },
8244
8245 // Convert a byte array to a string
8246 bytesToString: function(bytes) {
8247 for (var str = [], i = 0; i < bytes.length; i++)
8248 str.push(String.fromCharCode(bytes[i]));
8249 return str.join('');
8250 }
8251 }
8252};
8253
8254module.exports = charenc;
8255
8256
8257/***/ }),
8258/* 257 */
8259/***/ (function(module, exports, __webpack_require__) {
8260
8261module.exports = __webpack_require__(555);
8262
8263/***/ }),
8264/* 258 */
8265/***/ (function(module, exports, __webpack_require__) {
8266
8267"use strict";
8268
8269
8270var adapters = __webpack_require__(572);
8271
8272module.exports = function (AV) {
8273 AV.setAdapters(adapters);
8274 return AV;
8275};
8276
8277/***/ }),
8278/* 259 */
8279/***/ (function(module, exports) {
8280
8281// a string of all valid unicode whitespaces
8282module.exports = '\u0009\u000A\u000B\u000C\u000D\u0020\u00A0\u1680\u2000\u2001\u2002' +
8283 '\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF';
8284
8285
8286/***/ }),
8287/* 260 */
8288/***/ (function(module, exports, __webpack_require__) {
8289
8290"use strict";
8291
8292
8293var _interopRequireDefault = __webpack_require__(1);
8294
8295var _symbol = _interopRequireDefault(__webpack_require__(77));
8296
8297var _iterator = _interopRequireDefault(__webpack_require__(154));
8298
8299function _typeof(obj) {
8300 "@babel/helpers - typeof";
8301
8302 if (typeof _symbol.default === "function" && typeof _iterator.default === "symbol") {
8303 _typeof = function _typeof(obj) {
8304 return typeof obj;
8305 };
8306 } else {
8307 _typeof = function _typeof(obj) {
8308 return obj && typeof _symbol.default === "function" && obj.constructor === _symbol.default && obj !== _symbol.default.prototype ? "symbol" : typeof obj;
8309 };
8310 }
8311
8312 return _typeof(obj);
8313}
8314/**
8315 * Check if `obj` is an object.
8316 *
8317 * @param {Object} obj
8318 * @return {Boolean}
8319 * @api private
8320 */
8321
8322
8323function isObject(obj) {
8324 return obj !== null && _typeof(obj) === 'object';
8325}
8326
8327module.exports = isObject;
8328
8329/***/ }),
8330/* 261 */
8331/***/ (function(module, exports, __webpack_require__) {
8332
8333module.exports = __webpack_require__(608);
8334
8335/***/ }),
8336/* 262 */
8337/***/ (function(module, exports, __webpack_require__) {
8338
8339module.exports = __webpack_require__(614);
8340
8341/***/ }),
8342/* 263 */
8343/***/ (function(module, exports, __webpack_require__) {
8344
8345var fails = __webpack_require__(2);
8346
8347module.exports = !fails(function () {
8348 // eslint-disable-next-line es-x/no-object-isextensible, es-x/no-object-preventextensions -- required for testing
8349 return Object.isExtensible(Object.preventExtensions({}));
8350});
8351
8352
8353/***/ }),
8354/* 264 */
8355/***/ (function(module, exports, __webpack_require__) {
8356
8357var fails = __webpack_require__(2);
8358var isObject = __webpack_require__(11);
8359var classof = __webpack_require__(50);
8360var ARRAY_BUFFER_NON_EXTENSIBLE = __webpack_require__(626);
8361
8362// eslint-disable-next-line es-x/no-object-isextensible -- safe
8363var $isExtensible = Object.isExtensible;
8364var FAILS_ON_PRIMITIVES = fails(function () { $isExtensible(1); });
8365
8366// `Object.isExtensible` method
8367// https://tc39.es/ecma262/#sec-object.isextensible
8368module.exports = (FAILS_ON_PRIMITIVES || ARRAY_BUFFER_NON_EXTENSIBLE) ? function isExtensible(it) {
8369 if (!isObject(it)) return false;
8370 if (ARRAY_BUFFER_NON_EXTENSIBLE && classof(it) == 'ArrayBuffer') return false;
8371 return $isExtensible ? $isExtensible(it) : true;
8372} : $isExtensible;
8373
8374
8375/***/ }),
8376/* 265 */
8377/***/ (function(module, exports, __webpack_require__) {
8378
8379module.exports = __webpack_require__(627);
8380
8381/***/ }),
8382/* 266 */
8383/***/ (function(module, exports, __webpack_require__) {
8384
8385module.exports = __webpack_require__(631);
8386
8387/***/ }),
8388/* 267 */
8389/***/ (function(module, exports, __webpack_require__) {
8390
8391"use strict";
8392
8393var $ = __webpack_require__(0);
8394var global = __webpack_require__(8);
8395var InternalMetadataModule = __webpack_require__(97);
8396var fails = __webpack_require__(2);
8397var createNonEnumerableProperty = __webpack_require__(39);
8398var iterate = __webpack_require__(41);
8399var anInstance = __webpack_require__(110);
8400var isCallable = __webpack_require__(9);
8401var isObject = __webpack_require__(11);
8402var setToStringTag = __webpack_require__(56);
8403var defineProperty = __webpack_require__(23).f;
8404var forEach = __webpack_require__(75).forEach;
8405var DESCRIPTORS = __webpack_require__(14);
8406var InternalStateModule = __webpack_require__(44);
8407
8408var setInternalState = InternalStateModule.set;
8409var internalStateGetterFor = InternalStateModule.getterFor;
8410
8411module.exports = function (CONSTRUCTOR_NAME, wrapper, common) {
8412 var IS_MAP = CONSTRUCTOR_NAME.indexOf('Map') !== -1;
8413 var IS_WEAK = CONSTRUCTOR_NAME.indexOf('Weak') !== -1;
8414 var ADDER = IS_MAP ? 'set' : 'add';
8415 var NativeConstructor = global[CONSTRUCTOR_NAME];
8416 var NativePrototype = NativeConstructor && NativeConstructor.prototype;
8417 var exported = {};
8418 var Constructor;
8419
8420 if (!DESCRIPTORS || !isCallable(NativeConstructor)
8421 || !(IS_WEAK || NativePrototype.forEach && !fails(function () { new NativeConstructor().entries().next(); }))
8422 ) {
8423 // create collection constructor
8424 Constructor = common.getConstructor(wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER);
8425 InternalMetadataModule.enable();
8426 } else {
8427 Constructor = wrapper(function (target, iterable) {
8428 setInternalState(anInstance(target, Prototype), {
8429 type: CONSTRUCTOR_NAME,
8430 collection: new NativeConstructor()
8431 });
8432 if (iterable != undefined) iterate(iterable, target[ADDER], { that: target, AS_ENTRIES: IS_MAP });
8433 });
8434
8435 var Prototype = Constructor.prototype;
8436
8437 var getInternalState = internalStateGetterFor(CONSTRUCTOR_NAME);
8438
8439 forEach(['add', 'clear', 'delete', 'forEach', 'get', 'has', 'set', 'keys', 'values', 'entries'], function (KEY) {
8440 var IS_ADDER = KEY == 'add' || KEY == 'set';
8441 if (KEY in NativePrototype && !(IS_WEAK && KEY == 'clear')) {
8442 createNonEnumerableProperty(Prototype, KEY, function (a, b) {
8443 var collection = getInternalState(this).collection;
8444 if (!IS_ADDER && IS_WEAK && !isObject(a)) return KEY == 'get' ? undefined : false;
8445 var result = collection[KEY](a === 0 ? 0 : a, b);
8446 return IS_ADDER ? this : result;
8447 });
8448 }
8449 });
8450
8451 IS_WEAK || defineProperty(Prototype, 'size', {
8452 configurable: true,
8453 get: function () {
8454 return getInternalState(this).collection.size;
8455 }
8456 });
8457 }
8458
8459 setToStringTag(Constructor, CONSTRUCTOR_NAME, false, true);
8460
8461 exported[CONSTRUCTOR_NAME] = Constructor;
8462 $({ global: true, forced: true }, exported);
8463
8464 if (!IS_WEAK) common.setStrong(Constructor, CONSTRUCTOR_NAME, IS_MAP);
8465
8466 return Constructor;
8467};
8468
8469
8470/***/ }),
8471/* 268 */
8472/***/ (function(module, exports, __webpack_require__) {
8473
8474module.exports = __webpack_require__(647);
8475
8476/***/ }),
8477/* 269 */
8478/***/ (function(module, exports) {
8479
8480function _arrayLikeToArray(arr, len) {
8481 if (len == null || len > arr.length) len = arr.length;
8482
8483 for (var i = 0, arr2 = new Array(len); i < len; i++) {
8484 arr2[i] = arr[i];
8485 }
8486
8487 return arr2;
8488}
8489
8490module.exports = _arrayLikeToArray;
8491
8492/***/ }),
8493/* 270 */
8494/***/ (function(module, exports) {
8495
8496function _iterableToArray(iter) {
8497 if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter);
8498}
8499
8500module.exports = _iterableToArray;
8501
8502/***/ }),
8503/* 271 */
8504/***/ (function(module, exports, __webpack_require__) {
8505
8506var arrayLikeToArray = __webpack_require__(269);
8507
8508function _unsupportedIterableToArray(o, minLen) {
8509 if (!o) return;
8510 if (typeof o === "string") return arrayLikeToArray(o, minLen);
8511 var n = Object.prototype.toString.call(o).slice(8, -1);
8512 if (n === "Object" && o.constructor) n = o.constructor.name;
8513 if (n === "Map" || n === "Set") return Array.from(o);
8514 if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return arrayLikeToArray(o, minLen);
8515}
8516
8517module.exports = _unsupportedIterableToArray;
8518
8519/***/ }),
8520/* 272 */
8521/***/ (function(module, exports, __webpack_require__) {
8522
8523var baseRandom = __webpack_require__(671);
8524
8525/**
8526 * A specialized version of `_.shuffle` which mutates and sets the size of `array`.
8527 *
8528 * @private
8529 * @param {Array} array The array to shuffle.
8530 * @param {number} [size=array.length] The size of `array`.
8531 * @returns {Array} Returns `array`.
8532 */
8533function shuffleSelf(array, size) {
8534 var index = -1,
8535 length = array.length,
8536 lastIndex = length - 1;
8537
8538 size = size === undefined ? length : size;
8539 while (++index < size) {
8540 var rand = baseRandom(index, lastIndex),
8541 value = array[rand];
8542
8543 array[rand] = array[index];
8544 array[index] = value;
8545 }
8546 array.length = size;
8547 return array;
8548}
8549
8550module.exports = shuffleSelf;
8551
8552
8553/***/ }),
8554/* 273 */
8555/***/ (function(module, exports, __webpack_require__) {
8556
8557var baseValues = __webpack_require__(673),
8558 keys = __webpack_require__(675);
8559
8560/**
8561 * Creates an array of the own enumerable string keyed property values of `object`.
8562 *
8563 * **Note:** Non-object values are coerced to objects.
8564 *
8565 * @static
8566 * @since 0.1.0
8567 * @memberOf _
8568 * @category Object
8569 * @param {Object} object The object to query.
8570 * @returns {Array} Returns the array of property values.
8571 * @example
8572 *
8573 * function Foo() {
8574 * this.a = 1;
8575 * this.b = 2;
8576 * }
8577 *
8578 * Foo.prototype.c = 3;
8579 *
8580 * _.values(new Foo);
8581 * // => [1, 2] (iteration order is not guaranteed)
8582 *
8583 * _.values('hi');
8584 * // => ['h', 'i']
8585 */
8586function values(object) {
8587 return object == null ? [] : baseValues(object, keys(object));
8588}
8589
8590module.exports = values;
8591
8592
8593/***/ }),
8594/* 274 */
8595/***/ (function(module, exports, __webpack_require__) {
8596
8597var root = __webpack_require__(275);
8598
8599/** Built-in value references. */
8600var Symbol = root.Symbol;
8601
8602module.exports = Symbol;
8603
8604
8605/***/ }),
8606/* 275 */
8607/***/ (function(module, exports, __webpack_require__) {
8608
8609var freeGlobal = __webpack_require__(276);
8610
8611/** Detect free variable `self`. */
8612var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
8613
8614/** Used as a reference to the global object. */
8615var root = freeGlobal || freeSelf || Function('return this')();
8616
8617module.exports = root;
8618
8619
8620/***/ }),
8621/* 276 */
8622/***/ (function(module, exports, __webpack_require__) {
8623
8624/* WEBPACK VAR INJECTION */(function(global) {/** Detect free variable `global` from Node.js. */
8625var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
8626
8627module.exports = freeGlobal;
8628
8629/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(78)))
8630
8631/***/ }),
8632/* 277 */
8633/***/ (function(module, exports) {
8634
8635/**
8636 * Checks if `value` is classified as an `Array` object.
8637 *
8638 * @static
8639 * @memberOf _
8640 * @since 0.1.0
8641 * @category Lang
8642 * @param {*} value The value to check.
8643 * @returns {boolean} Returns `true` if `value` is an array, else `false`.
8644 * @example
8645 *
8646 * _.isArray([1, 2, 3]);
8647 * // => true
8648 *
8649 * _.isArray(document.body.children);
8650 * // => false
8651 *
8652 * _.isArray('abc');
8653 * // => false
8654 *
8655 * _.isArray(_.noop);
8656 * // => false
8657 */
8658var isArray = Array.isArray;
8659
8660module.exports = isArray;
8661
8662
8663/***/ }),
8664/* 278 */
8665/***/ (function(module, exports) {
8666
8667module.exports = function(module) {
8668 if(!module.webpackPolyfill) {
8669 module.deprecate = function() {};
8670 module.paths = [];
8671 // module.parent = undefined by default
8672 if(!module.children) module.children = [];
8673 Object.defineProperty(module, "loaded", {
8674 enumerable: true,
8675 get: function() {
8676 return module.l;
8677 }
8678 });
8679 Object.defineProperty(module, "id", {
8680 enumerable: true,
8681 get: function() {
8682 return module.i;
8683 }
8684 });
8685 module.webpackPolyfill = 1;
8686 }
8687 return module;
8688};
8689
8690
8691/***/ }),
8692/* 279 */
8693/***/ (function(module, exports) {
8694
8695/** Used as references for various `Number` constants. */
8696var MAX_SAFE_INTEGER = 9007199254740991;
8697
8698/**
8699 * Checks if `value` is a valid array-like length.
8700 *
8701 * **Note:** This method is loosely based on
8702 * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
8703 *
8704 * @static
8705 * @memberOf _
8706 * @since 4.0.0
8707 * @category Lang
8708 * @param {*} value The value to check.
8709 * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
8710 * @example
8711 *
8712 * _.isLength(3);
8713 * // => true
8714 *
8715 * _.isLength(Number.MIN_VALUE);
8716 * // => false
8717 *
8718 * _.isLength(Infinity);
8719 * // => false
8720 *
8721 * _.isLength('3');
8722 * // => false
8723 */
8724function isLength(value) {
8725 return typeof value == 'number' &&
8726 value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
8727}
8728
8729module.exports = isLength;
8730
8731
8732/***/ }),
8733/* 280 */
8734/***/ (function(module, exports) {
8735
8736/**
8737 * Creates a unary function that invokes `func` with its argument transformed.
8738 *
8739 * @private
8740 * @param {Function} func The function to wrap.
8741 * @param {Function} transform The argument transform.
8742 * @returns {Function} Returns the new function.
8743 */
8744function overArg(func, transform) {
8745 return function(arg) {
8746 return func(transform(arg));
8747 };
8748}
8749
8750module.exports = overArg;
8751
8752
8753/***/ }),
8754/* 281 */
8755/***/ (function(module, exports, __webpack_require__) {
8756
8757"use strict";
8758
8759
8760var AV = __webpack_require__(282);
8761
8762var useLiveQuery = __webpack_require__(620);
8763
8764var useAdatpers = __webpack_require__(258);
8765
8766module.exports = useAdatpers(useLiveQuery(AV));
8767
8768/***/ }),
8769/* 282 */
8770/***/ (function(module, exports, __webpack_require__) {
8771
8772"use strict";
8773
8774
8775var AV = __webpack_require__(283);
8776
8777var useAdatpers = __webpack_require__(258);
8778
8779module.exports = useAdatpers(AV);
8780
8781/***/ }),
8782/* 283 */
8783/***/ (function(module, exports, __webpack_require__) {
8784
8785"use strict";
8786
8787
8788module.exports = __webpack_require__(284);
8789
8790/***/ }),
8791/* 284 */
8792/***/ (function(module, exports, __webpack_require__) {
8793
8794"use strict";
8795
8796
8797var _interopRequireDefault = __webpack_require__(1);
8798
8799var _promise = _interopRequireDefault(__webpack_require__(12));
8800
8801/*!
8802 * LeanCloud JavaScript SDK
8803 * https://leancloud.cn
8804 *
8805 * Copyright 2016 LeanCloud.cn, Inc.
8806 * The LeanCloud JavaScript SDK is freely distributable under the MIT license.
8807 */
8808var _ = __webpack_require__(3);
8809
8810var AV = __webpack_require__(74);
8811
8812AV._ = _;
8813AV.version = __webpack_require__(233);
8814AV.Promise = _promise.default;
8815AV.localStorage = __webpack_require__(235);
8816AV.Cache = __webpack_require__(236);
8817AV.Error = __webpack_require__(48);
8818
8819__webpack_require__(423);
8820
8821__webpack_require__(471)(AV);
8822
8823__webpack_require__(472)(AV);
8824
8825__webpack_require__(473)(AV);
8826
8827__webpack_require__(474)(AV);
8828
8829__webpack_require__(479)(AV);
8830
8831__webpack_require__(480)(AV);
8832
8833__webpack_require__(533)(AV);
8834
8835__webpack_require__(558)(AV);
8836
8837__webpack_require__(559)(AV);
8838
8839__webpack_require__(561)(AV);
8840
8841__webpack_require__(562)(AV);
8842
8843__webpack_require__(563)(AV);
8844
8845__webpack_require__(564)(AV);
8846
8847__webpack_require__(565)(AV);
8848
8849__webpack_require__(566)(AV);
8850
8851__webpack_require__(567)(AV);
8852
8853__webpack_require__(568)(AV);
8854
8855__webpack_require__(569)(AV);
8856
8857AV.Conversation = __webpack_require__(570);
8858
8859__webpack_require__(571);
8860
8861module.exports = AV;
8862/**
8863 * Options to controll the authentication for an operation
8864 * @typedef {Object} AuthOptions
8865 * @property {String} [sessionToken] Specify a user to excute the operation as.
8866 * @property {AV.User} [user] Specify a user to excute the operation as. The user must have _sessionToken. This option will be ignored if sessionToken option provided.
8867 * @property {Boolean} [useMasterKey] Indicates whether masterKey is used for this operation. Only valid when masterKey is set.
8868 */
8869
8870/**
8871 * Options to controll the authentication for an SMS operation
8872 * @typedef {Object} SMSAuthOptions
8873 * @property {String} [sessionToken] Specify a user to excute the operation as.
8874 * @property {AV.User} [user] Specify a user to excute the operation as. The user must have _sessionToken. This option will be ignored if sessionToken option provided.
8875 * @property {Boolean} [useMasterKey] Indicates whether masterKey is used for this operation. Only valid when masterKey is set.
8876 * @property {String} [validateToken] a validate token returned by {@link AV.Cloud.verifyCaptcha}
8877 */
8878
8879/***/ }),
8880/* 285 */
8881/***/ (function(module, exports, __webpack_require__) {
8882
8883var parent = __webpack_require__(286);
8884__webpack_require__(46);
8885
8886module.exports = parent;
8887
8888
8889/***/ }),
8890/* 286 */
8891/***/ (function(module, exports, __webpack_require__) {
8892
8893__webpack_require__(287);
8894__webpack_require__(43);
8895__webpack_require__(68);
8896__webpack_require__(302);
8897__webpack_require__(316);
8898__webpack_require__(317);
8899__webpack_require__(318);
8900__webpack_require__(70);
8901var path = __webpack_require__(7);
8902
8903module.exports = path.Promise;
8904
8905
8906/***/ }),
8907/* 287 */
8908/***/ (function(module, exports, __webpack_require__) {
8909
8910// TODO: Remove this module from `core-js@4` since it's replaced to module below
8911__webpack_require__(288);
8912
8913
8914/***/ }),
8915/* 288 */
8916/***/ (function(module, exports, __webpack_require__) {
8917
8918"use strict";
8919
8920var $ = __webpack_require__(0);
8921var isPrototypeOf = __webpack_require__(16);
8922var getPrototypeOf = __webpack_require__(102);
8923var setPrototypeOf = __webpack_require__(104);
8924var copyConstructorProperties = __webpack_require__(293);
8925var create = __webpack_require__(53);
8926var createNonEnumerableProperty = __webpack_require__(39);
8927var createPropertyDescriptor = __webpack_require__(49);
8928var clearErrorStack = __webpack_require__(296);
8929var installErrorCause = __webpack_require__(297);
8930var iterate = __webpack_require__(41);
8931var normalizeStringArgument = __webpack_require__(298);
8932var wellKnownSymbol = __webpack_require__(5);
8933var ERROR_STACK_INSTALLABLE = __webpack_require__(299);
8934
8935var TO_STRING_TAG = wellKnownSymbol('toStringTag');
8936var $Error = Error;
8937var push = [].push;
8938
8939var $AggregateError = function AggregateError(errors, message /* , options */) {
8940 var options = arguments.length > 2 ? arguments[2] : undefined;
8941 var isInstance = isPrototypeOf(AggregateErrorPrototype, this);
8942 var that;
8943 if (setPrototypeOf) {
8944 that = setPrototypeOf(new $Error(), isInstance ? getPrototypeOf(this) : AggregateErrorPrototype);
8945 } else {
8946 that = isInstance ? this : create(AggregateErrorPrototype);
8947 createNonEnumerableProperty(that, TO_STRING_TAG, 'Error');
8948 }
8949 if (message !== undefined) createNonEnumerableProperty(that, 'message', normalizeStringArgument(message));
8950 if (ERROR_STACK_INSTALLABLE) createNonEnumerableProperty(that, 'stack', clearErrorStack(that.stack, 1));
8951 installErrorCause(that, options);
8952 var errorsArray = [];
8953 iterate(errors, push, { that: errorsArray });
8954 createNonEnumerableProperty(that, 'errors', errorsArray);
8955 return that;
8956};
8957
8958if (setPrototypeOf) setPrototypeOf($AggregateError, $Error);
8959else copyConstructorProperties($AggregateError, $Error, { name: true });
8960
8961var AggregateErrorPrototype = $AggregateError.prototype = create($Error.prototype, {
8962 constructor: createPropertyDescriptor(1, $AggregateError),
8963 message: createPropertyDescriptor(1, ''),
8964 name: createPropertyDescriptor(1, 'AggregateError')
8965});
8966
8967// `AggregateError` constructor
8968// https://tc39.es/ecma262/#sec-aggregate-error-constructor
8969$({ global: true, constructor: true, arity: 2 }, {
8970 AggregateError: $AggregateError
8971});
8972
8973
8974/***/ }),
8975/* 289 */
8976/***/ (function(module, exports, __webpack_require__) {
8977
8978var call = __webpack_require__(15);
8979var isObject = __webpack_require__(11);
8980var isSymbol = __webpack_require__(100);
8981var getMethod = __webpack_require__(122);
8982var ordinaryToPrimitive = __webpack_require__(290);
8983var wellKnownSymbol = __webpack_require__(5);
8984
8985var $TypeError = TypeError;
8986var TO_PRIMITIVE = wellKnownSymbol('toPrimitive');
8987
8988// `ToPrimitive` abstract operation
8989// https://tc39.es/ecma262/#sec-toprimitive
8990module.exports = function (input, pref) {
8991 if (!isObject(input) || isSymbol(input)) return input;
8992 var exoticToPrim = getMethod(input, TO_PRIMITIVE);
8993 var result;
8994 if (exoticToPrim) {
8995 if (pref === undefined) pref = 'default';
8996 result = call(exoticToPrim, input, pref);
8997 if (!isObject(result) || isSymbol(result)) return result;
8998 throw $TypeError("Can't convert object to primitive value");
8999 }
9000 if (pref === undefined) pref = 'number';
9001 return ordinaryToPrimitive(input, pref);
9002};
9003
9004
9005/***/ }),
9006/* 290 */
9007/***/ (function(module, exports, __webpack_require__) {
9008
9009var call = __webpack_require__(15);
9010var isCallable = __webpack_require__(9);
9011var isObject = __webpack_require__(11);
9012
9013var $TypeError = TypeError;
9014
9015// `OrdinaryToPrimitive` abstract operation
9016// https://tc39.es/ecma262/#sec-ordinarytoprimitive
9017module.exports = function (input, pref) {
9018 var fn, val;
9019 if (pref === 'string' && isCallable(fn = input.toString) && !isObject(val = call(fn, input))) return val;
9020 if (isCallable(fn = input.valueOf) && !isObject(val = call(fn, input))) return val;
9021 if (pref !== 'string' && isCallable(fn = input.toString) && !isObject(val = call(fn, input))) return val;
9022 throw $TypeError("Can't convert object to primitive value");
9023};
9024
9025
9026/***/ }),
9027/* 291 */
9028/***/ (function(module, exports, __webpack_require__) {
9029
9030var global = __webpack_require__(8);
9031
9032// eslint-disable-next-line es-x/no-object-defineproperty -- safe
9033var defineProperty = Object.defineProperty;
9034
9035module.exports = function (key, value) {
9036 try {
9037 defineProperty(global, key, { value: value, configurable: true, writable: true });
9038 } catch (error) {
9039 global[key] = value;
9040 } return value;
9041};
9042
9043
9044/***/ }),
9045/* 292 */
9046/***/ (function(module, exports, __webpack_require__) {
9047
9048var isCallable = __webpack_require__(9);
9049
9050var $String = String;
9051var $TypeError = TypeError;
9052
9053module.exports = function (argument) {
9054 if (typeof argument == 'object' || isCallable(argument)) return argument;
9055 throw $TypeError("Can't set " + $String(argument) + ' as a prototype');
9056};
9057
9058
9059/***/ }),
9060/* 293 */
9061/***/ (function(module, exports, __webpack_require__) {
9062
9063var hasOwn = __webpack_require__(13);
9064var ownKeys = __webpack_require__(162);
9065var getOwnPropertyDescriptorModule = __webpack_require__(64);
9066var definePropertyModule = __webpack_require__(23);
9067
9068module.exports = function (target, source, exceptions) {
9069 var keys = ownKeys(source);
9070 var defineProperty = definePropertyModule.f;
9071 var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
9072 for (var i = 0; i < keys.length; i++) {
9073 var key = keys[i];
9074 if (!hasOwn(target, key) && !(exceptions && hasOwn(exceptions, key))) {
9075 defineProperty(target, key, getOwnPropertyDescriptor(source, key));
9076 }
9077 }
9078};
9079
9080
9081/***/ }),
9082/* 294 */
9083/***/ (function(module, exports) {
9084
9085var ceil = Math.ceil;
9086var floor = Math.floor;
9087
9088// `Math.trunc` method
9089// https://tc39.es/ecma262/#sec-math.trunc
9090// eslint-disable-next-line es-x/no-math-trunc -- safe
9091module.exports = Math.trunc || function trunc(x) {
9092 var n = +x;
9093 return (n > 0 ? floor : ceil)(n);
9094};
9095
9096
9097/***/ }),
9098/* 295 */
9099/***/ (function(module, exports, __webpack_require__) {
9100
9101var toIntegerOrInfinity = __webpack_require__(127);
9102
9103var min = Math.min;
9104
9105// `ToLength` abstract operation
9106// https://tc39.es/ecma262/#sec-tolength
9107module.exports = function (argument) {
9108 return argument > 0 ? min(toIntegerOrInfinity(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991
9109};
9110
9111
9112/***/ }),
9113/* 296 */
9114/***/ (function(module, exports, __webpack_require__) {
9115
9116var uncurryThis = __webpack_require__(4);
9117
9118var $Error = Error;
9119var replace = uncurryThis(''.replace);
9120
9121var TEST = (function (arg) { return String($Error(arg).stack); })('zxcasd');
9122var V8_OR_CHAKRA_STACK_ENTRY = /\n\s*at [^:]*:[^\n]*/;
9123var IS_V8_OR_CHAKRA_STACK = V8_OR_CHAKRA_STACK_ENTRY.test(TEST);
9124
9125module.exports = function (stack, dropEntries) {
9126 if (IS_V8_OR_CHAKRA_STACK && typeof stack == 'string' && !$Error.prepareStackTrace) {
9127 while (dropEntries--) stack = replace(stack, V8_OR_CHAKRA_STACK_ENTRY, '');
9128 } return stack;
9129};
9130
9131
9132/***/ }),
9133/* 297 */
9134/***/ (function(module, exports, __webpack_require__) {
9135
9136var isObject = __webpack_require__(11);
9137var createNonEnumerableProperty = __webpack_require__(39);
9138
9139// `InstallErrorCause` abstract operation
9140// https://tc39.es/proposal-error-cause/#sec-errorobjects-install-error-cause
9141module.exports = function (O, options) {
9142 if (isObject(options) && 'cause' in options) {
9143 createNonEnumerableProperty(O, 'cause', options.cause);
9144 }
9145};
9146
9147
9148/***/ }),
9149/* 298 */
9150/***/ (function(module, exports, __webpack_require__) {
9151
9152var toString = __webpack_require__(42);
9153
9154module.exports = function (argument, $default) {
9155 return argument === undefined ? arguments.length < 2 ? '' : $default : toString(argument);
9156};
9157
9158
9159/***/ }),
9160/* 299 */
9161/***/ (function(module, exports, __webpack_require__) {
9162
9163var fails = __webpack_require__(2);
9164var createPropertyDescriptor = __webpack_require__(49);
9165
9166module.exports = !fails(function () {
9167 var error = Error('a');
9168 if (!('stack' in error)) return true;
9169 // eslint-disable-next-line es-x/no-object-defineproperty -- safe
9170 Object.defineProperty(error, 'stack', createPropertyDescriptor(1, 7));
9171 return error.stack !== 7;
9172});
9173
9174
9175/***/ }),
9176/* 300 */
9177/***/ (function(module, exports, __webpack_require__) {
9178
9179"use strict";
9180
9181var IteratorPrototype = __webpack_require__(170).IteratorPrototype;
9182var create = __webpack_require__(53);
9183var createPropertyDescriptor = __webpack_require__(49);
9184var setToStringTag = __webpack_require__(56);
9185var Iterators = __webpack_require__(54);
9186
9187var returnThis = function () { return this; };
9188
9189module.exports = function (IteratorConstructor, NAME, next, ENUMERABLE_NEXT) {
9190 var TO_STRING_TAG = NAME + ' Iterator';
9191 IteratorConstructor.prototype = create(IteratorPrototype, { next: createPropertyDescriptor(+!ENUMERABLE_NEXT, next) });
9192 setToStringTag(IteratorConstructor, TO_STRING_TAG, false, true);
9193 Iterators[TO_STRING_TAG] = returnThis;
9194 return IteratorConstructor;
9195};
9196
9197
9198/***/ }),
9199/* 301 */
9200/***/ (function(module, exports, __webpack_require__) {
9201
9202"use strict";
9203
9204var TO_STRING_TAG_SUPPORT = __webpack_require__(130);
9205var classof = __webpack_require__(55);
9206
9207// `Object.prototype.toString` method implementation
9208// https://tc39.es/ecma262/#sec-object.prototype.tostring
9209module.exports = TO_STRING_TAG_SUPPORT ? {}.toString : function toString() {
9210 return '[object ' + classof(this) + ']';
9211};
9212
9213
9214/***/ }),
9215/* 302 */
9216/***/ (function(module, exports, __webpack_require__) {
9217
9218// TODO: Remove this module from `core-js@4` since it's split to modules listed below
9219__webpack_require__(303);
9220__webpack_require__(311);
9221__webpack_require__(312);
9222__webpack_require__(313);
9223__webpack_require__(314);
9224__webpack_require__(315);
9225
9226
9227/***/ }),
9228/* 303 */
9229/***/ (function(module, exports, __webpack_require__) {
9230
9231"use strict";
9232
9233var $ = __webpack_require__(0);
9234var IS_PURE = __webpack_require__(36);
9235var IS_NODE = __webpack_require__(109);
9236var global = __webpack_require__(8);
9237var call = __webpack_require__(15);
9238var defineBuiltIn = __webpack_require__(45);
9239var setPrototypeOf = __webpack_require__(104);
9240var setToStringTag = __webpack_require__(56);
9241var setSpecies = __webpack_require__(171);
9242var aCallable = __webpack_require__(29);
9243var isCallable = __webpack_require__(9);
9244var isObject = __webpack_require__(11);
9245var anInstance = __webpack_require__(110);
9246var speciesConstructor = __webpack_require__(172);
9247var task = __webpack_require__(174).set;
9248var microtask = __webpack_require__(305);
9249var hostReportErrors = __webpack_require__(308);
9250var perform = __webpack_require__(84);
9251var Queue = __webpack_require__(309);
9252var InternalStateModule = __webpack_require__(44);
9253var NativePromiseConstructor = __webpack_require__(69);
9254var PromiseConstructorDetection = __webpack_require__(85);
9255var newPromiseCapabilityModule = __webpack_require__(57);
9256
9257var PROMISE = 'Promise';
9258var FORCED_PROMISE_CONSTRUCTOR = PromiseConstructorDetection.CONSTRUCTOR;
9259var NATIVE_PROMISE_REJECTION_EVENT = PromiseConstructorDetection.REJECTION_EVENT;
9260var NATIVE_PROMISE_SUBCLASSING = PromiseConstructorDetection.SUBCLASSING;
9261var getInternalPromiseState = InternalStateModule.getterFor(PROMISE);
9262var setInternalState = InternalStateModule.set;
9263var NativePromisePrototype = NativePromiseConstructor && NativePromiseConstructor.prototype;
9264var PromiseConstructor = NativePromiseConstructor;
9265var PromisePrototype = NativePromisePrototype;
9266var TypeError = global.TypeError;
9267var document = global.document;
9268var process = global.process;
9269var newPromiseCapability = newPromiseCapabilityModule.f;
9270var newGenericPromiseCapability = newPromiseCapability;
9271
9272var DISPATCH_EVENT = !!(document && document.createEvent && global.dispatchEvent);
9273var UNHANDLED_REJECTION = 'unhandledrejection';
9274var REJECTION_HANDLED = 'rejectionhandled';
9275var PENDING = 0;
9276var FULFILLED = 1;
9277var REJECTED = 2;
9278var HANDLED = 1;
9279var UNHANDLED = 2;
9280
9281var Internal, OwnPromiseCapability, PromiseWrapper, nativeThen;
9282
9283// helpers
9284var isThenable = function (it) {
9285 var then;
9286 return isObject(it) && isCallable(then = it.then) ? then : false;
9287};
9288
9289var callReaction = function (reaction, state) {
9290 var value = state.value;
9291 var ok = state.state == FULFILLED;
9292 var handler = ok ? reaction.ok : reaction.fail;
9293 var resolve = reaction.resolve;
9294 var reject = reaction.reject;
9295 var domain = reaction.domain;
9296 var result, then, exited;
9297 try {
9298 if (handler) {
9299 if (!ok) {
9300 if (state.rejection === UNHANDLED) onHandleUnhandled(state);
9301 state.rejection = HANDLED;
9302 }
9303 if (handler === true) result = value;
9304 else {
9305 if (domain) domain.enter();
9306 result = handler(value); // can throw
9307 if (domain) {
9308 domain.exit();
9309 exited = true;
9310 }
9311 }
9312 if (result === reaction.promise) {
9313 reject(TypeError('Promise-chain cycle'));
9314 } else if (then = isThenable(result)) {
9315 call(then, result, resolve, reject);
9316 } else resolve(result);
9317 } else reject(value);
9318 } catch (error) {
9319 if (domain && !exited) domain.exit();
9320 reject(error);
9321 }
9322};
9323
9324var notify = function (state, isReject) {
9325 if (state.notified) return;
9326 state.notified = true;
9327 microtask(function () {
9328 var reactions = state.reactions;
9329 var reaction;
9330 while (reaction = reactions.get()) {
9331 callReaction(reaction, state);
9332 }
9333 state.notified = false;
9334 if (isReject && !state.rejection) onUnhandled(state);
9335 });
9336};
9337
9338var dispatchEvent = function (name, promise, reason) {
9339 var event, handler;
9340 if (DISPATCH_EVENT) {
9341 event = document.createEvent('Event');
9342 event.promise = promise;
9343 event.reason = reason;
9344 event.initEvent(name, false, true);
9345 global.dispatchEvent(event);
9346 } else event = { promise: promise, reason: reason };
9347 if (!NATIVE_PROMISE_REJECTION_EVENT && (handler = global['on' + name])) handler(event);
9348 else if (name === UNHANDLED_REJECTION) hostReportErrors('Unhandled promise rejection', reason);
9349};
9350
9351var onUnhandled = function (state) {
9352 call(task, global, function () {
9353 var promise = state.facade;
9354 var value = state.value;
9355 var IS_UNHANDLED = isUnhandled(state);
9356 var result;
9357 if (IS_UNHANDLED) {
9358 result = perform(function () {
9359 if (IS_NODE) {
9360 process.emit('unhandledRejection', value, promise);
9361 } else dispatchEvent(UNHANDLED_REJECTION, promise, value);
9362 });
9363 // Browsers should not trigger `rejectionHandled` event if it was handled here, NodeJS - should
9364 state.rejection = IS_NODE || isUnhandled(state) ? UNHANDLED : HANDLED;
9365 if (result.error) throw result.value;
9366 }
9367 });
9368};
9369
9370var isUnhandled = function (state) {
9371 return state.rejection !== HANDLED && !state.parent;
9372};
9373
9374var onHandleUnhandled = function (state) {
9375 call(task, global, function () {
9376 var promise = state.facade;
9377 if (IS_NODE) {
9378 process.emit('rejectionHandled', promise);
9379 } else dispatchEvent(REJECTION_HANDLED, promise, state.value);
9380 });
9381};
9382
9383var bind = function (fn, state, unwrap) {
9384 return function (value) {
9385 fn(state, value, unwrap);
9386 };
9387};
9388
9389var internalReject = function (state, value, unwrap) {
9390 if (state.done) return;
9391 state.done = true;
9392 if (unwrap) state = unwrap;
9393 state.value = value;
9394 state.state = REJECTED;
9395 notify(state, true);
9396};
9397
9398var internalResolve = function (state, value, unwrap) {
9399 if (state.done) return;
9400 state.done = true;
9401 if (unwrap) state = unwrap;
9402 try {
9403 if (state.facade === value) throw TypeError("Promise can't be resolved itself");
9404 var then = isThenable(value);
9405 if (then) {
9406 microtask(function () {
9407 var wrapper = { done: false };
9408 try {
9409 call(then, value,
9410 bind(internalResolve, wrapper, state),
9411 bind(internalReject, wrapper, state)
9412 );
9413 } catch (error) {
9414 internalReject(wrapper, error, state);
9415 }
9416 });
9417 } else {
9418 state.value = value;
9419 state.state = FULFILLED;
9420 notify(state, false);
9421 }
9422 } catch (error) {
9423 internalReject({ done: false }, error, state);
9424 }
9425};
9426
9427// constructor polyfill
9428if (FORCED_PROMISE_CONSTRUCTOR) {
9429 // 25.4.3.1 Promise(executor)
9430 PromiseConstructor = function Promise(executor) {
9431 anInstance(this, PromisePrototype);
9432 aCallable(executor);
9433 call(Internal, this);
9434 var state = getInternalPromiseState(this);
9435 try {
9436 executor(bind(internalResolve, state), bind(internalReject, state));
9437 } catch (error) {
9438 internalReject(state, error);
9439 }
9440 };
9441
9442 PromisePrototype = PromiseConstructor.prototype;
9443
9444 // eslint-disable-next-line no-unused-vars -- required for `.length`
9445 Internal = function Promise(executor) {
9446 setInternalState(this, {
9447 type: PROMISE,
9448 done: false,
9449 notified: false,
9450 parent: false,
9451 reactions: new Queue(),
9452 rejection: false,
9453 state: PENDING,
9454 value: undefined
9455 });
9456 };
9457
9458 // `Promise.prototype.then` method
9459 // https://tc39.es/ecma262/#sec-promise.prototype.then
9460 Internal.prototype = defineBuiltIn(PromisePrototype, 'then', function then(onFulfilled, onRejected) {
9461 var state = getInternalPromiseState(this);
9462 var reaction = newPromiseCapability(speciesConstructor(this, PromiseConstructor));
9463 state.parent = true;
9464 reaction.ok = isCallable(onFulfilled) ? onFulfilled : true;
9465 reaction.fail = isCallable(onRejected) && onRejected;
9466 reaction.domain = IS_NODE ? process.domain : undefined;
9467 if (state.state == PENDING) state.reactions.add(reaction);
9468 else microtask(function () {
9469 callReaction(reaction, state);
9470 });
9471 return reaction.promise;
9472 });
9473
9474 OwnPromiseCapability = function () {
9475 var promise = new Internal();
9476 var state = getInternalPromiseState(promise);
9477 this.promise = promise;
9478 this.resolve = bind(internalResolve, state);
9479 this.reject = bind(internalReject, state);
9480 };
9481
9482 newPromiseCapabilityModule.f = newPromiseCapability = function (C) {
9483 return C === PromiseConstructor || C === PromiseWrapper
9484 ? new OwnPromiseCapability(C)
9485 : newGenericPromiseCapability(C);
9486 };
9487
9488 if (!IS_PURE && isCallable(NativePromiseConstructor) && NativePromisePrototype !== Object.prototype) {
9489 nativeThen = NativePromisePrototype.then;
9490
9491 if (!NATIVE_PROMISE_SUBCLASSING) {
9492 // make `Promise#then` return a polyfilled `Promise` for native promise-based APIs
9493 defineBuiltIn(NativePromisePrototype, 'then', function then(onFulfilled, onRejected) {
9494 var that = this;
9495 return new PromiseConstructor(function (resolve, reject) {
9496 call(nativeThen, that, resolve, reject);
9497 }).then(onFulfilled, onRejected);
9498 // https://github.com/zloirock/core-js/issues/640
9499 }, { unsafe: true });
9500 }
9501
9502 // make `.constructor === Promise` work for native promise-based APIs
9503 try {
9504 delete NativePromisePrototype.constructor;
9505 } catch (error) { /* empty */ }
9506
9507 // make `instanceof Promise` work for native promise-based APIs
9508 if (setPrototypeOf) {
9509 setPrototypeOf(NativePromisePrototype, PromisePrototype);
9510 }
9511 }
9512}
9513
9514$({ global: true, constructor: true, wrap: true, forced: FORCED_PROMISE_CONSTRUCTOR }, {
9515 Promise: PromiseConstructor
9516});
9517
9518setToStringTag(PromiseConstructor, PROMISE, false, true);
9519setSpecies(PROMISE);
9520
9521
9522/***/ }),
9523/* 304 */
9524/***/ (function(module, exports) {
9525
9526var $TypeError = TypeError;
9527
9528module.exports = function (passed, required) {
9529 if (passed < required) throw $TypeError('Not enough arguments');
9530 return passed;
9531};
9532
9533
9534/***/ }),
9535/* 305 */
9536/***/ (function(module, exports, __webpack_require__) {
9537
9538var global = __webpack_require__(8);
9539var bind = __webpack_require__(52);
9540var getOwnPropertyDescriptor = __webpack_require__(64).f;
9541var macrotask = __webpack_require__(174).set;
9542var IS_IOS = __webpack_require__(175);
9543var IS_IOS_PEBBLE = __webpack_require__(306);
9544var IS_WEBOS_WEBKIT = __webpack_require__(307);
9545var IS_NODE = __webpack_require__(109);
9546
9547var MutationObserver = global.MutationObserver || global.WebKitMutationObserver;
9548var document = global.document;
9549var process = global.process;
9550var Promise = global.Promise;
9551// Node.js 11 shows ExperimentalWarning on getting `queueMicrotask`
9552var queueMicrotaskDescriptor = getOwnPropertyDescriptor(global, 'queueMicrotask');
9553var queueMicrotask = queueMicrotaskDescriptor && queueMicrotaskDescriptor.value;
9554
9555var flush, head, last, notify, toggle, node, promise, then;
9556
9557// modern engines have queueMicrotask method
9558if (!queueMicrotask) {
9559 flush = function () {
9560 var parent, fn;
9561 if (IS_NODE && (parent = process.domain)) parent.exit();
9562 while (head) {
9563 fn = head.fn;
9564 head = head.next;
9565 try {
9566 fn();
9567 } catch (error) {
9568 if (head) notify();
9569 else last = undefined;
9570 throw error;
9571 }
9572 } last = undefined;
9573 if (parent) parent.enter();
9574 };
9575
9576 // browsers with MutationObserver, except iOS - https://github.com/zloirock/core-js/issues/339
9577 // also except WebOS Webkit https://github.com/zloirock/core-js/issues/898
9578 if (!IS_IOS && !IS_NODE && !IS_WEBOS_WEBKIT && MutationObserver && document) {
9579 toggle = true;
9580 node = document.createTextNode('');
9581 new MutationObserver(flush).observe(node, { characterData: true });
9582 notify = function () {
9583 node.data = toggle = !toggle;
9584 };
9585 // environments with maybe non-completely correct, but existent Promise
9586 } else if (!IS_IOS_PEBBLE && Promise && Promise.resolve) {
9587 // Promise.resolve without an argument throws an error in LG WebOS 2
9588 promise = Promise.resolve(undefined);
9589 // workaround of WebKit ~ iOS Safari 10.1 bug
9590 promise.constructor = Promise;
9591 then = bind(promise.then, promise);
9592 notify = function () {
9593 then(flush);
9594 };
9595 // Node.js without promises
9596 } else if (IS_NODE) {
9597 notify = function () {
9598 process.nextTick(flush);
9599 };
9600 // for other environments - macrotask based on:
9601 // - setImmediate
9602 // - MessageChannel
9603 // - window.postMessage
9604 // - onreadystatechange
9605 // - setTimeout
9606 } else {
9607 // strange IE + webpack dev server bug - use .bind(global)
9608 macrotask = bind(macrotask, global);
9609 notify = function () {
9610 macrotask(flush);
9611 };
9612 }
9613}
9614
9615module.exports = queueMicrotask || function (fn) {
9616 var task = { fn: fn, next: undefined };
9617 if (last) last.next = task;
9618 if (!head) {
9619 head = task;
9620 notify();
9621 } last = task;
9622};
9623
9624
9625/***/ }),
9626/* 306 */
9627/***/ (function(module, exports, __webpack_require__) {
9628
9629var userAgent = __webpack_require__(51);
9630var global = __webpack_require__(8);
9631
9632module.exports = /ipad|iphone|ipod/i.test(userAgent) && global.Pebble !== undefined;
9633
9634
9635/***/ }),
9636/* 307 */
9637/***/ (function(module, exports, __webpack_require__) {
9638
9639var userAgent = __webpack_require__(51);
9640
9641module.exports = /web0s(?!.*chrome)/i.test(userAgent);
9642
9643
9644/***/ }),
9645/* 308 */
9646/***/ (function(module, exports, __webpack_require__) {
9647
9648var global = __webpack_require__(8);
9649
9650module.exports = function (a, b) {
9651 var console = global.console;
9652 if (console && console.error) {
9653 arguments.length == 1 ? console.error(a) : console.error(a, b);
9654 }
9655};
9656
9657
9658/***/ }),
9659/* 309 */
9660/***/ (function(module, exports) {
9661
9662var Queue = function () {
9663 this.head = null;
9664 this.tail = null;
9665};
9666
9667Queue.prototype = {
9668 add: function (item) {
9669 var entry = { item: item, next: null };
9670 if (this.head) this.tail.next = entry;
9671 else this.head = entry;
9672 this.tail = entry;
9673 },
9674 get: function () {
9675 var entry = this.head;
9676 if (entry) {
9677 this.head = entry.next;
9678 if (this.tail === entry) this.tail = null;
9679 return entry.item;
9680 }
9681 }
9682};
9683
9684module.exports = Queue;
9685
9686
9687/***/ }),
9688/* 310 */
9689/***/ (function(module, exports) {
9690
9691module.exports = typeof window == 'object' && typeof Deno != 'object';
9692
9693
9694/***/ }),
9695/* 311 */
9696/***/ (function(module, exports, __webpack_require__) {
9697
9698"use strict";
9699
9700var $ = __webpack_require__(0);
9701var call = __webpack_require__(15);
9702var aCallable = __webpack_require__(29);
9703var newPromiseCapabilityModule = __webpack_require__(57);
9704var perform = __webpack_require__(84);
9705var iterate = __webpack_require__(41);
9706var PROMISE_STATICS_INCORRECT_ITERATION = __webpack_require__(176);
9707
9708// `Promise.all` method
9709// https://tc39.es/ecma262/#sec-promise.all
9710$({ target: 'Promise', stat: true, forced: PROMISE_STATICS_INCORRECT_ITERATION }, {
9711 all: function all(iterable) {
9712 var C = this;
9713 var capability = newPromiseCapabilityModule.f(C);
9714 var resolve = capability.resolve;
9715 var reject = capability.reject;
9716 var result = perform(function () {
9717 var $promiseResolve = aCallable(C.resolve);
9718 var values = [];
9719 var counter = 0;
9720 var remaining = 1;
9721 iterate(iterable, function (promise) {
9722 var index = counter++;
9723 var alreadyCalled = false;
9724 remaining++;
9725 call($promiseResolve, C, promise).then(function (value) {
9726 if (alreadyCalled) return;
9727 alreadyCalled = true;
9728 values[index] = value;
9729 --remaining || resolve(values);
9730 }, reject);
9731 });
9732 --remaining || resolve(values);
9733 });
9734 if (result.error) reject(result.value);
9735 return capability.promise;
9736 }
9737});
9738
9739
9740/***/ }),
9741/* 312 */
9742/***/ (function(module, exports, __webpack_require__) {
9743
9744"use strict";
9745
9746var $ = __webpack_require__(0);
9747var IS_PURE = __webpack_require__(36);
9748var FORCED_PROMISE_CONSTRUCTOR = __webpack_require__(85).CONSTRUCTOR;
9749var NativePromiseConstructor = __webpack_require__(69);
9750var getBuiltIn = __webpack_require__(20);
9751var isCallable = __webpack_require__(9);
9752var defineBuiltIn = __webpack_require__(45);
9753
9754var NativePromisePrototype = NativePromiseConstructor && NativePromiseConstructor.prototype;
9755
9756// `Promise.prototype.catch` method
9757// https://tc39.es/ecma262/#sec-promise.prototype.catch
9758$({ target: 'Promise', proto: true, forced: FORCED_PROMISE_CONSTRUCTOR, real: true }, {
9759 'catch': function (onRejected) {
9760 return this.then(undefined, onRejected);
9761 }
9762});
9763
9764// makes sure that native promise-based APIs `Promise#catch` properly works with patched `Promise#then`
9765if (!IS_PURE && isCallable(NativePromiseConstructor)) {
9766 var method = getBuiltIn('Promise').prototype['catch'];
9767 if (NativePromisePrototype['catch'] !== method) {
9768 defineBuiltIn(NativePromisePrototype, 'catch', method, { unsafe: true });
9769 }
9770}
9771
9772
9773/***/ }),
9774/* 313 */
9775/***/ (function(module, exports, __webpack_require__) {
9776
9777"use strict";
9778
9779var $ = __webpack_require__(0);
9780var call = __webpack_require__(15);
9781var aCallable = __webpack_require__(29);
9782var newPromiseCapabilityModule = __webpack_require__(57);
9783var perform = __webpack_require__(84);
9784var iterate = __webpack_require__(41);
9785var PROMISE_STATICS_INCORRECT_ITERATION = __webpack_require__(176);
9786
9787// `Promise.race` method
9788// https://tc39.es/ecma262/#sec-promise.race
9789$({ target: 'Promise', stat: true, forced: PROMISE_STATICS_INCORRECT_ITERATION }, {
9790 race: function race(iterable) {
9791 var C = this;
9792 var capability = newPromiseCapabilityModule.f(C);
9793 var reject = capability.reject;
9794 var result = perform(function () {
9795 var $promiseResolve = aCallable(C.resolve);
9796 iterate(iterable, function (promise) {
9797 call($promiseResolve, C, promise).then(capability.resolve, reject);
9798 });
9799 });
9800 if (result.error) reject(result.value);
9801 return capability.promise;
9802 }
9803});
9804
9805
9806/***/ }),
9807/* 314 */
9808/***/ (function(module, exports, __webpack_require__) {
9809
9810"use strict";
9811
9812var $ = __webpack_require__(0);
9813var call = __webpack_require__(15);
9814var newPromiseCapabilityModule = __webpack_require__(57);
9815var FORCED_PROMISE_CONSTRUCTOR = __webpack_require__(85).CONSTRUCTOR;
9816
9817// `Promise.reject` method
9818// https://tc39.es/ecma262/#sec-promise.reject
9819$({ target: 'Promise', stat: true, forced: FORCED_PROMISE_CONSTRUCTOR }, {
9820 reject: function reject(r) {
9821 var capability = newPromiseCapabilityModule.f(this);
9822 call(capability.reject, undefined, r);
9823 return capability.promise;
9824 }
9825});
9826
9827
9828/***/ }),
9829/* 315 */
9830/***/ (function(module, exports, __webpack_require__) {
9831
9832"use strict";
9833
9834var $ = __webpack_require__(0);
9835var getBuiltIn = __webpack_require__(20);
9836var IS_PURE = __webpack_require__(36);
9837var NativePromiseConstructor = __webpack_require__(69);
9838var FORCED_PROMISE_CONSTRUCTOR = __webpack_require__(85).CONSTRUCTOR;
9839var promiseResolve = __webpack_require__(178);
9840
9841var PromiseConstructorWrapper = getBuiltIn('Promise');
9842var CHECK_WRAPPER = IS_PURE && !FORCED_PROMISE_CONSTRUCTOR;
9843
9844// `Promise.resolve` method
9845// https://tc39.es/ecma262/#sec-promise.resolve
9846$({ target: 'Promise', stat: true, forced: IS_PURE || FORCED_PROMISE_CONSTRUCTOR }, {
9847 resolve: function resolve(x) {
9848 return promiseResolve(CHECK_WRAPPER && this === PromiseConstructorWrapper ? NativePromiseConstructor : this, x);
9849 }
9850});
9851
9852
9853/***/ }),
9854/* 316 */
9855/***/ (function(module, exports, __webpack_require__) {
9856
9857"use strict";
9858
9859var $ = __webpack_require__(0);
9860var call = __webpack_require__(15);
9861var aCallable = __webpack_require__(29);
9862var newPromiseCapabilityModule = __webpack_require__(57);
9863var perform = __webpack_require__(84);
9864var iterate = __webpack_require__(41);
9865
9866// `Promise.allSettled` method
9867// https://tc39.es/ecma262/#sec-promise.allsettled
9868$({ target: 'Promise', stat: true }, {
9869 allSettled: function allSettled(iterable) {
9870 var C = this;
9871 var capability = newPromiseCapabilityModule.f(C);
9872 var resolve = capability.resolve;
9873 var reject = capability.reject;
9874 var result = perform(function () {
9875 var promiseResolve = aCallable(C.resolve);
9876 var values = [];
9877 var counter = 0;
9878 var remaining = 1;
9879 iterate(iterable, function (promise) {
9880 var index = counter++;
9881 var alreadyCalled = false;
9882 remaining++;
9883 call(promiseResolve, C, promise).then(function (value) {
9884 if (alreadyCalled) return;
9885 alreadyCalled = true;
9886 values[index] = { status: 'fulfilled', value: value };
9887 --remaining || resolve(values);
9888 }, function (error) {
9889 if (alreadyCalled) return;
9890 alreadyCalled = true;
9891 values[index] = { status: 'rejected', reason: error };
9892 --remaining || resolve(values);
9893 });
9894 });
9895 --remaining || resolve(values);
9896 });
9897 if (result.error) reject(result.value);
9898 return capability.promise;
9899 }
9900});
9901
9902
9903/***/ }),
9904/* 317 */
9905/***/ (function(module, exports, __webpack_require__) {
9906
9907"use strict";
9908
9909var $ = __webpack_require__(0);
9910var call = __webpack_require__(15);
9911var aCallable = __webpack_require__(29);
9912var getBuiltIn = __webpack_require__(20);
9913var newPromiseCapabilityModule = __webpack_require__(57);
9914var perform = __webpack_require__(84);
9915var iterate = __webpack_require__(41);
9916
9917var PROMISE_ANY_ERROR = 'No one promise resolved';
9918
9919// `Promise.any` method
9920// https://tc39.es/ecma262/#sec-promise.any
9921$({ target: 'Promise', stat: true }, {
9922 any: function any(iterable) {
9923 var C = this;
9924 var AggregateError = getBuiltIn('AggregateError');
9925 var capability = newPromiseCapabilityModule.f(C);
9926 var resolve = capability.resolve;
9927 var reject = capability.reject;
9928 var result = perform(function () {
9929 var promiseResolve = aCallable(C.resolve);
9930 var errors = [];
9931 var counter = 0;
9932 var remaining = 1;
9933 var alreadyResolved = false;
9934 iterate(iterable, function (promise) {
9935 var index = counter++;
9936 var alreadyRejected = false;
9937 remaining++;
9938 call(promiseResolve, C, promise).then(function (value) {
9939 if (alreadyRejected || alreadyResolved) return;
9940 alreadyResolved = true;
9941 resolve(value);
9942 }, function (error) {
9943 if (alreadyRejected || alreadyResolved) return;
9944 alreadyRejected = true;
9945 errors[index] = error;
9946 --remaining || reject(new AggregateError(errors, PROMISE_ANY_ERROR));
9947 });
9948 });
9949 --remaining || reject(new AggregateError(errors, PROMISE_ANY_ERROR));
9950 });
9951 if (result.error) reject(result.value);
9952 return capability.promise;
9953 }
9954});
9955
9956
9957/***/ }),
9958/* 318 */
9959/***/ (function(module, exports, __webpack_require__) {
9960
9961"use strict";
9962
9963var $ = __webpack_require__(0);
9964var IS_PURE = __webpack_require__(36);
9965var NativePromiseConstructor = __webpack_require__(69);
9966var fails = __webpack_require__(2);
9967var getBuiltIn = __webpack_require__(20);
9968var isCallable = __webpack_require__(9);
9969var speciesConstructor = __webpack_require__(172);
9970var promiseResolve = __webpack_require__(178);
9971var defineBuiltIn = __webpack_require__(45);
9972
9973var NativePromisePrototype = NativePromiseConstructor && NativePromiseConstructor.prototype;
9974
9975// Safari bug https://bugs.webkit.org/show_bug.cgi?id=200829
9976var NON_GENERIC = !!NativePromiseConstructor && fails(function () {
9977 // eslint-disable-next-line unicorn/no-thenable -- required for testing
9978 NativePromisePrototype['finally'].call({ then: function () { /* empty */ } }, function () { /* empty */ });
9979});
9980
9981// `Promise.prototype.finally` method
9982// https://tc39.es/ecma262/#sec-promise.prototype.finally
9983$({ target: 'Promise', proto: true, real: true, forced: NON_GENERIC }, {
9984 'finally': function (onFinally) {
9985 var C = speciesConstructor(this, getBuiltIn('Promise'));
9986 var isFunction = isCallable(onFinally);
9987 return this.then(
9988 isFunction ? function (x) {
9989 return promiseResolve(C, onFinally()).then(function () { return x; });
9990 } : onFinally,
9991 isFunction ? function (e) {
9992 return promiseResolve(C, onFinally()).then(function () { throw e; });
9993 } : onFinally
9994 );
9995 }
9996});
9997
9998// makes sure that native promise-based APIs `Promise#finally` properly works with patched `Promise#then`
9999if (!IS_PURE && isCallable(NativePromiseConstructor)) {
10000 var method = getBuiltIn('Promise').prototype['finally'];
10001 if (NativePromisePrototype['finally'] !== method) {
10002 defineBuiltIn(NativePromisePrototype, 'finally', method, { unsafe: true });
10003 }
10004}
10005
10006
10007/***/ }),
10008/* 319 */
10009/***/ (function(module, exports, __webpack_require__) {
10010
10011var uncurryThis = __webpack_require__(4);
10012var toIntegerOrInfinity = __webpack_require__(127);
10013var toString = __webpack_require__(42);
10014var requireObjectCoercible = __webpack_require__(81);
10015
10016var charAt = uncurryThis(''.charAt);
10017var charCodeAt = uncurryThis(''.charCodeAt);
10018var stringSlice = uncurryThis(''.slice);
10019
10020var createMethod = function (CONVERT_TO_STRING) {
10021 return function ($this, pos) {
10022 var S = toString(requireObjectCoercible($this));
10023 var position = toIntegerOrInfinity(pos);
10024 var size = S.length;
10025 var first, second;
10026 if (position < 0 || position >= size) return CONVERT_TO_STRING ? '' : undefined;
10027 first = charCodeAt(S, position);
10028 return first < 0xD800 || first > 0xDBFF || position + 1 === size
10029 || (second = charCodeAt(S, position + 1)) < 0xDC00 || second > 0xDFFF
10030 ? CONVERT_TO_STRING
10031 ? charAt(S, position)
10032 : first
10033 : CONVERT_TO_STRING
10034 ? stringSlice(S, position, position + 2)
10035 : (first - 0xD800 << 10) + (second - 0xDC00) + 0x10000;
10036 };
10037};
10038
10039module.exports = {
10040 // `String.prototype.codePointAt` method
10041 // https://tc39.es/ecma262/#sec-string.prototype.codepointat
10042 codeAt: createMethod(false),
10043 // `String.prototype.at` method
10044 // https://github.com/mathiasbynens/String.prototype.at
10045 charAt: createMethod(true)
10046};
10047
10048
10049/***/ }),
10050/* 320 */
10051/***/ (function(module, exports) {
10052
10053// iterable DOM collections
10054// flag - `iterable` interface - 'entries', 'keys', 'values', 'forEach' methods
10055module.exports = {
10056 CSSRuleList: 0,
10057 CSSStyleDeclaration: 0,
10058 CSSValueList: 0,
10059 ClientRectList: 0,
10060 DOMRectList: 0,
10061 DOMStringList: 0,
10062 DOMTokenList: 1,
10063 DataTransferItemList: 0,
10064 FileList: 0,
10065 HTMLAllCollection: 0,
10066 HTMLCollection: 0,
10067 HTMLFormElement: 0,
10068 HTMLSelectElement: 0,
10069 MediaList: 0,
10070 MimeTypeArray: 0,
10071 NamedNodeMap: 0,
10072 NodeList: 1,
10073 PaintRequestList: 0,
10074 Plugin: 0,
10075 PluginArray: 0,
10076 SVGLengthList: 0,
10077 SVGNumberList: 0,
10078 SVGPathSegList: 0,
10079 SVGPointList: 0,
10080 SVGStringList: 0,
10081 SVGTransformList: 0,
10082 SourceBufferList: 0,
10083 StyleSheetList: 0,
10084 TextTrackCueList: 0,
10085 TextTrackList: 0,
10086 TouchList: 0
10087};
10088
10089
10090/***/ }),
10091/* 321 */
10092/***/ (function(module, __webpack_exports__, __webpack_require__) {
10093
10094"use strict";
10095/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__index_js__ = __webpack_require__(134);
10096// Default Export
10097// ==============
10098// In this module, we mix our bundled exports into the `_` object and export
10099// the result. This is analogous to setting `module.exports = _` in CommonJS.
10100// Hence, this module is also the entry point of our UMD bundle and the package
10101// entry point for CommonJS and AMD users. In other words, this is (the source
10102// of) the module you are interfacing with when you do any of the following:
10103//
10104// ```js
10105// // CommonJS
10106// var _ = require('underscore');
10107//
10108// // AMD
10109// define(['underscore'], function(_) {...});
10110//
10111// // UMD in the browser
10112// // _ is available as a global variable
10113// ```
10114
10115
10116
10117// Add all of the Underscore functions to the wrapper object.
10118var _ = Object(__WEBPACK_IMPORTED_MODULE_0__index_js__["mixin"])(__WEBPACK_IMPORTED_MODULE_0__index_js__);
10119// Legacy Node.js API.
10120_._ = _;
10121// Export the Underscore API.
10122/* harmony default export */ __webpack_exports__["a"] = (_);
10123
10124
10125/***/ }),
10126/* 322 */
10127/***/ (function(module, __webpack_exports__, __webpack_require__) {
10128
10129"use strict";
10130/* harmony export (immutable) */ __webpack_exports__["a"] = isNull;
10131// Is a given value equal to null?
10132function isNull(obj) {
10133 return obj === null;
10134}
10135
10136
10137/***/ }),
10138/* 323 */
10139/***/ (function(module, __webpack_exports__, __webpack_require__) {
10140
10141"use strict";
10142/* harmony export (immutable) */ __webpack_exports__["a"] = isElement;
10143// Is a given value a DOM element?
10144function isElement(obj) {
10145 return !!(obj && obj.nodeType === 1);
10146}
10147
10148
10149/***/ }),
10150/* 324 */
10151/***/ (function(module, __webpack_exports__, __webpack_require__) {
10152
10153"use strict";
10154/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(18);
10155
10156
10157/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('Date'));
10158
10159
10160/***/ }),
10161/* 325 */
10162/***/ (function(module, __webpack_exports__, __webpack_require__) {
10163
10164"use strict";
10165/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(18);
10166
10167
10168/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('RegExp'));
10169
10170
10171/***/ }),
10172/* 326 */
10173/***/ (function(module, __webpack_exports__, __webpack_require__) {
10174
10175"use strict";
10176/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(18);
10177
10178
10179/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('Error'));
10180
10181
10182/***/ }),
10183/* 327 */
10184/***/ (function(module, __webpack_exports__, __webpack_require__) {
10185
10186"use strict";
10187/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(18);
10188
10189
10190/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('Object'));
10191
10192
10193/***/ }),
10194/* 328 */
10195/***/ (function(module, __webpack_exports__, __webpack_require__) {
10196
10197"use strict";
10198/* harmony export (immutable) */ __webpack_exports__["a"] = isFinite;
10199/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(6);
10200/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isSymbol_js__ = __webpack_require__(182);
10201
10202
10203
10204// Is a given object a finite number?
10205function isFinite(obj) {
10206 return !Object(__WEBPACK_IMPORTED_MODULE_1__isSymbol_js__["a" /* default */])(obj) && Object(__WEBPACK_IMPORTED_MODULE_0__setup_js__["f" /* _isFinite */])(obj) && !isNaN(parseFloat(obj));
10207}
10208
10209
10210/***/ }),
10211/* 329 */
10212/***/ (function(module, __webpack_exports__, __webpack_require__) {
10213
10214"use strict";
10215/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createSizePropertyCheck_js__ = __webpack_require__(187);
10216/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__getByteLength_js__ = __webpack_require__(138);
10217
10218
10219
10220// Internal helper to determine whether we should spend extensive checks against
10221// `ArrayBuffer` et al.
10222/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createSizePropertyCheck_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__getByteLength_js__["a" /* default */]));
10223
10224
10225/***/ }),
10226/* 330 */
10227/***/ (function(module, __webpack_exports__, __webpack_require__) {
10228
10229"use strict";
10230/* harmony export (immutable) */ __webpack_exports__["a"] = isEmpty;
10231/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__getLength_js__ = __webpack_require__(31);
10232/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isArray_js__ = __webpack_require__(59);
10233/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__isString_js__ = __webpack_require__(135);
10234/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__isArguments_js__ = __webpack_require__(137);
10235/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__keys_js__ = __webpack_require__(17);
10236
10237
10238
10239
10240
10241
10242// Is a given array, string, or object empty?
10243// An "empty" object has no enumerable own-properties.
10244function isEmpty(obj) {
10245 if (obj == null) return true;
10246 // Skip the more expensive `toString`-based type checks if `obj` has no
10247 // `.length`.
10248 var length = Object(__WEBPACK_IMPORTED_MODULE_0__getLength_js__["a" /* default */])(obj);
10249 if (typeof length == 'number' && (
10250 Object(__WEBPACK_IMPORTED_MODULE_1__isArray_js__["a" /* default */])(obj) || Object(__WEBPACK_IMPORTED_MODULE_2__isString_js__["a" /* default */])(obj) || Object(__WEBPACK_IMPORTED_MODULE_3__isArguments_js__["a" /* default */])(obj)
10251 )) return length === 0;
10252 return Object(__WEBPACK_IMPORTED_MODULE_0__getLength_js__["a" /* default */])(Object(__WEBPACK_IMPORTED_MODULE_4__keys_js__["a" /* default */])(obj)) === 0;
10253}
10254
10255
10256/***/ }),
10257/* 331 */
10258/***/ (function(module, __webpack_exports__, __webpack_require__) {
10259
10260"use strict";
10261/* harmony export (immutable) */ __webpack_exports__["a"] = isEqual;
10262/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__underscore_js__ = __webpack_require__(25);
10263/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__setup_js__ = __webpack_require__(6);
10264/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__getByteLength_js__ = __webpack_require__(138);
10265/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__isTypedArray_js__ = __webpack_require__(185);
10266/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__isFunction_js__ = __webpack_require__(30);
10267/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__stringTagBug_js__ = __webpack_require__(86);
10268/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__isDataView_js__ = __webpack_require__(136);
10269/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__keys_js__ = __webpack_require__(17);
10270/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__has_js__ = __webpack_require__(47);
10271/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__toBufferView_js__ = __webpack_require__(332);
10272
10273
10274
10275
10276
10277
10278
10279
10280
10281
10282
10283// We use this string twice, so give it a name for minification.
10284var tagDataView = '[object DataView]';
10285
10286// Internal recursive comparison function for `_.isEqual`.
10287function eq(a, b, aStack, bStack) {
10288 // Identical objects are equal. `0 === -0`, but they aren't identical.
10289 // See the [Harmony `egal` proposal](https://wiki.ecmascript.org/doku.php?id=harmony:egal).
10290 if (a === b) return a !== 0 || 1 / a === 1 / b;
10291 // `null` or `undefined` only equal to itself (strict comparison).
10292 if (a == null || b == null) return false;
10293 // `NaN`s are equivalent, but non-reflexive.
10294 if (a !== a) return b !== b;
10295 // Exhaust primitive checks
10296 var type = typeof a;
10297 if (type !== 'function' && type !== 'object' && typeof b != 'object') return false;
10298 return deepEq(a, b, aStack, bStack);
10299}
10300
10301// Internal recursive comparison function for `_.isEqual`.
10302function deepEq(a, b, aStack, bStack) {
10303 // Unwrap any wrapped objects.
10304 if (a instanceof __WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */]) a = a._wrapped;
10305 if (b instanceof __WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */]) b = b._wrapped;
10306 // Compare `[[Class]]` names.
10307 var className = __WEBPACK_IMPORTED_MODULE_1__setup_js__["t" /* toString */].call(a);
10308 if (className !== __WEBPACK_IMPORTED_MODULE_1__setup_js__["t" /* toString */].call(b)) return false;
10309 // Work around a bug in IE 10 - Edge 13.
10310 if (__WEBPACK_IMPORTED_MODULE_5__stringTagBug_js__["a" /* hasStringTagBug */] && className == '[object Object]' && Object(__WEBPACK_IMPORTED_MODULE_6__isDataView_js__["a" /* default */])(a)) {
10311 if (!Object(__WEBPACK_IMPORTED_MODULE_6__isDataView_js__["a" /* default */])(b)) return false;
10312 className = tagDataView;
10313 }
10314 switch (className) {
10315 // These types are compared by value.
10316 case '[object RegExp]':
10317 // RegExps are coerced to strings for comparison (Note: '' + /a/i === '/a/i')
10318 case '[object String]':
10319 // Primitives and their corresponding object wrappers are equivalent; thus, `"5"` is
10320 // equivalent to `new String("5")`.
10321 return '' + a === '' + b;
10322 case '[object Number]':
10323 // `NaN`s are equivalent, but non-reflexive.
10324 // Object(NaN) is equivalent to NaN.
10325 if (+a !== +a) return +b !== +b;
10326 // An `egal` comparison is performed for other numeric values.
10327 return +a === 0 ? 1 / +a === 1 / b : +a === +b;
10328 case '[object Date]':
10329 case '[object Boolean]':
10330 // Coerce dates and booleans to numeric primitive values. Dates are compared by their
10331 // millisecond representations. Note that invalid dates with millisecond representations
10332 // of `NaN` are not equivalent.
10333 return +a === +b;
10334 case '[object Symbol]':
10335 return __WEBPACK_IMPORTED_MODULE_1__setup_js__["d" /* SymbolProto */].valueOf.call(a) === __WEBPACK_IMPORTED_MODULE_1__setup_js__["d" /* SymbolProto */].valueOf.call(b);
10336 case '[object ArrayBuffer]':
10337 case tagDataView:
10338 // Coerce to typed array so we can fall through.
10339 return deepEq(Object(__WEBPACK_IMPORTED_MODULE_9__toBufferView_js__["a" /* default */])(a), Object(__WEBPACK_IMPORTED_MODULE_9__toBufferView_js__["a" /* default */])(b), aStack, bStack);
10340 }
10341
10342 var areArrays = className === '[object Array]';
10343 if (!areArrays && Object(__WEBPACK_IMPORTED_MODULE_3__isTypedArray_js__["a" /* default */])(a)) {
10344 var byteLength = Object(__WEBPACK_IMPORTED_MODULE_2__getByteLength_js__["a" /* default */])(a);
10345 if (byteLength !== Object(__WEBPACK_IMPORTED_MODULE_2__getByteLength_js__["a" /* default */])(b)) return false;
10346 if (a.buffer === b.buffer && a.byteOffset === b.byteOffset) return true;
10347 areArrays = true;
10348 }
10349 if (!areArrays) {
10350 if (typeof a != 'object' || typeof b != 'object') return false;
10351
10352 // Objects with different constructors are not equivalent, but `Object`s or `Array`s
10353 // from different frames are.
10354 var aCtor = a.constructor, bCtor = b.constructor;
10355 if (aCtor !== bCtor && !(Object(__WEBPACK_IMPORTED_MODULE_4__isFunction_js__["a" /* default */])(aCtor) && aCtor instanceof aCtor &&
10356 Object(__WEBPACK_IMPORTED_MODULE_4__isFunction_js__["a" /* default */])(bCtor) && bCtor instanceof bCtor)
10357 && ('constructor' in a && 'constructor' in b)) {
10358 return false;
10359 }
10360 }
10361 // Assume equality for cyclic structures. The algorithm for detecting cyclic
10362 // structures is adapted from ES 5.1 section 15.12.3, abstract operation `JO`.
10363
10364 // Initializing stack of traversed objects.
10365 // It's done here since we only need them for objects and arrays comparison.
10366 aStack = aStack || [];
10367 bStack = bStack || [];
10368 var length = aStack.length;
10369 while (length--) {
10370 // Linear search. Performance is inversely proportional to the number of
10371 // unique nested structures.
10372 if (aStack[length] === a) return bStack[length] === b;
10373 }
10374
10375 // Add the first object to the stack of traversed objects.
10376 aStack.push(a);
10377 bStack.push(b);
10378
10379 // Recursively compare objects and arrays.
10380 if (areArrays) {
10381 // Compare array lengths to determine if a deep comparison is necessary.
10382 length = a.length;
10383 if (length !== b.length) return false;
10384 // Deep compare the contents, ignoring non-numeric properties.
10385 while (length--) {
10386 if (!eq(a[length], b[length], aStack, bStack)) return false;
10387 }
10388 } else {
10389 // Deep compare objects.
10390 var _keys = Object(__WEBPACK_IMPORTED_MODULE_7__keys_js__["a" /* default */])(a), key;
10391 length = _keys.length;
10392 // Ensure that both objects contain the same number of properties before comparing deep equality.
10393 if (Object(__WEBPACK_IMPORTED_MODULE_7__keys_js__["a" /* default */])(b).length !== length) return false;
10394 while (length--) {
10395 // Deep compare each member
10396 key = _keys[length];
10397 if (!(Object(__WEBPACK_IMPORTED_MODULE_8__has_js__["a" /* default */])(b, key) && eq(a[key], b[key], aStack, bStack))) return false;
10398 }
10399 }
10400 // Remove the first object from the stack of traversed objects.
10401 aStack.pop();
10402 bStack.pop();
10403 return true;
10404}
10405
10406// Perform a deep comparison to check if two objects are equal.
10407function isEqual(a, b) {
10408 return eq(a, b);
10409}
10410
10411
10412/***/ }),
10413/* 332 */
10414/***/ (function(module, __webpack_exports__, __webpack_require__) {
10415
10416"use strict";
10417/* harmony export (immutable) */ __webpack_exports__["a"] = toBufferView;
10418/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__getByteLength_js__ = __webpack_require__(138);
10419
10420
10421// Internal function to wrap or shallow-copy an ArrayBuffer,
10422// typed array or DataView to a new view, reusing the buffer.
10423function toBufferView(bufferSource) {
10424 return new Uint8Array(
10425 bufferSource.buffer || bufferSource,
10426 bufferSource.byteOffset || 0,
10427 Object(__WEBPACK_IMPORTED_MODULE_0__getByteLength_js__["a" /* default */])(bufferSource)
10428 );
10429}
10430
10431
10432/***/ }),
10433/* 333 */
10434/***/ (function(module, __webpack_exports__, __webpack_require__) {
10435
10436"use strict";
10437/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(18);
10438/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__stringTagBug_js__ = __webpack_require__(86);
10439/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__methodFingerprint_js__ = __webpack_require__(139);
10440
10441
10442
10443
10444/* harmony default export */ __webpack_exports__["a"] = (__WEBPACK_IMPORTED_MODULE_1__stringTagBug_js__["b" /* isIE11 */] ? Object(__WEBPACK_IMPORTED_MODULE_2__methodFingerprint_js__["a" /* ie11fingerprint */])(__WEBPACK_IMPORTED_MODULE_2__methodFingerprint_js__["b" /* mapMethods */]) : Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('Map'));
10445
10446
10447/***/ }),
10448/* 334 */
10449/***/ (function(module, __webpack_exports__, __webpack_require__) {
10450
10451"use strict";
10452/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(18);
10453/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__stringTagBug_js__ = __webpack_require__(86);
10454/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__methodFingerprint_js__ = __webpack_require__(139);
10455
10456
10457
10458
10459/* harmony default export */ __webpack_exports__["a"] = (__WEBPACK_IMPORTED_MODULE_1__stringTagBug_js__["b" /* isIE11 */] ? Object(__WEBPACK_IMPORTED_MODULE_2__methodFingerprint_js__["a" /* ie11fingerprint */])(__WEBPACK_IMPORTED_MODULE_2__methodFingerprint_js__["d" /* weakMapMethods */]) : Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('WeakMap'));
10460
10461
10462/***/ }),
10463/* 335 */
10464/***/ (function(module, __webpack_exports__, __webpack_require__) {
10465
10466"use strict";
10467/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(18);
10468/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__stringTagBug_js__ = __webpack_require__(86);
10469/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__methodFingerprint_js__ = __webpack_require__(139);
10470
10471
10472
10473
10474/* harmony default export */ __webpack_exports__["a"] = (__WEBPACK_IMPORTED_MODULE_1__stringTagBug_js__["b" /* isIE11 */] ? Object(__WEBPACK_IMPORTED_MODULE_2__methodFingerprint_js__["a" /* ie11fingerprint */])(__WEBPACK_IMPORTED_MODULE_2__methodFingerprint_js__["c" /* setMethods */]) : Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('Set'));
10475
10476
10477/***/ }),
10478/* 336 */
10479/***/ (function(module, __webpack_exports__, __webpack_require__) {
10480
10481"use strict";
10482/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(18);
10483
10484
10485/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('WeakSet'));
10486
10487
10488/***/ }),
10489/* 337 */
10490/***/ (function(module, __webpack_exports__, __webpack_require__) {
10491
10492"use strict";
10493/* harmony export (immutable) */ __webpack_exports__["a"] = pairs;
10494/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__keys_js__ = __webpack_require__(17);
10495
10496
10497// Convert an object into a list of `[key, value]` pairs.
10498// The opposite of `_.object` with one argument.
10499function pairs(obj) {
10500 var _keys = Object(__WEBPACK_IMPORTED_MODULE_0__keys_js__["a" /* default */])(obj);
10501 var length = _keys.length;
10502 var pairs = Array(length);
10503 for (var i = 0; i < length; i++) {
10504 pairs[i] = [_keys[i], obj[_keys[i]]];
10505 }
10506 return pairs;
10507}
10508
10509
10510/***/ }),
10511/* 338 */
10512/***/ (function(module, __webpack_exports__, __webpack_require__) {
10513
10514"use strict";
10515/* harmony export (immutable) */ __webpack_exports__["a"] = create;
10516/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__baseCreate_js__ = __webpack_require__(195);
10517/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__extendOwn_js__ = __webpack_require__(141);
10518
10519
10520
10521// Creates an object that inherits from the given prototype object.
10522// If additional properties are provided then they will be added to the
10523// created object.
10524function create(prototype, props) {
10525 var result = Object(__WEBPACK_IMPORTED_MODULE_0__baseCreate_js__["a" /* default */])(prototype);
10526 if (props) Object(__WEBPACK_IMPORTED_MODULE_1__extendOwn_js__["a" /* default */])(result, props);
10527 return result;
10528}
10529
10530
10531/***/ }),
10532/* 339 */
10533/***/ (function(module, __webpack_exports__, __webpack_require__) {
10534
10535"use strict";
10536/* harmony export (immutable) */ __webpack_exports__["a"] = tap;
10537// Invokes `interceptor` with the `obj` and then returns `obj`.
10538// The primary purpose of this method is to "tap into" a method chain, in
10539// order to perform operations on intermediate results within the chain.
10540function tap(obj, interceptor) {
10541 interceptor(obj);
10542 return obj;
10543}
10544
10545
10546/***/ }),
10547/* 340 */
10548/***/ (function(module, __webpack_exports__, __webpack_require__) {
10549
10550"use strict";
10551/* harmony export (immutable) */ __webpack_exports__["a"] = has;
10552/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__has_js__ = __webpack_require__(47);
10553/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__toPath_js__ = __webpack_require__(88);
10554
10555
10556
10557// Shortcut function for checking if an object has a given property directly on
10558// itself (in other words, not on a prototype). Unlike the internal `has`
10559// function, this public version can also traverse nested properties.
10560function has(obj, path) {
10561 path = Object(__WEBPACK_IMPORTED_MODULE_1__toPath_js__["a" /* default */])(path);
10562 var length = path.length;
10563 for (var i = 0; i < length; i++) {
10564 var key = path[i];
10565 if (!Object(__WEBPACK_IMPORTED_MODULE_0__has_js__["a" /* default */])(obj, key)) return false;
10566 obj = obj[key];
10567 }
10568 return !!length;
10569}
10570
10571
10572/***/ }),
10573/* 341 */
10574/***/ (function(module, __webpack_exports__, __webpack_require__) {
10575
10576"use strict";
10577/* harmony export (immutable) */ __webpack_exports__["a"] = mapObject;
10578/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(22);
10579/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__keys_js__ = __webpack_require__(17);
10580
10581
10582
10583// Returns the results of applying the `iteratee` to each element of `obj`.
10584// In contrast to `_.map` it returns an object.
10585function mapObject(obj, iteratee, context) {
10586 iteratee = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(iteratee, context);
10587 var _keys = Object(__WEBPACK_IMPORTED_MODULE_1__keys_js__["a" /* default */])(obj),
10588 length = _keys.length,
10589 results = {};
10590 for (var index = 0; index < length; index++) {
10591 var currentKey = _keys[index];
10592 results[currentKey] = iteratee(obj[currentKey], currentKey, obj);
10593 }
10594 return results;
10595}
10596
10597
10598/***/ }),
10599/* 342 */
10600/***/ (function(module, __webpack_exports__, __webpack_require__) {
10601
10602"use strict";
10603/* harmony export (immutable) */ __webpack_exports__["a"] = propertyOf;
10604/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__noop_js__ = __webpack_require__(201);
10605/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__get_js__ = __webpack_require__(197);
10606
10607
10608
10609// Generates a function for a given object that returns a given property.
10610function propertyOf(obj) {
10611 if (obj == null) return __WEBPACK_IMPORTED_MODULE_0__noop_js__["a" /* default */];
10612 return function(path) {
10613 return Object(__WEBPACK_IMPORTED_MODULE_1__get_js__["a" /* default */])(obj, path);
10614 };
10615}
10616
10617
10618/***/ }),
10619/* 343 */
10620/***/ (function(module, __webpack_exports__, __webpack_require__) {
10621
10622"use strict";
10623/* harmony export (immutable) */ __webpack_exports__["a"] = times;
10624/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__optimizeCb_js__ = __webpack_require__(89);
10625
10626
10627// Run a function **n** times.
10628function times(n, iteratee, context) {
10629 var accum = Array(Math.max(0, n));
10630 iteratee = Object(__WEBPACK_IMPORTED_MODULE_0__optimizeCb_js__["a" /* default */])(iteratee, context, 1);
10631 for (var i = 0; i < n; i++) accum[i] = iteratee(i);
10632 return accum;
10633}
10634
10635
10636/***/ }),
10637/* 344 */
10638/***/ (function(module, __webpack_exports__, __webpack_require__) {
10639
10640"use strict";
10641/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createEscaper_js__ = __webpack_require__(203);
10642/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__escapeMap_js__ = __webpack_require__(204);
10643
10644
10645
10646// Function for escaping strings to HTML interpolation.
10647/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createEscaper_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__escapeMap_js__["a" /* default */]));
10648
10649
10650/***/ }),
10651/* 345 */
10652/***/ (function(module, __webpack_exports__, __webpack_require__) {
10653
10654"use strict";
10655/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createEscaper_js__ = __webpack_require__(203);
10656/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__unescapeMap_js__ = __webpack_require__(346);
10657
10658
10659
10660// Function for unescaping strings from HTML interpolation.
10661/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createEscaper_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__unescapeMap_js__["a" /* default */]));
10662
10663
10664/***/ }),
10665/* 346 */
10666/***/ (function(module, __webpack_exports__, __webpack_require__) {
10667
10668"use strict";
10669/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__invert_js__ = __webpack_require__(191);
10670/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__escapeMap_js__ = __webpack_require__(204);
10671
10672
10673
10674// Internal list of HTML entities for unescaping.
10675/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__invert_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__escapeMap_js__["a" /* default */]));
10676
10677
10678/***/ }),
10679/* 347 */
10680/***/ (function(module, __webpack_exports__, __webpack_require__) {
10681
10682"use strict";
10683/* harmony export (immutable) */ __webpack_exports__["a"] = template;
10684/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__defaults_js__ = __webpack_require__(194);
10685/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__underscore_js__ = __webpack_require__(25);
10686/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__templateSettings_js__ = __webpack_require__(205);
10687
10688
10689
10690
10691// When customizing `_.templateSettings`, if you don't want to define an
10692// interpolation, evaluation or escaping regex, we need one that is
10693// guaranteed not to match.
10694var noMatch = /(.)^/;
10695
10696// Certain characters need to be escaped so that they can be put into a
10697// string literal.
10698var escapes = {
10699 "'": "'",
10700 '\\': '\\',
10701 '\r': 'r',
10702 '\n': 'n',
10703 '\u2028': 'u2028',
10704 '\u2029': 'u2029'
10705};
10706
10707var escapeRegExp = /\\|'|\r|\n|\u2028|\u2029/g;
10708
10709function escapeChar(match) {
10710 return '\\' + escapes[match];
10711}
10712
10713var bareIdentifier = /^\s*(\w|\$)+\s*$/;
10714
10715// JavaScript micro-templating, similar to John Resig's implementation.
10716// Underscore templating handles arbitrary delimiters, preserves whitespace,
10717// and correctly escapes quotes within interpolated code.
10718// NB: `oldSettings` only exists for backwards compatibility.
10719function template(text, settings, oldSettings) {
10720 if (!settings && oldSettings) settings = oldSettings;
10721 settings = Object(__WEBPACK_IMPORTED_MODULE_0__defaults_js__["a" /* default */])({}, settings, __WEBPACK_IMPORTED_MODULE_1__underscore_js__["a" /* default */].templateSettings);
10722
10723 // Combine delimiters into one regular expression via alternation.
10724 var matcher = RegExp([
10725 (settings.escape || noMatch).source,
10726 (settings.interpolate || noMatch).source,
10727 (settings.evaluate || noMatch).source
10728 ].join('|') + '|$', 'g');
10729
10730 // Compile the template source, escaping string literals appropriately.
10731 var index = 0;
10732 var source = "__p+='";
10733 text.replace(matcher, function(match, escape, interpolate, evaluate, offset) {
10734 source += text.slice(index, offset).replace(escapeRegExp, escapeChar);
10735 index = offset + match.length;
10736
10737 if (escape) {
10738 source += "'+\n((__t=(" + escape + "))==null?'':_.escape(__t))+\n'";
10739 } else if (interpolate) {
10740 source += "'+\n((__t=(" + interpolate + "))==null?'':__t)+\n'";
10741 } else if (evaluate) {
10742 source += "';\n" + evaluate + "\n__p+='";
10743 }
10744
10745 // Adobe VMs need the match returned to produce the correct offset.
10746 return match;
10747 });
10748 source += "';\n";
10749
10750 var argument = settings.variable;
10751 if (argument) {
10752 if (!bareIdentifier.test(argument)) throw new Error(argument);
10753 } else {
10754 // If a variable is not specified, place data values in local scope.
10755 source = 'with(obj||{}){\n' + source + '}\n';
10756 argument = 'obj';
10757 }
10758
10759 source = "var __t,__p='',__j=Array.prototype.join," +
10760 "print=function(){__p+=__j.call(arguments,'');};\n" +
10761 source + 'return __p;\n';
10762
10763 var render;
10764 try {
10765 render = new Function(argument, '_', source);
10766 } catch (e) {
10767 e.source = source;
10768 throw e;
10769 }
10770
10771 var template = function(data) {
10772 return render.call(this, data, __WEBPACK_IMPORTED_MODULE_1__underscore_js__["a" /* default */]);
10773 };
10774
10775 // Provide the compiled source as a convenience for precompilation.
10776 template.source = 'function(' + argument + '){\n' + source + '}';
10777
10778 return template;
10779}
10780
10781
10782/***/ }),
10783/* 348 */
10784/***/ (function(module, __webpack_exports__, __webpack_require__) {
10785
10786"use strict";
10787/* harmony export (immutable) */ __webpack_exports__["a"] = result;
10788/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isFunction_js__ = __webpack_require__(30);
10789/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__toPath_js__ = __webpack_require__(88);
10790
10791
10792
10793// Traverses the children of `obj` along `path`. If a child is a function, it
10794// is invoked with its parent as context. Returns the value of the final
10795// child, or `fallback` if any child is undefined.
10796function result(obj, path, fallback) {
10797 path = Object(__WEBPACK_IMPORTED_MODULE_1__toPath_js__["a" /* default */])(path);
10798 var length = path.length;
10799 if (!length) {
10800 return Object(__WEBPACK_IMPORTED_MODULE_0__isFunction_js__["a" /* default */])(fallback) ? fallback.call(obj) : fallback;
10801 }
10802 for (var i = 0; i < length; i++) {
10803 var prop = obj == null ? void 0 : obj[path[i]];
10804 if (prop === void 0) {
10805 prop = fallback;
10806 i = length; // Ensure we don't continue iterating.
10807 }
10808 obj = Object(__WEBPACK_IMPORTED_MODULE_0__isFunction_js__["a" /* default */])(prop) ? prop.call(obj) : prop;
10809 }
10810 return obj;
10811}
10812
10813
10814/***/ }),
10815/* 349 */
10816/***/ (function(module, __webpack_exports__, __webpack_require__) {
10817
10818"use strict";
10819/* harmony export (immutable) */ __webpack_exports__["a"] = uniqueId;
10820// Generate a unique integer id (unique within the entire client session).
10821// Useful for temporary DOM ids.
10822var idCounter = 0;
10823function uniqueId(prefix) {
10824 var id = ++idCounter + '';
10825 return prefix ? prefix + id : id;
10826}
10827
10828
10829/***/ }),
10830/* 350 */
10831/***/ (function(module, __webpack_exports__, __webpack_require__) {
10832
10833"use strict";
10834/* harmony export (immutable) */ __webpack_exports__["a"] = chain;
10835/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__underscore_js__ = __webpack_require__(25);
10836
10837
10838// Start chaining a wrapped Underscore object.
10839function chain(obj) {
10840 var instance = Object(__WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */])(obj);
10841 instance._chain = true;
10842 return instance;
10843}
10844
10845
10846/***/ }),
10847/* 351 */
10848/***/ (function(module, __webpack_exports__, __webpack_require__) {
10849
10850"use strict";
10851/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(24);
10852/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__flatten_js__ = __webpack_require__(72);
10853/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__bind_js__ = __webpack_require__(207);
10854
10855
10856
10857
10858// Bind a number of an object's methods to that object. Remaining arguments
10859// are the method names to be bound. Useful for ensuring that all callbacks
10860// defined on an object belong to it.
10861/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(obj, keys) {
10862 keys = Object(__WEBPACK_IMPORTED_MODULE_1__flatten_js__["a" /* default */])(keys, false, false);
10863 var index = keys.length;
10864 if (index < 1) throw new Error('bindAll must be passed function names');
10865 while (index--) {
10866 var key = keys[index];
10867 obj[key] = Object(__WEBPACK_IMPORTED_MODULE_2__bind_js__["a" /* default */])(obj[key], obj);
10868 }
10869 return obj;
10870}));
10871
10872
10873/***/ }),
10874/* 352 */
10875/***/ (function(module, __webpack_exports__, __webpack_require__) {
10876
10877"use strict";
10878/* harmony export (immutable) */ __webpack_exports__["a"] = memoize;
10879/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__has_js__ = __webpack_require__(47);
10880
10881
10882// Memoize an expensive function by storing its results.
10883function memoize(func, hasher) {
10884 var memoize = function(key) {
10885 var cache = memoize.cache;
10886 var address = '' + (hasher ? hasher.apply(this, arguments) : key);
10887 if (!Object(__WEBPACK_IMPORTED_MODULE_0__has_js__["a" /* default */])(cache, address)) cache[address] = func.apply(this, arguments);
10888 return cache[address];
10889 };
10890 memoize.cache = {};
10891 return memoize;
10892}
10893
10894
10895/***/ }),
10896/* 353 */
10897/***/ (function(module, __webpack_exports__, __webpack_require__) {
10898
10899"use strict";
10900/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__partial_js__ = __webpack_require__(114);
10901/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__delay_js__ = __webpack_require__(208);
10902/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__underscore_js__ = __webpack_require__(25);
10903
10904
10905
10906
10907// Defers a function, scheduling it to run after the current call stack has
10908// cleared.
10909/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__partial_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__delay_js__["a" /* default */], __WEBPACK_IMPORTED_MODULE_2__underscore_js__["a" /* default */], 1));
10910
10911
10912/***/ }),
10913/* 354 */
10914/***/ (function(module, __webpack_exports__, __webpack_require__) {
10915
10916"use strict";
10917/* harmony export (immutable) */ __webpack_exports__["a"] = throttle;
10918/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__now_js__ = __webpack_require__(145);
10919
10920
10921// Returns a function, that, when invoked, will only be triggered at most once
10922// during a given window of time. Normally, the throttled function will run
10923// as much as it can, without ever going more than once per `wait` duration;
10924// but if you'd like to disable the execution on the leading edge, pass
10925// `{leading: false}`. To disable execution on the trailing edge, ditto.
10926function throttle(func, wait, options) {
10927 var timeout, context, args, result;
10928 var previous = 0;
10929 if (!options) options = {};
10930
10931 var later = function() {
10932 previous = options.leading === false ? 0 : Object(__WEBPACK_IMPORTED_MODULE_0__now_js__["a" /* default */])();
10933 timeout = null;
10934 result = func.apply(context, args);
10935 if (!timeout) context = args = null;
10936 };
10937
10938 var throttled = function() {
10939 var _now = Object(__WEBPACK_IMPORTED_MODULE_0__now_js__["a" /* default */])();
10940 if (!previous && options.leading === false) previous = _now;
10941 var remaining = wait - (_now - previous);
10942 context = this;
10943 args = arguments;
10944 if (remaining <= 0 || remaining > wait) {
10945 if (timeout) {
10946 clearTimeout(timeout);
10947 timeout = null;
10948 }
10949 previous = _now;
10950 result = func.apply(context, args);
10951 if (!timeout) context = args = null;
10952 } else if (!timeout && options.trailing !== false) {
10953 timeout = setTimeout(later, remaining);
10954 }
10955 return result;
10956 };
10957
10958 throttled.cancel = function() {
10959 clearTimeout(timeout);
10960 previous = 0;
10961 timeout = context = args = null;
10962 };
10963
10964 return throttled;
10965}
10966
10967
10968/***/ }),
10969/* 355 */
10970/***/ (function(module, __webpack_exports__, __webpack_require__) {
10971
10972"use strict";
10973/* harmony export (immutable) */ __webpack_exports__["a"] = debounce;
10974/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(24);
10975/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__now_js__ = __webpack_require__(145);
10976
10977
10978
10979// When a sequence of calls of the returned function ends, the argument
10980// function is triggered. The end of a sequence is defined by the `wait`
10981// parameter. If `immediate` is passed, the argument function will be
10982// triggered at the beginning of the sequence instead of at the end.
10983function debounce(func, wait, immediate) {
10984 var timeout, previous, args, result, context;
10985
10986 var later = function() {
10987 var passed = Object(__WEBPACK_IMPORTED_MODULE_1__now_js__["a" /* default */])() - previous;
10988 if (wait > passed) {
10989 timeout = setTimeout(later, wait - passed);
10990 } else {
10991 timeout = null;
10992 if (!immediate) result = func.apply(context, args);
10993 // This check is needed because `func` can recursively invoke `debounced`.
10994 if (!timeout) args = context = null;
10995 }
10996 };
10997
10998 var debounced = Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(_args) {
10999 context = this;
11000 args = _args;
11001 previous = Object(__WEBPACK_IMPORTED_MODULE_1__now_js__["a" /* default */])();
11002 if (!timeout) {
11003 timeout = setTimeout(later, wait);
11004 if (immediate) result = func.apply(context, args);
11005 }
11006 return result;
11007 });
11008
11009 debounced.cancel = function() {
11010 clearTimeout(timeout);
11011 timeout = args = context = null;
11012 };
11013
11014 return debounced;
11015}
11016
11017
11018/***/ }),
11019/* 356 */
11020/***/ (function(module, __webpack_exports__, __webpack_require__) {
11021
11022"use strict";
11023/* harmony export (immutable) */ __webpack_exports__["a"] = wrap;
11024/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__partial_js__ = __webpack_require__(114);
11025
11026
11027// Returns the first function passed as an argument to the second,
11028// allowing you to adjust arguments, run code before and after, and
11029// conditionally execute the original function.
11030function wrap(func, wrapper) {
11031 return Object(__WEBPACK_IMPORTED_MODULE_0__partial_js__["a" /* default */])(wrapper, func);
11032}
11033
11034
11035/***/ }),
11036/* 357 */
11037/***/ (function(module, __webpack_exports__, __webpack_require__) {
11038
11039"use strict";
11040/* harmony export (immutable) */ __webpack_exports__["a"] = compose;
11041// Returns a function that is the composition of a list of functions, each
11042// consuming the return value of the function that follows.
11043function compose() {
11044 var args = arguments;
11045 var start = args.length - 1;
11046 return function() {
11047 var i = start;
11048 var result = args[start].apply(this, arguments);
11049 while (i--) result = args[i].call(this, result);
11050 return result;
11051 };
11052}
11053
11054
11055/***/ }),
11056/* 358 */
11057/***/ (function(module, __webpack_exports__, __webpack_require__) {
11058
11059"use strict";
11060/* harmony export (immutable) */ __webpack_exports__["a"] = after;
11061// Returns a function that will only be executed on and after the Nth call.
11062function after(times, func) {
11063 return function() {
11064 if (--times < 1) {
11065 return func.apply(this, arguments);
11066 }
11067 };
11068}
11069
11070
11071/***/ }),
11072/* 359 */
11073/***/ (function(module, __webpack_exports__, __webpack_require__) {
11074
11075"use strict";
11076/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__partial_js__ = __webpack_require__(114);
11077/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__before_js__ = __webpack_require__(209);
11078
11079
11080
11081// Returns a function that will be executed at most one time, no matter how
11082// often you call it. Useful for lazy initialization.
11083/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__partial_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__before_js__["a" /* default */], 2));
11084
11085
11086/***/ }),
11087/* 360 */
11088/***/ (function(module, __webpack_exports__, __webpack_require__) {
11089
11090"use strict";
11091/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__findLastIndex_js__ = __webpack_require__(212);
11092/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__createIndexFinder_js__ = __webpack_require__(215);
11093
11094
11095
11096// Return the position of the last occurrence of an item in an array,
11097// or -1 if the item is not included in the array.
11098/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_1__createIndexFinder_js__["a" /* default */])(-1, __WEBPACK_IMPORTED_MODULE_0__findLastIndex_js__["a" /* default */]));
11099
11100
11101/***/ }),
11102/* 361 */
11103/***/ (function(module, __webpack_exports__, __webpack_require__) {
11104
11105"use strict";
11106/* harmony export (immutable) */ __webpack_exports__["a"] = findWhere;
11107/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__find_js__ = __webpack_require__(216);
11108/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__matcher_js__ = __webpack_require__(113);
11109
11110
11111
11112// Convenience version of a common use case of `_.find`: getting the first
11113// object containing specific `key:value` pairs.
11114function findWhere(obj, attrs) {
11115 return Object(__WEBPACK_IMPORTED_MODULE_0__find_js__["a" /* default */])(obj, Object(__WEBPACK_IMPORTED_MODULE_1__matcher_js__["a" /* default */])(attrs));
11116}
11117
11118
11119/***/ }),
11120/* 362 */
11121/***/ (function(module, __webpack_exports__, __webpack_require__) {
11122
11123"use strict";
11124/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createReduce_js__ = __webpack_require__(217);
11125
11126
11127// **Reduce** builds up a single result from a list of values, aka `inject`,
11128// or `foldl`.
11129/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createReduce_js__["a" /* default */])(1));
11130
11131
11132/***/ }),
11133/* 363 */
11134/***/ (function(module, __webpack_exports__, __webpack_require__) {
11135
11136"use strict";
11137/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createReduce_js__ = __webpack_require__(217);
11138
11139
11140// The right-associative version of reduce, also known as `foldr`.
11141/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createReduce_js__["a" /* default */])(-1));
11142
11143
11144/***/ }),
11145/* 364 */
11146/***/ (function(module, __webpack_exports__, __webpack_require__) {
11147
11148"use strict";
11149/* harmony export (immutable) */ __webpack_exports__["a"] = reject;
11150/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__filter_js__ = __webpack_require__(90);
11151/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__negate_js__ = __webpack_require__(146);
11152/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__cb_js__ = __webpack_require__(22);
11153
11154
11155
11156
11157// Return all the elements for which a truth test fails.
11158function reject(obj, predicate, context) {
11159 return Object(__WEBPACK_IMPORTED_MODULE_0__filter_js__["a" /* default */])(obj, Object(__WEBPACK_IMPORTED_MODULE_1__negate_js__["a" /* default */])(Object(__WEBPACK_IMPORTED_MODULE_2__cb_js__["a" /* default */])(predicate)), context);
11160}
11161
11162
11163/***/ }),
11164/* 365 */
11165/***/ (function(module, __webpack_exports__, __webpack_require__) {
11166
11167"use strict";
11168/* harmony export (immutable) */ __webpack_exports__["a"] = every;
11169/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(22);
11170/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isArrayLike_js__ = __webpack_require__(26);
11171/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__keys_js__ = __webpack_require__(17);
11172
11173
11174
11175
11176// Determine whether all of the elements pass a truth test.
11177function every(obj, predicate, context) {
11178 predicate = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(predicate, context);
11179 var _keys = !Object(__WEBPACK_IMPORTED_MODULE_1__isArrayLike_js__["a" /* default */])(obj) && Object(__WEBPACK_IMPORTED_MODULE_2__keys_js__["a" /* default */])(obj),
11180 length = (_keys || obj).length;
11181 for (var index = 0; index < length; index++) {
11182 var currentKey = _keys ? _keys[index] : index;
11183 if (!predicate(obj[currentKey], currentKey, obj)) return false;
11184 }
11185 return true;
11186}
11187
11188
11189/***/ }),
11190/* 366 */
11191/***/ (function(module, __webpack_exports__, __webpack_require__) {
11192
11193"use strict";
11194/* harmony export (immutable) */ __webpack_exports__["a"] = some;
11195/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(22);
11196/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isArrayLike_js__ = __webpack_require__(26);
11197/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__keys_js__ = __webpack_require__(17);
11198
11199
11200
11201
11202// Determine if at least one element in the object passes a truth test.
11203function some(obj, predicate, context) {
11204 predicate = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(predicate, context);
11205 var _keys = !Object(__WEBPACK_IMPORTED_MODULE_1__isArrayLike_js__["a" /* default */])(obj) && Object(__WEBPACK_IMPORTED_MODULE_2__keys_js__["a" /* default */])(obj),
11206 length = (_keys || obj).length;
11207 for (var index = 0; index < length; index++) {
11208 var currentKey = _keys ? _keys[index] : index;
11209 if (predicate(obj[currentKey], currentKey, obj)) return true;
11210 }
11211 return false;
11212}
11213
11214
11215/***/ }),
11216/* 367 */
11217/***/ (function(module, __webpack_exports__, __webpack_require__) {
11218
11219"use strict";
11220/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(24);
11221/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isFunction_js__ = __webpack_require__(30);
11222/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__map_js__ = __webpack_require__(73);
11223/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__deepGet_js__ = __webpack_require__(142);
11224/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__toPath_js__ = __webpack_require__(88);
11225
11226
11227
11228
11229
11230
11231// Invoke a method (with arguments) on every item in a collection.
11232/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(obj, path, args) {
11233 var contextPath, func;
11234 if (Object(__WEBPACK_IMPORTED_MODULE_1__isFunction_js__["a" /* default */])(path)) {
11235 func = path;
11236 } else {
11237 path = Object(__WEBPACK_IMPORTED_MODULE_4__toPath_js__["a" /* default */])(path);
11238 contextPath = path.slice(0, -1);
11239 path = path[path.length - 1];
11240 }
11241 return Object(__WEBPACK_IMPORTED_MODULE_2__map_js__["a" /* default */])(obj, function(context) {
11242 var method = func;
11243 if (!method) {
11244 if (contextPath && contextPath.length) {
11245 context = Object(__WEBPACK_IMPORTED_MODULE_3__deepGet_js__["a" /* default */])(context, contextPath);
11246 }
11247 if (context == null) return void 0;
11248 method = context[path];
11249 }
11250 return method == null ? method : method.apply(context, args);
11251 });
11252}));
11253
11254
11255/***/ }),
11256/* 368 */
11257/***/ (function(module, __webpack_exports__, __webpack_require__) {
11258
11259"use strict";
11260/* harmony export (immutable) */ __webpack_exports__["a"] = where;
11261/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__filter_js__ = __webpack_require__(90);
11262/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__matcher_js__ = __webpack_require__(113);
11263
11264
11265
11266// Convenience version of a common use case of `_.filter`: selecting only
11267// objects containing specific `key:value` pairs.
11268function where(obj, attrs) {
11269 return Object(__WEBPACK_IMPORTED_MODULE_0__filter_js__["a" /* default */])(obj, Object(__WEBPACK_IMPORTED_MODULE_1__matcher_js__["a" /* default */])(attrs));
11270}
11271
11272
11273/***/ }),
11274/* 369 */
11275/***/ (function(module, __webpack_exports__, __webpack_require__) {
11276
11277"use strict";
11278/* harmony export (immutable) */ __webpack_exports__["a"] = min;
11279/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__ = __webpack_require__(26);
11280/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__values_js__ = __webpack_require__(71);
11281/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__cb_js__ = __webpack_require__(22);
11282/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__each_js__ = __webpack_require__(60);
11283
11284
11285
11286
11287
11288// Return the minimum element (or element-based computation).
11289function min(obj, iteratee, context) {
11290 var result = Infinity, lastComputed = Infinity,
11291 value, computed;
11292 if (iteratee == null || typeof iteratee == 'number' && typeof obj[0] != 'object' && obj != null) {
11293 obj = Object(__WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__["a" /* default */])(obj) ? obj : Object(__WEBPACK_IMPORTED_MODULE_1__values_js__["a" /* default */])(obj);
11294 for (var i = 0, length = obj.length; i < length; i++) {
11295 value = obj[i];
11296 if (value != null && value < result) {
11297 result = value;
11298 }
11299 }
11300 } else {
11301 iteratee = Object(__WEBPACK_IMPORTED_MODULE_2__cb_js__["a" /* default */])(iteratee, context);
11302 Object(__WEBPACK_IMPORTED_MODULE_3__each_js__["a" /* default */])(obj, function(v, index, list) {
11303 computed = iteratee(v, index, list);
11304 if (computed < lastComputed || computed === Infinity && result === Infinity) {
11305 result = v;
11306 lastComputed = computed;
11307 }
11308 });
11309 }
11310 return result;
11311}
11312
11313
11314/***/ }),
11315/* 370 */
11316/***/ (function(module, __webpack_exports__, __webpack_require__) {
11317
11318"use strict";
11319/* harmony export (immutable) */ __webpack_exports__["a"] = shuffle;
11320/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__sample_js__ = __webpack_require__(219);
11321
11322
11323// Shuffle a collection.
11324function shuffle(obj) {
11325 return Object(__WEBPACK_IMPORTED_MODULE_0__sample_js__["a" /* default */])(obj, Infinity);
11326}
11327
11328
11329/***/ }),
11330/* 371 */
11331/***/ (function(module, __webpack_exports__, __webpack_require__) {
11332
11333"use strict";
11334/* harmony export (immutable) */ __webpack_exports__["a"] = sortBy;
11335/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(22);
11336/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__pluck_js__ = __webpack_require__(148);
11337/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__map_js__ = __webpack_require__(73);
11338
11339
11340
11341
11342// Sort the object's values by a criterion produced by an iteratee.
11343function sortBy(obj, iteratee, context) {
11344 var index = 0;
11345 iteratee = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(iteratee, context);
11346 return Object(__WEBPACK_IMPORTED_MODULE_1__pluck_js__["a" /* default */])(Object(__WEBPACK_IMPORTED_MODULE_2__map_js__["a" /* default */])(obj, function(value, key, list) {
11347 return {
11348 value: value,
11349 index: index++,
11350 criteria: iteratee(value, key, list)
11351 };
11352 }).sort(function(left, right) {
11353 var a = left.criteria;
11354 var b = right.criteria;
11355 if (a !== b) {
11356 if (a > b || a === void 0) return 1;
11357 if (a < b || b === void 0) return -1;
11358 }
11359 return left.index - right.index;
11360 }), 'value');
11361}
11362
11363
11364/***/ }),
11365/* 372 */
11366/***/ (function(module, __webpack_exports__, __webpack_require__) {
11367
11368"use strict";
11369/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__group_js__ = __webpack_require__(115);
11370/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__has_js__ = __webpack_require__(47);
11371
11372
11373
11374// Groups the object's values by a criterion. Pass either a string attribute
11375// to group by, or a function that returns the criterion.
11376/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__group_js__["a" /* default */])(function(result, value, key) {
11377 if (Object(__WEBPACK_IMPORTED_MODULE_1__has_js__["a" /* default */])(result, key)) result[key].push(value); else result[key] = [value];
11378}));
11379
11380
11381/***/ }),
11382/* 373 */
11383/***/ (function(module, __webpack_exports__, __webpack_require__) {
11384
11385"use strict";
11386/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__group_js__ = __webpack_require__(115);
11387
11388
11389// Indexes the object's values by a criterion, similar to `_.groupBy`, but for
11390// when you know that your index values will be unique.
11391/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__group_js__["a" /* default */])(function(result, value, key) {
11392 result[key] = value;
11393}));
11394
11395
11396/***/ }),
11397/* 374 */
11398/***/ (function(module, __webpack_exports__, __webpack_require__) {
11399
11400"use strict";
11401/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__group_js__ = __webpack_require__(115);
11402/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__has_js__ = __webpack_require__(47);
11403
11404
11405
11406// Counts instances of an object that group by a certain criterion. Pass
11407// either a string attribute to count by, or a function that returns the
11408// criterion.
11409/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__group_js__["a" /* default */])(function(result, value, key) {
11410 if (Object(__WEBPACK_IMPORTED_MODULE_1__has_js__["a" /* default */])(result, key)) result[key]++; else result[key] = 1;
11411}));
11412
11413
11414/***/ }),
11415/* 375 */
11416/***/ (function(module, __webpack_exports__, __webpack_require__) {
11417
11418"use strict";
11419/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__group_js__ = __webpack_require__(115);
11420
11421
11422// Split a collection into two arrays: one whose elements all pass the given
11423// truth test, and one whose elements all do not pass the truth test.
11424/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__group_js__["a" /* default */])(function(result, value, pass) {
11425 result[pass ? 0 : 1].push(value);
11426}, true));
11427
11428
11429/***/ }),
11430/* 376 */
11431/***/ (function(module, __webpack_exports__, __webpack_require__) {
11432
11433"use strict";
11434/* harmony export (immutable) */ __webpack_exports__["a"] = toArray;
11435/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isArray_js__ = __webpack_require__(59);
11436/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__setup_js__ = __webpack_require__(6);
11437/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__isString_js__ = __webpack_require__(135);
11438/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__isArrayLike_js__ = __webpack_require__(26);
11439/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__map_js__ = __webpack_require__(73);
11440/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__identity_js__ = __webpack_require__(143);
11441/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__values_js__ = __webpack_require__(71);
11442
11443
11444
11445
11446
11447
11448
11449
11450// Safely create a real, live array from anything iterable.
11451var reStrSymbol = /[^\ud800-\udfff]|[\ud800-\udbff][\udc00-\udfff]|[\ud800-\udfff]/g;
11452function toArray(obj) {
11453 if (!obj) return [];
11454 if (Object(__WEBPACK_IMPORTED_MODULE_0__isArray_js__["a" /* default */])(obj)) return __WEBPACK_IMPORTED_MODULE_1__setup_js__["q" /* slice */].call(obj);
11455 if (Object(__WEBPACK_IMPORTED_MODULE_2__isString_js__["a" /* default */])(obj)) {
11456 // Keep surrogate pair characters together.
11457 return obj.match(reStrSymbol);
11458 }
11459 if (Object(__WEBPACK_IMPORTED_MODULE_3__isArrayLike_js__["a" /* default */])(obj)) return Object(__WEBPACK_IMPORTED_MODULE_4__map_js__["a" /* default */])(obj, __WEBPACK_IMPORTED_MODULE_5__identity_js__["a" /* default */]);
11460 return Object(__WEBPACK_IMPORTED_MODULE_6__values_js__["a" /* default */])(obj);
11461}
11462
11463
11464/***/ }),
11465/* 377 */
11466/***/ (function(module, __webpack_exports__, __webpack_require__) {
11467
11468"use strict";
11469/* harmony export (immutable) */ __webpack_exports__["a"] = size;
11470/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__ = __webpack_require__(26);
11471/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__keys_js__ = __webpack_require__(17);
11472
11473
11474
11475// Return the number of elements in a collection.
11476function size(obj) {
11477 if (obj == null) return 0;
11478 return Object(__WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__["a" /* default */])(obj) ? obj.length : Object(__WEBPACK_IMPORTED_MODULE_1__keys_js__["a" /* default */])(obj).length;
11479}
11480
11481
11482/***/ }),
11483/* 378 */
11484/***/ (function(module, __webpack_exports__, __webpack_require__) {
11485
11486"use strict";
11487/* harmony export (immutable) */ __webpack_exports__["a"] = keyInObj;
11488// Internal `_.pick` helper function to determine whether `key` is an enumerable
11489// property name of `obj`.
11490function keyInObj(value, key, obj) {
11491 return key in obj;
11492}
11493
11494
11495/***/ }),
11496/* 379 */
11497/***/ (function(module, __webpack_exports__, __webpack_require__) {
11498
11499"use strict";
11500/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(24);
11501/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isFunction_js__ = __webpack_require__(30);
11502/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__negate_js__ = __webpack_require__(146);
11503/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__map_js__ = __webpack_require__(73);
11504/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__flatten_js__ = __webpack_require__(72);
11505/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__contains_js__ = __webpack_require__(91);
11506/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__pick_js__ = __webpack_require__(220);
11507
11508
11509
11510
11511
11512
11513
11514
11515// Return a copy of the object without the disallowed properties.
11516/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(obj, keys) {
11517 var iteratee = keys[0], context;
11518 if (Object(__WEBPACK_IMPORTED_MODULE_1__isFunction_js__["a" /* default */])(iteratee)) {
11519 iteratee = Object(__WEBPACK_IMPORTED_MODULE_2__negate_js__["a" /* default */])(iteratee);
11520 if (keys.length > 1) context = keys[1];
11521 } else {
11522 keys = Object(__WEBPACK_IMPORTED_MODULE_3__map_js__["a" /* default */])(Object(__WEBPACK_IMPORTED_MODULE_4__flatten_js__["a" /* default */])(keys, false, false), String);
11523 iteratee = function(value, key) {
11524 return !Object(__WEBPACK_IMPORTED_MODULE_5__contains_js__["a" /* default */])(keys, key);
11525 };
11526 }
11527 return Object(__WEBPACK_IMPORTED_MODULE_6__pick_js__["a" /* default */])(obj, iteratee, context);
11528}));
11529
11530
11531/***/ }),
11532/* 380 */
11533/***/ (function(module, __webpack_exports__, __webpack_require__) {
11534
11535"use strict";
11536/* harmony export (immutable) */ __webpack_exports__["a"] = first;
11537/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__initial_js__ = __webpack_require__(221);
11538
11539
11540// Get the first element of an array. Passing **n** will return the first N
11541// values in the array. The **guard** check allows it to work with `_.map`.
11542function first(array, n, guard) {
11543 if (array == null || array.length < 1) return n == null || guard ? void 0 : [];
11544 if (n == null || guard) return array[0];
11545 return Object(__WEBPACK_IMPORTED_MODULE_0__initial_js__["a" /* default */])(array, array.length - n);
11546}
11547
11548
11549/***/ }),
11550/* 381 */
11551/***/ (function(module, __webpack_exports__, __webpack_require__) {
11552
11553"use strict";
11554/* harmony export (immutable) */ __webpack_exports__["a"] = last;
11555/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__rest_js__ = __webpack_require__(222);
11556
11557
11558// Get the last element of an array. Passing **n** will return the last N
11559// values in the array.
11560function last(array, n, guard) {
11561 if (array == null || array.length < 1) return n == null || guard ? void 0 : [];
11562 if (n == null || guard) return array[array.length - 1];
11563 return Object(__WEBPACK_IMPORTED_MODULE_0__rest_js__["a" /* default */])(array, Math.max(0, array.length - n));
11564}
11565
11566
11567/***/ }),
11568/* 382 */
11569/***/ (function(module, __webpack_exports__, __webpack_require__) {
11570
11571"use strict";
11572/* harmony export (immutable) */ __webpack_exports__["a"] = compact;
11573/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__filter_js__ = __webpack_require__(90);
11574
11575
11576// Trim out all falsy values from an array.
11577function compact(array) {
11578 return Object(__WEBPACK_IMPORTED_MODULE_0__filter_js__["a" /* default */])(array, Boolean);
11579}
11580
11581
11582/***/ }),
11583/* 383 */
11584/***/ (function(module, __webpack_exports__, __webpack_require__) {
11585
11586"use strict";
11587/* harmony export (immutable) */ __webpack_exports__["a"] = flatten;
11588/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__flatten_js__ = __webpack_require__(72);
11589
11590
11591// Flatten out an array, either recursively (by default), or up to `depth`.
11592// Passing `true` or `false` as `depth` means `1` or `Infinity`, respectively.
11593function flatten(array, depth) {
11594 return Object(__WEBPACK_IMPORTED_MODULE_0__flatten_js__["a" /* default */])(array, depth, false);
11595}
11596
11597
11598/***/ }),
11599/* 384 */
11600/***/ (function(module, __webpack_exports__, __webpack_require__) {
11601
11602"use strict";
11603/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(24);
11604/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__difference_js__ = __webpack_require__(223);
11605
11606
11607
11608// Return a version of the array that does not contain the specified value(s).
11609/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(array, otherArrays) {
11610 return Object(__WEBPACK_IMPORTED_MODULE_1__difference_js__["a" /* default */])(array, otherArrays);
11611}));
11612
11613
11614/***/ }),
11615/* 385 */
11616/***/ (function(module, __webpack_exports__, __webpack_require__) {
11617
11618"use strict";
11619/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(24);
11620/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__uniq_js__ = __webpack_require__(224);
11621/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__flatten_js__ = __webpack_require__(72);
11622
11623
11624
11625
11626// Produce an array that contains the union: each distinct element from all of
11627// the passed-in arrays.
11628/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(arrays) {
11629 return Object(__WEBPACK_IMPORTED_MODULE_1__uniq_js__["a" /* default */])(Object(__WEBPACK_IMPORTED_MODULE_2__flatten_js__["a" /* default */])(arrays, true, true));
11630}));
11631
11632
11633/***/ }),
11634/* 386 */
11635/***/ (function(module, __webpack_exports__, __webpack_require__) {
11636
11637"use strict";
11638/* harmony export (immutable) */ __webpack_exports__["a"] = intersection;
11639/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__getLength_js__ = __webpack_require__(31);
11640/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__contains_js__ = __webpack_require__(91);
11641
11642
11643
11644// Produce an array that contains every item shared between all the
11645// passed-in arrays.
11646function intersection(array) {
11647 var result = [];
11648 var argsLength = arguments.length;
11649 for (var i = 0, length = Object(__WEBPACK_IMPORTED_MODULE_0__getLength_js__["a" /* default */])(array); i < length; i++) {
11650 var item = array[i];
11651 if (Object(__WEBPACK_IMPORTED_MODULE_1__contains_js__["a" /* default */])(result, item)) continue;
11652 var j;
11653 for (j = 1; j < argsLength; j++) {
11654 if (!Object(__WEBPACK_IMPORTED_MODULE_1__contains_js__["a" /* default */])(arguments[j], item)) break;
11655 }
11656 if (j === argsLength) result.push(item);
11657 }
11658 return result;
11659}
11660
11661
11662/***/ }),
11663/* 387 */
11664/***/ (function(module, __webpack_exports__, __webpack_require__) {
11665
11666"use strict";
11667/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(24);
11668/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__unzip_js__ = __webpack_require__(225);
11669
11670
11671
11672// Zip together multiple lists into a single array -- elements that share
11673// an index go together.
11674/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__unzip_js__["a" /* default */]));
11675
11676
11677/***/ }),
11678/* 388 */
11679/***/ (function(module, __webpack_exports__, __webpack_require__) {
11680
11681"use strict";
11682/* harmony export (immutable) */ __webpack_exports__["a"] = object;
11683/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__getLength_js__ = __webpack_require__(31);
11684
11685
11686// Converts lists into objects. Pass either a single array of `[key, value]`
11687// pairs, or two parallel arrays of the same length -- one of keys, and one of
11688// the corresponding values. Passing by pairs is the reverse of `_.pairs`.
11689function object(list, values) {
11690 var result = {};
11691 for (var i = 0, length = Object(__WEBPACK_IMPORTED_MODULE_0__getLength_js__["a" /* default */])(list); i < length; i++) {
11692 if (values) {
11693 result[list[i]] = values[i];
11694 } else {
11695 result[list[i][0]] = list[i][1];
11696 }
11697 }
11698 return result;
11699}
11700
11701
11702/***/ }),
11703/* 389 */
11704/***/ (function(module, __webpack_exports__, __webpack_require__) {
11705
11706"use strict";
11707/* harmony export (immutable) */ __webpack_exports__["a"] = range;
11708// Generate an integer Array containing an arithmetic progression. A port of
11709// the native Python `range()` function. See
11710// [the Python documentation](https://docs.python.org/library/functions.html#range).
11711function range(start, stop, step) {
11712 if (stop == null) {
11713 stop = start || 0;
11714 start = 0;
11715 }
11716 if (!step) {
11717 step = stop < start ? -1 : 1;
11718 }
11719
11720 var length = Math.max(Math.ceil((stop - start) / step), 0);
11721 var range = Array(length);
11722
11723 for (var idx = 0; idx < length; idx++, start += step) {
11724 range[idx] = start;
11725 }
11726
11727 return range;
11728}
11729
11730
11731/***/ }),
11732/* 390 */
11733/***/ (function(module, __webpack_exports__, __webpack_require__) {
11734
11735"use strict";
11736/* harmony export (immutable) */ __webpack_exports__["a"] = chunk;
11737/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(6);
11738
11739
11740// Chunk a single array into multiple arrays, each containing `count` or fewer
11741// items.
11742function chunk(array, count) {
11743 if (count == null || count < 1) return [];
11744 var result = [];
11745 var i = 0, length = array.length;
11746 while (i < length) {
11747 result.push(__WEBPACK_IMPORTED_MODULE_0__setup_js__["q" /* slice */].call(array, i, i += count));
11748 }
11749 return result;
11750}
11751
11752
11753/***/ }),
11754/* 391 */
11755/***/ (function(module, __webpack_exports__, __webpack_require__) {
11756
11757"use strict";
11758/* harmony export (immutable) */ __webpack_exports__["a"] = mixin;
11759/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__underscore_js__ = __webpack_require__(25);
11760/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__each_js__ = __webpack_require__(60);
11761/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__functions_js__ = __webpack_require__(192);
11762/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__setup_js__ = __webpack_require__(6);
11763/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__chainResult_js__ = __webpack_require__(226);
11764
11765
11766
11767
11768
11769
11770// Add your own custom functions to the Underscore object.
11771function mixin(obj) {
11772 Object(__WEBPACK_IMPORTED_MODULE_1__each_js__["a" /* default */])(Object(__WEBPACK_IMPORTED_MODULE_2__functions_js__["a" /* default */])(obj), function(name) {
11773 var func = __WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */][name] = obj[name];
11774 __WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */].prototype[name] = function() {
11775 var args = [this._wrapped];
11776 __WEBPACK_IMPORTED_MODULE_3__setup_js__["o" /* push */].apply(args, arguments);
11777 return Object(__WEBPACK_IMPORTED_MODULE_4__chainResult_js__["a" /* default */])(this, func.apply(__WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */], args));
11778 };
11779 });
11780 return __WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */];
11781}
11782
11783
11784/***/ }),
11785/* 392 */
11786/***/ (function(module, __webpack_exports__, __webpack_require__) {
11787
11788"use strict";
11789/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__underscore_js__ = __webpack_require__(25);
11790/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__each_js__ = __webpack_require__(60);
11791/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__setup_js__ = __webpack_require__(6);
11792/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__chainResult_js__ = __webpack_require__(226);
11793
11794
11795
11796
11797
11798// Add all mutator `Array` functions to the wrapper.
11799Object(__WEBPACK_IMPORTED_MODULE_1__each_js__["a" /* default */])(['pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift'], function(name) {
11800 var method = __WEBPACK_IMPORTED_MODULE_2__setup_js__["a" /* ArrayProto */][name];
11801 __WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */].prototype[name] = function() {
11802 var obj = this._wrapped;
11803 if (obj != null) {
11804 method.apply(obj, arguments);
11805 if ((name === 'shift' || name === 'splice') && obj.length === 0) {
11806 delete obj[0];
11807 }
11808 }
11809 return Object(__WEBPACK_IMPORTED_MODULE_3__chainResult_js__["a" /* default */])(this, obj);
11810 };
11811});
11812
11813// Add all accessor `Array` functions to the wrapper.
11814Object(__WEBPACK_IMPORTED_MODULE_1__each_js__["a" /* default */])(['concat', 'join', 'slice'], function(name) {
11815 var method = __WEBPACK_IMPORTED_MODULE_2__setup_js__["a" /* ArrayProto */][name];
11816 __WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */].prototype[name] = function() {
11817 var obj = this._wrapped;
11818 if (obj != null) obj = method.apply(obj, arguments);
11819 return Object(__WEBPACK_IMPORTED_MODULE_3__chainResult_js__["a" /* default */])(this, obj);
11820 };
11821});
11822
11823/* harmony default export */ __webpack_exports__["a"] = (__WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */]);
11824
11825
11826/***/ }),
11827/* 393 */
11828/***/ (function(module, exports, __webpack_require__) {
11829
11830var parent = __webpack_require__(394);
11831
11832module.exports = parent;
11833
11834
11835/***/ }),
11836/* 394 */
11837/***/ (function(module, exports, __webpack_require__) {
11838
11839var isPrototypeOf = __webpack_require__(16);
11840var method = __webpack_require__(395);
11841
11842var ArrayPrototype = Array.prototype;
11843
11844module.exports = function (it) {
11845 var own = it.concat;
11846 return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.concat) ? method : own;
11847};
11848
11849
11850/***/ }),
11851/* 395 */
11852/***/ (function(module, exports, __webpack_require__) {
11853
11854__webpack_require__(227);
11855var entryVirtual = __webpack_require__(27);
11856
11857module.exports = entryVirtual('Array').concat;
11858
11859
11860/***/ }),
11861/* 396 */
11862/***/ (function(module, exports) {
11863
11864var $TypeError = TypeError;
11865var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF; // 2 ** 53 - 1 == 9007199254740991
11866
11867module.exports = function (it) {
11868 if (it > MAX_SAFE_INTEGER) throw $TypeError('Maximum allowed index exceeded');
11869 return it;
11870};
11871
11872
11873/***/ }),
11874/* 397 */
11875/***/ (function(module, exports, __webpack_require__) {
11876
11877var isArray = __webpack_require__(92);
11878var isConstructor = __webpack_require__(111);
11879var isObject = __webpack_require__(11);
11880var wellKnownSymbol = __webpack_require__(5);
11881
11882var SPECIES = wellKnownSymbol('species');
11883var $Array = Array;
11884
11885// a part of `ArraySpeciesCreate` abstract operation
11886// https://tc39.es/ecma262/#sec-arrayspeciescreate
11887module.exports = function (originalArray) {
11888 var C;
11889 if (isArray(originalArray)) {
11890 C = originalArray.constructor;
11891 // cross-realm fallback
11892 if (isConstructor(C) && (C === $Array || isArray(C.prototype))) C = undefined;
11893 else if (isObject(C)) {
11894 C = C[SPECIES];
11895 if (C === null) C = undefined;
11896 }
11897 } return C === undefined ? $Array : C;
11898};
11899
11900
11901/***/ }),
11902/* 398 */
11903/***/ (function(module, exports, __webpack_require__) {
11904
11905var parent = __webpack_require__(399);
11906
11907module.exports = parent;
11908
11909
11910/***/ }),
11911/* 399 */
11912/***/ (function(module, exports, __webpack_require__) {
11913
11914var isPrototypeOf = __webpack_require__(16);
11915var method = __webpack_require__(400);
11916
11917var ArrayPrototype = Array.prototype;
11918
11919module.exports = function (it) {
11920 var own = it.map;
11921 return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.map) ? method : own;
11922};
11923
11924
11925/***/ }),
11926/* 400 */
11927/***/ (function(module, exports, __webpack_require__) {
11928
11929__webpack_require__(401);
11930var entryVirtual = __webpack_require__(27);
11931
11932module.exports = entryVirtual('Array').map;
11933
11934
11935/***/ }),
11936/* 401 */
11937/***/ (function(module, exports, __webpack_require__) {
11938
11939"use strict";
11940
11941var $ = __webpack_require__(0);
11942var $map = __webpack_require__(75).map;
11943var arrayMethodHasSpeciesSupport = __webpack_require__(116);
11944
11945var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('map');
11946
11947// `Array.prototype.map` method
11948// https://tc39.es/ecma262/#sec-array.prototype.map
11949// with adding support of @@species
11950$({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT }, {
11951 map: function map(callbackfn /* , thisArg */) {
11952 return $map(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
11953 }
11954});
11955
11956
11957/***/ }),
11958/* 402 */
11959/***/ (function(module, exports, __webpack_require__) {
11960
11961var parent = __webpack_require__(403);
11962
11963module.exports = parent;
11964
11965
11966/***/ }),
11967/* 403 */
11968/***/ (function(module, exports, __webpack_require__) {
11969
11970__webpack_require__(404);
11971var path = __webpack_require__(7);
11972
11973module.exports = path.Object.keys;
11974
11975
11976/***/ }),
11977/* 404 */
11978/***/ (function(module, exports, __webpack_require__) {
11979
11980var $ = __webpack_require__(0);
11981var toObject = __webpack_require__(33);
11982var nativeKeys = __webpack_require__(107);
11983var fails = __webpack_require__(2);
11984
11985var FAILS_ON_PRIMITIVES = fails(function () { nativeKeys(1); });
11986
11987// `Object.keys` method
11988// https://tc39.es/ecma262/#sec-object.keys
11989$({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES }, {
11990 keys: function keys(it) {
11991 return nativeKeys(toObject(it));
11992 }
11993});
11994
11995
11996/***/ }),
11997/* 405 */
11998/***/ (function(module, exports, __webpack_require__) {
11999
12000var parent = __webpack_require__(406);
12001
12002module.exports = parent;
12003
12004
12005/***/ }),
12006/* 406 */
12007/***/ (function(module, exports, __webpack_require__) {
12008
12009__webpack_require__(229);
12010var path = __webpack_require__(7);
12011var apply = __webpack_require__(79);
12012
12013// eslint-disable-next-line es-x/no-json -- safe
12014if (!path.JSON) path.JSON = { stringify: JSON.stringify };
12015
12016// eslint-disable-next-line no-unused-vars -- required for `.length`
12017module.exports = function stringify(it, replacer, space) {
12018 return apply(path.JSON.stringify, null, arguments);
12019};
12020
12021
12022/***/ }),
12023/* 407 */
12024/***/ (function(module, exports, __webpack_require__) {
12025
12026var parent = __webpack_require__(408);
12027
12028module.exports = parent;
12029
12030
12031/***/ }),
12032/* 408 */
12033/***/ (function(module, exports, __webpack_require__) {
12034
12035var isPrototypeOf = __webpack_require__(16);
12036var method = __webpack_require__(409);
12037
12038var ArrayPrototype = Array.prototype;
12039
12040module.exports = function (it) {
12041 var own = it.indexOf;
12042 return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.indexOf) ? method : own;
12043};
12044
12045
12046/***/ }),
12047/* 409 */
12048/***/ (function(module, exports, __webpack_require__) {
12049
12050__webpack_require__(410);
12051var entryVirtual = __webpack_require__(27);
12052
12053module.exports = entryVirtual('Array').indexOf;
12054
12055
12056/***/ }),
12057/* 410 */
12058/***/ (function(module, exports, __webpack_require__) {
12059
12060"use strict";
12061
12062/* eslint-disable es-x/no-array-prototype-indexof -- required for testing */
12063var $ = __webpack_require__(0);
12064var uncurryThis = __webpack_require__(4);
12065var $IndexOf = __webpack_require__(125).indexOf;
12066var arrayMethodIsStrict = __webpack_require__(150);
12067
12068var un$IndexOf = uncurryThis([].indexOf);
12069
12070var NEGATIVE_ZERO = !!un$IndexOf && 1 / un$IndexOf([1], 1, -0) < 0;
12071var STRICT_METHOD = arrayMethodIsStrict('indexOf');
12072
12073// `Array.prototype.indexOf` method
12074// https://tc39.es/ecma262/#sec-array.prototype.indexof
12075$({ target: 'Array', proto: true, forced: NEGATIVE_ZERO || !STRICT_METHOD }, {
12076 indexOf: function indexOf(searchElement /* , fromIndex = 0 */) {
12077 var fromIndex = arguments.length > 1 ? arguments[1] : undefined;
12078 return NEGATIVE_ZERO
12079 // convert -0 to +0
12080 ? un$IndexOf(this, searchElement, fromIndex) || 0
12081 : $IndexOf(this, searchElement, fromIndex);
12082 }
12083});
12084
12085
12086/***/ }),
12087/* 411 */
12088/***/ (function(module, exports, __webpack_require__) {
12089
12090__webpack_require__(46);
12091var classof = __webpack_require__(55);
12092var hasOwn = __webpack_require__(13);
12093var isPrototypeOf = __webpack_require__(16);
12094var method = __webpack_require__(412);
12095
12096var ArrayPrototype = Array.prototype;
12097
12098var DOMIterables = {
12099 DOMTokenList: true,
12100 NodeList: true
12101};
12102
12103module.exports = function (it) {
12104 var own = it.keys;
12105 return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.keys)
12106 || hasOwn(DOMIterables, classof(it)) ? method : own;
12107};
12108
12109
12110/***/ }),
12111/* 412 */
12112/***/ (function(module, exports, __webpack_require__) {
12113
12114var parent = __webpack_require__(413);
12115
12116module.exports = parent;
12117
12118
12119/***/ }),
12120/* 413 */
12121/***/ (function(module, exports, __webpack_require__) {
12122
12123__webpack_require__(43);
12124__webpack_require__(68);
12125var entryVirtual = __webpack_require__(27);
12126
12127module.exports = entryVirtual('Array').keys;
12128
12129
12130/***/ }),
12131/* 414 */
12132/***/ (function(module, exports) {
12133
12134// Unique ID creation requires a high quality random # generator. In the
12135// browser this is a little complicated due to unknown quality of Math.random()
12136// and inconsistent support for the `crypto` API. We do the best we can via
12137// feature-detection
12138
12139// getRandomValues needs to be invoked in a context where "this" is a Crypto
12140// implementation. Also, find the complete implementation of crypto on IE11.
12141var getRandomValues = (typeof(crypto) != 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto)) ||
12142 (typeof(msCrypto) != 'undefined' && typeof window.msCrypto.getRandomValues == 'function' && msCrypto.getRandomValues.bind(msCrypto));
12143
12144if (getRandomValues) {
12145 // WHATWG crypto RNG - http://wiki.whatwg.org/wiki/Crypto
12146 var rnds8 = new Uint8Array(16); // eslint-disable-line no-undef
12147
12148 module.exports = function whatwgRNG() {
12149 getRandomValues(rnds8);
12150 return rnds8;
12151 };
12152} else {
12153 // Math.random()-based (RNG)
12154 //
12155 // If all else fails, use Math.random(). It's fast, but is of unspecified
12156 // quality.
12157 var rnds = new Array(16);
12158
12159 module.exports = function mathRNG() {
12160 for (var i = 0, r; i < 16; i++) {
12161 if ((i & 0x03) === 0) r = Math.random() * 0x100000000;
12162 rnds[i] = r >>> ((i & 0x03) << 3) & 0xff;
12163 }
12164
12165 return rnds;
12166 };
12167}
12168
12169
12170/***/ }),
12171/* 415 */
12172/***/ (function(module, exports) {
12173
12174/**
12175 * Convert array of 16 byte values to UUID string format of the form:
12176 * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
12177 */
12178var byteToHex = [];
12179for (var i = 0; i < 256; ++i) {
12180 byteToHex[i] = (i + 0x100).toString(16).substr(1);
12181}
12182
12183function bytesToUuid(buf, offset) {
12184 var i = offset || 0;
12185 var bth = byteToHex;
12186 // join used to fix memory issue caused by concatenation: https://bugs.chromium.org/p/v8/issues/detail?id=3175#c4
12187 return ([bth[buf[i++]], bth[buf[i++]],
12188 bth[buf[i++]], bth[buf[i++]], '-',
12189 bth[buf[i++]], bth[buf[i++]], '-',
12190 bth[buf[i++]], bth[buf[i++]], '-',
12191 bth[buf[i++]], bth[buf[i++]], '-',
12192 bth[buf[i++]], bth[buf[i++]],
12193 bth[buf[i++]], bth[buf[i++]],
12194 bth[buf[i++]], bth[buf[i++]]]).join('');
12195}
12196
12197module.exports = bytesToUuid;
12198
12199
12200/***/ }),
12201/* 416 */
12202/***/ (function(module, exports, __webpack_require__) {
12203
12204"use strict";
12205
12206
12207/**
12208 * This is the common logic for both the Node.js and web browser
12209 * implementations of `debug()`.
12210 */
12211function setup(env) {
12212 createDebug.debug = createDebug;
12213 createDebug.default = createDebug;
12214 createDebug.coerce = coerce;
12215 createDebug.disable = disable;
12216 createDebug.enable = enable;
12217 createDebug.enabled = enabled;
12218 createDebug.humanize = __webpack_require__(417);
12219 Object.keys(env).forEach(function (key) {
12220 createDebug[key] = env[key];
12221 });
12222 /**
12223 * Active `debug` instances.
12224 */
12225
12226 createDebug.instances = [];
12227 /**
12228 * The currently active debug mode names, and names to skip.
12229 */
12230
12231 createDebug.names = [];
12232 createDebug.skips = [];
12233 /**
12234 * Map of special "%n" handling functions, for the debug "format" argument.
12235 *
12236 * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N".
12237 */
12238
12239 createDebug.formatters = {};
12240 /**
12241 * Selects a color for a debug namespace
12242 * @param {String} namespace The namespace string for the for the debug instance to be colored
12243 * @return {Number|String} An ANSI color code for the given namespace
12244 * @api private
12245 */
12246
12247 function selectColor(namespace) {
12248 var hash = 0;
12249
12250 for (var i = 0; i < namespace.length; i++) {
12251 hash = (hash << 5) - hash + namespace.charCodeAt(i);
12252 hash |= 0; // Convert to 32bit integer
12253 }
12254
12255 return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
12256 }
12257
12258 createDebug.selectColor = selectColor;
12259 /**
12260 * Create a debugger with the given `namespace`.
12261 *
12262 * @param {String} namespace
12263 * @return {Function}
12264 * @api public
12265 */
12266
12267 function createDebug(namespace) {
12268 var prevTime;
12269
12270 function debug() {
12271 // Disabled?
12272 if (!debug.enabled) {
12273 return;
12274 }
12275
12276 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
12277 args[_key] = arguments[_key];
12278 }
12279
12280 var self = debug; // Set `diff` timestamp
12281
12282 var curr = Number(new Date());
12283 var ms = curr - (prevTime || curr);
12284 self.diff = ms;
12285 self.prev = prevTime;
12286 self.curr = curr;
12287 prevTime = curr;
12288 args[0] = createDebug.coerce(args[0]);
12289
12290 if (typeof args[0] !== 'string') {
12291 // Anything else let's inspect with %O
12292 args.unshift('%O');
12293 } // Apply any `formatters` transformations
12294
12295
12296 var index = 0;
12297 args[0] = args[0].replace(/%([a-zA-Z%])/g, function (match, format) {
12298 // If we encounter an escaped % then don't increase the array index
12299 if (match === '%%') {
12300 return match;
12301 }
12302
12303 index++;
12304 var formatter = createDebug.formatters[format];
12305
12306 if (typeof formatter === 'function') {
12307 var val = args[index];
12308 match = formatter.call(self, val); // Now we need to remove `args[index]` since it's inlined in the `format`
12309
12310 args.splice(index, 1);
12311 index--;
12312 }
12313
12314 return match;
12315 }); // Apply env-specific formatting (colors, etc.)
12316
12317 createDebug.formatArgs.call(self, args);
12318 var logFn = self.log || createDebug.log;
12319 logFn.apply(self, args);
12320 }
12321
12322 debug.namespace = namespace;
12323 debug.enabled = createDebug.enabled(namespace);
12324 debug.useColors = createDebug.useColors();
12325 debug.color = selectColor(namespace);
12326 debug.destroy = destroy;
12327 debug.extend = extend; // Debug.formatArgs = formatArgs;
12328 // debug.rawLog = rawLog;
12329 // env-specific initialization logic for debug instances
12330
12331 if (typeof createDebug.init === 'function') {
12332 createDebug.init(debug);
12333 }
12334
12335 createDebug.instances.push(debug);
12336 return debug;
12337 }
12338
12339 function destroy() {
12340 var index = createDebug.instances.indexOf(this);
12341
12342 if (index !== -1) {
12343 createDebug.instances.splice(index, 1);
12344 return true;
12345 }
12346
12347 return false;
12348 }
12349
12350 function extend(namespace, delimiter) {
12351 return createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace);
12352 }
12353 /**
12354 * Enables a debug mode by namespaces. This can include modes
12355 * separated by a colon and wildcards.
12356 *
12357 * @param {String} namespaces
12358 * @api public
12359 */
12360
12361
12362 function enable(namespaces) {
12363 createDebug.save(namespaces);
12364 createDebug.names = [];
12365 createDebug.skips = [];
12366 var i;
12367 var split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/);
12368 var len = split.length;
12369
12370 for (i = 0; i < len; i++) {
12371 if (!split[i]) {
12372 // ignore empty strings
12373 continue;
12374 }
12375
12376 namespaces = split[i].replace(/\*/g, '.*?');
12377
12378 if (namespaces[0] === '-') {
12379 createDebug.skips.push(new RegExp('^' + namespaces.substr(1) + '$'));
12380 } else {
12381 createDebug.names.push(new RegExp('^' + namespaces + '$'));
12382 }
12383 }
12384
12385 for (i = 0; i < createDebug.instances.length; i++) {
12386 var instance = createDebug.instances[i];
12387 instance.enabled = createDebug.enabled(instance.namespace);
12388 }
12389 }
12390 /**
12391 * Disable debug output.
12392 *
12393 * @api public
12394 */
12395
12396
12397 function disable() {
12398 createDebug.enable('');
12399 }
12400 /**
12401 * Returns true if the given mode name is enabled, false otherwise.
12402 *
12403 * @param {String} name
12404 * @return {Boolean}
12405 * @api public
12406 */
12407
12408
12409 function enabled(name) {
12410 if (name[name.length - 1] === '*') {
12411 return true;
12412 }
12413
12414 var i;
12415 var len;
12416
12417 for (i = 0, len = createDebug.skips.length; i < len; i++) {
12418 if (createDebug.skips[i].test(name)) {
12419 return false;
12420 }
12421 }
12422
12423 for (i = 0, len = createDebug.names.length; i < len; i++) {
12424 if (createDebug.names[i].test(name)) {
12425 return true;
12426 }
12427 }
12428
12429 return false;
12430 }
12431 /**
12432 * Coerce `val`.
12433 *
12434 * @param {Mixed} val
12435 * @return {Mixed}
12436 * @api private
12437 */
12438
12439
12440 function coerce(val) {
12441 if (val instanceof Error) {
12442 return val.stack || val.message;
12443 }
12444
12445 return val;
12446 }
12447
12448 createDebug.enable(createDebug.load());
12449 return createDebug;
12450}
12451
12452module.exports = setup;
12453
12454
12455
12456/***/ }),
12457/* 417 */
12458/***/ (function(module, exports) {
12459
12460/**
12461 * Helpers.
12462 */
12463
12464var s = 1000;
12465var m = s * 60;
12466var h = m * 60;
12467var d = h * 24;
12468var w = d * 7;
12469var y = d * 365.25;
12470
12471/**
12472 * Parse or format the given `val`.
12473 *
12474 * Options:
12475 *
12476 * - `long` verbose formatting [false]
12477 *
12478 * @param {String|Number} val
12479 * @param {Object} [options]
12480 * @throws {Error} throw an error if val is not a non-empty string or a number
12481 * @return {String|Number}
12482 * @api public
12483 */
12484
12485module.exports = function(val, options) {
12486 options = options || {};
12487 var type = typeof val;
12488 if (type === 'string' && val.length > 0) {
12489 return parse(val);
12490 } else if (type === 'number' && isFinite(val)) {
12491 return options.long ? fmtLong(val) : fmtShort(val);
12492 }
12493 throw new Error(
12494 'val is not a non-empty string or a valid number. val=' +
12495 JSON.stringify(val)
12496 );
12497};
12498
12499/**
12500 * Parse the given `str` and return milliseconds.
12501 *
12502 * @param {String} str
12503 * @return {Number}
12504 * @api private
12505 */
12506
12507function parse(str) {
12508 str = String(str);
12509 if (str.length > 100) {
12510 return;
12511 }
12512 var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(
12513 str
12514 );
12515 if (!match) {
12516 return;
12517 }
12518 var n = parseFloat(match[1]);
12519 var type = (match[2] || 'ms').toLowerCase();
12520 switch (type) {
12521 case 'years':
12522 case 'year':
12523 case 'yrs':
12524 case 'yr':
12525 case 'y':
12526 return n * y;
12527 case 'weeks':
12528 case 'week':
12529 case 'w':
12530 return n * w;
12531 case 'days':
12532 case 'day':
12533 case 'd':
12534 return n * d;
12535 case 'hours':
12536 case 'hour':
12537 case 'hrs':
12538 case 'hr':
12539 case 'h':
12540 return n * h;
12541 case 'minutes':
12542 case 'minute':
12543 case 'mins':
12544 case 'min':
12545 case 'm':
12546 return n * m;
12547 case 'seconds':
12548 case 'second':
12549 case 'secs':
12550 case 'sec':
12551 case 's':
12552 return n * s;
12553 case 'milliseconds':
12554 case 'millisecond':
12555 case 'msecs':
12556 case 'msec':
12557 case 'ms':
12558 return n;
12559 default:
12560 return undefined;
12561 }
12562}
12563
12564/**
12565 * Short format for `ms`.
12566 *
12567 * @param {Number} ms
12568 * @return {String}
12569 * @api private
12570 */
12571
12572function fmtShort(ms) {
12573 var msAbs = Math.abs(ms);
12574 if (msAbs >= d) {
12575 return Math.round(ms / d) + 'd';
12576 }
12577 if (msAbs >= h) {
12578 return Math.round(ms / h) + 'h';
12579 }
12580 if (msAbs >= m) {
12581 return Math.round(ms / m) + 'm';
12582 }
12583 if (msAbs >= s) {
12584 return Math.round(ms / s) + 's';
12585 }
12586 return ms + 'ms';
12587}
12588
12589/**
12590 * Long format for `ms`.
12591 *
12592 * @param {Number} ms
12593 * @return {String}
12594 * @api private
12595 */
12596
12597function fmtLong(ms) {
12598 var msAbs = Math.abs(ms);
12599 if (msAbs >= d) {
12600 return plural(ms, msAbs, d, 'day');
12601 }
12602 if (msAbs >= h) {
12603 return plural(ms, msAbs, h, 'hour');
12604 }
12605 if (msAbs >= m) {
12606 return plural(ms, msAbs, m, 'minute');
12607 }
12608 if (msAbs >= s) {
12609 return plural(ms, msAbs, s, 'second');
12610 }
12611 return ms + ' ms';
12612}
12613
12614/**
12615 * Pluralization helper.
12616 */
12617
12618function plural(ms, msAbs, n, name) {
12619 var isPlural = msAbs >= n * 1.5;
12620 return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');
12621}
12622
12623
12624/***/ }),
12625/* 418 */
12626/***/ (function(module, exports, __webpack_require__) {
12627
12628__webpack_require__(419);
12629var path = __webpack_require__(7);
12630
12631module.exports = path.Object.getPrototypeOf;
12632
12633
12634/***/ }),
12635/* 419 */
12636/***/ (function(module, exports, __webpack_require__) {
12637
12638var $ = __webpack_require__(0);
12639var fails = __webpack_require__(2);
12640var toObject = __webpack_require__(33);
12641var nativeGetPrototypeOf = __webpack_require__(102);
12642var CORRECT_PROTOTYPE_GETTER = __webpack_require__(161);
12643
12644var FAILS_ON_PRIMITIVES = fails(function () { nativeGetPrototypeOf(1); });
12645
12646// `Object.getPrototypeOf` method
12647// https://tc39.es/ecma262/#sec-object.getprototypeof
12648$({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES, sham: !CORRECT_PROTOTYPE_GETTER }, {
12649 getPrototypeOf: function getPrototypeOf(it) {
12650 return nativeGetPrototypeOf(toObject(it));
12651 }
12652});
12653
12654
12655
12656/***/ }),
12657/* 420 */
12658/***/ (function(module, exports, __webpack_require__) {
12659
12660module.exports = __webpack_require__(237);
12661
12662/***/ }),
12663/* 421 */
12664/***/ (function(module, exports, __webpack_require__) {
12665
12666__webpack_require__(422);
12667var path = __webpack_require__(7);
12668
12669module.exports = path.Object.setPrototypeOf;
12670
12671
12672/***/ }),
12673/* 422 */
12674/***/ (function(module, exports, __webpack_require__) {
12675
12676var $ = __webpack_require__(0);
12677var setPrototypeOf = __webpack_require__(104);
12678
12679// `Object.setPrototypeOf` method
12680// https://tc39.es/ecma262/#sec-object.setprototypeof
12681$({ target: 'Object', stat: true }, {
12682 setPrototypeOf: setPrototypeOf
12683});
12684
12685
12686/***/ }),
12687/* 423 */
12688/***/ (function(module, exports, __webpack_require__) {
12689
12690"use strict";
12691
12692
12693var _interopRequireDefault = __webpack_require__(1);
12694
12695var _slice = _interopRequireDefault(__webpack_require__(34));
12696
12697var _concat = _interopRequireDefault(__webpack_require__(19));
12698
12699var _defineProperty = _interopRequireDefault(__webpack_require__(94));
12700
12701var AV = __webpack_require__(74);
12702
12703var AppRouter = __webpack_require__(429);
12704
12705var _require = __webpack_require__(32),
12706 isNullOrUndefined = _require.isNullOrUndefined;
12707
12708var _require2 = __webpack_require__(3),
12709 extend = _require2.extend,
12710 isObject = _require2.isObject,
12711 isEmpty = _require2.isEmpty;
12712
12713var isCNApp = function isCNApp(appId) {
12714 return (0, _slice.default)(appId).call(appId, -9) !== '-MdYXbMMI';
12715};
12716
12717var fillServerURLs = function fillServerURLs(url) {
12718 return {
12719 push: url,
12720 stats: url,
12721 engine: url,
12722 api: url,
12723 rtm: url
12724 };
12725};
12726
12727function getDefaultServerURLs(appId) {
12728 var _context, _context2, _context3, _context4, _context5;
12729
12730 if (isCNApp(appId)) {
12731 return {};
12732 }
12733
12734 var id = (0, _slice.default)(appId).call(appId, 0, 8).toLowerCase();
12735 var domain = 'lncldglobal.com';
12736 return {
12737 push: (0, _concat.default)(_context = "https://".concat(id, ".push.")).call(_context, domain),
12738 stats: (0, _concat.default)(_context2 = "https://".concat(id, ".stats.")).call(_context2, domain),
12739 engine: (0, _concat.default)(_context3 = "https://".concat(id, ".engine.")).call(_context3, domain),
12740 api: (0, _concat.default)(_context4 = "https://".concat(id, ".api.")).call(_context4, domain),
12741 rtm: (0, _concat.default)(_context5 = "https://".concat(id, ".rtm.")).call(_context5, domain)
12742 };
12743}
12744
12745var _disableAppRouter = false;
12746var _initialized = false;
12747/**
12748 * URLs for services
12749 * @typedef {Object} ServerURLs
12750 * @property {String} [api] serverURL for API service
12751 * @property {String} [engine] serverURL for engine service
12752 * @property {String} [stats] serverURL for stats service
12753 * @property {String} [push] serverURL for push service
12754 * @property {String} [rtm] serverURL for LiveQuery service
12755 */
12756
12757/**
12758 * Call this method first to set up your authentication tokens for AV.
12759 * You can get your app keys from the LeanCloud dashboard on http://leancloud.cn .
12760 * @function AV.init
12761 * @param {Object} options
12762 * @param {String} options.appId application id
12763 * @param {String} options.appKey application key
12764 * @param {String} [options.masterKey] application master key
12765 * @param {Boolean} [options.production]
12766 * @param {String|ServerURLs} [options.serverURL] URLs for services. if a string was given, it will be applied for all services.
12767 * @param {Boolean} [options.disableCurrentUser]
12768 */
12769
12770AV.init = function init(options) {
12771 if (!isObject(options)) {
12772 return AV.init({
12773 appId: options,
12774 appKey: arguments.length <= 1 ? undefined : arguments[1],
12775 masterKey: arguments.length <= 2 ? undefined : arguments[2]
12776 });
12777 }
12778
12779 var appId = options.appId,
12780 appKey = options.appKey,
12781 masterKey = options.masterKey,
12782 hookKey = options.hookKey,
12783 serverURL = options.serverURL,
12784 _options$serverURLs = options.serverURLs,
12785 serverURLs = _options$serverURLs === void 0 ? serverURL : _options$serverURLs,
12786 disableCurrentUser = options.disableCurrentUser,
12787 production = options.production,
12788 realtime = options.realtime;
12789 if (_initialized) console.warn('Initializing LeanCloud Storage SDK which has already been initialized. Reinitializing the SDK might cause problems like unexpected cross-app data writing and invalid relations.');
12790 if (!appId) throw new TypeError('appId must be a string');
12791 if (!appKey) throw new TypeError('appKey must be a string');
12792 if ("Browser" !== 'NODE_JS' && masterKey) console.warn('MasterKey is not supposed to be used at client side.');
12793
12794 if (isCNApp(appId)) {
12795 if (!serverURLs && isEmpty(AV._config.serverURLs)) {
12796 throw new TypeError("serverURL option is required for apps from CN region");
12797 }
12798 }
12799
12800 if (appId !== AV._config.applicationId) {
12801 // overwrite all keys when reinitializing as a new app
12802 AV._config.masterKey = masterKey;
12803 AV._config.hookKey = hookKey;
12804 } else {
12805 if (masterKey) AV._config.masterKey = masterKey;
12806 if (hookKey) AV._config.hookKey = hookKey;
12807 }
12808
12809 AV._config.applicationId = appId;
12810 AV._config.applicationKey = appKey;
12811
12812 if (!isNullOrUndefined(production)) {
12813 AV.setProduction(production);
12814 }
12815
12816 if (typeof disableCurrentUser !== 'undefined') AV._config.disableCurrentUser = disableCurrentUser;
12817 var disableAppRouter = _disableAppRouter || typeof serverURLs !== 'undefined';
12818
12819 if (!disableAppRouter) {
12820 AV._appRouter = new AppRouter(AV);
12821 }
12822
12823 AV._setServerURLs(extend({}, getDefaultServerURLs(appId), AV._config.serverURLs, typeof serverURLs === 'string' ? fillServerURLs(serverURLs) : serverURLs), disableAppRouter);
12824
12825 if (realtime) {
12826 AV._config.realtime = realtime;
12827 } else if (AV._sharedConfig.liveQueryRealtime) {
12828 var _AV$_config$serverURL = AV._config.serverURLs,
12829 api = _AV$_config$serverURL.api,
12830 rtm = _AV$_config$serverURL.rtm;
12831 AV._config.realtime = new AV._sharedConfig.liveQueryRealtime({
12832 appId: appId,
12833 appKey: appKey,
12834 server: {
12835 api: api,
12836 RTMRouter: rtm
12837 }
12838 });
12839 }
12840
12841 _initialized = true;
12842}; // If we're running in node.js, allow using the master key.
12843
12844
12845if (false) {
12846 AV.Cloud = AV.Cloud || {};
12847 /**
12848 * Switches the LeanCloud SDK to using the Master key. The Master key grants
12849 * priveleged access to the data in LeanCloud and can be used to bypass ACLs and
12850 * other restrictions that are applied to the client SDKs.
12851 * <p><strong><em>Available in Cloud Code and Node.js only.</em></strong>
12852 * </p>
12853 */
12854
12855 AV.Cloud.useMasterKey = function () {
12856 AV._config.useMasterKey = true;
12857 };
12858}
12859/**
12860 * Call this method to set production environment variable.
12861 * @function AV.setProduction
12862 * @param {Boolean} production True is production environment,and
12863 * it's true by default.
12864 */
12865
12866
12867AV.setProduction = function (production) {
12868 if (!isNullOrUndefined(production)) {
12869 AV._config.production = production ? 1 : 0;
12870 } else {
12871 // change to default value
12872 AV._config.production = null;
12873 }
12874};
12875
12876AV._setServerURLs = function (urls) {
12877 var disableAppRouter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
12878
12879 if (typeof urls !== 'string') {
12880 extend(AV._config.serverURLs, urls);
12881 } else {
12882 AV._config.serverURLs = fillServerURLs(urls);
12883 }
12884
12885 if (disableAppRouter) {
12886 if (AV._appRouter) {
12887 AV._appRouter.disable();
12888 } else {
12889 _disableAppRouter = true;
12890 }
12891 }
12892};
12893/**
12894 * Set server URLs for services.
12895 * @function AV.setServerURL
12896 * @since 4.3.0
12897 * @param {String|ServerURLs} urls URLs for services. if a string was given, it will be applied for all services.
12898 * You can also set them when initializing SDK with `options.serverURL`
12899 */
12900
12901
12902AV.setServerURL = function (urls) {
12903 return AV._setServerURLs(urls);
12904};
12905
12906AV.setServerURLs = AV.setServerURL;
12907
12908AV.keepErrorRawMessage = function (value) {
12909 AV._sharedConfig.keepErrorRawMessage = value;
12910};
12911/**
12912 * Set a deadline for requests to complete.
12913 * Note that file upload requests are not affected.
12914 * @function AV.setRequestTimeout
12915 * @since 3.6.0
12916 * @param {number} ms
12917 */
12918
12919
12920AV.setRequestTimeout = function (ms) {
12921 AV._config.requestTimeout = ms;
12922}; // backword compatible
12923
12924
12925AV.initialize = AV.init;
12926
12927var defineConfig = function defineConfig(property) {
12928 return (0, _defineProperty.default)(AV, property, {
12929 get: function get() {
12930 return AV._config[property];
12931 },
12932 set: function set(value) {
12933 AV._config[property] = value;
12934 }
12935 });
12936};
12937
12938['applicationId', 'applicationKey', 'masterKey', 'hookKey'].forEach(defineConfig);
12939
12940/***/ }),
12941/* 424 */
12942/***/ (function(module, exports, __webpack_require__) {
12943
12944var isPrototypeOf = __webpack_require__(16);
12945var method = __webpack_require__(425);
12946
12947var ArrayPrototype = Array.prototype;
12948
12949module.exports = function (it) {
12950 var own = it.slice;
12951 return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.slice) ? method : own;
12952};
12953
12954
12955/***/ }),
12956/* 425 */
12957/***/ (function(module, exports, __webpack_require__) {
12958
12959__webpack_require__(426);
12960var entryVirtual = __webpack_require__(27);
12961
12962module.exports = entryVirtual('Array').slice;
12963
12964
12965/***/ }),
12966/* 426 */
12967/***/ (function(module, exports, __webpack_require__) {
12968
12969"use strict";
12970
12971var $ = __webpack_require__(0);
12972var isArray = __webpack_require__(92);
12973var isConstructor = __webpack_require__(111);
12974var isObject = __webpack_require__(11);
12975var toAbsoluteIndex = __webpack_require__(126);
12976var lengthOfArrayLike = __webpack_require__(40);
12977var toIndexedObject = __webpack_require__(35);
12978var createProperty = __webpack_require__(93);
12979var wellKnownSymbol = __webpack_require__(5);
12980var arrayMethodHasSpeciesSupport = __webpack_require__(116);
12981var un$Slice = __webpack_require__(112);
12982
12983var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('slice');
12984
12985var SPECIES = wellKnownSymbol('species');
12986var $Array = Array;
12987var max = Math.max;
12988
12989// `Array.prototype.slice` method
12990// https://tc39.es/ecma262/#sec-array.prototype.slice
12991// fallback for not array-like ES3 strings and DOM objects
12992$({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT }, {
12993 slice: function slice(start, end) {
12994 var O = toIndexedObject(this);
12995 var length = lengthOfArrayLike(O);
12996 var k = toAbsoluteIndex(start, length);
12997 var fin = toAbsoluteIndex(end === undefined ? length : end, length);
12998 // inline `ArraySpeciesCreate` for usage native `Array#slice` where it's possible
12999 var Constructor, result, n;
13000 if (isArray(O)) {
13001 Constructor = O.constructor;
13002 // cross-realm fallback
13003 if (isConstructor(Constructor) && (Constructor === $Array || isArray(Constructor.prototype))) {
13004 Constructor = undefined;
13005 } else if (isObject(Constructor)) {
13006 Constructor = Constructor[SPECIES];
13007 if (Constructor === null) Constructor = undefined;
13008 }
13009 if (Constructor === $Array || Constructor === undefined) {
13010 return un$Slice(O, k, fin);
13011 }
13012 }
13013 result = new (Constructor === undefined ? $Array : Constructor)(max(fin - k, 0));
13014 for (n = 0; k < fin; k++, n++) if (k in O) createProperty(result, n, O[k]);
13015 result.length = n;
13016 return result;
13017 }
13018});
13019
13020
13021/***/ }),
13022/* 427 */
13023/***/ (function(module, exports, __webpack_require__) {
13024
13025__webpack_require__(428);
13026var path = __webpack_require__(7);
13027
13028var Object = path.Object;
13029
13030var defineProperty = module.exports = function defineProperty(it, key, desc) {
13031 return Object.defineProperty(it, key, desc);
13032};
13033
13034if (Object.defineProperty.sham) defineProperty.sham = true;
13035
13036
13037/***/ }),
13038/* 428 */
13039/***/ (function(module, exports, __webpack_require__) {
13040
13041var $ = __webpack_require__(0);
13042var DESCRIPTORS = __webpack_require__(14);
13043var defineProperty = __webpack_require__(23).f;
13044
13045// `Object.defineProperty` method
13046// https://tc39.es/ecma262/#sec-object.defineproperty
13047// eslint-disable-next-line es-x/no-object-defineproperty -- safe
13048$({ target: 'Object', stat: true, forced: Object.defineProperty !== defineProperty, sham: !DESCRIPTORS }, {
13049 defineProperty: defineProperty
13050});
13051
13052
13053/***/ }),
13054/* 429 */
13055/***/ (function(module, exports, __webpack_require__) {
13056
13057"use strict";
13058
13059
13060var ajax = __webpack_require__(117);
13061
13062var Cache = __webpack_require__(236);
13063
13064function AppRouter(AV) {
13065 var _this = this;
13066
13067 this.AV = AV;
13068 this.lockedUntil = 0;
13069 Cache.getAsync('serverURLs').then(function (data) {
13070 if (_this.disabled) return;
13071 if (!data) return _this.lock(0);
13072 var serverURLs = data.serverURLs,
13073 lockedUntil = data.lockedUntil;
13074
13075 _this.AV._setServerURLs(serverURLs, false);
13076
13077 _this.lockedUntil = lockedUntil;
13078 }).catch(function () {
13079 return _this.lock(0);
13080 });
13081}
13082
13083AppRouter.prototype.disable = function disable() {
13084 this.disabled = true;
13085};
13086
13087AppRouter.prototype.lock = function lock(ttl) {
13088 this.lockedUntil = Date.now() + ttl;
13089};
13090
13091AppRouter.prototype.refresh = function refresh() {
13092 var _this2 = this;
13093
13094 if (this.disabled) return;
13095 if (Date.now() < this.lockedUntil) return;
13096 this.lock(10);
13097 var url = 'https://app-router.com/2/route';
13098 return ajax({
13099 method: 'get',
13100 url: url,
13101 query: {
13102 appId: this.AV.applicationId
13103 }
13104 }).then(function (servers) {
13105 if (_this2.disabled) return;
13106 var ttl = servers.ttl;
13107 if (!ttl) throw new Error('missing ttl');
13108 ttl = ttl * 1000;
13109 var protocal = 'https://';
13110 var serverURLs = {
13111 push: protocal + servers.push_server,
13112 stats: protocal + servers.stats_server,
13113 engine: protocal + servers.engine_server,
13114 api: protocal + servers.api_server
13115 };
13116
13117 _this2.AV._setServerURLs(serverURLs, false);
13118
13119 _this2.lock(ttl);
13120
13121 return Cache.setAsync('serverURLs', {
13122 serverURLs: serverURLs,
13123 lockedUntil: _this2.lockedUntil
13124 }, ttl);
13125 }).catch(function (error) {
13126 // bypass all errors
13127 console.warn("refresh server URLs failed: ".concat(error.message));
13128
13129 _this2.lock(600);
13130 });
13131};
13132
13133module.exports = AppRouter;
13134
13135/***/ }),
13136/* 430 */
13137/***/ (function(module, exports, __webpack_require__) {
13138
13139module.exports = __webpack_require__(431);
13140
13141
13142/***/ }),
13143/* 431 */
13144/***/ (function(module, exports, __webpack_require__) {
13145
13146var parent = __webpack_require__(432);
13147__webpack_require__(454);
13148__webpack_require__(455);
13149__webpack_require__(456);
13150__webpack_require__(457);
13151__webpack_require__(458);
13152// TODO: Remove from `core-js@4`
13153__webpack_require__(459);
13154__webpack_require__(460);
13155__webpack_require__(461);
13156
13157module.exports = parent;
13158
13159
13160/***/ }),
13161/* 432 */
13162/***/ (function(module, exports, __webpack_require__) {
13163
13164var parent = __webpack_require__(241);
13165
13166module.exports = parent;
13167
13168
13169/***/ }),
13170/* 433 */
13171/***/ (function(module, exports, __webpack_require__) {
13172
13173__webpack_require__(227);
13174__webpack_require__(68);
13175__webpack_require__(242);
13176__webpack_require__(438);
13177__webpack_require__(439);
13178__webpack_require__(440);
13179__webpack_require__(441);
13180__webpack_require__(247);
13181__webpack_require__(442);
13182__webpack_require__(443);
13183__webpack_require__(444);
13184__webpack_require__(445);
13185__webpack_require__(446);
13186__webpack_require__(447);
13187__webpack_require__(448);
13188__webpack_require__(449);
13189__webpack_require__(450);
13190__webpack_require__(451);
13191__webpack_require__(452);
13192__webpack_require__(453);
13193var path = __webpack_require__(7);
13194
13195module.exports = path.Symbol;
13196
13197
13198/***/ }),
13199/* 434 */
13200/***/ (function(module, exports, __webpack_require__) {
13201
13202"use strict";
13203
13204var $ = __webpack_require__(0);
13205var global = __webpack_require__(8);
13206var call = __webpack_require__(15);
13207var uncurryThis = __webpack_require__(4);
13208var IS_PURE = __webpack_require__(36);
13209var DESCRIPTORS = __webpack_require__(14);
13210var NATIVE_SYMBOL = __webpack_require__(65);
13211var fails = __webpack_require__(2);
13212var hasOwn = __webpack_require__(13);
13213var isPrototypeOf = __webpack_require__(16);
13214var anObject = __webpack_require__(21);
13215var toIndexedObject = __webpack_require__(35);
13216var toPropertyKey = __webpack_require__(99);
13217var $toString = __webpack_require__(42);
13218var createPropertyDescriptor = __webpack_require__(49);
13219var nativeObjectCreate = __webpack_require__(53);
13220var objectKeys = __webpack_require__(107);
13221var getOwnPropertyNamesModule = __webpack_require__(105);
13222var getOwnPropertyNamesExternal = __webpack_require__(243);
13223var getOwnPropertySymbolsModule = __webpack_require__(106);
13224var getOwnPropertyDescriptorModule = __webpack_require__(64);
13225var definePropertyModule = __webpack_require__(23);
13226var definePropertiesModule = __webpack_require__(129);
13227var propertyIsEnumerableModule = __webpack_require__(121);
13228var defineBuiltIn = __webpack_require__(45);
13229var shared = __webpack_require__(82);
13230var sharedKey = __webpack_require__(103);
13231var hiddenKeys = __webpack_require__(83);
13232var uid = __webpack_require__(101);
13233var wellKnownSymbol = __webpack_require__(5);
13234var wrappedWellKnownSymbolModule = __webpack_require__(151);
13235var defineWellKnownSymbol = __webpack_require__(10);
13236var defineSymbolToPrimitive = __webpack_require__(245);
13237var setToStringTag = __webpack_require__(56);
13238var InternalStateModule = __webpack_require__(44);
13239var $forEach = __webpack_require__(75).forEach;
13240
13241var HIDDEN = sharedKey('hidden');
13242var SYMBOL = 'Symbol';
13243var PROTOTYPE = 'prototype';
13244
13245var setInternalState = InternalStateModule.set;
13246var getInternalState = InternalStateModule.getterFor(SYMBOL);
13247
13248var ObjectPrototype = Object[PROTOTYPE];
13249var $Symbol = global.Symbol;
13250var SymbolPrototype = $Symbol && $Symbol[PROTOTYPE];
13251var TypeError = global.TypeError;
13252var QObject = global.QObject;
13253var nativeGetOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
13254var nativeDefineProperty = definePropertyModule.f;
13255var nativeGetOwnPropertyNames = getOwnPropertyNamesExternal.f;
13256var nativePropertyIsEnumerable = propertyIsEnumerableModule.f;
13257var push = uncurryThis([].push);
13258
13259var AllSymbols = shared('symbols');
13260var ObjectPrototypeSymbols = shared('op-symbols');
13261var WellKnownSymbolsStore = shared('wks');
13262
13263// Don't use setters in Qt Script, https://github.com/zloirock/core-js/issues/173
13264var USE_SETTER = !QObject || !QObject[PROTOTYPE] || !QObject[PROTOTYPE].findChild;
13265
13266// fallback for old Android, https://code.google.com/p/v8/issues/detail?id=687
13267var setSymbolDescriptor = DESCRIPTORS && fails(function () {
13268 return nativeObjectCreate(nativeDefineProperty({}, 'a', {
13269 get: function () { return nativeDefineProperty(this, 'a', { value: 7 }).a; }
13270 })).a != 7;
13271}) ? function (O, P, Attributes) {
13272 var ObjectPrototypeDescriptor = nativeGetOwnPropertyDescriptor(ObjectPrototype, P);
13273 if (ObjectPrototypeDescriptor) delete ObjectPrototype[P];
13274 nativeDefineProperty(O, P, Attributes);
13275 if (ObjectPrototypeDescriptor && O !== ObjectPrototype) {
13276 nativeDefineProperty(ObjectPrototype, P, ObjectPrototypeDescriptor);
13277 }
13278} : nativeDefineProperty;
13279
13280var wrap = function (tag, description) {
13281 var symbol = AllSymbols[tag] = nativeObjectCreate(SymbolPrototype);
13282 setInternalState(symbol, {
13283 type: SYMBOL,
13284 tag: tag,
13285 description: description
13286 });
13287 if (!DESCRIPTORS) symbol.description = description;
13288 return symbol;
13289};
13290
13291var $defineProperty = function defineProperty(O, P, Attributes) {
13292 if (O === ObjectPrototype) $defineProperty(ObjectPrototypeSymbols, P, Attributes);
13293 anObject(O);
13294 var key = toPropertyKey(P);
13295 anObject(Attributes);
13296 if (hasOwn(AllSymbols, key)) {
13297 if (!Attributes.enumerable) {
13298 if (!hasOwn(O, HIDDEN)) nativeDefineProperty(O, HIDDEN, createPropertyDescriptor(1, {}));
13299 O[HIDDEN][key] = true;
13300 } else {
13301 if (hasOwn(O, HIDDEN) && O[HIDDEN][key]) O[HIDDEN][key] = false;
13302 Attributes = nativeObjectCreate(Attributes, { enumerable: createPropertyDescriptor(0, false) });
13303 } return setSymbolDescriptor(O, key, Attributes);
13304 } return nativeDefineProperty(O, key, Attributes);
13305};
13306
13307var $defineProperties = function defineProperties(O, Properties) {
13308 anObject(O);
13309 var properties = toIndexedObject(Properties);
13310 var keys = objectKeys(properties).concat($getOwnPropertySymbols(properties));
13311 $forEach(keys, function (key) {
13312 if (!DESCRIPTORS || call($propertyIsEnumerable, properties, key)) $defineProperty(O, key, properties[key]);
13313 });
13314 return O;
13315};
13316
13317var $create = function create(O, Properties) {
13318 return Properties === undefined ? nativeObjectCreate(O) : $defineProperties(nativeObjectCreate(O), Properties);
13319};
13320
13321var $propertyIsEnumerable = function propertyIsEnumerable(V) {
13322 var P = toPropertyKey(V);
13323 var enumerable = call(nativePropertyIsEnumerable, this, P);
13324 if (this === ObjectPrototype && hasOwn(AllSymbols, P) && !hasOwn(ObjectPrototypeSymbols, P)) return false;
13325 return enumerable || !hasOwn(this, P) || !hasOwn(AllSymbols, P) || hasOwn(this, HIDDEN) && this[HIDDEN][P]
13326 ? enumerable : true;
13327};
13328
13329var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(O, P) {
13330 var it = toIndexedObject(O);
13331 var key = toPropertyKey(P);
13332 if (it === ObjectPrototype && hasOwn(AllSymbols, key) && !hasOwn(ObjectPrototypeSymbols, key)) return;
13333 var descriptor = nativeGetOwnPropertyDescriptor(it, key);
13334 if (descriptor && hasOwn(AllSymbols, key) && !(hasOwn(it, HIDDEN) && it[HIDDEN][key])) {
13335 descriptor.enumerable = true;
13336 }
13337 return descriptor;
13338};
13339
13340var $getOwnPropertyNames = function getOwnPropertyNames(O) {
13341 var names = nativeGetOwnPropertyNames(toIndexedObject(O));
13342 var result = [];
13343 $forEach(names, function (key) {
13344 if (!hasOwn(AllSymbols, key) && !hasOwn(hiddenKeys, key)) push(result, key);
13345 });
13346 return result;
13347};
13348
13349var $getOwnPropertySymbols = function (O) {
13350 var IS_OBJECT_PROTOTYPE = O === ObjectPrototype;
13351 var names = nativeGetOwnPropertyNames(IS_OBJECT_PROTOTYPE ? ObjectPrototypeSymbols : toIndexedObject(O));
13352 var result = [];
13353 $forEach(names, function (key) {
13354 if (hasOwn(AllSymbols, key) && (!IS_OBJECT_PROTOTYPE || hasOwn(ObjectPrototype, key))) {
13355 push(result, AllSymbols[key]);
13356 }
13357 });
13358 return result;
13359};
13360
13361// `Symbol` constructor
13362// https://tc39.es/ecma262/#sec-symbol-constructor
13363if (!NATIVE_SYMBOL) {
13364 $Symbol = function Symbol() {
13365 if (isPrototypeOf(SymbolPrototype, this)) throw TypeError('Symbol is not a constructor');
13366 var description = !arguments.length || arguments[0] === undefined ? undefined : $toString(arguments[0]);
13367 var tag = uid(description);
13368 var setter = function (value) {
13369 if (this === ObjectPrototype) call(setter, ObjectPrototypeSymbols, value);
13370 if (hasOwn(this, HIDDEN) && hasOwn(this[HIDDEN], tag)) this[HIDDEN][tag] = false;
13371 setSymbolDescriptor(this, tag, createPropertyDescriptor(1, value));
13372 };
13373 if (DESCRIPTORS && USE_SETTER) setSymbolDescriptor(ObjectPrototype, tag, { configurable: true, set: setter });
13374 return wrap(tag, description);
13375 };
13376
13377 SymbolPrototype = $Symbol[PROTOTYPE];
13378
13379 defineBuiltIn(SymbolPrototype, 'toString', function toString() {
13380 return getInternalState(this).tag;
13381 });
13382
13383 defineBuiltIn($Symbol, 'withoutSetter', function (description) {
13384 return wrap(uid(description), description);
13385 });
13386
13387 propertyIsEnumerableModule.f = $propertyIsEnumerable;
13388 definePropertyModule.f = $defineProperty;
13389 definePropertiesModule.f = $defineProperties;
13390 getOwnPropertyDescriptorModule.f = $getOwnPropertyDescriptor;
13391 getOwnPropertyNamesModule.f = getOwnPropertyNamesExternal.f = $getOwnPropertyNames;
13392 getOwnPropertySymbolsModule.f = $getOwnPropertySymbols;
13393
13394 wrappedWellKnownSymbolModule.f = function (name) {
13395 return wrap(wellKnownSymbol(name), name);
13396 };
13397
13398 if (DESCRIPTORS) {
13399 // https://github.com/tc39/proposal-Symbol-description
13400 nativeDefineProperty(SymbolPrototype, 'description', {
13401 configurable: true,
13402 get: function description() {
13403 return getInternalState(this).description;
13404 }
13405 });
13406 if (!IS_PURE) {
13407 defineBuiltIn(ObjectPrototype, 'propertyIsEnumerable', $propertyIsEnumerable, { unsafe: true });
13408 }
13409 }
13410}
13411
13412$({ global: true, constructor: true, wrap: true, forced: !NATIVE_SYMBOL, sham: !NATIVE_SYMBOL }, {
13413 Symbol: $Symbol
13414});
13415
13416$forEach(objectKeys(WellKnownSymbolsStore), function (name) {
13417 defineWellKnownSymbol(name);
13418});
13419
13420$({ target: SYMBOL, stat: true, forced: !NATIVE_SYMBOL }, {
13421 useSetter: function () { USE_SETTER = true; },
13422 useSimple: function () { USE_SETTER = false; }
13423});
13424
13425$({ target: 'Object', stat: true, forced: !NATIVE_SYMBOL, sham: !DESCRIPTORS }, {
13426 // `Object.create` method
13427 // https://tc39.es/ecma262/#sec-object.create
13428 create: $create,
13429 // `Object.defineProperty` method
13430 // https://tc39.es/ecma262/#sec-object.defineproperty
13431 defineProperty: $defineProperty,
13432 // `Object.defineProperties` method
13433 // https://tc39.es/ecma262/#sec-object.defineproperties
13434 defineProperties: $defineProperties,
13435 // `Object.getOwnPropertyDescriptor` method
13436 // https://tc39.es/ecma262/#sec-object.getownpropertydescriptors
13437 getOwnPropertyDescriptor: $getOwnPropertyDescriptor
13438});
13439
13440$({ target: 'Object', stat: true, forced: !NATIVE_SYMBOL }, {
13441 // `Object.getOwnPropertyNames` method
13442 // https://tc39.es/ecma262/#sec-object.getownpropertynames
13443 getOwnPropertyNames: $getOwnPropertyNames
13444});
13445
13446// `Symbol.prototype[@@toPrimitive]` method
13447// https://tc39.es/ecma262/#sec-symbol.prototype-@@toprimitive
13448defineSymbolToPrimitive();
13449
13450// `Symbol.prototype[@@toStringTag]` property
13451// https://tc39.es/ecma262/#sec-symbol.prototype-@@tostringtag
13452setToStringTag($Symbol, SYMBOL);
13453
13454hiddenKeys[HIDDEN] = true;
13455
13456
13457/***/ }),
13458/* 435 */
13459/***/ (function(module, exports, __webpack_require__) {
13460
13461var $ = __webpack_require__(0);
13462var getBuiltIn = __webpack_require__(20);
13463var hasOwn = __webpack_require__(13);
13464var toString = __webpack_require__(42);
13465var shared = __webpack_require__(82);
13466var NATIVE_SYMBOL_REGISTRY = __webpack_require__(246);
13467
13468var StringToSymbolRegistry = shared('string-to-symbol-registry');
13469var SymbolToStringRegistry = shared('symbol-to-string-registry');
13470
13471// `Symbol.for` method
13472// https://tc39.es/ecma262/#sec-symbol.for
13473$({ target: 'Symbol', stat: true, forced: !NATIVE_SYMBOL_REGISTRY }, {
13474 'for': function (key) {
13475 var string = toString(key);
13476 if (hasOwn(StringToSymbolRegistry, string)) return StringToSymbolRegistry[string];
13477 var symbol = getBuiltIn('Symbol')(string);
13478 StringToSymbolRegistry[string] = symbol;
13479 SymbolToStringRegistry[symbol] = string;
13480 return symbol;
13481 }
13482});
13483
13484
13485/***/ }),
13486/* 436 */
13487/***/ (function(module, exports, __webpack_require__) {
13488
13489var $ = __webpack_require__(0);
13490var hasOwn = __webpack_require__(13);
13491var isSymbol = __webpack_require__(100);
13492var tryToString = __webpack_require__(67);
13493var shared = __webpack_require__(82);
13494var NATIVE_SYMBOL_REGISTRY = __webpack_require__(246);
13495
13496var SymbolToStringRegistry = shared('symbol-to-string-registry');
13497
13498// `Symbol.keyFor` method
13499// https://tc39.es/ecma262/#sec-symbol.keyfor
13500$({ target: 'Symbol', stat: true, forced: !NATIVE_SYMBOL_REGISTRY }, {
13501 keyFor: function keyFor(sym) {
13502 if (!isSymbol(sym)) throw TypeError(tryToString(sym) + ' is not a symbol');
13503 if (hasOwn(SymbolToStringRegistry, sym)) return SymbolToStringRegistry[sym];
13504 }
13505});
13506
13507
13508/***/ }),
13509/* 437 */
13510/***/ (function(module, exports, __webpack_require__) {
13511
13512var $ = __webpack_require__(0);
13513var NATIVE_SYMBOL = __webpack_require__(65);
13514var fails = __webpack_require__(2);
13515var getOwnPropertySymbolsModule = __webpack_require__(106);
13516var toObject = __webpack_require__(33);
13517
13518// V8 ~ Chrome 38 and 39 `Object.getOwnPropertySymbols` fails on primitives
13519// https://bugs.chromium.org/p/v8/issues/detail?id=3443
13520var FORCED = !NATIVE_SYMBOL || fails(function () { getOwnPropertySymbolsModule.f(1); });
13521
13522// `Object.getOwnPropertySymbols` method
13523// https://tc39.es/ecma262/#sec-object.getownpropertysymbols
13524$({ target: 'Object', stat: true, forced: FORCED }, {
13525 getOwnPropertySymbols: function getOwnPropertySymbols(it) {
13526 var $getOwnPropertySymbols = getOwnPropertySymbolsModule.f;
13527 return $getOwnPropertySymbols ? $getOwnPropertySymbols(toObject(it)) : [];
13528 }
13529});
13530
13531
13532/***/ }),
13533/* 438 */
13534/***/ (function(module, exports, __webpack_require__) {
13535
13536var defineWellKnownSymbol = __webpack_require__(10);
13537
13538// `Symbol.asyncIterator` well-known symbol
13539// https://tc39.es/ecma262/#sec-symbol.asynciterator
13540defineWellKnownSymbol('asyncIterator');
13541
13542
13543/***/ }),
13544/* 439 */
13545/***/ (function(module, exports) {
13546
13547// empty
13548
13549
13550/***/ }),
13551/* 440 */
13552/***/ (function(module, exports, __webpack_require__) {
13553
13554var defineWellKnownSymbol = __webpack_require__(10);
13555
13556// `Symbol.hasInstance` well-known symbol
13557// https://tc39.es/ecma262/#sec-symbol.hasinstance
13558defineWellKnownSymbol('hasInstance');
13559
13560
13561/***/ }),
13562/* 441 */
13563/***/ (function(module, exports, __webpack_require__) {
13564
13565var defineWellKnownSymbol = __webpack_require__(10);
13566
13567// `Symbol.isConcatSpreadable` well-known symbol
13568// https://tc39.es/ecma262/#sec-symbol.isconcatspreadable
13569defineWellKnownSymbol('isConcatSpreadable');
13570
13571
13572/***/ }),
13573/* 442 */
13574/***/ (function(module, exports, __webpack_require__) {
13575
13576var defineWellKnownSymbol = __webpack_require__(10);
13577
13578// `Symbol.match` well-known symbol
13579// https://tc39.es/ecma262/#sec-symbol.match
13580defineWellKnownSymbol('match');
13581
13582
13583/***/ }),
13584/* 443 */
13585/***/ (function(module, exports, __webpack_require__) {
13586
13587var defineWellKnownSymbol = __webpack_require__(10);
13588
13589// `Symbol.matchAll` well-known symbol
13590// https://tc39.es/ecma262/#sec-symbol.matchall
13591defineWellKnownSymbol('matchAll');
13592
13593
13594/***/ }),
13595/* 444 */
13596/***/ (function(module, exports, __webpack_require__) {
13597
13598var defineWellKnownSymbol = __webpack_require__(10);
13599
13600// `Symbol.replace` well-known symbol
13601// https://tc39.es/ecma262/#sec-symbol.replace
13602defineWellKnownSymbol('replace');
13603
13604
13605/***/ }),
13606/* 445 */
13607/***/ (function(module, exports, __webpack_require__) {
13608
13609var defineWellKnownSymbol = __webpack_require__(10);
13610
13611// `Symbol.search` well-known symbol
13612// https://tc39.es/ecma262/#sec-symbol.search
13613defineWellKnownSymbol('search');
13614
13615
13616/***/ }),
13617/* 446 */
13618/***/ (function(module, exports, __webpack_require__) {
13619
13620var defineWellKnownSymbol = __webpack_require__(10);
13621
13622// `Symbol.species` well-known symbol
13623// https://tc39.es/ecma262/#sec-symbol.species
13624defineWellKnownSymbol('species');
13625
13626
13627/***/ }),
13628/* 447 */
13629/***/ (function(module, exports, __webpack_require__) {
13630
13631var defineWellKnownSymbol = __webpack_require__(10);
13632
13633// `Symbol.split` well-known symbol
13634// https://tc39.es/ecma262/#sec-symbol.split
13635defineWellKnownSymbol('split');
13636
13637
13638/***/ }),
13639/* 448 */
13640/***/ (function(module, exports, __webpack_require__) {
13641
13642var defineWellKnownSymbol = __webpack_require__(10);
13643var defineSymbolToPrimitive = __webpack_require__(245);
13644
13645// `Symbol.toPrimitive` well-known symbol
13646// https://tc39.es/ecma262/#sec-symbol.toprimitive
13647defineWellKnownSymbol('toPrimitive');
13648
13649// `Symbol.prototype[@@toPrimitive]` method
13650// https://tc39.es/ecma262/#sec-symbol.prototype-@@toprimitive
13651defineSymbolToPrimitive();
13652
13653
13654/***/ }),
13655/* 449 */
13656/***/ (function(module, exports, __webpack_require__) {
13657
13658var getBuiltIn = __webpack_require__(20);
13659var defineWellKnownSymbol = __webpack_require__(10);
13660var setToStringTag = __webpack_require__(56);
13661
13662// `Symbol.toStringTag` well-known symbol
13663// https://tc39.es/ecma262/#sec-symbol.tostringtag
13664defineWellKnownSymbol('toStringTag');
13665
13666// `Symbol.prototype[@@toStringTag]` property
13667// https://tc39.es/ecma262/#sec-symbol.prototype-@@tostringtag
13668setToStringTag(getBuiltIn('Symbol'), 'Symbol');
13669
13670
13671/***/ }),
13672/* 450 */
13673/***/ (function(module, exports, __webpack_require__) {
13674
13675var defineWellKnownSymbol = __webpack_require__(10);
13676
13677// `Symbol.unscopables` well-known symbol
13678// https://tc39.es/ecma262/#sec-symbol.unscopables
13679defineWellKnownSymbol('unscopables');
13680
13681
13682/***/ }),
13683/* 451 */
13684/***/ (function(module, exports, __webpack_require__) {
13685
13686var global = __webpack_require__(8);
13687var setToStringTag = __webpack_require__(56);
13688
13689// JSON[@@toStringTag] property
13690// https://tc39.es/ecma262/#sec-json-@@tostringtag
13691setToStringTag(global.JSON, 'JSON', true);
13692
13693
13694/***/ }),
13695/* 452 */
13696/***/ (function(module, exports) {
13697
13698// empty
13699
13700
13701/***/ }),
13702/* 453 */
13703/***/ (function(module, exports) {
13704
13705// empty
13706
13707
13708/***/ }),
13709/* 454 */
13710/***/ (function(module, exports, __webpack_require__) {
13711
13712var defineWellKnownSymbol = __webpack_require__(10);
13713
13714// `Symbol.asyncDispose` well-known symbol
13715// https://github.com/tc39/proposal-using-statement
13716defineWellKnownSymbol('asyncDispose');
13717
13718
13719/***/ }),
13720/* 455 */
13721/***/ (function(module, exports, __webpack_require__) {
13722
13723var defineWellKnownSymbol = __webpack_require__(10);
13724
13725// `Symbol.dispose` well-known symbol
13726// https://github.com/tc39/proposal-using-statement
13727defineWellKnownSymbol('dispose');
13728
13729
13730/***/ }),
13731/* 456 */
13732/***/ (function(module, exports, __webpack_require__) {
13733
13734var defineWellKnownSymbol = __webpack_require__(10);
13735
13736// `Symbol.matcher` well-known symbol
13737// https://github.com/tc39/proposal-pattern-matching
13738defineWellKnownSymbol('matcher');
13739
13740
13741/***/ }),
13742/* 457 */
13743/***/ (function(module, exports, __webpack_require__) {
13744
13745var defineWellKnownSymbol = __webpack_require__(10);
13746
13747// `Symbol.metadataKey` well-known symbol
13748// https://github.com/tc39/proposal-decorator-metadata
13749defineWellKnownSymbol('metadataKey');
13750
13751
13752/***/ }),
13753/* 458 */
13754/***/ (function(module, exports, __webpack_require__) {
13755
13756var defineWellKnownSymbol = __webpack_require__(10);
13757
13758// `Symbol.observable` well-known symbol
13759// https://github.com/tc39/proposal-observable
13760defineWellKnownSymbol('observable');
13761
13762
13763/***/ }),
13764/* 459 */
13765/***/ (function(module, exports, __webpack_require__) {
13766
13767// TODO: Remove from `core-js@4`
13768var defineWellKnownSymbol = __webpack_require__(10);
13769
13770// `Symbol.metadata` well-known symbol
13771// https://github.com/tc39/proposal-decorators
13772defineWellKnownSymbol('metadata');
13773
13774
13775/***/ }),
13776/* 460 */
13777/***/ (function(module, exports, __webpack_require__) {
13778
13779// TODO: remove from `core-js@4`
13780var defineWellKnownSymbol = __webpack_require__(10);
13781
13782// `Symbol.patternMatch` well-known symbol
13783// https://github.com/tc39/proposal-pattern-matching
13784defineWellKnownSymbol('patternMatch');
13785
13786
13787/***/ }),
13788/* 461 */
13789/***/ (function(module, exports, __webpack_require__) {
13790
13791// TODO: remove from `core-js@4`
13792var defineWellKnownSymbol = __webpack_require__(10);
13793
13794defineWellKnownSymbol('replaceAll');
13795
13796
13797/***/ }),
13798/* 462 */
13799/***/ (function(module, exports, __webpack_require__) {
13800
13801module.exports = __webpack_require__(463);
13802
13803/***/ }),
13804/* 463 */
13805/***/ (function(module, exports, __webpack_require__) {
13806
13807module.exports = __webpack_require__(464);
13808
13809
13810/***/ }),
13811/* 464 */
13812/***/ (function(module, exports, __webpack_require__) {
13813
13814var parent = __webpack_require__(465);
13815
13816module.exports = parent;
13817
13818
13819/***/ }),
13820/* 465 */
13821/***/ (function(module, exports, __webpack_require__) {
13822
13823var parent = __webpack_require__(248);
13824
13825module.exports = parent;
13826
13827
13828/***/ }),
13829/* 466 */
13830/***/ (function(module, exports, __webpack_require__) {
13831
13832__webpack_require__(43);
13833__webpack_require__(68);
13834__webpack_require__(70);
13835__webpack_require__(247);
13836var WrappedWellKnownSymbolModule = __webpack_require__(151);
13837
13838module.exports = WrappedWellKnownSymbolModule.f('iterator');
13839
13840
13841/***/ }),
13842/* 467 */
13843/***/ (function(module, exports, __webpack_require__) {
13844
13845var parent = __webpack_require__(468);
13846
13847module.exports = parent;
13848
13849
13850/***/ }),
13851/* 468 */
13852/***/ (function(module, exports, __webpack_require__) {
13853
13854var isPrototypeOf = __webpack_require__(16);
13855var method = __webpack_require__(469);
13856
13857var ArrayPrototype = Array.prototype;
13858
13859module.exports = function (it) {
13860 var own = it.filter;
13861 return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.filter) ? method : own;
13862};
13863
13864
13865/***/ }),
13866/* 469 */
13867/***/ (function(module, exports, __webpack_require__) {
13868
13869__webpack_require__(470);
13870var entryVirtual = __webpack_require__(27);
13871
13872module.exports = entryVirtual('Array').filter;
13873
13874
13875/***/ }),
13876/* 470 */
13877/***/ (function(module, exports, __webpack_require__) {
13878
13879"use strict";
13880
13881var $ = __webpack_require__(0);
13882var $filter = __webpack_require__(75).filter;
13883var arrayMethodHasSpeciesSupport = __webpack_require__(116);
13884
13885var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('filter');
13886
13887// `Array.prototype.filter` method
13888// https://tc39.es/ecma262/#sec-array.prototype.filter
13889// with adding support of @@species
13890$({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT }, {
13891 filter: function filter(callbackfn /* , thisArg */) {
13892 return $filter(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
13893 }
13894});
13895
13896
13897/***/ }),
13898/* 471 */
13899/***/ (function(module, exports, __webpack_require__) {
13900
13901"use strict";
13902
13903
13904var _interopRequireDefault = __webpack_require__(1);
13905
13906var _slice = _interopRequireDefault(__webpack_require__(34));
13907
13908var _keys = _interopRequireDefault(__webpack_require__(62));
13909
13910var _concat = _interopRequireDefault(__webpack_require__(19));
13911
13912var _ = __webpack_require__(3);
13913
13914module.exports = function (AV) {
13915 var eventSplitter = /\s+/;
13916 var slice = (0, _slice.default)(Array.prototype);
13917 /**
13918 * @class
13919 *
13920 * <p>AV.Events is a fork of Backbone's Events module, provided for your
13921 * convenience.</p>
13922 *
13923 * <p>A module that can be mixed in to any object in order to provide
13924 * it with custom events. You may bind callback functions to an event
13925 * with `on`, or remove these functions with `off`.
13926 * Triggering an event fires all callbacks in the order that `on` was
13927 * called.
13928 *
13929 * @private
13930 * @example
13931 * var object = {};
13932 * _.extend(object, AV.Events);
13933 * object.on('expand', function(){ alert('expanded'); });
13934 * object.trigger('expand');</pre></p>
13935 *
13936 */
13937
13938 AV.Events = {
13939 /**
13940 * Bind one or more space separated events, `events`, to a `callback`
13941 * function. Passing `"all"` will bind the callback to all events fired.
13942 */
13943 on: function on(events, callback, context) {
13944 var calls, event, node, tail, list;
13945
13946 if (!callback) {
13947 return this;
13948 }
13949
13950 events = events.split(eventSplitter);
13951 calls = this._callbacks || (this._callbacks = {}); // Create an immutable callback list, allowing traversal during
13952 // modification. The tail is an empty object that will always be used
13953 // as the next node.
13954
13955 event = events.shift();
13956
13957 while (event) {
13958 list = calls[event];
13959 node = list ? list.tail : {};
13960 node.next = tail = {};
13961 node.context = context;
13962 node.callback = callback;
13963 calls[event] = {
13964 tail: tail,
13965 next: list ? list.next : node
13966 };
13967 event = events.shift();
13968 }
13969
13970 return this;
13971 },
13972
13973 /**
13974 * Remove one or many callbacks. If `context` is null, removes all callbacks
13975 * with that function. If `callback` is null, removes all callbacks for the
13976 * event. If `events` is null, removes all bound callbacks for all events.
13977 */
13978 off: function off(events, callback, context) {
13979 var event, calls, node, tail, cb, ctx; // No events, or removing *all* events.
13980
13981 if (!(calls = this._callbacks)) {
13982 return;
13983 }
13984
13985 if (!(events || callback || context)) {
13986 delete this._callbacks;
13987 return this;
13988 } // Loop through the listed events and contexts, splicing them out of the
13989 // linked list of callbacks if appropriate.
13990
13991
13992 events = events ? events.split(eventSplitter) : (0, _keys.default)(_).call(_, calls);
13993 event = events.shift();
13994
13995 while (event) {
13996 node = calls[event];
13997 delete calls[event];
13998
13999 if (!node || !(callback || context)) {
14000 continue;
14001 } // Create a new list, omitting the indicated callbacks.
14002
14003
14004 tail = node.tail;
14005 node = node.next;
14006
14007 while (node !== tail) {
14008 cb = node.callback;
14009 ctx = node.context;
14010
14011 if (callback && cb !== callback || context && ctx !== context) {
14012 this.on(event, cb, ctx);
14013 }
14014
14015 node = node.next;
14016 }
14017
14018 event = events.shift();
14019 }
14020
14021 return this;
14022 },
14023
14024 /**
14025 * Trigger one or many events, firing all bound callbacks. Callbacks are
14026 * passed the same arguments as `trigger` is, apart from the event name
14027 * (unless you're listening on `"all"`, which will cause your callback to
14028 * receive the true name of the event as the first argument).
14029 */
14030 trigger: function trigger(events) {
14031 var event, node, calls, tail, args, all, rest;
14032
14033 if (!(calls = this._callbacks)) {
14034 return this;
14035 }
14036
14037 all = calls.all;
14038 events = events.split(eventSplitter);
14039 rest = slice.call(arguments, 1); // For each event, walk through the linked list of callbacks twice,
14040 // first to trigger the event, then to trigger any `"all"` callbacks.
14041
14042 event = events.shift();
14043
14044 while (event) {
14045 node = calls[event];
14046
14047 if (node) {
14048 tail = node.tail;
14049
14050 while ((node = node.next) !== tail) {
14051 node.callback.apply(node.context || this, rest);
14052 }
14053 }
14054
14055 node = all;
14056
14057 if (node) {
14058 var _context;
14059
14060 tail = node.tail;
14061 args = (0, _concat.default)(_context = [event]).call(_context, rest);
14062
14063 while ((node = node.next) !== tail) {
14064 node.callback.apply(node.context || this, args);
14065 }
14066 }
14067
14068 event = events.shift();
14069 }
14070
14071 return this;
14072 }
14073 };
14074 /**
14075 * @function
14076 */
14077
14078 AV.Events.bind = AV.Events.on;
14079 /**
14080 * @function
14081 */
14082
14083 AV.Events.unbind = AV.Events.off;
14084};
14085
14086/***/ }),
14087/* 472 */
14088/***/ (function(module, exports, __webpack_require__) {
14089
14090"use strict";
14091
14092
14093var _interopRequireDefault = __webpack_require__(1);
14094
14095var _promise = _interopRequireDefault(__webpack_require__(12));
14096
14097var _ = __webpack_require__(3);
14098/*global navigator: false */
14099
14100
14101module.exports = function (AV) {
14102 /**
14103 * Creates a new GeoPoint with any of the following forms:<br>
14104 * @example
14105 * new GeoPoint(otherGeoPoint)
14106 * new GeoPoint(30, 30)
14107 * new GeoPoint([30, 30])
14108 * new GeoPoint({latitude: 30, longitude: 30})
14109 * new GeoPoint() // defaults to (0, 0)
14110 * @class
14111 *
14112 * <p>Represents a latitude / longitude point that may be associated
14113 * with a key in a AVObject or used as a reference point for geo queries.
14114 * This allows proximity-based queries on the key.</p>
14115 *
14116 * <p>Only one key in a class may contain a GeoPoint.</p>
14117 *
14118 * <p>Example:<pre>
14119 * var point = new AV.GeoPoint(30.0, -20.0);
14120 * var object = new AV.Object("PlaceObject");
14121 * object.set("location", point);
14122 * object.save();</pre></p>
14123 */
14124 AV.GeoPoint = function (arg1, arg2) {
14125 if (_.isArray(arg1)) {
14126 AV.GeoPoint._validate(arg1[0], arg1[1]);
14127
14128 this.latitude = arg1[0];
14129 this.longitude = arg1[1];
14130 } else if (_.isObject(arg1)) {
14131 AV.GeoPoint._validate(arg1.latitude, arg1.longitude);
14132
14133 this.latitude = arg1.latitude;
14134 this.longitude = arg1.longitude;
14135 } else if (_.isNumber(arg1) && _.isNumber(arg2)) {
14136 AV.GeoPoint._validate(arg1, arg2);
14137
14138 this.latitude = arg1;
14139 this.longitude = arg2;
14140 } else {
14141 this.latitude = 0;
14142 this.longitude = 0;
14143 } // Add properties so that anyone using Webkit or Mozilla will get an error
14144 // if they try to set values that are out of bounds.
14145
14146
14147 var self = this;
14148
14149 if (this.__defineGetter__ && this.__defineSetter__) {
14150 // Use _latitude and _longitude to actually store the values, and add
14151 // getters and setters for latitude and longitude.
14152 this._latitude = this.latitude;
14153 this._longitude = this.longitude;
14154
14155 this.__defineGetter__('latitude', function () {
14156 return self._latitude;
14157 });
14158
14159 this.__defineGetter__('longitude', function () {
14160 return self._longitude;
14161 });
14162
14163 this.__defineSetter__('latitude', function (val) {
14164 AV.GeoPoint._validate(val, self.longitude);
14165
14166 self._latitude = val;
14167 });
14168
14169 this.__defineSetter__('longitude', function (val) {
14170 AV.GeoPoint._validate(self.latitude, val);
14171
14172 self._longitude = val;
14173 });
14174 }
14175 };
14176 /**
14177 * @lends AV.GeoPoint.prototype
14178 * @property {float} latitude North-south portion of the coordinate, in range
14179 * [-90, 90]. Throws an exception if set out of range in a modern browser.
14180 * @property {float} longitude East-west portion of the coordinate, in range
14181 * [-180, 180]. Throws if set out of range in a modern browser.
14182 */
14183
14184 /**
14185 * Throws an exception if the given lat-long is out of bounds.
14186 * @private
14187 */
14188
14189
14190 AV.GeoPoint._validate = function (latitude, longitude) {
14191 if (latitude < -90.0) {
14192 throw new Error('AV.GeoPoint latitude ' + latitude + ' < -90.0.');
14193 }
14194
14195 if (latitude > 90.0) {
14196 throw new Error('AV.GeoPoint latitude ' + latitude + ' > 90.0.');
14197 }
14198
14199 if (longitude < -180.0) {
14200 throw new Error('AV.GeoPoint longitude ' + longitude + ' < -180.0.');
14201 }
14202
14203 if (longitude > 180.0) {
14204 throw new Error('AV.GeoPoint longitude ' + longitude + ' > 180.0.');
14205 }
14206 };
14207 /**
14208 * Creates a GeoPoint with the user's current location, if available.
14209 * @return {Promise.<AV.GeoPoint>}
14210 */
14211
14212
14213 AV.GeoPoint.current = function () {
14214 return new _promise.default(function (resolve, reject) {
14215 navigator.geolocation.getCurrentPosition(function (location) {
14216 resolve(new AV.GeoPoint({
14217 latitude: location.coords.latitude,
14218 longitude: location.coords.longitude
14219 }));
14220 }, reject);
14221 });
14222 };
14223
14224 _.extend(AV.GeoPoint.prototype,
14225 /** @lends AV.GeoPoint.prototype */
14226 {
14227 /**
14228 * Returns a JSON representation of the GeoPoint, suitable for AV.
14229 * @return {Object}
14230 */
14231 toJSON: function toJSON() {
14232 AV.GeoPoint._validate(this.latitude, this.longitude);
14233
14234 return {
14235 __type: 'GeoPoint',
14236 latitude: this.latitude,
14237 longitude: this.longitude
14238 };
14239 },
14240
14241 /**
14242 * Returns the distance from this GeoPoint to another in radians.
14243 * @param {AV.GeoPoint} point the other AV.GeoPoint.
14244 * @return {Number}
14245 */
14246 radiansTo: function radiansTo(point) {
14247 var d2r = Math.PI / 180.0;
14248 var lat1rad = this.latitude * d2r;
14249 var long1rad = this.longitude * d2r;
14250 var lat2rad = point.latitude * d2r;
14251 var long2rad = point.longitude * d2r;
14252 var deltaLat = lat1rad - lat2rad;
14253 var deltaLong = long1rad - long2rad;
14254 var sinDeltaLatDiv2 = Math.sin(deltaLat / 2);
14255 var sinDeltaLongDiv2 = Math.sin(deltaLong / 2); // Square of half the straight line chord distance between both points.
14256
14257 var a = sinDeltaLatDiv2 * sinDeltaLatDiv2 + Math.cos(lat1rad) * Math.cos(lat2rad) * sinDeltaLongDiv2 * sinDeltaLongDiv2;
14258 a = Math.min(1.0, a);
14259 return 2 * Math.asin(Math.sqrt(a));
14260 },
14261
14262 /**
14263 * Returns the distance from this GeoPoint to another in kilometers.
14264 * @param {AV.GeoPoint} point the other AV.GeoPoint.
14265 * @return {Number}
14266 */
14267 kilometersTo: function kilometersTo(point) {
14268 return this.radiansTo(point) * 6371.0;
14269 },
14270
14271 /**
14272 * Returns the distance from this GeoPoint to another in miles.
14273 * @param {AV.GeoPoint} point the other AV.GeoPoint.
14274 * @return {Number}
14275 */
14276 milesTo: function milesTo(point) {
14277 return this.radiansTo(point) * 3958.8;
14278 }
14279 });
14280};
14281
14282/***/ }),
14283/* 473 */
14284/***/ (function(module, exports, __webpack_require__) {
14285
14286"use strict";
14287
14288
14289var _ = __webpack_require__(3);
14290
14291module.exports = function (AV) {
14292 var PUBLIC_KEY = '*';
14293 /**
14294 * Creates a new ACL.
14295 * If no argument is given, the ACL has no permissions for anyone.
14296 * If the argument is a AV.User, the ACL will have read and write
14297 * permission for only that user.
14298 * If the argument is any other JSON object, that object will be interpretted
14299 * as a serialized ACL created with toJSON().
14300 * @see AV.Object#setACL
14301 * @class
14302 *
14303 * <p>An ACL, or Access Control List can be added to any
14304 * <code>AV.Object</code> to restrict access to only a subset of users
14305 * of your application.</p>
14306 */
14307
14308 AV.ACL = function (arg1) {
14309 var self = this;
14310 self.permissionsById = {};
14311
14312 if (_.isObject(arg1)) {
14313 if (arg1 instanceof AV.User) {
14314 self.setReadAccess(arg1, true);
14315 self.setWriteAccess(arg1, true);
14316 } else {
14317 if (_.isFunction(arg1)) {
14318 throw new Error('AV.ACL() called with a function. Did you forget ()?');
14319 }
14320
14321 AV._objectEach(arg1, function (accessList, userId) {
14322 if (!_.isString(userId)) {
14323 throw new Error('Tried to create an ACL with an invalid userId.');
14324 }
14325
14326 self.permissionsById[userId] = {};
14327
14328 AV._objectEach(accessList, function (allowed, permission) {
14329 if (permission !== 'read' && permission !== 'write') {
14330 throw new Error('Tried to create an ACL with an invalid permission type.');
14331 }
14332
14333 if (!_.isBoolean(allowed)) {
14334 throw new Error('Tried to create an ACL with an invalid permission value.');
14335 }
14336
14337 self.permissionsById[userId][permission] = allowed;
14338 });
14339 });
14340 }
14341 }
14342 };
14343 /**
14344 * Returns a JSON-encoded version of the ACL.
14345 * @return {Object}
14346 */
14347
14348
14349 AV.ACL.prototype.toJSON = function () {
14350 return _.clone(this.permissionsById);
14351 };
14352
14353 AV.ACL.prototype._setAccess = function (accessType, userId, allowed) {
14354 if (userId instanceof AV.User) {
14355 userId = userId.id;
14356 } else if (userId instanceof AV.Role) {
14357 userId = 'role:' + userId.getName();
14358 }
14359
14360 if (!_.isString(userId)) {
14361 throw new Error('userId must be a string.');
14362 }
14363
14364 if (!_.isBoolean(allowed)) {
14365 throw new Error('allowed must be either true or false.');
14366 }
14367
14368 var permissions = this.permissionsById[userId];
14369
14370 if (!permissions) {
14371 if (!allowed) {
14372 // The user already doesn't have this permission, so no action needed.
14373 return;
14374 } else {
14375 permissions = {};
14376 this.permissionsById[userId] = permissions;
14377 }
14378 }
14379
14380 if (allowed) {
14381 this.permissionsById[userId][accessType] = true;
14382 } else {
14383 delete permissions[accessType];
14384
14385 if (_.isEmpty(permissions)) {
14386 delete this.permissionsById[userId];
14387 }
14388 }
14389 };
14390
14391 AV.ACL.prototype._getAccess = function (accessType, userId) {
14392 if (userId instanceof AV.User) {
14393 userId = userId.id;
14394 } else if (userId instanceof AV.Role) {
14395 userId = 'role:' + userId.getName();
14396 }
14397
14398 var permissions = this.permissionsById[userId];
14399
14400 if (!permissions) {
14401 return false;
14402 }
14403
14404 return permissions[accessType] ? true : false;
14405 };
14406 /**
14407 * Set whether the given user is allowed to read this object.
14408 * @param userId An instance of AV.User or its objectId.
14409 * @param {Boolean} allowed Whether that user should have read access.
14410 */
14411
14412
14413 AV.ACL.prototype.setReadAccess = function (userId, allowed) {
14414 this._setAccess('read', userId, allowed);
14415 };
14416 /**
14417 * Get whether the given user id is *explicitly* allowed to read this object.
14418 * Even if this returns false, the user may still be able to access it if
14419 * getPublicReadAccess returns true or a role that the user belongs to has
14420 * write access.
14421 * @param userId An instance of AV.User or its objectId, or a AV.Role.
14422 * @return {Boolean}
14423 */
14424
14425
14426 AV.ACL.prototype.getReadAccess = function (userId) {
14427 return this._getAccess('read', userId);
14428 };
14429 /**
14430 * Set whether the given user id is allowed to write this object.
14431 * @param userId An instance of AV.User or its objectId, or a AV.Role..
14432 * @param {Boolean} allowed Whether that user should have write access.
14433 */
14434
14435
14436 AV.ACL.prototype.setWriteAccess = function (userId, allowed) {
14437 this._setAccess('write', userId, allowed);
14438 };
14439 /**
14440 * Get whether the given user id is *explicitly* allowed to write this object.
14441 * Even if this returns false, the user may still be able to write it if
14442 * getPublicWriteAccess returns true or a role that the user belongs to has
14443 * write access.
14444 * @param userId An instance of AV.User or its objectId, or a AV.Role.
14445 * @return {Boolean}
14446 */
14447
14448
14449 AV.ACL.prototype.getWriteAccess = function (userId) {
14450 return this._getAccess('write', userId);
14451 };
14452 /**
14453 * Set whether the public is allowed to read this object.
14454 * @param {Boolean} allowed
14455 */
14456
14457
14458 AV.ACL.prototype.setPublicReadAccess = function (allowed) {
14459 this.setReadAccess(PUBLIC_KEY, allowed);
14460 };
14461 /**
14462 * Get whether the public is allowed to read this object.
14463 * @return {Boolean}
14464 */
14465
14466
14467 AV.ACL.prototype.getPublicReadAccess = function () {
14468 return this.getReadAccess(PUBLIC_KEY);
14469 };
14470 /**
14471 * Set whether the public is allowed to write this object.
14472 * @param {Boolean} allowed
14473 */
14474
14475
14476 AV.ACL.prototype.setPublicWriteAccess = function (allowed) {
14477 this.setWriteAccess(PUBLIC_KEY, allowed);
14478 };
14479 /**
14480 * Get whether the public is allowed to write this object.
14481 * @return {Boolean}
14482 */
14483
14484
14485 AV.ACL.prototype.getPublicWriteAccess = function () {
14486 return this.getWriteAccess(PUBLIC_KEY);
14487 };
14488 /**
14489 * Get whether users belonging to the given role are allowed
14490 * to read this object. Even if this returns false, the role may
14491 * still be able to write it if a parent role has read access.
14492 *
14493 * @param role The name of the role, or a AV.Role object.
14494 * @return {Boolean} true if the role has read access. false otherwise.
14495 * @throws {String} If role is neither a AV.Role nor a String.
14496 */
14497
14498
14499 AV.ACL.prototype.getRoleReadAccess = function (role) {
14500 if (role instanceof AV.Role) {
14501 // Normalize to the String name
14502 role = role.getName();
14503 }
14504
14505 if (_.isString(role)) {
14506 return this.getReadAccess('role:' + role);
14507 }
14508
14509 throw new Error('role must be a AV.Role or a String');
14510 };
14511 /**
14512 * Get whether users belonging to the given role are allowed
14513 * to write this object. Even if this returns false, the role may
14514 * still be able to write it if a parent role has write access.
14515 *
14516 * @param role The name of the role, or a AV.Role object.
14517 * @return {Boolean} true if the role has write access. false otherwise.
14518 * @throws {String} If role is neither a AV.Role nor a String.
14519 */
14520
14521
14522 AV.ACL.prototype.getRoleWriteAccess = function (role) {
14523 if (role instanceof AV.Role) {
14524 // Normalize to the String name
14525 role = role.getName();
14526 }
14527
14528 if (_.isString(role)) {
14529 return this.getWriteAccess('role:' + role);
14530 }
14531
14532 throw new Error('role must be a AV.Role or a String');
14533 };
14534 /**
14535 * Set whether users belonging to the given role are allowed
14536 * to read this object.
14537 *
14538 * @param role The name of the role, or a AV.Role object.
14539 * @param {Boolean} allowed Whether the given role can read this object.
14540 * @throws {String} If role is neither a AV.Role nor a String.
14541 */
14542
14543
14544 AV.ACL.prototype.setRoleReadAccess = function (role, allowed) {
14545 if (role instanceof AV.Role) {
14546 // Normalize to the String name
14547 role = role.getName();
14548 }
14549
14550 if (_.isString(role)) {
14551 this.setReadAccess('role:' + role, allowed);
14552 return;
14553 }
14554
14555 throw new Error('role must be a AV.Role or a String');
14556 };
14557 /**
14558 * Set whether users belonging to the given role are allowed
14559 * to write this object.
14560 *
14561 * @param role The name of the role, or a AV.Role object.
14562 * @param {Boolean} allowed Whether the given role can write this object.
14563 * @throws {String} If role is neither a AV.Role nor a String.
14564 */
14565
14566
14567 AV.ACL.prototype.setRoleWriteAccess = function (role, allowed) {
14568 if (role instanceof AV.Role) {
14569 // Normalize to the String name
14570 role = role.getName();
14571 }
14572
14573 if (_.isString(role)) {
14574 this.setWriteAccess('role:' + role, allowed);
14575 return;
14576 }
14577
14578 throw new Error('role must be a AV.Role or a String');
14579 };
14580};
14581
14582/***/ }),
14583/* 474 */
14584/***/ (function(module, exports, __webpack_require__) {
14585
14586"use strict";
14587
14588
14589var _interopRequireDefault = __webpack_require__(1);
14590
14591var _concat = _interopRequireDefault(__webpack_require__(19));
14592
14593var _find = _interopRequireDefault(__webpack_require__(96));
14594
14595var _indexOf = _interopRequireDefault(__webpack_require__(61));
14596
14597var _map = _interopRequireDefault(__webpack_require__(37));
14598
14599var _ = __webpack_require__(3);
14600
14601module.exports = function (AV) {
14602 /**
14603 * @private
14604 * @class
14605 * A AV.Op is an atomic operation that can be applied to a field in a
14606 * AV.Object. For example, calling <code>object.set("foo", "bar")</code>
14607 * is an example of a AV.Op.Set. Calling <code>object.unset("foo")</code>
14608 * is a AV.Op.Unset. These operations are stored in a AV.Object and
14609 * sent to the server as part of <code>object.save()</code> operations.
14610 * Instances of AV.Op should be immutable.
14611 *
14612 * You should not create subclasses of AV.Op or instantiate AV.Op
14613 * directly.
14614 */
14615 AV.Op = function () {
14616 this._initialize.apply(this, arguments);
14617 };
14618
14619 _.extend(AV.Op.prototype,
14620 /** @lends AV.Op.prototype */
14621 {
14622 _initialize: function _initialize() {}
14623 });
14624
14625 _.extend(AV.Op, {
14626 /**
14627 * To create a new Op, call AV.Op._extend();
14628 * @private
14629 */
14630 _extend: AV._extend,
14631 // A map of __op string to decoder function.
14632 _opDecoderMap: {},
14633
14634 /**
14635 * Registers a function to convert a json object with an __op field into an
14636 * instance of a subclass of AV.Op.
14637 * @private
14638 */
14639 _registerDecoder: function _registerDecoder(opName, decoder) {
14640 AV.Op._opDecoderMap[opName] = decoder;
14641 },
14642
14643 /**
14644 * Converts a json object into an instance of a subclass of AV.Op.
14645 * @private
14646 */
14647 _decode: function _decode(json) {
14648 var decoder = AV.Op._opDecoderMap[json.__op];
14649
14650 if (decoder) {
14651 return decoder(json);
14652 } else {
14653 return undefined;
14654 }
14655 }
14656 });
14657 /*
14658 * Add a handler for Batch ops.
14659 */
14660
14661
14662 AV.Op._registerDecoder('Batch', function (json) {
14663 var op = null;
14664
14665 AV._arrayEach(json.ops, function (nextOp) {
14666 nextOp = AV.Op._decode(nextOp);
14667 op = nextOp._mergeWithPrevious(op);
14668 });
14669
14670 return op;
14671 });
14672 /**
14673 * @private
14674 * @class
14675 * A Set operation indicates that either the field was changed using
14676 * AV.Object.set, or it is a mutable container that was detected as being
14677 * changed.
14678 */
14679
14680
14681 AV.Op.Set = AV.Op._extend(
14682 /** @lends AV.Op.Set.prototype */
14683 {
14684 _initialize: function _initialize(value) {
14685 this._value = value;
14686 },
14687
14688 /**
14689 * Returns the new value of this field after the set.
14690 */
14691 value: function value() {
14692 return this._value;
14693 },
14694
14695 /**
14696 * Returns a JSON version of the operation suitable for sending to AV.
14697 * @return {Object}
14698 */
14699 toJSON: function toJSON() {
14700 return AV._encode(this.value());
14701 },
14702 _mergeWithPrevious: function _mergeWithPrevious(previous) {
14703 return this;
14704 },
14705 _estimate: function _estimate(oldValue) {
14706 return this.value();
14707 }
14708 });
14709 /**
14710 * A sentinel value that is returned by AV.Op.Unset._estimate to
14711 * indicate the field should be deleted. Basically, if you find _UNSET as a
14712 * value in your object, you should remove that key.
14713 */
14714
14715 AV.Op._UNSET = {};
14716 /**
14717 * @private
14718 * @class
14719 * An Unset operation indicates that this field has been deleted from the
14720 * object.
14721 */
14722
14723 AV.Op.Unset = AV.Op._extend(
14724 /** @lends AV.Op.Unset.prototype */
14725 {
14726 /**
14727 * Returns a JSON version of the operation suitable for sending to AV.
14728 * @return {Object}
14729 */
14730 toJSON: function toJSON() {
14731 return {
14732 __op: 'Delete'
14733 };
14734 },
14735 _mergeWithPrevious: function _mergeWithPrevious(previous) {
14736 return this;
14737 },
14738 _estimate: function _estimate(oldValue) {
14739 return AV.Op._UNSET;
14740 }
14741 });
14742
14743 AV.Op._registerDecoder('Delete', function (json) {
14744 return new AV.Op.Unset();
14745 });
14746 /**
14747 * @private
14748 * @class
14749 * An Increment is an atomic operation where the numeric value for the field
14750 * will be increased by a given amount.
14751 */
14752
14753
14754 AV.Op.Increment = AV.Op._extend(
14755 /** @lends AV.Op.Increment.prototype */
14756 {
14757 _initialize: function _initialize(amount) {
14758 this._amount = amount;
14759 },
14760
14761 /**
14762 * Returns the amount to increment by.
14763 * @return {Number} the amount to increment by.
14764 */
14765 amount: function amount() {
14766 return this._amount;
14767 },
14768
14769 /**
14770 * Returns a JSON version of the operation suitable for sending to AV.
14771 * @return {Object}
14772 */
14773 toJSON: function toJSON() {
14774 return {
14775 __op: 'Increment',
14776 amount: this._amount
14777 };
14778 },
14779 _mergeWithPrevious: function _mergeWithPrevious(previous) {
14780 if (!previous) {
14781 return this;
14782 } else if (previous instanceof AV.Op.Unset) {
14783 return new AV.Op.Set(this.amount());
14784 } else if (previous instanceof AV.Op.Set) {
14785 return new AV.Op.Set(previous.value() + this.amount());
14786 } else if (previous instanceof AV.Op.Increment) {
14787 return new AV.Op.Increment(this.amount() + previous.amount());
14788 } else {
14789 throw new Error('Op is invalid after previous op.');
14790 }
14791 },
14792 _estimate: function _estimate(oldValue) {
14793 if (!oldValue) {
14794 return this.amount();
14795 }
14796
14797 return oldValue + this.amount();
14798 }
14799 });
14800
14801 AV.Op._registerDecoder('Increment', function (json) {
14802 return new AV.Op.Increment(json.amount);
14803 });
14804 /**
14805 * @private
14806 * @class
14807 * BitAnd is an atomic operation where the given value will be bit and to the
14808 * value than is stored in this field.
14809 */
14810
14811
14812 AV.Op.BitAnd = AV.Op._extend(
14813 /** @lends AV.Op.BitAnd.prototype */
14814 {
14815 _initialize: function _initialize(value) {
14816 this._value = value;
14817 },
14818 value: function value() {
14819 return this._value;
14820 },
14821
14822 /**
14823 * Returns a JSON version of the operation suitable for sending to AV.
14824 * @return {Object}
14825 */
14826 toJSON: function toJSON() {
14827 return {
14828 __op: 'BitAnd',
14829 value: this.value()
14830 };
14831 },
14832 _mergeWithPrevious: function _mergeWithPrevious(previous) {
14833 if (!previous) {
14834 return this;
14835 } else if (previous instanceof AV.Op.Unset) {
14836 return new AV.Op.Set(0);
14837 } else if (previous instanceof AV.Op.Set) {
14838 return new AV.Op.Set(previous.value() & this.value());
14839 } else {
14840 throw new Error('Op is invalid after previous op.');
14841 }
14842 },
14843 _estimate: function _estimate(oldValue) {
14844 return oldValue & this.value();
14845 }
14846 });
14847
14848 AV.Op._registerDecoder('BitAnd', function (json) {
14849 return new AV.Op.BitAnd(json.value);
14850 });
14851 /**
14852 * @private
14853 * @class
14854 * BitOr is an atomic operation where the given value will be bit and to the
14855 * value than is stored in this field.
14856 */
14857
14858
14859 AV.Op.BitOr = AV.Op._extend(
14860 /** @lends AV.Op.BitOr.prototype */
14861 {
14862 _initialize: function _initialize(value) {
14863 this._value = value;
14864 },
14865 value: function value() {
14866 return this._value;
14867 },
14868
14869 /**
14870 * Returns a JSON version of the operation suitable for sending to AV.
14871 * @return {Object}
14872 */
14873 toJSON: function toJSON() {
14874 return {
14875 __op: 'BitOr',
14876 value: this.value()
14877 };
14878 },
14879 _mergeWithPrevious: function _mergeWithPrevious(previous) {
14880 if (!previous) {
14881 return this;
14882 } else if (previous instanceof AV.Op.Unset) {
14883 return new AV.Op.Set(this.value());
14884 } else if (previous instanceof AV.Op.Set) {
14885 return new AV.Op.Set(previous.value() | this.value());
14886 } else {
14887 throw new Error('Op is invalid after previous op.');
14888 }
14889 },
14890 _estimate: function _estimate(oldValue) {
14891 return oldValue | this.value();
14892 }
14893 });
14894
14895 AV.Op._registerDecoder('BitOr', function (json) {
14896 return new AV.Op.BitOr(json.value);
14897 });
14898 /**
14899 * @private
14900 * @class
14901 * BitXor is an atomic operation where the given value will be bit and to the
14902 * value than is stored in this field.
14903 */
14904
14905
14906 AV.Op.BitXor = AV.Op._extend(
14907 /** @lends AV.Op.BitXor.prototype */
14908 {
14909 _initialize: function _initialize(value) {
14910 this._value = value;
14911 },
14912 value: function value() {
14913 return this._value;
14914 },
14915
14916 /**
14917 * Returns a JSON version of the operation suitable for sending to AV.
14918 * @return {Object}
14919 */
14920 toJSON: function toJSON() {
14921 return {
14922 __op: 'BitXor',
14923 value: this.value()
14924 };
14925 },
14926 _mergeWithPrevious: function _mergeWithPrevious(previous) {
14927 if (!previous) {
14928 return this;
14929 } else if (previous instanceof AV.Op.Unset) {
14930 return new AV.Op.Set(this.value());
14931 } else if (previous instanceof AV.Op.Set) {
14932 return new AV.Op.Set(previous.value() ^ this.value());
14933 } else {
14934 throw new Error('Op is invalid after previous op.');
14935 }
14936 },
14937 _estimate: function _estimate(oldValue) {
14938 return oldValue ^ this.value();
14939 }
14940 });
14941
14942 AV.Op._registerDecoder('BitXor', function (json) {
14943 return new AV.Op.BitXor(json.value);
14944 });
14945 /**
14946 * @private
14947 * @class
14948 * Add is an atomic operation where the given objects will be appended to the
14949 * array that is stored in this field.
14950 */
14951
14952
14953 AV.Op.Add = AV.Op._extend(
14954 /** @lends AV.Op.Add.prototype */
14955 {
14956 _initialize: function _initialize(objects) {
14957 this._objects = objects;
14958 },
14959
14960 /**
14961 * Returns the objects to be added to the array.
14962 * @return {Array} The objects to be added to the array.
14963 */
14964 objects: function objects() {
14965 return this._objects;
14966 },
14967
14968 /**
14969 * Returns a JSON version of the operation suitable for sending to AV.
14970 * @return {Object}
14971 */
14972 toJSON: function toJSON() {
14973 return {
14974 __op: 'Add',
14975 objects: AV._encode(this.objects())
14976 };
14977 },
14978 _mergeWithPrevious: function _mergeWithPrevious(previous) {
14979 if (!previous) {
14980 return this;
14981 } else if (previous instanceof AV.Op.Unset) {
14982 return new AV.Op.Set(this.objects());
14983 } else if (previous instanceof AV.Op.Set) {
14984 return new AV.Op.Set(this._estimate(previous.value()));
14985 } else if (previous instanceof AV.Op.Add) {
14986 var _context;
14987
14988 return new AV.Op.Add((0, _concat.default)(_context = previous.objects()).call(_context, this.objects()));
14989 } else {
14990 throw new Error('Op is invalid after previous op.');
14991 }
14992 },
14993 _estimate: function _estimate(oldValue) {
14994 if (!oldValue) {
14995 return _.clone(this.objects());
14996 } else {
14997 return (0, _concat.default)(oldValue).call(oldValue, this.objects());
14998 }
14999 }
15000 });
15001
15002 AV.Op._registerDecoder('Add', function (json) {
15003 return new AV.Op.Add(AV._decode(json.objects));
15004 });
15005 /**
15006 * @private
15007 * @class
15008 * AddUnique is an atomic operation where the given items will be appended to
15009 * the array that is stored in this field only if they were not already
15010 * present in the array.
15011 */
15012
15013
15014 AV.Op.AddUnique = AV.Op._extend(
15015 /** @lends AV.Op.AddUnique.prototype */
15016 {
15017 _initialize: function _initialize(objects) {
15018 this._objects = _.uniq(objects);
15019 },
15020
15021 /**
15022 * Returns the objects to be added to the array.
15023 * @return {Array} The objects to be added to the array.
15024 */
15025 objects: function objects() {
15026 return this._objects;
15027 },
15028
15029 /**
15030 * Returns a JSON version of the operation suitable for sending to AV.
15031 * @return {Object}
15032 */
15033 toJSON: function toJSON() {
15034 return {
15035 __op: 'AddUnique',
15036 objects: AV._encode(this.objects())
15037 };
15038 },
15039 _mergeWithPrevious: function _mergeWithPrevious(previous) {
15040 if (!previous) {
15041 return this;
15042 } else if (previous instanceof AV.Op.Unset) {
15043 return new AV.Op.Set(this.objects());
15044 } else if (previous instanceof AV.Op.Set) {
15045 return new AV.Op.Set(this._estimate(previous.value()));
15046 } else if (previous instanceof AV.Op.AddUnique) {
15047 return new AV.Op.AddUnique(this._estimate(previous.objects()));
15048 } else {
15049 throw new Error('Op is invalid after previous op.');
15050 }
15051 },
15052 _estimate: function _estimate(oldValue) {
15053 if (!oldValue) {
15054 return _.clone(this.objects());
15055 } else {
15056 // We can't just take the _.uniq(_.union(...)) of oldValue and
15057 // this.objects, because the uniqueness may not apply to oldValue
15058 // (especially if the oldValue was set via .set())
15059 var newValue = _.clone(oldValue);
15060
15061 AV._arrayEach(this.objects(), function (obj) {
15062 if (obj instanceof AV.Object && obj.id) {
15063 var matchingObj = (0, _find.default)(_).call(_, newValue, function (anObj) {
15064 return anObj instanceof AV.Object && anObj.id === obj.id;
15065 });
15066
15067 if (!matchingObj) {
15068 newValue.push(obj);
15069 } else {
15070 var index = (0, _indexOf.default)(_).call(_, newValue, matchingObj);
15071 newValue[index] = obj;
15072 }
15073 } else if (!_.contains(newValue, obj)) {
15074 newValue.push(obj);
15075 }
15076 });
15077
15078 return newValue;
15079 }
15080 }
15081 });
15082
15083 AV.Op._registerDecoder('AddUnique', function (json) {
15084 return new AV.Op.AddUnique(AV._decode(json.objects));
15085 });
15086 /**
15087 * @private
15088 * @class
15089 * Remove is an atomic operation where the given objects will be removed from
15090 * the array that is stored in this field.
15091 */
15092
15093
15094 AV.Op.Remove = AV.Op._extend(
15095 /** @lends AV.Op.Remove.prototype */
15096 {
15097 _initialize: function _initialize(objects) {
15098 this._objects = _.uniq(objects);
15099 },
15100
15101 /**
15102 * Returns the objects to be removed from the array.
15103 * @return {Array} The objects to be removed from the array.
15104 */
15105 objects: function objects() {
15106 return this._objects;
15107 },
15108
15109 /**
15110 * Returns a JSON version of the operation suitable for sending to AV.
15111 * @return {Object}
15112 */
15113 toJSON: function toJSON() {
15114 return {
15115 __op: 'Remove',
15116 objects: AV._encode(this.objects())
15117 };
15118 },
15119 _mergeWithPrevious: function _mergeWithPrevious(previous) {
15120 if (!previous) {
15121 return this;
15122 } else if (previous instanceof AV.Op.Unset) {
15123 return previous;
15124 } else if (previous instanceof AV.Op.Set) {
15125 return new AV.Op.Set(this._estimate(previous.value()));
15126 } else if (previous instanceof AV.Op.Remove) {
15127 return new AV.Op.Remove(_.union(previous.objects(), this.objects()));
15128 } else {
15129 throw new Error('Op is invalid after previous op.');
15130 }
15131 },
15132 _estimate: function _estimate(oldValue) {
15133 if (!oldValue) {
15134 return [];
15135 } else {
15136 var newValue = _.difference(oldValue, this.objects()); // If there are saved AV Objects being removed, also remove them.
15137
15138
15139 AV._arrayEach(this.objects(), function (obj) {
15140 if (obj instanceof AV.Object && obj.id) {
15141 newValue = _.reject(newValue, function (other) {
15142 return other instanceof AV.Object && other.id === obj.id;
15143 });
15144 }
15145 });
15146
15147 return newValue;
15148 }
15149 }
15150 });
15151
15152 AV.Op._registerDecoder('Remove', function (json) {
15153 return new AV.Op.Remove(AV._decode(json.objects));
15154 });
15155 /**
15156 * @private
15157 * @class
15158 * A Relation operation indicates that the field is an instance of
15159 * AV.Relation, and objects are being added to, or removed from, that
15160 * relation.
15161 */
15162
15163
15164 AV.Op.Relation = AV.Op._extend(
15165 /** @lends AV.Op.Relation.prototype */
15166 {
15167 _initialize: function _initialize(adds, removes) {
15168 this._targetClassName = null;
15169 var self = this;
15170
15171 var pointerToId = function pointerToId(object) {
15172 if (object instanceof AV.Object) {
15173 if (!object.id) {
15174 throw new Error("You can't add an unsaved AV.Object to a relation.");
15175 }
15176
15177 if (!self._targetClassName) {
15178 self._targetClassName = object.className;
15179 }
15180
15181 if (self._targetClassName !== object.className) {
15182 throw new Error('Tried to create a AV.Relation with 2 different types: ' + self._targetClassName + ' and ' + object.className + '.');
15183 }
15184
15185 return object.id;
15186 }
15187
15188 return object;
15189 };
15190
15191 this.relationsToAdd = _.uniq((0, _map.default)(_).call(_, adds, pointerToId));
15192 this.relationsToRemove = _.uniq((0, _map.default)(_).call(_, removes, pointerToId));
15193 },
15194
15195 /**
15196 * Returns an array of unfetched AV.Object that are being added to the
15197 * relation.
15198 * @return {Array}
15199 */
15200 added: function added() {
15201 var self = this;
15202 return (0, _map.default)(_).call(_, this.relationsToAdd, function (objectId) {
15203 var object = AV.Object._create(self._targetClassName);
15204
15205 object.id = objectId;
15206 return object;
15207 });
15208 },
15209
15210 /**
15211 * Returns an array of unfetched AV.Object that are being removed from
15212 * the relation.
15213 * @return {Array}
15214 */
15215 removed: function removed() {
15216 var self = this;
15217 return (0, _map.default)(_).call(_, this.relationsToRemove, function (objectId) {
15218 var object = AV.Object._create(self._targetClassName);
15219
15220 object.id = objectId;
15221 return object;
15222 });
15223 },
15224
15225 /**
15226 * Returns a JSON version of the operation suitable for sending to AV.
15227 * @return {Object}
15228 */
15229 toJSON: function toJSON() {
15230 var adds = null;
15231 var removes = null;
15232 var self = this;
15233
15234 var idToPointer = function idToPointer(id) {
15235 return {
15236 __type: 'Pointer',
15237 className: self._targetClassName,
15238 objectId: id
15239 };
15240 };
15241
15242 var pointers = null;
15243
15244 if (this.relationsToAdd.length > 0) {
15245 pointers = (0, _map.default)(_).call(_, this.relationsToAdd, idToPointer);
15246 adds = {
15247 __op: 'AddRelation',
15248 objects: pointers
15249 };
15250 }
15251
15252 if (this.relationsToRemove.length > 0) {
15253 pointers = (0, _map.default)(_).call(_, this.relationsToRemove, idToPointer);
15254 removes = {
15255 __op: 'RemoveRelation',
15256 objects: pointers
15257 };
15258 }
15259
15260 if (adds && removes) {
15261 return {
15262 __op: 'Batch',
15263 ops: [adds, removes]
15264 };
15265 }
15266
15267 return adds || removes || {};
15268 },
15269 _mergeWithPrevious: function _mergeWithPrevious(previous) {
15270 if (!previous) {
15271 return this;
15272 } else if (previous instanceof AV.Op.Unset) {
15273 throw new Error("You can't modify a relation after deleting it.");
15274 } else if (previous instanceof AV.Op.Relation) {
15275 if (previous._targetClassName && previous._targetClassName !== this._targetClassName) {
15276 throw new Error('Related object must be of class ' + previous._targetClassName + ', but ' + this._targetClassName + ' was passed in.');
15277 }
15278
15279 var newAdd = _.union(_.difference(previous.relationsToAdd, this.relationsToRemove), this.relationsToAdd);
15280
15281 var newRemove = _.union(_.difference(previous.relationsToRemove, this.relationsToAdd), this.relationsToRemove);
15282
15283 var newRelation = new AV.Op.Relation(newAdd, newRemove);
15284 newRelation._targetClassName = this._targetClassName;
15285 return newRelation;
15286 } else {
15287 throw new Error('Op is invalid after previous op.');
15288 }
15289 },
15290 _estimate: function _estimate(oldValue, object, key) {
15291 if (!oldValue) {
15292 var relation = new AV.Relation(object, key);
15293 relation.targetClassName = this._targetClassName;
15294 } else if (oldValue instanceof AV.Relation) {
15295 if (this._targetClassName) {
15296 if (oldValue.targetClassName) {
15297 if (oldValue.targetClassName !== this._targetClassName) {
15298 throw new Error('Related object must be a ' + oldValue.targetClassName + ', but a ' + this._targetClassName + ' was passed in.');
15299 }
15300 } else {
15301 oldValue.targetClassName = this._targetClassName;
15302 }
15303 }
15304
15305 return oldValue;
15306 } else {
15307 throw new Error('Op is invalid after previous op.');
15308 }
15309 }
15310 });
15311
15312 AV.Op._registerDecoder('AddRelation', function (json) {
15313 return new AV.Op.Relation(AV._decode(json.objects), []);
15314 });
15315
15316 AV.Op._registerDecoder('RemoveRelation', function (json) {
15317 return new AV.Op.Relation([], AV._decode(json.objects));
15318 });
15319};
15320
15321/***/ }),
15322/* 475 */
15323/***/ (function(module, exports, __webpack_require__) {
15324
15325var parent = __webpack_require__(476);
15326
15327module.exports = parent;
15328
15329
15330/***/ }),
15331/* 476 */
15332/***/ (function(module, exports, __webpack_require__) {
15333
15334var isPrototypeOf = __webpack_require__(16);
15335var method = __webpack_require__(477);
15336
15337var ArrayPrototype = Array.prototype;
15338
15339module.exports = function (it) {
15340 var own = it.find;
15341 return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.find) ? method : own;
15342};
15343
15344
15345/***/ }),
15346/* 477 */
15347/***/ (function(module, exports, __webpack_require__) {
15348
15349__webpack_require__(478);
15350var entryVirtual = __webpack_require__(27);
15351
15352module.exports = entryVirtual('Array').find;
15353
15354
15355/***/ }),
15356/* 478 */
15357/***/ (function(module, exports, __webpack_require__) {
15358
15359"use strict";
15360
15361var $ = __webpack_require__(0);
15362var $find = __webpack_require__(75).find;
15363var addToUnscopables = __webpack_require__(131);
15364
15365var FIND = 'find';
15366var SKIPS_HOLES = true;
15367
15368// Shouldn't skip holes
15369if (FIND in []) Array(1)[FIND](function () { SKIPS_HOLES = false; });
15370
15371// `Array.prototype.find` method
15372// https://tc39.es/ecma262/#sec-array.prototype.find
15373$({ target: 'Array', proto: true, forced: SKIPS_HOLES }, {
15374 find: function find(callbackfn /* , that = undefined */) {
15375 return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
15376 }
15377});
15378
15379// https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
15380addToUnscopables(FIND);
15381
15382
15383/***/ }),
15384/* 479 */
15385/***/ (function(module, exports, __webpack_require__) {
15386
15387"use strict";
15388
15389
15390var _ = __webpack_require__(3);
15391
15392module.exports = function (AV) {
15393 /**
15394 * Creates a new Relation for the given parent object and key. This
15395 * constructor should rarely be used directly, but rather created by
15396 * {@link AV.Object#relation}.
15397 * @param {AV.Object} parent The parent of this relation.
15398 * @param {String} key The key for this relation on the parent.
15399 * @see AV.Object#relation
15400 * @class
15401 *
15402 * <p>
15403 * A class that is used to access all of the children of a many-to-many
15404 * relationship. Each instance of AV.Relation is associated with a
15405 * particular parent object and key.
15406 * </p>
15407 */
15408 AV.Relation = function (parent, key) {
15409 if (!_.isString(key)) {
15410 throw new TypeError('key must be a string');
15411 }
15412
15413 this.parent = parent;
15414 this.key = key;
15415 this.targetClassName = null;
15416 };
15417 /**
15418 * Creates a query that can be used to query the parent objects in this relation.
15419 * @param {String} parentClass The parent class or name.
15420 * @param {String} relationKey The relation field key in parent.
15421 * @param {AV.Object} child The child object.
15422 * @return {AV.Query}
15423 */
15424
15425
15426 AV.Relation.reverseQuery = function (parentClass, relationKey, child) {
15427 var query = new AV.Query(parentClass);
15428 query.equalTo(relationKey, child._toPointer());
15429 return query;
15430 };
15431
15432 _.extend(AV.Relation.prototype,
15433 /** @lends AV.Relation.prototype */
15434 {
15435 /**
15436 * Makes sure that this relation has the right parent and key.
15437 * @private
15438 */
15439 _ensureParentAndKey: function _ensureParentAndKey(parent, key) {
15440 this.parent = this.parent || parent;
15441 this.key = this.key || key;
15442
15443 if (this.parent !== parent) {
15444 throw new Error('Internal Error. Relation retrieved from two different Objects.');
15445 }
15446
15447 if (this.key !== key) {
15448 throw new Error('Internal Error. Relation retrieved from two different keys.');
15449 }
15450 },
15451
15452 /**
15453 * Adds a AV.Object or an array of AV.Objects to the relation.
15454 * @param {AV.Object|AV.Object[]} objects The item or items to add.
15455 */
15456 add: function add(objects) {
15457 if (!_.isArray(objects)) {
15458 objects = [objects];
15459 }
15460
15461 var change = new AV.Op.Relation(objects, []);
15462 this.parent.set(this.key, change);
15463 this.targetClassName = change._targetClassName;
15464 },
15465
15466 /**
15467 * Removes a AV.Object or an array of AV.Objects from this relation.
15468 * @param {AV.Object|AV.Object[]} objects The item or items to remove.
15469 */
15470 remove: function remove(objects) {
15471 if (!_.isArray(objects)) {
15472 objects = [objects];
15473 }
15474
15475 var change = new AV.Op.Relation([], objects);
15476 this.parent.set(this.key, change);
15477 this.targetClassName = change._targetClassName;
15478 },
15479
15480 /**
15481 * Returns a JSON version of the object suitable for saving to disk.
15482 * @return {Object}
15483 */
15484 toJSON: function toJSON() {
15485 return {
15486 __type: 'Relation',
15487 className: this.targetClassName
15488 };
15489 },
15490
15491 /**
15492 * Returns a AV.Query that is limited to objects in this
15493 * relation.
15494 * @return {AV.Query}
15495 */
15496 query: function query() {
15497 var targetClass;
15498 var query;
15499
15500 if (!this.targetClassName) {
15501 targetClass = AV.Object._getSubclass(this.parent.className);
15502 query = new AV.Query(targetClass);
15503 query._defaultParams.redirectClassNameForKey = this.key;
15504 } else {
15505 targetClass = AV.Object._getSubclass(this.targetClassName);
15506 query = new AV.Query(targetClass);
15507 }
15508
15509 query._addCondition('$relatedTo', 'object', this.parent._toPointer());
15510
15511 query._addCondition('$relatedTo', 'key', this.key);
15512
15513 return query;
15514 }
15515 });
15516};
15517
15518/***/ }),
15519/* 480 */
15520/***/ (function(module, exports, __webpack_require__) {
15521
15522"use strict";
15523
15524
15525var _interopRequireDefault = __webpack_require__(1);
15526
15527var _promise = _interopRequireDefault(__webpack_require__(12));
15528
15529var _ = __webpack_require__(3);
15530
15531var cos = __webpack_require__(481);
15532
15533var qiniu = __webpack_require__(482);
15534
15535var s3 = __webpack_require__(528);
15536
15537var AVError = __webpack_require__(48);
15538
15539var _require = __webpack_require__(28),
15540 request = _require.request,
15541 AVRequest = _require._request;
15542
15543var _require2 = __webpack_require__(32),
15544 tap = _require2.tap,
15545 transformFetchOptions = _require2.transformFetchOptions;
15546
15547var debug = __webpack_require__(63)('leancloud:file');
15548
15549var parseBase64 = __webpack_require__(532);
15550
15551module.exports = function (AV) {
15552 // port from browserify path module
15553 // since react-native packager won't shim node modules.
15554 var extname = function extname(path) {
15555 if (!_.isString(path)) return '';
15556 return path.match(/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/)[4];
15557 };
15558
15559 var b64Digit = function b64Digit(number) {
15560 if (number < 26) {
15561 return String.fromCharCode(65 + number);
15562 }
15563
15564 if (number < 52) {
15565 return String.fromCharCode(97 + (number - 26));
15566 }
15567
15568 if (number < 62) {
15569 return String.fromCharCode(48 + (number - 52));
15570 }
15571
15572 if (number === 62) {
15573 return '+';
15574 }
15575
15576 if (number === 63) {
15577 return '/';
15578 }
15579
15580 throw new Error('Tried to encode large digit ' + number + ' in base64.');
15581 };
15582
15583 var encodeBase64 = function encodeBase64(array) {
15584 var chunks = [];
15585 chunks.length = Math.ceil(array.length / 3);
15586
15587 _.times(chunks.length, function (i) {
15588 var b1 = array[i * 3];
15589 var b2 = array[i * 3 + 1] || 0;
15590 var b3 = array[i * 3 + 2] || 0;
15591 var has2 = i * 3 + 1 < array.length;
15592 var has3 = i * 3 + 2 < array.length;
15593 chunks[i] = [b64Digit(b1 >> 2 & 0x3f), b64Digit(b1 << 4 & 0x30 | b2 >> 4 & 0x0f), has2 ? b64Digit(b2 << 2 & 0x3c | b3 >> 6 & 0x03) : '=', has3 ? b64Digit(b3 & 0x3f) : '='].join('');
15594 });
15595
15596 return chunks.join('');
15597 };
15598 /**
15599 * An AV.File is a local representation of a file that is saved to the AV
15600 * cloud.
15601 * @param name {String} The file's name. This will change to a unique value
15602 * once the file has finished saving.
15603 * @param data {Array} The data for the file, as either:
15604 * 1. an Array of byte value Numbers, or
15605 * 2. an Object like { base64: "..." } with a base64-encoded String.
15606 * 3. a Blob(File) selected with a file upload control in a browser.
15607 * 4. an Object like { blob: {uri: "..."} } that mimics Blob
15608 * in some non-browser environments such as React Native.
15609 * 5. a Buffer in Node.js runtime.
15610 * 6. a Stream in Node.js runtime.
15611 *
15612 * For example:<pre>
15613 * var fileUploadControl = $("#profilePhotoFileUpload")[0];
15614 * if (fileUploadControl.files.length > 0) {
15615 * var file = fileUploadControl.files[0];
15616 * var name = "photo.jpg";
15617 * var file = new AV.File(name, file);
15618 * file.save().then(function() {
15619 * // The file has been saved to AV.
15620 * }, function(error) {
15621 * // The file either could not be read, or could not be saved to AV.
15622 * });
15623 * }</pre>
15624 *
15625 * @class
15626 * @param [mimeType] {String} Content-Type header to use for the file. If
15627 * this is omitted, the content type will be inferred from the name's
15628 * extension.
15629 */
15630
15631
15632 AV.File = function (name, data, mimeType) {
15633 this.attributes = {
15634 name: name,
15635 url: '',
15636 metaData: {},
15637 // 用来存储转换后要上传的 base64 String
15638 base64: ''
15639 };
15640
15641 if (_.isString(data)) {
15642 throw new TypeError('Creating an AV.File from a String is not yet supported.');
15643 }
15644
15645 if (_.isArray(data)) {
15646 this.attributes.metaData.size = data.length;
15647 data = {
15648 base64: encodeBase64(data)
15649 };
15650 }
15651
15652 this._extName = '';
15653 this._data = data;
15654 this._uploadHeaders = {};
15655
15656 if (data && data.blob && typeof data.blob.uri === 'string') {
15657 this._extName = extname(data.blob.uri);
15658 }
15659
15660 if (typeof Blob !== 'undefined' && data instanceof Blob) {
15661 if (data.size) {
15662 this.attributes.metaData.size = data.size;
15663 }
15664
15665 if (data.name) {
15666 this._extName = extname(data.name);
15667 }
15668 }
15669
15670 var owner;
15671
15672 if (data && data.owner) {
15673 owner = data.owner;
15674 } else if (!AV._config.disableCurrentUser) {
15675 try {
15676 owner = AV.User.current();
15677 } catch (error) {
15678 if ('SYNC_API_NOT_AVAILABLE' !== error.code) {
15679 throw error;
15680 }
15681 }
15682 }
15683
15684 this.attributes.metaData.owner = owner ? owner.id : 'unknown';
15685 this.set('mime_type', mimeType);
15686 };
15687 /**
15688 * Creates a fresh AV.File object with exists url for saving to AVOS Cloud.
15689 * @param {String} name the file name
15690 * @param {String} url the file url.
15691 * @param {Object} [metaData] the file metadata object.
15692 * @param {String} [type] Content-Type header to use for the file. If
15693 * this is omitted, the content type will be inferred from the name's
15694 * extension.
15695 * @return {AV.File} the file object
15696 */
15697
15698
15699 AV.File.withURL = function (name, url, metaData, type) {
15700 if (!name || !url) {
15701 throw new Error('Please provide file name and url');
15702 }
15703
15704 var file = new AV.File(name, null, type); //copy metaData properties to file.
15705
15706 if (metaData) {
15707 for (var prop in metaData) {
15708 if (!file.attributes.metaData[prop]) file.attributes.metaData[prop] = metaData[prop];
15709 }
15710 }
15711
15712 file.attributes.url = url; //Mark the file is from external source.
15713
15714 file.attributes.metaData.__source = 'external';
15715 file.attributes.metaData.size = 0;
15716 return file;
15717 };
15718 /**
15719 * Creates a file object with exists objectId.
15720 * @param {String} objectId The objectId string
15721 * @return {AV.File} the file object
15722 */
15723
15724
15725 AV.File.createWithoutData = function (objectId) {
15726 if (!objectId) {
15727 throw new TypeError('The objectId must be provided');
15728 }
15729
15730 var file = new AV.File();
15731 file.id = objectId;
15732 return file;
15733 };
15734 /**
15735 * Request file censor.
15736 * @since 4.13.0
15737 * @param {String} objectId
15738 * @return {Promise.<string>}
15739 */
15740
15741
15742 AV.File.censor = function (objectId) {
15743 if (!AV._config.masterKey) {
15744 throw new Error('Cannot censor a file without masterKey');
15745 }
15746
15747 return request({
15748 method: 'POST',
15749 path: "/files/".concat(objectId, "/censor"),
15750 authOptions: {
15751 useMasterKey: true
15752 }
15753 }).then(function (res) {
15754 return res.censorResult;
15755 });
15756 };
15757
15758 _.extend(AV.File.prototype,
15759 /** @lends AV.File.prototype */
15760 {
15761 className: '_File',
15762 _toFullJSON: function _toFullJSON(seenObjects) {
15763 var _this = this;
15764
15765 var full = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
15766
15767 var json = _.clone(this.attributes);
15768
15769 AV._objectEach(json, function (val, key) {
15770 json[key] = AV._encode(val, seenObjects, undefined, full);
15771 });
15772
15773 AV._objectEach(this._operations, function (val, key) {
15774 json[key] = val;
15775 });
15776
15777 if (_.has(this, 'id')) {
15778 json.objectId = this.id;
15779 }
15780
15781 ['createdAt', 'updatedAt'].forEach(function (key) {
15782 if (_.has(_this, key)) {
15783 var val = _this[key];
15784 json[key] = _.isDate(val) ? val.toJSON() : val;
15785 }
15786 });
15787
15788 if (full) {
15789 json.__type = 'File';
15790 }
15791
15792 return json;
15793 },
15794
15795 /**
15796 * Returns a JSON version of the file with meta data.
15797 * Inverse to {@link AV.parseJSON}
15798 * @since 3.0.0
15799 * @return {Object}
15800 */
15801 toFullJSON: function toFullJSON() {
15802 var seenObjects = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
15803 return this._toFullJSON(seenObjects);
15804 },
15805
15806 /**
15807 * Returns a JSON version of the object.
15808 * @return {Object}
15809 */
15810 toJSON: function toJSON(key, holder) {
15811 var seenObjects = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [this];
15812 return this._toFullJSON(seenObjects, false);
15813 },
15814
15815 /**
15816 * Gets a Pointer referencing this file.
15817 * @private
15818 */
15819 _toPointer: function _toPointer() {
15820 return {
15821 __type: 'Pointer',
15822 className: this.className,
15823 objectId: this.id
15824 };
15825 },
15826
15827 /**
15828 * Returns the ACL for this file.
15829 * @returns {AV.ACL} An instance of AV.ACL.
15830 */
15831 getACL: function getACL() {
15832 return this._acl;
15833 },
15834
15835 /**
15836 * Sets the ACL to be used for this file.
15837 * @param {AV.ACL} acl An instance of AV.ACL.
15838 */
15839 setACL: function setACL(acl) {
15840 if (!(acl instanceof AV.ACL)) {
15841 return new AVError(AVError.OTHER_CAUSE, 'ACL must be a AV.ACL.');
15842 }
15843
15844 this._acl = acl;
15845 return this;
15846 },
15847
15848 /**
15849 * Gets the name of the file. Before save is called, this is the filename
15850 * given by the user. After save is called, that name gets prefixed with a
15851 * unique identifier.
15852 */
15853 name: function name() {
15854 return this.get('name');
15855 },
15856
15857 /**
15858 * Gets the url of the file. It is only available after you save the file or
15859 * after you get the file from a AV.Object.
15860 * @return {String}
15861 */
15862 url: function url() {
15863 return this.get('url');
15864 },
15865
15866 /**
15867 * Gets the attributs of the file object.
15868 * @param {String} The attribute name which want to get.
15869 * @returns {Any}
15870 */
15871 get: function get(attrName) {
15872 switch (attrName) {
15873 case 'objectId':
15874 return this.id;
15875
15876 case 'url':
15877 case 'name':
15878 case 'mime_type':
15879 case 'metaData':
15880 case 'createdAt':
15881 case 'updatedAt':
15882 return this.attributes[attrName];
15883
15884 default:
15885 return this.attributes.metaData[attrName];
15886 }
15887 },
15888
15889 /**
15890 * Set the metaData of the file object.
15891 * @param {Object} Object is an key value Object for setting metaData.
15892 * @param {String} attr is an optional metadata key.
15893 * @param {Object} value is an optional metadata value.
15894 * @returns {String|Number|Array|Object}
15895 */
15896 set: function set() {
15897 var _this2 = this;
15898
15899 var set = function set(attrName, value) {
15900 switch (attrName) {
15901 case 'name':
15902 case 'url':
15903 case 'mime_type':
15904 case 'base64':
15905 case 'metaData':
15906 _this2.attributes[attrName] = value;
15907 break;
15908
15909 default:
15910 // File 并非一个 AVObject,不能完全自定义其他属性,所以只能都放在 metaData 上面
15911 _this2.attributes.metaData[attrName] = value;
15912 break;
15913 }
15914 };
15915
15916 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
15917 args[_key] = arguments[_key];
15918 }
15919
15920 switch (args.length) {
15921 case 1:
15922 // 传入一个 Object
15923 for (var k in args[0]) {
15924 set(k, args[0][k]);
15925 }
15926
15927 break;
15928
15929 case 2:
15930 set(args[0], args[1]);
15931 break;
15932 }
15933
15934 return this;
15935 },
15936
15937 /**
15938 * Set a header for the upload request.
15939 * For more infomation, go to https://url.leanapp.cn/avfile-upload-headers
15940 *
15941 * @param {String} key header key
15942 * @param {String} value header value
15943 * @return {AV.File} this
15944 */
15945 setUploadHeader: function setUploadHeader(key, value) {
15946 this._uploadHeaders[key] = value;
15947 return this;
15948 },
15949
15950 /**
15951 * <p>Returns the file's metadata JSON object if no arguments is given.Returns the
15952 * metadata value if a key is given.Set metadata value if key and value are both given.</p>
15953 * <p><pre>
15954 * var metadata = file.metaData(); //Get metadata JSON object.
15955 * var size = file.metaData('size'); // Get the size metadata value.
15956 * file.metaData('format', 'jpeg'); //set metadata attribute and value.
15957 *</pre></p>
15958 * @return {Object} The file's metadata JSON object.
15959 * @param {String} attr an optional metadata key.
15960 * @param {Object} value an optional metadata value.
15961 **/
15962 metaData: function metaData(attr, value) {
15963 if (attr && value) {
15964 this.attributes.metaData[attr] = value;
15965 return this;
15966 } else if (attr && !value) {
15967 return this.attributes.metaData[attr];
15968 } else {
15969 return this.attributes.metaData;
15970 }
15971 },
15972
15973 /**
15974 * 如果文件是图片,获取图片的缩略图URL。可以传入宽度、高度、质量、格式等参数。
15975 * @return {String} 缩略图URL
15976 * @param {Number} width 宽度,单位:像素
15977 * @param {Number} heigth 高度,单位:像素
15978 * @param {Number} quality 质量,1-100的数字,默认100
15979 * @param {Number} scaleToFit 是否将图片自适应大小。默认为true。
15980 * @param {String} fmt 格式,默认为png,也可以为jpeg,gif等格式。
15981 */
15982 thumbnailURL: function thumbnailURL(width, height) {
15983 var quality = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 100;
15984 var scaleToFit = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
15985 var fmt = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 'png';
15986 var url = this.attributes.url;
15987
15988 if (!url) {
15989 throw new Error('Invalid url.');
15990 }
15991
15992 if (!width || !height || width <= 0 || height <= 0) {
15993 throw new Error('Invalid width or height value.');
15994 }
15995
15996 if (quality <= 0 || quality > 100) {
15997 throw new Error('Invalid quality value.');
15998 }
15999
16000 var mode = scaleToFit ? 2 : 1;
16001 return url + '?imageView/' + mode + '/w/' + width + '/h/' + height + '/q/' + quality + '/format/' + fmt;
16002 },
16003
16004 /**
16005 * Returns the file's size.
16006 * @return {Number} The file's size in bytes.
16007 **/
16008 size: function size() {
16009 return this.metaData().size;
16010 },
16011
16012 /**
16013 * Returns the file's owner.
16014 * @return {String} The file's owner id.
16015 */
16016 ownerId: function ownerId() {
16017 return this.metaData().owner;
16018 },
16019
16020 /**
16021 * Destroy the file.
16022 * @param {AuthOptions} options
16023 * @return {Promise} A promise that is fulfilled when the destroy
16024 * completes.
16025 */
16026 destroy: function destroy(options) {
16027 if (!this.id) {
16028 return _promise.default.reject(new Error('The file id does not eixst.'));
16029 }
16030
16031 var request = AVRequest('files', null, this.id, 'DELETE', null, options);
16032 return request;
16033 },
16034
16035 /**
16036 * Request Qiniu upload token
16037 * @param {string} type
16038 * @return {Promise} Resolved with the response
16039 * @private
16040 */
16041 _fileToken: function _fileToken(type, authOptions) {
16042 var name = this.attributes.name;
16043 var extName = extname(name);
16044
16045 if (!extName && this._extName) {
16046 name += this._extName;
16047 extName = this._extName;
16048 }
16049
16050 var data = {
16051 name: name,
16052 keep_file_name: authOptions.keepFileName,
16053 key: authOptions.key,
16054 ACL: this._acl,
16055 mime_type: type,
16056 metaData: this.attributes.metaData
16057 };
16058 return AVRequest('fileTokens', null, null, 'POST', data, authOptions);
16059 },
16060
16061 /**
16062 * @callback UploadProgressCallback
16063 * @param {XMLHttpRequestProgressEvent} event - The progress event with 'loaded' and 'total' attributes
16064 */
16065
16066 /**
16067 * Saves the file to the AV cloud.
16068 * @param {AuthOptions} [options] AuthOptions plus:
16069 * @param {UploadProgressCallback} [options.onprogress] 文件上传进度,在 Node.js 中无效,回调参数说明详见 {@link UploadProgressCallback}。
16070 * @param {boolean} [options.keepFileName = false] 保留下载文件的文件名。
16071 * @param {string} [options.key] 指定文件的 key。设置该选项需要使用 masterKey
16072 * @return {Promise} Promise that is resolved when the save finishes.
16073 */
16074 save: function save() {
16075 var _this3 = this;
16076
16077 var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
16078
16079 if (this.id) {
16080 throw new Error('File is already saved.');
16081 }
16082
16083 if (!this._previousSave) {
16084 if (this._data) {
16085 var mimeType = this.get('mime_type');
16086 this._previousSave = this._fileToken(mimeType, options).then(function (uploadInfo) {
16087 if (uploadInfo.mime_type) {
16088 mimeType = uploadInfo.mime_type;
16089
16090 _this3.set('mime_type', mimeType);
16091 }
16092
16093 _this3._token = uploadInfo.token;
16094 return _promise.default.resolve().then(function () {
16095 var data = _this3._data;
16096
16097 if (data && data.base64) {
16098 return parseBase64(data.base64, mimeType);
16099 }
16100
16101 if (data && data.blob) {
16102 if (!data.blob.type && mimeType) {
16103 data.blob.type = mimeType;
16104 }
16105
16106 if (!data.blob.name) {
16107 data.blob.name = _this3.get('name');
16108 }
16109
16110 return data.blob;
16111 }
16112
16113 if (typeof Blob !== 'undefined' && data instanceof Blob) {
16114 return data;
16115 }
16116
16117 throw new TypeError('malformed file data');
16118 }).then(function (data) {
16119 var _options = _.extend({}, options); // filter out download progress events
16120
16121
16122 if (options.onprogress) {
16123 _options.onprogress = function (event) {
16124 if (event.direction === 'download') return;
16125 return options.onprogress(event);
16126 };
16127 }
16128
16129 switch (uploadInfo.provider) {
16130 case 's3':
16131 return s3(uploadInfo, data, _this3, _options);
16132
16133 case 'qcloud':
16134 return cos(uploadInfo, data, _this3, _options);
16135
16136 case 'qiniu':
16137 default:
16138 return qiniu(uploadInfo, data, _this3, _options);
16139 }
16140 }).then(tap(function () {
16141 return _this3._callback(true);
16142 }), function (error) {
16143 _this3._callback(false);
16144
16145 throw error;
16146 });
16147 });
16148 } else if (this.attributes.url && this.attributes.metaData.__source === 'external') {
16149 // external link file.
16150 var data = {
16151 name: this.attributes.name,
16152 ACL: this._acl,
16153 metaData: this.attributes.metaData,
16154 mime_type: this.mimeType,
16155 url: this.attributes.url
16156 };
16157 this._previousSave = AVRequest('files', null, null, 'post', data, options).then(function (response) {
16158 _this3.id = response.objectId;
16159 return _this3;
16160 });
16161 }
16162 }
16163
16164 return this._previousSave;
16165 },
16166 _callback: function _callback(success) {
16167 AVRequest('fileCallback', null, null, 'post', {
16168 token: this._token,
16169 result: success
16170 }).catch(debug);
16171 delete this._token;
16172 delete this._data;
16173 },
16174
16175 /**
16176 * fetch the file from server. If the server's representation of the
16177 * model differs from its current attributes, they will be overriden,
16178 * @param {Object} fetchOptions Optional options to set 'keys',
16179 * 'include' and 'includeACL' option.
16180 * @param {AuthOptions} options
16181 * @return {Promise} A promise that is fulfilled when the fetch
16182 * completes.
16183 */
16184 fetch: function fetch(fetchOptions, options) {
16185 if (!this.id) {
16186 throw new Error('Cannot fetch unsaved file');
16187 }
16188
16189 var request = AVRequest('files', null, this.id, 'GET', transformFetchOptions(fetchOptions), options);
16190 return request.then(this._finishFetch.bind(this));
16191 },
16192 _finishFetch: function _finishFetch(response) {
16193 var value = AV.Object.prototype.parse(response);
16194 value.attributes = {
16195 name: value.name,
16196 url: value.url,
16197 mime_type: value.mime_type,
16198 bucket: value.bucket
16199 };
16200 value.attributes.metaData = value.metaData || {};
16201 value.id = value.objectId; // clean
16202
16203 delete value.objectId;
16204 delete value.metaData;
16205 delete value.url;
16206 delete value.name;
16207 delete value.mime_type;
16208 delete value.bucket;
16209
16210 _.extend(this, value);
16211
16212 return this;
16213 },
16214
16215 /**
16216 * Request file censor
16217 * @since 4.13.0
16218 * @return {Promise.<string>}
16219 */
16220 censor: function censor() {
16221 if (!this.id) {
16222 throw new Error('Cannot censor an unsaved file');
16223 }
16224
16225 return AV.File.censor(this.id);
16226 }
16227 });
16228};
16229
16230/***/ }),
16231/* 481 */
16232/***/ (function(module, exports, __webpack_require__) {
16233
16234"use strict";
16235
16236
16237var _require = __webpack_require__(76),
16238 getAdapter = _require.getAdapter;
16239
16240var debug = __webpack_require__(63)('cos');
16241
16242module.exports = function (uploadInfo, data, file) {
16243 var saveOptions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
16244 var url = uploadInfo.upload_url + '?sign=' + encodeURIComponent(uploadInfo.token);
16245 var fileFormData = {
16246 field: 'fileContent',
16247 data: data,
16248 name: file.attributes.name
16249 };
16250 var options = {
16251 headers: file._uploadHeaders,
16252 data: {
16253 op: 'upload'
16254 },
16255 onprogress: saveOptions.onprogress
16256 };
16257 debug('url: %s, file: %o, options: %o', url, fileFormData, options);
16258 var upload = getAdapter('upload');
16259 return upload(url, fileFormData, options).then(function (response) {
16260 debug(response.status, response.data);
16261
16262 if (response.ok === false) {
16263 var error = new Error(response.status);
16264 error.response = response;
16265 throw error;
16266 }
16267
16268 file.attributes.url = uploadInfo.url;
16269 file._bucket = uploadInfo.bucket;
16270 file.id = uploadInfo.objectId;
16271 return file;
16272 }, function (error) {
16273 var response = error.response;
16274
16275 if (response) {
16276 debug(response.status, response.data);
16277 error.statusCode = response.status;
16278 error.response = response.data;
16279 }
16280
16281 throw error;
16282 });
16283};
16284
16285/***/ }),
16286/* 482 */
16287/***/ (function(module, exports, __webpack_require__) {
16288
16289"use strict";
16290
16291
16292var _sliceInstanceProperty2 = __webpack_require__(34);
16293
16294var _Array$from = __webpack_require__(152);
16295
16296var _Symbol = __webpack_require__(77);
16297
16298var _getIteratorMethod = __webpack_require__(252);
16299
16300var _Reflect$construct = __webpack_require__(492);
16301
16302var _interopRequireDefault = __webpack_require__(1);
16303
16304var _inherits2 = _interopRequireDefault(__webpack_require__(496));
16305
16306var _possibleConstructorReturn2 = _interopRequireDefault(__webpack_require__(518));
16307
16308var _getPrototypeOf2 = _interopRequireDefault(__webpack_require__(520));
16309
16310var _classCallCheck2 = _interopRequireDefault(__webpack_require__(525));
16311
16312var _createClass2 = _interopRequireDefault(__webpack_require__(526));
16313
16314var _stringify = _interopRequireDefault(__webpack_require__(38));
16315
16316var _concat = _interopRequireDefault(__webpack_require__(19));
16317
16318var _promise = _interopRequireDefault(__webpack_require__(12));
16319
16320var _slice = _interopRequireDefault(__webpack_require__(34));
16321
16322function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = _Reflect$construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
16323
16324function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !_Reflect$construct) return false; if (_Reflect$construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
16325
16326function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof _Symbol !== "undefined" && _getIteratorMethod(o) || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
16327
16328function _unsupportedIterableToArray(o, minLen) { var _context8; if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = _sliceInstanceProperty2(_context8 = Object.prototype.toString.call(o)).call(_context8, 8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return _Array$from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
16329
16330function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
16331
16332var _require = __webpack_require__(76),
16333 getAdapter = _require.getAdapter;
16334
16335var debug = __webpack_require__(63)('leancloud:qiniu');
16336
16337var ajax = __webpack_require__(117);
16338
16339var btoa = __webpack_require__(527);
16340
16341var SHARD_THRESHOLD = 1024 * 1024 * 64;
16342var CHUNK_SIZE = 1024 * 1024 * 16;
16343
16344function upload(uploadInfo, data, file) {
16345 var saveOptions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
16346 // Get the uptoken to upload files to qiniu.
16347 var uptoken = uploadInfo.token;
16348 var url = uploadInfo.upload_url || 'https://upload.qiniup.com';
16349 var fileFormData = {
16350 field: 'file',
16351 data: data,
16352 name: file.attributes.name
16353 };
16354 var options = {
16355 headers: file._uploadHeaders,
16356 data: {
16357 name: file.attributes.name,
16358 key: uploadInfo.key,
16359 token: uptoken
16360 },
16361 onprogress: saveOptions.onprogress
16362 };
16363 debug('url: %s, file: %o, options: %o', url, fileFormData, options);
16364 var upload = getAdapter('upload');
16365 return upload(url, fileFormData, options).then(function (response) {
16366 debug(response.status, response.data);
16367
16368 if (response.ok === false) {
16369 var message = response.status;
16370
16371 if (response.data) {
16372 if (response.data.error) {
16373 message = response.data.error;
16374 } else {
16375 message = (0, _stringify.default)(response.data);
16376 }
16377 }
16378
16379 var error = new Error(message);
16380 error.response = response;
16381 throw error;
16382 }
16383
16384 file.attributes.url = uploadInfo.url;
16385 file._bucket = uploadInfo.bucket;
16386 file.id = uploadInfo.objectId;
16387 return file;
16388 }, function (error) {
16389 var response = error.response;
16390
16391 if (response) {
16392 debug(response.status, response.data);
16393 error.statusCode = response.status;
16394 error.response = response.data;
16395 }
16396
16397 throw error;
16398 });
16399}
16400
16401function urlSafeBase64(string) {
16402 var base64 = btoa(unescape(encodeURIComponent(string)));
16403 var result = '';
16404
16405 var _iterator = _createForOfIteratorHelper(base64),
16406 _step;
16407
16408 try {
16409 for (_iterator.s(); !(_step = _iterator.n()).done;) {
16410 var ch = _step.value;
16411
16412 switch (ch) {
16413 case '+':
16414 result += '-';
16415 break;
16416
16417 case '/':
16418 result += '_';
16419 break;
16420
16421 default:
16422 result += ch;
16423 }
16424 }
16425 } catch (err) {
16426 _iterator.e(err);
16427 } finally {
16428 _iterator.f();
16429 }
16430
16431 return result;
16432}
16433
16434var ShardUploader = /*#__PURE__*/function () {
16435 function ShardUploader(uploadInfo, data, file, saveOptions) {
16436 var _context,
16437 _context2,
16438 _this = this;
16439
16440 (0, _classCallCheck2.default)(this, ShardUploader);
16441 this.uploadInfo = uploadInfo;
16442 this.data = data;
16443 this.file = file;
16444 this.size = undefined;
16445 this.offset = 0;
16446 this.uploadedChunks = 0;
16447 var key = urlSafeBase64(uploadInfo.key);
16448 var uploadURL = uploadInfo.upload_url || 'https://upload.qiniup.com';
16449 this.baseURL = (0, _concat.default)(_context = (0, _concat.default)(_context2 = "".concat(uploadURL, "/buckets/")).call(_context2, uploadInfo.bucket, "/objects/")).call(_context, key, "/uploads");
16450 this.upToken = 'UpToken ' + uploadInfo.token;
16451 this.uploaded = 0;
16452
16453 if (saveOptions && saveOptions.onprogress) {
16454 this.onProgress = function (_ref) {
16455 var loaded = _ref.loaded;
16456 loaded += _this.uploadedChunks * CHUNK_SIZE;
16457
16458 if (loaded <= _this.uploaded) {
16459 return;
16460 }
16461
16462 if (_this.size) {
16463 saveOptions.onprogress({
16464 loaded: loaded,
16465 total: _this.size,
16466 percent: loaded / _this.size * 100
16467 });
16468 } else {
16469 saveOptions.onprogress({
16470 loaded: loaded
16471 });
16472 }
16473
16474 _this.uploaded = loaded;
16475 };
16476 }
16477 }
16478 /**
16479 * @returns {Promise<string>}
16480 */
16481
16482
16483 (0, _createClass2.default)(ShardUploader, [{
16484 key: "getUploadId",
16485 value: function getUploadId() {
16486 return ajax({
16487 method: 'POST',
16488 url: this.baseURL,
16489 headers: {
16490 Authorization: this.upToken
16491 }
16492 }).then(function (res) {
16493 return res.uploadId;
16494 });
16495 }
16496 }, {
16497 key: "getChunk",
16498 value: function getChunk() {
16499 throw new Error('Not implemented');
16500 }
16501 /**
16502 * @param {string} uploadId
16503 * @param {number} partNumber
16504 * @param {any} data
16505 * @returns {Promise<{ partNumber: number, etag: string }>}
16506 */
16507
16508 }, {
16509 key: "uploadPart",
16510 value: function uploadPart(uploadId, partNumber, data) {
16511 var _context3, _context4;
16512
16513 return ajax({
16514 method: 'PUT',
16515 url: (0, _concat.default)(_context3 = (0, _concat.default)(_context4 = "".concat(this.baseURL, "/")).call(_context4, uploadId, "/")).call(_context3, partNumber),
16516 headers: {
16517 Authorization: this.upToken
16518 },
16519 data: data,
16520 onprogress: this.onProgress
16521 }).then(function (_ref2) {
16522 var etag = _ref2.etag;
16523 return {
16524 partNumber: partNumber,
16525 etag: etag
16526 };
16527 });
16528 }
16529 }, {
16530 key: "stopUpload",
16531 value: function stopUpload(uploadId) {
16532 var _context5;
16533
16534 return ajax({
16535 method: 'DELETE',
16536 url: (0, _concat.default)(_context5 = "".concat(this.baseURL, "/")).call(_context5, uploadId),
16537 headers: {
16538 Authorization: this.upToken
16539 }
16540 });
16541 }
16542 }, {
16543 key: "upload",
16544 value: function upload() {
16545 var _this2 = this;
16546
16547 var parts = [];
16548 return this.getUploadId().then(function (uploadId) {
16549 var uploadPart = function uploadPart() {
16550 return _promise.default.resolve(_this2.getChunk()).then(function (chunk) {
16551 if (!chunk) {
16552 return;
16553 }
16554
16555 var partNumber = parts.length + 1;
16556 return _this2.uploadPart(uploadId, partNumber, chunk).then(function (part) {
16557 parts.push(part);
16558 _this2.uploadedChunks++;
16559 return uploadPart();
16560 });
16561 }).catch(function (error) {
16562 return _this2.stopUpload(uploadId).then(function () {
16563 return _promise.default.reject(error);
16564 });
16565 });
16566 };
16567
16568 return uploadPart().then(function () {
16569 var _context6;
16570
16571 return ajax({
16572 method: 'POST',
16573 url: (0, _concat.default)(_context6 = "".concat(_this2.baseURL, "/")).call(_context6, uploadId),
16574 headers: {
16575 Authorization: _this2.upToken
16576 },
16577 data: {
16578 parts: parts,
16579 fname: _this2.file.attributes.name,
16580 mimeType: _this2.file.attributes.mime_type
16581 }
16582 });
16583 });
16584 }).then(function () {
16585 _this2.file.attributes.url = _this2.uploadInfo.url;
16586 _this2.file._bucket = _this2.uploadInfo.bucket;
16587 _this2.file.id = _this2.uploadInfo.objectId;
16588 return _this2.file;
16589 });
16590 }
16591 }]);
16592 return ShardUploader;
16593}();
16594
16595var BlobUploader = /*#__PURE__*/function (_ShardUploader) {
16596 (0, _inherits2.default)(BlobUploader, _ShardUploader);
16597
16598 var _super = _createSuper(BlobUploader);
16599
16600 function BlobUploader(uploadInfo, data, file, saveOptions) {
16601 var _this3;
16602
16603 (0, _classCallCheck2.default)(this, BlobUploader);
16604 _this3 = _super.call(this, uploadInfo, data, file, saveOptions);
16605 _this3.size = data.size;
16606 return _this3;
16607 }
16608 /**
16609 * @returns {Blob | null}
16610 */
16611
16612
16613 (0, _createClass2.default)(BlobUploader, [{
16614 key: "getChunk",
16615 value: function getChunk() {
16616 var _context7;
16617
16618 if (this.offset >= this.size) {
16619 return null;
16620 }
16621
16622 var chunk = (0, _slice.default)(_context7 = this.data).call(_context7, this.offset, this.offset + CHUNK_SIZE);
16623 this.offset += chunk.size;
16624 return chunk;
16625 }
16626 }]);
16627 return BlobUploader;
16628}(ShardUploader);
16629
16630function isBlob(data) {
16631 return typeof Blob !== 'undefined' && data instanceof Blob;
16632}
16633
16634module.exports = function (uploadInfo, data, file) {
16635 var saveOptions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
16636
16637 if (isBlob(data) && data.size >= SHARD_THRESHOLD) {
16638 return new BlobUploader(uploadInfo, data, file, saveOptions).upload();
16639 }
16640
16641 return upload(uploadInfo, data, file, saveOptions);
16642};
16643
16644/***/ }),
16645/* 483 */
16646/***/ (function(module, exports, __webpack_require__) {
16647
16648__webpack_require__(70);
16649__webpack_require__(484);
16650var path = __webpack_require__(7);
16651
16652module.exports = path.Array.from;
16653
16654
16655/***/ }),
16656/* 484 */
16657/***/ (function(module, exports, __webpack_require__) {
16658
16659var $ = __webpack_require__(0);
16660var from = __webpack_require__(485);
16661var checkCorrectnessOfIteration = __webpack_require__(177);
16662
16663var INCORRECT_ITERATION = !checkCorrectnessOfIteration(function (iterable) {
16664 // eslint-disable-next-line es-x/no-array-from -- required for testing
16665 Array.from(iterable);
16666});
16667
16668// `Array.from` method
16669// https://tc39.es/ecma262/#sec-array.from
16670$({ target: 'Array', stat: true, forced: INCORRECT_ITERATION }, {
16671 from: from
16672});
16673
16674
16675/***/ }),
16676/* 485 */
16677/***/ (function(module, exports, __webpack_require__) {
16678
16679"use strict";
16680
16681var bind = __webpack_require__(52);
16682var call = __webpack_require__(15);
16683var toObject = __webpack_require__(33);
16684var callWithSafeIterationClosing = __webpack_require__(486);
16685var isArrayIteratorMethod = __webpack_require__(165);
16686var isConstructor = __webpack_require__(111);
16687var lengthOfArrayLike = __webpack_require__(40);
16688var createProperty = __webpack_require__(93);
16689var getIterator = __webpack_require__(166);
16690var getIteratorMethod = __webpack_require__(108);
16691
16692var $Array = Array;
16693
16694// `Array.from` method implementation
16695// https://tc39.es/ecma262/#sec-array.from
16696module.exports = function from(arrayLike /* , mapfn = undefined, thisArg = undefined */) {
16697 var O = toObject(arrayLike);
16698 var IS_CONSTRUCTOR = isConstructor(this);
16699 var argumentsLength = arguments.length;
16700 var mapfn = argumentsLength > 1 ? arguments[1] : undefined;
16701 var mapping = mapfn !== undefined;
16702 if (mapping) mapfn = bind(mapfn, argumentsLength > 2 ? arguments[2] : undefined);
16703 var iteratorMethod = getIteratorMethod(O);
16704 var index = 0;
16705 var length, result, step, iterator, next, value;
16706 // if the target is not iterable or it's an array with the default iterator - use a simple case
16707 if (iteratorMethod && !(this === $Array && isArrayIteratorMethod(iteratorMethod))) {
16708 iterator = getIterator(O, iteratorMethod);
16709 next = iterator.next;
16710 result = IS_CONSTRUCTOR ? new this() : [];
16711 for (;!(step = call(next, iterator)).done; index++) {
16712 value = mapping ? callWithSafeIterationClosing(iterator, mapfn, [step.value, index], true) : step.value;
16713 createProperty(result, index, value);
16714 }
16715 } else {
16716 length = lengthOfArrayLike(O);
16717 result = IS_CONSTRUCTOR ? new this(length) : $Array(length);
16718 for (;length > index; index++) {
16719 value = mapping ? mapfn(O[index], index) : O[index];
16720 createProperty(result, index, value);
16721 }
16722 }
16723 result.length = index;
16724 return result;
16725};
16726
16727
16728/***/ }),
16729/* 486 */
16730/***/ (function(module, exports, __webpack_require__) {
16731
16732var anObject = __webpack_require__(21);
16733var iteratorClose = __webpack_require__(167);
16734
16735// call something on iterator step with safe closing on error
16736module.exports = function (iterator, fn, value, ENTRIES) {
16737 try {
16738 return ENTRIES ? fn(anObject(value)[0], value[1]) : fn(value);
16739 } catch (error) {
16740 iteratorClose(iterator, 'throw', error);
16741 }
16742};
16743
16744
16745/***/ }),
16746/* 487 */
16747/***/ (function(module, exports, __webpack_require__) {
16748
16749module.exports = __webpack_require__(488);
16750
16751
16752/***/ }),
16753/* 488 */
16754/***/ (function(module, exports, __webpack_require__) {
16755
16756var parent = __webpack_require__(489);
16757
16758module.exports = parent;
16759
16760
16761/***/ }),
16762/* 489 */
16763/***/ (function(module, exports, __webpack_require__) {
16764
16765var parent = __webpack_require__(490);
16766
16767module.exports = parent;
16768
16769
16770/***/ }),
16771/* 490 */
16772/***/ (function(module, exports, __webpack_require__) {
16773
16774var parent = __webpack_require__(491);
16775__webpack_require__(46);
16776
16777module.exports = parent;
16778
16779
16780/***/ }),
16781/* 491 */
16782/***/ (function(module, exports, __webpack_require__) {
16783
16784__webpack_require__(43);
16785__webpack_require__(70);
16786var getIteratorMethod = __webpack_require__(108);
16787
16788module.exports = getIteratorMethod;
16789
16790
16791/***/ }),
16792/* 492 */
16793/***/ (function(module, exports, __webpack_require__) {
16794
16795module.exports = __webpack_require__(493);
16796
16797/***/ }),
16798/* 493 */
16799/***/ (function(module, exports, __webpack_require__) {
16800
16801var parent = __webpack_require__(494);
16802
16803module.exports = parent;
16804
16805
16806/***/ }),
16807/* 494 */
16808/***/ (function(module, exports, __webpack_require__) {
16809
16810__webpack_require__(495);
16811var path = __webpack_require__(7);
16812
16813module.exports = path.Reflect.construct;
16814
16815
16816/***/ }),
16817/* 495 */
16818/***/ (function(module, exports, __webpack_require__) {
16819
16820var $ = __webpack_require__(0);
16821var getBuiltIn = __webpack_require__(20);
16822var apply = __webpack_require__(79);
16823var bind = __webpack_require__(253);
16824var aConstructor = __webpack_require__(173);
16825var anObject = __webpack_require__(21);
16826var isObject = __webpack_require__(11);
16827var create = __webpack_require__(53);
16828var fails = __webpack_require__(2);
16829
16830var nativeConstruct = getBuiltIn('Reflect', 'construct');
16831var ObjectPrototype = Object.prototype;
16832var push = [].push;
16833
16834// `Reflect.construct` method
16835// https://tc39.es/ecma262/#sec-reflect.construct
16836// MS Edge supports only 2 arguments and argumentsList argument is optional
16837// FF Nightly sets third argument as `new.target`, but does not create `this` from it
16838var NEW_TARGET_BUG = fails(function () {
16839 function F() { /* empty */ }
16840 return !(nativeConstruct(function () { /* empty */ }, [], F) instanceof F);
16841});
16842
16843var ARGS_BUG = !fails(function () {
16844 nativeConstruct(function () { /* empty */ });
16845});
16846
16847var FORCED = NEW_TARGET_BUG || ARGS_BUG;
16848
16849$({ target: 'Reflect', stat: true, forced: FORCED, sham: FORCED }, {
16850 construct: function construct(Target, args /* , newTarget */) {
16851 aConstructor(Target);
16852 anObject(args);
16853 var newTarget = arguments.length < 3 ? Target : aConstructor(arguments[2]);
16854 if (ARGS_BUG && !NEW_TARGET_BUG) return nativeConstruct(Target, args, newTarget);
16855 if (Target == newTarget) {
16856 // w/o altered newTarget, optimization for 0-4 arguments
16857 switch (args.length) {
16858 case 0: return new Target();
16859 case 1: return new Target(args[0]);
16860 case 2: return new Target(args[0], args[1]);
16861 case 3: return new Target(args[0], args[1], args[2]);
16862 case 4: return new Target(args[0], args[1], args[2], args[3]);
16863 }
16864 // w/o altered newTarget, lot of arguments case
16865 var $args = [null];
16866 apply(push, $args, args);
16867 return new (apply(bind, Target, $args))();
16868 }
16869 // with altered newTarget, not support built-in constructors
16870 var proto = newTarget.prototype;
16871 var instance = create(isObject(proto) ? proto : ObjectPrototype);
16872 var result = apply(Target, instance, args);
16873 return isObject(result) ? result : instance;
16874 }
16875});
16876
16877
16878/***/ }),
16879/* 496 */
16880/***/ (function(module, exports, __webpack_require__) {
16881
16882var _Object$create = __webpack_require__(497);
16883
16884var _Object$defineProperty = __webpack_require__(153);
16885
16886var setPrototypeOf = __webpack_require__(507);
16887
16888function _inherits(subClass, superClass) {
16889 if (typeof superClass !== "function" && superClass !== null) {
16890 throw new TypeError("Super expression must either be null or a function");
16891 }
16892
16893 subClass.prototype = _Object$create(superClass && superClass.prototype, {
16894 constructor: {
16895 value: subClass,
16896 writable: true,
16897 configurable: true
16898 }
16899 });
16900
16901 _Object$defineProperty(subClass, "prototype", {
16902 writable: false
16903 });
16904
16905 if (superClass) setPrototypeOf(subClass, superClass);
16906}
16907
16908module.exports = _inherits, module.exports.__esModule = true, module.exports["default"] = module.exports;
16909
16910/***/ }),
16911/* 497 */
16912/***/ (function(module, exports, __webpack_require__) {
16913
16914module.exports = __webpack_require__(498);
16915
16916/***/ }),
16917/* 498 */
16918/***/ (function(module, exports, __webpack_require__) {
16919
16920module.exports = __webpack_require__(499);
16921
16922
16923/***/ }),
16924/* 499 */
16925/***/ (function(module, exports, __webpack_require__) {
16926
16927var parent = __webpack_require__(500);
16928
16929module.exports = parent;
16930
16931
16932/***/ }),
16933/* 500 */
16934/***/ (function(module, exports, __webpack_require__) {
16935
16936var parent = __webpack_require__(501);
16937
16938module.exports = parent;
16939
16940
16941/***/ }),
16942/* 501 */
16943/***/ (function(module, exports, __webpack_require__) {
16944
16945var parent = __webpack_require__(502);
16946
16947module.exports = parent;
16948
16949
16950/***/ }),
16951/* 502 */
16952/***/ (function(module, exports, __webpack_require__) {
16953
16954__webpack_require__(503);
16955var path = __webpack_require__(7);
16956
16957var Object = path.Object;
16958
16959module.exports = function create(P, D) {
16960 return Object.create(P, D);
16961};
16962
16963
16964/***/ }),
16965/* 503 */
16966/***/ (function(module, exports, __webpack_require__) {
16967
16968// TODO: Remove from `core-js@4`
16969var $ = __webpack_require__(0);
16970var DESCRIPTORS = __webpack_require__(14);
16971var create = __webpack_require__(53);
16972
16973// `Object.create` method
16974// https://tc39.es/ecma262/#sec-object.create
16975$({ target: 'Object', stat: true, sham: !DESCRIPTORS }, {
16976 create: create
16977});
16978
16979
16980/***/ }),
16981/* 504 */
16982/***/ (function(module, exports, __webpack_require__) {
16983
16984module.exports = __webpack_require__(505);
16985
16986
16987/***/ }),
16988/* 505 */
16989/***/ (function(module, exports, __webpack_require__) {
16990
16991var parent = __webpack_require__(506);
16992
16993module.exports = parent;
16994
16995
16996/***/ }),
16997/* 506 */
16998/***/ (function(module, exports, __webpack_require__) {
16999
17000var parent = __webpack_require__(239);
17001
17002module.exports = parent;
17003
17004
17005/***/ }),
17006/* 507 */
17007/***/ (function(module, exports, __webpack_require__) {
17008
17009var _Object$setPrototypeOf = __webpack_require__(254);
17010
17011var _bindInstanceProperty = __webpack_require__(255);
17012
17013function _setPrototypeOf(o, p) {
17014 var _context;
17015
17016 module.exports = _setPrototypeOf = _Object$setPrototypeOf ? _bindInstanceProperty(_context = _Object$setPrototypeOf).call(_context) : function _setPrototypeOf(o, p) {
17017 o.__proto__ = p;
17018 return o;
17019 }, module.exports.__esModule = true, module.exports["default"] = module.exports;
17020 return _setPrototypeOf(o, p);
17021}
17022
17023module.exports = _setPrototypeOf, module.exports.__esModule = true, module.exports["default"] = module.exports;
17024
17025/***/ }),
17026/* 508 */
17027/***/ (function(module, exports, __webpack_require__) {
17028
17029module.exports = __webpack_require__(509);
17030
17031
17032/***/ }),
17033/* 509 */
17034/***/ (function(module, exports, __webpack_require__) {
17035
17036var parent = __webpack_require__(510);
17037
17038module.exports = parent;
17039
17040
17041/***/ }),
17042/* 510 */
17043/***/ (function(module, exports, __webpack_require__) {
17044
17045var parent = __webpack_require__(237);
17046
17047module.exports = parent;
17048
17049
17050/***/ }),
17051/* 511 */
17052/***/ (function(module, exports, __webpack_require__) {
17053
17054module.exports = __webpack_require__(512);
17055
17056
17057/***/ }),
17058/* 512 */
17059/***/ (function(module, exports, __webpack_require__) {
17060
17061var parent = __webpack_require__(513);
17062
17063module.exports = parent;
17064
17065
17066/***/ }),
17067/* 513 */
17068/***/ (function(module, exports, __webpack_require__) {
17069
17070var parent = __webpack_require__(514);
17071
17072module.exports = parent;
17073
17074
17075/***/ }),
17076/* 514 */
17077/***/ (function(module, exports, __webpack_require__) {
17078
17079var parent = __webpack_require__(515);
17080
17081module.exports = parent;
17082
17083
17084/***/ }),
17085/* 515 */
17086/***/ (function(module, exports, __webpack_require__) {
17087
17088var isPrototypeOf = __webpack_require__(16);
17089var method = __webpack_require__(516);
17090
17091var FunctionPrototype = Function.prototype;
17092
17093module.exports = function (it) {
17094 var own = it.bind;
17095 return it === FunctionPrototype || (isPrototypeOf(FunctionPrototype, it) && own === FunctionPrototype.bind) ? method : own;
17096};
17097
17098
17099/***/ }),
17100/* 516 */
17101/***/ (function(module, exports, __webpack_require__) {
17102
17103__webpack_require__(517);
17104var entryVirtual = __webpack_require__(27);
17105
17106module.exports = entryVirtual('Function').bind;
17107
17108
17109/***/ }),
17110/* 517 */
17111/***/ (function(module, exports, __webpack_require__) {
17112
17113// TODO: Remove from `core-js@4`
17114var $ = __webpack_require__(0);
17115var bind = __webpack_require__(253);
17116
17117// `Function.prototype.bind` method
17118// https://tc39.es/ecma262/#sec-function.prototype.bind
17119$({ target: 'Function', proto: true, forced: Function.bind !== bind }, {
17120 bind: bind
17121});
17122
17123
17124/***/ }),
17125/* 518 */
17126/***/ (function(module, exports, __webpack_require__) {
17127
17128var _typeof = __webpack_require__(95)["default"];
17129
17130var assertThisInitialized = __webpack_require__(519);
17131
17132function _possibleConstructorReturn(self, call) {
17133 if (call && (_typeof(call) === "object" || typeof call === "function")) {
17134 return call;
17135 } else if (call !== void 0) {
17136 throw new TypeError("Derived constructors may only return object or undefined");
17137 }
17138
17139 return assertThisInitialized(self);
17140}
17141
17142module.exports = _possibleConstructorReturn, module.exports.__esModule = true, module.exports["default"] = module.exports;
17143
17144/***/ }),
17145/* 519 */
17146/***/ (function(module, exports) {
17147
17148function _assertThisInitialized(self) {
17149 if (self === void 0) {
17150 throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
17151 }
17152
17153 return self;
17154}
17155
17156module.exports = _assertThisInitialized, module.exports.__esModule = true, module.exports["default"] = module.exports;
17157
17158/***/ }),
17159/* 520 */
17160/***/ (function(module, exports, __webpack_require__) {
17161
17162var _Object$setPrototypeOf = __webpack_require__(254);
17163
17164var _bindInstanceProperty = __webpack_require__(255);
17165
17166var _Object$getPrototypeOf = __webpack_require__(521);
17167
17168function _getPrototypeOf(o) {
17169 var _context;
17170
17171 module.exports = _getPrototypeOf = _Object$setPrototypeOf ? _bindInstanceProperty(_context = _Object$getPrototypeOf).call(_context) : function _getPrototypeOf(o) {
17172 return o.__proto__ || _Object$getPrototypeOf(o);
17173 }, module.exports.__esModule = true, module.exports["default"] = module.exports;
17174 return _getPrototypeOf(o);
17175}
17176
17177module.exports = _getPrototypeOf, module.exports.__esModule = true, module.exports["default"] = module.exports;
17178
17179/***/ }),
17180/* 521 */
17181/***/ (function(module, exports, __webpack_require__) {
17182
17183module.exports = __webpack_require__(522);
17184
17185/***/ }),
17186/* 522 */
17187/***/ (function(module, exports, __webpack_require__) {
17188
17189module.exports = __webpack_require__(523);
17190
17191
17192/***/ }),
17193/* 523 */
17194/***/ (function(module, exports, __webpack_require__) {
17195
17196var parent = __webpack_require__(524);
17197
17198module.exports = parent;
17199
17200
17201/***/ }),
17202/* 524 */
17203/***/ (function(module, exports, __webpack_require__) {
17204
17205var parent = __webpack_require__(232);
17206
17207module.exports = parent;
17208
17209
17210/***/ }),
17211/* 525 */
17212/***/ (function(module, exports) {
17213
17214function _classCallCheck(instance, Constructor) {
17215 if (!(instance instanceof Constructor)) {
17216 throw new TypeError("Cannot call a class as a function");
17217 }
17218}
17219
17220module.exports = _classCallCheck, module.exports.__esModule = true, module.exports["default"] = module.exports;
17221
17222/***/ }),
17223/* 526 */
17224/***/ (function(module, exports, __webpack_require__) {
17225
17226var _Object$defineProperty = __webpack_require__(153);
17227
17228function _defineProperties(target, props) {
17229 for (var i = 0; i < props.length; i++) {
17230 var descriptor = props[i];
17231 descriptor.enumerable = descriptor.enumerable || false;
17232 descriptor.configurable = true;
17233 if ("value" in descriptor) descriptor.writable = true;
17234
17235 _Object$defineProperty(target, descriptor.key, descriptor);
17236 }
17237}
17238
17239function _createClass(Constructor, protoProps, staticProps) {
17240 if (protoProps) _defineProperties(Constructor.prototype, protoProps);
17241 if (staticProps) _defineProperties(Constructor, staticProps);
17242
17243 _Object$defineProperty(Constructor, "prototype", {
17244 writable: false
17245 });
17246
17247 return Constructor;
17248}
17249
17250module.exports = _createClass, module.exports.__esModule = true, module.exports["default"] = module.exports;
17251
17252/***/ }),
17253/* 527 */
17254/***/ (function(module, exports, __webpack_require__) {
17255
17256"use strict";
17257
17258
17259var _interopRequireDefault = __webpack_require__(1);
17260
17261var _slice = _interopRequireDefault(__webpack_require__(34));
17262
17263// base64 character set, plus padding character (=)
17264var b64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
17265
17266module.exports = function (string) {
17267 var result = '';
17268
17269 for (var i = 0; i < string.length;) {
17270 var a = string.charCodeAt(i++);
17271 var b = string.charCodeAt(i++);
17272 var c = string.charCodeAt(i++);
17273
17274 if (a > 255 || b > 255 || c > 255) {
17275 throw new TypeError('Failed to encode base64: The string to be encoded contains characters outside of the Latin1 range.');
17276 }
17277
17278 var bitmap = a << 16 | b << 8 | c;
17279 result += b64.charAt(bitmap >> 18 & 63) + b64.charAt(bitmap >> 12 & 63) + b64.charAt(bitmap >> 6 & 63) + b64.charAt(bitmap & 63);
17280 } // To determine the final padding
17281
17282
17283 var rest = string.length % 3; // If there's need of padding, replace the last 'A's with equal signs
17284
17285 return rest ? (0, _slice.default)(result).call(result, 0, rest - 3) + '==='.substring(rest) : result;
17286};
17287
17288/***/ }),
17289/* 528 */
17290/***/ (function(module, exports, __webpack_require__) {
17291
17292"use strict";
17293
17294
17295var _ = __webpack_require__(3);
17296
17297var ajax = __webpack_require__(117);
17298
17299module.exports = function upload(uploadInfo, data, file) {
17300 var saveOptions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
17301 return ajax({
17302 url: uploadInfo.upload_url,
17303 method: 'PUT',
17304 data: data,
17305 headers: _.extend({
17306 'Content-Type': file.get('mime_type'),
17307 'Cache-Control': 'public, max-age=31536000'
17308 }, file._uploadHeaders),
17309 onprogress: saveOptions.onprogress
17310 }).then(function () {
17311 file.attributes.url = uploadInfo.url;
17312 file._bucket = uploadInfo.bucket;
17313 file.id = uploadInfo.objectId;
17314 return file;
17315 });
17316};
17317
17318/***/ }),
17319/* 529 */
17320/***/ (function(module, exports, __webpack_require__) {
17321
17322(function(){
17323 var crypt = __webpack_require__(530),
17324 utf8 = __webpack_require__(256).utf8,
17325 isBuffer = __webpack_require__(531),
17326 bin = __webpack_require__(256).bin,
17327
17328 // The core
17329 md5 = function (message, options) {
17330 // Convert to byte array
17331 if (message.constructor == String)
17332 if (options && options.encoding === 'binary')
17333 message = bin.stringToBytes(message);
17334 else
17335 message = utf8.stringToBytes(message);
17336 else if (isBuffer(message))
17337 message = Array.prototype.slice.call(message, 0);
17338 else if (!Array.isArray(message))
17339 message = message.toString();
17340 // else, assume byte array already
17341
17342 var m = crypt.bytesToWords(message),
17343 l = message.length * 8,
17344 a = 1732584193,
17345 b = -271733879,
17346 c = -1732584194,
17347 d = 271733878;
17348
17349 // Swap endian
17350 for (var i = 0; i < m.length; i++) {
17351 m[i] = ((m[i] << 8) | (m[i] >>> 24)) & 0x00FF00FF |
17352 ((m[i] << 24) | (m[i] >>> 8)) & 0xFF00FF00;
17353 }
17354
17355 // Padding
17356 m[l >>> 5] |= 0x80 << (l % 32);
17357 m[(((l + 64) >>> 9) << 4) + 14] = l;
17358
17359 // Method shortcuts
17360 var FF = md5._ff,
17361 GG = md5._gg,
17362 HH = md5._hh,
17363 II = md5._ii;
17364
17365 for (var i = 0; i < m.length; i += 16) {
17366
17367 var aa = a,
17368 bb = b,
17369 cc = c,
17370 dd = d;
17371
17372 a = FF(a, b, c, d, m[i+ 0], 7, -680876936);
17373 d = FF(d, a, b, c, m[i+ 1], 12, -389564586);
17374 c = FF(c, d, a, b, m[i+ 2], 17, 606105819);
17375 b = FF(b, c, d, a, m[i+ 3], 22, -1044525330);
17376 a = FF(a, b, c, d, m[i+ 4], 7, -176418897);
17377 d = FF(d, a, b, c, m[i+ 5], 12, 1200080426);
17378 c = FF(c, d, a, b, m[i+ 6], 17, -1473231341);
17379 b = FF(b, c, d, a, m[i+ 7], 22, -45705983);
17380 a = FF(a, b, c, d, m[i+ 8], 7, 1770035416);
17381 d = FF(d, a, b, c, m[i+ 9], 12, -1958414417);
17382 c = FF(c, d, a, b, m[i+10], 17, -42063);
17383 b = FF(b, c, d, a, m[i+11], 22, -1990404162);
17384 a = FF(a, b, c, d, m[i+12], 7, 1804603682);
17385 d = FF(d, a, b, c, m[i+13], 12, -40341101);
17386 c = FF(c, d, a, b, m[i+14], 17, -1502002290);
17387 b = FF(b, c, d, a, m[i+15], 22, 1236535329);
17388
17389 a = GG(a, b, c, d, m[i+ 1], 5, -165796510);
17390 d = GG(d, a, b, c, m[i+ 6], 9, -1069501632);
17391 c = GG(c, d, a, b, m[i+11], 14, 643717713);
17392 b = GG(b, c, d, a, m[i+ 0], 20, -373897302);
17393 a = GG(a, b, c, d, m[i+ 5], 5, -701558691);
17394 d = GG(d, a, b, c, m[i+10], 9, 38016083);
17395 c = GG(c, d, a, b, m[i+15], 14, -660478335);
17396 b = GG(b, c, d, a, m[i+ 4], 20, -405537848);
17397 a = GG(a, b, c, d, m[i+ 9], 5, 568446438);
17398 d = GG(d, a, b, c, m[i+14], 9, -1019803690);
17399 c = GG(c, d, a, b, m[i+ 3], 14, -187363961);
17400 b = GG(b, c, d, a, m[i+ 8], 20, 1163531501);
17401 a = GG(a, b, c, d, m[i+13], 5, -1444681467);
17402 d = GG(d, a, b, c, m[i+ 2], 9, -51403784);
17403 c = GG(c, d, a, b, m[i+ 7], 14, 1735328473);
17404 b = GG(b, c, d, a, m[i+12], 20, -1926607734);
17405
17406 a = HH(a, b, c, d, m[i+ 5], 4, -378558);
17407 d = HH(d, a, b, c, m[i+ 8], 11, -2022574463);
17408 c = HH(c, d, a, b, m[i+11], 16, 1839030562);
17409 b = HH(b, c, d, a, m[i+14], 23, -35309556);
17410 a = HH(a, b, c, d, m[i+ 1], 4, -1530992060);
17411 d = HH(d, a, b, c, m[i+ 4], 11, 1272893353);
17412 c = HH(c, d, a, b, m[i+ 7], 16, -155497632);
17413 b = HH(b, c, d, a, m[i+10], 23, -1094730640);
17414 a = HH(a, b, c, d, m[i+13], 4, 681279174);
17415 d = HH(d, a, b, c, m[i+ 0], 11, -358537222);
17416 c = HH(c, d, a, b, m[i+ 3], 16, -722521979);
17417 b = HH(b, c, d, a, m[i+ 6], 23, 76029189);
17418 a = HH(a, b, c, d, m[i+ 9], 4, -640364487);
17419 d = HH(d, a, b, c, m[i+12], 11, -421815835);
17420 c = HH(c, d, a, b, m[i+15], 16, 530742520);
17421 b = HH(b, c, d, a, m[i+ 2], 23, -995338651);
17422
17423 a = II(a, b, c, d, m[i+ 0], 6, -198630844);
17424 d = II(d, a, b, c, m[i+ 7], 10, 1126891415);
17425 c = II(c, d, a, b, m[i+14], 15, -1416354905);
17426 b = II(b, c, d, a, m[i+ 5], 21, -57434055);
17427 a = II(a, b, c, d, m[i+12], 6, 1700485571);
17428 d = II(d, a, b, c, m[i+ 3], 10, -1894986606);
17429 c = II(c, d, a, b, m[i+10], 15, -1051523);
17430 b = II(b, c, d, a, m[i+ 1], 21, -2054922799);
17431 a = II(a, b, c, d, m[i+ 8], 6, 1873313359);
17432 d = II(d, a, b, c, m[i+15], 10, -30611744);
17433 c = II(c, d, a, b, m[i+ 6], 15, -1560198380);
17434 b = II(b, c, d, a, m[i+13], 21, 1309151649);
17435 a = II(a, b, c, d, m[i+ 4], 6, -145523070);
17436 d = II(d, a, b, c, m[i+11], 10, -1120210379);
17437 c = II(c, d, a, b, m[i+ 2], 15, 718787259);
17438 b = II(b, c, d, a, m[i+ 9], 21, -343485551);
17439
17440 a = (a + aa) >>> 0;
17441 b = (b + bb) >>> 0;
17442 c = (c + cc) >>> 0;
17443 d = (d + dd) >>> 0;
17444 }
17445
17446 return crypt.endian([a, b, c, d]);
17447 };
17448
17449 // Auxiliary functions
17450 md5._ff = function (a, b, c, d, x, s, t) {
17451 var n = a + (b & c | ~b & d) + (x >>> 0) + t;
17452 return ((n << s) | (n >>> (32 - s))) + b;
17453 };
17454 md5._gg = function (a, b, c, d, x, s, t) {
17455 var n = a + (b & d | c & ~d) + (x >>> 0) + t;
17456 return ((n << s) | (n >>> (32 - s))) + b;
17457 };
17458 md5._hh = function (a, b, c, d, x, s, t) {
17459 var n = a + (b ^ c ^ d) + (x >>> 0) + t;
17460 return ((n << s) | (n >>> (32 - s))) + b;
17461 };
17462 md5._ii = function (a, b, c, d, x, s, t) {
17463 var n = a + (c ^ (b | ~d)) + (x >>> 0) + t;
17464 return ((n << s) | (n >>> (32 - s))) + b;
17465 };
17466
17467 // Package private blocksize
17468 md5._blocksize = 16;
17469 md5._digestsize = 16;
17470
17471 module.exports = function (message, options) {
17472 if (message === undefined || message === null)
17473 throw new Error('Illegal argument ' + message);
17474
17475 var digestbytes = crypt.wordsToBytes(md5(message, options));
17476 return options && options.asBytes ? digestbytes :
17477 options && options.asString ? bin.bytesToString(digestbytes) :
17478 crypt.bytesToHex(digestbytes);
17479 };
17480
17481})();
17482
17483
17484/***/ }),
17485/* 530 */
17486/***/ (function(module, exports) {
17487
17488(function() {
17489 var base64map
17490 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/',
17491
17492 crypt = {
17493 // Bit-wise rotation left
17494 rotl: function(n, b) {
17495 return (n << b) | (n >>> (32 - b));
17496 },
17497
17498 // Bit-wise rotation right
17499 rotr: function(n, b) {
17500 return (n << (32 - b)) | (n >>> b);
17501 },
17502
17503 // Swap big-endian to little-endian and vice versa
17504 endian: function(n) {
17505 // If number given, swap endian
17506 if (n.constructor == Number) {
17507 return crypt.rotl(n, 8) & 0x00FF00FF | crypt.rotl(n, 24) & 0xFF00FF00;
17508 }
17509
17510 // Else, assume array and swap all items
17511 for (var i = 0; i < n.length; i++)
17512 n[i] = crypt.endian(n[i]);
17513 return n;
17514 },
17515
17516 // Generate an array of any length of random bytes
17517 randomBytes: function(n) {
17518 for (var bytes = []; n > 0; n--)
17519 bytes.push(Math.floor(Math.random() * 256));
17520 return bytes;
17521 },
17522
17523 // Convert a byte array to big-endian 32-bit words
17524 bytesToWords: function(bytes) {
17525 for (var words = [], i = 0, b = 0; i < bytes.length; i++, b += 8)
17526 words[b >>> 5] |= bytes[i] << (24 - b % 32);
17527 return words;
17528 },
17529
17530 // Convert big-endian 32-bit words to a byte array
17531 wordsToBytes: function(words) {
17532 for (var bytes = [], b = 0; b < words.length * 32; b += 8)
17533 bytes.push((words[b >>> 5] >>> (24 - b % 32)) & 0xFF);
17534 return bytes;
17535 },
17536
17537 // Convert a byte array to a hex string
17538 bytesToHex: function(bytes) {
17539 for (var hex = [], i = 0; i < bytes.length; i++) {
17540 hex.push((bytes[i] >>> 4).toString(16));
17541 hex.push((bytes[i] & 0xF).toString(16));
17542 }
17543 return hex.join('');
17544 },
17545
17546 // Convert a hex string to a byte array
17547 hexToBytes: function(hex) {
17548 for (var bytes = [], c = 0; c < hex.length; c += 2)
17549 bytes.push(parseInt(hex.substr(c, 2), 16));
17550 return bytes;
17551 },
17552
17553 // Convert a byte array to a base-64 string
17554 bytesToBase64: function(bytes) {
17555 for (var base64 = [], i = 0; i < bytes.length; i += 3) {
17556 var triplet = (bytes[i] << 16) | (bytes[i + 1] << 8) | bytes[i + 2];
17557 for (var j = 0; j < 4; j++)
17558 if (i * 8 + j * 6 <= bytes.length * 8)
17559 base64.push(base64map.charAt((triplet >>> 6 * (3 - j)) & 0x3F));
17560 else
17561 base64.push('=');
17562 }
17563 return base64.join('');
17564 },
17565
17566 // Convert a base-64 string to a byte array
17567 base64ToBytes: function(base64) {
17568 // Remove non-base-64 characters
17569 base64 = base64.replace(/[^A-Z0-9+\/]/ig, '');
17570
17571 for (var bytes = [], i = 0, imod4 = 0; i < base64.length;
17572 imod4 = ++i % 4) {
17573 if (imod4 == 0) continue;
17574 bytes.push(((base64map.indexOf(base64.charAt(i - 1))
17575 & (Math.pow(2, -2 * imod4 + 8) - 1)) << (imod4 * 2))
17576 | (base64map.indexOf(base64.charAt(i)) >>> (6 - imod4 * 2)));
17577 }
17578 return bytes;
17579 }
17580 };
17581
17582 module.exports = crypt;
17583})();
17584
17585
17586/***/ }),
17587/* 531 */
17588/***/ (function(module, exports) {
17589
17590/*!
17591 * Determine if an object is a Buffer
17592 *
17593 * @author Feross Aboukhadijeh <https://feross.org>
17594 * @license MIT
17595 */
17596
17597// The _isBuffer check is for Safari 5-7 support, because it's missing
17598// Object.prototype.constructor. Remove this eventually
17599module.exports = function (obj) {
17600 return obj != null && (isBuffer(obj) || isSlowBuffer(obj) || !!obj._isBuffer)
17601}
17602
17603function isBuffer (obj) {
17604 return !!obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj)
17605}
17606
17607// For Node v0.10 support. Remove this eventually.
17608function isSlowBuffer (obj) {
17609 return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isBuffer(obj.slice(0, 0))
17610}
17611
17612
17613/***/ }),
17614/* 532 */
17615/***/ (function(module, exports, __webpack_require__) {
17616
17617"use strict";
17618
17619
17620var _interopRequireDefault = __webpack_require__(1);
17621
17622var _indexOf = _interopRequireDefault(__webpack_require__(61));
17623
17624var dataURItoBlob = function dataURItoBlob(dataURI, type) {
17625 var _context;
17626
17627 var byteString; // 传入的 base64,不是 dataURL
17628
17629 if ((0, _indexOf.default)(dataURI).call(dataURI, 'base64') < 0) {
17630 byteString = atob(dataURI);
17631 } else if ((0, _indexOf.default)(_context = dataURI.split(',')[0]).call(_context, 'base64') >= 0) {
17632 type = type || dataURI.split(',')[0].split(':')[1].split(';')[0];
17633 byteString = atob(dataURI.split(',')[1]);
17634 } else {
17635 byteString = unescape(dataURI.split(',')[1]);
17636 }
17637
17638 var ia = new Uint8Array(byteString.length);
17639
17640 for (var i = 0; i < byteString.length; i++) {
17641 ia[i] = byteString.charCodeAt(i);
17642 }
17643
17644 return new Blob([ia], {
17645 type: type
17646 });
17647};
17648
17649module.exports = dataURItoBlob;
17650
17651/***/ }),
17652/* 533 */
17653/***/ (function(module, exports, __webpack_require__) {
17654
17655"use strict";
17656
17657
17658var _interopRequireDefault = __webpack_require__(1);
17659
17660var _slicedToArray2 = _interopRequireDefault(__webpack_require__(534));
17661
17662var _map = _interopRequireDefault(__webpack_require__(37));
17663
17664var _indexOf = _interopRequireDefault(__webpack_require__(61));
17665
17666var _find = _interopRequireDefault(__webpack_require__(96));
17667
17668var _promise = _interopRequireDefault(__webpack_require__(12));
17669
17670var _concat = _interopRequireDefault(__webpack_require__(19));
17671
17672var _keys2 = _interopRequireDefault(__webpack_require__(62));
17673
17674var _stringify = _interopRequireDefault(__webpack_require__(38));
17675
17676var _defineProperty = _interopRequireDefault(__webpack_require__(94));
17677
17678var _getOwnPropertyDescriptor = _interopRequireDefault(__webpack_require__(257));
17679
17680var _ = __webpack_require__(3);
17681
17682var AVError = __webpack_require__(48);
17683
17684var _require = __webpack_require__(28),
17685 _request = _require._request;
17686
17687var _require2 = __webpack_require__(32),
17688 isNullOrUndefined = _require2.isNullOrUndefined,
17689 ensureArray = _require2.ensureArray,
17690 transformFetchOptions = _require2.transformFetchOptions,
17691 setValue = _require2.setValue,
17692 findValue = _require2.findValue,
17693 isPlainObject = _require2.isPlainObject,
17694 continueWhile = _require2.continueWhile;
17695
17696var recursiveToPointer = function recursiveToPointer(value) {
17697 if (_.isArray(value)) return (0, _map.default)(value).call(value, recursiveToPointer);
17698 if (isPlainObject(value)) return _.mapObject(value, recursiveToPointer);
17699 if (_.isObject(value) && value._toPointer) return value._toPointer();
17700 return value;
17701};
17702
17703var RESERVED_KEYS = ['objectId', 'createdAt', 'updatedAt'];
17704
17705var checkReservedKey = function checkReservedKey(key) {
17706 if ((0, _indexOf.default)(RESERVED_KEYS).call(RESERVED_KEYS, key) !== -1) {
17707 throw new Error("key[".concat(key, "] is reserved"));
17708 }
17709};
17710
17711var handleBatchResults = function handleBatchResults(results) {
17712 var firstError = (0, _find.default)(_).call(_, results, function (result) {
17713 return result instanceof Error;
17714 });
17715
17716 if (!firstError) {
17717 return results;
17718 }
17719
17720 var error = new AVError(firstError.code, firstError.message);
17721 error.results = results;
17722 throw error;
17723}; // Helper function to get a value from a Backbone object as a property
17724// or as a function.
17725
17726
17727function getValue(object, prop) {
17728 if (!(object && object[prop])) {
17729 return null;
17730 }
17731
17732 return _.isFunction(object[prop]) ? object[prop]() : object[prop];
17733} // AV.Object is analogous to the Java AVObject.
17734// It also implements the same interface as a Backbone model.
17735
17736
17737module.exports = function (AV) {
17738 /**
17739 * Creates a new model with defined attributes. A client id (cid) is
17740 * automatically generated and assigned for you.
17741 *
17742 * <p>You won't normally call this method directly. It is recommended that
17743 * you use a subclass of <code>AV.Object</code> instead, created by calling
17744 * <code>extend</code>.</p>
17745 *
17746 * <p>However, if you don't want to use a subclass, or aren't sure which
17747 * subclass is appropriate, you can use this form:<pre>
17748 * var object = new AV.Object("ClassName");
17749 * </pre>
17750 * That is basically equivalent to:<pre>
17751 * var MyClass = AV.Object.extend("ClassName");
17752 * var object = new MyClass();
17753 * </pre></p>
17754 *
17755 * @param {Object} attributes The initial set of data to store in the object.
17756 * @param {Object} options A set of Backbone-like options for creating the
17757 * object. The only option currently supported is "collection".
17758 * @see AV.Object.extend
17759 *
17760 * @class
17761 *
17762 * <p>The fundamental unit of AV data, which implements the Backbone Model
17763 * interface.</p>
17764 */
17765 AV.Object = function (attributes, options) {
17766 // Allow new AV.Object("ClassName") as a shortcut to _create.
17767 if (_.isString(attributes)) {
17768 return AV.Object._create.apply(this, arguments);
17769 }
17770
17771 attributes = attributes || {};
17772
17773 if (options && options.parse) {
17774 attributes = this.parse(attributes);
17775 attributes = this._mergeMagicFields(attributes);
17776 }
17777
17778 var defaults = getValue(this, 'defaults');
17779
17780 if (defaults) {
17781 attributes = _.extend({}, defaults, attributes);
17782 }
17783
17784 if (options && options.collection) {
17785 this.collection = options.collection;
17786 }
17787
17788 this._serverData = {}; // The last known data for this object from cloud.
17789
17790 this._opSetQueue = [{}]; // List of sets of changes to the data.
17791
17792 this._flags = {};
17793 this.attributes = {}; // The best estimate of this's current data.
17794
17795 this._hashedJSON = {}; // Hash of values of containers at last save.
17796
17797 this._escapedAttributes = {};
17798 this.cid = _.uniqueId('c');
17799 this.changed = {};
17800 this._silent = {};
17801 this._pending = {};
17802 this.set(attributes, {
17803 silent: true
17804 });
17805 this.changed = {};
17806 this._silent = {};
17807 this._pending = {};
17808 this._hasData = true;
17809 this._previousAttributes = _.clone(this.attributes);
17810 this.initialize.apply(this, arguments);
17811 };
17812 /**
17813 * @lends AV.Object.prototype
17814 * @property {String} id The objectId of the AV Object.
17815 */
17816
17817 /**
17818 * Saves the given list of AV.Object.
17819 * If any error is encountered, stops and calls the error handler.
17820 *
17821 * @example
17822 * AV.Object.saveAll([object1, object2, ...]).then(function(list) {
17823 * // All the objects were saved.
17824 * }, function(error) {
17825 * // An error occurred while saving one of the objects.
17826 * });
17827 *
17828 * @param {Array} list A list of <code>AV.Object</code>.
17829 */
17830
17831
17832 AV.Object.saveAll = function (list, options) {
17833 return AV.Object._deepSaveAsync(list, null, options);
17834 };
17835 /**
17836 * Fetch the given list of AV.Object.
17837 *
17838 * @param {AV.Object[]} objects A list of <code>AV.Object</code>
17839 * @param {AuthOptions} options
17840 * @return {Promise.<AV.Object[]>} The given list of <code>AV.Object</code>, updated
17841 */
17842
17843
17844 AV.Object.fetchAll = function (objects, options) {
17845 return _promise.default.resolve().then(function () {
17846 return _request('batch', null, null, 'POST', {
17847 requests: (0, _map.default)(_).call(_, objects, function (object) {
17848 var _context;
17849
17850 if (!object.className) throw new Error('object must have className to fetch');
17851 if (!object.id) throw new Error('object must have id to fetch');
17852 if (object.dirty()) throw new Error('object is modified but not saved');
17853 return {
17854 method: 'GET',
17855 path: (0, _concat.default)(_context = "/1.1/classes/".concat(object.className, "/")).call(_context, object.id)
17856 };
17857 })
17858 }, options);
17859 }).then(function (response) {
17860 var results = (0, _map.default)(_).call(_, objects, function (object, i) {
17861 if (response[i].success) {
17862 var fetchedAttrs = object.parse(response[i].success);
17863
17864 object._cleanupUnsetKeys(fetchedAttrs);
17865
17866 object._finishFetch(fetchedAttrs);
17867
17868 return object;
17869 }
17870
17871 if (response[i].success === null) {
17872 return new AVError(AVError.OBJECT_NOT_FOUND, 'Object not found.');
17873 }
17874
17875 return new AVError(response[i].error.code, response[i].error.error);
17876 });
17877 return handleBatchResults(results);
17878 });
17879 }; // Attach all inheritable methods to the AV.Object prototype.
17880
17881
17882 _.extend(AV.Object.prototype, AV.Events,
17883 /** @lends AV.Object.prototype */
17884 {
17885 _fetchWhenSave: false,
17886
17887 /**
17888 * Initialize is an empty function by default. Override it with your own
17889 * initialization logic.
17890 */
17891 initialize: function initialize() {},
17892
17893 /**
17894 * Set whether to enable fetchWhenSave option when updating object.
17895 * When set true, SDK would fetch the latest object after saving.
17896 * Default is false.
17897 *
17898 * @deprecated use AV.Object#save with options.fetchWhenSave instead
17899 * @param {boolean} enable true to enable fetchWhenSave option.
17900 */
17901 fetchWhenSave: function fetchWhenSave(enable) {
17902 console.warn('AV.Object#fetchWhenSave is deprecated, use AV.Object#save with options.fetchWhenSave instead.');
17903
17904 if (!_.isBoolean(enable)) {
17905 throw new Error('Expect boolean value for fetchWhenSave');
17906 }
17907
17908 this._fetchWhenSave = enable;
17909 },
17910
17911 /**
17912 * Returns the object's objectId.
17913 * @return {String} the objectId.
17914 */
17915 getObjectId: function getObjectId() {
17916 return this.id;
17917 },
17918
17919 /**
17920 * Returns the object's createdAt attribute.
17921 * @return {Date}
17922 */
17923 getCreatedAt: function getCreatedAt() {
17924 return this.createdAt;
17925 },
17926
17927 /**
17928 * Returns the object's updatedAt attribute.
17929 * @return {Date}
17930 */
17931 getUpdatedAt: function getUpdatedAt() {
17932 return this.updatedAt;
17933 },
17934
17935 /**
17936 * Returns a JSON version of the object.
17937 * @return {Object}
17938 */
17939 toJSON: function toJSON(key, holder) {
17940 var seenObjects = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
17941 return this._toFullJSON(seenObjects, false);
17942 },
17943
17944 /**
17945 * Returns a JSON version of the object with meta data.
17946 * Inverse to {@link AV.parseJSON}
17947 * @since 3.0.0
17948 * @return {Object}
17949 */
17950 toFullJSON: function toFullJSON() {
17951 var seenObjects = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
17952 return this._toFullJSON(seenObjects);
17953 },
17954 _toFullJSON: function _toFullJSON(seenObjects) {
17955 var _this = this;
17956
17957 var full = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
17958
17959 var json = _.clone(this.attributes);
17960
17961 if (_.isArray(seenObjects)) {
17962 var newSeenObjects = (0, _concat.default)(seenObjects).call(seenObjects, this);
17963 }
17964
17965 AV._objectEach(json, function (val, key) {
17966 json[key] = AV._encode(val, newSeenObjects, undefined, full);
17967 });
17968
17969 AV._objectEach(this._operations, function (val, key) {
17970 json[key] = val;
17971 });
17972
17973 if (_.has(this, 'id')) {
17974 json.objectId = this.id;
17975 }
17976
17977 ['createdAt', 'updatedAt'].forEach(function (key) {
17978 if (_.has(_this, key)) {
17979 var val = _this[key];
17980 json[key] = _.isDate(val) ? val.toJSON() : val;
17981 }
17982 });
17983
17984 if (full) {
17985 json.__type = 'Object';
17986 if (_.isArray(seenObjects) && seenObjects.length) json.__type = 'Pointer';
17987 json.className = this.className;
17988 }
17989
17990 return json;
17991 },
17992
17993 /**
17994 * Updates _hashedJSON to reflect the current state of this object.
17995 * Adds any changed hash values to the set of pending changes.
17996 * @private
17997 */
17998 _refreshCache: function _refreshCache() {
17999 var self = this;
18000
18001 if (self._refreshingCache) {
18002 return;
18003 }
18004
18005 self._refreshingCache = true;
18006
18007 AV._objectEach(this.attributes, function (value, key) {
18008 if (value instanceof AV.Object) {
18009 value._refreshCache();
18010 } else if (_.isObject(value)) {
18011 if (self._resetCacheForKey(key)) {
18012 self.set(key, new AV.Op.Set(value), {
18013 silent: true
18014 });
18015 }
18016 }
18017 });
18018
18019 delete self._refreshingCache;
18020 },
18021
18022 /**
18023 * Returns true if this object has been modified since its last
18024 * save/refresh. If an attribute is specified, it returns true only if that
18025 * particular attribute has been modified since the last save/refresh.
18026 * @param {String} attr An attribute name (optional).
18027 * @return {Boolean}
18028 */
18029 dirty: function dirty(attr) {
18030 this._refreshCache();
18031
18032 var currentChanges = _.last(this._opSetQueue);
18033
18034 if (attr) {
18035 return currentChanges[attr] ? true : false;
18036 }
18037
18038 if (!this.id) {
18039 return true;
18040 }
18041
18042 if ((0, _keys2.default)(_).call(_, currentChanges).length > 0) {
18043 return true;
18044 }
18045
18046 return false;
18047 },
18048
18049 /**
18050 * Returns the keys of the modified attribute since its last save/refresh.
18051 * @return {String[]}
18052 */
18053 dirtyKeys: function dirtyKeys() {
18054 this._refreshCache();
18055
18056 var currentChanges = _.last(this._opSetQueue);
18057
18058 return (0, _keys2.default)(_).call(_, currentChanges);
18059 },
18060
18061 /**
18062 * Gets a Pointer referencing this Object.
18063 * @private
18064 */
18065 _toPointer: function _toPointer() {
18066 // if (!this.id) {
18067 // throw new Error("Can't serialize an unsaved AV.Object");
18068 // }
18069 return {
18070 __type: 'Pointer',
18071 className: this.className,
18072 objectId: this.id
18073 };
18074 },
18075
18076 /**
18077 * Gets the value of an attribute.
18078 * @param {String} attr The string name of an attribute.
18079 */
18080 get: function get(attr) {
18081 switch (attr) {
18082 case 'objectId':
18083 return this.id;
18084
18085 case 'createdAt':
18086 case 'updatedAt':
18087 return this[attr];
18088
18089 default:
18090 return this.attributes[attr];
18091 }
18092 },
18093
18094 /**
18095 * Gets a relation on the given class for the attribute.
18096 * @param {String} attr The attribute to get the relation for.
18097 * @return {AV.Relation}
18098 */
18099 relation: function relation(attr) {
18100 var value = this.get(attr);
18101
18102 if (value) {
18103 if (!(value instanceof AV.Relation)) {
18104 throw new Error('Called relation() on non-relation field ' + attr);
18105 }
18106
18107 value._ensureParentAndKey(this, attr);
18108
18109 return value;
18110 } else {
18111 return new AV.Relation(this, attr);
18112 }
18113 },
18114
18115 /**
18116 * Gets the HTML-escaped value of an attribute.
18117 */
18118 escape: function escape(attr) {
18119 var html = this._escapedAttributes[attr];
18120
18121 if (html) {
18122 return html;
18123 }
18124
18125 var val = this.attributes[attr];
18126 var escaped;
18127
18128 if (isNullOrUndefined(val)) {
18129 escaped = '';
18130 } else {
18131 escaped = _.escape(val.toString());
18132 }
18133
18134 this._escapedAttributes[attr] = escaped;
18135 return escaped;
18136 },
18137
18138 /**
18139 * Returns <code>true</code> if the attribute contains a value that is not
18140 * null or undefined.
18141 * @param {String} attr The string name of the attribute.
18142 * @return {Boolean}
18143 */
18144 has: function has(attr) {
18145 return !isNullOrUndefined(this.attributes[attr]);
18146 },
18147
18148 /**
18149 * Pulls "special" fields like objectId, createdAt, etc. out of attrs
18150 * and puts them on "this" directly. Removes them from attrs.
18151 * @param attrs - A dictionary with the data for this AV.Object.
18152 * @private
18153 */
18154 _mergeMagicFields: function _mergeMagicFields(attrs) {
18155 // Check for changes of magic fields.
18156 var model = this;
18157 var specialFields = ['objectId', 'createdAt', 'updatedAt'];
18158
18159 AV._arrayEach(specialFields, function (attr) {
18160 if (attrs[attr]) {
18161 if (attr === 'objectId') {
18162 model.id = attrs[attr];
18163 } else if ((attr === 'createdAt' || attr === 'updatedAt') && !_.isDate(attrs[attr])) {
18164 model[attr] = AV._parseDate(attrs[attr]);
18165 } else {
18166 model[attr] = attrs[attr];
18167 }
18168
18169 delete attrs[attr];
18170 }
18171 });
18172
18173 return attrs;
18174 },
18175
18176 /**
18177 * Returns the json to be sent to the server.
18178 * @private
18179 */
18180 _startSave: function _startSave() {
18181 this._opSetQueue.push({});
18182 },
18183
18184 /**
18185 * Called when a save fails because of an error. Any changes that were part
18186 * of the save need to be merged with changes made after the save. This
18187 * might throw an exception is you do conflicting operations. For example,
18188 * if you do:
18189 * object.set("foo", "bar");
18190 * object.set("invalid field name", "baz");
18191 * object.save();
18192 * object.increment("foo");
18193 * then this will throw when the save fails and the client tries to merge
18194 * "bar" with the +1.
18195 * @private
18196 */
18197 _cancelSave: function _cancelSave() {
18198 var failedChanges = _.first(this._opSetQueue);
18199
18200 this._opSetQueue = _.rest(this._opSetQueue);
18201
18202 var nextChanges = _.first(this._opSetQueue);
18203
18204 AV._objectEach(failedChanges, function (op, key) {
18205 var op1 = failedChanges[key];
18206 var op2 = nextChanges[key];
18207
18208 if (op1 && op2) {
18209 nextChanges[key] = op2._mergeWithPrevious(op1);
18210 } else if (op1) {
18211 nextChanges[key] = op1;
18212 }
18213 });
18214
18215 this._saving = this._saving - 1;
18216 },
18217
18218 /**
18219 * Called when a save completes successfully. This merges the changes that
18220 * were saved into the known server data, and overrides it with any data
18221 * sent directly from the server.
18222 * @private
18223 */
18224 _finishSave: function _finishSave(serverData) {
18225 var _context2;
18226
18227 // Grab a copy of any object referenced by this object. These instances
18228 // may have already been fetched, and we don't want to lose their data.
18229 // Note that doing it like this means we will unify separate copies of the
18230 // same object, but that's a risk we have to take.
18231 var fetchedObjects = {};
18232
18233 AV._traverse(this.attributes, function (object) {
18234 if (object instanceof AV.Object && object.id && object._hasData) {
18235 fetchedObjects[object.id] = object;
18236 }
18237 });
18238
18239 var savedChanges = _.first(this._opSetQueue);
18240
18241 this._opSetQueue = _.rest(this._opSetQueue);
18242
18243 this._applyOpSet(savedChanges, this._serverData);
18244
18245 this._mergeMagicFields(serverData);
18246
18247 var self = this;
18248
18249 AV._objectEach(serverData, function (value, key) {
18250 self._serverData[key] = AV._decode(value, key); // Look for any objects that might have become unfetched and fix them
18251 // by replacing their values with the previously observed values.
18252
18253 var fetched = AV._traverse(self._serverData[key], function (object) {
18254 if (object instanceof AV.Object && fetchedObjects[object.id]) {
18255 return fetchedObjects[object.id];
18256 }
18257 });
18258
18259 if (fetched) {
18260 self._serverData[key] = fetched;
18261 }
18262 });
18263
18264 this._rebuildAllEstimatedData();
18265
18266 var opSetQueue = (0, _map.default)(_context2 = this._opSetQueue).call(_context2, _.clone);
18267
18268 this._refreshCache();
18269
18270 this._opSetQueue = opSetQueue;
18271 this._saving = this._saving - 1;
18272 },
18273
18274 /**
18275 * Called when a fetch or login is complete to set the known server data to
18276 * the given object.
18277 * @private
18278 */
18279 _finishFetch: function _finishFetch(serverData, hasData) {
18280 // Clear out any changes the user might have made previously.
18281 this._opSetQueue = [{}]; // Bring in all the new server data.
18282
18283 this._mergeMagicFields(serverData);
18284
18285 var self = this;
18286
18287 AV._objectEach(serverData, function (value, key) {
18288 self._serverData[key] = AV._decode(value, key);
18289 }); // Refresh the attributes.
18290
18291
18292 this._rebuildAllEstimatedData(); // Clear out the cache of mutable containers.
18293
18294
18295 this._refreshCache();
18296
18297 this._opSetQueue = [{}];
18298 this._hasData = hasData;
18299 },
18300
18301 /**
18302 * Applies the set of AV.Op in opSet to the object target.
18303 * @private
18304 */
18305 _applyOpSet: function _applyOpSet(opSet, target) {
18306 var self = this;
18307
18308 AV._objectEach(opSet, function (change, key) {
18309 var _findValue = findValue(target, key),
18310 _findValue2 = (0, _slicedToArray2.default)(_findValue, 3),
18311 value = _findValue2[0],
18312 actualTarget = _findValue2[1],
18313 actualKey = _findValue2[2];
18314
18315 setValue(target, key, change._estimate(value, self, key));
18316
18317 if (actualTarget && actualTarget[actualKey] === AV.Op._UNSET) {
18318 delete actualTarget[actualKey];
18319 }
18320 });
18321 },
18322
18323 /**
18324 * Replaces the cached value for key with the current value.
18325 * Returns true if the new value is different than the old value.
18326 * @private
18327 */
18328 _resetCacheForKey: function _resetCacheForKey(key) {
18329 var value = this.attributes[key];
18330
18331 if (_.isObject(value) && !(value instanceof AV.Object) && !(value instanceof AV.File)) {
18332 var json = (0, _stringify.default)(recursiveToPointer(value));
18333
18334 if (this._hashedJSON[key] !== json) {
18335 var wasSet = !!this._hashedJSON[key];
18336 this._hashedJSON[key] = json;
18337 return wasSet;
18338 }
18339 }
18340
18341 return false;
18342 },
18343
18344 /**
18345 * Populates attributes[key] by starting with the last known data from the
18346 * server, and applying all of the local changes that have been made to that
18347 * key since then.
18348 * @private
18349 */
18350 _rebuildEstimatedDataForKey: function _rebuildEstimatedDataForKey(key) {
18351 var self = this;
18352 delete this.attributes[key];
18353
18354 if (this._serverData[key]) {
18355 this.attributes[key] = this._serverData[key];
18356 }
18357
18358 AV._arrayEach(this._opSetQueue, function (opSet) {
18359 var op = opSet[key];
18360
18361 if (op) {
18362 var _findValue3 = findValue(self.attributes, key),
18363 _findValue4 = (0, _slicedToArray2.default)(_findValue3, 4),
18364 value = _findValue4[0],
18365 actualTarget = _findValue4[1],
18366 actualKey = _findValue4[2],
18367 firstKey = _findValue4[3];
18368
18369 setValue(self.attributes, key, op._estimate(value, self, key));
18370
18371 if (actualTarget && actualTarget[actualKey] === AV.Op._UNSET) {
18372 delete actualTarget[actualKey];
18373 }
18374
18375 self._resetCacheForKey(firstKey);
18376 }
18377 });
18378 },
18379
18380 /**
18381 * Populates attributes by starting with the last known data from the
18382 * server, and applying all of the local changes that have been made since
18383 * then.
18384 * @private
18385 */
18386 _rebuildAllEstimatedData: function _rebuildAllEstimatedData() {
18387 var self = this;
18388
18389 var previousAttributes = _.clone(this.attributes);
18390
18391 this.attributes = _.clone(this._serverData);
18392
18393 AV._arrayEach(this._opSetQueue, function (opSet) {
18394 self._applyOpSet(opSet, self.attributes);
18395
18396 AV._objectEach(opSet, function (op, key) {
18397 self._resetCacheForKey(key);
18398 });
18399 }); // Trigger change events for anything that changed because of the fetch.
18400
18401
18402 AV._objectEach(previousAttributes, function (oldValue, key) {
18403 if (self.attributes[key] !== oldValue) {
18404 self.trigger('change:' + key, self, self.attributes[key], {});
18405 }
18406 });
18407
18408 AV._objectEach(this.attributes, function (newValue, key) {
18409 if (!_.has(previousAttributes, key)) {
18410 self.trigger('change:' + key, self, newValue, {});
18411 }
18412 });
18413 },
18414
18415 /**
18416 * Sets a hash of model attributes on the object, firing
18417 * <code>"change"</code> unless you choose to silence it.
18418 *
18419 * <p>You can call it with an object containing keys and values, or with one
18420 * key and value. For example:</p>
18421 *
18422 * @example
18423 * gameTurn.set({
18424 * player: player1,
18425 * diceRoll: 2
18426 * });
18427 *
18428 * game.set("currentPlayer", player2);
18429 *
18430 * game.set("finished", true);
18431 *
18432 * @param {String} key The key to set.
18433 * @param {Any} value The value to give it.
18434 * @param {Object} [options]
18435 * @param {Boolean} [options.silent]
18436 * @return {AV.Object} self if succeeded, throws if the value is not valid.
18437 * @see AV.Object#validate
18438 */
18439 set: function set(key, value, options) {
18440 var attrs;
18441
18442 if (_.isObject(key) || isNullOrUndefined(key)) {
18443 attrs = _.mapObject(key, function (v, k) {
18444 checkReservedKey(k);
18445 return AV._decode(v, k);
18446 });
18447 options = value;
18448 } else {
18449 attrs = {};
18450 checkReservedKey(key);
18451 attrs[key] = AV._decode(value, key);
18452 } // Extract attributes and options.
18453
18454
18455 options = options || {};
18456
18457 if (!attrs) {
18458 return this;
18459 }
18460
18461 if (attrs instanceof AV.Object) {
18462 attrs = attrs.attributes;
18463 } // If the unset option is used, every attribute should be a Unset.
18464
18465
18466 if (options.unset) {
18467 AV._objectEach(attrs, function (unused_value, key) {
18468 attrs[key] = new AV.Op.Unset();
18469 });
18470 } // Apply all the attributes to get the estimated values.
18471
18472
18473 var dataToValidate = _.clone(attrs);
18474
18475 var self = this;
18476
18477 AV._objectEach(dataToValidate, function (value, key) {
18478 if (value instanceof AV.Op) {
18479 dataToValidate[key] = value._estimate(self.attributes[key], self, key);
18480
18481 if (dataToValidate[key] === AV.Op._UNSET) {
18482 delete dataToValidate[key];
18483 }
18484 }
18485 }); // Run validation.
18486
18487
18488 this._validate(attrs, options);
18489
18490 options.changes = {};
18491 var escaped = this._escapedAttributes; // Update attributes.
18492
18493 AV._arrayEach((0, _keys2.default)(_).call(_, attrs), function (attr) {
18494 var val = attrs[attr]; // If this is a relation object we need to set the parent correctly,
18495 // since the location where it was parsed does not have access to
18496 // this object.
18497
18498 if (val instanceof AV.Relation) {
18499 val.parent = self;
18500 }
18501
18502 if (!(val instanceof AV.Op)) {
18503 val = new AV.Op.Set(val);
18504 } // See if this change will actually have any effect.
18505
18506
18507 var isRealChange = true;
18508
18509 if (val instanceof AV.Op.Set && _.isEqual(self.attributes[attr], val.value)) {
18510 isRealChange = false;
18511 }
18512
18513 if (isRealChange) {
18514 delete escaped[attr];
18515
18516 if (options.silent) {
18517 self._silent[attr] = true;
18518 } else {
18519 options.changes[attr] = true;
18520 }
18521 }
18522
18523 var currentChanges = _.last(self._opSetQueue);
18524
18525 currentChanges[attr] = val._mergeWithPrevious(currentChanges[attr]);
18526
18527 self._rebuildEstimatedDataForKey(attr);
18528
18529 if (isRealChange) {
18530 self.changed[attr] = self.attributes[attr];
18531
18532 if (!options.silent) {
18533 self._pending[attr] = true;
18534 }
18535 } else {
18536 delete self.changed[attr];
18537 delete self._pending[attr];
18538 }
18539 });
18540
18541 if (!options.silent) {
18542 this.change(options);
18543 }
18544
18545 return this;
18546 },
18547
18548 /**
18549 * Remove an attribute from the model, firing <code>"change"</code> unless
18550 * you choose to silence it. This is a noop if the attribute doesn't
18551 * exist.
18552 * @param key {String} The key.
18553 */
18554 unset: function unset(attr, options) {
18555 options = options || {};
18556 options.unset = true;
18557 return this.set(attr, null, options);
18558 },
18559
18560 /**
18561 * Atomically increments the value of the given attribute the next time the
18562 * object is saved. If no amount is specified, 1 is used by default.
18563 *
18564 * @param key {String} The key.
18565 * @param amount {Number} The amount to increment by.
18566 */
18567 increment: function increment(attr, amount) {
18568 if (_.isUndefined(amount) || _.isNull(amount)) {
18569 amount = 1;
18570 }
18571
18572 return this.set(attr, new AV.Op.Increment(amount));
18573 },
18574
18575 /**
18576 * Atomically add an object to the end of the array associated with a given
18577 * key.
18578 * @param key {String} The key.
18579 * @param item {} The item to add.
18580 */
18581 add: function add(attr, item) {
18582 return this.set(attr, new AV.Op.Add(ensureArray(item)));
18583 },
18584
18585 /**
18586 * Atomically add an object to the array associated with a given key, only
18587 * if it is not already present in the array. The position of the insert is
18588 * not guaranteed.
18589 *
18590 * @param key {String} The key.
18591 * @param item {} The object to add.
18592 */
18593 addUnique: function addUnique(attr, item) {
18594 return this.set(attr, new AV.Op.AddUnique(ensureArray(item)));
18595 },
18596
18597 /**
18598 * Atomically remove all instances of an object from the array associated
18599 * with a given key.
18600 *
18601 * @param key {String} The key.
18602 * @param item {} The object to remove.
18603 */
18604 remove: function remove(attr, item) {
18605 return this.set(attr, new AV.Op.Remove(ensureArray(item)));
18606 },
18607
18608 /**
18609 * Atomically apply a "bit and" operation on the value associated with a
18610 * given key.
18611 *
18612 * @param key {String} The key.
18613 * @param value {Number} The value to apply.
18614 */
18615 bitAnd: function bitAnd(attr, value) {
18616 return this.set(attr, new AV.Op.BitAnd(value));
18617 },
18618
18619 /**
18620 * Atomically apply a "bit or" operation on the value associated with a
18621 * given key.
18622 *
18623 * @param key {String} The key.
18624 * @param value {Number} The value to apply.
18625 */
18626 bitOr: function bitOr(attr, value) {
18627 return this.set(attr, new AV.Op.BitOr(value));
18628 },
18629
18630 /**
18631 * Atomically apply a "bit xor" operation on the value associated with a
18632 * given key.
18633 *
18634 * @param key {String} The key.
18635 * @param value {Number} The value to apply.
18636 */
18637 bitXor: function bitXor(attr, value) {
18638 return this.set(attr, new AV.Op.BitXor(value));
18639 },
18640
18641 /**
18642 * Returns an instance of a subclass of AV.Op describing what kind of
18643 * modification has been performed on this field since the last time it was
18644 * saved. For example, after calling object.increment("x"), calling
18645 * object.op("x") would return an instance of AV.Op.Increment.
18646 *
18647 * @param key {String} The key.
18648 * @returns {AV.Op} The operation, or undefined if none.
18649 */
18650 op: function op(attr) {
18651 return _.last(this._opSetQueue)[attr];
18652 },
18653
18654 /**
18655 * Clear all attributes on the model, firing <code>"change"</code> unless
18656 * you choose to silence it.
18657 */
18658 clear: function clear(options) {
18659 options = options || {};
18660 options.unset = true;
18661
18662 var keysToClear = _.extend(this.attributes, this._operations);
18663
18664 return this.set(keysToClear, options);
18665 },
18666
18667 /**
18668 * Clears any (or specific) changes to the model made since the last save.
18669 * @param {string|string[]} [keys] specify keys to revert.
18670 */
18671 revert: function revert(keys) {
18672 var lastOp = _.last(this._opSetQueue);
18673
18674 var _keys = ensureArray(keys || (0, _keys2.default)(_).call(_, lastOp));
18675
18676 _keys.forEach(function (key) {
18677 delete lastOp[key];
18678 });
18679
18680 this._rebuildAllEstimatedData();
18681
18682 return this;
18683 },
18684
18685 /**
18686 * Returns a JSON-encoded set of operations to be sent with the next save
18687 * request.
18688 * @private
18689 */
18690 _getSaveJSON: function _getSaveJSON() {
18691 var json = _.clone(_.first(this._opSetQueue));
18692
18693 AV._objectEach(json, function (op, key) {
18694 json[key] = op.toJSON();
18695 });
18696
18697 return json;
18698 },
18699
18700 /**
18701 * Returns true if this object can be serialized for saving.
18702 * @private
18703 */
18704 _canBeSerialized: function _canBeSerialized() {
18705 return AV.Object._canBeSerializedAsValue(this.attributes);
18706 },
18707
18708 /**
18709 * Fetch the model from the server. If the server's representation of the
18710 * model differs from its current attributes, they will be overriden,
18711 * triggering a <code>"change"</code> event.
18712 * @param {Object} fetchOptions Optional options to set 'keys',
18713 * 'include' and 'includeACL' option.
18714 * @param {AuthOptions} options
18715 * @return {Promise} A promise that is fulfilled when the fetch
18716 * completes.
18717 */
18718 fetch: function fetch() {
18719 var fetchOptions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
18720 var options = arguments.length > 1 ? arguments[1] : undefined;
18721
18722 if (!this.id) {
18723 throw new Error('Cannot fetch unsaved object');
18724 }
18725
18726 var self = this;
18727
18728 var request = _request('classes', this.className, this.id, 'GET', transformFetchOptions(fetchOptions), options);
18729
18730 return request.then(function (response) {
18731 var fetchedAttrs = self.parse(response);
18732
18733 self._cleanupUnsetKeys(fetchedAttrs, (0, _keys2.default)(fetchOptions) ? ensureArray((0, _keys2.default)(fetchOptions)).join(',').split(',') : undefined);
18734
18735 self._finishFetch(fetchedAttrs, true);
18736
18737 return self;
18738 });
18739 },
18740 _cleanupUnsetKeys: function _cleanupUnsetKeys(fetchedAttrs) {
18741 var _this2 = this;
18742
18743 var fetchedKeys = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : (0, _keys2.default)(_).call(_, this._serverData);
18744
18745 _.forEach(fetchedKeys, function (key) {
18746 if (fetchedAttrs[key] === undefined) delete _this2._serverData[key];
18747 });
18748 },
18749
18750 /**
18751 * Set a hash of model attributes, and save the model to the server.
18752 * updatedAt will be updated when the request returns.
18753 * You can either call it as:<pre>
18754 * object.save();</pre>
18755 * or<pre>
18756 * object.save(null, options);</pre>
18757 * or<pre>
18758 * object.save(attrs, options);</pre>
18759 * or<pre>
18760 * object.save(key, value, options);</pre>
18761 *
18762 * @example
18763 * gameTurn.save({
18764 * player: "Jake Cutter",
18765 * diceRoll: 2
18766 * }).then(function(gameTurnAgain) {
18767 * // The save was successful.
18768 * }, function(error) {
18769 * // The save failed. Error is an instance of AVError.
18770 * });
18771 *
18772 * @param {AuthOptions} options AuthOptions plus:
18773 * @param {Boolean} options.fetchWhenSave fetch and update object after save succeeded
18774 * @param {AV.Query} options.query Save object only when it matches the query
18775 * @return {Promise} A promise that is fulfilled when the save
18776 * completes.
18777 * @see AVError
18778 */
18779 save: function save(arg1, arg2, arg3) {
18780 var attrs, current, options;
18781
18782 if (_.isObject(arg1) || isNullOrUndefined(arg1)) {
18783 attrs = arg1;
18784 options = arg2;
18785 } else {
18786 attrs = {};
18787 attrs[arg1] = arg2;
18788 options = arg3;
18789 }
18790
18791 options = _.clone(options) || {};
18792
18793 if (options.wait) {
18794 current = _.clone(this.attributes);
18795 }
18796
18797 var setOptions = _.clone(options) || {};
18798
18799 if (setOptions.wait) {
18800 setOptions.silent = true;
18801 }
18802
18803 if (attrs) {
18804 this.set(attrs, setOptions);
18805 }
18806
18807 var model = this;
18808 var unsavedChildren = [];
18809 var unsavedFiles = [];
18810
18811 AV.Object._findUnsavedChildren(model, unsavedChildren, unsavedFiles);
18812
18813 if (unsavedChildren.length + unsavedFiles.length > 1) {
18814 return AV.Object._deepSaveAsync(this, model, options);
18815 }
18816
18817 this._startSave();
18818
18819 this._saving = (this._saving || 0) + 1;
18820 this._allPreviousSaves = this._allPreviousSaves || _promise.default.resolve();
18821 this._allPreviousSaves = this._allPreviousSaves.catch(function (e) {}).then(function () {
18822 var method = model.id ? 'PUT' : 'POST';
18823
18824 var json = model._getSaveJSON();
18825
18826 var query = {};
18827
18828 if (model._fetchWhenSave || options.fetchWhenSave) {
18829 query['new'] = 'true';
18830 } // user login option
18831
18832
18833 if (options._failOnNotExist) {
18834 query.failOnNotExist = 'true';
18835 }
18836
18837 if (options.query) {
18838 var queryParams;
18839
18840 if (typeof options.query._getParams === 'function') {
18841 queryParams = options.query._getParams();
18842
18843 if (queryParams) {
18844 query.where = queryParams.where;
18845 }
18846 }
18847
18848 if (!query.where) {
18849 var error = new Error('options.query is not an AV.Query');
18850 throw error;
18851 }
18852 }
18853
18854 _.extend(json, model._flags);
18855
18856 var route = 'classes';
18857 var className = model.className;
18858
18859 if (model.className === '_User' && !model.id) {
18860 // Special-case user sign-up.
18861 route = 'users';
18862 className = null;
18863 } //hook makeRequest in options.
18864
18865
18866 var makeRequest = options._makeRequest || _request;
18867 var requestPromise = makeRequest(route, className, model.id, method, json, options, query);
18868 requestPromise = requestPromise.then(function (resp) {
18869 var serverAttrs = model.parse(resp);
18870
18871 if (options.wait) {
18872 serverAttrs = _.extend(attrs || {}, serverAttrs);
18873 }
18874
18875 model._finishSave(serverAttrs);
18876
18877 if (options.wait) {
18878 model.set(current, setOptions);
18879 }
18880
18881 return model;
18882 }, function (error) {
18883 model._cancelSave();
18884
18885 throw error;
18886 });
18887 return requestPromise;
18888 });
18889 return this._allPreviousSaves;
18890 },
18891
18892 /**
18893 * Destroy this model on the server if it was already persisted.
18894 * Optimistically removes the model from its collection, if it has one.
18895 * @param {AuthOptions} options AuthOptions plus:
18896 * @param {Boolean} [options.wait] wait for the server to respond
18897 * before removal.
18898 *
18899 * @return {Promise} A promise that is fulfilled when the destroy
18900 * completes.
18901 */
18902 destroy: function destroy(options) {
18903 options = options || {};
18904 var model = this;
18905
18906 var triggerDestroy = function triggerDestroy() {
18907 model.trigger('destroy', model, model.collection, options);
18908 };
18909
18910 if (!this.id) {
18911 return triggerDestroy();
18912 }
18913
18914 if (!options.wait) {
18915 triggerDestroy();
18916 }
18917
18918 var request = _request('classes', this.className, this.id, 'DELETE', this._flags, options);
18919
18920 return request.then(function () {
18921 if (options.wait) {
18922 triggerDestroy();
18923 }
18924
18925 return model;
18926 });
18927 },
18928
18929 /**
18930 * Converts a response into the hash of attributes to be set on the model.
18931 * @ignore
18932 */
18933 parse: function parse(resp) {
18934 var output = _.clone(resp);
18935
18936 ['createdAt', 'updatedAt'].forEach(function (key) {
18937 if (output[key]) {
18938 output[key] = AV._parseDate(output[key]);
18939 }
18940 });
18941
18942 if (output.createdAt && !output.updatedAt) {
18943 output.updatedAt = output.createdAt;
18944 }
18945
18946 return output;
18947 },
18948
18949 /**
18950 * Creates a new model with identical attributes to this one.
18951 * @return {AV.Object}
18952 */
18953 clone: function clone() {
18954 return new this.constructor(this.attributes);
18955 },
18956
18957 /**
18958 * Returns true if this object has never been saved to AV.
18959 * @return {Boolean}
18960 */
18961 isNew: function isNew() {
18962 return !this.id;
18963 },
18964
18965 /**
18966 * Call this method to manually fire a `"change"` event for this model and
18967 * a `"change:attribute"` event for each changed attribute.
18968 * Calling this will cause all objects observing the model to update.
18969 */
18970 change: function change(options) {
18971 options = options || {};
18972 var changing = this._changing;
18973 this._changing = true; // Silent changes become pending changes.
18974
18975 var self = this;
18976
18977 AV._objectEach(this._silent, function (attr) {
18978 self._pending[attr] = true;
18979 }); // Silent changes are triggered.
18980
18981
18982 var changes = _.extend({}, options.changes, this._silent);
18983
18984 this._silent = {};
18985
18986 AV._objectEach(changes, function (unused_value, attr) {
18987 self.trigger('change:' + attr, self, self.get(attr), options);
18988 });
18989
18990 if (changing) {
18991 return this;
18992 } // This is to get around lint not letting us make a function in a loop.
18993
18994
18995 var deleteChanged = function deleteChanged(value, attr) {
18996 if (!self._pending[attr] && !self._silent[attr]) {
18997 delete self.changed[attr];
18998 }
18999 }; // Continue firing `"change"` events while there are pending changes.
19000
19001
19002 while (!_.isEmpty(this._pending)) {
19003 this._pending = {};
19004 this.trigger('change', this, options); // Pending and silent changes still remain.
19005
19006 AV._objectEach(this.changed, deleteChanged);
19007
19008 self._previousAttributes = _.clone(this.attributes);
19009 }
19010
19011 this._changing = false;
19012 return this;
19013 },
19014
19015 /**
19016 * Gets the previous value of an attribute, recorded at the time the last
19017 * <code>"change"</code> event was fired.
19018 * @param {String} attr Name of the attribute to get.
19019 */
19020 previous: function previous(attr) {
19021 if (!arguments.length || !this._previousAttributes) {
19022 return null;
19023 }
19024
19025 return this._previousAttributes[attr];
19026 },
19027
19028 /**
19029 * Gets all of the attributes of the model at the time of the previous
19030 * <code>"change"</code> event.
19031 * @return {Object}
19032 */
19033 previousAttributes: function previousAttributes() {
19034 return _.clone(this._previousAttributes);
19035 },
19036
19037 /**
19038 * Checks if the model is currently in a valid state. It's only possible to
19039 * get into an *invalid* state if you're using silent changes.
19040 * @return {Boolean}
19041 */
19042 isValid: function isValid() {
19043 try {
19044 this.validate(this.attributes);
19045 } catch (error) {
19046 return false;
19047 }
19048
19049 return true;
19050 },
19051
19052 /**
19053 * You should not call this function directly unless you subclass
19054 * <code>AV.Object</code>, in which case you can override this method
19055 * to provide additional validation on <code>set</code> and
19056 * <code>save</code>. Your implementation should throw an Error if
19057 * the attrs is invalid
19058 *
19059 * @param {Object} attrs The current data to validate.
19060 * @see AV.Object#set
19061 */
19062 validate: function validate(attrs) {
19063 if (_.has(attrs, 'ACL') && !(attrs.ACL instanceof AV.ACL)) {
19064 throw new AVError(AVError.OTHER_CAUSE, 'ACL must be a AV.ACL.');
19065 }
19066 },
19067
19068 /**
19069 * Run validation against a set of incoming attributes, returning `true`
19070 * if all is well. If a specific `error` callback has been passed,
19071 * call that instead of firing the general `"error"` event.
19072 * @private
19073 */
19074 _validate: function _validate(attrs, options) {
19075 if (options.silent || !this.validate) {
19076 return;
19077 }
19078
19079 attrs = _.extend({}, this.attributes, attrs);
19080 this.validate(attrs);
19081 },
19082
19083 /**
19084 * Returns the ACL for this object.
19085 * @returns {AV.ACL} An instance of AV.ACL.
19086 * @see AV.Object#get
19087 */
19088 getACL: function getACL() {
19089 return this.get('ACL');
19090 },
19091
19092 /**
19093 * Sets the ACL to be used for this object.
19094 * @param {AV.ACL} acl An instance of AV.ACL.
19095 * @param {Object} options Optional Backbone-like options object to be
19096 * passed in to set.
19097 * @return {AV.Object} self
19098 * @see AV.Object#set
19099 */
19100 setACL: function setACL(acl, options) {
19101 return this.set('ACL', acl, options);
19102 },
19103 disableBeforeHook: function disableBeforeHook() {
19104 this.ignoreHook('beforeSave');
19105 this.ignoreHook('beforeUpdate');
19106 this.ignoreHook('beforeDelete');
19107 },
19108 disableAfterHook: function disableAfterHook() {
19109 this.ignoreHook('afterSave');
19110 this.ignoreHook('afterUpdate');
19111 this.ignoreHook('afterDelete');
19112 },
19113 ignoreHook: function ignoreHook(hookName) {
19114 if (!_.contains(['beforeSave', 'afterSave', 'beforeUpdate', 'afterUpdate', 'beforeDelete', 'afterDelete'], hookName)) {
19115 throw new Error('Unsupported hookName: ' + hookName);
19116 }
19117
19118 if (!AV.hookKey) {
19119 throw new Error('ignoreHook required hookKey');
19120 }
19121
19122 if (!this._flags.__ignore_hooks) {
19123 this._flags.__ignore_hooks = [];
19124 }
19125
19126 this._flags.__ignore_hooks.push(hookName);
19127 }
19128 });
19129 /**
19130 * Creates an instance of a subclass of AV.Object for the give classname
19131 * and id.
19132 * @param {String|Function} class the className or a subclass of AV.Object.
19133 * @param {String} id The object id of this model.
19134 * @return {AV.Object} A new subclass instance of AV.Object.
19135 */
19136
19137
19138 AV.Object.createWithoutData = function (klass, id, hasData) {
19139 var _klass;
19140
19141 if (_.isString(klass)) {
19142 _klass = AV.Object._getSubclass(klass);
19143 } else if (klass.prototype && klass.prototype instanceof AV.Object) {
19144 _klass = klass;
19145 } else {
19146 throw new Error('class must be a string or a subclass of AV.Object.');
19147 }
19148
19149 if (!id) {
19150 throw new TypeError('The objectId must be provided');
19151 }
19152
19153 var object = new _klass();
19154 object.id = id;
19155 object._hasData = hasData;
19156 return object;
19157 };
19158 /**
19159 * Delete objects in batch.
19160 * @param {AV.Object[]} objects The <code>AV.Object</code> array to be deleted.
19161 * @param {AuthOptions} options
19162 * @return {Promise} A promise that is fulfilled when the save
19163 * completes.
19164 */
19165
19166
19167 AV.Object.destroyAll = function (objects) {
19168 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
19169
19170 if (!objects || objects.length === 0) {
19171 return _promise.default.resolve();
19172 }
19173
19174 var objectsByClassNameAndFlags = _.groupBy(objects, function (object) {
19175 return (0, _stringify.default)({
19176 className: object.className,
19177 flags: object._flags
19178 });
19179 });
19180
19181 var body = {
19182 requests: (0, _map.default)(_).call(_, objectsByClassNameAndFlags, function (objects) {
19183 var _context3;
19184
19185 var ids = (0, _map.default)(_).call(_, objects, 'id').join(',');
19186 return {
19187 method: 'DELETE',
19188 path: (0, _concat.default)(_context3 = "/1.1/classes/".concat(objects[0].className, "/")).call(_context3, ids),
19189 body: objects[0]._flags
19190 };
19191 })
19192 };
19193 return _request('batch', null, null, 'POST', body, options).then(function (response) {
19194 var firstError = (0, _find.default)(_).call(_, response, function (result) {
19195 return !result.success;
19196 });
19197 if (firstError) throw new AVError(firstError.error.code, firstError.error.error);
19198 return undefined;
19199 });
19200 };
19201 /**
19202 * Returns the appropriate subclass for making new instances of the given
19203 * className string.
19204 * @private
19205 */
19206
19207
19208 AV.Object._getSubclass = function (className) {
19209 if (!_.isString(className)) {
19210 throw new Error('AV.Object._getSubclass requires a string argument.');
19211 }
19212
19213 var ObjectClass = AV.Object._classMap[className];
19214
19215 if (!ObjectClass) {
19216 ObjectClass = AV.Object.extend(className);
19217 AV.Object._classMap[className] = ObjectClass;
19218 }
19219
19220 return ObjectClass;
19221 };
19222 /**
19223 * Creates an instance of a subclass of AV.Object for the given classname.
19224 * @private
19225 */
19226
19227
19228 AV.Object._create = function (className, attributes, options) {
19229 var ObjectClass = AV.Object._getSubclass(className);
19230
19231 return new ObjectClass(attributes, options);
19232 }; // Set up a map of className to class so that we can create new instances of
19233 // AV Objects from JSON automatically.
19234
19235
19236 AV.Object._classMap = {};
19237 AV.Object._extend = AV._extend;
19238 /**
19239 * Creates a new model with defined attributes,
19240 * It's the same with
19241 * <pre>
19242 * new AV.Object(attributes, options);
19243 * </pre>
19244 * @param {Object} attributes The initial set of data to store in the object.
19245 * @param {Object} options A set of Backbone-like options for creating the
19246 * object. The only option currently supported is "collection".
19247 * @return {AV.Object}
19248 * @since v0.4.4
19249 * @see AV.Object
19250 * @see AV.Object.extend
19251 */
19252
19253 AV.Object['new'] = function (attributes, options) {
19254 return new AV.Object(attributes, options);
19255 };
19256 /**
19257 * Creates a new subclass of AV.Object for the given AV class name.
19258 *
19259 * <p>Every extension of a AV class will inherit from the most recent
19260 * previous extension of that class. When a AV.Object is automatically
19261 * created by parsing JSON, it will use the most recent extension of that
19262 * class.</p>
19263 *
19264 * @example
19265 * var MyClass = AV.Object.extend("MyClass", {
19266 * // Instance properties
19267 * }, {
19268 * // Class properties
19269 * });
19270 *
19271 * @param {String} className The name of the AV class backing this model.
19272 * @param {Object} protoProps Instance properties to add to instances of the
19273 * class returned from this method.
19274 * @param {Object} classProps Class properties to add the class returned from
19275 * this method.
19276 * @return {Class} A new subclass of AV.Object.
19277 */
19278
19279
19280 AV.Object.extend = function (className, protoProps, classProps) {
19281 // Handle the case with only two args.
19282 if (!_.isString(className)) {
19283 if (className && _.has(className, 'className')) {
19284 return AV.Object.extend(className.className, className, protoProps);
19285 } else {
19286 throw new Error("AV.Object.extend's first argument should be the className.");
19287 }
19288 } // If someone tries to subclass "User", coerce it to the right type.
19289
19290
19291 if (className === 'User') {
19292 className = '_User';
19293 }
19294
19295 var NewClassObject = null;
19296
19297 if (_.has(AV.Object._classMap, className)) {
19298 var OldClassObject = AV.Object._classMap[className]; // This new subclass has been told to extend both from "this" and from
19299 // OldClassObject. This is multiple inheritance, which isn't supported.
19300 // For now, let's just pick one.
19301
19302 if (protoProps || classProps) {
19303 NewClassObject = OldClassObject._extend(protoProps, classProps);
19304 } else {
19305 return OldClassObject;
19306 }
19307 } else {
19308 protoProps = protoProps || {};
19309 protoProps._className = className;
19310 NewClassObject = this._extend(protoProps, classProps);
19311 } // Extending a subclass should reuse the classname automatically.
19312
19313
19314 NewClassObject.extend = function (arg0) {
19315 var _context4;
19316
19317 if (_.isString(arg0) || arg0 && _.has(arg0, 'className')) {
19318 return AV.Object.extend.apply(NewClassObject, arguments);
19319 }
19320
19321 var newArguments = (0, _concat.default)(_context4 = [className]).call(_context4, _.toArray(arguments));
19322 return AV.Object.extend.apply(NewClassObject, newArguments);
19323 }; // Add the query property descriptor.
19324
19325
19326 (0, _defineProperty.default)(NewClassObject, 'query', (0, _getOwnPropertyDescriptor.default)(AV.Object, 'query'));
19327
19328 NewClassObject['new'] = function (attributes, options) {
19329 return new NewClassObject(attributes, options);
19330 };
19331
19332 AV.Object._classMap[className] = NewClassObject;
19333 return NewClassObject;
19334 }; // ES6 class syntax support
19335
19336
19337 (0, _defineProperty.default)(AV.Object.prototype, 'className', {
19338 get: function get() {
19339 var className = this._className || this.constructor._LCClassName || this.constructor.name; // If someone tries to subclass "User", coerce it to the right type.
19340
19341 if (className === 'User') {
19342 return '_User';
19343 }
19344
19345 return className;
19346 }
19347 });
19348 /**
19349 * Register a class.
19350 * If a subclass of <code>AV.Object</code> is defined with your own implement
19351 * rather then <code>AV.Object.extend</code>, the subclass must be registered.
19352 * @param {Function} klass A subclass of <code>AV.Object</code>
19353 * @param {String} [name] Specify the name of the class. Useful when the class might be uglified.
19354 * @example
19355 * class Person extend AV.Object {}
19356 * AV.Object.register(Person);
19357 */
19358
19359 AV.Object.register = function (klass, name) {
19360 if (!(klass.prototype instanceof AV.Object)) {
19361 throw new Error('registered class is not a subclass of AV.Object');
19362 }
19363
19364 var className = name || klass.name;
19365
19366 if (!className.length) {
19367 throw new Error('registered class must be named');
19368 }
19369
19370 if (name) {
19371 klass._LCClassName = name;
19372 }
19373
19374 AV.Object._classMap[className] = klass;
19375 };
19376 /**
19377 * Get a new Query of the current class
19378 * @name query
19379 * @memberof AV.Object
19380 * @type AV.Query
19381 * @readonly
19382 * @since v3.1.0
19383 * @example
19384 * const Post = AV.Object.extend('Post');
19385 * Post.query.equalTo('author', 'leancloud').find().then();
19386 */
19387
19388
19389 (0, _defineProperty.default)(AV.Object, 'query', {
19390 get: function get() {
19391 return new AV.Query(this.prototype.className);
19392 }
19393 });
19394
19395 AV.Object._findUnsavedChildren = function (objects, children, files) {
19396 AV._traverse(objects, function (object) {
19397 if (object instanceof AV.Object) {
19398 if (object.dirty()) {
19399 children.push(object);
19400 }
19401
19402 return;
19403 }
19404
19405 if (object instanceof AV.File) {
19406 if (!object.id) {
19407 files.push(object);
19408 }
19409
19410 return;
19411 }
19412 });
19413 };
19414
19415 AV.Object._canBeSerializedAsValue = function (object) {
19416 var canBeSerializedAsValue = true;
19417
19418 if (object instanceof AV.Object || object instanceof AV.File) {
19419 canBeSerializedAsValue = !!object.id;
19420 } else if (_.isArray(object)) {
19421 AV._arrayEach(object, function (child) {
19422 if (!AV.Object._canBeSerializedAsValue(child)) {
19423 canBeSerializedAsValue = false;
19424 }
19425 });
19426 } else if (_.isObject(object)) {
19427 AV._objectEach(object, function (child) {
19428 if (!AV.Object._canBeSerializedAsValue(child)) {
19429 canBeSerializedAsValue = false;
19430 }
19431 });
19432 }
19433
19434 return canBeSerializedAsValue;
19435 };
19436
19437 AV.Object._deepSaveAsync = function (object, model, options) {
19438 var unsavedChildren = [];
19439 var unsavedFiles = [];
19440
19441 AV.Object._findUnsavedChildren(object, unsavedChildren, unsavedFiles);
19442
19443 unsavedFiles = _.uniq(unsavedFiles);
19444
19445 var promise = _promise.default.resolve();
19446
19447 _.each(unsavedFiles, function (file) {
19448 promise = promise.then(function () {
19449 return file.save();
19450 });
19451 });
19452
19453 var objects = _.uniq(unsavedChildren);
19454
19455 var remaining = _.uniq(objects);
19456
19457 return promise.then(function () {
19458 return continueWhile(function () {
19459 return remaining.length > 0;
19460 }, function () {
19461 // Gather up all the objects that can be saved in this batch.
19462 var batch = [];
19463 var newRemaining = [];
19464
19465 AV._arrayEach(remaining, function (object) {
19466 if (object._canBeSerialized()) {
19467 batch.push(object);
19468 } else {
19469 newRemaining.push(object);
19470 }
19471 });
19472
19473 remaining = newRemaining; // If we can't save any objects, there must be a circular reference.
19474
19475 if (batch.length === 0) {
19476 return _promise.default.reject(new AVError(AVError.OTHER_CAUSE, 'Tried to save a batch with a cycle.'));
19477 } // Reserve a spot in every object's save queue.
19478
19479
19480 var readyToStart = _promise.default.resolve((0, _map.default)(_).call(_, batch, function (object) {
19481 return object._allPreviousSaves || _promise.default.resolve();
19482 })); // Save a single batch, whether previous saves succeeded or failed.
19483
19484
19485 var bathSavePromise = readyToStart.then(function () {
19486 return _request('batch', null, null, 'POST', {
19487 requests: (0, _map.default)(_).call(_, batch, function (object) {
19488 var method = object.id ? 'PUT' : 'POST';
19489
19490 var json = object._getSaveJSON();
19491
19492 _.extend(json, object._flags);
19493
19494 var route = 'classes';
19495 var className = object.className;
19496 var path = "/".concat(route, "/").concat(className);
19497
19498 if (object.className === '_User' && !object.id) {
19499 // Special-case user sign-up.
19500 path = '/users';
19501 }
19502
19503 var path = "/1.1".concat(path);
19504
19505 if (object.id) {
19506 path = path + '/' + object.id;
19507 }
19508
19509 object._startSave();
19510
19511 return {
19512 method: method,
19513 path: path,
19514 body: json,
19515 params: options && options.fetchWhenSave ? {
19516 fetchWhenSave: true
19517 } : undefined
19518 };
19519 })
19520 }, options).then(function (response) {
19521 var results = (0, _map.default)(_).call(_, batch, function (object, i) {
19522 if (response[i].success) {
19523 object._finishSave(object.parse(response[i].success));
19524
19525 return object;
19526 }
19527
19528 object._cancelSave();
19529
19530 return new AVError(response[i].error.code, response[i].error.error);
19531 });
19532 return handleBatchResults(results);
19533 });
19534 });
19535
19536 AV._arrayEach(batch, function (object) {
19537 object._allPreviousSaves = bathSavePromise;
19538 });
19539
19540 return bathSavePromise;
19541 });
19542 }).then(function () {
19543 return object;
19544 });
19545 };
19546};
19547
19548/***/ }),
19549/* 534 */
19550/***/ (function(module, exports, __webpack_require__) {
19551
19552var arrayWithHoles = __webpack_require__(535);
19553
19554var iterableToArrayLimit = __webpack_require__(543);
19555
19556var unsupportedIterableToArray = __webpack_require__(544);
19557
19558var nonIterableRest = __webpack_require__(554);
19559
19560function _slicedToArray(arr, i) {
19561 return arrayWithHoles(arr) || iterableToArrayLimit(arr, i) || unsupportedIterableToArray(arr, i) || nonIterableRest();
19562}
19563
19564module.exports = _slicedToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
19565
19566/***/ }),
19567/* 535 */
19568/***/ (function(module, exports, __webpack_require__) {
19569
19570var _Array$isArray = __webpack_require__(536);
19571
19572function _arrayWithHoles(arr) {
19573 if (_Array$isArray(arr)) return arr;
19574}
19575
19576module.exports = _arrayWithHoles, module.exports.__esModule = true, module.exports["default"] = module.exports;
19577
19578/***/ }),
19579/* 536 */
19580/***/ (function(module, exports, __webpack_require__) {
19581
19582module.exports = __webpack_require__(537);
19583
19584/***/ }),
19585/* 537 */
19586/***/ (function(module, exports, __webpack_require__) {
19587
19588module.exports = __webpack_require__(538);
19589
19590
19591/***/ }),
19592/* 538 */
19593/***/ (function(module, exports, __webpack_require__) {
19594
19595var parent = __webpack_require__(539);
19596
19597module.exports = parent;
19598
19599
19600/***/ }),
19601/* 539 */
19602/***/ (function(module, exports, __webpack_require__) {
19603
19604var parent = __webpack_require__(540);
19605
19606module.exports = parent;
19607
19608
19609/***/ }),
19610/* 540 */
19611/***/ (function(module, exports, __webpack_require__) {
19612
19613var parent = __webpack_require__(541);
19614
19615module.exports = parent;
19616
19617
19618/***/ }),
19619/* 541 */
19620/***/ (function(module, exports, __webpack_require__) {
19621
19622__webpack_require__(542);
19623var path = __webpack_require__(7);
19624
19625module.exports = path.Array.isArray;
19626
19627
19628/***/ }),
19629/* 542 */
19630/***/ (function(module, exports, __webpack_require__) {
19631
19632var $ = __webpack_require__(0);
19633var isArray = __webpack_require__(92);
19634
19635// `Array.isArray` method
19636// https://tc39.es/ecma262/#sec-array.isarray
19637$({ target: 'Array', stat: true }, {
19638 isArray: isArray
19639});
19640
19641
19642/***/ }),
19643/* 543 */
19644/***/ (function(module, exports, __webpack_require__) {
19645
19646var _Symbol = __webpack_require__(240);
19647
19648var _getIteratorMethod = __webpack_require__(252);
19649
19650function _iterableToArrayLimit(arr, i) {
19651 var _i = arr == null ? null : typeof _Symbol !== "undefined" && _getIteratorMethod(arr) || arr["@@iterator"];
19652
19653 if (_i == null) return;
19654 var _arr = [];
19655 var _n = true;
19656 var _d = false;
19657
19658 var _s, _e;
19659
19660 try {
19661 for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
19662 _arr.push(_s.value);
19663
19664 if (i && _arr.length === i) break;
19665 }
19666 } catch (err) {
19667 _d = true;
19668 _e = err;
19669 } finally {
19670 try {
19671 if (!_n && _i["return"] != null) _i["return"]();
19672 } finally {
19673 if (_d) throw _e;
19674 }
19675 }
19676
19677 return _arr;
19678}
19679
19680module.exports = _iterableToArrayLimit, module.exports.__esModule = true, module.exports["default"] = module.exports;
19681
19682/***/ }),
19683/* 544 */
19684/***/ (function(module, exports, __webpack_require__) {
19685
19686var _sliceInstanceProperty = __webpack_require__(545);
19687
19688var _Array$from = __webpack_require__(549);
19689
19690var arrayLikeToArray = __webpack_require__(553);
19691
19692function _unsupportedIterableToArray(o, minLen) {
19693 var _context;
19694
19695 if (!o) return;
19696 if (typeof o === "string") return arrayLikeToArray(o, minLen);
19697
19698 var n = _sliceInstanceProperty(_context = Object.prototype.toString.call(o)).call(_context, 8, -1);
19699
19700 if (n === "Object" && o.constructor) n = o.constructor.name;
19701 if (n === "Map" || n === "Set") return _Array$from(o);
19702 if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return arrayLikeToArray(o, minLen);
19703}
19704
19705module.exports = _unsupportedIterableToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
19706
19707/***/ }),
19708/* 545 */
19709/***/ (function(module, exports, __webpack_require__) {
19710
19711module.exports = __webpack_require__(546);
19712
19713/***/ }),
19714/* 546 */
19715/***/ (function(module, exports, __webpack_require__) {
19716
19717module.exports = __webpack_require__(547);
19718
19719
19720/***/ }),
19721/* 547 */
19722/***/ (function(module, exports, __webpack_require__) {
19723
19724var parent = __webpack_require__(548);
19725
19726module.exports = parent;
19727
19728
19729/***/ }),
19730/* 548 */
19731/***/ (function(module, exports, __webpack_require__) {
19732
19733var parent = __webpack_require__(238);
19734
19735module.exports = parent;
19736
19737
19738/***/ }),
19739/* 549 */
19740/***/ (function(module, exports, __webpack_require__) {
19741
19742module.exports = __webpack_require__(550);
19743
19744/***/ }),
19745/* 550 */
19746/***/ (function(module, exports, __webpack_require__) {
19747
19748module.exports = __webpack_require__(551);
19749
19750
19751/***/ }),
19752/* 551 */
19753/***/ (function(module, exports, __webpack_require__) {
19754
19755var parent = __webpack_require__(552);
19756
19757module.exports = parent;
19758
19759
19760/***/ }),
19761/* 552 */
19762/***/ (function(module, exports, __webpack_require__) {
19763
19764var parent = __webpack_require__(251);
19765
19766module.exports = parent;
19767
19768
19769/***/ }),
19770/* 553 */
19771/***/ (function(module, exports) {
19772
19773function _arrayLikeToArray(arr, len) {
19774 if (len == null || len > arr.length) len = arr.length;
19775
19776 for (var i = 0, arr2 = new Array(len); i < len; i++) {
19777 arr2[i] = arr[i];
19778 }
19779
19780 return arr2;
19781}
19782
19783module.exports = _arrayLikeToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
19784
19785/***/ }),
19786/* 554 */
19787/***/ (function(module, exports) {
19788
19789function _nonIterableRest() {
19790 throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
19791}
19792
19793module.exports = _nonIterableRest, module.exports.__esModule = true, module.exports["default"] = module.exports;
19794
19795/***/ }),
19796/* 555 */
19797/***/ (function(module, exports, __webpack_require__) {
19798
19799var parent = __webpack_require__(556);
19800
19801module.exports = parent;
19802
19803
19804/***/ }),
19805/* 556 */
19806/***/ (function(module, exports, __webpack_require__) {
19807
19808__webpack_require__(557);
19809var path = __webpack_require__(7);
19810
19811var Object = path.Object;
19812
19813var getOwnPropertyDescriptor = module.exports = function getOwnPropertyDescriptor(it, key) {
19814 return Object.getOwnPropertyDescriptor(it, key);
19815};
19816
19817if (Object.getOwnPropertyDescriptor.sham) getOwnPropertyDescriptor.sham = true;
19818
19819
19820/***/ }),
19821/* 557 */
19822/***/ (function(module, exports, __webpack_require__) {
19823
19824var $ = __webpack_require__(0);
19825var fails = __webpack_require__(2);
19826var toIndexedObject = __webpack_require__(35);
19827var nativeGetOwnPropertyDescriptor = __webpack_require__(64).f;
19828var DESCRIPTORS = __webpack_require__(14);
19829
19830var FAILS_ON_PRIMITIVES = fails(function () { nativeGetOwnPropertyDescriptor(1); });
19831var FORCED = !DESCRIPTORS || FAILS_ON_PRIMITIVES;
19832
19833// `Object.getOwnPropertyDescriptor` method
19834// https://tc39.es/ecma262/#sec-object.getownpropertydescriptor
19835$({ target: 'Object', stat: true, forced: FORCED, sham: !DESCRIPTORS }, {
19836 getOwnPropertyDescriptor: function getOwnPropertyDescriptor(it, key) {
19837 return nativeGetOwnPropertyDescriptor(toIndexedObject(it), key);
19838 }
19839});
19840
19841
19842/***/ }),
19843/* 558 */
19844/***/ (function(module, exports, __webpack_require__) {
19845
19846"use strict";
19847
19848
19849var _ = __webpack_require__(3);
19850
19851var AVError = __webpack_require__(48);
19852
19853module.exports = function (AV) {
19854 AV.Role = AV.Object.extend('_Role',
19855 /** @lends AV.Role.prototype */
19856 {
19857 // Instance Methods
19858
19859 /**
19860 * Represents a Role on the AV server. Roles represent groupings of
19861 * Users for the purposes of granting permissions (e.g. specifying an ACL
19862 * for an Object). Roles are specified by their sets of child users and
19863 * child roles, all of which are granted any permissions that the parent
19864 * role has.
19865 *
19866 * <p>Roles must have a name (which cannot be changed after creation of the
19867 * role), and must specify an ACL.</p>
19868 * An AV.Role is a local representation of a role persisted to the AV
19869 * cloud.
19870 * @class AV.Role
19871 * @param {String} name The name of the Role to create.
19872 * @param {AV.ACL} acl The ACL for this role.
19873 */
19874 constructor: function constructor(name, acl) {
19875 if (_.isString(name)) {
19876 AV.Object.prototype.constructor.call(this, null, null);
19877 this.setName(name);
19878 } else {
19879 AV.Object.prototype.constructor.call(this, name, acl);
19880 }
19881
19882 if (acl) {
19883 if (!(acl instanceof AV.ACL)) {
19884 throw new TypeError('acl must be an instance of AV.ACL');
19885 } else {
19886 this.setACL(acl);
19887 }
19888 }
19889 },
19890
19891 /**
19892 * Gets the name of the role. You can alternatively call role.get("name")
19893 *
19894 * @return {String} the name of the role.
19895 */
19896 getName: function getName() {
19897 return this.get('name');
19898 },
19899
19900 /**
19901 * Sets the name for a role. This value must be set before the role has
19902 * been saved to the server, and cannot be set once the role has been
19903 * saved.
19904 *
19905 * <p>
19906 * A role's name can only contain alphanumeric characters, _, -, and
19907 * spaces.
19908 * </p>
19909 *
19910 * <p>This is equivalent to calling role.set("name", name)</p>
19911 *
19912 * @param {String} name The name of the role.
19913 */
19914 setName: function setName(name, options) {
19915 return this.set('name', name, options);
19916 },
19917
19918 /**
19919 * Gets the AV.Relation for the AV.Users that are direct
19920 * children of this role. These users are granted any privileges that this
19921 * role has been granted (e.g. read or write access through ACLs). You can
19922 * add or remove users from the role through this relation.
19923 *
19924 * <p>This is equivalent to calling role.relation("users")</p>
19925 *
19926 * @return {AV.Relation} the relation for the users belonging to this
19927 * role.
19928 */
19929 getUsers: function getUsers() {
19930 return this.relation('users');
19931 },
19932
19933 /**
19934 * Gets the AV.Relation for the AV.Roles that are direct
19935 * children of this role. These roles' users are granted any privileges that
19936 * this role has been granted (e.g. read or write access through ACLs). You
19937 * can add or remove child roles from this role through this relation.
19938 *
19939 * <p>This is equivalent to calling role.relation("roles")</p>
19940 *
19941 * @return {AV.Relation} the relation for the roles belonging to this
19942 * role.
19943 */
19944 getRoles: function getRoles() {
19945 return this.relation('roles');
19946 },
19947
19948 /**
19949 * @ignore
19950 */
19951 validate: function validate(attrs, options) {
19952 if ('name' in attrs && attrs.name !== this.getName()) {
19953 var newName = attrs.name;
19954
19955 if (this.id && this.id !== attrs.objectId) {
19956 // Check to see if the objectId being set matches this.id.
19957 // This happens during a fetch -- the id is set before calling fetch.
19958 // Let the name be set in this case.
19959 return new AVError(AVError.OTHER_CAUSE, "A role's name can only be set before it has been saved.");
19960 }
19961
19962 if (!_.isString(newName)) {
19963 return new AVError(AVError.OTHER_CAUSE, "A role's name must be a String.");
19964 }
19965
19966 if (!/^[0-9a-zA-Z\-_ ]+$/.test(newName)) {
19967 return new AVError(AVError.OTHER_CAUSE, "A role's name can only contain alphanumeric characters, _," + ' -, and spaces.');
19968 }
19969 }
19970
19971 if (AV.Object.prototype.validate) {
19972 return AV.Object.prototype.validate.call(this, attrs, options);
19973 }
19974
19975 return false;
19976 }
19977 });
19978};
19979
19980/***/ }),
19981/* 559 */
19982/***/ (function(module, exports, __webpack_require__) {
19983
19984"use strict";
19985
19986
19987var _interopRequireDefault = __webpack_require__(1);
19988
19989var _defineProperty2 = _interopRequireDefault(__webpack_require__(560));
19990
19991var _promise = _interopRequireDefault(__webpack_require__(12));
19992
19993var _map = _interopRequireDefault(__webpack_require__(37));
19994
19995var _find = _interopRequireDefault(__webpack_require__(96));
19996
19997var _stringify = _interopRequireDefault(__webpack_require__(38));
19998
19999var _ = __webpack_require__(3);
20000
20001var uuid = __webpack_require__(230);
20002
20003var AVError = __webpack_require__(48);
20004
20005var _require = __webpack_require__(28),
20006 AVRequest = _require._request,
20007 request = _require.request;
20008
20009var _require2 = __webpack_require__(76),
20010 getAdapter = _require2.getAdapter;
20011
20012var PLATFORM_ANONYMOUS = 'anonymous';
20013var PLATFORM_QQAPP = 'lc_qqapp';
20014
20015var mergeUnionDataIntoAuthData = function mergeUnionDataIntoAuthData() {
20016 var defaultUnionIdPlatform = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'weixin';
20017 return function (authData, unionId) {
20018 var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
20019 _ref$unionIdPlatform = _ref.unionIdPlatform,
20020 unionIdPlatform = _ref$unionIdPlatform === void 0 ? defaultUnionIdPlatform : _ref$unionIdPlatform,
20021 _ref$asMainAccount = _ref.asMainAccount,
20022 asMainAccount = _ref$asMainAccount === void 0 ? false : _ref$asMainAccount;
20023
20024 if (typeof unionId !== 'string') throw new AVError(AVError.OTHER_CAUSE, 'unionId is not a string');
20025 if (typeof unionIdPlatform !== 'string') throw new AVError(AVError.OTHER_CAUSE, 'unionIdPlatform is not a string');
20026 return _.extend({}, authData, {
20027 platform: unionIdPlatform,
20028 unionid: unionId,
20029 main_account: Boolean(asMainAccount)
20030 });
20031 };
20032};
20033
20034module.exports = function (AV) {
20035 /**
20036 * @class
20037 *
20038 * <p>An AV.User object is a local representation of a user persisted to the
20039 * LeanCloud server. This class is a subclass of an AV.Object, and retains the
20040 * same functionality of an AV.Object, but also extends it with various
20041 * user specific methods, like authentication, signing up, and validation of
20042 * uniqueness.</p>
20043 */
20044 AV.User = AV.Object.extend('_User',
20045 /** @lends AV.User.prototype */
20046 {
20047 // Instance Variables
20048 _isCurrentUser: false,
20049 // Instance Methods
20050
20051 /**
20052 * Internal method to handle special fields in a _User response.
20053 * @private
20054 */
20055 _mergeMagicFields: function _mergeMagicFields(attrs) {
20056 if (attrs.sessionToken) {
20057 this._sessionToken = attrs.sessionToken;
20058 delete attrs.sessionToken;
20059 }
20060
20061 return AV.User.__super__._mergeMagicFields.call(this, attrs);
20062 },
20063
20064 /**
20065 * Removes null values from authData (which exist temporarily for
20066 * unlinking)
20067 * @private
20068 */
20069 _cleanupAuthData: function _cleanupAuthData() {
20070 if (!this.isCurrent()) {
20071 return;
20072 }
20073
20074 var authData = this.get('authData');
20075
20076 if (!authData) {
20077 return;
20078 }
20079
20080 AV._objectEach(this.get('authData'), function (value, key) {
20081 if (!authData[key]) {
20082 delete authData[key];
20083 }
20084 });
20085 },
20086
20087 /**
20088 * Synchronizes authData for all providers.
20089 * @private
20090 */
20091 _synchronizeAllAuthData: function _synchronizeAllAuthData() {
20092 var authData = this.get('authData');
20093
20094 if (!authData) {
20095 return;
20096 }
20097
20098 var self = this;
20099
20100 AV._objectEach(this.get('authData'), function (value, key) {
20101 self._synchronizeAuthData(key);
20102 });
20103 },
20104
20105 /**
20106 * Synchronizes auth data for a provider (e.g. puts the access token in the
20107 * right place to be used by the Facebook SDK).
20108 * @private
20109 */
20110 _synchronizeAuthData: function _synchronizeAuthData(provider) {
20111 if (!this.isCurrent()) {
20112 return;
20113 }
20114
20115 var authType;
20116
20117 if (_.isString(provider)) {
20118 authType = provider;
20119 provider = AV.User._authProviders[authType];
20120 } else {
20121 authType = provider.getAuthType();
20122 }
20123
20124 var authData = this.get('authData');
20125
20126 if (!authData || !provider) {
20127 return;
20128 }
20129
20130 var success = provider.restoreAuthentication(authData[authType]);
20131
20132 if (!success) {
20133 this.dissociateAuthData(provider);
20134 }
20135 },
20136 _handleSaveResult: function _handleSaveResult(makeCurrent) {
20137 // Clean up and synchronize the authData object, removing any unset values
20138 if (makeCurrent && !AV._config.disableCurrentUser) {
20139 this._isCurrentUser = true;
20140 }
20141
20142 this._cleanupAuthData();
20143
20144 this._synchronizeAllAuthData(); // Don't keep the password around.
20145
20146
20147 delete this._serverData.password;
20148
20149 this._rebuildEstimatedDataForKey('password');
20150
20151 this._refreshCache();
20152
20153 if ((makeCurrent || this.isCurrent()) && !AV._config.disableCurrentUser) {
20154 // Some old version of leanengine-node-sdk will overwrite
20155 // AV.User._saveCurrentUser which returns no Promise.
20156 // So we need a Promise wrapper.
20157 return _promise.default.resolve(AV.User._saveCurrentUser(this));
20158 } else {
20159 return _promise.default.resolve();
20160 }
20161 },
20162
20163 /**
20164 * Unlike in the Android/iOS SDKs, logInWith is unnecessary, since you can
20165 * call linkWith on the user (even if it doesn't exist yet on the server).
20166 * @private
20167 */
20168 _linkWith: function _linkWith(provider, data) {
20169 var _this = this;
20170
20171 var _ref2 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
20172 _ref2$failOnNotExist = _ref2.failOnNotExist,
20173 failOnNotExist = _ref2$failOnNotExist === void 0 ? false : _ref2$failOnNotExist;
20174
20175 var authType;
20176
20177 if (_.isString(provider)) {
20178 authType = provider;
20179 provider = AV.User._authProviders[provider];
20180 } else {
20181 authType = provider.getAuthType();
20182 }
20183
20184 if (data) {
20185 return this.save({
20186 authData: (0, _defineProperty2.default)({}, authType, data)
20187 }, {
20188 fetchWhenSave: !!this.get('authData'),
20189 _failOnNotExist: failOnNotExist
20190 }).then(function (model) {
20191 return model._handleSaveResult(true).then(function () {
20192 return model;
20193 });
20194 });
20195 } else {
20196 return provider.authenticate().then(function (result) {
20197 return _this._linkWith(provider, result);
20198 });
20199 }
20200 },
20201
20202 /**
20203 * Associate the user with a third party authData.
20204 * @since 3.3.0
20205 * @param {Object} authData The response json data returned from third party token, maybe like { openid: 'abc123', access_token: '123abc', expires_in: 1382686496 }
20206 * @param {string} platform Available platform for sign up.
20207 * @return {Promise<AV.User>} A promise that is fulfilled with the user when completed.
20208 * @example user.associateWithAuthData({
20209 * openid: 'abc123',
20210 * access_token: '123abc',
20211 * expires_in: 1382686496
20212 * }, 'weixin').then(function(user) {
20213 * //Access user here
20214 * }).catch(function(error) {
20215 * //console.error("error: ", error);
20216 * });
20217 */
20218 associateWithAuthData: function associateWithAuthData(authData, platform) {
20219 return this._linkWith(platform, authData);
20220 },
20221
20222 /**
20223 * Associate the user with a third party authData and unionId.
20224 * @since 3.5.0
20225 * @param {Object} authData The response json data returned from third party token, maybe like { openid: 'abc123', access_token: '123abc', expires_in: 1382686496 }
20226 * @param {string} platform Available platform for sign up.
20227 * @param {string} unionId
20228 * @param {Object} [unionLoginOptions]
20229 * @param {string} [unionLoginOptions.unionIdPlatform = 'weixin'] unionId platform
20230 * @param {boolean} [unionLoginOptions.asMainAccount = false] If true, the unionId will be associated with the user.
20231 * @return {Promise<AV.User>} A promise that is fulfilled with the user when completed.
20232 * @example user.associateWithAuthDataAndUnionId({
20233 * openid: 'abc123',
20234 * access_token: '123abc',
20235 * expires_in: 1382686496
20236 * }, 'weixin', 'union123', {
20237 * unionIdPlatform: 'weixin',
20238 * asMainAccount: true,
20239 * }).then(function(user) {
20240 * //Access user here
20241 * }).catch(function(error) {
20242 * //console.error("error: ", error);
20243 * });
20244 */
20245 associateWithAuthDataAndUnionId: function associateWithAuthDataAndUnionId(authData, platform, unionId, unionOptions) {
20246 return this._linkWith(platform, mergeUnionDataIntoAuthData()(authData, unionId, unionOptions));
20247 },
20248
20249 /**
20250 * Associate the user with the identity of the current mini-app.
20251 * @since 4.6.0
20252 * @param {Object} [authInfo]
20253 * @param {Object} [option]
20254 * @param {Boolean} [option.failOnNotExist] If true, the login request will fail when no user matches this authInfo.authData exists.
20255 * @return {Promise<AV.User>}
20256 */
20257 associateWithMiniApp: function associateWithMiniApp(authInfo, option) {
20258 var _this2 = this;
20259
20260 if (authInfo === undefined) {
20261 var getAuthInfo = getAdapter('getAuthInfo');
20262 return getAuthInfo().then(function (authInfo) {
20263 return _this2._linkWith(authInfo.provider, authInfo.authData, option);
20264 });
20265 }
20266
20267 return this._linkWith(authInfo.provider, authInfo.authData, option);
20268 },
20269
20270 /**
20271 * 将用户与 QQ 小程序用户进行关联。适用于为已经在用户系统中存在的用户关联当前使用 QQ 小程序的微信帐号。
20272 * 仅在 QQ 小程序中可用。
20273 *
20274 * @deprecated Please use {@link AV.User#associateWithMiniApp}
20275 * @since 4.2.0
20276 * @param {Object} [options]
20277 * @param {boolean} [options.preferUnionId = false] 如果服务端在登录时获取到了用户的 UnionId,是否将 UnionId 保存在用户账号中。
20278 * @param {string} [options.unionIdPlatform = 'qq'] (only take effect when preferUnionId) unionId platform
20279 * @param {boolean} [options.asMainAccount = true] (only take effect when preferUnionId) If true, the unionId will be associated with the user.
20280 * @return {Promise<AV.User>}
20281 */
20282 associateWithQQApp: function associateWithQQApp() {
20283 var _this3 = this;
20284
20285 var _ref3 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
20286 _ref3$preferUnionId = _ref3.preferUnionId,
20287 preferUnionId = _ref3$preferUnionId === void 0 ? false : _ref3$preferUnionId,
20288 _ref3$unionIdPlatform = _ref3.unionIdPlatform,
20289 unionIdPlatform = _ref3$unionIdPlatform === void 0 ? 'qq' : _ref3$unionIdPlatform,
20290 _ref3$asMainAccount = _ref3.asMainAccount,
20291 asMainAccount = _ref3$asMainAccount === void 0 ? true : _ref3$asMainAccount;
20292
20293 var getAuthInfo = getAdapter('getAuthInfo');
20294 return getAuthInfo({
20295 preferUnionId: preferUnionId,
20296 asMainAccount: asMainAccount,
20297 platform: unionIdPlatform
20298 }).then(function (authInfo) {
20299 authInfo.provider = PLATFORM_QQAPP;
20300 return _this3.associateWithMiniApp(authInfo);
20301 });
20302 },
20303
20304 /**
20305 * 将用户与微信小程序用户进行关联。适用于为已经在用户系统中存在的用户关联当前使用微信小程序的微信帐号。
20306 * 仅在微信小程序中可用。
20307 *
20308 * @deprecated Please use {@link AV.User#associateWithMiniApp}
20309 * @since 3.13.0
20310 * @param {Object} [options]
20311 * @param {boolean} [options.preferUnionId = false] 当用户满足 {@link https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/union-id.html 获取 UnionId 的条件} 时,是否将 UnionId 保存在用户账号中。
20312 * @param {string} [options.unionIdPlatform = 'weixin'] (only take effect when preferUnionId) unionId platform
20313 * @param {boolean} [options.asMainAccount = true] (only take effect when preferUnionId) If true, the unionId will be associated with the user.
20314 * @return {Promise<AV.User>}
20315 */
20316 associateWithWeapp: function associateWithWeapp() {
20317 var _this4 = this;
20318
20319 var _ref4 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
20320 _ref4$preferUnionId = _ref4.preferUnionId,
20321 preferUnionId = _ref4$preferUnionId === void 0 ? false : _ref4$preferUnionId,
20322 _ref4$unionIdPlatform = _ref4.unionIdPlatform,
20323 unionIdPlatform = _ref4$unionIdPlatform === void 0 ? 'weixin' : _ref4$unionIdPlatform,
20324 _ref4$asMainAccount = _ref4.asMainAccount,
20325 asMainAccount = _ref4$asMainAccount === void 0 ? true : _ref4$asMainAccount;
20326
20327 var getAuthInfo = getAdapter('getAuthInfo');
20328 return getAuthInfo({
20329 preferUnionId: preferUnionId,
20330 asMainAccount: asMainAccount,
20331 platform: unionIdPlatform
20332 }).then(function (authInfo) {
20333 return _this4.associateWithMiniApp(authInfo);
20334 });
20335 },
20336
20337 /**
20338 * @deprecated renamed to {@link AV.User#associateWithWeapp}
20339 * @return {Promise<AV.User>}
20340 */
20341 linkWithWeapp: function linkWithWeapp(options) {
20342 console.warn('DEPRECATED: User#linkWithWeapp 已废弃,请使用 User#associateWithWeapp 代替');
20343 return this.associateWithWeapp(options);
20344 },
20345
20346 /**
20347 * 将用户与 QQ 小程序用户进行关联。适用于为已经在用户系统中存在的用户关联当前使用 QQ 小程序的 QQ 帐号。
20348 * 仅在 QQ 小程序中可用。
20349 *
20350 * @deprecated Please use {@link AV.User#associateWithMiniApp}
20351 * @since 4.2.0
20352 * @param {string} unionId
20353 * @param {Object} [unionOptions]
20354 * @param {string} [unionOptions.unionIdPlatform = 'qq'] unionId platform
20355 * @param {boolean} [unionOptions.asMainAccount = false] If true, the unionId will be associated with the user.
20356 * @return {Promise<AV.User>}
20357 */
20358 associateWithQQAppWithUnionId: function associateWithQQAppWithUnionId(unionId) {
20359 var _this5 = this;
20360
20361 var _ref5 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
20362 _ref5$unionIdPlatform = _ref5.unionIdPlatform,
20363 unionIdPlatform = _ref5$unionIdPlatform === void 0 ? 'qq' : _ref5$unionIdPlatform,
20364 _ref5$asMainAccount = _ref5.asMainAccount,
20365 asMainAccount = _ref5$asMainAccount === void 0 ? false : _ref5$asMainAccount;
20366
20367 var getAuthInfo = getAdapter('getAuthInfo');
20368 return getAuthInfo({
20369 platform: unionIdPlatform
20370 }).then(function (authInfo) {
20371 authInfo = AV.User.mergeUnionId(authInfo, unionId, {
20372 asMainAccount: asMainAccount
20373 });
20374 authInfo.provider = PLATFORM_QQAPP;
20375 return _this5.associateWithMiniApp(authInfo);
20376 });
20377 },
20378
20379 /**
20380 * 将用户与微信小程序用户进行关联。适用于为已经在用户系统中存在的用户关联当前使用微信小程序的微信帐号。
20381 * 仅在微信小程序中可用。
20382 *
20383 * @deprecated Please use {@link AV.User#associateWithMiniApp}
20384 * @since 3.13.0
20385 * @param {string} unionId
20386 * @param {Object} [unionOptions]
20387 * @param {string} [unionOptions.unionIdPlatform = 'weixin'] unionId platform
20388 * @param {boolean} [unionOptions.asMainAccount = false] If true, the unionId will be associated with the user.
20389 * @return {Promise<AV.User>}
20390 */
20391 associateWithWeappWithUnionId: function associateWithWeappWithUnionId(unionId) {
20392 var _this6 = this;
20393
20394 var _ref6 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
20395 _ref6$unionIdPlatform = _ref6.unionIdPlatform,
20396 unionIdPlatform = _ref6$unionIdPlatform === void 0 ? 'weixin' : _ref6$unionIdPlatform,
20397 _ref6$asMainAccount = _ref6.asMainAccount,
20398 asMainAccount = _ref6$asMainAccount === void 0 ? false : _ref6$asMainAccount;
20399
20400 var getAuthInfo = getAdapter('getAuthInfo');
20401 return getAuthInfo({
20402 platform: unionIdPlatform
20403 }).then(function (authInfo) {
20404 authInfo = AV.User.mergeUnionId(authInfo, unionId, {
20405 asMainAccount: asMainAccount
20406 });
20407 return _this6.associateWithMiniApp(authInfo);
20408 });
20409 },
20410
20411 /**
20412 * Unlinks a user from a service.
20413 * @param {string} platform
20414 * @return {Promise<AV.User>}
20415 * @since 3.3.0
20416 */
20417 dissociateAuthData: function dissociateAuthData(provider) {
20418 this.unset("authData.".concat(provider));
20419 return this.save().then(function (model) {
20420 return model._handleSaveResult(true).then(function () {
20421 return model;
20422 });
20423 });
20424 },
20425
20426 /**
20427 * @private
20428 * @deprecated
20429 */
20430 _unlinkFrom: function _unlinkFrom(provider) {
20431 console.warn('DEPRECATED: User#_unlinkFrom 已废弃,请使用 User#dissociateAuthData 代替');
20432 return this.dissociateAuthData(provider);
20433 },
20434
20435 /**
20436 * Checks whether a user is linked to a service.
20437 * @private
20438 */
20439 _isLinked: function _isLinked(provider) {
20440 var authType;
20441
20442 if (_.isString(provider)) {
20443 authType = provider;
20444 } else {
20445 authType = provider.getAuthType();
20446 }
20447
20448 var authData = this.get('authData') || {};
20449 return !!authData[authType];
20450 },
20451
20452 /**
20453 * Checks whether a user is anonymous.
20454 * @since 3.9.0
20455 * @return {boolean}
20456 */
20457 isAnonymous: function isAnonymous() {
20458 return this._isLinked(PLATFORM_ANONYMOUS);
20459 },
20460 logOut: function logOut() {
20461 this._logOutWithAll();
20462
20463 this._isCurrentUser = false;
20464 },
20465
20466 /**
20467 * Deauthenticates all providers.
20468 * @private
20469 */
20470 _logOutWithAll: function _logOutWithAll() {
20471 var authData = this.get('authData');
20472
20473 if (!authData) {
20474 return;
20475 }
20476
20477 var self = this;
20478
20479 AV._objectEach(this.get('authData'), function (value, key) {
20480 self._logOutWith(key);
20481 });
20482 },
20483
20484 /**
20485 * Deauthenticates a single provider (e.g. removing access tokens from the
20486 * Facebook SDK).
20487 * @private
20488 */
20489 _logOutWith: function _logOutWith(provider) {
20490 if (!this.isCurrent()) {
20491 return;
20492 }
20493
20494 if (_.isString(provider)) {
20495 provider = AV.User._authProviders[provider];
20496 }
20497
20498 if (provider && provider.deauthenticate) {
20499 provider.deauthenticate();
20500 }
20501 },
20502
20503 /**
20504 * Signs up a new user. You should call this instead of save for
20505 * new AV.Users. This will create a new AV.User on the server, and
20506 * also persist the session on disk so that you can access the user using
20507 * <code>current</code>.
20508 *
20509 * <p>A username and password must be set before calling signUp.</p>
20510 *
20511 * @param {Object} attrs Extra fields to set on the new user, or null.
20512 * @param {AuthOptions} options
20513 * @return {Promise} A promise that is fulfilled when the signup
20514 * finishes.
20515 * @see AV.User.signUp
20516 */
20517 signUp: function signUp(attrs, options) {
20518 var error;
20519 var username = attrs && attrs.username || this.get('username');
20520
20521 if (!username || username === '') {
20522 error = new AVError(AVError.OTHER_CAUSE, 'Cannot sign up user with an empty name.');
20523 throw error;
20524 }
20525
20526 var password = attrs && attrs.password || this.get('password');
20527
20528 if (!password || password === '') {
20529 error = new AVError(AVError.OTHER_CAUSE, 'Cannot sign up user with an empty password.');
20530 throw error;
20531 }
20532
20533 return this.save(attrs, options).then(function (model) {
20534 if (model.isAnonymous()) {
20535 model.unset("authData.".concat(PLATFORM_ANONYMOUS));
20536 model._opSetQueue = [{}];
20537 }
20538
20539 return model._handleSaveResult(true).then(function () {
20540 return model;
20541 });
20542 });
20543 },
20544
20545 /**
20546 * Signs up a new user with mobile phone and sms code.
20547 * You should call this instead of save for
20548 * new AV.Users. This will create a new AV.User on the server, and
20549 * also persist the session on disk so that you can access the user using
20550 * <code>current</code>.
20551 *
20552 * <p>A username and password must be set before calling signUp.</p>
20553 *
20554 * @param {Object} attrs Extra fields to set on the new user, or null.
20555 * @param {AuthOptions} options
20556 * @return {Promise} A promise that is fulfilled when the signup
20557 * finishes.
20558 * @see AV.User.signUpOrlogInWithMobilePhone
20559 * @see AV.Cloud.requestSmsCode
20560 */
20561 signUpOrlogInWithMobilePhone: function signUpOrlogInWithMobilePhone(attrs) {
20562 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
20563 var error;
20564 var mobilePhoneNumber = attrs && attrs.mobilePhoneNumber || this.get('mobilePhoneNumber');
20565
20566 if (!mobilePhoneNumber || mobilePhoneNumber === '') {
20567 error = new AVError(AVError.OTHER_CAUSE, 'Cannot sign up or login user by mobilePhoneNumber ' + 'with an empty mobilePhoneNumber.');
20568 throw error;
20569 }
20570
20571 var smsCode = attrs && attrs.smsCode || this.get('smsCode');
20572
20573 if (!smsCode || smsCode === '') {
20574 error = new AVError(AVError.OTHER_CAUSE, 'Cannot sign up or login user by mobilePhoneNumber ' + 'with an empty smsCode.');
20575 throw error;
20576 }
20577
20578 options._makeRequest = function (route, className, id, method, json) {
20579 return AVRequest('usersByMobilePhone', null, null, 'POST', json);
20580 };
20581
20582 return this.save(attrs, options).then(function (model) {
20583 delete model.attributes.smsCode;
20584 delete model._serverData.smsCode;
20585 return model._handleSaveResult(true).then(function () {
20586 return model;
20587 });
20588 });
20589 },
20590
20591 /**
20592 * The same with {@link AV.User.loginWithAuthData}, except that you can set attributes before login.
20593 * @since 3.7.0
20594 */
20595 loginWithAuthData: function loginWithAuthData(authData, platform, options) {
20596 return this._linkWith(platform, authData, options);
20597 },
20598
20599 /**
20600 * The same with {@link AV.User.loginWithAuthDataAndUnionId}, except that you can set attributes before login.
20601 * @since 3.7.0
20602 */
20603 loginWithAuthDataAndUnionId: function loginWithAuthDataAndUnionId(authData, platform, unionId, unionLoginOptions) {
20604 return this.loginWithAuthData(mergeUnionDataIntoAuthData()(authData, unionId, unionLoginOptions), platform, unionLoginOptions);
20605 },
20606
20607 /**
20608 * The same with {@link AV.User.loginWithWeapp}, except that you can set attributes before login.
20609 * @deprecated please use {@link AV.User#loginWithMiniApp}
20610 * @since 3.7.0
20611 * @param {Object} [options]
20612 * @param {boolean} [options.failOnNotExist] If true, the login request will fail when no user matches this authData exists.
20613 * @param {boolean} [options.preferUnionId] 当用户满足 {@link https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/union-id.html 获取 UnionId 的条件} 时,是否使用 UnionId 登录。(since 3.13.0)
20614 * @param {string} [options.unionIdPlatform = 'weixin'] (only take effect when preferUnionId) unionId platform
20615 * @param {boolean} [options.asMainAccount = true] (only take effect when preferUnionId) If true, the unionId will be associated with the user.
20616 * @return {Promise<AV.User>}
20617 */
20618 loginWithWeapp: function loginWithWeapp() {
20619 var _this7 = this;
20620
20621 var _ref7 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
20622 _ref7$preferUnionId = _ref7.preferUnionId,
20623 preferUnionId = _ref7$preferUnionId === void 0 ? false : _ref7$preferUnionId,
20624 _ref7$unionIdPlatform = _ref7.unionIdPlatform,
20625 unionIdPlatform = _ref7$unionIdPlatform === void 0 ? 'weixin' : _ref7$unionIdPlatform,
20626 _ref7$asMainAccount = _ref7.asMainAccount,
20627 asMainAccount = _ref7$asMainAccount === void 0 ? true : _ref7$asMainAccount,
20628 _ref7$failOnNotExist = _ref7.failOnNotExist,
20629 failOnNotExist = _ref7$failOnNotExist === void 0 ? false : _ref7$failOnNotExist;
20630
20631 var getAuthInfo = getAdapter('getAuthInfo');
20632 return getAuthInfo({
20633 preferUnionId: preferUnionId,
20634 asMainAccount: asMainAccount,
20635 platform: unionIdPlatform
20636 }).then(function (authInfo) {
20637 return _this7.loginWithMiniApp(authInfo, {
20638 failOnNotExist: failOnNotExist
20639 });
20640 });
20641 },
20642
20643 /**
20644 * The same with {@link AV.User.loginWithWeappWithUnionId}, except that you can set attributes before login.
20645 * @deprecated please use {@link AV.User#loginWithMiniApp}
20646 * @since 3.13.0
20647 */
20648 loginWithWeappWithUnionId: function loginWithWeappWithUnionId(unionId) {
20649 var _this8 = this;
20650
20651 var _ref8 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
20652 _ref8$unionIdPlatform = _ref8.unionIdPlatform,
20653 unionIdPlatform = _ref8$unionIdPlatform === void 0 ? 'weixin' : _ref8$unionIdPlatform,
20654 _ref8$asMainAccount = _ref8.asMainAccount,
20655 asMainAccount = _ref8$asMainAccount === void 0 ? false : _ref8$asMainAccount,
20656 _ref8$failOnNotExist = _ref8.failOnNotExist,
20657 failOnNotExist = _ref8$failOnNotExist === void 0 ? false : _ref8$failOnNotExist;
20658
20659 var getAuthInfo = getAdapter('getAuthInfo');
20660 return getAuthInfo({
20661 platform: unionIdPlatform
20662 }).then(function (authInfo) {
20663 authInfo = AV.User.mergeUnionId(authInfo, unionId, {
20664 asMainAccount: asMainAccount
20665 });
20666 return _this8.loginWithMiniApp(authInfo, {
20667 failOnNotExist: failOnNotExist
20668 });
20669 });
20670 },
20671
20672 /**
20673 * The same with {@link AV.User.loginWithQQApp}, except that you can set attributes before login.
20674 * @deprecated please use {@link AV.User#loginWithMiniApp}
20675 * @since 4.2.0
20676 * @param {Object} [options]
20677 * @param {boolean} [options.failOnNotExist] If true, the login request will fail when no user matches this authData exists.
20678 * @param {boolean} [options.preferUnionId] 如果服务端在登录时获取到了用户的 UnionId,是否将 UnionId 保存在用户账号中。
20679 * @param {string} [options.unionIdPlatform = 'qq'] (only take effect when preferUnionId) unionId platform
20680 * @param {boolean} [options.asMainAccount = true] (only take effect when preferUnionId) If true, the unionId will be associated with the user.
20681 */
20682 loginWithQQApp: function loginWithQQApp() {
20683 var _this9 = this;
20684
20685 var _ref9 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
20686 _ref9$preferUnionId = _ref9.preferUnionId,
20687 preferUnionId = _ref9$preferUnionId === void 0 ? false : _ref9$preferUnionId,
20688 _ref9$unionIdPlatform = _ref9.unionIdPlatform,
20689 unionIdPlatform = _ref9$unionIdPlatform === void 0 ? 'qq' : _ref9$unionIdPlatform,
20690 _ref9$asMainAccount = _ref9.asMainAccount,
20691 asMainAccount = _ref9$asMainAccount === void 0 ? true : _ref9$asMainAccount,
20692 _ref9$failOnNotExist = _ref9.failOnNotExist,
20693 failOnNotExist = _ref9$failOnNotExist === void 0 ? false : _ref9$failOnNotExist;
20694
20695 var getAuthInfo = getAdapter('getAuthInfo');
20696 return getAuthInfo({
20697 preferUnionId: preferUnionId,
20698 asMainAccount: asMainAccount,
20699 platform: unionIdPlatform
20700 }).then(function (authInfo) {
20701 authInfo.provider = PLATFORM_QQAPP;
20702 return _this9.loginWithMiniApp(authInfo, {
20703 failOnNotExist: failOnNotExist
20704 });
20705 });
20706 },
20707
20708 /**
20709 * The same with {@link AV.User.loginWithQQAppWithUnionId}, except that you can set attributes before login.
20710 * @deprecated please use {@link AV.User#loginWithMiniApp}
20711 * @since 4.2.0
20712 */
20713 loginWithQQAppWithUnionId: function loginWithQQAppWithUnionId(unionId) {
20714 var _this10 = this;
20715
20716 var _ref10 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
20717 _ref10$unionIdPlatfor = _ref10.unionIdPlatform,
20718 unionIdPlatform = _ref10$unionIdPlatfor === void 0 ? 'qq' : _ref10$unionIdPlatfor,
20719 _ref10$asMainAccount = _ref10.asMainAccount,
20720 asMainAccount = _ref10$asMainAccount === void 0 ? false : _ref10$asMainAccount,
20721 _ref10$failOnNotExist = _ref10.failOnNotExist,
20722 failOnNotExist = _ref10$failOnNotExist === void 0 ? false : _ref10$failOnNotExist;
20723
20724 var getAuthInfo = getAdapter('getAuthInfo');
20725 return getAuthInfo({
20726 platform: unionIdPlatform
20727 }).then(function (authInfo) {
20728 authInfo = AV.User.mergeUnionId(authInfo, unionId, {
20729 asMainAccount: asMainAccount
20730 });
20731 authInfo.provider = PLATFORM_QQAPP;
20732 return _this10.loginWithMiniApp(authInfo, {
20733 failOnNotExist: failOnNotExist
20734 });
20735 });
20736 },
20737
20738 /**
20739 * The same with {@link AV.User.loginWithMiniApp}, except that you can set attributes before login.
20740 * @since 4.6.0
20741 */
20742 loginWithMiniApp: function loginWithMiniApp(authInfo, option) {
20743 var _this11 = this;
20744
20745 if (authInfo === undefined) {
20746 var getAuthInfo = getAdapter('getAuthInfo');
20747 return getAuthInfo().then(function (authInfo) {
20748 return _this11.loginWithAuthData(authInfo.authData, authInfo.provider, option);
20749 });
20750 }
20751
20752 return this.loginWithAuthData(authInfo.authData, authInfo.provider, option);
20753 },
20754
20755 /**
20756 * Logs in a AV.User. On success, this saves the session to localStorage,
20757 * so you can retrieve the currently logged in user using
20758 * <code>current</code>.
20759 *
20760 * <p>A username and password must be set before calling logIn.</p>
20761 *
20762 * @see AV.User.logIn
20763 * @return {Promise} A promise that is fulfilled with the user when
20764 * the login is complete.
20765 */
20766 logIn: function logIn() {
20767 var model = this;
20768 var request = AVRequest('login', null, null, 'POST', this.toJSON());
20769 return request.then(function (resp) {
20770 var serverAttrs = model.parse(resp);
20771
20772 model._finishFetch(serverAttrs);
20773
20774 return model._handleSaveResult(true).then(function () {
20775 if (!serverAttrs.smsCode) delete model.attributes['smsCode'];
20776 return model;
20777 });
20778 });
20779 },
20780
20781 /**
20782 * @see AV.Object#save
20783 */
20784 save: function save(arg1, arg2, arg3) {
20785 var attrs, options;
20786
20787 if (_.isObject(arg1) || _.isNull(arg1) || _.isUndefined(arg1)) {
20788 attrs = arg1;
20789 options = arg2;
20790 } else {
20791 attrs = {};
20792 attrs[arg1] = arg2;
20793 options = arg3;
20794 }
20795
20796 options = options || {};
20797 return AV.Object.prototype.save.call(this, attrs, options).then(function (model) {
20798 return model._handleSaveResult(false).then(function () {
20799 return model;
20800 });
20801 });
20802 },
20803
20804 /**
20805 * Follow a user
20806 * @since 0.3.0
20807 * @param {Object | AV.User | String} options if an AV.User or string is given, it will be used as the target user.
20808 * @param {AV.User | String} options.user The target user or user's objectId to follow.
20809 * @param {Object} [options.attributes] key-value attributes dictionary to be used as
20810 * conditions of followerQuery/followeeQuery.
20811 * @param {AuthOptions} [authOptions]
20812 */
20813 follow: function follow(options, authOptions) {
20814 if (!this.id) {
20815 throw new Error('Please signin.');
20816 }
20817
20818 var user;
20819 var attributes;
20820
20821 if (options.user) {
20822 user = options.user;
20823 attributes = options.attributes;
20824 } else {
20825 user = options;
20826 }
20827
20828 var userObjectId = _.isString(user) ? user : user.id;
20829
20830 if (!userObjectId) {
20831 throw new Error('Invalid target user.');
20832 }
20833
20834 var route = 'users/' + this.id + '/friendship/' + userObjectId;
20835 var request = AVRequest(route, null, null, 'POST', AV._encode(attributes), authOptions);
20836 return request;
20837 },
20838
20839 /**
20840 * Unfollow a user.
20841 * @since 0.3.0
20842 * @param {Object | AV.User | String} options if an AV.User or string is given, it will be used as the target user.
20843 * @param {AV.User | String} options.user The target user or user's objectId to unfollow.
20844 * @param {AuthOptions} [authOptions]
20845 */
20846 unfollow: function unfollow(options, authOptions) {
20847 if (!this.id) {
20848 throw new Error('Please signin.');
20849 }
20850
20851 var user;
20852
20853 if (options.user) {
20854 user = options.user;
20855 } else {
20856 user = options;
20857 }
20858
20859 var userObjectId = _.isString(user) ? user : user.id;
20860
20861 if (!userObjectId) {
20862 throw new Error('Invalid target user.');
20863 }
20864
20865 var route = 'users/' + this.id + '/friendship/' + userObjectId;
20866 var request = AVRequest(route, null, null, 'DELETE', null, authOptions);
20867 return request;
20868 },
20869
20870 /**
20871 * Get the user's followers and followees.
20872 * @since 4.8.0
20873 * @param {Object} [options]
20874 * @param {Number} [options.skip]
20875 * @param {Number} [options.limit]
20876 * @param {AuthOptions} [authOptions]
20877 */
20878 getFollowersAndFollowees: function getFollowersAndFollowees(options, authOptions) {
20879 if (!this.id) {
20880 throw new Error('Please signin.');
20881 }
20882
20883 return request({
20884 method: 'GET',
20885 path: "/users/".concat(this.id, "/followersAndFollowees"),
20886 query: {
20887 skip: options && options.skip,
20888 limit: options && options.limit,
20889 include: 'follower,followee',
20890 keys: 'follower,followee'
20891 },
20892 authOptions: authOptions
20893 }).then(function (_ref11) {
20894 var followers = _ref11.followers,
20895 followees = _ref11.followees;
20896 return {
20897 followers: (0, _map.default)(followers).call(followers, function (_ref12) {
20898 var follower = _ref12.follower;
20899 return AV._decode(follower);
20900 }),
20901 followees: (0, _map.default)(followees).call(followees, function (_ref13) {
20902 var followee = _ref13.followee;
20903 return AV._decode(followee);
20904 })
20905 };
20906 });
20907 },
20908
20909 /**
20910 *Create a follower query to query the user's followers.
20911 * @since 0.3.0
20912 * @see AV.User#followerQuery
20913 */
20914 followerQuery: function followerQuery() {
20915 return AV.User.followerQuery(this.id);
20916 },
20917
20918 /**
20919 *Create a followee query to query the user's followees.
20920 * @since 0.3.0
20921 * @see AV.User#followeeQuery
20922 */
20923 followeeQuery: function followeeQuery() {
20924 return AV.User.followeeQuery(this.id);
20925 },
20926
20927 /**
20928 * @see AV.Object#fetch
20929 */
20930 fetch: function fetch(fetchOptions, options) {
20931 return AV.Object.prototype.fetch.call(this, fetchOptions, options).then(function (model) {
20932 return model._handleSaveResult(false).then(function () {
20933 return model;
20934 });
20935 });
20936 },
20937
20938 /**
20939 * Update user's new password safely based on old password.
20940 * @param {String} oldPassword the old password.
20941 * @param {String} newPassword the new password.
20942 * @param {AuthOptions} options
20943 */
20944 updatePassword: function updatePassword(oldPassword, newPassword, options) {
20945 var _this12 = this;
20946
20947 var route = 'users/' + this.id + '/updatePassword';
20948 var params = {
20949 old_password: oldPassword,
20950 new_password: newPassword
20951 };
20952 var request = AVRequest(route, null, null, 'PUT', params, options);
20953 return request.then(function (resp) {
20954 _this12._finishFetch(_this12.parse(resp));
20955
20956 return _this12._handleSaveResult(true).then(function () {
20957 return resp;
20958 });
20959 });
20960 },
20961
20962 /**
20963 * Returns true if <code>current</code> would return this user.
20964 * @see AV.User#current
20965 */
20966 isCurrent: function isCurrent() {
20967 return this._isCurrentUser;
20968 },
20969
20970 /**
20971 * Returns get("username").
20972 * @return {String}
20973 * @see AV.Object#get
20974 */
20975 getUsername: function getUsername() {
20976 return this.get('username');
20977 },
20978
20979 /**
20980 * Returns get("mobilePhoneNumber").
20981 * @return {String}
20982 * @see AV.Object#get
20983 */
20984 getMobilePhoneNumber: function getMobilePhoneNumber() {
20985 return this.get('mobilePhoneNumber');
20986 },
20987
20988 /**
20989 * Calls set("mobilePhoneNumber", phoneNumber, options) and returns the result.
20990 * @param {String} mobilePhoneNumber
20991 * @return {Boolean}
20992 * @see AV.Object#set
20993 */
20994 setMobilePhoneNumber: function setMobilePhoneNumber(phone, options) {
20995 return this.set('mobilePhoneNumber', phone, options);
20996 },
20997
20998 /**
20999 * Calls set("username", username, options) and returns the result.
21000 * @param {String} username
21001 * @return {Boolean}
21002 * @see AV.Object#set
21003 */
21004 setUsername: function setUsername(username, options) {
21005 return this.set('username', username, options);
21006 },
21007
21008 /**
21009 * Calls set("password", password, options) and returns the result.
21010 * @param {String} password
21011 * @return {Boolean}
21012 * @see AV.Object#set
21013 */
21014 setPassword: function setPassword(password, options) {
21015 return this.set('password', password, options);
21016 },
21017
21018 /**
21019 * Returns get("email").
21020 * @return {String}
21021 * @see AV.Object#get
21022 */
21023 getEmail: function getEmail() {
21024 return this.get('email');
21025 },
21026
21027 /**
21028 * Calls set("email", email, options) and returns the result.
21029 * @param {String} email
21030 * @param {AuthOptions} options
21031 * @return {Boolean}
21032 * @see AV.Object#set
21033 */
21034 setEmail: function setEmail(email, options) {
21035 return this.set('email', email, options);
21036 },
21037
21038 /**
21039 * Checks whether this user is the current user and has been authenticated.
21040 * @deprecated 如果要判断当前用户的登录状态是否有效,请使用 currentUser.isAuthenticated().then(),
21041 * 如果要判断该用户是否是当前登录用户,请使用 user.id === currentUser.id
21042 * @return (Boolean) whether this user is the current user and is logged in.
21043 */
21044 authenticated: function authenticated() {
21045 console.warn('DEPRECATED: 如果要判断当前用户的登录状态是否有效,请使用 currentUser.isAuthenticated().then(),如果要判断该用户是否是当前登录用户,请使用 user.id === currentUser.id。');
21046 return !!this._sessionToken && !AV._config.disableCurrentUser && AV.User.current() && AV.User.current().id === this.id;
21047 },
21048
21049 /**
21050 * Detects if current sessionToken is valid.
21051 *
21052 * @since 2.0.0
21053 * @return Promise.<Boolean>
21054 */
21055 isAuthenticated: function isAuthenticated() {
21056 var _this13 = this;
21057
21058 return _promise.default.resolve().then(function () {
21059 return !!_this13._sessionToken && AV.User._fetchUserBySessionToken(_this13._sessionToken).then(function () {
21060 return true;
21061 }, function (error) {
21062 if (error.code === 211) {
21063 return false;
21064 }
21065
21066 throw error;
21067 });
21068 });
21069 },
21070
21071 /**
21072 * Get sessionToken of current user.
21073 * @return {String} sessionToken
21074 */
21075 getSessionToken: function getSessionToken() {
21076 return this._sessionToken;
21077 },
21078
21079 /**
21080 * Refresh sessionToken of current user.
21081 * @since 2.1.0
21082 * @param {AuthOptions} [options]
21083 * @return {Promise.<AV.User>} user with refreshed sessionToken
21084 */
21085 refreshSessionToken: function refreshSessionToken(options) {
21086 var _this14 = this;
21087
21088 return AVRequest("users/".concat(this.id, "/refreshSessionToken"), null, null, 'PUT', null, options).then(function (response) {
21089 _this14._finishFetch(response);
21090
21091 return _this14._handleSaveResult(true).then(function () {
21092 return _this14;
21093 });
21094 });
21095 },
21096
21097 /**
21098 * Get this user's Roles.
21099 * @param {AuthOptions} [options]
21100 * @return {Promise.<AV.Role[]>} A promise that is fulfilled with the roles when
21101 * the query is complete.
21102 */
21103 getRoles: function getRoles(options) {
21104 var _context;
21105
21106 return (0, _find.default)(_context = AV.Relation.reverseQuery('_Role', 'users', this)).call(_context, options);
21107 }
21108 },
21109 /** @lends AV.User */
21110 {
21111 // Class Variables
21112 // The currently logged-in user.
21113 _currentUser: null,
21114 // Whether currentUser is known to match the serialized version on disk.
21115 // This is useful for saving a localstorage check if you try to load
21116 // _currentUser frequently while there is none stored.
21117 _currentUserMatchesDisk: false,
21118 // The localStorage key suffix that the current user is stored under.
21119 _CURRENT_USER_KEY: 'currentUser',
21120 // The mapping of auth provider names to actual providers
21121 _authProviders: {},
21122 // Class Methods
21123
21124 /**
21125 * Signs up a new user with a username (or email) and password.
21126 * This will create a new AV.User on the server, and also persist the
21127 * session in localStorage so that you can access the user using
21128 * {@link #current}.
21129 *
21130 * @param {String} username The username (or email) to sign up with.
21131 * @param {String} password The password to sign up with.
21132 * @param {Object} [attrs] Extra fields to set on the new user.
21133 * @param {AuthOptions} [options]
21134 * @return {Promise} A promise that is fulfilled with the user when
21135 * the signup completes.
21136 * @see AV.User#signUp
21137 */
21138 signUp: function signUp(username, password, attrs, options) {
21139 attrs = attrs || {};
21140 attrs.username = username;
21141 attrs.password = password;
21142
21143 var user = AV.Object._create('_User');
21144
21145 return user.signUp(attrs, options);
21146 },
21147
21148 /**
21149 * Logs in a user with a username (or email) and password. On success, this
21150 * saves the session to disk, so you can retrieve the currently logged in
21151 * user using <code>current</code>.
21152 *
21153 * @param {String} username The username (or email) to log in with.
21154 * @param {String} password The password to log in with.
21155 * @return {Promise} A promise that is fulfilled with the user when
21156 * the login completes.
21157 * @see AV.User#logIn
21158 */
21159 logIn: function logIn(username, password) {
21160 var user = AV.Object._create('_User');
21161
21162 user._finishFetch({
21163 username: username,
21164 password: password
21165 });
21166
21167 return user.logIn();
21168 },
21169
21170 /**
21171 * Logs in a user with a session token. On success, this saves the session
21172 * to disk, so you can retrieve the currently logged in user using
21173 * <code>current</code>.
21174 *
21175 * @param {String} sessionToken The sessionToken to log in with.
21176 * @return {Promise} A promise that is fulfilled with the user when
21177 * the login completes.
21178 */
21179 become: function become(sessionToken) {
21180 return this._fetchUserBySessionToken(sessionToken).then(function (user) {
21181 return user._handleSaveResult(true).then(function () {
21182 return user;
21183 });
21184 });
21185 },
21186 _fetchUserBySessionToken: function _fetchUserBySessionToken(sessionToken) {
21187 if (sessionToken === undefined) {
21188 return _promise.default.reject(new Error('The sessionToken cannot be undefined'));
21189 }
21190
21191 var user = AV.Object._create('_User');
21192
21193 return request({
21194 method: 'GET',
21195 path: '/users/me',
21196 authOptions: {
21197 sessionToken: sessionToken
21198 }
21199 }).then(function (resp) {
21200 var serverAttrs = user.parse(resp);
21201
21202 user._finishFetch(serverAttrs);
21203
21204 return user;
21205 });
21206 },
21207
21208 /**
21209 * Logs in a user with a mobile phone number and sms code sent by
21210 * AV.User.requestLoginSmsCode.On success, this
21211 * saves the session to disk, so you can retrieve the currently logged in
21212 * user using <code>current</code>.
21213 *
21214 * @param {String} mobilePhone The user's mobilePhoneNumber
21215 * @param {String} smsCode The sms code sent by AV.User.requestLoginSmsCode
21216 * @return {Promise} A promise that is fulfilled with the user when
21217 * the login completes.
21218 * @see AV.User#logIn
21219 */
21220 logInWithMobilePhoneSmsCode: function logInWithMobilePhoneSmsCode(mobilePhone, smsCode) {
21221 var user = AV.Object._create('_User');
21222
21223 user._finishFetch({
21224 mobilePhoneNumber: mobilePhone,
21225 smsCode: smsCode
21226 });
21227
21228 return user.logIn();
21229 },
21230
21231 /**
21232 * Signs up or logs in a user with a mobilePhoneNumber and smsCode.
21233 * On success, this saves the session to disk, so you can retrieve the currently
21234 * logged in user using <code>current</code>.
21235 *
21236 * @param {String} mobilePhoneNumber The user's mobilePhoneNumber.
21237 * @param {String} smsCode The sms code sent by AV.Cloud.requestSmsCode
21238 * @param {Object} attributes The user's other attributes such as username etc.
21239 * @param {AuthOptions} options
21240 * @return {Promise} A promise that is fulfilled with the user when
21241 * the login completes.
21242 * @see AV.User#signUpOrlogInWithMobilePhone
21243 * @see AV.Cloud.requestSmsCode
21244 */
21245 signUpOrlogInWithMobilePhone: function signUpOrlogInWithMobilePhone(mobilePhoneNumber, smsCode, attrs, options) {
21246 attrs = attrs || {};
21247 attrs.mobilePhoneNumber = mobilePhoneNumber;
21248 attrs.smsCode = smsCode;
21249
21250 var user = AV.Object._create('_User');
21251
21252 return user.signUpOrlogInWithMobilePhone(attrs, options);
21253 },
21254
21255 /**
21256 * Logs in a user with a mobile phone number and password. On success, this
21257 * saves the session to disk, so you can retrieve the currently logged in
21258 * user using <code>current</code>.
21259 *
21260 * @param {String} mobilePhone The user's mobilePhoneNumber
21261 * @param {String} password The password to log in with.
21262 * @return {Promise} A promise that is fulfilled with the user when
21263 * the login completes.
21264 * @see AV.User#logIn
21265 */
21266 logInWithMobilePhone: function logInWithMobilePhone(mobilePhone, password) {
21267 var user = AV.Object._create('_User');
21268
21269 user._finishFetch({
21270 mobilePhoneNumber: mobilePhone,
21271 password: password
21272 });
21273
21274 return user.logIn();
21275 },
21276
21277 /**
21278 * Logs in a user with email and password.
21279 *
21280 * @since 3.13.0
21281 * @param {String} email The user's email.
21282 * @param {String} password The password to log in with.
21283 * @return {Promise} A promise that is fulfilled with the user when
21284 * the login completes.
21285 */
21286 loginWithEmail: function loginWithEmail(email, password) {
21287 var user = AV.Object._create('_User');
21288
21289 user._finishFetch({
21290 email: email,
21291 password: password
21292 });
21293
21294 return user.logIn();
21295 },
21296
21297 /**
21298 * Signs up or logs in a user with a third party auth data(AccessToken).
21299 * On success, this saves the session to disk, so you can retrieve the currently
21300 * logged in user using <code>current</code>.
21301 *
21302 * @since 3.7.0
21303 * @param {Object} authData The response json data returned from third party token, maybe like { openid: 'abc123', access_token: '123abc', expires_in: 1382686496 }
21304 * @param {string} platform Available platform for sign up.
21305 * @param {Object} [options]
21306 * @param {boolean} [options.failOnNotExist] If true, the login request will fail when no user matches this authData exists.
21307 * @return {Promise} A promise that is fulfilled with the user when
21308 * the login completes.
21309 * @example AV.User.loginWithAuthData({
21310 * openid: 'abc123',
21311 * access_token: '123abc',
21312 * expires_in: 1382686496
21313 * }, 'weixin').then(function(user) {
21314 * //Access user here
21315 * }).catch(function(error) {
21316 * //console.error("error: ", error);
21317 * });
21318 * @see {@link https://leancloud.cn/docs/js_guide.html#绑定第三方平台账户}
21319 */
21320 loginWithAuthData: function loginWithAuthData(authData, platform, options) {
21321 return AV.User._logInWith(platform, authData, options);
21322 },
21323
21324 /**
21325 * @deprecated renamed to {@link AV.User.loginWithAuthData}
21326 */
21327 signUpOrlogInWithAuthData: function signUpOrlogInWithAuthData() {
21328 console.warn('DEPRECATED: User.signUpOrlogInWithAuthData 已废弃,请使用 User#loginWithAuthData 代替');
21329 return this.loginWithAuthData.apply(this, arguments);
21330 },
21331
21332 /**
21333 * Signs up or logs in a user with a third party authData and unionId.
21334 * @since 3.7.0
21335 * @param {Object} authData The response json data returned from third party token, maybe like { openid: 'abc123', access_token: '123abc', expires_in: 1382686496 }
21336 * @param {string} platform Available platform for sign up.
21337 * @param {string} unionId
21338 * @param {Object} [unionLoginOptions]
21339 * @param {string} [unionLoginOptions.unionIdPlatform = 'weixin'] unionId platform
21340 * @param {boolean} [unionLoginOptions.asMainAccount = false] If true, the unionId will be associated with the user.
21341 * @param {boolean} [unionLoginOptions.failOnNotExist] If true, the login request will fail when no user matches this authData exists.
21342 * @return {Promise<AV.User>} A promise that is fulfilled with the user when completed.
21343 * @example AV.User.loginWithAuthDataAndUnionId({
21344 * openid: 'abc123',
21345 * access_token: '123abc',
21346 * expires_in: 1382686496
21347 * }, 'weixin', 'union123', {
21348 * unionIdPlatform: 'weixin',
21349 * asMainAccount: true,
21350 * }).then(function(user) {
21351 * //Access user here
21352 * }).catch(function(error) {
21353 * //console.error("error: ", error);
21354 * });
21355 */
21356 loginWithAuthDataAndUnionId: function loginWithAuthDataAndUnionId(authData, platform, unionId, unionLoginOptions) {
21357 return this.loginWithAuthData(mergeUnionDataIntoAuthData()(authData, unionId, unionLoginOptions), platform, unionLoginOptions);
21358 },
21359
21360 /**
21361 * @deprecated renamed to {@link AV.User.loginWithAuthDataAndUnionId}
21362 * @since 3.5.0
21363 */
21364 signUpOrlogInWithAuthDataAndUnionId: function signUpOrlogInWithAuthDataAndUnionId() {
21365 console.warn('DEPRECATED: User.signUpOrlogInWithAuthDataAndUnionId 已废弃,请使用 User#loginWithAuthDataAndUnionId 代替');
21366 return this.loginWithAuthDataAndUnionId.apply(this, arguments);
21367 },
21368
21369 /**
21370 * Merge unionId into authInfo.
21371 * @since 4.6.0
21372 * @param {Object} authInfo
21373 * @param {String} unionId
21374 * @param {Object} [unionIdOption]
21375 * @param {Boolean} [unionIdOption.asMainAccount] If true, the unionId will be associated with the user.
21376 */
21377 mergeUnionId: function mergeUnionId(authInfo, unionId) {
21378 var _ref14 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
21379 _ref14$asMainAccount = _ref14.asMainAccount,
21380 asMainAccount = _ref14$asMainAccount === void 0 ? false : _ref14$asMainAccount;
21381
21382 authInfo = JSON.parse((0, _stringify.default)(authInfo));
21383 var _authInfo = authInfo,
21384 authData = _authInfo.authData,
21385 platform = _authInfo.platform;
21386 authData.platform = platform;
21387 authData.main_account = asMainAccount;
21388 authData.unionid = unionId;
21389 return authInfo;
21390 },
21391
21392 /**
21393 * 使用当前使用微信小程序的微信用户身份注册或登录,成功后用户的 session 会在设备上持久化保存,之后可以使用 AV.User.current() 获取当前登录用户。
21394 * 仅在微信小程序中可用。
21395 *
21396 * @deprecated please use {@link AV.User.loginWithMiniApp}
21397 * @since 2.0.0
21398 * @param {Object} [options]
21399 * @param {boolean} [options.preferUnionId] 当用户满足 {@link https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/union-id.html 获取 UnionId 的条件} 时,是否使用 UnionId 登录。(since 3.13.0)
21400 * @param {string} [options.unionIdPlatform = 'weixin'] (only take effect when preferUnionId) unionId platform
21401 * @param {boolean} [options.asMainAccount = true] (only take effect when preferUnionId) If true, the unionId will be associated with the user.
21402 * @param {boolean} [options.failOnNotExist] If true, the login request will fail when no user matches this authData exists. (since v3.7.0)
21403 * @return {Promise.<AV.User>}
21404 */
21405 loginWithWeapp: function loginWithWeapp() {
21406 var _this15 = this;
21407
21408 var _ref15 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
21409 _ref15$preferUnionId = _ref15.preferUnionId,
21410 preferUnionId = _ref15$preferUnionId === void 0 ? false : _ref15$preferUnionId,
21411 _ref15$unionIdPlatfor = _ref15.unionIdPlatform,
21412 unionIdPlatform = _ref15$unionIdPlatfor === void 0 ? 'weixin' : _ref15$unionIdPlatfor,
21413 _ref15$asMainAccount = _ref15.asMainAccount,
21414 asMainAccount = _ref15$asMainAccount === void 0 ? true : _ref15$asMainAccount,
21415 _ref15$failOnNotExist = _ref15.failOnNotExist,
21416 failOnNotExist = _ref15$failOnNotExist === void 0 ? false : _ref15$failOnNotExist;
21417
21418 var getAuthInfo = getAdapter('getAuthInfo');
21419 return getAuthInfo({
21420 preferUnionId: preferUnionId,
21421 asMainAccount: asMainAccount,
21422 platform: unionIdPlatform
21423 }).then(function (authInfo) {
21424 return _this15.loginWithMiniApp(authInfo, {
21425 failOnNotExist: failOnNotExist
21426 });
21427 });
21428 },
21429
21430 /**
21431 * 使用当前使用微信小程序的微信用户身份注册或登录,
21432 * 仅在微信小程序中可用。
21433 *
21434 * @deprecated please use {@link AV.User.loginWithMiniApp}
21435 * @since 3.13.0
21436 * @param {Object} [unionLoginOptions]
21437 * @param {string} [unionLoginOptions.unionIdPlatform = 'weixin'] unionId platform
21438 * @param {boolean} [unionLoginOptions.asMainAccount = false] If true, the unionId will be associated with the user.
21439 * @param {boolean} [unionLoginOptions.failOnNotExist] If true, the login request will fail when no user matches this authData exists. * @return {Promise.<AV.User>}
21440 */
21441 loginWithWeappWithUnionId: function loginWithWeappWithUnionId(unionId) {
21442 var _this16 = this;
21443
21444 var _ref16 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
21445 _ref16$unionIdPlatfor = _ref16.unionIdPlatform,
21446 unionIdPlatform = _ref16$unionIdPlatfor === void 0 ? 'weixin' : _ref16$unionIdPlatfor,
21447 _ref16$asMainAccount = _ref16.asMainAccount,
21448 asMainAccount = _ref16$asMainAccount === void 0 ? false : _ref16$asMainAccount,
21449 _ref16$failOnNotExist = _ref16.failOnNotExist,
21450 failOnNotExist = _ref16$failOnNotExist === void 0 ? false : _ref16$failOnNotExist;
21451
21452 var getAuthInfo = getAdapter('getAuthInfo');
21453 return getAuthInfo({
21454 platform: unionIdPlatform
21455 }).then(function (authInfo) {
21456 authInfo = AV.User.mergeUnionId(authInfo, unionId, {
21457 asMainAccount: asMainAccount
21458 });
21459 return _this16.loginWithMiniApp(authInfo, {
21460 failOnNotExist: failOnNotExist
21461 });
21462 });
21463 },
21464
21465 /**
21466 * 使用当前使用 QQ 小程序的 QQ 用户身份注册或登录,成功后用户的 session 会在设备上持久化保存,之后可以使用 AV.User.current() 获取当前登录用户。
21467 * 仅在 QQ 小程序中可用。
21468 *
21469 * @deprecated please use {@link AV.User.loginWithMiniApp}
21470 * @since 4.2.0
21471 * @param {Object} [options]
21472 * @param {boolean} [options.preferUnionId] 如果服务端在登录时获取到了用户的 UnionId,是否将 UnionId 保存在用户账号中。
21473 * @param {string} [options.unionIdPlatform = 'qq'] (only take effect when preferUnionId) unionId platform
21474 * @param {boolean} [options.asMainAccount = true] (only take effect when preferUnionId) If true, the unionId will be associated with the user.
21475 * @param {boolean} [options.failOnNotExist] If true, the login request will fail when no user matches this authData exists. (since v3.7.0)
21476 * @return {Promise.<AV.User>}
21477 */
21478 loginWithQQApp: function loginWithQQApp() {
21479 var _this17 = this;
21480
21481 var _ref17 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
21482 _ref17$preferUnionId = _ref17.preferUnionId,
21483 preferUnionId = _ref17$preferUnionId === void 0 ? false : _ref17$preferUnionId,
21484 _ref17$unionIdPlatfor = _ref17.unionIdPlatform,
21485 unionIdPlatform = _ref17$unionIdPlatfor === void 0 ? 'qq' : _ref17$unionIdPlatfor,
21486 _ref17$asMainAccount = _ref17.asMainAccount,
21487 asMainAccount = _ref17$asMainAccount === void 0 ? true : _ref17$asMainAccount,
21488 _ref17$failOnNotExist = _ref17.failOnNotExist,
21489 failOnNotExist = _ref17$failOnNotExist === void 0 ? false : _ref17$failOnNotExist;
21490
21491 var getAuthInfo = getAdapter('getAuthInfo');
21492 return getAuthInfo({
21493 preferUnionId: preferUnionId,
21494 asMainAccount: asMainAccount,
21495 platform: unionIdPlatform
21496 }).then(function (authInfo) {
21497 authInfo.provider = PLATFORM_QQAPP;
21498 return _this17.loginWithMiniApp(authInfo, {
21499 failOnNotExist: failOnNotExist
21500 });
21501 });
21502 },
21503
21504 /**
21505 * 使用当前使用 QQ 小程序的 QQ 用户身份注册或登录,
21506 * 仅在 QQ 小程序中可用。
21507 *
21508 * @deprecated please use {@link AV.User.loginWithMiniApp}
21509 * @since 4.2.0
21510 * @param {Object} [unionLoginOptions]
21511 * @param {string} [unionLoginOptions.unionIdPlatform = 'qq'] unionId platform
21512 * @param {boolean} [unionLoginOptions.asMainAccount = false] If true, the unionId will be associated with the user.
21513 * @param {boolean} [unionLoginOptions.failOnNotExist] If true, the login request will fail when no user matches this authData exists.
21514 * @return {Promise.<AV.User>}
21515 */
21516 loginWithQQAppWithUnionId: function loginWithQQAppWithUnionId(unionId) {
21517 var _this18 = this;
21518
21519 var _ref18 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
21520 _ref18$unionIdPlatfor = _ref18.unionIdPlatform,
21521 unionIdPlatform = _ref18$unionIdPlatfor === void 0 ? 'qq' : _ref18$unionIdPlatfor,
21522 _ref18$asMainAccount = _ref18.asMainAccount,
21523 asMainAccount = _ref18$asMainAccount === void 0 ? false : _ref18$asMainAccount,
21524 _ref18$failOnNotExist = _ref18.failOnNotExist,
21525 failOnNotExist = _ref18$failOnNotExist === void 0 ? false : _ref18$failOnNotExist;
21526
21527 var getAuthInfo = getAdapter('getAuthInfo');
21528 return getAuthInfo({
21529 platform: unionIdPlatform
21530 }).then(function (authInfo) {
21531 authInfo = AV.User.mergeUnionId(authInfo, unionId, {
21532 asMainAccount: asMainAccount
21533 });
21534 authInfo.provider = PLATFORM_QQAPP;
21535 return _this18.loginWithMiniApp(authInfo, {
21536 failOnNotExist: failOnNotExist
21537 });
21538 });
21539 },
21540
21541 /**
21542 * Register or login using the identity of the current mini-app.
21543 * @param {Object} authInfo
21544 * @param {Object} [option]
21545 * @param {Boolean} [option.failOnNotExist] If true, the login request will fail when no user matches this authInfo.authData exists.
21546 */
21547 loginWithMiniApp: function loginWithMiniApp(authInfo, option) {
21548 var _this19 = this;
21549
21550 if (authInfo === undefined) {
21551 var getAuthInfo = getAdapter('getAuthInfo');
21552 return getAuthInfo().then(function (authInfo) {
21553 return _this19.loginWithAuthData(authInfo.authData, authInfo.provider, option);
21554 });
21555 }
21556
21557 return this.loginWithAuthData(authInfo.authData, authInfo.provider, option);
21558 },
21559
21560 /**
21561 * Only use for DI in tests to produce deterministic IDs.
21562 */
21563 _genId: function _genId() {
21564 return uuid();
21565 },
21566
21567 /**
21568 * Creates an anonymous user.
21569 *
21570 * @since 3.9.0
21571 * @return {Promise.<AV.User>}
21572 */
21573 loginAnonymously: function loginAnonymously() {
21574 return this.loginWithAuthData({
21575 id: AV.User._genId()
21576 }, 'anonymous');
21577 },
21578 associateWithAuthData: function associateWithAuthData(userObj, platform, authData) {
21579 console.warn('DEPRECATED: User.associateWithAuthData 已废弃,请使用 User#associateWithAuthData 代替');
21580 return userObj._linkWith(platform, authData);
21581 },
21582
21583 /**
21584 * Logs out the currently logged in user session. This will remove the
21585 * session from disk, log out of linked services, and future calls to
21586 * <code>current</code> will return <code>null</code>.
21587 * @return {Promise}
21588 */
21589 logOut: function logOut() {
21590 if (AV._config.disableCurrentUser) {
21591 console.warn('AV.User.current() was disabled in multi-user environment, call logOut() from user object instead https://leancloud.cn/docs/leanengine-node-sdk-upgrade-1.html');
21592 return _promise.default.resolve(null);
21593 }
21594
21595 if (AV.User._currentUser !== null) {
21596 AV.User._currentUser._logOutWithAll();
21597
21598 AV.User._currentUser._isCurrentUser = false;
21599 }
21600
21601 AV.User._currentUserMatchesDisk = true;
21602 AV.User._currentUser = null;
21603 return AV.localStorage.removeItemAsync(AV._getAVPath(AV.User._CURRENT_USER_KEY)).then(function () {
21604 return AV._refreshSubscriptionId();
21605 });
21606 },
21607
21608 /**
21609 *Create a follower query for special user to query the user's followers.
21610 * @param {String} userObjectId The user object id.
21611 * @return {AV.FriendShipQuery}
21612 * @since 0.3.0
21613 */
21614 followerQuery: function followerQuery(userObjectId) {
21615 if (!userObjectId || !_.isString(userObjectId)) {
21616 throw new Error('Invalid user object id.');
21617 }
21618
21619 var query = new AV.FriendShipQuery('_Follower');
21620 query._friendshipTag = 'follower';
21621 query.equalTo('user', AV.Object.createWithoutData('_User', userObjectId));
21622 return query;
21623 },
21624
21625 /**
21626 *Create a followee query for special user to query the user's followees.
21627 * @param {String} userObjectId The user object id.
21628 * @return {AV.FriendShipQuery}
21629 * @since 0.3.0
21630 */
21631 followeeQuery: function followeeQuery(userObjectId) {
21632 if (!userObjectId || !_.isString(userObjectId)) {
21633 throw new Error('Invalid user object id.');
21634 }
21635
21636 var query = new AV.FriendShipQuery('_Followee');
21637 query._friendshipTag = 'followee';
21638 query.equalTo('user', AV.Object.createWithoutData('_User', userObjectId));
21639 return query;
21640 },
21641
21642 /**
21643 * Requests a password reset email to be sent to the specified email address
21644 * associated with the user account. This email allows the user to securely
21645 * reset their password on the AV site.
21646 *
21647 * @param {String} email The email address associated with the user that
21648 * forgot their password.
21649 * @return {Promise}
21650 */
21651 requestPasswordReset: function requestPasswordReset(email) {
21652 var json = {
21653 email: email
21654 };
21655 var request = AVRequest('requestPasswordReset', null, null, 'POST', json);
21656 return request;
21657 },
21658
21659 /**
21660 * Requests a verify email to be sent to the specified email address
21661 * associated with the user account. This email allows the user to securely
21662 * verify their email address on the AV site.
21663 *
21664 * @param {String} email The email address associated with the user that
21665 * doesn't verify their email address.
21666 * @return {Promise}
21667 */
21668 requestEmailVerify: function requestEmailVerify(email) {
21669 var json = {
21670 email: email
21671 };
21672 var request = AVRequest('requestEmailVerify', null, null, 'POST', json);
21673 return request;
21674 },
21675
21676 /**
21677 * Requests a verify sms code to be sent to the specified mobile phone
21678 * number associated with the user account. This sms code allows the user to
21679 * verify their mobile phone number by calling AV.User.verifyMobilePhone
21680 *
21681 * @param {String} mobilePhoneNumber The mobile phone number associated with the
21682 * user that doesn't verify their mobile phone number.
21683 * @param {SMSAuthOptions} [options]
21684 * @return {Promise}
21685 */
21686 requestMobilePhoneVerify: function requestMobilePhoneVerify(mobilePhoneNumber) {
21687 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
21688 var data = {
21689 mobilePhoneNumber: mobilePhoneNumber
21690 };
21691
21692 if (options.validateToken) {
21693 data.validate_token = options.validateToken;
21694 }
21695
21696 var request = AVRequest('requestMobilePhoneVerify', null, null, 'POST', data, options);
21697 return request;
21698 },
21699
21700 /**
21701 * Requests a reset password sms code to be sent to the specified mobile phone
21702 * number associated with the user account. This sms code allows the user to
21703 * reset their account's password by calling AV.User.resetPasswordBySmsCode
21704 *
21705 * @param {String} mobilePhoneNumber The mobile phone number associated with the
21706 * user that doesn't verify their mobile phone number.
21707 * @param {SMSAuthOptions} [options]
21708 * @return {Promise}
21709 */
21710 requestPasswordResetBySmsCode: function requestPasswordResetBySmsCode(mobilePhoneNumber) {
21711 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
21712 var data = {
21713 mobilePhoneNumber: mobilePhoneNumber
21714 };
21715
21716 if (options.validateToken) {
21717 data.validate_token = options.validateToken;
21718 }
21719
21720 var request = AVRequest('requestPasswordResetBySmsCode', null, null, 'POST', data, options);
21721 return request;
21722 },
21723
21724 /**
21725 * Requests a change mobile phone number sms code to be sent to the mobilePhoneNumber.
21726 * This sms code allows current user to reset it's mobilePhoneNumber by
21727 * calling {@link AV.User.changePhoneNumber}
21728 * @since 4.7.0
21729 * @param {String} mobilePhoneNumber
21730 * @param {Number} [ttl] ttl of sms code (default is 6 minutes)
21731 * @param {SMSAuthOptions} [options]
21732 * @return {Promise}
21733 */
21734 requestChangePhoneNumber: function requestChangePhoneNumber(mobilePhoneNumber, ttl, options) {
21735 var data = {
21736 mobilePhoneNumber: mobilePhoneNumber
21737 };
21738
21739 if (ttl) {
21740 data.ttl = options.ttl;
21741 }
21742
21743 if (options && options.validateToken) {
21744 data.validate_token = options.validateToken;
21745 }
21746
21747 return AVRequest('requestChangePhoneNumber', null, null, 'POST', data, options);
21748 },
21749
21750 /**
21751 * Makes a call to reset user's account mobilePhoneNumber by sms code.
21752 * The sms code is sent by {@link AV.User.requestChangePhoneNumber}
21753 * @since 4.7.0
21754 * @param {String} mobilePhoneNumber
21755 * @param {String} code The sms code.
21756 * @return {Promise}
21757 */
21758 changePhoneNumber: function changePhoneNumber(mobilePhoneNumber, code) {
21759 var data = {
21760 mobilePhoneNumber: mobilePhoneNumber,
21761 code: code
21762 };
21763 return AVRequest('changePhoneNumber', null, null, 'POST', data);
21764 },
21765
21766 /**
21767 * Makes a call to reset user's account password by sms code and new password.
21768 * The sms code is sent by AV.User.requestPasswordResetBySmsCode.
21769 * @param {String} code The sms code sent by AV.User.Cloud.requestSmsCode
21770 * @param {String} password The new password.
21771 * @return {Promise} A promise that will be resolved with the result
21772 * of the function.
21773 */
21774 resetPasswordBySmsCode: function resetPasswordBySmsCode(code, password) {
21775 var json = {
21776 password: password
21777 };
21778 var request = AVRequest('resetPasswordBySmsCode', null, code, 'PUT', json);
21779 return request;
21780 },
21781
21782 /**
21783 * Makes a call to verify sms code that sent by AV.User.Cloud.requestSmsCode
21784 * If verify successfully,the user mobilePhoneVerified attribute will be true.
21785 * @param {String} code The sms code sent by AV.User.Cloud.requestSmsCode
21786 * @return {Promise} A promise that will be resolved with the result
21787 * of the function.
21788 */
21789 verifyMobilePhone: function verifyMobilePhone(code) {
21790 var request = AVRequest('verifyMobilePhone', null, code, 'POST', null);
21791 return request;
21792 },
21793
21794 /**
21795 * Requests a logIn sms code to be sent to the specified mobile phone
21796 * number associated with the user account. This sms code allows the user to
21797 * login by AV.User.logInWithMobilePhoneSmsCode function.
21798 *
21799 * @param {String} mobilePhoneNumber The mobile phone number associated with the
21800 * user that want to login by AV.User.logInWithMobilePhoneSmsCode
21801 * @param {SMSAuthOptions} [options]
21802 * @return {Promise}
21803 */
21804 requestLoginSmsCode: function requestLoginSmsCode(mobilePhoneNumber) {
21805 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
21806 var data = {
21807 mobilePhoneNumber: mobilePhoneNumber
21808 };
21809
21810 if (options.validateToken) {
21811 data.validate_token = options.validateToken;
21812 }
21813
21814 var request = AVRequest('requestLoginSmsCode', null, null, 'POST', data, options);
21815 return request;
21816 },
21817
21818 /**
21819 * Retrieves the currently logged in AVUser with a valid session,
21820 * either from memory or localStorage, if necessary.
21821 * @return {Promise.<AV.User>} resolved with the currently logged in AV.User.
21822 */
21823 currentAsync: function currentAsync() {
21824 if (AV._config.disableCurrentUser) {
21825 console.warn('AV.User.currentAsync() was disabled in multi-user environment, access user from request instead https://leancloud.cn/docs/leanengine-node-sdk-upgrade-1.html');
21826 return _promise.default.resolve(null);
21827 }
21828
21829 if (AV.User._currentUser) {
21830 return _promise.default.resolve(AV.User._currentUser);
21831 }
21832
21833 if (AV.User._currentUserMatchesDisk) {
21834 return _promise.default.resolve(AV.User._currentUser);
21835 }
21836
21837 return AV.localStorage.getItemAsync(AV._getAVPath(AV.User._CURRENT_USER_KEY)).then(function (userData) {
21838 if (!userData) {
21839 return null;
21840 } // Load the user from local storage.
21841
21842
21843 AV.User._currentUserMatchesDisk = true;
21844 AV.User._currentUser = AV.Object._create('_User');
21845 AV.User._currentUser._isCurrentUser = true;
21846 var json = JSON.parse(userData);
21847 AV.User._currentUser.id = json._id;
21848 delete json._id;
21849 AV.User._currentUser._sessionToken = json._sessionToken;
21850 delete json._sessionToken;
21851
21852 AV.User._currentUser._finishFetch(json); //AV.User._currentUser.set(json);
21853
21854
21855 AV.User._currentUser._synchronizeAllAuthData();
21856
21857 AV.User._currentUser._refreshCache();
21858
21859 AV.User._currentUser._opSetQueue = [{}];
21860 return AV.User._currentUser;
21861 });
21862 },
21863
21864 /**
21865 * Retrieves the currently logged in AVUser with a valid session,
21866 * either from memory or localStorage, if necessary.
21867 * @return {AV.User} The currently logged in AV.User.
21868 */
21869 current: function current() {
21870 if (AV._config.disableCurrentUser) {
21871 console.warn('AV.User.current() was disabled in multi-user environment, access user from request instead https://leancloud.cn/docs/leanengine-node-sdk-upgrade-1.html');
21872 return null;
21873 }
21874
21875 if (AV.localStorage.async) {
21876 var error = new Error('Synchronous API User.current() is not available in this runtime. Use User.currentAsync() instead.');
21877 error.code = 'SYNC_API_NOT_AVAILABLE';
21878 throw error;
21879 }
21880
21881 if (AV.User._currentUser) {
21882 return AV.User._currentUser;
21883 }
21884
21885 if (AV.User._currentUserMatchesDisk) {
21886 return AV.User._currentUser;
21887 } // Load the user from local storage.
21888
21889
21890 AV.User._currentUserMatchesDisk = true;
21891 var userData = AV.localStorage.getItem(AV._getAVPath(AV.User._CURRENT_USER_KEY));
21892
21893 if (!userData) {
21894 return null;
21895 }
21896
21897 AV.User._currentUser = AV.Object._create('_User');
21898 AV.User._currentUser._isCurrentUser = true;
21899 var json = JSON.parse(userData);
21900 AV.User._currentUser.id = json._id;
21901 delete json._id;
21902 AV.User._currentUser._sessionToken = json._sessionToken;
21903 delete json._sessionToken;
21904
21905 AV.User._currentUser._finishFetch(json); //AV.User._currentUser.set(json);
21906
21907
21908 AV.User._currentUser._synchronizeAllAuthData();
21909
21910 AV.User._currentUser._refreshCache();
21911
21912 AV.User._currentUser._opSetQueue = [{}];
21913 return AV.User._currentUser;
21914 },
21915
21916 /**
21917 * Persists a user as currentUser to localStorage, and into the singleton.
21918 * @private
21919 */
21920 _saveCurrentUser: function _saveCurrentUser(user) {
21921 var promise;
21922
21923 if (AV.User._currentUser !== user) {
21924 promise = AV.User.logOut();
21925 } else {
21926 promise = _promise.default.resolve();
21927 }
21928
21929 return promise.then(function () {
21930 user._isCurrentUser = true;
21931 AV.User._currentUser = user;
21932
21933 var json = user._toFullJSON();
21934
21935 json._id = user.id;
21936 json._sessionToken = user._sessionToken;
21937 return AV.localStorage.setItemAsync(AV._getAVPath(AV.User._CURRENT_USER_KEY), (0, _stringify.default)(json)).then(function () {
21938 AV.User._currentUserMatchesDisk = true;
21939 return AV._refreshSubscriptionId();
21940 });
21941 });
21942 },
21943 _registerAuthenticationProvider: function _registerAuthenticationProvider(provider) {
21944 AV.User._authProviders[provider.getAuthType()] = provider; // Synchronize the current user with the auth provider.
21945
21946 if (!AV._config.disableCurrentUser && AV.User.current()) {
21947 AV.User.current()._synchronizeAuthData(provider.getAuthType());
21948 }
21949 },
21950 _logInWith: function _logInWith(provider, authData, options) {
21951 var user = AV.Object._create('_User');
21952
21953 return user._linkWith(provider, authData, options);
21954 }
21955 });
21956};
21957
21958/***/ }),
21959/* 560 */
21960/***/ (function(module, exports, __webpack_require__) {
21961
21962var _Object$defineProperty = __webpack_require__(153);
21963
21964function _defineProperty(obj, key, value) {
21965 if (key in obj) {
21966 _Object$defineProperty(obj, key, {
21967 value: value,
21968 enumerable: true,
21969 configurable: true,
21970 writable: true
21971 });
21972 } else {
21973 obj[key] = value;
21974 }
21975
21976 return obj;
21977}
21978
21979module.exports = _defineProperty, module.exports.__esModule = true, module.exports["default"] = module.exports;
21980
21981/***/ }),
21982/* 561 */
21983/***/ (function(module, exports, __webpack_require__) {
21984
21985"use strict";
21986
21987
21988var _interopRequireDefault = __webpack_require__(1);
21989
21990var _map = _interopRequireDefault(__webpack_require__(37));
21991
21992var _promise = _interopRequireDefault(__webpack_require__(12));
21993
21994var _keys = _interopRequireDefault(__webpack_require__(62));
21995
21996var _stringify = _interopRequireDefault(__webpack_require__(38));
21997
21998var _find = _interopRequireDefault(__webpack_require__(96));
21999
22000var _concat = _interopRequireDefault(__webpack_require__(19));
22001
22002var _ = __webpack_require__(3);
22003
22004var debug = __webpack_require__(63)('leancloud:query');
22005
22006var AVError = __webpack_require__(48);
22007
22008var _require = __webpack_require__(28),
22009 _request = _require._request,
22010 request = _require.request;
22011
22012var _require2 = __webpack_require__(32),
22013 ensureArray = _require2.ensureArray,
22014 transformFetchOptions = _require2.transformFetchOptions,
22015 continueWhile = _require2.continueWhile;
22016
22017var requires = function requires(value, message) {
22018 if (value === undefined) {
22019 throw new Error(message);
22020 }
22021}; // AV.Query is a way to create a list of AV.Objects.
22022
22023
22024module.exports = function (AV) {
22025 /**
22026 * Creates a new AV.Query for the given AV.Object subclass.
22027 * @param {Class|String} objectClass An instance of a subclass of AV.Object, or a AV className string.
22028 * @class
22029 *
22030 * <p>AV.Query defines a query that is used to fetch AV.Objects. The
22031 * most common use case is finding all objects that match a query through the
22032 * <code>find</code> method. For example, this sample code fetches all objects
22033 * of class <code>MyClass</code>. It calls a different function depending on
22034 * whether the fetch succeeded or not.
22035 *
22036 * <pre>
22037 * var query = new AV.Query(MyClass);
22038 * query.find().then(function(results) {
22039 * // results is an array of AV.Object.
22040 * }, function(error) {
22041 * // error is an instance of AVError.
22042 * });</pre></p>
22043 *
22044 * <p>An AV.Query can also be used to retrieve a single object whose id is
22045 * known, through the get method. For example, this sample code fetches an
22046 * object of class <code>MyClass</code> and id <code>myId</code>. It calls a
22047 * different function depending on whether the fetch succeeded or not.
22048 *
22049 * <pre>
22050 * var query = new AV.Query(MyClass);
22051 * query.get(myId).then(function(object) {
22052 * // object is an instance of AV.Object.
22053 * }, function(error) {
22054 * // error is an instance of AVError.
22055 * });</pre></p>
22056 *
22057 * <p>An AV.Query can also be used to count the number of objects that match
22058 * the query without retrieving all of those objects. For example, this
22059 * sample code counts the number of objects of the class <code>MyClass</code>
22060 * <pre>
22061 * var query = new AV.Query(MyClass);
22062 * query.count().then(function(number) {
22063 * // There are number instances of MyClass.
22064 * }, function(error) {
22065 * // error is an instance of AVError.
22066 * });</pre></p>
22067 */
22068 AV.Query = function (objectClass) {
22069 if (_.isString(objectClass)) {
22070 objectClass = AV.Object._getSubclass(objectClass);
22071 }
22072
22073 this.objectClass = objectClass;
22074 this.className = objectClass.prototype.className;
22075 this._where = {};
22076 this._include = [];
22077 this._select = [];
22078 this._limit = -1; // negative limit means, do not send a limit
22079
22080 this._skip = 0;
22081 this._defaultParams = {};
22082 };
22083 /**
22084 * Constructs a AV.Query that is the OR of the passed in queries. For
22085 * example:
22086 * <pre>var compoundQuery = AV.Query.or(query1, query2, query3);</pre>
22087 *
22088 * will create a compoundQuery that is an or of the query1, query2, and
22089 * query3.
22090 * @param {...AV.Query} var_args The list of queries to OR.
22091 * @return {AV.Query} The query that is the OR of the passed in queries.
22092 */
22093
22094
22095 AV.Query.or = function () {
22096 var queries = _.toArray(arguments);
22097
22098 var className = null;
22099
22100 AV._arrayEach(queries, function (q) {
22101 if (_.isNull(className)) {
22102 className = q.className;
22103 }
22104
22105 if (className !== q.className) {
22106 throw new Error('All queries must be for the same class');
22107 }
22108 });
22109
22110 var query = new AV.Query(className);
22111
22112 query._orQuery(queries);
22113
22114 return query;
22115 };
22116 /**
22117 * Constructs a AV.Query that is the AND of the passed in queries. For
22118 * example:
22119 * <pre>var compoundQuery = AV.Query.and(query1, query2, query3);</pre>
22120 *
22121 * will create a compoundQuery that is an 'and' of the query1, query2, and
22122 * query3.
22123 * @param {...AV.Query} var_args The list of queries to AND.
22124 * @return {AV.Query} The query that is the AND of the passed in queries.
22125 */
22126
22127
22128 AV.Query.and = function () {
22129 var queries = _.toArray(arguments);
22130
22131 var className = null;
22132
22133 AV._arrayEach(queries, function (q) {
22134 if (_.isNull(className)) {
22135 className = q.className;
22136 }
22137
22138 if (className !== q.className) {
22139 throw new Error('All queries must be for the same class');
22140 }
22141 });
22142
22143 var query = new AV.Query(className);
22144
22145 query._andQuery(queries);
22146
22147 return query;
22148 };
22149 /**
22150 * Retrieves a list of AVObjects that satisfy the CQL.
22151 * CQL syntax please see {@link https://leancloud.cn/docs/cql_guide.html CQL Guide}.
22152 *
22153 * @param {String} cql A CQL string, see {@link https://leancloud.cn/docs/cql_guide.html CQL Guide}.
22154 * @param {Array} pvalues An array contains placeholder values.
22155 * @param {AuthOptions} options
22156 * @return {Promise} A promise that is resolved with the results when
22157 * the query completes.
22158 */
22159
22160
22161 AV.Query.doCloudQuery = function (cql, pvalues, options) {
22162 var params = {
22163 cql: cql
22164 };
22165
22166 if (_.isArray(pvalues)) {
22167 params.pvalues = pvalues;
22168 } else {
22169 options = pvalues;
22170 }
22171
22172 var request = _request('cloudQuery', null, null, 'GET', params, options);
22173
22174 return request.then(function (response) {
22175 //query to process results.
22176 var query = new AV.Query(response.className);
22177 var results = (0, _map.default)(_).call(_, response.results, function (json) {
22178 var obj = query._newObject(response);
22179
22180 if (obj._finishFetch) {
22181 obj._finishFetch(query._processResult(json), true);
22182 }
22183
22184 return obj;
22185 });
22186 return {
22187 results: results,
22188 count: response.count,
22189 className: response.className
22190 };
22191 });
22192 };
22193 /**
22194 * Return a query with conditions from json.
22195 * This can be useful to send a query from server side to client side.
22196 * @since 4.0.0
22197 * @param {Object} json from {@link AV.Query#toJSON}
22198 * @return {AV.Query}
22199 */
22200
22201
22202 AV.Query.fromJSON = function (_ref) {
22203 var className = _ref.className,
22204 where = _ref.where,
22205 include = _ref.include,
22206 select = _ref.select,
22207 includeACL = _ref.includeACL,
22208 limit = _ref.limit,
22209 skip = _ref.skip,
22210 order = _ref.order;
22211
22212 if (typeof className !== 'string') {
22213 throw new TypeError('Invalid Query JSON, className must be a String.');
22214 }
22215
22216 var query = new AV.Query(className);
22217
22218 _.extend(query, {
22219 _where: where,
22220 _include: include,
22221 _select: select,
22222 _includeACL: includeACL,
22223 _limit: limit,
22224 _skip: skip,
22225 _order: order
22226 });
22227
22228 return query;
22229 };
22230
22231 AV.Query._extend = AV._extend;
22232
22233 _.extend(AV.Query.prototype,
22234 /** @lends AV.Query.prototype */
22235 {
22236 //hook to iterate result. Added by dennis<xzhuang@avoscloud.com>.
22237 _processResult: function _processResult(obj) {
22238 return obj;
22239 },
22240
22241 /**
22242 * Constructs an AV.Object whose id is already known by fetching data from
22243 * the server.
22244 *
22245 * @param {String} objectId The id of the object to be fetched.
22246 * @param {AuthOptions} options
22247 * @return {Promise.<AV.Object>}
22248 */
22249 get: function get(objectId, options) {
22250 if (!_.isString(objectId)) {
22251 throw new Error('objectId must be a string');
22252 }
22253
22254 if (objectId === '') {
22255 return _promise.default.reject(new AVError(AVError.OBJECT_NOT_FOUND, 'Object not found.'));
22256 }
22257
22258 var obj = this._newObject();
22259
22260 obj.id = objectId;
22261
22262 var queryJSON = this._getParams();
22263
22264 var fetchOptions = {};
22265 if ((0, _keys.default)(queryJSON)) fetchOptions.keys = (0, _keys.default)(queryJSON);
22266 if (queryJSON.include) fetchOptions.include = queryJSON.include;
22267 if (queryJSON.includeACL) fetchOptions.includeACL = queryJSON.includeACL;
22268 return _request('classes', this.className, objectId, 'GET', transformFetchOptions(fetchOptions), options).then(function (response) {
22269 if (_.isEmpty(response)) throw new AVError(AVError.OBJECT_NOT_FOUND, 'Object not found.');
22270
22271 obj._finishFetch(obj.parse(response), true);
22272
22273 return obj;
22274 });
22275 },
22276
22277 /**
22278 * Returns a JSON representation of this query.
22279 * @return {Object}
22280 */
22281 toJSON: function toJSON() {
22282 var className = this.className,
22283 where = this._where,
22284 include = this._include,
22285 select = this._select,
22286 includeACL = this._includeACL,
22287 limit = this._limit,
22288 skip = this._skip,
22289 order = this._order;
22290 return {
22291 className: className,
22292 where: where,
22293 include: include,
22294 select: select,
22295 includeACL: includeACL,
22296 limit: limit,
22297 skip: skip,
22298 order: order
22299 };
22300 },
22301 _getParams: function _getParams() {
22302 var params = _.extend({}, this._defaultParams, {
22303 where: this._where
22304 });
22305
22306 if (this._include.length > 0) {
22307 params.include = this._include.join(',');
22308 }
22309
22310 if (this._select.length > 0) {
22311 params.keys = this._select.join(',');
22312 }
22313
22314 if (this._includeACL !== undefined) {
22315 params.returnACL = this._includeACL;
22316 }
22317
22318 if (this._limit >= 0) {
22319 params.limit = this._limit;
22320 }
22321
22322 if (this._skip > 0) {
22323 params.skip = this._skip;
22324 }
22325
22326 if (this._order !== undefined) {
22327 params.order = this._order;
22328 }
22329
22330 return params;
22331 },
22332 _newObject: function _newObject(response) {
22333 var obj;
22334
22335 if (response && response.className) {
22336 obj = new AV.Object(response.className);
22337 } else {
22338 obj = new this.objectClass();
22339 }
22340
22341 return obj;
22342 },
22343 _createRequest: function _createRequest() {
22344 var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this._getParams();
22345 var options = arguments.length > 1 ? arguments[1] : undefined;
22346 var path = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "/classes/".concat(this.className);
22347
22348 if (encodeURIComponent((0, _stringify.default)(params)).length > 2000) {
22349 var body = {
22350 requests: [{
22351 method: 'GET',
22352 path: "/1.1".concat(path),
22353 params: params
22354 }]
22355 };
22356 return request({
22357 path: '/batch',
22358 method: 'POST',
22359 data: body,
22360 authOptions: options
22361 }).then(function (response) {
22362 var result = response[0];
22363
22364 if (result.success) {
22365 return result.success;
22366 }
22367
22368 var error = new AVError(result.error.code, result.error.error || 'Unknown batch error');
22369 throw error;
22370 });
22371 }
22372
22373 return request({
22374 method: 'GET',
22375 path: path,
22376 query: params,
22377 authOptions: options
22378 });
22379 },
22380 _parseResponse: function _parseResponse(response) {
22381 var _this = this;
22382
22383 return (0, _map.default)(_).call(_, response.results, function (json) {
22384 var obj = _this._newObject(response);
22385
22386 if (obj._finishFetch) {
22387 obj._finishFetch(_this._processResult(json), true);
22388 }
22389
22390 return obj;
22391 });
22392 },
22393
22394 /**
22395 * Retrieves a list of AVObjects that satisfy this query.
22396 *
22397 * @param {AuthOptions} options
22398 * @return {Promise} A promise that is resolved with the results when
22399 * the query completes.
22400 */
22401 find: function find(options) {
22402 var request = this._createRequest(undefined, options);
22403
22404 return request.then(this._parseResponse.bind(this));
22405 },
22406
22407 /**
22408 * Retrieves both AVObjects and total count.
22409 *
22410 * @since 4.12.0
22411 * @param {AuthOptions} options
22412 * @return {Promise} A tuple contains results and count.
22413 */
22414 findAndCount: function findAndCount(options) {
22415 var _this2 = this;
22416
22417 var params = this._getParams();
22418
22419 params.count = 1;
22420
22421 var request = this._createRequest(params, options);
22422
22423 return request.then(function (response) {
22424 return [_this2._parseResponse(response), response.count];
22425 });
22426 },
22427
22428 /**
22429 * scan a Query. masterKey required.
22430 *
22431 * @since 2.1.0
22432 * @param {object} [options]
22433 * @param {string} [options.orderedBy] specify the key to sort
22434 * @param {number} [options.batchSize] specify the batch size for each request
22435 * @param {AuthOptions} [authOptions]
22436 * @return {AsyncIterator.<AV.Object>}
22437 * @example const testIterator = {
22438 * [Symbol.asyncIterator]() {
22439 * return new Query('Test').scan(undefined, { useMasterKey: true });
22440 * },
22441 * };
22442 * for await (const test of testIterator) {
22443 * console.log(test.id);
22444 * }
22445 */
22446 scan: function scan() {
22447 var _this3 = this;
22448
22449 var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
22450 orderedBy = _ref2.orderedBy,
22451 batchSize = _ref2.batchSize;
22452
22453 var authOptions = arguments.length > 1 ? arguments[1] : undefined;
22454
22455 var condition = this._getParams();
22456
22457 debug('scan %O', condition);
22458
22459 if (condition.order) {
22460 console.warn('The order of the query is ignored for Query#scan. Checkout the orderedBy option of Query#scan.');
22461 delete condition.order;
22462 }
22463
22464 if (condition.skip) {
22465 console.warn('The skip option of the query is ignored for Query#scan.');
22466 delete condition.skip;
22467 }
22468
22469 if (condition.limit) {
22470 console.warn('The limit option of the query is ignored for Query#scan.');
22471 delete condition.limit;
22472 }
22473
22474 if (orderedBy) condition.scan_key = orderedBy;
22475 if (batchSize) condition.limit = batchSize;
22476 var cursor;
22477 var remainResults = [];
22478 return {
22479 next: function next() {
22480 if (remainResults.length) {
22481 return _promise.default.resolve({
22482 done: false,
22483 value: remainResults.shift()
22484 });
22485 }
22486
22487 if (cursor === null) {
22488 return _promise.default.resolve({
22489 done: true
22490 });
22491 }
22492
22493 return _request('scan/classes', _this3.className, null, 'GET', cursor ? _.extend({}, condition, {
22494 cursor: cursor
22495 }) : condition, authOptions).then(function (response) {
22496 cursor = response.cursor;
22497
22498 if (response.results.length) {
22499 var results = _this3._parseResponse(response);
22500
22501 results.forEach(function (result) {
22502 return remainResults.push(result);
22503 });
22504 }
22505
22506 if (cursor === null && remainResults.length === 0) {
22507 return {
22508 done: true
22509 };
22510 }
22511
22512 return {
22513 done: false,
22514 value: remainResults.shift()
22515 };
22516 });
22517 }
22518 };
22519 },
22520
22521 /**
22522 * Delete objects retrieved by this query.
22523 * @param {AuthOptions} options
22524 * @return {Promise} A promise that is fulfilled when the save
22525 * completes.
22526 */
22527 destroyAll: function destroyAll(options) {
22528 var self = this;
22529 return (0, _find.default)(self).call(self, options).then(function (objects) {
22530 return AV.Object.destroyAll(objects, options);
22531 });
22532 },
22533
22534 /**
22535 * Counts the number of objects that match this query.
22536 *
22537 * @param {AuthOptions} options
22538 * @return {Promise} A promise that is resolved with the count when
22539 * the query completes.
22540 */
22541 count: function count(options) {
22542 var params = this._getParams();
22543
22544 params.limit = 0;
22545 params.count = 1;
22546
22547 var request = this._createRequest(params, options);
22548
22549 return request.then(function (response) {
22550 return response.count;
22551 });
22552 },
22553
22554 /**
22555 * Retrieves at most one AV.Object that satisfies this query.
22556 *
22557 * @param {AuthOptions} options
22558 * @return {Promise} A promise that is resolved with the object when
22559 * the query completes.
22560 */
22561 first: function first(options) {
22562 var self = this;
22563
22564 var params = this._getParams();
22565
22566 params.limit = 1;
22567
22568 var request = this._createRequest(params, options);
22569
22570 return request.then(function (response) {
22571 return (0, _map.default)(_).call(_, response.results, function (json) {
22572 var obj = self._newObject();
22573
22574 if (obj._finishFetch) {
22575 obj._finishFetch(self._processResult(json), true);
22576 }
22577
22578 return obj;
22579 })[0];
22580 });
22581 },
22582
22583 /**
22584 * Sets the number of results to skip before returning any results.
22585 * This is useful for pagination.
22586 * Default is to skip zero results.
22587 * @param {Number} n the number of results to skip.
22588 * @return {AV.Query} Returns the query, so you can chain this call.
22589 */
22590 skip: function skip(n) {
22591 requires(n, 'undefined is not a valid skip value');
22592 this._skip = n;
22593 return this;
22594 },
22595
22596 /**
22597 * Sets the limit of the number of results to return. The default limit is
22598 * 100, with a maximum of 1000 results being returned at a time.
22599 * @param {Number} n the number of results to limit to.
22600 * @return {AV.Query} Returns the query, so you can chain this call.
22601 */
22602 limit: function limit(n) {
22603 requires(n, 'undefined is not a valid limit value');
22604 this._limit = n;
22605 return this;
22606 },
22607
22608 /**
22609 * Add a constraint to the query that requires a particular key's value to
22610 * be equal to the provided value.
22611 * @param {String} key The key to check.
22612 * @param value The value that the AV.Object must contain.
22613 * @return {AV.Query} Returns the query, so you can chain this call.
22614 */
22615 equalTo: function equalTo(key, value) {
22616 requires(key, 'undefined is not a valid key');
22617 requires(value, 'undefined is not a valid value');
22618 this._where[key] = AV._encode(value);
22619 return this;
22620 },
22621
22622 /**
22623 * Helper for condition queries
22624 * @private
22625 */
22626 _addCondition: function _addCondition(key, condition, value) {
22627 requires(key, 'undefined is not a valid condition key');
22628 requires(condition, 'undefined is not a valid condition');
22629 requires(value, 'undefined is not a valid condition value'); // Check if we already have a condition
22630
22631 if (!this._where[key]) {
22632 this._where[key] = {};
22633 }
22634
22635 this._where[key][condition] = AV._encode(value);
22636 return this;
22637 },
22638
22639 /**
22640 * Add a constraint to the query that requires a particular
22641 * <strong>array</strong> key's length to be equal to the provided value.
22642 * @param {String} key The array key to check.
22643 * @param {number} value The length value.
22644 * @return {AV.Query} Returns the query, so you can chain this call.
22645 */
22646 sizeEqualTo: function sizeEqualTo(key, value) {
22647 this._addCondition(key, '$size', value);
22648
22649 return this;
22650 },
22651
22652 /**
22653 * Add a constraint to the query that requires a particular key's value to
22654 * be not equal to the provided value.
22655 * @param {String} key The key to check.
22656 * @param value The value that must not be equalled.
22657 * @return {AV.Query} Returns the query, so you can chain this call.
22658 */
22659 notEqualTo: function notEqualTo(key, value) {
22660 this._addCondition(key, '$ne', value);
22661
22662 return this;
22663 },
22664
22665 /**
22666 * Add a constraint to the query that requires a particular key's value to
22667 * be less than the provided value.
22668 * @param {String} key The key to check.
22669 * @param value The value that provides an upper bound.
22670 * @return {AV.Query} Returns the query, so you can chain this call.
22671 */
22672 lessThan: function lessThan(key, value) {
22673 this._addCondition(key, '$lt', value);
22674
22675 return this;
22676 },
22677
22678 /**
22679 * Add a constraint to the query that requires a particular key's value to
22680 * be greater than the provided value.
22681 * @param {String} key The key to check.
22682 * @param value The value that provides an lower bound.
22683 * @return {AV.Query} Returns the query, so you can chain this call.
22684 */
22685 greaterThan: function greaterThan(key, value) {
22686 this._addCondition(key, '$gt', value);
22687
22688 return this;
22689 },
22690
22691 /**
22692 * Add a constraint to the query that requires a particular key's value to
22693 * be less than or equal to the provided value.
22694 * @param {String} key The key to check.
22695 * @param value The value that provides an upper bound.
22696 * @return {AV.Query} Returns the query, so you can chain this call.
22697 */
22698 lessThanOrEqualTo: function lessThanOrEqualTo(key, value) {
22699 this._addCondition(key, '$lte', value);
22700
22701 return this;
22702 },
22703
22704 /**
22705 * Add a constraint to the query that requires a particular key's value to
22706 * be greater than or equal to the provided value.
22707 * @param {String} key The key to check.
22708 * @param value The value that provides an lower bound.
22709 * @return {AV.Query} Returns the query, so you can chain this call.
22710 */
22711 greaterThanOrEqualTo: function greaterThanOrEqualTo(key, value) {
22712 this._addCondition(key, '$gte', value);
22713
22714 return this;
22715 },
22716
22717 /**
22718 * Add a constraint to the query that requires a particular key's value to
22719 * be contained in the provided list of values.
22720 * @param {String} key The key to check.
22721 * @param {Array} values The values that will match.
22722 * @return {AV.Query} Returns the query, so you can chain this call.
22723 */
22724 containedIn: function containedIn(key, values) {
22725 this._addCondition(key, '$in', values);
22726
22727 return this;
22728 },
22729
22730 /**
22731 * Add a constraint to the query that requires a particular key's value to
22732 * not be contained in the provided list of values.
22733 * @param {String} key The key to check.
22734 * @param {Array} values The values that will not match.
22735 * @return {AV.Query} Returns the query, so you can chain this call.
22736 */
22737 notContainedIn: function notContainedIn(key, values) {
22738 this._addCondition(key, '$nin', values);
22739
22740 return this;
22741 },
22742
22743 /**
22744 * Add a constraint to the query that requires a particular key's value to
22745 * contain each one of the provided list of values.
22746 * @param {String} key The key to check. This key's value must be an array.
22747 * @param {Array} values The values that will match.
22748 * @return {AV.Query} Returns the query, so you can chain this call.
22749 */
22750 containsAll: function containsAll(key, values) {
22751 this._addCondition(key, '$all', values);
22752
22753 return this;
22754 },
22755
22756 /**
22757 * Add a constraint for finding objects that contain the given key.
22758 * @param {String} key The key that should exist.
22759 * @return {AV.Query} Returns the query, so you can chain this call.
22760 */
22761 exists: function exists(key) {
22762 this._addCondition(key, '$exists', true);
22763
22764 return this;
22765 },
22766
22767 /**
22768 * Add a constraint for finding objects that do not contain a given key.
22769 * @param {String} key The key that should not exist
22770 * @return {AV.Query} Returns the query, so you can chain this call.
22771 */
22772 doesNotExist: function doesNotExist(key) {
22773 this._addCondition(key, '$exists', false);
22774
22775 return this;
22776 },
22777
22778 /**
22779 * Add a regular expression constraint for finding string values that match
22780 * the provided regular expression.
22781 * This may be slow for large datasets.
22782 * @param {String} key The key that the string to match is stored in.
22783 * @param {RegExp} regex The regular expression pattern to match.
22784 * @return {AV.Query} Returns the query, so you can chain this call.
22785 */
22786 matches: function matches(key, regex, modifiers) {
22787 this._addCondition(key, '$regex', regex);
22788
22789 if (!modifiers) {
22790 modifiers = '';
22791 } // Javascript regex options support mig as inline options but store them
22792 // as properties of the object. We support mi & should migrate them to
22793 // modifiers
22794
22795
22796 if (regex.ignoreCase) {
22797 modifiers += 'i';
22798 }
22799
22800 if (regex.multiline) {
22801 modifiers += 'm';
22802 }
22803
22804 if (modifiers && modifiers.length) {
22805 this._addCondition(key, '$options', modifiers);
22806 }
22807
22808 return this;
22809 },
22810
22811 /**
22812 * Add a constraint that requires that a key's value matches a AV.Query
22813 * constraint.
22814 * @param {String} key The key that the contains the object to match the
22815 * query.
22816 * @param {AV.Query} query The query that should match.
22817 * @return {AV.Query} Returns the query, so you can chain this call.
22818 */
22819 matchesQuery: function matchesQuery(key, query) {
22820 var queryJSON = query._getParams();
22821
22822 queryJSON.className = query.className;
22823
22824 this._addCondition(key, '$inQuery', queryJSON);
22825
22826 return this;
22827 },
22828
22829 /**
22830 * Add a constraint that requires that a key's value not matches a
22831 * AV.Query constraint.
22832 * @param {String} key The key that the contains the object to match the
22833 * query.
22834 * @param {AV.Query} query The query that should not match.
22835 * @return {AV.Query} Returns the query, so you can chain this call.
22836 */
22837 doesNotMatchQuery: function doesNotMatchQuery(key, query) {
22838 var queryJSON = query._getParams();
22839
22840 queryJSON.className = query.className;
22841
22842 this._addCondition(key, '$notInQuery', queryJSON);
22843
22844 return this;
22845 },
22846
22847 /**
22848 * Add a constraint that requires that a key's value matches a value in
22849 * an object returned by a different AV.Query.
22850 * @param {String} key The key that contains the value that is being
22851 * matched.
22852 * @param {String} queryKey The key in the objects returned by the query to
22853 * match against.
22854 * @param {AV.Query} query The query to run.
22855 * @return {AV.Query} Returns the query, so you can chain this call.
22856 */
22857 matchesKeyInQuery: function matchesKeyInQuery(key, queryKey, query) {
22858 var queryJSON = query._getParams();
22859
22860 queryJSON.className = query.className;
22861
22862 this._addCondition(key, '$select', {
22863 key: queryKey,
22864 query: queryJSON
22865 });
22866
22867 return this;
22868 },
22869
22870 /**
22871 * Add a constraint that requires that a key's value not match a value in
22872 * an object returned by a different AV.Query.
22873 * @param {String} key The key that contains the value that is being
22874 * excluded.
22875 * @param {String} queryKey The key in the objects returned by the query to
22876 * match against.
22877 * @param {AV.Query} query The query to run.
22878 * @return {AV.Query} Returns the query, so you can chain this call.
22879 */
22880 doesNotMatchKeyInQuery: function doesNotMatchKeyInQuery(key, queryKey, query) {
22881 var queryJSON = query._getParams();
22882
22883 queryJSON.className = query.className;
22884
22885 this._addCondition(key, '$dontSelect', {
22886 key: queryKey,
22887 query: queryJSON
22888 });
22889
22890 return this;
22891 },
22892
22893 /**
22894 * Add constraint that at least one of the passed in queries matches.
22895 * @param {Array} queries
22896 * @return {AV.Query} Returns the query, so you can chain this call.
22897 * @private
22898 */
22899 _orQuery: function _orQuery(queries) {
22900 var queryJSON = (0, _map.default)(_).call(_, queries, function (q) {
22901 return q._getParams().where;
22902 });
22903 this._where.$or = queryJSON;
22904 return this;
22905 },
22906
22907 /**
22908 * Add constraint that both of the passed in queries matches.
22909 * @param {Array} queries
22910 * @return {AV.Query} Returns the query, so you can chain this call.
22911 * @private
22912 */
22913 _andQuery: function _andQuery(queries) {
22914 var queryJSON = (0, _map.default)(_).call(_, queries, function (q) {
22915 return q._getParams().where;
22916 });
22917 this._where.$and = queryJSON;
22918 return this;
22919 },
22920
22921 /**
22922 * Converts a string into a regex that matches it.
22923 * Surrounding with \Q .. \E does this, we just need to escape \E's in
22924 * the text separately.
22925 * @private
22926 */
22927 _quote: function _quote(s) {
22928 return '\\Q' + s.replace('\\E', '\\E\\\\E\\Q') + '\\E';
22929 },
22930
22931 /**
22932 * Add a constraint for finding string values that contain a provided
22933 * string. This may be slow for large datasets.
22934 * @param {String} key The key that the string to match is stored in.
22935 * @param {String} substring The substring that the value must contain.
22936 * @return {AV.Query} Returns the query, so you can chain this call.
22937 */
22938 contains: function contains(key, value) {
22939 this._addCondition(key, '$regex', this._quote(value));
22940
22941 return this;
22942 },
22943
22944 /**
22945 * Add a constraint for finding string values that start with a provided
22946 * string. This query will use the backend index, so it will be fast even
22947 * for large datasets.
22948 * @param {String} key The key that the string to match is stored in.
22949 * @param {String} prefix The substring that the value must start with.
22950 * @return {AV.Query} Returns the query, so you can chain this call.
22951 */
22952 startsWith: function startsWith(key, value) {
22953 this._addCondition(key, '$regex', '^' + this._quote(value));
22954
22955 return this;
22956 },
22957
22958 /**
22959 * Add a constraint for finding string values that end with a provided
22960 * string. This will be slow for large datasets.
22961 * @param {String} key The key that the string to match is stored in.
22962 * @param {String} suffix The substring that the value must end with.
22963 * @return {AV.Query} Returns the query, so you can chain this call.
22964 */
22965 endsWith: function endsWith(key, value) {
22966 this._addCondition(key, '$regex', this._quote(value) + '$');
22967
22968 return this;
22969 },
22970
22971 /**
22972 * Sorts the results in ascending order by the given key.
22973 *
22974 * @param {String} key The key to order by.
22975 * @return {AV.Query} Returns the query, so you can chain this call.
22976 */
22977 ascending: function ascending(key) {
22978 requires(key, 'undefined is not a valid key');
22979 this._order = key;
22980 return this;
22981 },
22982
22983 /**
22984 * Also sorts the results in ascending order by the given key. The previous sort keys have
22985 * precedence over this key.
22986 *
22987 * @param {String} key The key to order by
22988 * @return {AV.Query} Returns the query so you can chain this call.
22989 */
22990 addAscending: function addAscending(key) {
22991 requires(key, 'undefined is not a valid key');
22992 if (this._order) this._order += ',' + key;else this._order = key;
22993 return this;
22994 },
22995
22996 /**
22997 * Sorts the results in descending order by the given key.
22998 *
22999 * @param {String} key The key to order by.
23000 * @return {AV.Query} Returns the query, so you can chain this call.
23001 */
23002 descending: function descending(key) {
23003 requires(key, 'undefined is not a valid key');
23004 this._order = '-' + key;
23005 return this;
23006 },
23007
23008 /**
23009 * Also sorts the results in descending order by the given key. The previous sort keys have
23010 * precedence over this key.
23011 *
23012 * @param {String} key The key to order by
23013 * @return {AV.Query} Returns the query so you can chain this call.
23014 */
23015 addDescending: function addDescending(key) {
23016 requires(key, 'undefined is not a valid key');
23017 if (this._order) this._order += ',-' + key;else this._order = '-' + key;
23018 return this;
23019 },
23020
23021 /**
23022 * Add a proximity based constraint for finding objects with key point
23023 * values near the point given.
23024 * @param {String} key The key that the AV.GeoPoint is stored in.
23025 * @param {AV.GeoPoint} point The reference AV.GeoPoint that is used.
23026 * @return {AV.Query} Returns the query, so you can chain this call.
23027 */
23028 near: function near(key, point) {
23029 if (!(point instanceof AV.GeoPoint)) {
23030 // Try to cast it to a GeoPoint, so that near("loc", [20,30]) works.
23031 point = new AV.GeoPoint(point);
23032 }
23033
23034 this._addCondition(key, '$nearSphere', point);
23035
23036 return this;
23037 },
23038
23039 /**
23040 * Add a proximity based constraint for finding objects with key point
23041 * values near the point given and within the maximum distance given.
23042 * @param {String} key The key that the AV.GeoPoint is stored in.
23043 * @param {AV.GeoPoint} point The reference AV.GeoPoint that is used.
23044 * @param maxDistance Maximum distance (in radians) of results to return.
23045 * @return {AV.Query} Returns the query, so you can chain this call.
23046 */
23047 withinRadians: function withinRadians(key, point, distance) {
23048 this.near(key, point);
23049
23050 this._addCondition(key, '$maxDistance', distance);
23051
23052 return this;
23053 },
23054
23055 /**
23056 * Add a proximity based constraint for finding objects with key point
23057 * values near the point given and within the maximum distance given.
23058 * Radius of earth used is 3958.8 miles.
23059 * @param {String} key The key that the AV.GeoPoint is stored in.
23060 * @param {AV.GeoPoint} point The reference AV.GeoPoint that is used.
23061 * @param {Number} maxDistance Maximum distance (in miles) of results to
23062 * return.
23063 * @return {AV.Query} Returns the query, so you can chain this call.
23064 */
23065 withinMiles: function withinMiles(key, point, distance) {
23066 return this.withinRadians(key, point, distance / 3958.8);
23067 },
23068
23069 /**
23070 * Add a proximity based constraint for finding objects with key point
23071 * values near the point given and within the maximum distance given.
23072 * Radius of earth used is 6371.0 kilometers.
23073 * @param {String} key The key that the AV.GeoPoint is stored in.
23074 * @param {AV.GeoPoint} point The reference AV.GeoPoint that is used.
23075 * @param {Number} maxDistance Maximum distance (in kilometers) of results
23076 * to return.
23077 * @return {AV.Query} Returns the query, so you can chain this call.
23078 */
23079 withinKilometers: function withinKilometers(key, point, distance) {
23080 return this.withinRadians(key, point, distance / 6371.0);
23081 },
23082
23083 /**
23084 * Add a constraint to the query that requires a particular key's
23085 * coordinates be contained within a given rectangular geographic bounding
23086 * box.
23087 * @param {String} key The key to be constrained.
23088 * @param {AV.GeoPoint} southwest
23089 * The lower-left inclusive corner of the box.
23090 * @param {AV.GeoPoint} northeast
23091 * The upper-right inclusive corner of the box.
23092 * @return {AV.Query} Returns the query, so you can chain this call.
23093 */
23094 withinGeoBox: function withinGeoBox(key, southwest, northeast) {
23095 if (!(southwest instanceof AV.GeoPoint)) {
23096 southwest = new AV.GeoPoint(southwest);
23097 }
23098
23099 if (!(northeast instanceof AV.GeoPoint)) {
23100 northeast = new AV.GeoPoint(northeast);
23101 }
23102
23103 this._addCondition(key, '$within', {
23104 $box: [southwest, northeast]
23105 });
23106
23107 return this;
23108 },
23109
23110 /**
23111 * Include nested AV.Objects for the provided key. You can use dot
23112 * notation to specify which fields in the included object are also fetch.
23113 * @param {String[]} keys The name of the key to include.
23114 * @return {AV.Query} Returns the query, so you can chain this call.
23115 */
23116 include: function include(keys) {
23117 var _this4 = this;
23118
23119 requires(keys, 'undefined is not a valid key');
23120
23121 _.forEach(arguments, function (keys) {
23122 var _context;
23123
23124 _this4._include = (0, _concat.default)(_context = _this4._include).call(_context, ensureArray(keys));
23125 });
23126
23127 return this;
23128 },
23129
23130 /**
23131 * Include the ACL.
23132 * @param {Boolean} [value=true] Whether to include the ACL
23133 * @return {AV.Query} Returns the query, so you can chain this call.
23134 */
23135 includeACL: function includeACL() {
23136 var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
23137 this._includeACL = value;
23138 return this;
23139 },
23140
23141 /**
23142 * Restrict the fields of the returned AV.Objects to include only the
23143 * provided keys. If this is called multiple times, then all of the keys
23144 * specified in each of the calls will be included.
23145 * @param {String[]} keys The names of the keys to include.
23146 * @return {AV.Query} Returns the query, so you can chain this call.
23147 */
23148 select: function select(keys) {
23149 var _this5 = this;
23150
23151 requires(keys, 'undefined is not a valid key');
23152
23153 _.forEach(arguments, function (keys) {
23154 var _context2;
23155
23156 _this5._select = (0, _concat.default)(_context2 = _this5._select).call(_context2, ensureArray(keys));
23157 });
23158
23159 return this;
23160 },
23161
23162 /**
23163 * Iterates over each result of a query, calling a callback for each one. If
23164 * the callback returns a promise, the iteration will not continue until
23165 * that promise has been fulfilled. If the callback returns a rejected
23166 * promise, then iteration will stop with that error. The items are
23167 * processed in an unspecified order. The query may not have any sort order,
23168 * and may not use limit or skip.
23169 * @param callback {Function} Callback that will be called with each result
23170 * of the query.
23171 * @return {Promise} A promise that will be fulfilled once the
23172 * iteration has completed.
23173 */
23174 each: function each(callback) {
23175 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
23176
23177 if (this._order || this._skip || this._limit >= 0) {
23178 var error = new Error('Cannot iterate on a query with sort, skip, or limit.');
23179 return _promise.default.reject(error);
23180 }
23181
23182 var query = new AV.Query(this.objectClass); // We can override the batch size from the options.
23183 // This is undocumented, but useful for testing.
23184
23185 query._limit = options.batchSize || 100;
23186 query._where = _.clone(this._where);
23187 query._include = _.clone(this._include);
23188 query.ascending('objectId');
23189 var finished = false;
23190 return continueWhile(function () {
23191 return !finished;
23192 }, function () {
23193 return (0, _find.default)(query).call(query, options).then(function (results) {
23194 var callbacksDone = _promise.default.resolve();
23195
23196 _.each(results, function (result) {
23197 callbacksDone = callbacksDone.then(function () {
23198 return callback(result);
23199 });
23200 });
23201
23202 return callbacksDone.then(function () {
23203 if (results.length >= query._limit) {
23204 query.greaterThan('objectId', results[results.length - 1].id);
23205 } else {
23206 finished = true;
23207 }
23208 });
23209 });
23210 });
23211 },
23212
23213 /**
23214 * Subscribe the changes of this query.
23215 *
23216 * LiveQuery is not included in the default bundle: {@link https://url.leanapp.cn/enable-live-query}.
23217 *
23218 * @since 3.0.0
23219 * @return {AV.LiveQuery} An eventemitter which can be used to get LiveQuery updates;
23220 */
23221 subscribe: function subscribe(options) {
23222 return AV.LiveQuery.init(this, options);
23223 }
23224 });
23225
23226 AV.FriendShipQuery = AV.Query._extend({
23227 _newObject: function _newObject() {
23228 var UserClass = AV.Object._getSubclass('_User');
23229
23230 return new UserClass();
23231 },
23232 _processResult: function _processResult(json) {
23233 if (json && json[this._friendshipTag]) {
23234 var user = json[this._friendshipTag];
23235
23236 if (user.__type === 'Pointer' && user.className === '_User') {
23237 delete user.__type;
23238 delete user.className;
23239 }
23240
23241 return user;
23242 } else {
23243 return null;
23244 }
23245 }
23246 });
23247};
23248
23249/***/ }),
23250/* 562 */
23251/***/ (function(module, exports, __webpack_require__) {
23252
23253"use strict";
23254
23255
23256var _interopRequireDefault = __webpack_require__(1);
23257
23258var _promise = _interopRequireDefault(__webpack_require__(12));
23259
23260var _keys = _interopRequireDefault(__webpack_require__(62));
23261
23262var _ = __webpack_require__(3);
23263
23264var EventEmitter = __webpack_require__(234);
23265
23266var _require = __webpack_require__(32),
23267 inherits = _require.inherits;
23268
23269var _require2 = __webpack_require__(28),
23270 request = _require2.request;
23271
23272var subscribe = function subscribe(queryJSON, subscriptionId) {
23273 return request({
23274 method: 'POST',
23275 path: '/LiveQuery/subscribe',
23276 data: {
23277 query: queryJSON,
23278 id: subscriptionId
23279 }
23280 });
23281};
23282
23283module.exports = function (AV) {
23284 var requireRealtime = function requireRealtime() {
23285 if (!AV._config.realtime) {
23286 throw new Error('LiveQuery not supported. Please use the LiveQuery bundle. https://url.leanapp.cn/enable-live-query');
23287 }
23288 };
23289 /**
23290 * @class
23291 * A LiveQuery, created by {@link AV.Query#subscribe} is an EventEmitter notifies changes of the Query.
23292 * @since 3.0.0
23293 */
23294
23295
23296 AV.LiveQuery = inherits(EventEmitter,
23297 /** @lends AV.LiveQuery.prototype */
23298 {
23299 constructor: function constructor(id, client, queryJSON, subscriptionId) {
23300 var _this = this;
23301
23302 EventEmitter.apply(this);
23303 this.id = id;
23304 this._client = client;
23305
23306 this._client.register(this);
23307
23308 this._queryJSON = queryJSON;
23309 this._subscriptionId = subscriptionId;
23310 this._onMessage = this._dispatch.bind(this);
23311
23312 this._onReconnect = function () {
23313 subscribe(_this._queryJSON, _this._subscriptionId).catch(function (error) {
23314 return console.error("LiveQuery resubscribe error: ".concat(error.message));
23315 });
23316 };
23317
23318 client.on('message', this._onMessage);
23319 client.on('reconnect', this._onReconnect);
23320 },
23321 _dispatch: function _dispatch(message) {
23322 var _this2 = this;
23323
23324 message.forEach(function (_ref) {
23325 var op = _ref.op,
23326 object = _ref.object,
23327 queryId = _ref.query_id,
23328 updatedKeys = _ref.updatedKeys;
23329 if (queryId !== _this2.id) return;
23330 var target = AV.parseJSON(_.extend({
23331 __type: object.className === '_File' ? 'File' : 'Object'
23332 }, object));
23333
23334 if (updatedKeys) {
23335 /**
23336 * An existing AV.Object which fulfills the Query you subscribe is updated.
23337 * @event AV.LiveQuery#update
23338 * @param {AV.Object|AV.File} target updated object
23339 * @param {String[]} updatedKeys updated keys
23340 */
23341
23342 /**
23343 * An existing AV.Object which doesn't fulfill the Query is updated and now it fulfills the Query.
23344 * @event AV.LiveQuery#enter
23345 * @param {AV.Object|AV.File} target updated object
23346 * @param {String[]} updatedKeys updated keys
23347 */
23348
23349 /**
23350 * An existing AV.Object which fulfills the Query is updated and now it doesn't fulfill the Query.
23351 * @event AV.LiveQuery#leave
23352 * @param {AV.Object|AV.File} target updated object
23353 * @param {String[]} updatedKeys updated keys
23354 */
23355 _this2.emit(op, target, updatedKeys);
23356 } else {
23357 /**
23358 * A new AV.Object which fulfills the Query you subscribe is created.
23359 * @event AV.LiveQuery#create
23360 * @param {AV.Object|AV.File} target updated object
23361 */
23362
23363 /**
23364 * An existing AV.Object which fulfills the Query you subscribe is deleted.
23365 * @event AV.LiveQuery#delete
23366 * @param {AV.Object|AV.File} target updated object
23367 */
23368 _this2.emit(op, target);
23369 }
23370 });
23371 },
23372
23373 /**
23374 * unsubscribe the query
23375 *
23376 * @return {Promise}
23377 */
23378 unsubscribe: function unsubscribe() {
23379 var client = this._client;
23380 client.off('message', this._onMessage);
23381 client.off('reconnect', this._onReconnect);
23382 client.deregister(this);
23383 return request({
23384 method: 'POST',
23385 path: '/LiveQuery/unsubscribe',
23386 data: {
23387 id: client.id,
23388 query_id: this.id
23389 }
23390 });
23391 }
23392 },
23393 /** @lends AV.LiveQuery */
23394 {
23395 init: function init(query) {
23396 var _ref2 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
23397 _ref2$subscriptionId = _ref2.subscriptionId,
23398 userDefinedSubscriptionId = _ref2$subscriptionId === void 0 ? AV._getSubscriptionId() : _ref2$subscriptionId;
23399
23400 requireRealtime();
23401 if (!(query instanceof AV.Query)) throw new TypeError('LiveQuery must be inited with a Query');
23402 return _promise.default.resolve(userDefinedSubscriptionId).then(function (subscriptionId) {
23403 return AV._config.realtime.createLiveQueryClient(subscriptionId).then(function (liveQueryClient) {
23404 var _query$_getParams = query._getParams(),
23405 where = _query$_getParams.where,
23406 keys = (0, _keys.default)(_query$_getParams),
23407 returnACL = _query$_getParams.returnACL;
23408
23409 var queryJSON = {
23410 where: where,
23411 keys: keys,
23412 returnACL: returnACL,
23413 className: query.className
23414 };
23415 var promise = subscribe(queryJSON, subscriptionId).then(function (_ref3) {
23416 var queryId = _ref3.query_id;
23417 return new AV.LiveQuery(queryId, liveQueryClient, queryJSON, subscriptionId);
23418 }).finally(function () {
23419 liveQueryClient.deregister(promise);
23420 });
23421 liveQueryClient.register(promise);
23422 return promise;
23423 });
23424 });
23425 },
23426
23427 /**
23428 * Pause the LiveQuery connection. This is useful to deactivate the SDK when the app is swtiched to background.
23429 * @static
23430 * @return void
23431 */
23432 pause: function pause() {
23433 requireRealtime();
23434 return AV._config.realtime.pause();
23435 },
23436
23437 /**
23438 * Resume the LiveQuery connection. All subscriptions will be restored after reconnection.
23439 * @static
23440 * @return void
23441 */
23442 resume: function resume() {
23443 requireRealtime();
23444 return AV._config.realtime.resume();
23445 }
23446 });
23447};
23448
23449/***/ }),
23450/* 563 */
23451/***/ (function(module, exports, __webpack_require__) {
23452
23453"use strict";
23454
23455
23456var _ = __webpack_require__(3);
23457
23458var _require = __webpack_require__(32),
23459 tap = _require.tap;
23460
23461module.exports = function (AV) {
23462 /**
23463 * @class
23464 * @example
23465 * AV.Captcha.request().then(captcha => {
23466 * captcha.bind({
23467 * textInput: 'code', // the id for textInput
23468 * image: 'captcha',
23469 * verifyButton: 'verify',
23470 * }, {
23471 * success: (validateCode) => {}, // next step
23472 * error: (error) => {}, // present error.message to user
23473 * });
23474 * });
23475 */
23476 AV.Captcha = function Captcha(options, authOptions) {
23477 this._options = options;
23478 this._authOptions = authOptions;
23479 /**
23480 * The image url of the captcha
23481 * @type string
23482 */
23483
23484 this.url = undefined;
23485 /**
23486 * The captchaToken of the captcha.
23487 * @type string
23488 */
23489
23490 this.captchaToken = undefined;
23491 /**
23492 * The validateToken of the captcha.
23493 * @type string
23494 */
23495
23496 this.validateToken = undefined;
23497 };
23498 /**
23499 * Refresh the captcha
23500 * @return {Promise.<string>} a new capcha url
23501 */
23502
23503
23504 AV.Captcha.prototype.refresh = function refresh() {
23505 var _this = this;
23506
23507 return AV.Cloud._requestCaptcha(this._options, this._authOptions).then(function (_ref) {
23508 var captchaToken = _ref.captchaToken,
23509 url = _ref.url;
23510
23511 _.extend(_this, {
23512 captchaToken: captchaToken,
23513 url: url
23514 });
23515
23516 return url;
23517 });
23518 };
23519 /**
23520 * Verify the captcha
23521 * @param {String} code The code from user input
23522 * @return {Promise.<string>} validateToken if the code is valid
23523 */
23524
23525
23526 AV.Captcha.prototype.verify = function verify(code) {
23527 var _this2 = this;
23528
23529 return AV.Cloud.verifyCaptcha(code, this.captchaToken).then(tap(function (validateToken) {
23530 return _this2.validateToken = validateToken;
23531 }));
23532 };
23533
23534 if (true) {
23535 /**
23536 * Bind the captcha to HTMLElements. <b>ONLY AVAILABLE in browsers</b>.
23537 * @param [elements]
23538 * @param {String|HTMLInputElement} [elements.textInput] An input element typed text, or the id for the element.
23539 * @param {String|HTMLImageElement} [elements.image] An image element, or the id for the element.
23540 * @param {String|HTMLElement} [elements.verifyButton] A button element, or the id for the element.
23541 * @param [callbacks]
23542 * @param {Function} [callbacks.success] Success callback will be called if the code is verified. The param `validateCode` can be used for further SMS request.
23543 * @param {Function} [callbacks.error] Error callback will be called if something goes wrong, detailed in param `error.message`.
23544 */
23545 AV.Captcha.prototype.bind = function bind(_ref2, _ref3) {
23546 var _this3 = this;
23547
23548 var textInput = _ref2.textInput,
23549 image = _ref2.image,
23550 verifyButton = _ref2.verifyButton;
23551 var success = _ref3.success,
23552 error = _ref3.error;
23553
23554 if (typeof textInput === 'string') {
23555 textInput = document.getElementById(textInput);
23556 if (!textInput) throw new Error("textInput with id ".concat(textInput, " not found"));
23557 }
23558
23559 if (typeof image === 'string') {
23560 image = document.getElementById(image);
23561 if (!image) throw new Error("image with id ".concat(image, " not found"));
23562 }
23563
23564 if (typeof verifyButton === 'string') {
23565 verifyButton = document.getElementById(verifyButton);
23566 if (!verifyButton) throw new Error("verifyButton with id ".concat(verifyButton, " not found"));
23567 }
23568
23569 this.__refresh = function () {
23570 return _this3.refresh().then(function (url) {
23571 image.src = url;
23572
23573 if (textInput) {
23574 textInput.value = '';
23575 textInput.focus();
23576 }
23577 }).catch(function (err) {
23578 return console.warn("refresh captcha fail: ".concat(err.message));
23579 });
23580 };
23581
23582 if (image) {
23583 this.__image = image;
23584 image.src = this.url;
23585 image.addEventListener('click', this.__refresh);
23586 }
23587
23588 this.__verify = function () {
23589 var code = textInput.value;
23590
23591 _this3.verify(code).catch(function (err) {
23592 _this3.__refresh();
23593
23594 throw err;
23595 }).then(success, error).catch(function (err) {
23596 return console.warn("verify captcha fail: ".concat(err.message));
23597 });
23598 };
23599
23600 if (textInput && verifyButton) {
23601 this.__verifyButton = verifyButton;
23602 verifyButton.addEventListener('click', this.__verify);
23603 }
23604 };
23605 /**
23606 * unbind the captcha from HTMLElements. <b>ONLY AVAILABLE in browsers</b>.
23607 */
23608
23609
23610 AV.Captcha.prototype.unbind = function unbind() {
23611 if (this.__image) this.__image.removeEventListener('click', this.__refresh);
23612 if (this.__verifyButton) this.__verifyButton.removeEventListener('click', this.__verify);
23613 };
23614 }
23615 /**
23616 * Request a captcha
23617 * @param [options]
23618 * @param {Number} [options.width] width(px) of the captcha, ranged 60-200
23619 * @param {Number} [options.height] height(px) of the captcha, ranged 30-100
23620 * @param {Number} [options.size=4] length of the captcha, ranged 3-6. MasterKey required.
23621 * @param {Number} [options.ttl=60] time to live(s), ranged 10-180. MasterKey required.
23622 * @return {Promise.<AV.Captcha>}
23623 */
23624
23625
23626 AV.Captcha.request = function (options, authOptions) {
23627 var captcha = new AV.Captcha(options, authOptions);
23628 return captcha.refresh().then(function () {
23629 return captcha;
23630 });
23631 };
23632};
23633
23634/***/ }),
23635/* 564 */
23636/***/ (function(module, exports, __webpack_require__) {
23637
23638"use strict";
23639
23640
23641var _interopRequireDefault = __webpack_require__(1);
23642
23643var _promise = _interopRequireDefault(__webpack_require__(12));
23644
23645var _ = __webpack_require__(3);
23646
23647var _require = __webpack_require__(28),
23648 _request = _require._request,
23649 request = _require.request;
23650
23651module.exports = function (AV) {
23652 /**
23653 * Contains functions for calling and declaring
23654 * <p><strong><em>
23655 * Some functions are only available from Cloud Code.
23656 * </em></strong></p>
23657 *
23658 * @namespace
23659 * @borrows AV.Captcha.request as requestCaptcha
23660 */
23661 AV.Cloud = AV.Cloud || {};
23662
23663 _.extend(AV.Cloud,
23664 /** @lends AV.Cloud */
23665 {
23666 /**
23667 * Makes a call to a cloud function.
23668 * @param {String} name The function name.
23669 * @param {Object} [data] The parameters to send to the cloud function.
23670 * @param {AuthOptions} [options]
23671 * @return {Promise} A promise that will be resolved with the result
23672 * of the function.
23673 */
23674 run: function run(name, data, options) {
23675 return request({
23676 service: 'engine',
23677 method: 'POST',
23678 path: "/functions/".concat(name),
23679 data: AV._encode(data, null, true),
23680 authOptions: options
23681 }).then(function (resp) {
23682 return AV._decode(resp).result;
23683 });
23684 },
23685
23686 /**
23687 * Makes a call to a cloud function, you can send {AV.Object} as param or a field of param; the response
23688 * from server will also be parsed as an {AV.Object}, array of {AV.Object}, or object includes {AV.Object}
23689 * @param {String} name The function name.
23690 * @param {Object} [data] The parameters to send to the cloud function.
23691 * @param {AuthOptions} [options]
23692 * @return {Promise} A promise that will be resolved with the result of the function.
23693 */
23694 rpc: function rpc(name, data, options) {
23695 if (_.isArray(data)) {
23696 return _promise.default.reject(new Error("Can't pass Array as the param of rpc function in JavaScript SDK."));
23697 }
23698
23699 return request({
23700 service: 'engine',
23701 method: 'POST',
23702 path: "/call/".concat(name),
23703 data: AV._encodeObjectOrArray(data),
23704 authOptions: options
23705 }).then(function (resp) {
23706 return AV._decode(resp).result;
23707 });
23708 },
23709
23710 /**
23711 * Make a call to request server date time.
23712 * @return {Promise.<Date>} A promise that will be resolved with the result
23713 * of the function.
23714 * @since 0.5.9
23715 */
23716 getServerDate: function getServerDate() {
23717 return _request('date', null, null, 'GET').then(function (resp) {
23718 return AV._decode(resp);
23719 });
23720 },
23721
23722 /**
23723 * Makes a call to request an sms code for operation verification.
23724 * @param {String|Object} data The mobile phone number string or a JSON
23725 * object that contains mobilePhoneNumber,template,sign,op,ttl,name etc.
23726 * @param {String} data.mobilePhoneNumber
23727 * @param {String} [data.template] sms template name
23728 * @param {String} [data.sign] sms signature name
23729 * @param {String} [data.smsType] sending code by `sms` (default) or `voice` call
23730 * @param {SMSAuthOptions} [options]
23731 * @return {Promise} A promise that will be resolved if the request succeed
23732 */
23733 requestSmsCode: function requestSmsCode(data) {
23734 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
23735
23736 if (_.isString(data)) {
23737 data = {
23738 mobilePhoneNumber: data
23739 };
23740 }
23741
23742 if (!data.mobilePhoneNumber) {
23743 throw new Error('Missing mobilePhoneNumber.');
23744 }
23745
23746 if (options.validateToken) {
23747 data = _.extend({}, data, {
23748 validate_token: options.validateToken
23749 });
23750 }
23751
23752 return _request('requestSmsCode', null, null, 'POST', data, options);
23753 },
23754
23755 /**
23756 * Makes a call to verify sms code that sent by AV.Cloud.requestSmsCode
23757 * @param {String} code The sms code sent by AV.Cloud.requestSmsCode
23758 * @param {phone} phone The mobile phoner number.
23759 * @return {Promise} A promise that will be resolved with the result
23760 * of the function.
23761 */
23762 verifySmsCode: function verifySmsCode(code, phone) {
23763 if (!code) throw new Error('Missing sms code.');
23764 var params = {};
23765
23766 if (_.isString(phone)) {
23767 params['mobilePhoneNumber'] = phone;
23768 }
23769
23770 return _request('verifySmsCode', code, null, 'POST', params);
23771 },
23772 _requestCaptcha: function _requestCaptcha(options, authOptions) {
23773 return _request('requestCaptcha', null, null, 'GET', options, authOptions).then(function (_ref) {
23774 var url = _ref.captcha_url,
23775 captchaToken = _ref.captcha_token;
23776 return {
23777 captchaToken: captchaToken,
23778 url: url
23779 };
23780 });
23781 },
23782
23783 /**
23784 * Request a captcha.
23785 */
23786 requestCaptcha: AV.Captcha.request,
23787
23788 /**
23789 * Verify captcha code. This is the low-level API for captcha.
23790 * Checkout {@link AV.Captcha} for high abstract APIs.
23791 * @param {String} code the code from user input
23792 * @param {String} captchaToken captchaToken returned by {@link AV.Cloud.requestCaptcha}
23793 * @return {Promise.<String>} validateToken if the code is valid
23794 */
23795 verifyCaptcha: function verifyCaptcha(code, captchaToken) {
23796 return _request('verifyCaptcha', null, null, 'POST', {
23797 captcha_code: code,
23798 captcha_token: captchaToken
23799 }).then(function (_ref2) {
23800 var validateToken = _ref2.validate_token;
23801 return validateToken;
23802 });
23803 }
23804 });
23805};
23806
23807/***/ }),
23808/* 565 */
23809/***/ (function(module, exports, __webpack_require__) {
23810
23811"use strict";
23812
23813
23814var request = __webpack_require__(28).request;
23815
23816module.exports = function (AV) {
23817 AV.Installation = AV.Object.extend('_Installation');
23818 /**
23819 * @namespace
23820 */
23821
23822 AV.Push = AV.Push || {};
23823 /**
23824 * Sends a push notification.
23825 * @param {Object} data The data of the push notification.
23826 * @param {String[]} [data.channels] An Array of channels to push to.
23827 * @param {Date} [data.push_time] A Date object for when to send the push.
23828 * @param {Date} [data.expiration_time] A Date object for when to expire
23829 * the push.
23830 * @param {Number} [data.expiration_interval] The seconds from now to expire the push.
23831 * @param {Number} [data.flow_control] The clients to notify per second
23832 * @param {AV.Query} [data.where] An AV.Query over AV.Installation that is used to match
23833 * a set of installations to push to.
23834 * @param {String} [data.cql] A CQL statement over AV.Installation that is used to match
23835 * a set of installations to push to.
23836 * @param {Object} data.data The data to send as part of the push.
23837 More details: https://url.leanapp.cn/pushData
23838 * @param {AuthOptions} [options]
23839 * @return {Promise}
23840 */
23841
23842 AV.Push.send = function (data, options) {
23843 if (data.where) {
23844 data.where = data.where._getParams().where;
23845 }
23846
23847 if (data.where && data.cql) {
23848 throw new Error("Both where and cql can't be set");
23849 }
23850
23851 if (data.push_time) {
23852 data.push_time = data.push_time.toJSON();
23853 }
23854
23855 if (data.expiration_time) {
23856 data.expiration_time = data.expiration_time.toJSON();
23857 }
23858
23859 if (data.expiration_time && data.expiration_interval) {
23860 throw new Error("Both expiration_time and expiration_interval can't be set");
23861 }
23862
23863 return request({
23864 service: 'push',
23865 method: 'POST',
23866 path: '/push',
23867 data: data,
23868 authOptions: options
23869 });
23870 };
23871};
23872
23873/***/ }),
23874/* 566 */
23875/***/ (function(module, exports, __webpack_require__) {
23876
23877"use strict";
23878
23879
23880var _interopRequireDefault = __webpack_require__(1);
23881
23882var _promise = _interopRequireDefault(__webpack_require__(12));
23883
23884var _typeof2 = _interopRequireDefault(__webpack_require__(95));
23885
23886var _ = __webpack_require__(3);
23887
23888var AVRequest = __webpack_require__(28)._request;
23889
23890var _require = __webpack_require__(32),
23891 getSessionToken = _require.getSessionToken;
23892
23893module.exports = function (AV) {
23894 var getUser = function getUser() {
23895 var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
23896 var sessionToken = getSessionToken(options);
23897
23898 if (sessionToken) {
23899 return AV.User._fetchUserBySessionToken(getSessionToken(options));
23900 }
23901
23902 return AV.User.currentAsync();
23903 };
23904
23905 var getUserPointer = function getUserPointer(options) {
23906 return getUser(options).then(function (currUser) {
23907 return AV.Object.createWithoutData('_User', currUser.id)._toPointer();
23908 });
23909 };
23910 /**
23911 * Contains functions to deal with Status in LeanCloud.
23912 * @class
23913 */
23914
23915
23916 AV.Status = function (imageUrl, message) {
23917 this.data = {};
23918 this.inboxType = 'default';
23919 this.query = null;
23920
23921 if (imageUrl && (0, _typeof2.default)(imageUrl) === 'object') {
23922 this.data = imageUrl;
23923 } else {
23924 if (imageUrl) {
23925 this.data.image = imageUrl;
23926 }
23927
23928 if (message) {
23929 this.data.message = message;
23930 }
23931 }
23932
23933 return this;
23934 };
23935
23936 _.extend(AV.Status.prototype,
23937 /** @lends AV.Status.prototype */
23938 {
23939 /**
23940 * Gets the value of an attribute in status data.
23941 * @param {String} attr The string name of an attribute.
23942 */
23943 get: function get(attr) {
23944 return this.data[attr];
23945 },
23946
23947 /**
23948 * Sets a hash of model attributes on the status data.
23949 * @param {String} key The key to set.
23950 * @param {any} value The value to give it.
23951 */
23952 set: function set(key, value) {
23953 this.data[key] = value;
23954 return this;
23955 },
23956
23957 /**
23958 * Destroy this status,then it will not be avaiable in other user's inboxes.
23959 * @param {AuthOptions} options
23960 * @return {Promise} A promise that is fulfilled when the destroy
23961 * completes.
23962 */
23963 destroy: function destroy(options) {
23964 if (!this.id) return _promise.default.reject(new Error('The status id is not exists.'));
23965 var request = AVRequest('statuses', null, this.id, 'DELETE', options);
23966 return request;
23967 },
23968
23969 /**
23970 * Cast the AV.Status object to an AV.Object pointer.
23971 * @return {AV.Object} A AV.Object pointer.
23972 */
23973 toObject: function toObject() {
23974 if (!this.id) return null;
23975 return AV.Object.createWithoutData('_Status', this.id);
23976 },
23977 _getDataJSON: function _getDataJSON() {
23978 var json = _.clone(this.data);
23979
23980 return AV._encode(json);
23981 },
23982
23983 /**
23984 * Send a status by a AV.Query object.
23985 * @since 0.3.0
23986 * @param {AuthOptions} options
23987 * @return {Promise} A promise that is fulfilled when the send
23988 * completes.
23989 * @example
23990 * // send a status to male users
23991 * var status = new AVStatus('image url', 'a message');
23992 * status.query = new AV.Query('_User');
23993 * status.query.equalTo('gender', 'male');
23994 * status.send().then(function(){
23995 * //send status successfully.
23996 * }, function(err){
23997 * //an error threw.
23998 * console.dir(err);
23999 * });
24000 */
24001 send: function send() {
24002 var _this = this;
24003
24004 var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
24005
24006 if (!getSessionToken(options) && !AV.User.current()) {
24007 throw new Error('Please signin an user.');
24008 }
24009
24010 if (!this.query) {
24011 return AV.Status.sendStatusToFollowers(this, options);
24012 }
24013
24014 return getUserPointer(options).then(function (currUser) {
24015 var query = _this.query._getParams();
24016
24017 query.className = _this.query.className;
24018 var data = {};
24019 data.query = query;
24020 _this.data = _this.data || {};
24021 _this.data.source = _this.data.source || currUser;
24022 data.data = _this._getDataJSON();
24023 data.inboxType = _this.inboxType || 'default';
24024 return AVRequest('statuses', null, null, 'POST', data, options);
24025 }).then(function (response) {
24026 _this.id = response.objectId;
24027 _this.createdAt = AV._parseDate(response.createdAt);
24028 return _this;
24029 });
24030 },
24031 _finishFetch: function _finishFetch(serverData) {
24032 this.id = serverData.objectId;
24033 this.createdAt = AV._parseDate(serverData.createdAt);
24034 this.updatedAt = AV._parseDate(serverData.updatedAt);
24035 this.messageId = serverData.messageId;
24036 delete serverData.messageId;
24037 delete serverData.objectId;
24038 delete serverData.createdAt;
24039 delete serverData.updatedAt;
24040 this.data = AV._decode(serverData);
24041 }
24042 });
24043 /**
24044 * Send a status to current signined user's followers.
24045 * @since 0.3.0
24046 * @param {AV.Status} status A status object to be send to followers.
24047 * @param {AuthOptions} options
24048 * @return {Promise} A promise that is fulfilled when the send
24049 * completes.
24050 * @example
24051 * var status = new AVStatus('image url', 'a message');
24052 * AV.Status.sendStatusToFollowers(status).then(function(){
24053 * //send status successfully.
24054 * }, function(err){
24055 * //an error threw.
24056 * console.dir(err);
24057 * });
24058 */
24059
24060
24061 AV.Status.sendStatusToFollowers = function (status) {
24062 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
24063
24064 if (!getSessionToken(options) && !AV.User.current()) {
24065 throw new Error('Please signin an user.');
24066 }
24067
24068 return getUserPointer(options).then(function (currUser) {
24069 var query = {};
24070 query.className = '_Follower';
24071 query.keys = 'follower';
24072 query.where = {
24073 user: currUser
24074 };
24075 var data = {};
24076 data.query = query;
24077 status.data = status.data || {};
24078 status.data.source = status.data.source || currUser;
24079 data.data = status._getDataJSON();
24080 data.inboxType = status.inboxType || 'default';
24081 var request = AVRequest('statuses', null, null, 'POST', data, options);
24082 return request.then(function (response) {
24083 status.id = response.objectId;
24084 status.createdAt = AV._parseDate(response.createdAt);
24085 return status;
24086 });
24087 });
24088 };
24089 /**
24090 * <p>Send a status from current signined user to other user's private status inbox.</p>
24091 * @since 0.3.0
24092 * @param {AV.Status} status A status object to be send to followers.
24093 * @param {String} target The target user or user's objectId.
24094 * @param {AuthOptions} options
24095 * @return {Promise} A promise that is fulfilled when the send
24096 * completes.
24097 * @example
24098 * // send a private status to user '52e84e47e4b0f8de283b079b'
24099 * var status = new AVStatus('image url', 'a message');
24100 * AV.Status.sendPrivateStatus(status, '52e84e47e4b0f8de283b079b').then(function(){
24101 * //send status successfully.
24102 * }, function(err){
24103 * //an error threw.
24104 * console.dir(err);
24105 * });
24106 */
24107
24108
24109 AV.Status.sendPrivateStatus = function (status, target) {
24110 var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
24111
24112 if (!getSessionToken(options) && !AV.User.current()) {
24113 throw new Error('Please signin an user.');
24114 }
24115
24116 if (!target) {
24117 throw new Error('Invalid target user.');
24118 }
24119
24120 var userObjectId = _.isString(target) ? target : target.id;
24121
24122 if (!userObjectId) {
24123 throw new Error('Invalid target user.');
24124 }
24125
24126 return getUserPointer(options).then(function (currUser) {
24127 var query = {};
24128 query.className = '_User';
24129 query.where = {
24130 objectId: userObjectId
24131 };
24132 var data = {};
24133 data.query = query;
24134 status.data = status.data || {};
24135 status.data.source = status.data.source || currUser;
24136 data.data = status._getDataJSON();
24137 data.inboxType = 'private';
24138 status.inboxType = 'private';
24139 var request = AVRequest('statuses', null, null, 'POST', data, options);
24140 return request.then(function (response) {
24141 status.id = response.objectId;
24142 status.createdAt = AV._parseDate(response.createdAt);
24143 return status;
24144 });
24145 });
24146 };
24147 /**
24148 * Count unread statuses in someone's inbox.
24149 * @since 0.3.0
24150 * @param {AV.User} owner The status owner.
24151 * @param {String} inboxType The inbox type, 'default' by default.
24152 * @param {AuthOptions} options
24153 * @return {Promise} A promise that is fulfilled when the count
24154 * completes.
24155 * @example
24156 * AV.Status.countUnreadStatuses(AV.User.current()).then(function(response){
24157 * console.log(response.unread); //unread statuses number.
24158 * console.log(response.total); //total statuses number.
24159 * });
24160 */
24161
24162
24163 AV.Status.countUnreadStatuses = function (owner) {
24164 var inboxType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'default';
24165 var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
24166 if (!_.isString(inboxType)) options = inboxType;
24167
24168 if (!getSessionToken(options) && owner == null && !AV.User.current()) {
24169 throw new Error('Please signin an user or pass the owner objectId.');
24170 }
24171
24172 return _promise.default.resolve(owner || getUser(options)).then(function (owner) {
24173 var params = {};
24174 params.inboxType = AV._encode(inboxType);
24175 params.owner = AV._encode(owner);
24176 return AVRequest('subscribe/statuses/count', null, null, 'GET', params, options);
24177 });
24178 };
24179 /**
24180 * reset unread statuses count in someone's inbox.
24181 * @since 2.1.0
24182 * @param {AV.User} owner The status owner.
24183 * @param {String} inboxType The inbox type, 'default' by default.
24184 * @param {AuthOptions} options
24185 * @return {Promise} A promise that is fulfilled when the reset
24186 * completes.
24187 * @example
24188 * AV.Status.resetUnreadCount(AV.User.current()).then(function(response){
24189 * console.log(response.unread); //unread statuses number.
24190 * console.log(response.total); //total statuses number.
24191 * });
24192 */
24193
24194
24195 AV.Status.resetUnreadCount = function (owner) {
24196 var inboxType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'default';
24197 var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
24198 if (!_.isString(inboxType)) options = inboxType;
24199
24200 if (!getSessionToken(options) && owner == null && !AV.User.current()) {
24201 throw new Error('Please signin an user or pass the owner objectId.');
24202 }
24203
24204 return _promise.default.resolve(owner || getUser(options)).then(function (owner) {
24205 var params = {};
24206 params.inboxType = AV._encode(inboxType);
24207 params.owner = AV._encode(owner);
24208 return AVRequest('subscribe/statuses/resetUnreadCount', null, null, 'POST', params, options);
24209 });
24210 };
24211 /**
24212 * Create a status query to find someone's published statuses.
24213 * @since 0.3.0
24214 * @param {AV.User} source The status source, typically the publisher.
24215 * @return {AV.Query} The query object for status.
24216 * @example
24217 * //Find current user's published statuses.
24218 * var query = AV.Status.statusQuery(AV.User.current());
24219 * query.find().then(function(statuses){
24220 * //process statuses
24221 * });
24222 */
24223
24224
24225 AV.Status.statusQuery = function (source) {
24226 var query = new AV.Query('_Status');
24227
24228 if (source) {
24229 query.equalTo('source', source);
24230 }
24231
24232 return query;
24233 };
24234 /**
24235 * <p>AV.InboxQuery defines a query that is used to fetch somebody's inbox statuses.</p>
24236 * @class
24237 */
24238
24239
24240 AV.InboxQuery = AV.Query._extend(
24241 /** @lends AV.InboxQuery.prototype */
24242 {
24243 _objectClass: AV.Status,
24244 _sinceId: 0,
24245 _maxId: 0,
24246 _inboxType: 'default',
24247 _owner: null,
24248 _newObject: function _newObject() {
24249 return new AV.Status();
24250 },
24251 _createRequest: function _createRequest(params, options) {
24252 return AV.InboxQuery.__super__._createRequest.call(this, params, options, '/subscribe/statuses');
24253 },
24254
24255 /**
24256 * Sets the messageId of results to skip before returning any results.
24257 * This is useful for pagination.
24258 * Default is zero.
24259 * @param {Number} n the mesage id.
24260 * @return {AV.InboxQuery} Returns the query, so you can chain this call.
24261 */
24262 sinceId: function sinceId(id) {
24263 this._sinceId = id;
24264 return this;
24265 },
24266
24267 /**
24268 * Sets the maximal messageId of results。
24269 * This is useful for pagination.
24270 * Default is zero that is no limition.
24271 * @param {Number} n the mesage id.
24272 * @return {AV.InboxQuery} Returns the query, so you can chain this call.
24273 */
24274 maxId: function maxId(id) {
24275 this._maxId = id;
24276 return this;
24277 },
24278
24279 /**
24280 * Sets the owner of the querying inbox.
24281 * @param {AV.User} owner The inbox owner.
24282 * @return {AV.InboxQuery} Returns the query, so you can chain this call.
24283 */
24284 owner: function owner(_owner) {
24285 this._owner = _owner;
24286 return this;
24287 },
24288
24289 /**
24290 * Sets the querying inbox type.default is 'default'.
24291 * @param {String} type The inbox type.
24292 * @return {AV.InboxQuery} Returns the query, so you can chain this call.
24293 */
24294 inboxType: function inboxType(type) {
24295 this._inboxType = type;
24296 return this;
24297 },
24298 _getParams: function _getParams() {
24299 var params = AV.InboxQuery.__super__._getParams.call(this);
24300
24301 params.owner = AV._encode(this._owner);
24302 params.inboxType = AV._encode(this._inboxType);
24303 params.sinceId = AV._encode(this._sinceId);
24304 params.maxId = AV._encode(this._maxId);
24305 return params;
24306 }
24307 });
24308 /**
24309 * Create a inbox status query to find someone's inbox statuses.
24310 * @since 0.3.0
24311 * @param {AV.User} owner The inbox's owner
24312 * @param {String} inboxType The inbox type,'default' by default.
24313 * @return {AV.InboxQuery} The inbox query object.
24314 * @see AV.InboxQuery
24315 * @example
24316 * //Find current user's default inbox statuses.
24317 * var query = AV.Status.inboxQuery(AV.User.current());
24318 * //find the statuses after the last message id
24319 * query.sinceId(lastMessageId);
24320 * query.find().then(function(statuses){
24321 * //process statuses
24322 * });
24323 */
24324
24325 AV.Status.inboxQuery = function (owner, inboxType) {
24326 var query = new AV.InboxQuery(AV.Status);
24327
24328 if (owner) {
24329 query._owner = owner;
24330 }
24331
24332 if (inboxType) {
24333 query._inboxType = inboxType;
24334 }
24335
24336 return query;
24337 };
24338};
24339
24340/***/ }),
24341/* 567 */
24342/***/ (function(module, exports, __webpack_require__) {
24343
24344"use strict";
24345
24346
24347var _interopRequireDefault = __webpack_require__(1);
24348
24349var _stringify = _interopRequireDefault(__webpack_require__(38));
24350
24351var _map = _interopRequireDefault(__webpack_require__(37));
24352
24353var _ = __webpack_require__(3);
24354
24355var AVRequest = __webpack_require__(28)._request;
24356
24357module.exports = function (AV) {
24358 /**
24359 * A builder to generate sort string for app searching.For example:
24360 * @class
24361 * @since 0.5.1
24362 * @example
24363 * var builder = new AV.SearchSortBuilder();
24364 * builder.ascending('key1').descending('key2','max');
24365 * var query = new AV.SearchQuery('Player');
24366 * query.sortBy(builder);
24367 * query.find().then();
24368 */
24369 AV.SearchSortBuilder = function () {
24370 this._sortFields = [];
24371 };
24372
24373 _.extend(AV.SearchSortBuilder.prototype,
24374 /** @lends AV.SearchSortBuilder.prototype */
24375 {
24376 _addField: function _addField(key, order, mode, missing) {
24377 var field = {};
24378 field[key] = {
24379 order: order || 'asc',
24380 mode: mode || 'avg',
24381 missing: '_' + (missing || 'last')
24382 };
24383
24384 this._sortFields.push(field);
24385
24386 return this;
24387 },
24388
24389 /**
24390 * Sorts the results in ascending order by the given key and options.
24391 *
24392 * @param {String} key The key to order by.
24393 * @param {String} mode The sort mode, default is 'avg', you can choose
24394 * 'max' or 'min' too.
24395 * @param {String} missing The missing key behaviour, default is 'last',
24396 * you can choose 'first' too.
24397 * @return {AV.SearchSortBuilder} Returns the builder, so you can chain this call.
24398 */
24399 ascending: function ascending(key, mode, missing) {
24400 return this._addField(key, 'asc', mode, missing);
24401 },
24402
24403 /**
24404 * Sorts the results in descending order by the given key and options.
24405 *
24406 * @param {String} key The key to order by.
24407 * @param {String} mode The sort mode, default is 'avg', you can choose
24408 * 'max' or 'min' too.
24409 * @param {String} missing The missing key behaviour, default is 'last',
24410 * you can choose 'first' too.
24411 * @return {AV.SearchSortBuilder} Returns the builder, so you can chain this call.
24412 */
24413 descending: function descending(key, mode, missing) {
24414 return this._addField(key, 'desc', mode, missing);
24415 },
24416
24417 /**
24418 * Add a proximity based constraint for finding objects with key point
24419 * values near the point given.
24420 * @param {String} key The key that the AV.GeoPoint is stored in.
24421 * @param {AV.GeoPoint} point The reference AV.GeoPoint that is used.
24422 * @param {Object} options The other options such as mode,order, unit etc.
24423 * @return {AV.SearchSortBuilder} Returns the builder, so you can chain this call.
24424 */
24425 whereNear: function whereNear(key, point, options) {
24426 options = options || {};
24427 var field = {};
24428 var geo = {
24429 lat: point.latitude,
24430 lon: point.longitude
24431 };
24432 var m = {
24433 order: options.order || 'asc',
24434 mode: options.mode || 'avg',
24435 unit: options.unit || 'km'
24436 };
24437 m[key] = geo;
24438 field['_geo_distance'] = m;
24439
24440 this._sortFields.push(field);
24441
24442 return this;
24443 },
24444
24445 /**
24446 * Build a sort string by configuration.
24447 * @return {String} the sort string.
24448 */
24449 build: function build() {
24450 return (0, _stringify.default)(AV._encode(this._sortFields));
24451 }
24452 });
24453 /**
24454 * App searching query.Use just like AV.Query:
24455 *
24456 * Visit <a href='https://leancloud.cn/docs/app_search_guide.html'>App Searching Guide</a>
24457 * for more details.
24458 * @class
24459 * @since 0.5.1
24460 * @example
24461 * var query = new AV.SearchQuery('Player');
24462 * query.queryString('*');
24463 * query.find().then(function(results) {
24464 * console.log('Found %d objects', query.hits());
24465 * //Process results
24466 * });
24467 */
24468
24469
24470 AV.SearchQuery = AV.Query._extend(
24471 /** @lends AV.SearchQuery.prototype */
24472 {
24473 _sid: null,
24474 _hits: 0,
24475 _queryString: null,
24476 _highlights: null,
24477 _sortBuilder: null,
24478 _clazz: null,
24479 constructor: function constructor(className) {
24480 if (className) {
24481 this._clazz = className;
24482 } else {
24483 className = '__INVALID_CLASS';
24484 }
24485
24486 AV.Query.call(this, className);
24487 },
24488 _createRequest: function _createRequest(params, options) {
24489 return AVRequest('search/select', null, null, 'GET', params || this._getParams(), options);
24490 },
24491
24492 /**
24493 * Sets the sid of app searching query.Default is null.
24494 * @param {String} sid Scroll id for searching.
24495 * @return {AV.SearchQuery} Returns the query, so you can chain this call.
24496 */
24497 sid: function sid(_sid) {
24498 this._sid = _sid;
24499 return this;
24500 },
24501
24502 /**
24503 * Sets the query string of app searching.
24504 * @param {String} q The query string.
24505 * @return {AV.SearchQuery} Returns the query, so you can chain this call.
24506 */
24507 queryString: function queryString(q) {
24508 this._queryString = q;
24509 return this;
24510 },
24511
24512 /**
24513 * Sets the highlight fields. Such as
24514 * <pre><code>
24515 * query.highlights('title');
24516 * //or pass an array.
24517 * query.highlights(['title', 'content'])
24518 * </code></pre>
24519 * @param {String|String[]} highlights a list of fields.
24520 * @return {AV.SearchQuery} Returns the query, so you can chain this call.
24521 */
24522 highlights: function highlights(_highlights) {
24523 var objects;
24524
24525 if (_highlights && _.isString(_highlights)) {
24526 objects = _.toArray(arguments);
24527 } else {
24528 objects = _highlights;
24529 }
24530
24531 this._highlights = objects;
24532 return this;
24533 },
24534
24535 /**
24536 * Sets the sort builder for this query.
24537 * @see AV.SearchSortBuilder
24538 * @param { AV.SearchSortBuilder} builder The sort builder.
24539 * @return {AV.SearchQuery} Returns the query, so you can chain this call.
24540 *
24541 */
24542 sortBy: function sortBy(builder) {
24543 this._sortBuilder = builder;
24544 return this;
24545 },
24546
24547 /**
24548 * Returns the number of objects that match this query.
24549 * @return {Number}
24550 */
24551 hits: function hits() {
24552 if (!this._hits) {
24553 this._hits = 0;
24554 }
24555
24556 return this._hits;
24557 },
24558 _processResult: function _processResult(json) {
24559 delete json['className'];
24560 delete json['_app_url'];
24561 delete json['_deeplink'];
24562 return json;
24563 },
24564
24565 /**
24566 * Returns true when there are more documents can be retrieved by this
24567 * query instance, you can call find function to get more results.
24568 * @see AV.SearchQuery#find
24569 * @return {Boolean}
24570 */
24571 hasMore: function hasMore() {
24572 return !this._hitEnd;
24573 },
24574
24575 /**
24576 * Reset current query instance state(such as sid, hits etc) except params
24577 * for a new searching. After resetting, hasMore() will return true.
24578 */
24579 reset: function reset() {
24580 this._hitEnd = false;
24581 this._sid = null;
24582 this._hits = 0;
24583 },
24584
24585 /**
24586 * Retrieves a list of AVObjects that satisfy this query.
24587 * Either options.success or options.error is called when the find
24588 * completes.
24589 *
24590 * @see AV.Query#find
24591 * @param {AuthOptions} options
24592 * @return {Promise} A promise that is resolved with the results when
24593 * the query completes.
24594 */
24595 find: function find(options) {
24596 var self = this;
24597
24598 var request = this._createRequest(undefined, options);
24599
24600 return request.then(function (response) {
24601 //update sid for next querying.
24602 if (response.sid) {
24603 self._oldSid = self._sid;
24604 self._sid = response.sid;
24605 } else {
24606 self._sid = null;
24607 self._hitEnd = true;
24608 }
24609
24610 self._hits = response.hits || 0;
24611 return (0, _map.default)(_).call(_, response.results, function (json) {
24612 if (json.className) {
24613 response.className = json.className;
24614 }
24615
24616 var obj = self._newObject(response);
24617
24618 obj.appURL = json['_app_url'];
24619
24620 obj._finishFetch(self._processResult(json), true);
24621
24622 return obj;
24623 });
24624 });
24625 },
24626 _getParams: function _getParams() {
24627 var params = AV.SearchQuery.__super__._getParams.call(this);
24628
24629 delete params.where;
24630
24631 if (this._clazz) {
24632 params.clazz = this.className;
24633 }
24634
24635 if (this._sid) {
24636 params.sid = this._sid;
24637 }
24638
24639 if (!this._queryString) {
24640 throw new Error('Please set query string.');
24641 } else {
24642 params.q = this._queryString;
24643 }
24644
24645 if (this._highlights) {
24646 params.highlights = this._highlights.join(',');
24647 }
24648
24649 if (this._sortBuilder && params.order) {
24650 throw new Error('sort and order can not be set at same time.');
24651 }
24652
24653 if (this._sortBuilder) {
24654 params.sort = this._sortBuilder.build();
24655 }
24656
24657 return params;
24658 }
24659 });
24660};
24661/**
24662 * Sorts the results in ascending order by the given key.
24663 *
24664 * @method AV.SearchQuery#ascending
24665 * @param {String} key The key to order by.
24666 * @return {AV.SearchQuery} Returns the query, so you can chain this call.
24667 */
24668
24669/**
24670 * Also sorts the results in ascending order by the given key. The previous sort keys have
24671 * precedence over this key.
24672 *
24673 * @method AV.SearchQuery#addAscending
24674 * @param {String} key The key to order by
24675 * @return {AV.SearchQuery} Returns the query so you can chain this call.
24676 */
24677
24678/**
24679 * Sorts the results in descending order by the given key.
24680 *
24681 * @method AV.SearchQuery#descending
24682 * @param {String} key The key to order by.
24683 * @return {AV.SearchQuery} Returns the query, so you can chain this call.
24684 */
24685
24686/**
24687 * Also sorts the results in descending order by the given key. The previous sort keys have
24688 * precedence over this key.
24689 *
24690 * @method AV.SearchQuery#addDescending
24691 * @param {String} key The key to order by
24692 * @return {AV.SearchQuery} Returns the query so you can chain this call.
24693 */
24694
24695/**
24696 * Include nested AV.Objects for the provided key. You can use dot
24697 * notation to specify which fields in the included object are also fetch.
24698 * @method AV.SearchQuery#include
24699 * @param {String[]} keys The name of the key to include.
24700 * @return {AV.SearchQuery} Returns the query, so you can chain this call.
24701 */
24702
24703/**
24704 * Sets the number of results to skip before returning any results.
24705 * This is useful for pagination.
24706 * Default is to skip zero results.
24707 * @method AV.SearchQuery#skip
24708 * @param {Number} n the number of results to skip.
24709 * @return {AV.SearchQuery} Returns the query, so you can chain this call.
24710 */
24711
24712/**
24713 * Sets the limit of the number of results to return. The default limit is
24714 * 100, with a maximum of 1000 results being returned at a time.
24715 * @method AV.SearchQuery#limit
24716 * @param {Number} n the number of results to limit to.
24717 * @return {AV.SearchQuery} Returns the query, so you can chain this call.
24718 */
24719
24720/***/ }),
24721/* 568 */
24722/***/ (function(module, exports, __webpack_require__) {
24723
24724"use strict";
24725
24726
24727var _interopRequireDefault = __webpack_require__(1);
24728
24729var _promise = _interopRequireDefault(__webpack_require__(12));
24730
24731var _ = __webpack_require__(3);
24732
24733var AVError = __webpack_require__(48);
24734
24735var _require = __webpack_require__(28),
24736 request = _require.request;
24737
24738module.exports = function (AV) {
24739 /**
24740 * 包含了使用了 LeanCloud
24741 * <a href='/docs/leaninsight_guide.html'>离线数据分析功能</a>的函数。
24742 * <p><strong><em>
24743 * 仅在云引擎运行环境下有效。
24744 * </em></strong></p>
24745 * @namespace
24746 */
24747 AV.Insight = AV.Insight || {};
24748
24749 _.extend(AV.Insight,
24750 /** @lends AV.Insight */
24751 {
24752 /**
24753 * 开始一个 Insight 任务。结果里将返回 Job id,你可以拿得到的 id 使用
24754 * AV.Insight.JobQuery 查询任务状态和结果。
24755 * @param {Object} jobConfig 任务配置的 JSON 对象,例如:<code><pre>
24756 * { "sql" : "select count(*) as c,gender from _User group by gender",
24757 * "saveAs": {
24758 * "className" : "UserGender",
24759 * "limit": 1
24760 * }
24761 * }
24762 * </pre></code>
24763 * sql 指定任务执行的 SQL 语句, saveAs(可选) 指定将结果保存在哪张表里,limit 最大 1000。
24764 * @param {AuthOptions} [options]
24765 * @return {Promise} A promise that will be resolved with the result
24766 * of the function.
24767 */
24768 startJob: function startJob(jobConfig, options) {
24769 if (!jobConfig || !jobConfig.sql) {
24770 throw new Error('Please provide the sql to run the job.');
24771 }
24772
24773 var data = {
24774 jobConfig: jobConfig,
24775 appId: AV.applicationId
24776 };
24777 return request({
24778 path: '/bigquery/jobs',
24779 method: 'POST',
24780 data: AV._encode(data, null, true),
24781 authOptions: options,
24782 signKey: false
24783 }).then(function (resp) {
24784 return AV._decode(resp).id;
24785 });
24786 },
24787
24788 /**
24789 * 监听 Insight 任务事件(未来推出独立部署的离线分析服务后开放)
24790 * <p><strong><em>
24791 * 仅在云引擎运行环境下有效。
24792 * </em></strong></p>
24793 * @param {String} event 监听的事件,目前尚不支持。
24794 * @param {Function} 监听回调函数,接收 (err, id) 两个参数,err 表示错误信息,
24795 * id 表示任务 id。接下来你可以拿这个 id 使用AV.Insight.JobQuery 查询任务状态和结果。
24796 *
24797 */
24798 on: function on(event, cb) {}
24799 });
24800 /**
24801 * 创建一个对象,用于查询 Insight 任务状态和结果。
24802 * @class
24803 * @param {String} id 任务 id
24804 * @since 0.5.5
24805 */
24806
24807
24808 AV.Insight.JobQuery = function (id, className) {
24809 if (!id) {
24810 throw new Error('Please provide the job id.');
24811 }
24812
24813 this.id = id;
24814 this.className = className;
24815 this._skip = 0;
24816 this._limit = 100;
24817 };
24818
24819 _.extend(AV.Insight.JobQuery.prototype,
24820 /** @lends AV.Insight.JobQuery.prototype */
24821 {
24822 /**
24823 * Sets the number of results to skip before returning any results.
24824 * This is useful for pagination.
24825 * Default is to skip zero results.
24826 * @param {Number} n the number of results to skip.
24827 * @return {AV.Query} Returns the query, so you can chain this call.
24828 */
24829 skip: function skip(n) {
24830 this._skip = n;
24831 return this;
24832 },
24833
24834 /**
24835 * Sets the limit of the number of results to return. The default limit is
24836 * 100, with a maximum of 1000 results being returned at a time.
24837 * @param {Number} n the number of results to limit to.
24838 * @return {AV.Query} Returns the query, so you can chain this call.
24839 */
24840 limit: function limit(n) {
24841 this._limit = n;
24842 return this;
24843 },
24844
24845 /**
24846 * 查询任务状态和结果,任务结果为一个 JSON 对象,包括 status 表示任务状态, totalCount 表示总数,
24847 * results 数组表示任务结果数组,previewCount 表示可以返回的结果总数,任务的开始和截止时间
24848 * startTime、endTime 等信息。
24849 *
24850 * @param {AuthOptions} [options]
24851 * @return {Promise} A promise that will be resolved with the result
24852 * of the function.
24853 *
24854 */
24855 find: function find(options) {
24856 var params = {
24857 skip: this._skip,
24858 limit: this._limit
24859 };
24860 return request({
24861 path: "/bigquery/jobs/".concat(this.id),
24862 method: 'GET',
24863 query: params,
24864 authOptions: options,
24865 signKey: false
24866 }).then(function (response) {
24867 if (response.error) {
24868 return _promise.default.reject(new AVError(response.code, response.error));
24869 }
24870
24871 return _promise.default.resolve(response);
24872 });
24873 }
24874 });
24875};
24876
24877/***/ }),
24878/* 569 */
24879/***/ (function(module, exports, __webpack_require__) {
24880
24881"use strict";
24882
24883
24884var _interopRequireDefault = __webpack_require__(1);
24885
24886var _promise = _interopRequireDefault(__webpack_require__(12));
24887
24888var _ = __webpack_require__(3);
24889
24890var _require = __webpack_require__(28),
24891 LCRequest = _require.request;
24892
24893var _require2 = __webpack_require__(32),
24894 getSessionToken = _require2.getSessionToken;
24895
24896module.exports = function (AV) {
24897 var getUserWithSessionToken = function getUserWithSessionToken(authOptions) {
24898 if (authOptions.user) {
24899 if (!authOptions.user._sessionToken) {
24900 throw new Error('authOptions.user is not signed in.');
24901 }
24902
24903 return _promise.default.resolve(authOptions.user);
24904 }
24905
24906 if (authOptions.sessionToken) {
24907 return AV.User._fetchUserBySessionToken(authOptions.sessionToken);
24908 }
24909
24910 return AV.User.currentAsync();
24911 };
24912
24913 var getSessionTokenAsync = function getSessionTokenAsync(authOptions) {
24914 var sessionToken = getSessionToken(authOptions);
24915
24916 if (sessionToken) {
24917 return _promise.default.resolve(sessionToken);
24918 }
24919
24920 return AV.User.currentAsync().then(function (user) {
24921 if (user) {
24922 return user.getSessionToken();
24923 }
24924 });
24925 };
24926 /**
24927 * Contains functions to deal with Friendship in LeanCloud.
24928 * @class
24929 */
24930
24931
24932 AV.Friendship = {
24933 /**
24934 * Request friendship.
24935 * @since 4.8.0
24936 * @param {String | AV.User | Object} options if an AV.User or string is given, it will be used as the friend.
24937 * @param {AV.User | string} options.friend The friend (or friend's objectId) to follow.
24938 * @param {Object} [options.attributes] key-value attributes dictionary to be used as conditions of followeeQuery.
24939 * @param {AuthOptions} [authOptions]
24940 * @return {Promise<void>}
24941 */
24942 request: function request(options) {
24943 var authOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
24944 var friend;
24945 var attributes;
24946
24947 if (options.friend) {
24948 friend = options.friend;
24949 attributes = options.attributes;
24950 } else {
24951 friend = options;
24952 }
24953
24954 var friendObj = _.isString(friend) ? AV.Object.createWithoutData('_User', friend) : friend;
24955 return getUserWithSessionToken(authOptions).then(function (userObj) {
24956 if (!userObj) {
24957 throw new Error('Please signin an user.');
24958 }
24959
24960 return LCRequest({
24961 method: 'POST',
24962 path: '/users/friendshipRequests',
24963 data: {
24964 user: userObj._toPointer(),
24965 friend: friendObj._toPointer(),
24966 friendship: attributes
24967 },
24968 authOptions: authOptions
24969 });
24970 });
24971 },
24972
24973 /**
24974 * Accept a friendship request.
24975 * @since 4.8.0
24976 * @param {AV.Object | string | Object} options if an AV.Object or string is given, it will be used as the request in _FriendshipRequest.
24977 * @param {AV.Object} options.request The request (or it's objectId) to be accepted.
24978 * @param {Object} [options.attributes] key-value attributes dictionary to be used as conditions of {@link AV#followeeQuery}.
24979 * @param {AuthOptions} [authOptions]
24980 * @return {Promise<void>}
24981 */
24982 acceptRequest: function acceptRequest(options) {
24983 var authOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
24984 var request;
24985 var attributes;
24986
24987 if (options.request) {
24988 request = options.request;
24989 attributes = options.attributes;
24990 } else {
24991 request = options;
24992 }
24993
24994 var requestId = _.isString(request) ? request : request.id;
24995 return getSessionTokenAsync(authOptions).then(function (sessionToken) {
24996 if (!sessionToken) {
24997 throw new Error('Please signin an user.');
24998 }
24999
25000 return LCRequest({
25001 method: 'PUT',
25002 path: '/users/friendshipRequests/' + requestId + '/accept',
25003 data: {
25004 friendship: AV._encode(attributes)
25005 },
25006 authOptions: authOptions
25007 });
25008 });
25009 },
25010
25011 /**
25012 * Decline a friendship request.
25013 * @param {AV.Object | string} request The request (or it's objectId) to be declined.
25014 * @param {AuthOptions} [authOptions]
25015 * @return {Promise<void>}
25016 */
25017 declineRequest: function declineRequest(request) {
25018 var authOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
25019 var requestId = _.isString(request) ? request : request.id;
25020 return getSessionTokenAsync(authOptions).then(function (sessionToken) {
25021 if (!sessionToken) {
25022 throw new Error('Please signin an user.');
25023 }
25024
25025 return LCRequest({
25026 method: 'PUT',
25027 path: '/users/friendshipRequests/' + requestId + '/decline',
25028 authOptions: authOptions
25029 });
25030 });
25031 }
25032 };
25033};
25034
25035/***/ }),
25036/* 570 */
25037/***/ (function(module, exports, __webpack_require__) {
25038
25039"use strict";
25040
25041
25042var _interopRequireDefault = __webpack_require__(1);
25043
25044var _stringify = _interopRequireDefault(__webpack_require__(38));
25045
25046var _ = __webpack_require__(3);
25047
25048var _require = __webpack_require__(28),
25049 _request = _require._request;
25050
25051var AV = __webpack_require__(74);
25052
25053var serializeMessage = function serializeMessage(message) {
25054 if (typeof message === 'string') {
25055 return message;
25056 }
25057
25058 if (typeof message.getPayload === 'function') {
25059 return (0, _stringify.default)(message.getPayload());
25060 }
25061
25062 return (0, _stringify.default)(message);
25063};
25064/**
25065 * <p>An AV.Conversation is a local representation of a LeanCloud realtime's
25066 * conversation. This class is a subclass of AV.Object, and retains the
25067 * same functionality of an AV.Object, but also extends it with various
25068 * conversation specific methods, like get members, creators of this conversation.
25069 * </p>
25070 *
25071 * @class AV.Conversation
25072 * @param {String} name The name of the Role to create.
25073 * @param {Object} [options]
25074 * @param {Boolean} [options.isSystem] Set this conversation as system conversation.
25075 * @param {Boolean} [options.isTransient] Set this conversation as transient conversation.
25076 */
25077
25078
25079module.exports = AV.Object.extend('_Conversation',
25080/** @lends AV.Conversation.prototype */
25081{
25082 constructor: function constructor(name) {
25083 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
25084 AV.Object.prototype.constructor.call(this, null, null);
25085 this.set('name', name);
25086
25087 if (options.isSystem !== undefined) {
25088 this.set('sys', options.isSystem ? true : false);
25089 }
25090
25091 if (options.isTransient !== undefined) {
25092 this.set('tr', options.isTransient ? true : false);
25093 }
25094 },
25095
25096 /**
25097 * Get current conversation's creator.
25098 *
25099 * @return {String}
25100 */
25101 getCreator: function getCreator() {
25102 return this.get('c');
25103 },
25104
25105 /**
25106 * Get the last message's time.
25107 *
25108 * @return {Date}
25109 */
25110 getLastMessageAt: function getLastMessageAt() {
25111 return this.get('lm');
25112 },
25113
25114 /**
25115 * Get this conversation's members
25116 *
25117 * @return {String[]}
25118 */
25119 getMembers: function getMembers() {
25120 return this.get('m');
25121 },
25122
25123 /**
25124 * Add a member to this conversation
25125 *
25126 * @param {String} member
25127 */
25128 addMember: function addMember(member) {
25129 return this.add('m', member);
25130 },
25131
25132 /**
25133 * Get this conversation's members who set this conversation as muted.
25134 *
25135 * @return {String[]}
25136 */
25137 getMutedMembers: function getMutedMembers() {
25138 return this.get('mu');
25139 },
25140
25141 /**
25142 * Get this conversation's name field.
25143 *
25144 * @return String
25145 */
25146 getName: function getName() {
25147 return this.get('name');
25148 },
25149
25150 /**
25151 * Returns true if this conversation is transient conversation.
25152 *
25153 * @return {Boolean}
25154 */
25155 isTransient: function isTransient() {
25156 return this.get('tr');
25157 },
25158
25159 /**
25160 * Returns true if this conversation is system conversation.
25161 *
25162 * @return {Boolean}
25163 */
25164 isSystem: function isSystem() {
25165 return this.get('sys');
25166 },
25167
25168 /**
25169 * Send realtime message to this conversation, using HTTP request.
25170 *
25171 * @param {String} fromClient Sender's client id.
25172 * @param {String|Object} message The message which will send to conversation.
25173 * It could be a raw string, or an object with a `toJSON` method, like a
25174 * realtime SDK's Message object. See more: {@link https://leancloud.cn/docs/realtime_guide-js.html#消息}
25175 * @param {Object} [options]
25176 * @param {Boolean} [options.transient] Whether send this message as transient message or not.
25177 * @param {String[]} [options.toClients] Ids of clients to send to. This option can be used only in system conversation.
25178 * @param {Object} [options.pushData] Push data to this message. See more: {@link https://url.leanapp.cn/pushData 推送消息内容}
25179 * @param {AuthOptions} [authOptions]
25180 * @return {Promise}
25181 */
25182 send: function send(fromClient, message) {
25183 var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
25184 var authOptions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
25185 var data = {
25186 from_peer: fromClient,
25187 conv_id: this.id,
25188 transient: false,
25189 message: serializeMessage(message)
25190 };
25191
25192 if (options.toClients !== undefined) {
25193 data.to_peers = options.toClients;
25194 }
25195
25196 if (options.transient !== undefined) {
25197 data.transient = options.transient ? true : false;
25198 }
25199
25200 if (options.pushData !== undefined) {
25201 data.push_data = options.pushData;
25202 }
25203
25204 return _request('rtm', 'messages', null, 'POST', data, authOptions);
25205 },
25206
25207 /**
25208 * Send realtime broadcast message to all clients, via this conversation, using HTTP request.
25209 *
25210 * @param {String} fromClient Sender's client id.
25211 * @param {String|Object} message The message which will send to conversation.
25212 * It could be a raw string, or an object with a `toJSON` method, like a
25213 * realtime SDK's Message object. See more: {@link https://leancloud.cn/docs/realtime_guide-js.html#消息}.
25214 * @param {Object} [options]
25215 * @param {Object} [options.pushData] Push data to this message. See more: {@link https://url.leanapp.cn/pushData 推送消息内容}.
25216 * @param {Object} [options.validTill] The message will valid till this time.
25217 * @param {AuthOptions} [authOptions]
25218 * @return {Promise}
25219 */
25220 broadcast: function broadcast(fromClient, message) {
25221 var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
25222 var authOptions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
25223 var data = {
25224 from_peer: fromClient,
25225 conv_id: this.id,
25226 message: serializeMessage(message)
25227 };
25228
25229 if (options.pushData !== undefined) {
25230 data.push = options.pushData;
25231 }
25232
25233 if (options.validTill !== undefined) {
25234 var ts = options.validTill;
25235
25236 if (_.isDate(ts)) {
25237 ts = ts.getTime();
25238 }
25239
25240 options.valid_till = ts;
25241 }
25242
25243 return _request('rtm', 'broadcast', null, 'POST', data, authOptions);
25244 }
25245});
25246
25247/***/ }),
25248/* 571 */
25249/***/ (function(module, exports, __webpack_require__) {
25250
25251"use strict";
25252
25253
25254var _interopRequireDefault = __webpack_require__(1);
25255
25256var _promise = _interopRequireDefault(__webpack_require__(12));
25257
25258var _map = _interopRequireDefault(__webpack_require__(37));
25259
25260var _concat = _interopRequireDefault(__webpack_require__(19));
25261
25262var _ = __webpack_require__(3);
25263
25264var _require = __webpack_require__(28),
25265 request = _require.request;
25266
25267var _require2 = __webpack_require__(32),
25268 ensureArray = _require2.ensureArray,
25269 parseDate = _require2.parseDate;
25270
25271var AV = __webpack_require__(74);
25272/**
25273 * The version change interval for Leaderboard
25274 * @enum
25275 */
25276
25277
25278AV.LeaderboardVersionChangeInterval = {
25279 NEVER: 'never',
25280 DAY: 'day',
25281 WEEK: 'week',
25282 MONTH: 'month'
25283};
25284/**
25285 * The order of the leaderboard results
25286 * @enum
25287 */
25288
25289AV.LeaderboardOrder = {
25290 ASCENDING: 'ascending',
25291 DESCENDING: 'descending'
25292};
25293/**
25294 * The update strategy for Leaderboard
25295 * @enum
25296 */
25297
25298AV.LeaderboardUpdateStrategy = {
25299 /** Only keep the best statistic. If the leaderboard is in descending order, the best statistic is the highest one. */
25300 BETTER: 'better',
25301
25302 /** Keep the last updated statistic */
25303 LAST: 'last',
25304
25305 /** Keep the sum of all updated statistics */
25306 SUM: 'sum'
25307};
25308/**
25309 * @typedef {Object} Ranking
25310 * @property {number} rank Starts at 0
25311 * @property {number} value the statistic value of this ranking
25312 * @property {AV.User} user The user of this ranking
25313 * @property {Statistic[]} [includedStatistics] Other statistics of the user, specified by the `includeStatistic` option of `AV.Leaderboard.getResults()`
25314 */
25315
25316/**
25317 * @typedef {Object} LeaderboardArchive
25318 * @property {string} statisticName
25319 * @property {number} version version of the leaderboard
25320 * @property {string} status
25321 * @property {string} url URL for the downloadable archive
25322 * @property {Date} activatedAt time when this version became active
25323 * @property {Date} deactivatedAt time when this version was deactivated by a version incrementing
25324 */
25325
25326/**
25327 * @class
25328 */
25329
25330function Statistic(_ref) {
25331 var name = _ref.name,
25332 value = _ref.value,
25333 version = _ref.version;
25334
25335 /**
25336 * @type {string}
25337 */
25338 this.name = name;
25339 /**
25340 * @type {number}
25341 */
25342
25343 this.value = value;
25344 /**
25345 * @type {number?}
25346 */
25347
25348 this.version = version;
25349}
25350
25351var parseStatisticData = function parseStatisticData(statisticData) {
25352 var _AV$_decode = AV._decode(statisticData),
25353 name = _AV$_decode.statisticName,
25354 value = _AV$_decode.statisticValue,
25355 version = _AV$_decode.version;
25356
25357 return new Statistic({
25358 name: name,
25359 value: value,
25360 version: version
25361 });
25362};
25363/**
25364 * @class
25365 */
25366
25367
25368AV.Leaderboard = function Leaderboard(statisticName) {
25369 /**
25370 * @type {string}
25371 */
25372 this.statisticName = statisticName;
25373 /**
25374 * @type {AV.LeaderboardOrder}
25375 */
25376
25377 this.order = undefined;
25378 /**
25379 * @type {AV.LeaderboardUpdateStrategy}
25380 */
25381
25382 this.updateStrategy = undefined;
25383 /**
25384 * @type {AV.LeaderboardVersionChangeInterval}
25385 */
25386
25387 this.versionChangeInterval = undefined;
25388 /**
25389 * @type {number}
25390 */
25391
25392 this.version = undefined;
25393 /**
25394 * @type {Date?}
25395 */
25396
25397 this.nextResetAt = undefined;
25398 /**
25399 * @type {Date?}
25400 */
25401
25402 this.createdAt = undefined;
25403};
25404
25405var Leaderboard = AV.Leaderboard;
25406/**
25407 * Create an instance of Leaderboard for the give statistic name.
25408 * @param {string} statisticName
25409 * @return {AV.Leaderboard}
25410 */
25411
25412AV.Leaderboard.createWithoutData = function (statisticName) {
25413 return new Leaderboard(statisticName);
25414};
25415/**
25416 * (masterKey required) Create a new Leaderboard.
25417 * @param {Object} options
25418 * @param {string} options.statisticName
25419 * @param {AV.LeaderboardOrder} options.order
25420 * @param {AV.LeaderboardVersionChangeInterval} [options.versionChangeInterval] default to WEEK
25421 * @param {AV.LeaderboardUpdateStrategy} [options.updateStrategy] default to BETTER
25422 * @param {AuthOptions} [authOptions]
25423 * @return {Promise<AV.Leaderboard>}
25424 */
25425
25426
25427AV.Leaderboard.createLeaderboard = function (_ref2, authOptions) {
25428 var statisticName = _ref2.statisticName,
25429 order = _ref2.order,
25430 versionChangeInterval = _ref2.versionChangeInterval,
25431 updateStrategy = _ref2.updateStrategy;
25432 return request({
25433 method: 'POST',
25434 path: '/leaderboard/leaderboards',
25435 data: {
25436 statisticName: statisticName,
25437 order: order,
25438 versionChangeInterval: versionChangeInterval,
25439 updateStrategy: updateStrategy
25440 },
25441 authOptions: authOptions
25442 }).then(function (data) {
25443 var leaderboard = new Leaderboard(statisticName);
25444 return leaderboard._finishFetch(data);
25445 });
25446};
25447/**
25448 * Get the Leaderboard with the specified statistic name.
25449 * @param {string} statisticName
25450 * @param {AuthOptions} [authOptions]
25451 * @return {Promise<AV.Leaderboard>}
25452 */
25453
25454
25455AV.Leaderboard.getLeaderboard = function (statisticName, authOptions) {
25456 return Leaderboard.createWithoutData(statisticName).fetch(authOptions);
25457};
25458/**
25459 * Get Statistics for the specified user.
25460 * @param {AV.User} user The specified AV.User pointer.
25461 * @param {Object} [options]
25462 * @param {string[]} [options.statisticNames] Specify the statisticNames. If not set, all statistics of the user will be fetched.
25463 * @param {AuthOptions} [authOptions]
25464 * @return {Promise<Statistic[]>}
25465 */
25466
25467
25468AV.Leaderboard.getStatistics = function (user) {
25469 var _ref3 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
25470 statisticNames = _ref3.statisticNames;
25471
25472 var authOptions = arguments.length > 2 ? arguments[2] : undefined;
25473 return _promise.default.resolve().then(function () {
25474 if (!(user && user.id)) throw new Error('user must be an AV.User');
25475 return request({
25476 method: 'GET',
25477 path: "/leaderboard/users/".concat(user.id, "/statistics"),
25478 query: {
25479 statistics: statisticNames ? ensureArray(statisticNames).join(',') : undefined
25480 },
25481 authOptions: authOptions
25482 }).then(function (_ref4) {
25483 var results = _ref4.results;
25484 return (0, _map.default)(results).call(results, parseStatisticData);
25485 });
25486 });
25487};
25488/**
25489 * Update Statistics for the specified user.
25490 * @param {AV.User} user The specified AV.User pointer.
25491 * @param {Object} statistics A name-value pair representing the statistics to update.
25492 * @param {AuthOptions} [options] AuthOptions plus:
25493 * @param {boolean} [options.overwrite] Wethere to overwrite these statistics disregarding the updateStrategy of there leaderboards
25494 * @return {Promise<Statistic[]>}
25495 */
25496
25497
25498AV.Leaderboard.updateStatistics = function (user, statistics) {
25499 var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
25500 return _promise.default.resolve().then(function () {
25501 if (!(user && user.id)) throw new Error('user must be an AV.User');
25502 var data = (0, _map.default)(_).call(_, statistics, function (value, key) {
25503 return {
25504 statisticName: key,
25505 statisticValue: value
25506 };
25507 });
25508 var overwrite = options.overwrite;
25509 return request({
25510 method: 'POST',
25511 path: "/leaderboard/users/".concat(user.id, "/statistics"),
25512 query: {
25513 overwrite: overwrite ? 1 : undefined
25514 },
25515 data: data,
25516 authOptions: options
25517 }).then(function (_ref5) {
25518 var results = _ref5.results;
25519 return (0, _map.default)(results).call(results, parseStatisticData);
25520 });
25521 });
25522};
25523/**
25524 * Delete Statistics for the specified user.
25525 * @param {AV.User} user The specified AV.User pointer.
25526 * @param {Object} statistics A name-value pair representing the statistics to delete.
25527 * @param {AuthOptions} [options]
25528 * @return {Promise<void>}
25529 */
25530
25531
25532AV.Leaderboard.deleteStatistics = function (user, statisticNames, authOptions) {
25533 return _promise.default.resolve().then(function () {
25534 if (!(user && user.id)) throw new Error('user must be an AV.User');
25535 return request({
25536 method: 'DELETE',
25537 path: "/leaderboard/users/".concat(user.id, "/statistics"),
25538 query: {
25539 statistics: ensureArray(statisticNames).join(',')
25540 },
25541 authOptions: authOptions
25542 }).then(function () {
25543 return undefined;
25544 });
25545 });
25546};
25547
25548_.extend(Leaderboard.prototype,
25549/** @lends AV.Leaderboard.prototype */
25550{
25551 _finishFetch: function _finishFetch(data) {
25552 var _this = this;
25553
25554 _.forEach(data, function (value, key) {
25555 if (key === 'updatedAt' || key === 'objectId') return;
25556
25557 if (key === 'expiredAt') {
25558 key = 'nextResetAt';
25559 }
25560
25561 if (key === 'createdAt') {
25562 value = parseDate(value);
25563 }
25564
25565 if (value && value.__type === 'Date') {
25566 value = parseDate(value.iso);
25567 }
25568
25569 _this[key] = value;
25570 });
25571
25572 return this;
25573 },
25574
25575 /**
25576 * Fetch data from the srever.
25577 * @param {AuthOptions} [authOptions]
25578 * @return {Promise<AV.Leaderboard>}
25579 */
25580 fetch: function fetch(authOptions) {
25581 var _this2 = this;
25582
25583 return request({
25584 method: 'GET',
25585 path: "/leaderboard/leaderboards/".concat(this.statisticName),
25586 authOptions: authOptions
25587 }).then(function (data) {
25588 return _this2._finishFetch(data);
25589 });
25590 },
25591
25592 /**
25593 * Counts the number of users participated in this leaderboard
25594 * @param {Object} [options]
25595 * @param {number} [options.version] Specify the version of the leaderboard
25596 * @param {AuthOptions} [authOptions]
25597 * @return {Promise<number>}
25598 */
25599 count: function count() {
25600 var _ref6 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
25601 version = _ref6.version;
25602
25603 var authOptions = arguments.length > 1 ? arguments[1] : undefined;
25604 return request({
25605 method: 'GET',
25606 path: "/leaderboard/leaderboards/".concat(this.statisticName, "/ranks"),
25607 query: {
25608 count: 1,
25609 limit: 0,
25610 version: version
25611 },
25612 authOptions: authOptions
25613 }).then(function (_ref7) {
25614 var count = _ref7.count;
25615 return count;
25616 });
25617 },
25618 _getResults: function _getResults(_ref8, authOptions, userId) {
25619 var _context;
25620
25621 var skip = _ref8.skip,
25622 limit = _ref8.limit,
25623 selectUserKeys = _ref8.selectUserKeys,
25624 includeUserKeys = _ref8.includeUserKeys,
25625 includeStatistics = _ref8.includeStatistics,
25626 version = _ref8.version;
25627 return request({
25628 method: 'GET',
25629 path: (0, _concat.default)(_context = "/leaderboard/leaderboards/".concat(this.statisticName, "/ranks")).call(_context, userId ? "/".concat(userId) : ''),
25630 query: {
25631 skip: skip,
25632 limit: limit,
25633 selectUserKeys: _.union(ensureArray(selectUserKeys), ensureArray(includeUserKeys)).join(',') || undefined,
25634 includeUser: includeUserKeys ? ensureArray(includeUserKeys).join(',') : undefined,
25635 includeStatistics: includeStatistics ? ensureArray(includeStatistics).join(',') : undefined,
25636 version: version
25637 },
25638 authOptions: authOptions
25639 }).then(function (_ref9) {
25640 var rankings = _ref9.results;
25641 return (0, _map.default)(rankings).call(rankings, function (rankingData) {
25642 var _AV$_decode2 = AV._decode(rankingData),
25643 user = _AV$_decode2.user,
25644 value = _AV$_decode2.statisticValue,
25645 rank = _AV$_decode2.rank,
25646 _AV$_decode2$statisti = _AV$_decode2.statistics,
25647 statistics = _AV$_decode2$statisti === void 0 ? [] : _AV$_decode2$statisti;
25648
25649 return {
25650 user: user,
25651 value: value,
25652 rank: rank,
25653 includedStatistics: (0, _map.default)(statistics).call(statistics, parseStatisticData)
25654 };
25655 });
25656 });
25657 },
25658
25659 /**
25660 * Retrieve a list of ranked users for this Leaderboard.
25661 * @param {Object} [options]
25662 * @param {number} [options.skip] The number of results to skip. This is useful for pagination.
25663 * @param {number} [options.limit] The limit of the number of results.
25664 * @param {string[]} [options.selectUserKeys] Specify keys of the users to include in the Rankings
25665 * @param {string[]} [options.includeUserKeys] If the value of a selected user keys is a Pointer, use this options to include its value.
25666 * @param {string[]} [options.includeStatistics] Specify other statistics to include in the Rankings
25667 * @param {number} [options.version] Specify the version of the leaderboard
25668 * @param {AuthOptions} [authOptions]
25669 * @return {Promise<Ranking[]>}
25670 */
25671 getResults: function getResults() {
25672 var _ref10 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
25673 skip = _ref10.skip,
25674 limit = _ref10.limit,
25675 selectUserKeys = _ref10.selectUserKeys,
25676 includeUserKeys = _ref10.includeUserKeys,
25677 includeStatistics = _ref10.includeStatistics,
25678 version = _ref10.version;
25679
25680 var authOptions = arguments.length > 1 ? arguments[1] : undefined;
25681 return this._getResults({
25682 skip: skip,
25683 limit: limit,
25684 selectUserKeys: selectUserKeys,
25685 includeUserKeys: includeUserKeys,
25686 includeStatistics: includeStatistics,
25687 version: version
25688 }, authOptions);
25689 },
25690
25691 /**
25692 * Retrieve a list of ranked users for this Leaderboard, centered on the specified user.
25693 * @param {AV.User} user The specified AV.User pointer.
25694 * @param {Object} [options]
25695 * @param {number} [options.limit] The limit of the number of results.
25696 * @param {string[]} [options.selectUserKeys] Specify keys of the users to include in the Rankings
25697 * @param {string[]} [options.includeUserKeys] If the value of a selected user keys is a Pointer, use this options to include its value.
25698 * @param {string[]} [options.includeStatistics] Specify other statistics to include in the Rankings
25699 * @param {number} [options.version] Specify the version of the leaderboard
25700 * @param {AuthOptions} [authOptions]
25701 * @return {Promise<Ranking[]>}
25702 */
25703 getResultsAroundUser: function getResultsAroundUser(user) {
25704 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
25705 var authOptions = arguments.length > 2 ? arguments[2] : undefined;
25706
25707 // getResultsAroundUser(options, authOptions)
25708 if (user && typeof user.id !== 'string') {
25709 return this.getResultsAroundUser(undefined, user, options);
25710 }
25711
25712 var limit = options.limit,
25713 selectUserKeys = options.selectUserKeys,
25714 includeUserKeys = options.includeUserKeys,
25715 includeStatistics = options.includeStatistics,
25716 version = options.version;
25717 return this._getResults({
25718 limit: limit,
25719 selectUserKeys: selectUserKeys,
25720 includeUserKeys: includeUserKeys,
25721 includeStatistics: includeStatistics,
25722 version: version
25723 }, authOptions, user ? user.id : 'self');
25724 },
25725 _update: function _update(data, authOptions) {
25726 var _this3 = this;
25727
25728 return request({
25729 method: 'PUT',
25730 path: "/leaderboard/leaderboards/".concat(this.statisticName),
25731 data: data,
25732 authOptions: authOptions
25733 }).then(function (result) {
25734 return _this3._finishFetch(result);
25735 });
25736 },
25737
25738 /**
25739 * (masterKey required) Update the version change interval of the Leaderboard.
25740 * @param {AV.LeaderboardVersionChangeInterval} versionChangeInterval
25741 * @param {AuthOptions} [authOptions]
25742 * @return {Promise<AV.Leaderboard>}
25743 */
25744 updateVersionChangeInterval: function updateVersionChangeInterval(versionChangeInterval, authOptions) {
25745 return this._update({
25746 versionChangeInterval: versionChangeInterval
25747 }, authOptions);
25748 },
25749
25750 /**
25751 * (masterKey required) Update the version change interval of the Leaderboard.
25752 * @param {AV.LeaderboardUpdateStrategy} updateStrategy
25753 * @param {AuthOptions} [authOptions]
25754 * @return {Promise<AV.Leaderboard>}
25755 */
25756 updateUpdateStrategy: function updateUpdateStrategy(updateStrategy, authOptions) {
25757 return this._update({
25758 updateStrategy: updateStrategy
25759 }, authOptions);
25760 },
25761
25762 /**
25763 * (masterKey required) Reset the Leaderboard. The version of the Leaderboard will be incremented by 1.
25764 * @param {AuthOptions} [authOptions]
25765 * @return {Promise<AV.Leaderboard>}
25766 */
25767 reset: function reset(authOptions) {
25768 var _this4 = this;
25769
25770 return request({
25771 method: 'PUT',
25772 path: "/leaderboard/leaderboards/".concat(this.statisticName, "/incrementVersion"),
25773 authOptions: authOptions
25774 }).then(function (data) {
25775 return _this4._finishFetch(data);
25776 });
25777 },
25778
25779 /**
25780 * (masterKey required) Delete the Leaderboard and its all archived versions.
25781 * @param {AuthOptions} [authOptions]
25782 * @return {void}
25783 */
25784 destroy: function destroy(authOptions) {
25785 return AV.request({
25786 method: 'DELETE',
25787 path: "/leaderboard/leaderboards/".concat(this.statisticName),
25788 authOptions: authOptions
25789 }).then(function () {
25790 return undefined;
25791 });
25792 },
25793
25794 /**
25795 * (masterKey required) Get archived versions.
25796 * @param {Object} [options]
25797 * @param {number} [options.skip] The number of results to skip. This is useful for pagination.
25798 * @param {number} [options.limit] The limit of the number of results.
25799 * @param {AuthOptions} [authOptions]
25800 * @return {Promise<LeaderboardArchive[]>}
25801 */
25802 getArchives: function getArchives() {
25803 var _this5 = this;
25804
25805 var _ref11 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
25806 skip = _ref11.skip,
25807 limit = _ref11.limit;
25808
25809 var authOptions = arguments.length > 1 ? arguments[1] : undefined;
25810 return request({
25811 method: 'GET',
25812 path: "/leaderboard/leaderboards/".concat(this.statisticName, "/archives"),
25813 query: {
25814 skip: skip,
25815 limit: limit
25816 },
25817 authOptions: authOptions
25818 }).then(function (_ref12) {
25819 var results = _ref12.results;
25820 return (0, _map.default)(results).call(results, function (_ref13) {
25821 var version = _ref13.version,
25822 status = _ref13.status,
25823 url = _ref13.url,
25824 activatedAt = _ref13.activatedAt,
25825 deactivatedAt = _ref13.deactivatedAt;
25826 return {
25827 statisticName: _this5.statisticName,
25828 version: version,
25829 status: status,
25830 url: url,
25831 activatedAt: parseDate(activatedAt.iso),
25832 deactivatedAt: parseDate(deactivatedAt.iso)
25833 };
25834 });
25835 });
25836 }
25837});
25838
25839/***/ }),
25840/* 572 */
25841/***/ (function(module, exports, __webpack_require__) {
25842
25843"use strict";
25844
25845
25846var _Object$defineProperty = __webpack_require__(94);
25847
25848_Object$defineProperty(exports, "__esModule", {
25849 value: true
25850});
25851
25852exports.platformInfo = exports.WebSocket = void 0;
25853
25854_Object$defineProperty(exports, "request", {
25855 enumerable: true,
25856 get: function get() {
25857 return _adaptersSuperagent.request;
25858 }
25859});
25860
25861exports.storage = void 0;
25862
25863_Object$defineProperty(exports, "upload", {
25864 enumerable: true,
25865 get: function get() {
25866 return _adaptersSuperagent.upload;
25867 }
25868});
25869
25870var _adaptersSuperagent = __webpack_require__(573);
25871
25872var storage = window.localStorage;
25873exports.storage = storage;
25874var WebSocket = window.WebSocket;
25875exports.WebSocket = WebSocket;
25876var platformInfo = {
25877 name: "Browser"
25878};
25879exports.platformInfo = platformInfo;
25880
25881/***/ }),
25882/* 573 */
25883/***/ (function(module, exports, __webpack_require__) {
25884
25885"use strict";
25886
25887var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
25888 function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
25889 return new (P || (P = Promise))(function (resolve, reject) {
25890 function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
25891 function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
25892 function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
25893 step((generator = generator.apply(thisArg, _arguments || [])).next());
25894 });
25895};
25896var __generator = (this && this.__generator) || function (thisArg, body) {
25897 var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
25898 return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
25899 function verb(n) { return function (v) { return step([n, v]); }; }
25900 function step(op) {
25901 if (f) throw new TypeError("Generator is already executing.");
25902 while (_) try {
25903 if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
25904 if (y = 0, t) op = [op[0] & 2, t.value];
25905 switch (op[0]) {
25906 case 0: case 1: t = op; break;
25907 case 4: _.label++; return { value: op[1], done: false };
25908 case 5: _.label++; y = op[1]; op = [0]; continue;
25909 case 7: op = _.ops.pop(); _.trys.pop(); continue;
25910 default:
25911 if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
25912 if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
25913 if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
25914 if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
25915 if (t[2]) _.ops.pop();
25916 _.trys.pop(); continue;
25917 }
25918 op = body.call(thisArg, _);
25919 } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
25920 if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
25921 }
25922};
25923Object.defineProperty(exports, "__esModule", { value: true });
25924exports.upload = exports.request = void 0;
25925var adapter_utils_1 = __webpack_require__(574);
25926var superagent = __webpack_require__(575);
25927function convertResponse(res) {
25928 return {
25929 ok: res.ok,
25930 status: res.status,
25931 headers: res.header,
25932 data: res.body,
25933 };
25934}
25935var request = function (url, options) {
25936 if (options === void 0) { options = {}; }
25937 return __awaiter(void 0, void 0, void 0, function () {
25938 var _a, method, data, headers, onprogress, signal, req, aborted, onAbort, res, error_1;
25939 return __generator(this, function (_b) {
25940 switch (_b.label) {
25941 case 0:
25942 _a = options.method, method = _a === void 0 ? "GET" : _a, data = options.data, headers = options.headers, onprogress = options.onprogress, signal = options.signal;
25943 if (signal === null || signal === void 0 ? void 0 : signal.aborted) {
25944 throw new adapter_utils_1.AbortError("Request aborted");
25945 }
25946 req = superagent(method, url).ok(function () { return true; });
25947 if (headers) {
25948 req.set(headers);
25949 }
25950 if (onprogress) {
25951 req.on("progress", onprogress);
25952 }
25953 aborted = false;
25954 onAbort = function () {
25955 aborted = true;
25956 req.abort();
25957 };
25958 signal === null || signal === void 0 ? void 0 : signal.addEventListener("abort", onAbort);
25959 _b.label = 1;
25960 case 1:
25961 _b.trys.push([1, 3, 4, 5]);
25962 return [4 /*yield*/, req.send(data)];
25963 case 2:
25964 res = _b.sent();
25965 return [2 /*return*/, convertResponse(res)];
25966 case 3:
25967 error_1 = _b.sent();
25968 if (aborted) {
25969 throw new adapter_utils_1.AbortError("Request aborted");
25970 }
25971 throw error_1;
25972 case 4:
25973 signal === null || signal === void 0 ? void 0 : signal.removeEventListener("abort", onAbort);
25974 return [7 /*endfinally*/];
25975 case 5: return [2 /*return*/];
25976 }
25977 });
25978 });
25979};
25980exports.request = request;
25981var upload = function (url, file, options) {
25982 if (options === void 0) { options = {}; }
25983 return __awaiter(void 0, void 0, void 0, function () {
25984 var _a, method, data, headers, onprogress, signal, req, aborted, onAbort, res, error_2;
25985 return __generator(this, function (_b) {
25986 switch (_b.label) {
25987 case 0:
25988 _a = options.method, method = _a === void 0 ? "POST" : _a, data = options.data, headers = options.headers, onprogress = options.onprogress, signal = options.signal;
25989 if (signal === null || signal === void 0 ? void 0 : signal.aborted) {
25990 throw new adapter_utils_1.AbortError("Request aborted");
25991 }
25992 req = superagent(method, url)
25993 .ok(function () { return true; })
25994 .attach(file.field, file.data, file.name);
25995 if (data) {
25996 req.field(data);
25997 }
25998 if (headers) {
25999 req.set(headers);
26000 }
26001 if (onprogress) {
26002 req.on("progress", onprogress);
26003 }
26004 aborted = false;
26005 onAbort = function () {
26006 aborted = true;
26007 req.abort();
26008 };
26009 signal === null || signal === void 0 ? void 0 : signal.addEventListener("abort", onAbort);
26010 _b.label = 1;
26011 case 1:
26012 _b.trys.push([1, 3, 4, 5]);
26013 return [4 /*yield*/, req];
26014 case 2:
26015 res = _b.sent();
26016 return [2 /*return*/, convertResponse(res)];
26017 case 3:
26018 error_2 = _b.sent();
26019 if (aborted) {
26020 throw new adapter_utils_1.AbortError("Request aborted");
26021 }
26022 throw error_2;
26023 case 4:
26024 signal === null || signal === void 0 ? void 0 : signal.removeEventListener("abort", onAbort);
26025 return [7 /*endfinally*/];
26026 case 5: return [2 /*return*/];
26027 }
26028 });
26029 });
26030};
26031exports.upload = upload;
26032//# sourceMappingURL=index.js.map
26033
26034/***/ }),
26035/* 574 */
26036/***/ (function(module, __webpack_exports__, __webpack_require__) {
26037
26038"use strict";
26039Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
26040/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AbortError", function() { return AbortError; });
26041/*! *****************************************************************************
26042Copyright (c) Microsoft Corporation.
26043
26044Permission to use, copy, modify, and/or distribute this software for any
26045purpose with or without fee is hereby granted.
26046
26047THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
26048REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
26049AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
26050INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
26051LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
26052OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
26053PERFORMANCE OF THIS SOFTWARE.
26054***************************************************************************** */
26055/* global Reflect, Promise */
26056
26057var extendStatics = function(d, b) {
26058 extendStatics = Object.setPrototypeOf ||
26059 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
26060 function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
26061 return extendStatics(d, b);
26062};
26063
26064function __extends(d, b) {
26065 extendStatics(d, b);
26066 function __() { this.constructor = d; }
26067 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
26068}
26069
26070var AbortError = /** @class */ (function (_super) {
26071 __extends(AbortError, _super);
26072 function AbortError() {
26073 var _this = _super !== null && _super.apply(this, arguments) || this;
26074 _this.name = "AbortError";
26075 return _this;
26076 }
26077 return AbortError;
26078}(Error));
26079
26080
26081//# sourceMappingURL=index.es.js.map
26082
26083
26084/***/ }),
26085/* 575 */
26086/***/ (function(module, exports, __webpack_require__) {
26087
26088"use strict";
26089
26090
26091var _interopRequireDefault = __webpack_require__(1);
26092
26093var _symbol = _interopRequireDefault(__webpack_require__(77));
26094
26095var _iterator = _interopRequireDefault(__webpack_require__(154));
26096
26097var _trim = _interopRequireDefault(__webpack_require__(576));
26098
26099var _concat = _interopRequireDefault(__webpack_require__(19));
26100
26101var _indexOf = _interopRequireDefault(__webpack_require__(61));
26102
26103var _slice = _interopRequireDefault(__webpack_require__(34));
26104
26105function _typeof(obj) {
26106 "@babel/helpers - typeof";
26107
26108 if (typeof _symbol.default === "function" && typeof _iterator.default === "symbol") {
26109 _typeof = function _typeof(obj) {
26110 return typeof obj;
26111 };
26112 } else {
26113 _typeof = function _typeof(obj) {
26114 return obj && typeof _symbol.default === "function" && obj.constructor === _symbol.default && obj !== _symbol.default.prototype ? "symbol" : typeof obj;
26115 };
26116 }
26117
26118 return _typeof(obj);
26119}
26120/**
26121 * Root reference for iframes.
26122 */
26123
26124
26125var root;
26126
26127if (typeof window !== 'undefined') {
26128 // Browser window
26129 root = window;
26130} else if (typeof self === 'undefined') {
26131 // Other environments
26132 console.warn('Using browser-only version of superagent in non-browser environment');
26133 root = void 0;
26134} else {
26135 // Web Worker
26136 root = self;
26137}
26138
26139var Emitter = __webpack_require__(583);
26140
26141var safeStringify = __webpack_require__(584);
26142
26143var RequestBase = __webpack_require__(585);
26144
26145var isObject = __webpack_require__(260);
26146
26147var ResponseBase = __webpack_require__(606);
26148
26149var Agent = __webpack_require__(613);
26150/**
26151 * Noop.
26152 */
26153
26154
26155function noop() {}
26156/**
26157 * Expose `request`.
26158 */
26159
26160
26161module.exports = function (method, url) {
26162 // callback
26163 if (typeof url === 'function') {
26164 return new exports.Request('GET', method).end(url);
26165 } // url first
26166
26167
26168 if (arguments.length === 1) {
26169 return new exports.Request('GET', method);
26170 }
26171
26172 return new exports.Request(method, url);
26173};
26174
26175exports = module.exports;
26176var request = exports;
26177exports.Request = Request;
26178/**
26179 * Determine XHR.
26180 */
26181
26182request.getXHR = function () {
26183 if (root.XMLHttpRequest && (!root.location || root.location.protocol !== 'file:' || !root.ActiveXObject)) {
26184 return new XMLHttpRequest();
26185 }
26186
26187 try {
26188 return new ActiveXObject('Microsoft.XMLHTTP');
26189 } catch (_unused) {}
26190
26191 try {
26192 return new ActiveXObject('Msxml2.XMLHTTP.6.0');
26193 } catch (_unused2) {}
26194
26195 try {
26196 return new ActiveXObject('Msxml2.XMLHTTP.3.0');
26197 } catch (_unused3) {}
26198
26199 try {
26200 return new ActiveXObject('Msxml2.XMLHTTP');
26201 } catch (_unused4) {}
26202
26203 throw new Error('Browser-only version of superagent could not find XHR');
26204};
26205/**
26206 * Removes leading and trailing whitespace, added to support IE.
26207 *
26208 * @param {String} s
26209 * @return {String}
26210 * @api private
26211 */
26212
26213
26214var trim = (0, _trim.default)('') ? function (s) {
26215 return (0, _trim.default)(s).call(s);
26216} : function (s) {
26217 return s.replace(/(^\s*|\s*$)/g, '');
26218};
26219/**
26220 * Serialize the given `obj`.
26221 *
26222 * @param {Object} obj
26223 * @return {String}
26224 * @api private
26225 */
26226
26227function serialize(obj) {
26228 if (!isObject(obj)) return obj;
26229 var pairs = [];
26230
26231 for (var key in obj) {
26232 if (Object.prototype.hasOwnProperty.call(obj, key)) pushEncodedKeyValuePair(pairs, key, obj[key]);
26233 }
26234
26235 return pairs.join('&');
26236}
26237/**
26238 * Helps 'serialize' with serializing arrays.
26239 * Mutates the pairs array.
26240 *
26241 * @param {Array} pairs
26242 * @param {String} key
26243 * @param {Mixed} val
26244 */
26245
26246
26247function pushEncodedKeyValuePair(pairs, key, val) {
26248 if (val === undefined) return;
26249
26250 if (val === null) {
26251 pairs.push(encodeURI(key));
26252 return;
26253 }
26254
26255 if (Array.isArray(val)) {
26256 val.forEach(function (v) {
26257 pushEncodedKeyValuePair(pairs, key, v);
26258 });
26259 } else if (isObject(val)) {
26260 for (var subkey in val) {
26261 var _context;
26262
26263 if (Object.prototype.hasOwnProperty.call(val, subkey)) pushEncodedKeyValuePair(pairs, (0, _concat.default)(_context = "".concat(key, "[")).call(_context, subkey, "]"), val[subkey]);
26264 }
26265 } else {
26266 pairs.push(encodeURI(key) + '=' + encodeURIComponent(val));
26267 }
26268}
26269/**
26270 * Expose serialization method.
26271 */
26272
26273
26274request.serializeObject = serialize;
26275/**
26276 * Parse the given x-www-form-urlencoded `str`.
26277 *
26278 * @param {String} str
26279 * @return {Object}
26280 * @api private
26281 */
26282
26283function parseString(str) {
26284 var obj = {};
26285 var pairs = str.split('&');
26286 var pair;
26287 var pos;
26288
26289 for (var i = 0, len = pairs.length; i < len; ++i) {
26290 pair = pairs[i];
26291 pos = (0, _indexOf.default)(pair).call(pair, '=');
26292
26293 if (pos === -1) {
26294 obj[decodeURIComponent(pair)] = '';
26295 } else {
26296 obj[decodeURIComponent((0, _slice.default)(pair).call(pair, 0, pos))] = decodeURIComponent((0, _slice.default)(pair).call(pair, pos + 1));
26297 }
26298 }
26299
26300 return obj;
26301}
26302/**
26303 * Expose parser.
26304 */
26305
26306
26307request.parseString = parseString;
26308/**
26309 * Default MIME type map.
26310 *
26311 * superagent.types.xml = 'application/xml';
26312 *
26313 */
26314
26315request.types = {
26316 html: 'text/html',
26317 json: 'application/json',
26318 xml: 'text/xml',
26319 urlencoded: 'application/x-www-form-urlencoded',
26320 form: 'application/x-www-form-urlencoded',
26321 'form-data': 'application/x-www-form-urlencoded'
26322};
26323/**
26324 * Default serialization map.
26325 *
26326 * superagent.serialize['application/xml'] = function(obj){
26327 * return 'generated xml here';
26328 * };
26329 *
26330 */
26331
26332request.serialize = {
26333 'application/x-www-form-urlencoded': serialize,
26334 'application/json': safeStringify
26335};
26336/**
26337 * Default parsers.
26338 *
26339 * superagent.parse['application/xml'] = function(str){
26340 * return { object parsed from str };
26341 * };
26342 *
26343 */
26344
26345request.parse = {
26346 'application/x-www-form-urlencoded': parseString,
26347 'application/json': JSON.parse
26348};
26349/**
26350 * Parse the given header `str` into
26351 * an object containing the mapped fields.
26352 *
26353 * @param {String} str
26354 * @return {Object}
26355 * @api private
26356 */
26357
26358function parseHeader(str) {
26359 var lines = str.split(/\r?\n/);
26360 var fields = {};
26361 var index;
26362 var line;
26363 var field;
26364 var val;
26365
26366 for (var i = 0, len = lines.length; i < len; ++i) {
26367 line = lines[i];
26368 index = (0, _indexOf.default)(line).call(line, ':');
26369
26370 if (index === -1) {
26371 // could be empty line, just skip it
26372 continue;
26373 }
26374
26375 field = (0, _slice.default)(line).call(line, 0, index).toLowerCase();
26376 val = trim((0, _slice.default)(line).call(line, index + 1));
26377 fields[field] = val;
26378 }
26379
26380 return fields;
26381}
26382/**
26383 * Check if `mime` is json or has +json structured syntax suffix.
26384 *
26385 * @param {String} mime
26386 * @return {Boolean}
26387 * @api private
26388 */
26389
26390
26391function isJSON(mime) {
26392 // should match /json or +json
26393 // but not /json-seq
26394 return /[/+]json($|[^-\w])/.test(mime);
26395}
26396/**
26397 * Initialize a new `Response` with the given `xhr`.
26398 *
26399 * - set flags (.ok, .error, etc)
26400 * - parse header
26401 *
26402 * Examples:
26403 *
26404 * Aliasing `superagent` as `request` is nice:
26405 *
26406 * request = superagent;
26407 *
26408 * We can use the promise-like API, or pass callbacks:
26409 *
26410 * request.get('/').end(function(res){});
26411 * request.get('/', function(res){});
26412 *
26413 * Sending data can be chained:
26414 *
26415 * request
26416 * .post('/user')
26417 * .send({ name: 'tj' })
26418 * .end(function(res){});
26419 *
26420 * Or passed to `.send()`:
26421 *
26422 * request
26423 * .post('/user')
26424 * .send({ name: 'tj' }, function(res){});
26425 *
26426 * Or passed to `.post()`:
26427 *
26428 * request
26429 * .post('/user', { name: 'tj' })
26430 * .end(function(res){});
26431 *
26432 * Or further reduced to a single call for simple cases:
26433 *
26434 * request
26435 * .post('/user', { name: 'tj' }, function(res){});
26436 *
26437 * @param {XMLHTTPRequest} xhr
26438 * @param {Object} options
26439 * @api private
26440 */
26441
26442
26443function Response(req) {
26444 this.req = req;
26445 this.xhr = this.req.xhr; // responseText is accessible only if responseType is '' or 'text' and on older browsers
26446
26447 this.text = this.req.method !== 'HEAD' && (this.xhr.responseType === '' || this.xhr.responseType === 'text') || typeof this.xhr.responseType === 'undefined' ? this.xhr.responseText : null;
26448 this.statusText = this.req.xhr.statusText;
26449 var status = this.xhr.status; // handle IE9 bug: http://stackoverflow.com/questions/10046972/msie-returns-status-code-of-1223-for-ajax-request
26450
26451 if (status === 1223) {
26452 status = 204;
26453 }
26454
26455 this._setStatusProperties(status);
26456
26457 this.headers = parseHeader(this.xhr.getAllResponseHeaders());
26458 this.header = this.headers; // getAllResponseHeaders sometimes falsely returns "" for CORS requests, but
26459 // getResponseHeader still works. so we get content-type even if getting
26460 // other headers fails.
26461
26462 this.header['content-type'] = this.xhr.getResponseHeader('content-type');
26463
26464 this._setHeaderProperties(this.header);
26465
26466 if (this.text === null && req._responseType) {
26467 this.body = this.xhr.response;
26468 } else {
26469 this.body = this.req.method === 'HEAD' ? null : this._parseBody(this.text ? this.text : this.xhr.response);
26470 }
26471} // eslint-disable-next-line new-cap
26472
26473
26474ResponseBase(Response.prototype);
26475/**
26476 * Parse the given body `str`.
26477 *
26478 * Used for auto-parsing of bodies. Parsers
26479 * are defined on the `superagent.parse` object.
26480 *
26481 * @param {String} str
26482 * @return {Mixed}
26483 * @api private
26484 */
26485
26486Response.prototype._parseBody = function (str) {
26487 var parse = request.parse[this.type];
26488
26489 if (this.req._parser) {
26490 return this.req._parser(this, str);
26491 }
26492
26493 if (!parse && isJSON(this.type)) {
26494 parse = request.parse['application/json'];
26495 }
26496
26497 return parse && str && (str.length > 0 || str instanceof Object) ? parse(str) : null;
26498};
26499/**
26500 * Return an `Error` representative of this response.
26501 *
26502 * @return {Error}
26503 * @api public
26504 */
26505
26506
26507Response.prototype.toError = function () {
26508 var _context2, _context3;
26509
26510 var req = this.req;
26511 var method = req.method;
26512 var url = req.url;
26513 var msg = (0, _concat.default)(_context2 = (0, _concat.default)(_context3 = "cannot ".concat(method, " ")).call(_context3, url, " (")).call(_context2, this.status, ")");
26514 var err = new Error(msg);
26515 err.status = this.status;
26516 err.method = method;
26517 err.url = url;
26518 return err;
26519};
26520/**
26521 * Expose `Response`.
26522 */
26523
26524
26525request.Response = Response;
26526/**
26527 * Initialize a new `Request` with the given `method` and `url`.
26528 *
26529 * @param {String} method
26530 * @param {String} url
26531 * @api public
26532 */
26533
26534function Request(method, url) {
26535 var self = this;
26536 this._query = this._query || [];
26537 this.method = method;
26538 this.url = url;
26539 this.header = {}; // preserves header name case
26540
26541 this._header = {}; // coerces header names to lowercase
26542
26543 this.on('end', function () {
26544 var err = null;
26545 var res = null;
26546
26547 try {
26548 res = new Response(self);
26549 } catch (err_) {
26550 err = new Error('Parser is unable to parse the response');
26551 err.parse = true;
26552 err.original = err_; // issue #675: return the raw response if the response parsing fails
26553
26554 if (self.xhr) {
26555 // ie9 doesn't have 'response' property
26556 err.rawResponse = typeof self.xhr.responseType === 'undefined' ? self.xhr.responseText : self.xhr.response; // issue #876: return the http status code if the response parsing fails
26557
26558 err.status = self.xhr.status ? self.xhr.status : null;
26559 err.statusCode = err.status; // backwards-compat only
26560 } else {
26561 err.rawResponse = null;
26562 err.status = null;
26563 }
26564
26565 return self.callback(err);
26566 }
26567
26568 self.emit('response', res);
26569 var new_err;
26570
26571 try {
26572 if (!self._isResponseOK(res)) {
26573 new_err = new Error(res.statusText || res.text || 'Unsuccessful HTTP response');
26574 }
26575 } catch (err_) {
26576 new_err = err_; // ok() callback can throw
26577 } // #1000 don't catch errors from the callback to avoid double calling it
26578
26579
26580 if (new_err) {
26581 new_err.original = err;
26582 new_err.response = res;
26583 new_err.status = res.status;
26584 self.callback(new_err, res);
26585 } else {
26586 self.callback(null, res);
26587 }
26588 });
26589}
26590/**
26591 * Mixin `Emitter` and `RequestBase`.
26592 */
26593// eslint-disable-next-line new-cap
26594
26595
26596Emitter(Request.prototype); // eslint-disable-next-line new-cap
26597
26598RequestBase(Request.prototype);
26599/**
26600 * Set Content-Type to `type`, mapping values from `request.types`.
26601 *
26602 * Examples:
26603 *
26604 * superagent.types.xml = 'application/xml';
26605 *
26606 * request.post('/')
26607 * .type('xml')
26608 * .send(xmlstring)
26609 * .end(callback);
26610 *
26611 * request.post('/')
26612 * .type('application/xml')
26613 * .send(xmlstring)
26614 * .end(callback);
26615 *
26616 * @param {String} type
26617 * @return {Request} for chaining
26618 * @api public
26619 */
26620
26621Request.prototype.type = function (type) {
26622 this.set('Content-Type', request.types[type] || type);
26623 return this;
26624};
26625/**
26626 * Set Accept to `type`, mapping values from `request.types`.
26627 *
26628 * Examples:
26629 *
26630 * superagent.types.json = 'application/json';
26631 *
26632 * request.get('/agent')
26633 * .accept('json')
26634 * .end(callback);
26635 *
26636 * request.get('/agent')
26637 * .accept('application/json')
26638 * .end(callback);
26639 *
26640 * @param {String} accept
26641 * @return {Request} for chaining
26642 * @api public
26643 */
26644
26645
26646Request.prototype.accept = function (type) {
26647 this.set('Accept', request.types[type] || type);
26648 return this;
26649};
26650/**
26651 * Set Authorization field value with `user` and `pass`.
26652 *
26653 * @param {String} user
26654 * @param {String} [pass] optional in case of using 'bearer' as type
26655 * @param {Object} options with 'type' property 'auto', 'basic' or 'bearer' (default 'basic')
26656 * @return {Request} for chaining
26657 * @api public
26658 */
26659
26660
26661Request.prototype.auth = function (user, pass, options) {
26662 if (arguments.length === 1) pass = '';
26663
26664 if (_typeof(pass) === 'object' && pass !== null) {
26665 // pass is optional and can be replaced with options
26666 options = pass;
26667 pass = '';
26668 }
26669
26670 if (!options) {
26671 options = {
26672 type: typeof btoa === 'function' ? 'basic' : 'auto'
26673 };
26674 }
26675
26676 var encoder = function encoder(string) {
26677 if (typeof btoa === 'function') {
26678 return btoa(string);
26679 }
26680
26681 throw new Error('Cannot use basic auth, btoa is not a function');
26682 };
26683
26684 return this._auth(user, pass, options, encoder);
26685};
26686/**
26687 * Add query-string `val`.
26688 *
26689 * Examples:
26690 *
26691 * request.get('/shoes')
26692 * .query('size=10')
26693 * .query({ color: 'blue' })
26694 *
26695 * @param {Object|String} val
26696 * @return {Request} for chaining
26697 * @api public
26698 */
26699
26700
26701Request.prototype.query = function (val) {
26702 if (typeof val !== 'string') val = serialize(val);
26703 if (val) this._query.push(val);
26704 return this;
26705};
26706/**
26707 * Queue the given `file` as an attachment to the specified `field`,
26708 * with optional `options` (or filename).
26709 *
26710 * ``` js
26711 * request.post('/upload')
26712 * .attach('content', new Blob(['<a id="a"><b id="b">hey!</b></a>'], { type: "text/html"}))
26713 * .end(callback);
26714 * ```
26715 *
26716 * @param {String} field
26717 * @param {Blob|File} file
26718 * @param {String|Object} options
26719 * @return {Request} for chaining
26720 * @api public
26721 */
26722
26723
26724Request.prototype.attach = function (field, file, options) {
26725 if (file) {
26726 if (this._data) {
26727 throw new Error("superagent can't mix .send() and .attach()");
26728 }
26729
26730 this._getFormData().append(field, file, options || file.name);
26731 }
26732
26733 return this;
26734};
26735
26736Request.prototype._getFormData = function () {
26737 if (!this._formData) {
26738 this._formData = new root.FormData();
26739 }
26740
26741 return this._formData;
26742};
26743/**
26744 * Invoke the callback with `err` and `res`
26745 * and handle arity check.
26746 *
26747 * @param {Error} err
26748 * @param {Response} res
26749 * @api private
26750 */
26751
26752
26753Request.prototype.callback = function (err, res) {
26754 if (this._shouldRetry(err, res)) {
26755 return this._retry();
26756 }
26757
26758 var fn = this._callback;
26759 this.clearTimeout();
26760
26761 if (err) {
26762 if (this._maxRetries) err.retries = this._retries - 1;
26763 this.emit('error', err);
26764 }
26765
26766 fn(err, res);
26767};
26768/**
26769 * Invoke callback with x-domain error.
26770 *
26771 * @api private
26772 */
26773
26774
26775Request.prototype.crossDomainError = function () {
26776 var err = new Error('Request has been terminated\nPossible causes: the network is offline, Origin is not allowed by Access-Control-Allow-Origin, the page is being unloaded, etc.');
26777 err.crossDomain = true;
26778 err.status = this.status;
26779 err.method = this.method;
26780 err.url = this.url;
26781 this.callback(err);
26782}; // This only warns, because the request is still likely to work
26783
26784
26785Request.prototype.agent = function () {
26786 console.warn('This is not supported in browser version of superagent');
26787 return this;
26788};
26789
26790Request.prototype.ca = Request.prototype.agent;
26791Request.prototype.buffer = Request.prototype.ca; // This throws, because it can't send/receive data as expected
26792
26793Request.prototype.write = function () {
26794 throw new Error('Streaming is not supported in browser version of superagent');
26795};
26796
26797Request.prototype.pipe = Request.prototype.write;
26798/**
26799 * Check if `obj` is a host object,
26800 * we don't want to serialize these :)
26801 *
26802 * @param {Object} obj host object
26803 * @return {Boolean} is a host object
26804 * @api private
26805 */
26806
26807Request.prototype._isHost = function (obj) {
26808 // Native objects stringify to [object File], [object Blob], [object FormData], etc.
26809 return obj && _typeof(obj) === 'object' && !Array.isArray(obj) && Object.prototype.toString.call(obj) !== '[object Object]';
26810};
26811/**
26812 * Initiate request, invoking callback `fn(res)`
26813 * with an instanceof `Response`.
26814 *
26815 * @param {Function} fn
26816 * @return {Request} for chaining
26817 * @api public
26818 */
26819
26820
26821Request.prototype.end = function (fn) {
26822 if (this._endCalled) {
26823 console.warn('Warning: .end() was called twice. This is not supported in superagent');
26824 }
26825
26826 this._endCalled = true; // store callback
26827
26828 this._callback = fn || noop; // querystring
26829
26830 this._finalizeQueryString();
26831
26832 this._end();
26833};
26834
26835Request.prototype._setUploadTimeout = function () {
26836 var self = this; // upload timeout it's wokrs only if deadline timeout is off
26837
26838 if (this._uploadTimeout && !this._uploadTimeoutTimer) {
26839 this._uploadTimeoutTimer = setTimeout(function () {
26840 self._timeoutError('Upload timeout of ', self._uploadTimeout, 'ETIMEDOUT');
26841 }, this._uploadTimeout);
26842 }
26843}; // eslint-disable-next-line complexity
26844
26845
26846Request.prototype._end = function () {
26847 if (this._aborted) return this.callback(new Error('The request has been aborted even before .end() was called'));
26848 var self = this;
26849 this.xhr = request.getXHR();
26850 var xhr = this.xhr;
26851 var data = this._formData || this._data;
26852
26853 this._setTimeouts(); // state change
26854
26855
26856 xhr.onreadystatechange = function () {
26857 var readyState = xhr.readyState;
26858
26859 if (readyState >= 2 && self._responseTimeoutTimer) {
26860 clearTimeout(self._responseTimeoutTimer);
26861 }
26862
26863 if (readyState !== 4) {
26864 return;
26865 } // In IE9, reads to any property (e.g. status) off of an aborted XHR will
26866 // result in the error "Could not complete the operation due to error c00c023f"
26867
26868
26869 var status;
26870
26871 try {
26872 status = xhr.status;
26873 } catch (_unused5) {
26874 status = 0;
26875 }
26876
26877 if (!status) {
26878 if (self.timedout || self._aborted) return;
26879 return self.crossDomainError();
26880 }
26881
26882 self.emit('end');
26883 }; // progress
26884
26885
26886 var handleProgress = function handleProgress(direction, e) {
26887 if (e.total > 0) {
26888 e.percent = e.loaded / e.total * 100;
26889
26890 if (e.percent === 100) {
26891 clearTimeout(self._uploadTimeoutTimer);
26892 }
26893 }
26894
26895 e.direction = direction;
26896 self.emit('progress', e);
26897 };
26898
26899 if (this.hasListeners('progress')) {
26900 try {
26901 xhr.addEventListener('progress', handleProgress.bind(null, 'download'));
26902
26903 if (xhr.upload) {
26904 xhr.upload.addEventListener('progress', handleProgress.bind(null, 'upload'));
26905 }
26906 } catch (_unused6) {// Accessing xhr.upload fails in IE from a web worker, so just pretend it doesn't exist.
26907 // Reported here:
26908 // https://connect.microsoft.com/IE/feedback/details/837245/xmlhttprequest-upload-throws-invalid-argument-when-used-from-web-worker-context
26909 }
26910 }
26911
26912 if (xhr.upload) {
26913 this._setUploadTimeout();
26914 } // initiate request
26915
26916
26917 try {
26918 if (this.username && this.password) {
26919 xhr.open(this.method, this.url, true, this.username, this.password);
26920 } else {
26921 xhr.open(this.method, this.url, true);
26922 }
26923 } catch (err) {
26924 // see #1149
26925 return this.callback(err);
26926 } // CORS
26927
26928
26929 if (this._withCredentials) xhr.withCredentials = true; // body
26930
26931 if (!this._formData && this.method !== 'GET' && this.method !== 'HEAD' && typeof data !== 'string' && !this._isHost(data)) {
26932 // serialize stuff
26933 var contentType = this._header['content-type'];
26934
26935 var _serialize = this._serializer || request.serialize[contentType ? contentType.split(';')[0] : ''];
26936
26937 if (!_serialize && isJSON(contentType)) {
26938 _serialize = request.serialize['application/json'];
26939 }
26940
26941 if (_serialize) data = _serialize(data);
26942 } // set header fields
26943
26944
26945 for (var field in this.header) {
26946 if (this.header[field] === null) continue;
26947 if (Object.prototype.hasOwnProperty.call(this.header, field)) xhr.setRequestHeader(field, this.header[field]);
26948 }
26949
26950 if (this._responseType) {
26951 xhr.responseType = this._responseType;
26952 } // send stuff
26953
26954
26955 this.emit('request', this); // IE11 xhr.send(undefined) sends 'undefined' string as POST payload (instead of nothing)
26956 // We need null here if data is undefined
26957
26958 xhr.send(typeof data === 'undefined' ? null : data);
26959};
26960
26961request.agent = function () {
26962 return new Agent();
26963};
26964
26965['GET', 'POST', 'OPTIONS', 'PATCH', 'PUT', 'DELETE'].forEach(function (method) {
26966 Agent.prototype[method.toLowerCase()] = function (url, fn) {
26967 var req = new request.Request(method, url);
26968
26969 this._setDefaults(req);
26970
26971 if (fn) {
26972 req.end(fn);
26973 }
26974
26975 return req;
26976 };
26977});
26978Agent.prototype.del = Agent.prototype.delete;
26979/**
26980 * GET `url` with optional callback `fn(res)`.
26981 *
26982 * @param {String} url
26983 * @param {Mixed|Function} [data] or fn
26984 * @param {Function} [fn]
26985 * @return {Request}
26986 * @api public
26987 */
26988
26989request.get = function (url, data, fn) {
26990 var req = request('GET', url);
26991
26992 if (typeof data === 'function') {
26993 fn = data;
26994 data = null;
26995 }
26996
26997 if (data) req.query(data);
26998 if (fn) req.end(fn);
26999 return req;
27000};
27001/**
27002 * HEAD `url` with optional callback `fn(res)`.
27003 *
27004 * @param {String} url
27005 * @param {Mixed|Function} [data] or fn
27006 * @param {Function} [fn]
27007 * @return {Request}
27008 * @api public
27009 */
27010
27011
27012request.head = function (url, data, fn) {
27013 var req = request('HEAD', url);
27014
27015 if (typeof data === 'function') {
27016 fn = data;
27017 data = null;
27018 }
27019
27020 if (data) req.query(data);
27021 if (fn) req.end(fn);
27022 return req;
27023};
27024/**
27025 * OPTIONS query to `url` with optional callback `fn(res)`.
27026 *
27027 * @param {String} url
27028 * @param {Mixed|Function} [data] or fn
27029 * @param {Function} [fn]
27030 * @return {Request}
27031 * @api public
27032 */
27033
27034
27035request.options = function (url, data, fn) {
27036 var req = request('OPTIONS', url);
27037
27038 if (typeof data === 'function') {
27039 fn = data;
27040 data = null;
27041 }
27042
27043 if (data) req.send(data);
27044 if (fn) req.end(fn);
27045 return req;
27046};
27047/**
27048 * DELETE `url` with optional `data` and callback `fn(res)`.
27049 *
27050 * @param {String} url
27051 * @param {Mixed} [data]
27052 * @param {Function} [fn]
27053 * @return {Request}
27054 * @api public
27055 */
27056
27057
27058function del(url, data, fn) {
27059 var req = request('DELETE', url);
27060
27061 if (typeof data === 'function') {
27062 fn = data;
27063 data = null;
27064 }
27065
27066 if (data) req.send(data);
27067 if (fn) req.end(fn);
27068 return req;
27069}
27070
27071request.del = del;
27072request.delete = del;
27073/**
27074 * PATCH `url` with optional `data` and callback `fn(res)`.
27075 *
27076 * @param {String} url
27077 * @param {Mixed} [data]
27078 * @param {Function} [fn]
27079 * @return {Request}
27080 * @api public
27081 */
27082
27083request.patch = function (url, data, fn) {
27084 var req = request('PATCH', url);
27085
27086 if (typeof data === 'function') {
27087 fn = data;
27088 data = null;
27089 }
27090
27091 if (data) req.send(data);
27092 if (fn) req.end(fn);
27093 return req;
27094};
27095/**
27096 * POST `url` with optional `data` and callback `fn(res)`.
27097 *
27098 * @param {String} url
27099 * @param {Mixed} [data]
27100 * @param {Function} [fn]
27101 * @return {Request}
27102 * @api public
27103 */
27104
27105
27106request.post = function (url, data, fn) {
27107 var req = request('POST', url);
27108
27109 if (typeof data === 'function') {
27110 fn = data;
27111 data = null;
27112 }
27113
27114 if (data) req.send(data);
27115 if (fn) req.end(fn);
27116 return req;
27117};
27118/**
27119 * PUT `url` with optional `data` and callback `fn(res)`.
27120 *
27121 * @param {String} url
27122 * @param {Mixed|Function} [data] or fn
27123 * @param {Function} [fn]
27124 * @return {Request}
27125 * @api public
27126 */
27127
27128
27129request.put = function (url, data, fn) {
27130 var req = request('PUT', url);
27131
27132 if (typeof data === 'function') {
27133 fn = data;
27134 data = null;
27135 }
27136
27137 if (data) req.send(data);
27138 if (fn) req.end(fn);
27139 return req;
27140};
27141
27142/***/ }),
27143/* 576 */
27144/***/ (function(module, exports, __webpack_require__) {
27145
27146module.exports = __webpack_require__(577);
27147
27148/***/ }),
27149/* 577 */
27150/***/ (function(module, exports, __webpack_require__) {
27151
27152var parent = __webpack_require__(578);
27153
27154module.exports = parent;
27155
27156
27157/***/ }),
27158/* 578 */
27159/***/ (function(module, exports, __webpack_require__) {
27160
27161var isPrototypeOf = __webpack_require__(16);
27162var method = __webpack_require__(579);
27163
27164var StringPrototype = String.prototype;
27165
27166module.exports = function (it) {
27167 var own = it.trim;
27168 return typeof it == 'string' || it === StringPrototype
27169 || (isPrototypeOf(StringPrototype, it) && own === StringPrototype.trim) ? method : own;
27170};
27171
27172
27173/***/ }),
27174/* 579 */
27175/***/ (function(module, exports, __webpack_require__) {
27176
27177__webpack_require__(580);
27178var entryVirtual = __webpack_require__(27);
27179
27180module.exports = entryVirtual('String').trim;
27181
27182
27183/***/ }),
27184/* 580 */
27185/***/ (function(module, exports, __webpack_require__) {
27186
27187"use strict";
27188
27189var $ = __webpack_require__(0);
27190var $trim = __webpack_require__(581).trim;
27191var forcedStringTrimMethod = __webpack_require__(582);
27192
27193// `String.prototype.trim` method
27194// https://tc39.es/ecma262/#sec-string.prototype.trim
27195$({ target: 'String', proto: true, forced: forcedStringTrimMethod('trim') }, {
27196 trim: function trim() {
27197 return $trim(this);
27198 }
27199});
27200
27201
27202/***/ }),
27203/* 581 */
27204/***/ (function(module, exports, __webpack_require__) {
27205
27206var uncurryThis = __webpack_require__(4);
27207var requireObjectCoercible = __webpack_require__(81);
27208var toString = __webpack_require__(42);
27209var whitespaces = __webpack_require__(259);
27210
27211var replace = uncurryThis(''.replace);
27212var whitespace = '[' + whitespaces + ']';
27213var ltrim = RegExp('^' + whitespace + whitespace + '*');
27214var rtrim = RegExp(whitespace + whitespace + '*$');
27215
27216// `String.prototype.{ trim, trimStart, trimEnd, trimLeft, trimRight }` methods implementation
27217var createMethod = function (TYPE) {
27218 return function ($this) {
27219 var string = toString(requireObjectCoercible($this));
27220 if (TYPE & 1) string = replace(string, ltrim, '');
27221 if (TYPE & 2) string = replace(string, rtrim, '');
27222 return string;
27223 };
27224};
27225
27226module.exports = {
27227 // `String.prototype.{ trimLeft, trimStart }` methods
27228 // https://tc39.es/ecma262/#sec-string.prototype.trimstart
27229 start: createMethod(1),
27230 // `String.prototype.{ trimRight, trimEnd }` methods
27231 // https://tc39.es/ecma262/#sec-string.prototype.trimend
27232 end: createMethod(2),
27233 // `String.prototype.trim` method
27234 // https://tc39.es/ecma262/#sec-string.prototype.trim
27235 trim: createMethod(3)
27236};
27237
27238
27239/***/ }),
27240/* 582 */
27241/***/ (function(module, exports, __webpack_require__) {
27242
27243var PROPER_FUNCTION_NAME = __webpack_require__(169).PROPER;
27244var fails = __webpack_require__(2);
27245var whitespaces = __webpack_require__(259);
27246
27247var non = '\u200B\u0085\u180E';
27248
27249// check that a method works with the correct list
27250// of whitespaces and has a correct name
27251module.exports = function (METHOD_NAME) {
27252 return fails(function () {
27253 return !!whitespaces[METHOD_NAME]()
27254 || non[METHOD_NAME]() !== non
27255 || (PROPER_FUNCTION_NAME && whitespaces[METHOD_NAME].name !== METHOD_NAME);
27256 });
27257};
27258
27259
27260/***/ }),
27261/* 583 */
27262/***/ (function(module, exports, __webpack_require__) {
27263
27264
27265/**
27266 * Expose `Emitter`.
27267 */
27268
27269if (true) {
27270 module.exports = Emitter;
27271}
27272
27273/**
27274 * Initialize a new `Emitter`.
27275 *
27276 * @api public
27277 */
27278
27279function Emitter(obj) {
27280 if (obj) return mixin(obj);
27281};
27282
27283/**
27284 * Mixin the emitter properties.
27285 *
27286 * @param {Object} obj
27287 * @return {Object}
27288 * @api private
27289 */
27290
27291function mixin(obj) {
27292 for (var key in Emitter.prototype) {
27293 obj[key] = Emitter.prototype[key];
27294 }
27295 return obj;
27296}
27297
27298/**
27299 * Listen on the given `event` with `fn`.
27300 *
27301 * @param {String} event
27302 * @param {Function} fn
27303 * @return {Emitter}
27304 * @api public
27305 */
27306
27307Emitter.prototype.on =
27308Emitter.prototype.addEventListener = function(event, fn){
27309 this._callbacks = this._callbacks || {};
27310 (this._callbacks['$' + event] = this._callbacks['$' + event] || [])
27311 .push(fn);
27312 return this;
27313};
27314
27315/**
27316 * Adds an `event` listener that will be invoked a single
27317 * time then automatically removed.
27318 *
27319 * @param {String} event
27320 * @param {Function} fn
27321 * @return {Emitter}
27322 * @api public
27323 */
27324
27325Emitter.prototype.once = function(event, fn){
27326 function on() {
27327 this.off(event, on);
27328 fn.apply(this, arguments);
27329 }
27330
27331 on.fn = fn;
27332 this.on(event, on);
27333 return this;
27334};
27335
27336/**
27337 * Remove the given callback for `event` or all
27338 * registered callbacks.
27339 *
27340 * @param {String} event
27341 * @param {Function} fn
27342 * @return {Emitter}
27343 * @api public
27344 */
27345
27346Emitter.prototype.off =
27347Emitter.prototype.removeListener =
27348Emitter.prototype.removeAllListeners =
27349Emitter.prototype.removeEventListener = function(event, fn){
27350 this._callbacks = this._callbacks || {};
27351
27352 // all
27353 if (0 == arguments.length) {
27354 this._callbacks = {};
27355 return this;
27356 }
27357
27358 // specific event
27359 var callbacks = this._callbacks['$' + event];
27360 if (!callbacks) return this;
27361
27362 // remove all handlers
27363 if (1 == arguments.length) {
27364 delete this._callbacks['$' + event];
27365 return this;
27366 }
27367
27368 // remove specific handler
27369 var cb;
27370 for (var i = 0; i < callbacks.length; i++) {
27371 cb = callbacks[i];
27372 if (cb === fn || cb.fn === fn) {
27373 callbacks.splice(i, 1);
27374 break;
27375 }
27376 }
27377
27378 // Remove event specific arrays for event types that no
27379 // one is subscribed for to avoid memory leak.
27380 if (callbacks.length === 0) {
27381 delete this._callbacks['$' + event];
27382 }
27383
27384 return this;
27385};
27386
27387/**
27388 * Emit `event` with the given args.
27389 *
27390 * @param {String} event
27391 * @param {Mixed} ...
27392 * @return {Emitter}
27393 */
27394
27395Emitter.prototype.emit = function(event){
27396 this._callbacks = this._callbacks || {};
27397
27398 var args = new Array(arguments.length - 1)
27399 , callbacks = this._callbacks['$' + event];
27400
27401 for (var i = 1; i < arguments.length; i++) {
27402 args[i - 1] = arguments[i];
27403 }
27404
27405 if (callbacks) {
27406 callbacks = callbacks.slice(0);
27407 for (var i = 0, len = callbacks.length; i < len; ++i) {
27408 callbacks[i].apply(this, args);
27409 }
27410 }
27411
27412 return this;
27413};
27414
27415/**
27416 * Return array of callbacks for `event`.
27417 *
27418 * @param {String} event
27419 * @return {Array}
27420 * @api public
27421 */
27422
27423Emitter.prototype.listeners = function(event){
27424 this._callbacks = this._callbacks || {};
27425 return this._callbacks['$' + event] || [];
27426};
27427
27428/**
27429 * Check if this emitter has `event` handlers.
27430 *
27431 * @param {String} event
27432 * @return {Boolean}
27433 * @api public
27434 */
27435
27436Emitter.prototype.hasListeners = function(event){
27437 return !! this.listeners(event).length;
27438};
27439
27440
27441/***/ }),
27442/* 584 */
27443/***/ (function(module, exports) {
27444
27445module.exports = stringify
27446stringify.default = stringify
27447stringify.stable = deterministicStringify
27448stringify.stableStringify = deterministicStringify
27449
27450var LIMIT_REPLACE_NODE = '[...]'
27451var CIRCULAR_REPLACE_NODE = '[Circular]'
27452
27453var arr = []
27454var replacerStack = []
27455
27456function defaultOptions () {
27457 return {
27458 depthLimit: Number.MAX_SAFE_INTEGER,
27459 edgesLimit: Number.MAX_SAFE_INTEGER
27460 }
27461}
27462
27463// Regular stringify
27464function stringify (obj, replacer, spacer, options) {
27465 if (typeof options === 'undefined') {
27466 options = defaultOptions()
27467 }
27468
27469 decirc(obj, '', 0, [], undefined, 0, options)
27470 var res
27471 try {
27472 if (replacerStack.length === 0) {
27473 res = JSON.stringify(obj, replacer, spacer)
27474 } else {
27475 res = JSON.stringify(obj, replaceGetterValues(replacer), spacer)
27476 }
27477 } catch (_) {
27478 return JSON.stringify('[unable to serialize, circular reference is too complex to analyze]')
27479 } finally {
27480 while (arr.length !== 0) {
27481 var part = arr.pop()
27482 if (part.length === 4) {
27483 Object.defineProperty(part[0], part[1], part[3])
27484 } else {
27485 part[0][part[1]] = part[2]
27486 }
27487 }
27488 }
27489 return res
27490}
27491
27492function setReplace (replace, val, k, parent) {
27493 var propertyDescriptor = Object.getOwnPropertyDescriptor(parent, k)
27494 if (propertyDescriptor.get !== undefined) {
27495 if (propertyDescriptor.configurable) {
27496 Object.defineProperty(parent, k, { value: replace })
27497 arr.push([parent, k, val, propertyDescriptor])
27498 } else {
27499 replacerStack.push([val, k, replace])
27500 }
27501 } else {
27502 parent[k] = replace
27503 arr.push([parent, k, val])
27504 }
27505}
27506
27507function decirc (val, k, edgeIndex, stack, parent, depth, options) {
27508 depth += 1
27509 var i
27510 if (typeof val === 'object' && val !== null) {
27511 for (i = 0; i < stack.length; i++) {
27512 if (stack[i] === val) {
27513 setReplace(CIRCULAR_REPLACE_NODE, val, k, parent)
27514 return
27515 }
27516 }
27517
27518 if (
27519 typeof options.depthLimit !== 'undefined' &&
27520 depth > options.depthLimit
27521 ) {
27522 setReplace(LIMIT_REPLACE_NODE, val, k, parent)
27523 return
27524 }
27525
27526 if (
27527 typeof options.edgesLimit !== 'undefined' &&
27528 edgeIndex + 1 > options.edgesLimit
27529 ) {
27530 setReplace(LIMIT_REPLACE_NODE, val, k, parent)
27531 return
27532 }
27533
27534 stack.push(val)
27535 // Optimize for Arrays. Big arrays could kill the performance otherwise!
27536 if (Array.isArray(val)) {
27537 for (i = 0; i < val.length; i++) {
27538 decirc(val[i], i, i, stack, val, depth, options)
27539 }
27540 } else {
27541 var keys = Object.keys(val)
27542 for (i = 0; i < keys.length; i++) {
27543 var key = keys[i]
27544 decirc(val[key], key, i, stack, val, depth, options)
27545 }
27546 }
27547 stack.pop()
27548 }
27549}
27550
27551// Stable-stringify
27552function compareFunction (a, b) {
27553 if (a < b) {
27554 return -1
27555 }
27556 if (a > b) {
27557 return 1
27558 }
27559 return 0
27560}
27561
27562function deterministicStringify (obj, replacer, spacer, options) {
27563 if (typeof options === 'undefined') {
27564 options = defaultOptions()
27565 }
27566
27567 var tmp = deterministicDecirc(obj, '', 0, [], undefined, 0, options) || obj
27568 var res
27569 try {
27570 if (replacerStack.length === 0) {
27571 res = JSON.stringify(tmp, replacer, spacer)
27572 } else {
27573 res = JSON.stringify(tmp, replaceGetterValues(replacer), spacer)
27574 }
27575 } catch (_) {
27576 return JSON.stringify('[unable to serialize, circular reference is too complex to analyze]')
27577 } finally {
27578 // Ensure that we restore the object as it was.
27579 while (arr.length !== 0) {
27580 var part = arr.pop()
27581 if (part.length === 4) {
27582 Object.defineProperty(part[0], part[1], part[3])
27583 } else {
27584 part[0][part[1]] = part[2]
27585 }
27586 }
27587 }
27588 return res
27589}
27590
27591function deterministicDecirc (val, k, edgeIndex, stack, parent, depth, options) {
27592 depth += 1
27593 var i
27594 if (typeof val === 'object' && val !== null) {
27595 for (i = 0; i < stack.length; i++) {
27596 if (stack[i] === val) {
27597 setReplace(CIRCULAR_REPLACE_NODE, val, k, parent)
27598 return
27599 }
27600 }
27601 try {
27602 if (typeof val.toJSON === 'function') {
27603 return
27604 }
27605 } catch (_) {
27606 return
27607 }
27608
27609 if (
27610 typeof options.depthLimit !== 'undefined' &&
27611 depth > options.depthLimit
27612 ) {
27613 setReplace(LIMIT_REPLACE_NODE, val, k, parent)
27614 return
27615 }
27616
27617 if (
27618 typeof options.edgesLimit !== 'undefined' &&
27619 edgeIndex + 1 > options.edgesLimit
27620 ) {
27621 setReplace(LIMIT_REPLACE_NODE, val, k, parent)
27622 return
27623 }
27624
27625 stack.push(val)
27626 // Optimize for Arrays. Big arrays could kill the performance otherwise!
27627 if (Array.isArray(val)) {
27628 for (i = 0; i < val.length; i++) {
27629 deterministicDecirc(val[i], i, i, stack, val, depth, options)
27630 }
27631 } else {
27632 // Create a temporary object in the required way
27633 var tmp = {}
27634 var keys = Object.keys(val).sort(compareFunction)
27635 for (i = 0; i < keys.length; i++) {
27636 var key = keys[i]
27637 deterministicDecirc(val[key], key, i, stack, val, depth, options)
27638 tmp[key] = val[key]
27639 }
27640 if (typeof parent !== 'undefined') {
27641 arr.push([parent, k, val])
27642 parent[k] = tmp
27643 } else {
27644 return tmp
27645 }
27646 }
27647 stack.pop()
27648 }
27649}
27650
27651// wraps replacer function to handle values we couldn't replace
27652// and mark them as replaced value
27653function replaceGetterValues (replacer) {
27654 replacer =
27655 typeof replacer !== 'undefined'
27656 ? replacer
27657 : function (k, v) {
27658 return v
27659 }
27660 return function (key, val) {
27661 if (replacerStack.length > 0) {
27662 for (var i = 0; i < replacerStack.length; i++) {
27663 var part = replacerStack[i]
27664 if (part[1] === key && part[0] === val) {
27665 val = part[2]
27666 replacerStack.splice(i, 1)
27667 break
27668 }
27669 }
27670 }
27671 return replacer.call(this, key, val)
27672 }
27673}
27674
27675
27676/***/ }),
27677/* 585 */
27678/***/ (function(module, exports, __webpack_require__) {
27679
27680"use strict";
27681
27682
27683var _interopRequireDefault = __webpack_require__(1);
27684
27685var _symbol = _interopRequireDefault(__webpack_require__(77));
27686
27687var _iterator = _interopRequireDefault(__webpack_require__(154));
27688
27689var _includes = _interopRequireDefault(__webpack_require__(586));
27690
27691var _promise = _interopRequireDefault(__webpack_require__(12));
27692
27693var _concat = _interopRequireDefault(__webpack_require__(19));
27694
27695var _indexOf = _interopRequireDefault(__webpack_require__(61));
27696
27697var _slice = _interopRequireDefault(__webpack_require__(34));
27698
27699var _sort = _interopRequireDefault(__webpack_require__(596));
27700
27701function _typeof(obj) {
27702 "@babel/helpers - typeof";
27703
27704 if (typeof _symbol.default === "function" && typeof _iterator.default === "symbol") {
27705 _typeof = function _typeof(obj) {
27706 return typeof obj;
27707 };
27708 } else {
27709 _typeof = function _typeof(obj) {
27710 return obj && typeof _symbol.default === "function" && obj.constructor === _symbol.default && obj !== _symbol.default.prototype ? "symbol" : typeof obj;
27711 };
27712 }
27713
27714 return _typeof(obj);
27715}
27716/**
27717 * Module of mixed-in functions shared between node and client code
27718 */
27719
27720
27721var isObject = __webpack_require__(260);
27722/**
27723 * Expose `RequestBase`.
27724 */
27725
27726
27727module.exports = RequestBase;
27728/**
27729 * Initialize a new `RequestBase`.
27730 *
27731 * @api public
27732 */
27733
27734function RequestBase(obj) {
27735 if (obj) return mixin(obj);
27736}
27737/**
27738 * Mixin the prototype properties.
27739 *
27740 * @param {Object} obj
27741 * @return {Object}
27742 * @api private
27743 */
27744
27745
27746function mixin(obj) {
27747 for (var key in RequestBase.prototype) {
27748 if (Object.prototype.hasOwnProperty.call(RequestBase.prototype, key)) obj[key] = RequestBase.prototype[key];
27749 }
27750
27751 return obj;
27752}
27753/**
27754 * Clear previous timeout.
27755 *
27756 * @return {Request} for chaining
27757 * @api public
27758 */
27759
27760
27761RequestBase.prototype.clearTimeout = function () {
27762 clearTimeout(this._timer);
27763 clearTimeout(this._responseTimeoutTimer);
27764 clearTimeout(this._uploadTimeoutTimer);
27765 delete this._timer;
27766 delete this._responseTimeoutTimer;
27767 delete this._uploadTimeoutTimer;
27768 return this;
27769};
27770/**
27771 * Override default response body parser
27772 *
27773 * This function will be called to convert incoming data into request.body
27774 *
27775 * @param {Function}
27776 * @api public
27777 */
27778
27779
27780RequestBase.prototype.parse = function (fn) {
27781 this._parser = fn;
27782 return this;
27783};
27784/**
27785 * Set format of binary response body.
27786 * In browser valid formats are 'blob' and 'arraybuffer',
27787 * which return Blob and ArrayBuffer, respectively.
27788 *
27789 * In Node all values result in Buffer.
27790 *
27791 * Examples:
27792 *
27793 * req.get('/')
27794 * .responseType('blob')
27795 * .end(callback);
27796 *
27797 * @param {String} val
27798 * @return {Request} for chaining
27799 * @api public
27800 */
27801
27802
27803RequestBase.prototype.responseType = function (val) {
27804 this._responseType = val;
27805 return this;
27806};
27807/**
27808 * Override default request body serializer
27809 *
27810 * This function will be called to convert data set via .send or .attach into payload to send
27811 *
27812 * @param {Function}
27813 * @api public
27814 */
27815
27816
27817RequestBase.prototype.serialize = function (fn) {
27818 this._serializer = fn;
27819 return this;
27820};
27821/**
27822 * Set timeouts.
27823 *
27824 * - response timeout is time between sending request and receiving the first byte of the response. Includes DNS and connection time.
27825 * - deadline is the time from start of the request to receiving response body in full. If the deadline is too short large files may not load at all on slow connections.
27826 * - upload is the time since last bit of data was sent or received. This timeout works only if deadline timeout is off
27827 *
27828 * Value of 0 or false means no timeout.
27829 *
27830 * @param {Number|Object} ms or {response, deadline}
27831 * @return {Request} for chaining
27832 * @api public
27833 */
27834
27835
27836RequestBase.prototype.timeout = function (options) {
27837 if (!options || _typeof(options) !== 'object') {
27838 this._timeout = options;
27839 this._responseTimeout = 0;
27840 this._uploadTimeout = 0;
27841 return this;
27842 }
27843
27844 for (var option in options) {
27845 if (Object.prototype.hasOwnProperty.call(options, option)) {
27846 switch (option) {
27847 case 'deadline':
27848 this._timeout = options.deadline;
27849 break;
27850
27851 case 'response':
27852 this._responseTimeout = options.response;
27853 break;
27854
27855 case 'upload':
27856 this._uploadTimeout = options.upload;
27857 break;
27858
27859 default:
27860 console.warn('Unknown timeout option', option);
27861 }
27862 }
27863 }
27864
27865 return this;
27866};
27867/**
27868 * Set number of retry attempts on error.
27869 *
27870 * Failed requests will be retried 'count' times if timeout or err.code >= 500.
27871 *
27872 * @param {Number} count
27873 * @param {Function} [fn]
27874 * @return {Request} for chaining
27875 * @api public
27876 */
27877
27878
27879RequestBase.prototype.retry = function (count, fn) {
27880 // Default to 1 if no count passed or true
27881 if (arguments.length === 0 || count === true) count = 1;
27882 if (count <= 0) count = 0;
27883 this._maxRetries = count;
27884 this._retries = 0;
27885 this._retryCallback = fn;
27886 return this;
27887};
27888
27889var ERROR_CODES = ['ECONNRESET', 'ETIMEDOUT', 'EADDRINFO', 'ESOCKETTIMEDOUT'];
27890/**
27891 * Determine if a request should be retried.
27892 * (Borrowed from segmentio/superagent-retry)
27893 *
27894 * @param {Error} err an error
27895 * @param {Response} [res] response
27896 * @returns {Boolean} if segment should be retried
27897 */
27898
27899RequestBase.prototype._shouldRetry = function (err, res) {
27900 if (!this._maxRetries || this._retries++ >= this._maxRetries) {
27901 return false;
27902 }
27903
27904 if (this._retryCallback) {
27905 try {
27906 var override = this._retryCallback(err, res);
27907
27908 if (override === true) return true;
27909 if (override === false) return false; // undefined falls back to defaults
27910 } catch (err_) {
27911 console.error(err_);
27912 }
27913 }
27914
27915 if (res && res.status && res.status >= 500 && res.status !== 501) return true;
27916
27917 if (err) {
27918 if (err.code && (0, _includes.default)(ERROR_CODES).call(ERROR_CODES, err.code)) return true; // Superagent timeout
27919
27920 if (err.timeout && err.code === 'ECONNABORTED') return true;
27921 if (err.crossDomain) return true;
27922 }
27923
27924 return false;
27925};
27926/**
27927 * Retry request
27928 *
27929 * @return {Request} for chaining
27930 * @api private
27931 */
27932
27933
27934RequestBase.prototype._retry = function () {
27935 this.clearTimeout(); // node
27936
27937 if (this.req) {
27938 this.req = null;
27939 this.req = this.request();
27940 }
27941
27942 this._aborted = false;
27943 this.timedout = false;
27944 this.timedoutError = null;
27945 return this._end();
27946};
27947/**
27948 * Promise support
27949 *
27950 * @param {Function} resolve
27951 * @param {Function} [reject]
27952 * @return {Request}
27953 */
27954
27955
27956RequestBase.prototype.then = function (resolve, reject) {
27957 var _this = this;
27958
27959 if (!this._fullfilledPromise) {
27960 var self = this;
27961
27962 if (this._endCalled) {
27963 console.warn('Warning: superagent request was sent twice, because both .end() and .then() were called. Never call .end() if you use promises');
27964 }
27965
27966 this._fullfilledPromise = new _promise.default(function (resolve, reject) {
27967 self.on('abort', function () {
27968 if (_this._maxRetries && _this._maxRetries > _this._retries) {
27969 return;
27970 }
27971
27972 if (_this.timedout && _this.timedoutError) {
27973 reject(_this.timedoutError);
27974 return;
27975 }
27976
27977 var err = new Error('Aborted');
27978 err.code = 'ABORTED';
27979 err.status = _this.status;
27980 err.method = _this.method;
27981 err.url = _this.url;
27982 reject(err);
27983 });
27984 self.end(function (err, res) {
27985 if (err) reject(err);else resolve(res);
27986 });
27987 });
27988 }
27989
27990 return this._fullfilledPromise.then(resolve, reject);
27991};
27992
27993RequestBase.prototype.catch = function (cb) {
27994 return this.then(undefined, cb);
27995};
27996/**
27997 * Allow for extension
27998 */
27999
28000
28001RequestBase.prototype.use = function (fn) {
28002 fn(this);
28003 return this;
28004};
28005
28006RequestBase.prototype.ok = function (cb) {
28007 if (typeof cb !== 'function') throw new Error('Callback required');
28008 this._okCallback = cb;
28009 return this;
28010};
28011
28012RequestBase.prototype._isResponseOK = function (res) {
28013 if (!res) {
28014 return false;
28015 }
28016
28017 if (this._okCallback) {
28018 return this._okCallback(res);
28019 }
28020
28021 return res.status >= 200 && res.status < 300;
28022};
28023/**
28024 * Get request header `field`.
28025 * Case-insensitive.
28026 *
28027 * @param {String} field
28028 * @return {String}
28029 * @api public
28030 */
28031
28032
28033RequestBase.prototype.get = function (field) {
28034 return this._header[field.toLowerCase()];
28035};
28036/**
28037 * Get case-insensitive header `field` value.
28038 * This is a deprecated internal API. Use `.get(field)` instead.
28039 *
28040 * (getHeader is no longer used internally by the superagent code base)
28041 *
28042 * @param {String} field
28043 * @return {String}
28044 * @api private
28045 * @deprecated
28046 */
28047
28048
28049RequestBase.prototype.getHeader = RequestBase.prototype.get;
28050/**
28051 * Set header `field` to `val`, or multiple fields with one object.
28052 * Case-insensitive.
28053 *
28054 * Examples:
28055 *
28056 * req.get('/')
28057 * .set('Accept', 'application/json')
28058 * .set('X-API-Key', 'foobar')
28059 * .end(callback);
28060 *
28061 * req.get('/')
28062 * .set({ Accept: 'application/json', 'X-API-Key': 'foobar' })
28063 * .end(callback);
28064 *
28065 * @param {String|Object} field
28066 * @param {String} val
28067 * @return {Request} for chaining
28068 * @api public
28069 */
28070
28071RequestBase.prototype.set = function (field, val) {
28072 if (isObject(field)) {
28073 for (var key in field) {
28074 if (Object.prototype.hasOwnProperty.call(field, key)) this.set(key, field[key]);
28075 }
28076
28077 return this;
28078 }
28079
28080 this._header[field.toLowerCase()] = val;
28081 this.header[field] = val;
28082 return this;
28083};
28084/**
28085 * Remove header `field`.
28086 * Case-insensitive.
28087 *
28088 * Example:
28089 *
28090 * req.get('/')
28091 * .unset('User-Agent')
28092 * .end(callback);
28093 *
28094 * @param {String} field field name
28095 */
28096
28097
28098RequestBase.prototype.unset = function (field) {
28099 delete this._header[field.toLowerCase()];
28100 delete this.header[field];
28101 return this;
28102};
28103/**
28104 * Write the field `name` and `val`, or multiple fields with one object
28105 * for "multipart/form-data" request bodies.
28106 *
28107 * ``` js
28108 * request.post('/upload')
28109 * .field('foo', 'bar')
28110 * .end(callback);
28111 *
28112 * request.post('/upload')
28113 * .field({ foo: 'bar', baz: 'qux' })
28114 * .end(callback);
28115 * ```
28116 *
28117 * @param {String|Object} name name of field
28118 * @param {String|Blob|File|Buffer|fs.ReadStream} val value of field
28119 * @return {Request} for chaining
28120 * @api public
28121 */
28122
28123
28124RequestBase.prototype.field = function (name, val) {
28125 // name should be either a string or an object.
28126 if (name === null || undefined === name) {
28127 throw new Error('.field(name, val) name can not be empty');
28128 }
28129
28130 if (this._data) {
28131 throw new Error(".field() can't be used if .send() is used. Please use only .send() or only .field() & .attach()");
28132 }
28133
28134 if (isObject(name)) {
28135 for (var key in name) {
28136 if (Object.prototype.hasOwnProperty.call(name, key)) this.field(key, name[key]);
28137 }
28138
28139 return this;
28140 }
28141
28142 if (Array.isArray(val)) {
28143 for (var i in val) {
28144 if (Object.prototype.hasOwnProperty.call(val, i)) this.field(name, val[i]);
28145 }
28146
28147 return this;
28148 } // val should be defined now
28149
28150
28151 if (val === null || undefined === val) {
28152 throw new Error('.field(name, val) val can not be empty');
28153 }
28154
28155 if (typeof val === 'boolean') {
28156 val = String(val);
28157 }
28158
28159 this._getFormData().append(name, val);
28160
28161 return this;
28162};
28163/**
28164 * Abort the request, and clear potential timeout.
28165 *
28166 * @return {Request} request
28167 * @api public
28168 */
28169
28170
28171RequestBase.prototype.abort = function () {
28172 if (this._aborted) {
28173 return this;
28174 }
28175
28176 this._aborted = true;
28177 if (this.xhr) this.xhr.abort(); // browser
28178
28179 if (this.req) this.req.abort(); // node
28180
28181 this.clearTimeout();
28182 this.emit('abort');
28183 return this;
28184};
28185
28186RequestBase.prototype._auth = function (user, pass, options, base64Encoder) {
28187 var _context;
28188
28189 switch (options.type) {
28190 case 'basic':
28191 this.set('Authorization', "Basic ".concat(base64Encoder((0, _concat.default)(_context = "".concat(user, ":")).call(_context, pass))));
28192 break;
28193
28194 case 'auto':
28195 this.username = user;
28196 this.password = pass;
28197 break;
28198
28199 case 'bearer':
28200 // usage would be .auth(accessToken, { type: 'bearer' })
28201 this.set('Authorization', "Bearer ".concat(user));
28202 break;
28203
28204 default:
28205 break;
28206 }
28207
28208 return this;
28209};
28210/**
28211 * Enable transmission of cookies with x-domain requests.
28212 *
28213 * Note that for this to work the origin must not be
28214 * using "Access-Control-Allow-Origin" with a wildcard,
28215 * and also must set "Access-Control-Allow-Credentials"
28216 * to "true".
28217 *
28218 * @api public
28219 */
28220
28221
28222RequestBase.prototype.withCredentials = function (on) {
28223 // This is browser-only functionality. Node side is no-op.
28224 if (on === undefined) on = true;
28225 this._withCredentials = on;
28226 return this;
28227};
28228/**
28229 * Set the max redirects to `n`. Does nothing in browser XHR implementation.
28230 *
28231 * @param {Number} n
28232 * @return {Request} for chaining
28233 * @api public
28234 */
28235
28236
28237RequestBase.prototype.redirects = function (n) {
28238 this._maxRedirects = n;
28239 return this;
28240};
28241/**
28242 * Maximum size of buffered response body, in bytes. Counts uncompressed size.
28243 * Default 200MB.
28244 *
28245 * @param {Number} n number of bytes
28246 * @return {Request} for chaining
28247 */
28248
28249
28250RequestBase.prototype.maxResponseSize = function (n) {
28251 if (typeof n !== 'number') {
28252 throw new TypeError('Invalid argument');
28253 }
28254
28255 this._maxResponseSize = n;
28256 return this;
28257};
28258/**
28259 * Convert to a plain javascript object (not JSON string) of scalar properties.
28260 * Note as this method is designed to return a useful non-this value,
28261 * it cannot be chained.
28262 *
28263 * @return {Object} describing method, url, and data of this request
28264 * @api public
28265 */
28266
28267
28268RequestBase.prototype.toJSON = function () {
28269 return {
28270 method: this.method,
28271 url: this.url,
28272 data: this._data,
28273 headers: this._header
28274 };
28275};
28276/**
28277 * Send `data` as the request body, defaulting the `.type()` to "json" when
28278 * an object is given.
28279 *
28280 * Examples:
28281 *
28282 * // manual json
28283 * request.post('/user')
28284 * .type('json')
28285 * .send('{"name":"tj"}')
28286 * .end(callback)
28287 *
28288 * // auto json
28289 * request.post('/user')
28290 * .send({ name: 'tj' })
28291 * .end(callback)
28292 *
28293 * // manual x-www-form-urlencoded
28294 * request.post('/user')
28295 * .type('form')
28296 * .send('name=tj')
28297 * .end(callback)
28298 *
28299 * // auto x-www-form-urlencoded
28300 * request.post('/user')
28301 * .type('form')
28302 * .send({ name: 'tj' })
28303 * .end(callback)
28304 *
28305 * // defaults to x-www-form-urlencoded
28306 * request.post('/user')
28307 * .send('name=tobi')
28308 * .send('species=ferret')
28309 * .end(callback)
28310 *
28311 * @param {String|Object} data
28312 * @return {Request} for chaining
28313 * @api public
28314 */
28315// eslint-disable-next-line complexity
28316
28317
28318RequestBase.prototype.send = function (data) {
28319 var isObj = isObject(data);
28320 var type = this._header['content-type'];
28321
28322 if (this._formData) {
28323 throw new Error(".send() can't be used if .attach() or .field() is used. Please use only .send() or only .field() & .attach()");
28324 }
28325
28326 if (isObj && !this._data) {
28327 if (Array.isArray(data)) {
28328 this._data = [];
28329 } else if (!this._isHost(data)) {
28330 this._data = {};
28331 }
28332 } else if (data && this._data && this._isHost(this._data)) {
28333 throw new Error("Can't merge these send calls");
28334 } // merge
28335
28336
28337 if (isObj && isObject(this._data)) {
28338 for (var key in data) {
28339 if (Object.prototype.hasOwnProperty.call(data, key)) this._data[key] = data[key];
28340 }
28341 } else if (typeof data === 'string') {
28342 // default to x-www-form-urlencoded
28343 if (!type) this.type('form');
28344 type = this._header['content-type'];
28345
28346 if (type === 'application/x-www-form-urlencoded') {
28347 var _context2;
28348
28349 this._data = this._data ? (0, _concat.default)(_context2 = "".concat(this._data, "&")).call(_context2, data) : data;
28350 } else {
28351 this._data = (this._data || '') + data;
28352 }
28353 } else {
28354 this._data = data;
28355 }
28356
28357 if (!isObj || this._isHost(data)) {
28358 return this;
28359 } // default to json
28360
28361
28362 if (!type) this.type('json');
28363 return this;
28364};
28365/**
28366 * Sort `querystring` by the sort function
28367 *
28368 *
28369 * Examples:
28370 *
28371 * // default order
28372 * request.get('/user')
28373 * .query('name=Nick')
28374 * .query('search=Manny')
28375 * .sortQuery()
28376 * .end(callback)
28377 *
28378 * // customized sort function
28379 * request.get('/user')
28380 * .query('name=Nick')
28381 * .query('search=Manny')
28382 * .sortQuery(function(a, b){
28383 * return a.length - b.length;
28384 * })
28385 * .end(callback)
28386 *
28387 *
28388 * @param {Function} sort
28389 * @return {Request} for chaining
28390 * @api public
28391 */
28392
28393
28394RequestBase.prototype.sortQuery = function (sort) {
28395 // _sort default to true but otherwise can be a function or boolean
28396 this._sort = typeof sort === 'undefined' ? true : sort;
28397 return this;
28398};
28399/**
28400 * Compose querystring to append to req.url
28401 *
28402 * @api private
28403 */
28404
28405
28406RequestBase.prototype._finalizeQueryString = function () {
28407 var query = this._query.join('&');
28408
28409 if (query) {
28410 var _context3;
28411
28412 this.url += ((0, _includes.default)(_context3 = this.url).call(_context3, '?') ? '&' : '?') + query;
28413 }
28414
28415 this._query.length = 0; // Makes the call idempotent
28416
28417 if (this._sort) {
28418 var _context4;
28419
28420 var index = (0, _indexOf.default)(_context4 = this.url).call(_context4, '?');
28421
28422 if (index >= 0) {
28423 var _context5, _context6;
28424
28425 var queryArr = (0, _slice.default)(_context5 = this.url).call(_context5, index + 1).split('&');
28426
28427 if (typeof this._sort === 'function') {
28428 (0, _sort.default)(queryArr).call(queryArr, this._sort);
28429 } else {
28430 (0, _sort.default)(queryArr).call(queryArr);
28431 }
28432
28433 this.url = (0, _slice.default)(_context6 = this.url).call(_context6, 0, index) + '?' + queryArr.join('&');
28434 }
28435 }
28436}; // For backwards compat only
28437
28438
28439RequestBase.prototype._appendQueryString = function () {
28440 console.warn('Unsupported');
28441};
28442/**
28443 * Invoke callback with timeout error.
28444 *
28445 * @api private
28446 */
28447
28448
28449RequestBase.prototype._timeoutError = function (reason, timeout, errno) {
28450 if (this._aborted) {
28451 return;
28452 }
28453
28454 var err = new Error("".concat(reason + timeout, "ms exceeded"));
28455 err.timeout = timeout;
28456 err.code = 'ECONNABORTED';
28457 err.errno = errno;
28458 this.timedout = true;
28459 this.timedoutError = err;
28460 this.abort();
28461 this.callback(err);
28462};
28463
28464RequestBase.prototype._setTimeouts = function () {
28465 var self = this; // deadline
28466
28467 if (this._timeout && !this._timer) {
28468 this._timer = setTimeout(function () {
28469 self._timeoutError('Timeout of ', self._timeout, 'ETIME');
28470 }, this._timeout);
28471 } // response timeout
28472
28473
28474 if (this._responseTimeout && !this._responseTimeoutTimer) {
28475 this._responseTimeoutTimer = setTimeout(function () {
28476 self._timeoutError('Response timeout of ', self._responseTimeout, 'ETIMEDOUT');
28477 }, this._responseTimeout);
28478 }
28479};
28480
28481/***/ }),
28482/* 586 */
28483/***/ (function(module, exports, __webpack_require__) {
28484
28485module.exports = __webpack_require__(587);
28486
28487/***/ }),
28488/* 587 */
28489/***/ (function(module, exports, __webpack_require__) {
28490
28491var parent = __webpack_require__(588);
28492
28493module.exports = parent;
28494
28495
28496/***/ }),
28497/* 588 */
28498/***/ (function(module, exports, __webpack_require__) {
28499
28500var isPrototypeOf = __webpack_require__(16);
28501var arrayMethod = __webpack_require__(589);
28502var stringMethod = __webpack_require__(591);
28503
28504var ArrayPrototype = Array.prototype;
28505var StringPrototype = String.prototype;
28506
28507module.exports = function (it) {
28508 var own = it.includes;
28509 if (it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.includes)) return arrayMethod;
28510 if (typeof it == 'string' || it === StringPrototype || (isPrototypeOf(StringPrototype, it) && own === StringPrototype.includes)) {
28511 return stringMethod;
28512 } return own;
28513};
28514
28515
28516/***/ }),
28517/* 589 */
28518/***/ (function(module, exports, __webpack_require__) {
28519
28520__webpack_require__(590);
28521var entryVirtual = __webpack_require__(27);
28522
28523module.exports = entryVirtual('Array').includes;
28524
28525
28526/***/ }),
28527/* 590 */
28528/***/ (function(module, exports, __webpack_require__) {
28529
28530"use strict";
28531
28532var $ = __webpack_require__(0);
28533var $includes = __webpack_require__(125).includes;
28534var fails = __webpack_require__(2);
28535var addToUnscopables = __webpack_require__(131);
28536
28537// FF99+ bug
28538var BROKEN_ON_SPARSE = fails(function () {
28539 return !Array(1).includes();
28540});
28541
28542// `Array.prototype.includes` method
28543// https://tc39.es/ecma262/#sec-array.prototype.includes
28544$({ target: 'Array', proto: true, forced: BROKEN_ON_SPARSE }, {
28545 includes: function includes(el /* , fromIndex = 0 */) {
28546 return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined);
28547 }
28548});
28549
28550// https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
28551addToUnscopables('includes');
28552
28553
28554/***/ }),
28555/* 591 */
28556/***/ (function(module, exports, __webpack_require__) {
28557
28558__webpack_require__(592);
28559var entryVirtual = __webpack_require__(27);
28560
28561module.exports = entryVirtual('String').includes;
28562
28563
28564/***/ }),
28565/* 592 */
28566/***/ (function(module, exports, __webpack_require__) {
28567
28568"use strict";
28569
28570var $ = __webpack_require__(0);
28571var uncurryThis = __webpack_require__(4);
28572var notARegExp = __webpack_require__(593);
28573var requireObjectCoercible = __webpack_require__(81);
28574var toString = __webpack_require__(42);
28575var correctIsRegExpLogic = __webpack_require__(595);
28576
28577var stringIndexOf = uncurryThis(''.indexOf);
28578
28579// `String.prototype.includes` method
28580// https://tc39.es/ecma262/#sec-string.prototype.includes
28581$({ target: 'String', proto: true, forced: !correctIsRegExpLogic('includes') }, {
28582 includes: function includes(searchString /* , position = 0 */) {
28583 return !!~stringIndexOf(
28584 toString(requireObjectCoercible(this)),
28585 toString(notARegExp(searchString)),
28586 arguments.length > 1 ? arguments[1] : undefined
28587 );
28588 }
28589});
28590
28591
28592/***/ }),
28593/* 593 */
28594/***/ (function(module, exports, __webpack_require__) {
28595
28596var isRegExp = __webpack_require__(594);
28597
28598var $TypeError = TypeError;
28599
28600module.exports = function (it) {
28601 if (isRegExp(it)) {
28602 throw $TypeError("The method doesn't accept regular expressions");
28603 } return it;
28604};
28605
28606
28607/***/ }),
28608/* 594 */
28609/***/ (function(module, exports, __webpack_require__) {
28610
28611var isObject = __webpack_require__(11);
28612var classof = __webpack_require__(50);
28613var wellKnownSymbol = __webpack_require__(5);
28614
28615var MATCH = wellKnownSymbol('match');
28616
28617// `IsRegExp` abstract operation
28618// https://tc39.es/ecma262/#sec-isregexp
28619module.exports = function (it) {
28620 var isRegExp;
28621 return isObject(it) && ((isRegExp = it[MATCH]) !== undefined ? !!isRegExp : classof(it) == 'RegExp');
28622};
28623
28624
28625/***/ }),
28626/* 595 */
28627/***/ (function(module, exports, __webpack_require__) {
28628
28629var wellKnownSymbol = __webpack_require__(5);
28630
28631var MATCH = wellKnownSymbol('match');
28632
28633module.exports = function (METHOD_NAME) {
28634 var regexp = /./;
28635 try {
28636 '/./'[METHOD_NAME](regexp);
28637 } catch (error1) {
28638 try {
28639 regexp[MATCH] = false;
28640 return '/./'[METHOD_NAME](regexp);
28641 } catch (error2) { /* empty */ }
28642 } return false;
28643};
28644
28645
28646/***/ }),
28647/* 596 */
28648/***/ (function(module, exports, __webpack_require__) {
28649
28650module.exports = __webpack_require__(597);
28651
28652/***/ }),
28653/* 597 */
28654/***/ (function(module, exports, __webpack_require__) {
28655
28656var parent = __webpack_require__(598);
28657
28658module.exports = parent;
28659
28660
28661/***/ }),
28662/* 598 */
28663/***/ (function(module, exports, __webpack_require__) {
28664
28665var isPrototypeOf = __webpack_require__(16);
28666var method = __webpack_require__(599);
28667
28668var ArrayPrototype = Array.prototype;
28669
28670module.exports = function (it) {
28671 var own = it.sort;
28672 return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.sort) ? method : own;
28673};
28674
28675
28676/***/ }),
28677/* 599 */
28678/***/ (function(module, exports, __webpack_require__) {
28679
28680__webpack_require__(600);
28681var entryVirtual = __webpack_require__(27);
28682
28683module.exports = entryVirtual('Array').sort;
28684
28685
28686/***/ }),
28687/* 600 */
28688/***/ (function(module, exports, __webpack_require__) {
28689
28690"use strict";
28691
28692var $ = __webpack_require__(0);
28693var uncurryThis = __webpack_require__(4);
28694var aCallable = __webpack_require__(29);
28695var toObject = __webpack_require__(33);
28696var lengthOfArrayLike = __webpack_require__(40);
28697var deletePropertyOrThrow = __webpack_require__(601);
28698var toString = __webpack_require__(42);
28699var fails = __webpack_require__(2);
28700var internalSort = __webpack_require__(602);
28701var arrayMethodIsStrict = __webpack_require__(150);
28702var FF = __webpack_require__(603);
28703var IE_OR_EDGE = __webpack_require__(604);
28704var V8 = __webpack_require__(66);
28705var WEBKIT = __webpack_require__(605);
28706
28707var test = [];
28708var un$Sort = uncurryThis(test.sort);
28709var push = uncurryThis(test.push);
28710
28711// IE8-
28712var FAILS_ON_UNDEFINED = fails(function () {
28713 test.sort(undefined);
28714});
28715// V8 bug
28716var FAILS_ON_NULL = fails(function () {
28717 test.sort(null);
28718});
28719// Old WebKit
28720var STRICT_METHOD = arrayMethodIsStrict('sort');
28721
28722var STABLE_SORT = !fails(function () {
28723 // feature detection can be too slow, so check engines versions
28724 if (V8) return V8 < 70;
28725 if (FF && FF > 3) return;
28726 if (IE_OR_EDGE) return true;
28727 if (WEBKIT) return WEBKIT < 603;
28728
28729 var result = '';
28730 var code, chr, value, index;
28731
28732 // generate an array with more 512 elements (Chakra and old V8 fails only in this case)
28733 for (code = 65; code < 76; code++) {
28734 chr = String.fromCharCode(code);
28735
28736 switch (code) {
28737 case 66: case 69: case 70: case 72: value = 3; break;
28738 case 68: case 71: value = 4; break;
28739 default: value = 2;
28740 }
28741
28742 for (index = 0; index < 47; index++) {
28743 test.push({ k: chr + index, v: value });
28744 }
28745 }
28746
28747 test.sort(function (a, b) { return b.v - a.v; });
28748
28749 for (index = 0; index < test.length; index++) {
28750 chr = test[index].k.charAt(0);
28751 if (result.charAt(result.length - 1) !== chr) result += chr;
28752 }
28753
28754 return result !== 'DGBEFHACIJK';
28755});
28756
28757var FORCED = FAILS_ON_UNDEFINED || !FAILS_ON_NULL || !STRICT_METHOD || !STABLE_SORT;
28758
28759var getSortCompare = function (comparefn) {
28760 return function (x, y) {
28761 if (y === undefined) return -1;
28762 if (x === undefined) return 1;
28763 if (comparefn !== undefined) return +comparefn(x, y) || 0;
28764 return toString(x) > toString(y) ? 1 : -1;
28765 };
28766};
28767
28768// `Array.prototype.sort` method
28769// https://tc39.es/ecma262/#sec-array.prototype.sort
28770$({ target: 'Array', proto: true, forced: FORCED }, {
28771 sort: function sort(comparefn) {
28772 if (comparefn !== undefined) aCallable(comparefn);
28773
28774 var array = toObject(this);
28775
28776 if (STABLE_SORT) return comparefn === undefined ? un$Sort(array) : un$Sort(array, comparefn);
28777
28778 var items = [];
28779 var arrayLength = lengthOfArrayLike(array);
28780 var itemsLength, index;
28781
28782 for (index = 0; index < arrayLength; index++) {
28783 if (index in array) push(items, array[index]);
28784 }
28785
28786 internalSort(items, getSortCompare(comparefn));
28787
28788 itemsLength = items.length;
28789 index = 0;
28790
28791 while (index < itemsLength) array[index] = items[index++];
28792 while (index < arrayLength) deletePropertyOrThrow(array, index++);
28793
28794 return array;
28795 }
28796});
28797
28798
28799/***/ }),
28800/* 601 */
28801/***/ (function(module, exports, __webpack_require__) {
28802
28803"use strict";
28804
28805var tryToString = __webpack_require__(67);
28806
28807var $TypeError = TypeError;
28808
28809module.exports = function (O, P) {
28810 if (!delete O[P]) throw $TypeError('Cannot delete property ' + tryToString(P) + ' of ' + tryToString(O));
28811};
28812
28813
28814/***/ }),
28815/* 602 */
28816/***/ (function(module, exports, __webpack_require__) {
28817
28818var arraySlice = __webpack_require__(244);
28819
28820var floor = Math.floor;
28821
28822var mergeSort = function (array, comparefn) {
28823 var length = array.length;
28824 var middle = floor(length / 2);
28825 return length < 8 ? insertionSort(array, comparefn) : merge(
28826 array,
28827 mergeSort(arraySlice(array, 0, middle), comparefn),
28828 mergeSort(arraySlice(array, middle), comparefn),
28829 comparefn
28830 );
28831};
28832
28833var insertionSort = function (array, comparefn) {
28834 var length = array.length;
28835 var i = 1;
28836 var element, j;
28837
28838 while (i < length) {
28839 j = i;
28840 element = array[i];
28841 while (j && comparefn(array[j - 1], element) > 0) {
28842 array[j] = array[--j];
28843 }
28844 if (j !== i++) array[j] = element;
28845 } return array;
28846};
28847
28848var merge = function (array, left, right, comparefn) {
28849 var llength = left.length;
28850 var rlength = right.length;
28851 var lindex = 0;
28852 var rindex = 0;
28853
28854 while (lindex < llength || rindex < rlength) {
28855 array[lindex + rindex] = (lindex < llength && rindex < rlength)
28856 ? comparefn(left[lindex], right[rindex]) <= 0 ? left[lindex++] : right[rindex++]
28857 : lindex < llength ? left[lindex++] : right[rindex++];
28858 } return array;
28859};
28860
28861module.exports = mergeSort;
28862
28863
28864/***/ }),
28865/* 603 */
28866/***/ (function(module, exports, __webpack_require__) {
28867
28868var userAgent = __webpack_require__(51);
28869
28870var firefox = userAgent.match(/firefox\/(\d+)/i);
28871
28872module.exports = !!firefox && +firefox[1];
28873
28874
28875/***/ }),
28876/* 604 */
28877/***/ (function(module, exports, __webpack_require__) {
28878
28879var UA = __webpack_require__(51);
28880
28881module.exports = /MSIE|Trident/.test(UA);
28882
28883
28884/***/ }),
28885/* 605 */
28886/***/ (function(module, exports, __webpack_require__) {
28887
28888var userAgent = __webpack_require__(51);
28889
28890var webkit = userAgent.match(/AppleWebKit\/(\d+)\./);
28891
28892module.exports = !!webkit && +webkit[1];
28893
28894
28895/***/ }),
28896/* 606 */
28897/***/ (function(module, exports, __webpack_require__) {
28898
28899"use strict";
28900
28901/**
28902 * Module dependencies.
28903 */
28904
28905var utils = __webpack_require__(607);
28906/**
28907 * Expose `ResponseBase`.
28908 */
28909
28910
28911module.exports = ResponseBase;
28912/**
28913 * Initialize a new `ResponseBase`.
28914 *
28915 * @api public
28916 */
28917
28918function ResponseBase(obj) {
28919 if (obj) return mixin(obj);
28920}
28921/**
28922 * Mixin the prototype properties.
28923 *
28924 * @param {Object} obj
28925 * @return {Object}
28926 * @api private
28927 */
28928
28929
28930function mixin(obj) {
28931 for (var key in ResponseBase.prototype) {
28932 if (Object.prototype.hasOwnProperty.call(ResponseBase.prototype, key)) obj[key] = ResponseBase.prototype[key];
28933 }
28934
28935 return obj;
28936}
28937/**
28938 * Get case-insensitive `field` value.
28939 *
28940 * @param {String} field
28941 * @return {String}
28942 * @api public
28943 */
28944
28945
28946ResponseBase.prototype.get = function (field) {
28947 return this.header[field.toLowerCase()];
28948};
28949/**
28950 * Set header related properties:
28951 *
28952 * - `.type` the content type without params
28953 *
28954 * A response of "Content-Type: text/plain; charset=utf-8"
28955 * will provide you with a `.type` of "text/plain".
28956 *
28957 * @param {Object} header
28958 * @api private
28959 */
28960
28961
28962ResponseBase.prototype._setHeaderProperties = function (header) {
28963 // TODO: moar!
28964 // TODO: make this a util
28965 // content-type
28966 var ct = header['content-type'] || '';
28967 this.type = utils.type(ct); // params
28968
28969 var params = utils.params(ct);
28970
28971 for (var key in params) {
28972 if (Object.prototype.hasOwnProperty.call(params, key)) this[key] = params[key];
28973 }
28974
28975 this.links = {}; // links
28976
28977 try {
28978 if (header.link) {
28979 this.links = utils.parseLinks(header.link);
28980 }
28981 } catch (_unused) {// ignore
28982 }
28983};
28984/**
28985 * Set flags such as `.ok` based on `status`.
28986 *
28987 * For example a 2xx response will give you a `.ok` of __true__
28988 * whereas 5xx will be __false__ and `.error` will be __true__. The
28989 * `.clientError` and `.serverError` are also available to be more
28990 * specific, and `.statusType` is the class of error ranging from 1..5
28991 * sometimes useful for mapping respond colors etc.
28992 *
28993 * "sugar" properties are also defined for common cases. Currently providing:
28994 *
28995 * - .noContent
28996 * - .badRequest
28997 * - .unauthorized
28998 * - .notAcceptable
28999 * - .notFound
29000 *
29001 * @param {Number} status
29002 * @api private
29003 */
29004
29005
29006ResponseBase.prototype._setStatusProperties = function (status) {
29007 var type = status / 100 | 0; // status / class
29008
29009 this.statusCode = status;
29010 this.status = this.statusCode;
29011 this.statusType = type; // basics
29012
29013 this.info = type === 1;
29014 this.ok = type === 2;
29015 this.redirect = type === 3;
29016 this.clientError = type === 4;
29017 this.serverError = type === 5;
29018 this.error = type === 4 || type === 5 ? this.toError() : false; // sugar
29019
29020 this.created = status === 201;
29021 this.accepted = status === 202;
29022 this.noContent = status === 204;
29023 this.badRequest = status === 400;
29024 this.unauthorized = status === 401;
29025 this.notAcceptable = status === 406;
29026 this.forbidden = status === 403;
29027 this.notFound = status === 404;
29028 this.unprocessableEntity = status === 422;
29029};
29030
29031/***/ }),
29032/* 607 */
29033/***/ (function(module, exports, __webpack_require__) {
29034
29035"use strict";
29036
29037/**
29038 * Return the mime type for the given `str`.
29039 *
29040 * @param {String} str
29041 * @return {String}
29042 * @api private
29043 */
29044
29045var _interopRequireDefault = __webpack_require__(1);
29046
29047var _reduce = _interopRequireDefault(__webpack_require__(261));
29048
29049var _slice = _interopRequireDefault(__webpack_require__(34));
29050
29051exports.type = function (str) {
29052 return str.split(/ *; */).shift();
29053};
29054/**
29055 * Return header field parameters.
29056 *
29057 * @param {String} str
29058 * @return {Object}
29059 * @api private
29060 */
29061
29062
29063exports.params = function (str) {
29064 var _context;
29065
29066 return (0, _reduce.default)(_context = str.split(/ *; */)).call(_context, function (obj, str) {
29067 var parts = str.split(/ *= */);
29068 var key = parts.shift();
29069 var val = parts.shift();
29070 if (key && val) obj[key] = val;
29071 return obj;
29072 }, {});
29073};
29074/**
29075 * Parse Link header fields.
29076 *
29077 * @param {String} str
29078 * @return {Object}
29079 * @api private
29080 */
29081
29082
29083exports.parseLinks = function (str) {
29084 var _context2;
29085
29086 return (0, _reduce.default)(_context2 = str.split(/ *, */)).call(_context2, function (obj, str) {
29087 var _context3, _context4;
29088
29089 var parts = str.split(/ *; */);
29090 var url = (0, _slice.default)(_context3 = parts[0]).call(_context3, 1, -1);
29091 var rel = (0, _slice.default)(_context4 = parts[1].split(/ *= */)[1]).call(_context4, 1, -1);
29092 obj[rel] = url;
29093 return obj;
29094 }, {});
29095};
29096/**
29097 * Strip content related fields from `header`.
29098 *
29099 * @param {Object} header
29100 * @return {Object} header
29101 * @api private
29102 */
29103
29104
29105exports.cleanHeader = function (header, changesOrigin) {
29106 delete header['content-type'];
29107 delete header['content-length'];
29108 delete header['transfer-encoding'];
29109 delete header.host; // secuirty
29110
29111 if (changesOrigin) {
29112 delete header.authorization;
29113 delete header.cookie;
29114 }
29115
29116 return header;
29117};
29118
29119/***/ }),
29120/* 608 */
29121/***/ (function(module, exports, __webpack_require__) {
29122
29123var parent = __webpack_require__(609);
29124
29125module.exports = parent;
29126
29127
29128/***/ }),
29129/* 609 */
29130/***/ (function(module, exports, __webpack_require__) {
29131
29132var isPrototypeOf = __webpack_require__(16);
29133var method = __webpack_require__(610);
29134
29135var ArrayPrototype = Array.prototype;
29136
29137module.exports = function (it) {
29138 var own = it.reduce;
29139 return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.reduce) ? method : own;
29140};
29141
29142
29143/***/ }),
29144/* 610 */
29145/***/ (function(module, exports, __webpack_require__) {
29146
29147__webpack_require__(611);
29148var entryVirtual = __webpack_require__(27);
29149
29150module.exports = entryVirtual('Array').reduce;
29151
29152
29153/***/ }),
29154/* 611 */
29155/***/ (function(module, exports, __webpack_require__) {
29156
29157"use strict";
29158
29159var $ = __webpack_require__(0);
29160var $reduce = __webpack_require__(612).left;
29161var arrayMethodIsStrict = __webpack_require__(150);
29162var CHROME_VERSION = __webpack_require__(66);
29163var IS_NODE = __webpack_require__(109);
29164
29165var STRICT_METHOD = arrayMethodIsStrict('reduce');
29166// Chrome 80-82 has a critical bug
29167// https://bugs.chromium.org/p/chromium/issues/detail?id=1049982
29168var CHROME_BUG = !IS_NODE && CHROME_VERSION > 79 && CHROME_VERSION < 83;
29169
29170// `Array.prototype.reduce` method
29171// https://tc39.es/ecma262/#sec-array.prototype.reduce
29172$({ target: 'Array', proto: true, forced: !STRICT_METHOD || CHROME_BUG }, {
29173 reduce: function reduce(callbackfn /* , initialValue */) {
29174 var length = arguments.length;
29175 return $reduce(this, callbackfn, length, length > 1 ? arguments[1] : undefined);
29176 }
29177});
29178
29179
29180/***/ }),
29181/* 612 */
29182/***/ (function(module, exports, __webpack_require__) {
29183
29184var aCallable = __webpack_require__(29);
29185var toObject = __webpack_require__(33);
29186var IndexedObject = __webpack_require__(98);
29187var lengthOfArrayLike = __webpack_require__(40);
29188
29189var $TypeError = TypeError;
29190
29191// `Array.prototype.{ reduce, reduceRight }` methods implementation
29192var createMethod = function (IS_RIGHT) {
29193 return function (that, callbackfn, argumentsLength, memo) {
29194 aCallable(callbackfn);
29195 var O = toObject(that);
29196 var self = IndexedObject(O);
29197 var length = lengthOfArrayLike(O);
29198 var index = IS_RIGHT ? length - 1 : 0;
29199 var i = IS_RIGHT ? -1 : 1;
29200 if (argumentsLength < 2) while (true) {
29201 if (index in self) {
29202 memo = self[index];
29203 index += i;
29204 break;
29205 }
29206 index += i;
29207 if (IS_RIGHT ? index < 0 : length <= index) {
29208 throw $TypeError('Reduce of empty array with no initial value');
29209 }
29210 }
29211 for (;IS_RIGHT ? index >= 0 : length > index; index += i) if (index in self) {
29212 memo = callbackfn(memo, self[index], index, O);
29213 }
29214 return memo;
29215 };
29216};
29217
29218module.exports = {
29219 // `Array.prototype.reduce` method
29220 // https://tc39.es/ecma262/#sec-array.prototype.reduce
29221 left: createMethod(false),
29222 // `Array.prototype.reduceRight` method
29223 // https://tc39.es/ecma262/#sec-array.prototype.reduceright
29224 right: createMethod(true)
29225};
29226
29227
29228/***/ }),
29229/* 613 */
29230/***/ (function(module, exports, __webpack_require__) {
29231
29232"use strict";
29233
29234
29235var _interopRequireDefault = __webpack_require__(1);
29236
29237var _slice = _interopRequireDefault(__webpack_require__(34));
29238
29239var _from = _interopRequireDefault(__webpack_require__(152));
29240
29241var _symbol = _interopRequireDefault(__webpack_require__(77));
29242
29243var _isIterable2 = _interopRequireDefault(__webpack_require__(262));
29244
29245function _toConsumableArray(arr) {
29246 return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
29247}
29248
29249function _nonIterableSpread() {
29250 throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
29251}
29252
29253function _unsupportedIterableToArray(o, minLen) {
29254 var _context;
29255
29256 if (!o) return;
29257 if (typeof o === "string") return _arrayLikeToArray(o, minLen);
29258 var n = (0, _slice.default)(_context = Object.prototype.toString.call(o)).call(_context, 8, -1);
29259 if (n === "Object" && o.constructor) n = o.constructor.name;
29260 if (n === "Map" || n === "Set") return (0, _from.default)(o);
29261 if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
29262}
29263
29264function _iterableToArray(iter) {
29265 if (typeof _symbol.default !== "undefined" && (0, _isIterable2.default)(Object(iter))) return (0, _from.default)(iter);
29266}
29267
29268function _arrayWithoutHoles(arr) {
29269 if (Array.isArray(arr)) return _arrayLikeToArray(arr);
29270}
29271
29272function _arrayLikeToArray(arr, len) {
29273 if (len == null || len > arr.length) len = arr.length;
29274
29275 for (var i = 0, arr2 = new Array(len); i < len; i++) {
29276 arr2[i] = arr[i];
29277 }
29278
29279 return arr2;
29280}
29281
29282function Agent() {
29283 this._defaults = [];
29284}
29285
29286['use', 'on', 'once', 'set', 'query', 'type', 'accept', 'auth', 'withCredentials', 'sortQuery', 'retry', 'ok', 'redirects', 'timeout', 'buffer', 'serialize', 'parse', 'ca', 'key', 'pfx', 'cert', 'disableTLSCerts'].forEach(function (fn) {
29287 // Default setting for all requests from this agent
29288 Agent.prototype[fn] = function () {
29289 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
29290 args[_key] = arguments[_key];
29291 }
29292
29293 this._defaults.push({
29294 fn: fn,
29295 args: args
29296 });
29297
29298 return this;
29299 };
29300});
29301
29302Agent.prototype._setDefaults = function (req) {
29303 this._defaults.forEach(function (def) {
29304 req[def.fn].apply(req, _toConsumableArray(def.args));
29305 });
29306};
29307
29308module.exports = Agent;
29309
29310/***/ }),
29311/* 614 */
29312/***/ (function(module, exports, __webpack_require__) {
29313
29314module.exports = __webpack_require__(615);
29315
29316
29317/***/ }),
29318/* 615 */
29319/***/ (function(module, exports, __webpack_require__) {
29320
29321var parent = __webpack_require__(616);
29322
29323module.exports = parent;
29324
29325
29326/***/ }),
29327/* 616 */
29328/***/ (function(module, exports, __webpack_require__) {
29329
29330var parent = __webpack_require__(617);
29331
29332module.exports = parent;
29333
29334
29335/***/ }),
29336/* 617 */
29337/***/ (function(module, exports, __webpack_require__) {
29338
29339var parent = __webpack_require__(618);
29340__webpack_require__(46);
29341
29342module.exports = parent;
29343
29344
29345/***/ }),
29346/* 618 */
29347/***/ (function(module, exports, __webpack_require__) {
29348
29349__webpack_require__(43);
29350__webpack_require__(70);
29351var isIterable = __webpack_require__(619);
29352
29353module.exports = isIterable;
29354
29355
29356/***/ }),
29357/* 619 */
29358/***/ (function(module, exports, __webpack_require__) {
29359
29360var classof = __webpack_require__(55);
29361var hasOwn = __webpack_require__(13);
29362var wellKnownSymbol = __webpack_require__(5);
29363var Iterators = __webpack_require__(54);
29364
29365var ITERATOR = wellKnownSymbol('iterator');
29366var $Object = Object;
29367
29368module.exports = function (it) {
29369 var O = $Object(it);
29370 return O[ITERATOR] !== undefined
29371 || '@@iterator' in O
29372 || hasOwn(Iterators, classof(O));
29373};
29374
29375
29376/***/ }),
29377/* 620 */
29378/***/ (function(module, exports, __webpack_require__) {
29379
29380"use strict";
29381
29382
29383var _require = __webpack_require__(155),
29384 Realtime = _require.Realtime,
29385 setRTMAdapters = _require.setAdapters;
29386
29387var _require2 = __webpack_require__(704),
29388 LiveQueryPlugin = _require2.LiveQueryPlugin;
29389
29390Realtime.__preRegisteredPlugins = [LiveQueryPlugin];
29391
29392module.exports = function (AV) {
29393 AV._sharedConfig.liveQueryRealtime = Realtime;
29394 var setAdapters = AV.setAdapters;
29395
29396 AV.setAdapters = function (adapters) {
29397 setAdapters(adapters);
29398 setRTMAdapters(adapters);
29399 };
29400
29401 return AV;
29402};
29403
29404/***/ }),
29405/* 621 */
29406/***/ (function(module, exports, __webpack_require__) {
29407
29408"use strict";
29409/* WEBPACK VAR INJECTION */(function(global) {
29410
29411var _interopRequireDefault = __webpack_require__(1);
29412
29413var _typeof3 = _interopRequireDefault(__webpack_require__(95));
29414
29415var _defineProperty2 = _interopRequireDefault(__webpack_require__(94));
29416
29417var _freeze = _interopRequireDefault(__webpack_require__(622));
29418
29419var _assign = _interopRequireDefault(__webpack_require__(265));
29420
29421var _symbol = _interopRequireDefault(__webpack_require__(77));
29422
29423var _concat = _interopRequireDefault(__webpack_require__(19));
29424
29425var _keys = _interopRequireDefault(__webpack_require__(149));
29426
29427var _getOwnPropertySymbols = _interopRequireDefault(__webpack_require__(266));
29428
29429var _filter = _interopRequireDefault(__webpack_require__(249));
29430
29431var _getOwnPropertyDescriptor = _interopRequireDefault(__webpack_require__(257));
29432
29433var _getOwnPropertyDescriptors = _interopRequireDefault(__webpack_require__(633));
29434
29435var _defineProperties = _interopRequireDefault(__webpack_require__(637));
29436
29437var _promise = _interopRequireDefault(__webpack_require__(12));
29438
29439var _slice = _interopRequireDefault(__webpack_require__(34));
29440
29441var _indexOf = _interopRequireDefault(__webpack_require__(61));
29442
29443var _weakMap = _interopRequireDefault(__webpack_require__(641));
29444
29445var _stringify = _interopRequireDefault(__webpack_require__(38));
29446
29447var _map = _interopRequireDefault(__webpack_require__(37));
29448
29449var _reduce = _interopRequireDefault(__webpack_require__(261));
29450
29451var _find = _interopRequireDefault(__webpack_require__(96));
29452
29453var _set = _interopRequireDefault(__webpack_require__(268));
29454
29455var _context6, _context15;
29456
29457(0, _defineProperty2.default)(exports, '__esModule', {
29458 value: true
29459});
29460
29461function _interopDefault(ex) {
29462 return ex && (0, _typeof3.default)(ex) === 'object' && 'default' in ex ? ex['default'] : ex;
29463}
29464
29465var protobufLight = _interopDefault(__webpack_require__(652));
29466
29467var EventEmitter = _interopDefault(__webpack_require__(656));
29468
29469var _regeneratorRuntime = _interopDefault(__webpack_require__(657));
29470
29471var _asyncToGenerator = _interopDefault(__webpack_require__(659));
29472
29473var _toConsumableArray = _interopDefault(__webpack_require__(660));
29474
29475var _defineProperty = _interopDefault(__webpack_require__(663));
29476
29477var _objectWithoutProperties = _interopDefault(__webpack_require__(664));
29478
29479var _assertThisInitialized = _interopDefault(__webpack_require__(666));
29480
29481var _inheritsLoose = _interopDefault(__webpack_require__(667));
29482
29483var d = _interopDefault(__webpack_require__(63));
29484
29485var shuffle = _interopDefault(__webpack_require__(668));
29486
29487var values = _interopDefault(__webpack_require__(273));
29488
29489var _toArray = _interopDefault(__webpack_require__(695));
29490
29491var _createClass = _interopDefault(__webpack_require__(698));
29492
29493var _applyDecoratedDescriptor = _interopDefault(__webpack_require__(699));
29494
29495var StateMachine = _interopDefault(__webpack_require__(700));
29496
29497var _typeof = _interopDefault(__webpack_require__(701));
29498
29499var isPlainObject = _interopDefault(__webpack_require__(702));
29500
29501var promiseTimeout = __webpack_require__(250);
29502
29503var messageCompiled = protobufLight.newBuilder({})['import']({
29504 "package": 'push_server.messages2',
29505 syntax: 'proto2',
29506 options: {
29507 objc_class_prefix: 'AVIM'
29508 },
29509 messages: [{
29510 name: 'JsonObjectMessage',
29511 syntax: 'proto2',
29512 fields: [{
29513 rule: 'required',
29514 type: 'string',
29515 name: 'data',
29516 id: 1
29517 }]
29518 }, {
29519 name: 'UnreadTuple',
29520 syntax: 'proto2',
29521 fields: [{
29522 rule: 'required',
29523 type: 'string',
29524 name: 'cid',
29525 id: 1
29526 }, {
29527 rule: 'required',
29528 type: 'int32',
29529 name: 'unread',
29530 id: 2
29531 }, {
29532 rule: 'optional',
29533 type: 'string',
29534 name: 'mid',
29535 id: 3
29536 }, {
29537 rule: 'optional',
29538 type: 'int64',
29539 name: 'timestamp',
29540 id: 4
29541 }, {
29542 rule: 'optional',
29543 type: 'string',
29544 name: 'from',
29545 id: 5
29546 }, {
29547 rule: 'optional',
29548 type: 'string',
29549 name: 'data',
29550 id: 6
29551 }, {
29552 rule: 'optional',
29553 type: 'int64',
29554 name: 'patchTimestamp',
29555 id: 7
29556 }, {
29557 rule: 'optional',
29558 type: 'bool',
29559 name: 'mentioned',
29560 id: 8
29561 }, {
29562 rule: 'optional',
29563 type: 'bytes',
29564 name: 'binaryMsg',
29565 id: 9
29566 }, {
29567 rule: 'optional',
29568 type: 'int32',
29569 name: 'convType',
29570 id: 10
29571 }]
29572 }, {
29573 name: 'LogItem',
29574 syntax: 'proto2',
29575 fields: [{
29576 rule: 'optional',
29577 type: 'string',
29578 name: 'from',
29579 id: 1
29580 }, {
29581 rule: 'optional',
29582 type: 'string',
29583 name: 'data',
29584 id: 2
29585 }, {
29586 rule: 'optional',
29587 type: 'int64',
29588 name: 'timestamp',
29589 id: 3
29590 }, {
29591 rule: 'optional',
29592 type: 'string',
29593 name: 'msgId',
29594 id: 4
29595 }, {
29596 rule: 'optional',
29597 type: 'int64',
29598 name: 'ackAt',
29599 id: 5
29600 }, {
29601 rule: 'optional',
29602 type: 'int64',
29603 name: 'readAt',
29604 id: 6
29605 }, {
29606 rule: 'optional',
29607 type: 'int64',
29608 name: 'patchTimestamp',
29609 id: 7
29610 }, {
29611 rule: 'optional',
29612 type: 'bool',
29613 name: 'mentionAll',
29614 id: 8
29615 }, {
29616 rule: 'repeated',
29617 type: 'string',
29618 name: 'mentionPids',
29619 id: 9
29620 }, {
29621 rule: 'optional',
29622 type: 'bool',
29623 name: 'bin',
29624 id: 10
29625 }, {
29626 rule: 'optional',
29627 type: 'int32',
29628 name: 'convType',
29629 id: 11
29630 }]
29631 }, {
29632 name: 'ConvMemberInfo',
29633 syntax: 'proto2',
29634 fields: [{
29635 rule: 'optional',
29636 type: 'string',
29637 name: 'pid',
29638 id: 1
29639 }, {
29640 rule: 'optional',
29641 type: 'string',
29642 name: 'role',
29643 id: 2
29644 }, {
29645 rule: 'optional',
29646 type: 'string',
29647 name: 'infoId',
29648 id: 3
29649 }]
29650 }, {
29651 name: 'DataCommand',
29652 syntax: 'proto2',
29653 fields: [{
29654 rule: 'repeated',
29655 type: 'string',
29656 name: 'ids',
29657 id: 1
29658 }, {
29659 rule: 'repeated',
29660 type: 'JsonObjectMessage',
29661 name: 'msg',
29662 id: 2
29663 }, {
29664 rule: 'optional',
29665 type: 'bool',
29666 name: 'offline',
29667 id: 3
29668 }]
29669 }, {
29670 name: 'SessionCommand',
29671 syntax: 'proto2',
29672 fields: [{
29673 rule: 'optional',
29674 type: 'int64',
29675 name: 't',
29676 id: 1
29677 }, {
29678 rule: 'optional',
29679 type: 'string',
29680 name: 'n',
29681 id: 2
29682 }, {
29683 rule: 'optional',
29684 type: 'string',
29685 name: 's',
29686 id: 3
29687 }, {
29688 rule: 'optional',
29689 type: 'string',
29690 name: 'ua',
29691 id: 4
29692 }, {
29693 rule: 'optional',
29694 type: 'bool',
29695 name: 'r',
29696 id: 5
29697 }, {
29698 rule: 'optional',
29699 type: 'string',
29700 name: 'tag',
29701 id: 6
29702 }, {
29703 rule: 'optional',
29704 type: 'string',
29705 name: 'deviceId',
29706 id: 7
29707 }, {
29708 rule: 'repeated',
29709 type: 'string',
29710 name: 'sessionPeerIds',
29711 id: 8
29712 }, {
29713 rule: 'repeated',
29714 type: 'string',
29715 name: 'onlineSessionPeerIds',
29716 id: 9
29717 }, {
29718 rule: 'optional',
29719 type: 'string',
29720 name: 'st',
29721 id: 10
29722 }, {
29723 rule: 'optional',
29724 type: 'int32',
29725 name: 'stTtl',
29726 id: 11
29727 }, {
29728 rule: 'optional',
29729 type: 'int32',
29730 name: 'code',
29731 id: 12
29732 }, {
29733 rule: 'optional',
29734 type: 'string',
29735 name: 'reason',
29736 id: 13
29737 }, {
29738 rule: 'optional',
29739 type: 'string',
29740 name: 'deviceToken',
29741 id: 14
29742 }, {
29743 rule: 'optional',
29744 type: 'bool',
29745 name: 'sp',
29746 id: 15
29747 }, {
29748 rule: 'optional',
29749 type: 'string',
29750 name: 'detail',
29751 id: 16
29752 }, {
29753 rule: 'optional',
29754 type: 'int64',
29755 name: 'lastUnreadNotifTime',
29756 id: 17
29757 }, {
29758 rule: 'optional',
29759 type: 'int64',
29760 name: 'lastPatchTime',
29761 id: 18
29762 }, {
29763 rule: 'optional',
29764 type: 'int64',
29765 name: 'configBitmap',
29766 id: 19
29767 }]
29768 }, {
29769 name: 'ErrorCommand',
29770 syntax: 'proto2',
29771 fields: [{
29772 rule: 'required',
29773 type: 'int32',
29774 name: 'code',
29775 id: 1
29776 }, {
29777 rule: 'required',
29778 type: 'string',
29779 name: 'reason',
29780 id: 2
29781 }, {
29782 rule: 'optional',
29783 type: 'int32',
29784 name: 'appCode',
29785 id: 3
29786 }, {
29787 rule: 'optional',
29788 type: 'string',
29789 name: 'detail',
29790 id: 4
29791 }, {
29792 rule: 'repeated',
29793 type: 'string',
29794 name: 'pids',
29795 id: 5
29796 }, {
29797 rule: 'optional',
29798 type: 'string',
29799 name: 'appMsg',
29800 id: 6
29801 }]
29802 }, {
29803 name: 'DirectCommand',
29804 syntax: 'proto2',
29805 fields: [{
29806 rule: 'optional',
29807 type: 'string',
29808 name: 'msg',
29809 id: 1
29810 }, {
29811 rule: 'optional',
29812 type: 'string',
29813 name: 'uid',
29814 id: 2
29815 }, {
29816 rule: 'optional',
29817 type: 'string',
29818 name: 'fromPeerId',
29819 id: 3
29820 }, {
29821 rule: 'optional',
29822 type: 'int64',
29823 name: 'timestamp',
29824 id: 4
29825 }, {
29826 rule: 'optional',
29827 type: 'bool',
29828 name: 'offline',
29829 id: 5
29830 }, {
29831 rule: 'optional',
29832 type: 'bool',
29833 name: 'hasMore',
29834 id: 6
29835 }, {
29836 rule: 'repeated',
29837 type: 'string',
29838 name: 'toPeerIds',
29839 id: 7
29840 }, {
29841 rule: 'optional',
29842 type: 'bool',
29843 name: 'r',
29844 id: 10
29845 }, {
29846 rule: 'optional',
29847 type: 'string',
29848 name: 'cid',
29849 id: 11
29850 }, {
29851 rule: 'optional',
29852 type: 'string',
29853 name: 'id',
29854 id: 12
29855 }, {
29856 rule: 'optional',
29857 type: 'bool',
29858 name: 'transient',
29859 id: 13
29860 }, {
29861 rule: 'optional',
29862 type: 'string',
29863 name: 'dt',
29864 id: 14
29865 }, {
29866 rule: 'optional',
29867 type: 'string',
29868 name: 'roomId',
29869 id: 15
29870 }, {
29871 rule: 'optional',
29872 type: 'string',
29873 name: 'pushData',
29874 id: 16
29875 }, {
29876 rule: 'optional',
29877 type: 'bool',
29878 name: 'will',
29879 id: 17
29880 }, {
29881 rule: 'optional',
29882 type: 'int64',
29883 name: 'patchTimestamp',
29884 id: 18
29885 }, {
29886 rule: 'optional',
29887 type: 'bytes',
29888 name: 'binaryMsg',
29889 id: 19
29890 }, {
29891 rule: 'repeated',
29892 type: 'string',
29893 name: 'mentionPids',
29894 id: 20
29895 }, {
29896 rule: 'optional',
29897 type: 'bool',
29898 name: 'mentionAll',
29899 id: 21
29900 }, {
29901 rule: 'optional',
29902 type: 'int32',
29903 name: 'convType',
29904 id: 22
29905 }]
29906 }, {
29907 name: 'AckCommand',
29908 syntax: 'proto2',
29909 fields: [{
29910 rule: 'optional',
29911 type: 'int32',
29912 name: 'code',
29913 id: 1
29914 }, {
29915 rule: 'optional',
29916 type: 'string',
29917 name: 'reason',
29918 id: 2
29919 }, {
29920 rule: 'optional',
29921 type: 'string',
29922 name: 'mid',
29923 id: 3
29924 }, {
29925 rule: 'optional',
29926 type: 'string',
29927 name: 'cid',
29928 id: 4
29929 }, {
29930 rule: 'optional',
29931 type: 'int64',
29932 name: 't',
29933 id: 5
29934 }, {
29935 rule: 'optional',
29936 type: 'string',
29937 name: 'uid',
29938 id: 6
29939 }, {
29940 rule: 'optional',
29941 type: 'int64',
29942 name: 'fromts',
29943 id: 7
29944 }, {
29945 rule: 'optional',
29946 type: 'int64',
29947 name: 'tots',
29948 id: 8
29949 }, {
29950 rule: 'optional',
29951 type: 'string',
29952 name: 'type',
29953 id: 9
29954 }, {
29955 rule: 'repeated',
29956 type: 'string',
29957 name: 'ids',
29958 id: 10
29959 }, {
29960 rule: 'optional',
29961 type: 'int32',
29962 name: 'appCode',
29963 id: 11
29964 }, {
29965 rule: 'optional',
29966 type: 'string',
29967 name: 'appMsg',
29968 id: 12
29969 }]
29970 }, {
29971 name: 'UnreadCommand',
29972 syntax: 'proto2',
29973 fields: [{
29974 rule: 'repeated',
29975 type: 'UnreadTuple',
29976 name: 'convs',
29977 id: 1
29978 }, {
29979 rule: 'optional',
29980 type: 'int64',
29981 name: 'notifTime',
29982 id: 2
29983 }]
29984 }, {
29985 name: 'ConvCommand',
29986 syntax: 'proto2',
29987 fields: [{
29988 rule: 'repeated',
29989 type: 'string',
29990 name: 'm',
29991 id: 1
29992 }, {
29993 rule: 'optional',
29994 type: 'bool',
29995 name: 'transient',
29996 id: 2
29997 }, {
29998 rule: 'optional',
29999 type: 'bool',
30000 name: 'unique',
30001 id: 3
30002 }, {
30003 rule: 'optional',
30004 type: 'string',
30005 name: 'cid',
30006 id: 4
30007 }, {
30008 rule: 'optional',
30009 type: 'string',
30010 name: 'cdate',
30011 id: 5
30012 }, {
30013 rule: 'optional',
30014 type: 'string',
30015 name: 'initBy',
30016 id: 6
30017 }, {
30018 rule: 'optional',
30019 type: 'string',
30020 name: 'sort',
30021 id: 7
30022 }, {
30023 rule: 'optional',
30024 type: 'int32',
30025 name: 'limit',
30026 id: 8
30027 }, {
30028 rule: 'optional',
30029 type: 'int32',
30030 name: 'skip',
30031 id: 9
30032 }, {
30033 rule: 'optional',
30034 type: 'int32',
30035 name: 'flag',
30036 id: 10
30037 }, {
30038 rule: 'optional',
30039 type: 'int32',
30040 name: 'count',
30041 id: 11
30042 }, {
30043 rule: 'optional',
30044 type: 'string',
30045 name: 'udate',
30046 id: 12
30047 }, {
30048 rule: 'optional',
30049 type: 'int64',
30050 name: 't',
30051 id: 13
30052 }, {
30053 rule: 'optional',
30054 type: 'string',
30055 name: 'n',
30056 id: 14
30057 }, {
30058 rule: 'optional',
30059 type: 'string',
30060 name: 's',
30061 id: 15
30062 }, {
30063 rule: 'optional',
30064 type: 'bool',
30065 name: 'statusSub',
30066 id: 16
30067 }, {
30068 rule: 'optional',
30069 type: 'bool',
30070 name: 'statusPub',
30071 id: 17
30072 }, {
30073 rule: 'optional',
30074 type: 'int32',
30075 name: 'statusTTL',
30076 id: 18
30077 }, {
30078 rule: 'optional',
30079 type: 'string',
30080 name: 'uniqueId',
30081 id: 19
30082 }, {
30083 rule: 'optional',
30084 type: 'string',
30085 name: 'targetClientId',
30086 id: 20
30087 }, {
30088 rule: 'optional',
30089 type: 'int64',
30090 name: 'maxReadTimestamp',
30091 id: 21
30092 }, {
30093 rule: 'optional',
30094 type: 'int64',
30095 name: 'maxAckTimestamp',
30096 id: 22
30097 }, {
30098 rule: 'optional',
30099 type: 'bool',
30100 name: 'queryAllMembers',
30101 id: 23
30102 }, {
30103 rule: 'repeated',
30104 type: 'MaxReadTuple',
30105 name: 'maxReadTuples',
30106 id: 24
30107 }, {
30108 rule: 'repeated',
30109 type: 'string',
30110 name: 'cids',
30111 id: 25
30112 }, {
30113 rule: 'optional',
30114 type: 'ConvMemberInfo',
30115 name: 'info',
30116 id: 26
30117 }, {
30118 rule: 'optional',
30119 type: 'bool',
30120 name: 'tempConv',
30121 id: 27
30122 }, {
30123 rule: 'optional',
30124 type: 'int32',
30125 name: 'tempConvTTL',
30126 id: 28
30127 }, {
30128 rule: 'repeated',
30129 type: 'string',
30130 name: 'tempConvIds',
30131 id: 29
30132 }, {
30133 rule: 'repeated',
30134 type: 'string',
30135 name: 'allowedPids',
30136 id: 30
30137 }, {
30138 rule: 'repeated',
30139 type: 'ErrorCommand',
30140 name: 'failedPids',
30141 id: 31
30142 }, {
30143 rule: 'optional',
30144 type: 'string',
30145 name: 'next',
30146 id: 40
30147 }, {
30148 rule: 'optional',
30149 type: 'JsonObjectMessage',
30150 name: 'results',
30151 id: 100
30152 }, {
30153 rule: 'optional',
30154 type: 'JsonObjectMessage',
30155 name: 'where',
30156 id: 101
30157 }, {
30158 rule: 'optional',
30159 type: 'JsonObjectMessage',
30160 name: 'attr',
30161 id: 103
30162 }, {
30163 rule: 'optional',
30164 type: 'JsonObjectMessage',
30165 name: 'attrModified',
30166 id: 104
30167 }]
30168 }, {
30169 name: 'RoomCommand',
30170 syntax: 'proto2',
30171 fields: [{
30172 rule: 'optional',
30173 type: 'string',
30174 name: 'roomId',
30175 id: 1
30176 }, {
30177 rule: 'optional',
30178 type: 'string',
30179 name: 's',
30180 id: 2
30181 }, {
30182 rule: 'optional',
30183 type: 'int64',
30184 name: 't',
30185 id: 3
30186 }, {
30187 rule: 'optional',
30188 type: 'string',
30189 name: 'n',
30190 id: 4
30191 }, {
30192 rule: 'optional',
30193 type: 'bool',
30194 name: 'transient',
30195 id: 5
30196 }, {
30197 rule: 'repeated',
30198 type: 'string',
30199 name: 'roomPeerIds',
30200 id: 6
30201 }, {
30202 rule: 'optional',
30203 type: 'string',
30204 name: 'byPeerId',
30205 id: 7
30206 }]
30207 }, {
30208 name: 'LogsCommand',
30209 syntax: 'proto2',
30210 fields: [{
30211 rule: 'optional',
30212 type: 'string',
30213 name: 'cid',
30214 id: 1
30215 }, {
30216 rule: 'optional',
30217 type: 'int32',
30218 name: 'l',
30219 id: 2
30220 }, {
30221 rule: 'optional',
30222 type: 'int32',
30223 name: 'limit',
30224 id: 3
30225 }, {
30226 rule: 'optional',
30227 type: 'int64',
30228 name: 't',
30229 id: 4
30230 }, {
30231 rule: 'optional',
30232 type: 'int64',
30233 name: 'tt',
30234 id: 5
30235 }, {
30236 rule: 'optional',
30237 type: 'string',
30238 name: 'tmid',
30239 id: 6
30240 }, {
30241 rule: 'optional',
30242 type: 'string',
30243 name: 'mid',
30244 id: 7
30245 }, {
30246 rule: 'optional',
30247 type: 'string',
30248 name: 'checksum',
30249 id: 8
30250 }, {
30251 rule: 'optional',
30252 type: 'bool',
30253 name: 'stored',
30254 id: 9
30255 }, {
30256 rule: 'optional',
30257 type: 'QueryDirection',
30258 name: 'direction',
30259 id: 10,
30260 options: {
30261 "default": 'OLD'
30262 }
30263 }, {
30264 rule: 'optional',
30265 type: 'bool',
30266 name: 'tIncluded',
30267 id: 11
30268 }, {
30269 rule: 'optional',
30270 type: 'bool',
30271 name: 'ttIncluded',
30272 id: 12
30273 }, {
30274 rule: 'optional',
30275 type: 'int32',
30276 name: 'lctype',
30277 id: 13
30278 }, {
30279 rule: 'repeated',
30280 type: 'LogItem',
30281 name: 'logs',
30282 id: 105
30283 }],
30284 enums: [{
30285 name: 'QueryDirection',
30286 syntax: 'proto2',
30287 values: [{
30288 name: 'OLD',
30289 id: 1
30290 }, {
30291 name: 'NEW',
30292 id: 2
30293 }]
30294 }]
30295 }, {
30296 name: 'RcpCommand',
30297 syntax: 'proto2',
30298 fields: [{
30299 rule: 'optional',
30300 type: 'string',
30301 name: 'id',
30302 id: 1
30303 }, {
30304 rule: 'optional',
30305 type: 'string',
30306 name: 'cid',
30307 id: 2
30308 }, {
30309 rule: 'optional',
30310 type: 'int64',
30311 name: 't',
30312 id: 3
30313 }, {
30314 rule: 'optional',
30315 type: 'bool',
30316 name: 'read',
30317 id: 4
30318 }, {
30319 rule: 'optional',
30320 type: 'string',
30321 name: 'from',
30322 id: 5
30323 }]
30324 }, {
30325 name: 'ReadTuple',
30326 syntax: 'proto2',
30327 fields: [{
30328 rule: 'required',
30329 type: 'string',
30330 name: 'cid',
30331 id: 1
30332 }, {
30333 rule: 'optional',
30334 type: 'int64',
30335 name: 'timestamp',
30336 id: 2
30337 }, {
30338 rule: 'optional',
30339 type: 'string',
30340 name: 'mid',
30341 id: 3
30342 }]
30343 }, {
30344 name: 'MaxReadTuple',
30345 syntax: 'proto2',
30346 fields: [{
30347 rule: 'optional',
30348 type: 'string',
30349 name: 'pid',
30350 id: 1
30351 }, {
30352 rule: 'optional',
30353 type: 'int64',
30354 name: 'maxAckTimestamp',
30355 id: 2
30356 }, {
30357 rule: 'optional',
30358 type: 'int64',
30359 name: 'maxReadTimestamp',
30360 id: 3
30361 }]
30362 }, {
30363 name: 'ReadCommand',
30364 syntax: 'proto2',
30365 fields: [{
30366 rule: 'optional',
30367 type: 'string',
30368 name: 'cid',
30369 id: 1
30370 }, {
30371 rule: 'repeated',
30372 type: 'string',
30373 name: 'cids',
30374 id: 2
30375 }, {
30376 rule: 'repeated',
30377 type: 'ReadTuple',
30378 name: 'convs',
30379 id: 3
30380 }]
30381 }, {
30382 name: 'PresenceCommand',
30383 syntax: 'proto2',
30384 fields: [{
30385 rule: 'optional',
30386 type: 'StatusType',
30387 name: 'status',
30388 id: 1
30389 }, {
30390 rule: 'repeated',
30391 type: 'string',
30392 name: 'sessionPeerIds',
30393 id: 2
30394 }, {
30395 rule: 'optional',
30396 type: 'string',
30397 name: 'cid',
30398 id: 3
30399 }]
30400 }, {
30401 name: 'ReportCommand',
30402 syntax: 'proto2',
30403 fields: [{
30404 rule: 'optional',
30405 type: 'bool',
30406 name: 'initiative',
30407 id: 1
30408 }, {
30409 rule: 'optional',
30410 type: 'string',
30411 name: 'type',
30412 id: 2
30413 }, {
30414 rule: 'optional',
30415 type: 'string',
30416 name: 'data',
30417 id: 3
30418 }]
30419 }, {
30420 name: 'PatchItem',
30421 syntax: 'proto2',
30422 fields: [{
30423 rule: 'optional',
30424 type: 'string',
30425 name: 'cid',
30426 id: 1
30427 }, {
30428 rule: 'optional',
30429 type: 'string',
30430 name: 'mid',
30431 id: 2
30432 }, {
30433 rule: 'optional',
30434 type: 'int64',
30435 name: 'timestamp',
30436 id: 3
30437 }, {
30438 rule: 'optional',
30439 type: 'bool',
30440 name: 'recall',
30441 id: 4
30442 }, {
30443 rule: 'optional',
30444 type: 'string',
30445 name: 'data',
30446 id: 5
30447 }, {
30448 rule: 'optional',
30449 type: 'int64',
30450 name: 'patchTimestamp',
30451 id: 6
30452 }, {
30453 rule: 'optional',
30454 type: 'string',
30455 name: 'from',
30456 id: 7
30457 }, {
30458 rule: 'optional',
30459 type: 'bytes',
30460 name: 'binaryMsg',
30461 id: 8
30462 }, {
30463 rule: 'optional',
30464 type: 'bool',
30465 name: 'mentionAll',
30466 id: 9
30467 }, {
30468 rule: 'repeated',
30469 type: 'string',
30470 name: 'mentionPids',
30471 id: 10
30472 }, {
30473 rule: 'optional',
30474 type: 'int64',
30475 name: 'patchCode',
30476 id: 11
30477 }, {
30478 rule: 'optional',
30479 type: 'string',
30480 name: 'patchReason',
30481 id: 12
30482 }]
30483 }, {
30484 name: 'PatchCommand',
30485 syntax: 'proto2',
30486 fields: [{
30487 rule: 'repeated',
30488 type: 'PatchItem',
30489 name: 'patches',
30490 id: 1
30491 }, {
30492 rule: 'optional',
30493 type: 'int64',
30494 name: 'lastPatchTime',
30495 id: 2
30496 }]
30497 }, {
30498 name: 'PubsubCommand',
30499 syntax: 'proto2',
30500 fields: [{
30501 rule: 'optional',
30502 type: 'string',
30503 name: 'cid',
30504 id: 1
30505 }, {
30506 rule: 'repeated',
30507 type: 'string',
30508 name: 'cids',
30509 id: 2
30510 }, {
30511 rule: 'optional',
30512 type: 'string',
30513 name: 'topic',
30514 id: 3
30515 }, {
30516 rule: 'optional',
30517 type: 'string',
30518 name: 'subtopic',
30519 id: 4
30520 }, {
30521 rule: 'repeated',
30522 type: 'string',
30523 name: 'topics',
30524 id: 5
30525 }, {
30526 rule: 'repeated',
30527 type: 'string',
30528 name: 'subtopics',
30529 id: 6
30530 }, {
30531 rule: 'optional',
30532 type: 'JsonObjectMessage',
30533 name: 'results',
30534 id: 7
30535 }]
30536 }, {
30537 name: 'BlacklistCommand',
30538 syntax: 'proto2',
30539 fields: [{
30540 rule: 'optional',
30541 type: 'string',
30542 name: 'srcCid',
30543 id: 1
30544 }, {
30545 rule: 'repeated',
30546 type: 'string',
30547 name: 'toPids',
30548 id: 2
30549 }, {
30550 rule: 'optional',
30551 type: 'string',
30552 name: 'srcPid',
30553 id: 3
30554 }, {
30555 rule: 'repeated',
30556 type: 'string',
30557 name: 'toCids',
30558 id: 4
30559 }, {
30560 rule: 'optional',
30561 type: 'int32',
30562 name: 'limit',
30563 id: 5
30564 }, {
30565 rule: 'optional',
30566 type: 'string',
30567 name: 'next',
30568 id: 6
30569 }, {
30570 rule: 'repeated',
30571 type: 'string',
30572 name: 'blockedPids',
30573 id: 8
30574 }, {
30575 rule: 'repeated',
30576 type: 'string',
30577 name: 'blockedCids',
30578 id: 9
30579 }, {
30580 rule: 'repeated',
30581 type: 'string',
30582 name: 'allowedPids',
30583 id: 10
30584 }, {
30585 rule: 'repeated',
30586 type: 'ErrorCommand',
30587 name: 'failedPids',
30588 id: 11
30589 }, {
30590 rule: 'optional',
30591 type: 'int64',
30592 name: 't',
30593 id: 12
30594 }, {
30595 rule: 'optional',
30596 type: 'string',
30597 name: 'n',
30598 id: 13
30599 }, {
30600 rule: 'optional',
30601 type: 'string',
30602 name: 's',
30603 id: 14
30604 }]
30605 }, {
30606 name: 'GenericCommand',
30607 syntax: 'proto2',
30608 fields: [{
30609 rule: 'optional',
30610 type: 'CommandType',
30611 name: 'cmd',
30612 id: 1
30613 }, {
30614 rule: 'optional',
30615 type: 'OpType',
30616 name: 'op',
30617 id: 2
30618 }, {
30619 rule: 'optional',
30620 type: 'string',
30621 name: 'appId',
30622 id: 3
30623 }, {
30624 rule: 'optional',
30625 type: 'string',
30626 name: 'peerId',
30627 id: 4
30628 }, {
30629 rule: 'optional',
30630 type: 'int32',
30631 name: 'i',
30632 id: 5
30633 }, {
30634 rule: 'optional',
30635 type: 'string',
30636 name: 'installationId',
30637 id: 6
30638 }, {
30639 rule: 'optional',
30640 type: 'int32',
30641 name: 'priority',
30642 id: 7
30643 }, {
30644 rule: 'optional',
30645 type: 'int32',
30646 name: 'service',
30647 id: 8
30648 }, {
30649 rule: 'optional',
30650 type: 'int64',
30651 name: 'serverTs',
30652 id: 9
30653 }, {
30654 rule: 'optional',
30655 type: 'int64',
30656 name: 'clientTs',
30657 id: 10
30658 }, {
30659 rule: 'optional',
30660 type: 'int32',
30661 name: 'notificationType',
30662 id: 11
30663 }, {
30664 rule: 'optional',
30665 type: 'DataCommand',
30666 name: 'dataMessage',
30667 id: 101
30668 }, {
30669 rule: 'optional',
30670 type: 'SessionCommand',
30671 name: 'sessionMessage',
30672 id: 102
30673 }, {
30674 rule: 'optional',
30675 type: 'ErrorCommand',
30676 name: 'errorMessage',
30677 id: 103
30678 }, {
30679 rule: 'optional',
30680 type: 'DirectCommand',
30681 name: 'directMessage',
30682 id: 104
30683 }, {
30684 rule: 'optional',
30685 type: 'AckCommand',
30686 name: 'ackMessage',
30687 id: 105
30688 }, {
30689 rule: 'optional',
30690 type: 'UnreadCommand',
30691 name: 'unreadMessage',
30692 id: 106
30693 }, {
30694 rule: 'optional',
30695 type: 'ReadCommand',
30696 name: 'readMessage',
30697 id: 107
30698 }, {
30699 rule: 'optional',
30700 type: 'RcpCommand',
30701 name: 'rcpMessage',
30702 id: 108
30703 }, {
30704 rule: 'optional',
30705 type: 'LogsCommand',
30706 name: 'logsMessage',
30707 id: 109
30708 }, {
30709 rule: 'optional',
30710 type: 'ConvCommand',
30711 name: 'convMessage',
30712 id: 110
30713 }, {
30714 rule: 'optional',
30715 type: 'RoomCommand',
30716 name: 'roomMessage',
30717 id: 111
30718 }, {
30719 rule: 'optional',
30720 type: 'PresenceCommand',
30721 name: 'presenceMessage',
30722 id: 112
30723 }, {
30724 rule: 'optional',
30725 type: 'ReportCommand',
30726 name: 'reportMessage',
30727 id: 113
30728 }, {
30729 rule: 'optional',
30730 type: 'PatchCommand',
30731 name: 'patchMessage',
30732 id: 114
30733 }, {
30734 rule: 'optional',
30735 type: 'PubsubCommand',
30736 name: 'pubsubMessage',
30737 id: 115
30738 }, {
30739 rule: 'optional',
30740 type: 'BlacklistCommand',
30741 name: 'blacklistMessage',
30742 id: 116
30743 }]
30744 }],
30745 enums: [{
30746 name: 'CommandType',
30747 syntax: 'proto2',
30748 values: [{
30749 name: 'session',
30750 id: 0
30751 }, {
30752 name: 'conv',
30753 id: 1
30754 }, {
30755 name: 'direct',
30756 id: 2
30757 }, {
30758 name: 'ack',
30759 id: 3
30760 }, {
30761 name: 'rcp',
30762 id: 4
30763 }, {
30764 name: 'unread',
30765 id: 5
30766 }, {
30767 name: 'logs',
30768 id: 6
30769 }, {
30770 name: 'error',
30771 id: 7
30772 }, {
30773 name: 'login',
30774 id: 8
30775 }, {
30776 name: 'data',
30777 id: 9
30778 }, {
30779 name: 'room',
30780 id: 10
30781 }, {
30782 name: 'read',
30783 id: 11
30784 }, {
30785 name: 'presence',
30786 id: 12
30787 }, {
30788 name: 'report',
30789 id: 13
30790 }, {
30791 name: 'echo',
30792 id: 14
30793 }, {
30794 name: 'loggedin',
30795 id: 15
30796 }, {
30797 name: 'logout',
30798 id: 16
30799 }, {
30800 name: 'loggedout',
30801 id: 17
30802 }, {
30803 name: 'patch',
30804 id: 18
30805 }, {
30806 name: 'pubsub',
30807 id: 19
30808 }, {
30809 name: 'blacklist',
30810 id: 20
30811 }, {
30812 name: 'goaway',
30813 id: 21
30814 }]
30815 }, {
30816 name: 'OpType',
30817 syntax: 'proto2',
30818 values: [{
30819 name: 'open',
30820 id: 1
30821 }, {
30822 name: 'add',
30823 id: 2
30824 }, {
30825 name: 'remove',
30826 id: 3
30827 }, {
30828 name: 'close',
30829 id: 4
30830 }, {
30831 name: 'opened',
30832 id: 5
30833 }, {
30834 name: 'closed',
30835 id: 6
30836 }, {
30837 name: 'query',
30838 id: 7
30839 }, {
30840 name: 'query_result',
30841 id: 8
30842 }, {
30843 name: 'conflict',
30844 id: 9
30845 }, {
30846 name: 'added',
30847 id: 10
30848 }, {
30849 name: 'removed',
30850 id: 11
30851 }, {
30852 name: 'refresh',
30853 id: 12
30854 }, {
30855 name: 'refreshed',
30856 id: 13
30857 }, {
30858 name: 'start',
30859 id: 30
30860 }, {
30861 name: 'started',
30862 id: 31
30863 }, {
30864 name: 'joined',
30865 id: 32
30866 }, {
30867 name: 'members_joined',
30868 id: 33
30869 }, {
30870 name: 'left',
30871 id: 39
30872 }, {
30873 name: 'members_left',
30874 id: 40
30875 }, {
30876 name: 'results',
30877 id: 42
30878 }, {
30879 name: 'count',
30880 id: 43
30881 }, {
30882 name: 'result',
30883 id: 44
30884 }, {
30885 name: 'update',
30886 id: 45
30887 }, {
30888 name: 'updated',
30889 id: 46
30890 }, {
30891 name: 'mute',
30892 id: 47
30893 }, {
30894 name: 'unmute',
30895 id: 48
30896 }, {
30897 name: 'status',
30898 id: 49
30899 }, {
30900 name: 'members',
30901 id: 50
30902 }, {
30903 name: 'max_read',
30904 id: 51
30905 }, {
30906 name: 'is_member',
30907 id: 52
30908 }, {
30909 name: 'member_info_update',
30910 id: 53
30911 }, {
30912 name: 'member_info_updated',
30913 id: 54
30914 }, {
30915 name: 'member_info_changed',
30916 id: 55
30917 }, {
30918 name: 'join',
30919 id: 80
30920 }, {
30921 name: 'invite',
30922 id: 81
30923 }, {
30924 name: 'leave',
30925 id: 82
30926 }, {
30927 name: 'kick',
30928 id: 83
30929 }, {
30930 name: 'reject',
30931 id: 84
30932 }, {
30933 name: 'invited',
30934 id: 85
30935 }, {
30936 name: 'kicked',
30937 id: 86
30938 }, {
30939 name: 'upload',
30940 id: 100
30941 }, {
30942 name: 'uploaded',
30943 id: 101
30944 }, {
30945 name: 'subscribe',
30946 id: 120
30947 }, {
30948 name: 'subscribed',
30949 id: 121
30950 }, {
30951 name: 'unsubscribe',
30952 id: 122
30953 }, {
30954 name: 'unsubscribed',
30955 id: 123
30956 }, {
30957 name: 'is_subscribed',
30958 id: 124
30959 }, {
30960 name: 'modify',
30961 id: 150
30962 }, {
30963 name: 'modified',
30964 id: 151
30965 }, {
30966 name: 'block',
30967 id: 170
30968 }, {
30969 name: 'unblock',
30970 id: 171
30971 }, {
30972 name: 'blocked',
30973 id: 172
30974 }, {
30975 name: 'unblocked',
30976 id: 173
30977 }, {
30978 name: 'members_blocked',
30979 id: 174
30980 }, {
30981 name: 'members_unblocked',
30982 id: 175
30983 }, {
30984 name: 'check_block',
30985 id: 176
30986 }, {
30987 name: 'check_result',
30988 id: 177
30989 }, {
30990 name: 'add_shutup',
30991 id: 180
30992 }, {
30993 name: 'remove_shutup',
30994 id: 181
30995 }, {
30996 name: 'query_shutup',
30997 id: 182
30998 }, {
30999 name: 'shutup_added',
31000 id: 183
31001 }, {
31002 name: 'shutup_removed',
31003 id: 184
31004 }, {
31005 name: 'shutup_result',
31006 id: 185
31007 }, {
31008 name: 'shutuped',
31009 id: 186
31010 }, {
31011 name: 'unshutuped',
31012 id: 187
31013 }, {
31014 name: 'members_shutuped',
31015 id: 188
31016 }, {
31017 name: 'members_unshutuped',
31018 id: 189
31019 }, {
31020 name: 'check_shutup',
31021 id: 190
31022 }]
31023 }, {
31024 name: 'StatusType',
31025 syntax: 'proto2',
31026 values: [{
31027 name: 'on',
31028 id: 1
31029 }, {
31030 name: 'off',
31031 id: 2
31032 }]
31033 }],
31034 isNamespace: true
31035}).build();
31036var _messages$push_server = messageCompiled.push_server.messages2,
31037 JsonObjectMessage = _messages$push_server.JsonObjectMessage,
31038 UnreadTuple = _messages$push_server.UnreadTuple,
31039 LogItem = _messages$push_server.LogItem,
31040 DataCommand = _messages$push_server.DataCommand,
31041 SessionCommand = _messages$push_server.SessionCommand,
31042 ErrorCommand = _messages$push_server.ErrorCommand,
31043 DirectCommand = _messages$push_server.DirectCommand,
31044 AckCommand = _messages$push_server.AckCommand,
31045 UnreadCommand = _messages$push_server.UnreadCommand,
31046 ConvCommand = _messages$push_server.ConvCommand,
31047 RoomCommand = _messages$push_server.RoomCommand,
31048 LogsCommand = _messages$push_server.LogsCommand,
31049 RcpCommand = _messages$push_server.RcpCommand,
31050 ReadTuple = _messages$push_server.ReadTuple,
31051 MaxReadTuple = _messages$push_server.MaxReadTuple,
31052 ReadCommand = _messages$push_server.ReadCommand,
31053 PresenceCommand = _messages$push_server.PresenceCommand,
31054 ReportCommand = _messages$push_server.ReportCommand,
31055 GenericCommand = _messages$push_server.GenericCommand,
31056 BlacklistCommand = _messages$push_server.BlacklistCommand,
31057 PatchCommand = _messages$push_server.PatchCommand,
31058 PatchItem = _messages$push_server.PatchItem,
31059 ConvMemberInfo = _messages$push_server.ConvMemberInfo,
31060 CommandType = _messages$push_server.CommandType,
31061 OpType = _messages$push_server.OpType,
31062 StatusType = _messages$push_server.StatusType;
31063var message = /*#__PURE__*/(0, _freeze.default)({
31064 __proto__: null,
31065 JsonObjectMessage: JsonObjectMessage,
31066 UnreadTuple: UnreadTuple,
31067 LogItem: LogItem,
31068 DataCommand: DataCommand,
31069 SessionCommand: SessionCommand,
31070 ErrorCommand: ErrorCommand,
31071 DirectCommand: DirectCommand,
31072 AckCommand: AckCommand,
31073 UnreadCommand: UnreadCommand,
31074 ConvCommand: ConvCommand,
31075 RoomCommand: RoomCommand,
31076 LogsCommand: LogsCommand,
31077 RcpCommand: RcpCommand,
31078 ReadTuple: ReadTuple,
31079 MaxReadTuple: MaxReadTuple,
31080 ReadCommand: ReadCommand,
31081 PresenceCommand: PresenceCommand,
31082 ReportCommand: ReportCommand,
31083 GenericCommand: GenericCommand,
31084 BlacklistCommand: BlacklistCommand,
31085 PatchCommand: PatchCommand,
31086 PatchItem: PatchItem,
31087 ConvMemberInfo: ConvMemberInfo,
31088 CommandType: CommandType,
31089 OpType: OpType,
31090 StatusType: StatusType
31091});
31092var adapters = {};
31093
31094var getAdapter = function getAdapter(name) {
31095 var adapter = adapters[name];
31096
31097 if (adapter === undefined) {
31098 throw new Error("".concat(name, " adapter is not configured"));
31099 }
31100
31101 return adapter;
31102};
31103/**
31104 * 指定 Adapters
31105 * @function
31106 * @memberof module:leancloud-realtime
31107 * @param {Adapters} newAdapters Adapters 的类型请参考 {@link https://url.leanapp.cn/adapter-type-definitions @leancloud/adapter-types} 中的定义
31108 */
31109
31110
31111var setAdapters = function setAdapters(newAdapters) {
31112 (0, _assign.default)(adapters, newAdapters);
31113};
31114/* eslint-disable */
31115
31116
31117var global$1 = typeof global !== 'undefined' ? global : typeof window !== 'undefined' ? window : {};
31118var EXPIRED = (0, _symbol.default)('expired');
31119var debug = d('LC:Expirable');
31120
31121var Expirable = /*#__PURE__*/function () {
31122 function Expirable(value, ttl) {
31123 this.originalValue = value;
31124
31125 if (typeof ttl === 'number') {
31126 this.expiredAt = Date.now() + ttl;
31127 }
31128 }
31129
31130 _createClass(Expirable, [{
31131 key: "value",
31132 get: function get() {
31133 var expired = this.expiredAt && this.expiredAt <= Date.now();
31134 if (expired) debug("expired: ".concat(this.originalValue));
31135 return expired ? EXPIRED : this.originalValue;
31136 }
31137 }]);
31138
31139 return Expirable;
31140}();
31141
31142Expirable.EXPIRED = EXPIRED;
31143var debug$1 = d('LC:Cache');
31144
31145var Cache = /*#__PURE__*/function () {
31146 function Cache() {
31147 var name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'anonymous';
31148 this.name = name;
31149 this._map = {};
31150 }
31151
31152 var _proto = Cache.prototype;
31153
31154 _proto.get = function get(key) {
31155 var _context5;
31156
31157 var cache = this._map[key];
31158
31159 if (cache) {
31160 var value = cache.value;
31161
31162 if (value !== Expirable.EXPIRED) {
31163 debug$1('[%s] hit: %s', this.name, key);
31164 return value;
31165 }
31166
31167 delete this._map[key];
31168 }
31169
31170 debug$1((0, _concat.default)(_context5 = "[".concat(this.name, "] missed: ")).call(_context5, key));
31171 return null;
31172 };
31173
31174 _proto.set = function set(key, value, ttl) {
31175 debug$1('[%s] set: %s %d', this.name, key, ttl);
31176 this._map[key] = new Expirable(value, ttl);
31177 };
31178
31179 return Cache;
31180}();
31181
31182function ownKeys(object, enumerableOnly) {
31183 var keys = (0, _keys.default)(object);
31184
31185 if (_getOwnPropertySymbols.default) {
31186 var symbols = (0, _getOwnPropertySymbols.default)(object);
31187 if (enumerableOnly) symbols = (0, _filter.default)(symbols).call(symbols, function (sym) {
31188 return (0, _getOwnPropertyDescriptor.default)(object, sym).enumerable;
31189 });
31190 keys.push.apply(keys, symbols);
31191 }
31192
31193 return keys;
31194}
31195
31196function _objectSpread(target) {
31197 for (var i = 1; i < arguments.length; i++) {
31198 var source = arguments[i] != null ? arguments[i] : {};
31199
31200 if (i % 2) {
31201 ownKeys(Object(source), true).forEach(function (key) {
31202 _defineProperty(target, key, source[key]);
31203 });
31204 } else if (_getOwnPropertyDescriptors.default) {
31205 (0, _defineProperties.default)(target, (0, _getOwnPropertyDescriptors.default)(source));
31206 } else {
31207 ownKeys(Object(source)).forEach(function (key) {
31208 (0, _defineProperty2.default)(target, key, (0, _getOwnPropertyDescriptor.default)(source, key));
31209 });
31210 }
31211 }
31212
31213 return target;
31214}
31215/**
31216 * 调试日志控制器
31217 * @const
31218 * @memberof module:leancloud-realtime
31219 * @example
31220 * debug.enable(); // 启用调试日志
31221 * debug.disable(); // 关闭调试日志
31222 */
31223
31224
31225var debug$2 = {
31226 enable: function enable() {
31227 var namespaces = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'LC*';
31228 return d.enable(namespaces);
31229 },
31230 disable: d.disable
31231};
31232
31233var tryAll = function tryAll(promiseConstructors) {
31234 var promise = new _promise.default(promiseConstructors[0]);
31235
31236 if (promiseConstructors.length === 1) {
31237 return promise;
31238 }
31239
31240 return promise["catch"](function () {
31241 return tryAll((0, _slice.default)(promiseConstructors).call(promiseConstructors, 1));
31242 });
31243}; // eslint-disable-next-line no-sequences
31244
31245
31246var tap = function tap(interceptor) {
31247 return function (value) {
31248 return interceptor(value), value;
31249 };
31250};
31251
31252var isIE10 = global$1.navigator && global$1.navigator.userAgent && (0, _indexOf.default)(_context6 = global$1.navigator.userAgent).call(_context6, 'MSIE 10.') !== -1;
31253var map = new _weakMap.default(); // protected property helper
31254
31255var internal = function internal(object) {
31256 if (!map.has(object)) {
31257 map.set(object, {});
31258 }
31259
31260 return map.get(object);
31261};
31262
31263var compact = function compact(obj, filter) {
31264 if (!isPlainObject(obj)) return obj;
31265
31266 var object = _objectSpread({}, obj);
31267
31268 (0, _keys.default)(object).forEach(function (prop) {
31269 var value = object[prop];
31270
31271 if (value === filter) {
31272 delete object[prop];
31273 } else {
31274 object[prop] = compact(value, filter);
31275 }
31276 });
31277 return object;
31278}; // debug utility
31279
31280
31281var removeNull = function removeNull(obj) {
31282 return compact(obj, null);
31283};
31284
31285var trim = function trim(message) {
31286 return removeNull(JSON.parse((0, _stringify.default)(message)));
31287};
31288
31289var ensureArray = function ensureArray(target) {
31290 if (Array.isArray(target)) {
31291 return target;
31292 }
31293
31294 if (target === undefined || target === null) {
31295 return [];
31296 }
31297
31298 return [target];
31299};
31300
31301var isWeapp = // eslint-disable-next-line no-undef
31302(typeof wx === "undefined" ? "undefined" : _typeof(wx)) === 'object' && typeof wx.connectSocket === 'function'; // throttle decorator
31303
31304var isCNApp = function isCNApp(appId) {
31305 return (0, _slice.default)(appId).call(appId, -9) !== '-MdYXbMMI';
31306};
31307
31308var equalBuffer = function equalBuffer(buffer1, buffer2) {
31309 if (!buffer1 || !buffer2) return false;
31310 if (buffer1.byteLength !== buffer2.byteLength) return false;
31311 var a = new Uint8Array(buffer1);
31312 var b = new Uint8Array(buffer2);
31313 return !a.some(function (value, index) {
31314 return value !== b[index];
31315 });
31316};
31317
31318var _class;
31319
31320function ownKeys$1(object, enumerableOnly) {
31321 var keys = (0, _keys.default)(object);
31322
31323 if (_getOwnPropertySymbols.default) {
31324 var symbols = (0, _getOwnPropertySymbols.default)(object);
31325 if (enumerableOnly) symbols = (0, _filter.default)(symbols).call(symbols, function (sym) {
31326 return (0, _getOwnPropertyDescriptor.default)(object, sym).enumerable;
31327 });
31328 keys.push.apply(keys, symbols);
31329 }
31330
31331 return keys;
31332}
31333
31334function _objectSpread$1(target) {
31335 for (var i = 1; i < arguments.length; i++) {
31336 var source = arguments[i] != null ? arguments[i] : {};
31337
31338 if (i % 2) {
31339 ownKeys$1(Object(source), true).forEach(function (key) {
31340 _defineProperty(target, key, source[key]);
31341 });
31342 } else if (_getOwnPropertyDescriptors.default) {
31343 (0, _defineProperties.default)(target, (0, _getOwnPropertyDescriptors.default)(source));
31344 } else {
31345 ownKeys$1(Object(source)).forEach(function (key) {
31346 (0, _defineProperty2.default)(target, key, (0, _getOwnPropertyDescriptor.default)(source, key));
31347 });
31348 }
31349 }
31350
31351 return target;
31352}
31353
31354var debug$3 = d('LC:WebSocketPlus');
31355var OPEN = 'open';
31356var DISCONNECT = 'disconnect';
31357var RECONNECT = 'reconnect';
31358var RETRY = 'retry';
31359var SCHEDULE = 'schedule';
31360var OFFLINE = 'offline';
31361var ONLINE = 'online';
31362var ERROR = 'error';
31363var MESSAGE = 'message';
31364var HEARTBEAT_TIME = 180000;
31365var TIMEOUT_TIME = 380000;
31366
31367var DEFAULT_RETRY_STRATEGY = function DEFAULT_RETRY_STRATEGY(attempt) {
31368 return Math.min(1000 * Math.pow(2, attempt), 300000);
31369};
31370
31371var requireConnected = function requireConnected(target, name, descriptor) {
31372 return _objectSpread$1(_objectSpread$1({}, descriptor), {}, {
31373 value: function requireConnectedWrapper() {
31374 var _context7;
31375
31376 var _descriptor$value;
31377
31378 this.checkConnectionAvailability(name);
31379
31380 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
31381 args[_key] = arguments[_key];
31382 }
31383
31384 return (_descriptor$value = descriptor.value).call.apply(_descriptor$value, (0, _concat.default)(_context7 = [this]).call(_context7, args));
31385 }
31386 });
31387};
31388
31389var WebSocketPlus = (_class = /*#__PURE__*/function (_EventEmitter) {
31390 _inheritsLoose(WebSocketPlus, _EventEmitter);
31391
31392 _createClass(WebSocketPlus, [{
31393 key: "urls",
31394 get: function get() {
31395 return this._urls;
31396 },
31397 set: function set(urls) {
31398 this._urls = ensureArray(urls);
31399 }
31400 }]);
31401
31402 function WebSocketPlus(getUrls, protocol) {
31403 var _this;
31404
31405 _this = _EventEmitter.call(this) || this;
31406
31407 _this.init();
31408
31409 _this._protocol = protocol;
31410
31411 _promise.default.resolve(typeof getUrls === 'function' ? getUrls() : getUrls).then(ensureArray).then(function (urls) {
31412 _this._urls = urls;
31413 return _this._open();
31414 }).then(function () {
31415 _this.__postponeTimeoutTimer = _this._postponeTimeoutTimer.bind(_assertThisInitialized(_this));
31416
31417 if (global$1.addEventListener) {
31418 _this.__pause = function () {
31419 if (_this.can('pause')) _this.pause();
31420 };
31421
31422 _this.__resume = function () {
31423 if (_this.can('resume')) _this.resume();
31424 };
31425
31426 global$1.addEventListener('offline', _this.__pause);
31427 global$1.addEventListener('online', _this.__resume);
31428 }
31429
31430 _this.open();
31431 })["catch"](_this["throw"].bind(_assertThisInitialized(_this)));
31432
31433 return _this;
31434 }
31435
31436 var _proto = WebSocketPlus.prototype;
31437
31438 _proto._open = function _open() {
31439 var _this2 = this;
31440
31441 return this._createWs(this._urls, this._protocol).then(function (ws) {
31442 var _context8;
31443
31444 var _this2$_urls = _toArray(_this2._urls),
31445 first = _this2$_urls[0],
31446 reset = (0, _slice.default)(_this2$_urls).call(_this2$_urls, 1);
31447
31448 _this2._urls = (0, _concat.default)(_context8 = []).call(_context8, _toConsumableArray(reset), [first]);
31449 return ws;
31450 });
31451 };
31452
31453 _proto._createWs = function _createWs(urls, protocol) {
31454 var _this3 = this;
31455
31456 return tryAll((0, _map.default)(urls).call(urls, function (url) {
31457 return function (resolve, reject) {
31458 var _context9;
31459
31460 debug$3((0, _concat.default)(_context9 = "connect [".concat(url, "] ")).call(_context9, protocol));
31461 var WebSocket = getAdapter('WebSocket');
31462 var ws = protocol ? new WebSocket(url, protocol) : new WebSocket(url);
31463 ws.binaryType = _this3.binaryType || 'arraybuffer';
31464
31465 ws.onopen = function () {
31466 return resolve(ws);
31467 };
31468
31469 ws.onclose = function (error) {
31470 if (error instanceof Error) {
31471 return reject(error);
31472 } // in browser, error event is useless
31473
31474
31475 return reject(new Error("Failed to connect [".concat(url, "]")));
31476 };
31477
31478 ws.onerror = ws.onclose;
31479 };
31480 })).then(function (ws) {
31481 _this3._ws = ws;
31482 _this3._ws.onclose = _this3._handleClose.bind(_this3);
31483 _this3._ws.onmessage = _this3._handleMessage.bind(_this3);
31484 return ws;
31485 });
31486 };
31487
31488 _proto._destroyWs = function _destroyWs() {
31489 var ws = this._ws;
31490 if (!ws) return;
31491 ws.onopen = null;
31492 ws.onclose = null;
31493 ws.onerror = null;
31494 ws.onmessage = null;
31495 this._ws = null;
31496 ws.close();
31497 } // eslint-disable-next-line class-methods-use-this
31498 ;
31499
31500 _proto.onbeforeevent = function onbeforeevent(event, from, to) {
31501 var _context10, _context11;
31502
31503 for (var _len2 = arguments.length, payload = new Array(_len2 > 3 ? _len2 - 3 : 0), _key2 = 3; _key2 < _len2; _key2++) {
31504 payload[_key2 - 3] = arguments[_key2];
31505 }
31506
31507 debug$3((0, _concat.default)(_context10 = (0, _concat.default)(_context11 = "".concat(event, ": ")).call(_context11, from, " -> ")).call(_context10, to, " %o"), payload);
31508 };
31509
31510 _proto.onopen = function onopen() {
31511 this.emit(OPEN);
31512 };
31513
31514 _proto.onconnected = function onconnected() {
31515 this._startConnectionKeeper();
31516 };
31517
31518 _proto.onleaveconnected = function onleaveconnected(event, from, to) {
31519 this._stopConnectionKeeper();
31520
31521 this._destroyWs();
31522
31523 if (to === 'offline' || to === 'disconnected') {
31524 this.emit(DISCONNECT);
31525 }
31526 };
31527
31528 _proto.onpause = function onpause() {
31529 this.emit(OFFLINE);
31530 };
31531
31532 _proto.onbeforeresume = function onbeforeresume() {
31533 this.emit(ONLINE);
31534 };
31535
31536 _proto.onreconnect = function onreconnect() {
31537 this.emit(RECONNECT);
31538 };
31539
31540 _proto.ondisconnected = function ondisconnected(event, from, to) {
31541 var _context12;
31542
31543 var _this4 = this;
31544
31545 var attempt = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
31546 var delay = from === OFFLINE ? 0 : DEFAULT_RETRY_STRATEGY.call(null, attempt);
31547 debug$3((0, _concat.default)(_context12 = "schedule attempt=".concat(attempt, " delay=")).call(_context12, delay));
31548 this.emit(SCHEDULE, attempt, delay);
31549
31550 if (this.__scheduledRetry) {
31551 clearTimeout(this.__scheduledRetry);
31552 }
31553
31554 this.__scheduledRetry = setTimeout(function () {
31555 if (_this4.is('disconnected')) {
31556 _this4.retry(attempt);
31557 }
31558 }, delay);
31559 };
31560
31561 _proto.onretry = function onretry(event, from, to) {
31562 var _this5 = this;
31563
31564 var attempt = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
31565 this.emit(RETRY, attempt);
31566
31567 this._open().then(function () {
31568 return _this5.can('reconnect') && _this5.reconnect();
31569 }, function () {
31570 return _this5.can('fail') && _this5.fail(attempt + 1);
31571 });
31572 };
31573
31574 _proto.onerror = function onerror(event, from, to, error) {
31575 this.emit(ERROR, error);
31576 };
31577
31578 _proto.onclose = function onclose() {
31579 if (global$1.removeEventListener) {
31580 if (this.__pause) global$1.removeEventListener('offline', this.__pause);
31581 if (this.__resume) global$1.removeEventListener('online', this.__resume);
31582 }
31583 };
31584
31585 _proto.checkConnectionAvailability = function checkConnectionAvailability() {
31586 var name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'API';
31587
31588 if (!this.is('connected')) {
31589 var _context13;
31590
31591 var currentState = this.current;
31592 console.warn((0, _concat.default)(_context13 = "".concat(name, " should not be called when the connection is ")).call(_context13, currentState));
31593
31594 if (this.is('disconnected') || this.is('reconnecting')) {
31595 console.warn('disconnect and reconnect event should be handled to avoid such calls.');
31596 }
31597
31598 throw new Error('Connection unavailable');
31599 }
31600 } // jsdoc-ignore-start
31601 ;
31602
31603 _proto. // jsdoc-ignore-end
31604 _ping = function _ping() {
31605 debug$3('ping');
31606
31607 try {
31608 this.ping();
31609 } catch (error) {
31610 console.warn("websocket ping error: ".concat(error.message));
31611 }
31612 };
31613
31614 _proto.ping = function ping() {
31615 if (this._ws.ping) {
31616 this._ws.ping();
31617 } else {
31618 console.warn("The WebSocket implement does not support sending ping frame.\n Override ping method to use application defined ping/pong mechanism.");
31619 }
31620 };
31621
31622 _proto._postponeTimeoutTimer = function _postponeTimeoutTimer() {
31623 var _this6 = this;
31624
31625 debug$3('_postponeTimeoutTimer');
31626
31627 this._clearTimeoutTimers();
31628
31629 this._timeoutTimer = setTimeout(function () {
31630 debug$3('timeout');
31631
31632 _this6.disconnect();
31633 }, TIMEOUT_TIME);
31634 };
31635
31636 _proto._clearTimeoutTimers = function _clearTimeoutTimers() {
31637 if (this._timeoutTimer) {
31638 clearTimeout(this._timeoutTimer);
31639 }
31640 };
31641
31642 _proto._startConnectionKeeper = function _startConnectionKeeper() {
31643 debug$3('start connection keeper');
31644 this._heartbeatTimer = setInterval(this._ping.bind(this), HEARTBEAT_TIME);
31645 var addListener = this._ws.addListener || this._ws.addEventListener;
31646
31647 if (!addListener) {
31648 debug$3('connection keeper disabled due to the lack of #addEventListener.');
31649 return;
31650 }
31651
31652 addListener.call(this._ws, 'message', this.__postponeTimeoutTimer);
31653 addListener.call(this._ws, 'pong', this.__postponeTimeoutTimer);
31654
31655 this._postponeTimeoutTimer();
31656 };
31657
31658 _proto._stopConnectionKeeper = function _stopConnectionKeeper() {
31659 debug$3('stop connection keeper'); // websockets/ws#489
31660
31661 var removeListener = this._ws.removeListener || this._ws.removeEventListener;
31662
31663 if (removeListener) {
31664 removeListener.call(this._ws, 'message', this.__postponeTimeoutTimer);
31665 removeListener.call(this._ws, 'pong', this.__postponeTimeoutTimer);
31666
31667 this._clearTimeoutTimers();
31668 }
31669
31670 if (this._heartbeatTimer) {
31671 clearInterval(this._heartbeatTimer);
31672 }
31673 };
31674
31675 _proto._handleClose = function _handleClose(event) {
31676 var _context14;
31677
31678 debug$3((0, _concat.default)(_context14 = "ws closed [".concat(event.code, "] ")).call(_context14, event.reason)); // socket closed manually, ignore close event.
31679
31680 if (this.isFinished()) return;
31681 this.handleClose(event);
31682 };
31683
31684 _proto.handleClose = function handleClose() {
31685 // reconnect
31686 this.disconnect();
31687 } // jsdoc-ignore-start
31688 ;
31689
31690 _proto. // jsdoc-ignore-end
31691 send = function send(data) {
31692 debug$3('send', data);
31693
31694 this._ws.send(data);
31695 };
31696
31697 _proto._handleMessage = function _handleMessage(event) {
31698 debug$3('message', event.data);
31699 this.handleMessage(event.data);
31700 };
31701
31702 _proto.handleMessage = function handleMessage(message) {
31703 this.emit(MESSAGE, message);
31704 };
31705
31706 return WebSocketPlus;
31707}(EventEmitter), (_applyDecoratedDescriptor(_class.prototype, "_ping", [requireConnected], (0, _getOwnPropertyDescriptor.default)(_class.prototype, "_ping"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "send", [requireConnected], (0, _getOwnPropertyDescriptor.default)(_class.prototype, "send"), _class.prototype)), _class);
31708StateMachine.create({
31709 target: WebSocketPlus.prototype,
31710 initial: {
31711 state: 'initialized',
31712 event: 'init',
31713 defer: true
31714 },
31715 terminal: 'closed',
31716 events: [{
31717 name: 'open',
31718 from: 'initialized',
31719 to: 'connected'
31720 }, {
31721 name: 'disconnect',
31722 from: 'connected',
31723 to: 'disconnected'
31724 }, {
31725 name: 'retry',
31726 from: 'disconnected',
31727 to: 'reconnecting'
31728 }, {
31729 name: 'fail',
31730 from: 'reconnecting',
31731 to: 'disconnected'
31732 }, {
31733 name: 'reconnect',
31734 from: 'reconnecting',
31735 to: 'connected'
31736 }, {
31737 name: 'pause',
31738 from: ['connected', 'disconnected', 'reconnecting'],
31739 to: 'offline'
31740 }, {}, {
31741 name: 'resume',
31742 from: 'offline',
31743 to: 'disconnected'
31744 }, {
31745 name: 'close',
31746 from: ['connected', 'disconnected', 'reconnecting', 'offline'],
31747 to: 'closed'
31748 }, {
31749 name: 'throw',
31750 from: '*',
31751 to: 'error'
31752 }]
31753});
31754var error = (0, _freeze.default)({
31755 1000: {
31756 name: 'CLOSE_NORMAL'
31757 },
31758 1006: {
31759 name: 'CLOSE_ABNORMAL'
31760 },
31761 4100: {
31762 name: 'APP_NOT_AVAILABLE',
31763 message: 'App not exists or realtime message service is disabled.'
31764 },
31765 4102: {
31766 name: 'SIGNATURE_FAILED',
31767 message: 'Login signature mismatch.'
31768 },
31769 4103: {
31770 name: 'INVALID_LOGIN',
31771 message: 'Malformed clientId.'
31772 },
31773 4105: {
31774 name: 'SESSION_REQUIRED',
31775 message: 'Message sent before session opened.'
31776 },
31777 4107: {
31778 name: 'READ_TIMEOUT'
31779 },
31780 4108: {
31781 name: 'LOGIN_TIMEOUT'
31782 },
31783 4109: {
31784 name: 'FRAME_TOO_LONG'
31785 },
31786 4110: {
31787 name: 'INVALID_ORIGIN',
31788 message: 'Access denied by domain whitelist.'
31789 },
31790 4111: {
31791 name: 'SESSION_CONFLICT'
31792 },
31793 4112: {
31794 name: 'SESSION_TOKEN_EXPIRED'
31795 },
31796 4113: {
31797 name: 'APP_QUOTA_EXCEEDED',
31798 message: 'The daily active users limit exceeded.'
31799 },
31800 4116: {
31801 name: 'MESSAGE_SENT_QUOTA_EXCEEDED',
31802 message: 'Command sent too fast.'
31803 },
31804 4200: {
31805 name: 'INTERNAL_ERROR',
31806 message: 'Internal error, please contact LeanCloud for support.'
31807 },
31808 4301: {
31809 name: 'CONVERSATION_API_FAILED',
31810 message: 'Upstream Conversatoin API failed, see error.detail for details.'
31811 },
31812 4302: {
31813 name: 'CONVERSATION_SIGNATURE_FAILED',
31814 message: 'Conversation action signature mismatch.'
31815 },
31816 4303: {
31817 name: 'CONVERSATION_NOT_FOUND'
31818 },
31819 4304: {
31820 name: 'CONVERSATION_FULL'
31821 },
31822 4305: {
31823 name: 'CONVERSATION_REJECTED_BY_APP',
31824 message: 'Conversation action rejected by hook.'
31825 },
31826 4306: {
31827 name: 'CONVERSATION_UPDATE_FAILED'
31828 },
31829 4307: {
31830 name: 'CONVERSATION_READ_ONLY'
31831 },
31832 4308: {
31833 name: 'CONVERSATION_NOT_ALLOWED'
31834 },
31835 4309: {
31836 name: 'CONVERSATION_UPDATE_REJECTED',
31837 message: 'Conversation update rejected because the client is not a member.'
31838 },
31839 4310: {
31840 name: 'CONVERSATION_QUERY_FAILED',
31841 message: 'Conversation query failed because it is too expansive.'
31842 },
31843 4311: {
31844 name: 'CONVERSATION_LOG_FAILED'
31845 },
31846 4312: {
31847 name: 'CONVERSATION_LOG_REJECTED',
31848 message: 'Message query rejected because the client is not a member of the conversation.'
31849 },
31850 4313: {
31851 name: 'SYSTEM_CONVERSATION_REQUIRED'
31852 },
31853 4314: {
31854 name: 'NORMAL_CONVERSATION_REQUIRED'
31855 },
31856 4315: {
31857 name: 'CONVERSATION_BLACKLISTED',
31858 message: 'Blacklisted in the conversation.'
31859 },
31860 4316: {
31861 name: 'TRANSIENT_CONVERSATION_REQUIRED'
31862 },
31863 4317: {
31864 name: 'CONVERSATION_MEMBERSHIP_REQUIRED'
31865 },
31866 4318: {
31867 name: 'CONVERSATION_API_QUOTA_EXCEEDED',
31868 message: 'LeanCloud API quota exceeded. You may upgrade your plan.'
31869 },
31870 4323: {
31871 name: 'TEMPORARY_CONVERSATION_EXPIRED',
31872 message: 'Temporary conversation expired or does not exist.'
31873 },
31874 4401: {
31875 name: 'INVALID_MESSAGING_TARGET',
31876 message: 'Conversation does not exist or client is not a member.'
31877 },
31878 4402: {
31879 name: 'MESSAGE_REJECTED_BY_APP',
31880 message: 'Message rejected by hook.'
31881 },
31882 4403: {
31883 name: 'MESSAGE_OWNERSHIP_REQUIRED'
31884 },
31885 4404: {
31886 name: 'MESSAGE_NOT_FOUND'
31887 },
31888 4405: {
31889 name: 'MESSAGE_UPDATE_REJECTED_BY_APP',
31890 message: 'Message update rejected by hook.'
31891 },
31892 4406: {
31893 name: 'MESSAGE_EDIT_DISABLED'
31894 },
31895 4407: {
31896 name: 'MESSAGE_RECALL_DISABLED'
31897 },
31898 5130: {
31899 name: 'OWNER_PROMOTION_NOT_ALLOWED',
31900 message: "Updating a member's role to owner is not allowed."
31901 }
31902});
31903var ErrorCode = (0, _freeze.default)((0, _reduce.default)(_context15 = (0, _keys.default)(error)).call(_context15, function (result, code) {
31904 return (0, _assign.default)(result, _defineProperty({}, error[code].name, Number(code)));
31905}, {}));
31906
31907var createError = function createError(_ref) {
31908 var code = _ref.code,
31909 reason = _ref.reason,
31910 appCode = _ref.appCode,
31911 detail = _ref.detail,
31912 errorMessage = _ref.error;
31913 var message = reason || detail || errorMessage;
31914 var name = reason;
31915
31916 if (!message && error[code]) {
31917 name = error[code].name;
31918 message = error[code].message || name;
31919 }
31920
31921 if (!message) {
31922 message = "Unknow Error: ".concat(code);
31923 }
31924
31925 var err = new Error(message);
31926 return (0, _assign.default)(err, {
31927 code: code,
31928 appCode: appCode,
31929 detail: detail,
31930 name: name
31931 });
31932};
31933
31934var debug$4 = d('LC:Connection');
31935var COMMAND_TIMEOUT = 20000;
31936var EXPIRE = (0, _symbol.default)('expire');
31937
31938var isIdempotentCommand = function isIdempotentCommand(command) {
31939 return !(command.cmd === CommandType.direct || command.cmd === CommandType.session && command.op === OpType.open || command.cmd === CommandType.conv && (command.op === OpType.start || command.op === OpType.update || command.op === OpType.members));
31940};
31941
31942var Connection = /*#__PURE__*/function (_WebSocketPlus) {
31943 _inheritsLoose(Connection, _WebSocketPlus);
31944
31945 function Connection(getUrl, _ref) {
31946 var _context16;
31947
31948 var _this;
31949
31950 var format = _ref.format,
31951 version = _ref.version;
31952 debug$4('initializing Connection');
31953 var protocolString = (0, _concat.default)(_context16 = "lc.".concat(format, ".")).call(_context16, version);
31954 _this = _WebSocketPlus.call(this, getUrl, protocolString) || this;
31955 _this._protocolFormat = format;
31956 _this._commands = {};
31957 _this._serialId = 0;
31958 return _this;
31959 }
31960
31961 var _proto = Connection.prototype;
31962
31963 _proto.send = /*#__PURE__*/function () {
31964 var _send = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(command) {
31965 var _this2 = this;
31966
31967 var waitingForRespond,
31968 buffer,
31969 serialId,
31970 duplicatedCommand,
31971 message,
31972 promise,
31973 _args = arguments;
31974 return _regeneratorRuntime.wrap(function _callee$(_context) {
31975 var _context17, _context18;
31976
31977 while (1) {
31978 switch (_context.prev = _context.next) {
31979 case 0:
31980 waitingForRespond = _args.length > 1 && _args[1] !== undefined ? _args[1] : true;
31981
31982 if (!waitingForRespond) {
31983 _context.next = 11;
31984 break;
31985 }
31986
31987 if (!isIdempotentCommand(command)) {
31988 _context.next = 8;
31989 break;
31990 }
31991
31992 buffer = command.toArrayBuffer();
31993 duplicatedCommand = (0, _find.default)(_context17 = values(this._commands)).call(_context17, function (_ref2) {
31994 var targetBuffer = _ref2.buffer,
31995 targetCommand = _ref2.command;
31996 return targetCommand.cmd === command.cmd && targetCommand.op === command.op && equalBuffer(targetBuffer, buffer);
31997 });
31998
31999 if (!duplicatedCommand) {
32000 _context.next = 8;
32001 break;
32002 }
32003
32004 console.warn((0, _concat.default)(_context18 = "Duplicated command [cmd:".concat(command.cmd, " op:")).call(_context18, command.op, "] is throttled."));
32005 return _context.abrupt("return", duplicatedCommand.promise);
32006
32007 case 8:
32008 this._serialId += 1;
32009 serialId = this._serialId;
32010 command.i = serialId;
32011 // eslint-disable-line no-param-reassign
32012
32013 case 11:
32014 if (debug$4.enabled) debug$4('↑ %O sent', trim(command));
32015
32016 if (this._protocolFormat === 'proto2base64') {
32017 message = command.toBase64();
32018 } else if (command.toArrayBuffer) {
32019 message = command.toArrayBuffer();
32020 }
32021
32022 if (message) {
32023 _context.next = 15;
32024 break;
32025 }
32026
32027 throw new TypeError("".concat(command, " is not a GenericCommand"));
32028
32029 case 15:
32030 _WebSocketPlus.prototype.send.call(this, message);
32031
32032 if (waitingForRespond) {
32033 _context.next = 18;
32034 break;
32035 }
32036
32037 return _context.abrupt("return", undefined);
32038
32039 case 18:
32040 promise = new _promise.default(function (resolve, reject) {
32041 _this2._commands[serialId] = {
32042 command: command,
32043 buffer: buffer,
32044 resolve: resolve,
32045 reject: reject,
32046 timeout: setTimeout(function () {
32047 if (_this2._commands[serialId]) {
32048 var _context19;
32049
32050 if (debug$4.enabled) debug$4('✗ %O timeout', trim(command));
32051 reject(createError({
32052 error: (0, _concat.default)(_context19 = "Command Timeout [cmd:".concat(command.cmd, " op:")).call(_context19, command.op, "]"),
32053 name: 'COMMAND_TIMEOUT'
32054 }));
32055 delete _this2._commands[serialId];
32056 }
32057 }, COMMAND_TIMEOUT)
32058 };
32059 });
32060 this._commands[serialId].promise = promise;
32061 return _context.abrupt("return", promise);
32062
32063 case 21:
32064 case "end":
32065 return _context.stop();
32066 }
32067 }
32068 }, _callee, this);
32069 }));
32070
32071 function send(_x) {
32072 return _send.apply(this, arguments);
32073 }
32074
32075 return send;
32076 }();
32077
32078 _proto.handleMessage = function handleMessage(msg) {
32079 var message;
32080
32081 try {
32082 message = GenericCommand.decode(msg);
32083 if (debug$4.enabled) debug$4('↓ %O received', trim(message));
32084 } catch (e) {
32085 console.warn('Decode message failed:', e.message, msg);
32086 return;
32087 }
32088
32089 var serialId = message.i;
32090
32091 if (serialId) {
32092 if (this._commands[serialId]) {
32093 clearTimeout(this._commands[serialId].timeout);
32094
32095 if (message.cmd === CommandType.error) {
32096 this._commands[serialId].reject(createError(message.errorMessage));
32097 } else {
32098 this._commands[serialId].resolve(message);
32099 }
32100
32101 delete this._commands[serialId];
32102 } else {
32103 console.warn("Unexpected command received with serialId [".concat(serialId, "],\n which have timed out or never been requested."));
32104 }
32105 } else {
32106 switch (message.cmd) {
32107 case CommandType.error:
32108 {
32109 this.emit(ERROR, createError(message.errorMessage));
32110 return;
32111 }
32112
32113 case CommandType.goaway:
32114 {
32115 this.emit(EXPIRE);
32116 return;
32117 }
32118
32119 default:
32120 {
32121 this.emit(MESSAGE, message);
32122 }
32123 }
32124 }
32125 };
32126
32127 _proto.ping = function ping() {
32128 return this.send(new GenericCommand({
32129 cmd: CommandType.echo
32130 }))["catch"](function (error) {
32131 return debug$4('ping failed:', error);
32132 });
32133 };
32134
32135 return Connection;
32136}(WebSocketPlus);
32137
32138var debug$5 = d('LC:request');
32139
32140var request = function request(_ref) {
32141 var _ref$method = _ref.method,
32142 method = _ref$method === void 0 ? 'GET' : _ref$method,
32143 _url = _ref.url,
32144 query = _ref.query,
32145 headers = _ref.headers,
32146 data = _ref.data,
32147 time = _ref.timeout;
32148 var url = _url;
32149
32150 if (query) {
32151 var _context20, _context21, _context23;
32152
32153 var queryString = (0, _filter.default)(_context20 = (0, _map.default)(_context21 = (0, _keys.default)(query)).call(_context21, function (key) {
32154 var _context22;
32155
32156 var value = query[key];
32157 if (value === undefined) return undefined;
32158 var v = isPlainObject(value) ? (0, _stringify.default)(value) : value;
32159 return (0, _concat.default)(_context22 = "".concat(encodeURIComponent(key), "=")).call(_context22, encodeURIComponent(v));
32160 })).call(_context20, function (qs) {
32161 return qs;
32162 }).join('&');
32163 url = (0, _concat.default)(_context23 = "".concat(url, "?")).call(_context23, queryString);
32164 }
32165
32166 debug$5('Req: %O %O %O', method, url, {
32167 headers: headers,
32168 data: data
32169 });
32170 var request = getAdapter('request');
32171 var promise = request(url, {
32172 method: method,
32173 headers: headers,
32174 data: data
32175 }).then(function (response) {
32176 if (response.ok === false) {
32177 var error = createError(response.data);
32178 error.response = response;
32179 throw error;
32180 }
32181
32182 debug$5('Res: %O %O %O', url, response.status, response.data);
32183 return response.data;
32184 })["catch"](function (error) {
32185 if (error.response) {
32186 debug$5('Error: %O %O %O', url, error.response.status, error.response.data);
32187 }
32188
32189 throw error;
32190 });
32191 return time ? promiseTimeout.timeout(promise, time) : promise;
32192};
32193
32194var applyDecorators = function applyDecorators(decorators, target) {
32195 if (decorators) {
32196 decorators.forEach(function (decorator) {
32197 try {
32198 decorator(target);
32199 } catch (error) {
32200 if (decorator._pluginName) {
32201 error.message += "[".concat(decorator._pluginName, "]");
32202 }
32203
32204 throw error;
32205 }
32206 });
32207 }
32208};
32209
32210var applyDispatcher = function applyDispatcher(dispatchers, payload) {
32211 var _context24;
32212
32213 return (0, _reduce.default)(_context24 = ensureArray(dispatchers)).call(_context24, function (resultPromise, dispatcher) {
32214 return resultPromise.then(function (shouldDispatch) {
32215 return shouldDispatch === false ? false : dispatcher.apply(void 0, _toConsumableArray(payload));
32216 })["catch"](function (error) {
32217 if (dispatcher._pluginName) {
32218 // eslint-disable-next-line no-param-reassign
32219 error.message += "[".concat(dispatcher._pluginName, "]");
32220 }
32221
32222 throw error;
32223 });
32224 }, _promise.default.resolve(true));
32225};
32226
32227var version = "5.0.0-rc.7";
32228
32229function ownKeys$2(object, enumerableOnly) {
32230 var keys = (0, _keys.default)(object);
32231
32232 if (_getOwnPropertySymbols.default) {
32233 var symbols = (0, _getOwnPropertySymbols.default)(object);
32234 if (enumerableOnly) symbols = (0, _filter.default)(symbols).call(symbols, function (sym) {
32235 return (0, _getOwnPropertyDescriptor.default)(object, sym).enumerable;
32236 });
32237 keys.push.apply(keys, symbols);
32238 }
32239
32240 return keys;
32241}
32242
32243function _objectSpread$2(target) {
32244 for (var i = 1; i < arguments.length; i++) {
32245 var source = arguments[i] != null ? arguments[i] : {};
32246
32247 if (i % 2) {
32248 ownKeys$2(Object(source), true).forEach(function (key) {
32249 _defineProperty(target, key, source[key]);
32250 });
32251 } else if (_getOwnPropertyDescriptors.default) {
32252 (0, _defineProperties.default)(target, (0, _getOwnPropertyDescriptors.default)(source));
32253 } else {
32254 ownKeys$2(Object(source)).forEach(function (key) {
32255 (0, _defineProperty2.default)(target, key, (0, _getOwnPropertyDescriptor.default)(source, key));
32256 });
32257 }
32258 }
32259
32260 return target;
32261}
32262
32263var debug$6 = d('LC:Realtime');
32264var routerCache = new Cache('push-router');
32265var initializedApp = {};
32266
32267var Realtime = /*#__PURE__*/function (_EventEmitter) {
32268 _inheritsLoose(Realtime, _EventEmitter);
32269 /**
32270 * @extends EventEmitter
32271 * @param {Object} options
32272 * @param {String} options.appId
32273 * @param {String} options.appKey (since 4.0.0)
32274 * @param {String|Object} [options.server] 指定服务器域名,中国节点应用此参数必填(since 4.0.0)
32275 * @param {Boolean} [options.noBinary=false] 设置 WebSocket 使用字符串格式收发消息(默认为二进制格式)。
32276 * 适用于 WebSocket 实现不支持二进制数据格式的情况
32277 * @param {Boolean} [options.ssl=true] 使用 wss 进行连接
32278 * @param {String|String[]} [options.RTMServers] 指定私有部署的 RTM 服务器地址(since 4.0.0)
32279 * @param {Plugin[]} [options.plugins] 加载插件(since 3.1.0)
32280 */
32281
32282
32283 function Realtime(_ref) {
32284 var _context25;
32285
32286 var _this2;
32287
32288 var plugins = _ref.plugins,
32289 options = _objectWithoutProperties(_ref, ["plugins"]);
32290
32291 debug$6('initializing Realtime %s %O', version, options);
32292 _this2 = _EventEmitter.call(this) || this;
32293 var appId = options.appId;
32294
32295 if (typeof appId !== 'string') {
32296 throw new TypeError("appId [".concat(appId, "] is not a string"));
32297 }
32298
32299 if (initializedApp[appId]) {
32300 throw new Error("App [".concat(appId, "] is already initialized."));
32301 }
32302
32303 initializedApp[appId] = true;
32304
32305 if (typeof options.appKey !== 'string') {
32306 throw new TypeError("appKey [".concat(options.appKey, "] is not a string"));
32307 }
32308
32309 if (isCNApp(appId)) {
32310 if (!options.server) {
32311 throw new TypeError("server option is required for apps from CN region");
32312 }
32313 }
32314
32315 _this2._options = _objectSpread$2({
32316 appId: undefined,
32317 appKey: undefined,
32318 noBinary: false,
32319 ssl: true,
32320 RTMServerName: typeof process !== 'undefined' ? process.env.RTM_SERVER_NAME : undefined
32321 }, options);
32322 _this2._cache = new Cache('endpoints');
32323
32324 var _this = internal(_assertThisInitialized(_this2));
32325
32326 _this.clients = new _set.default();
32327 _this.pendingClients = new _set.default();
32328 var mergedPlugins = (0, _concat.default)(_context25 = []).call(_context25, _toConsumableArray(ensureArray(Realtime.__preRegisteredPlugins)), _toConsumableArray(ensureArray(plugins)));
32329 debug$6('Using plugins %o', (0, _map.default)(mergedPlugins).call(mergedPlugins, function (plugin) {
32330 return plugin.name;
32331 }));
32332 _this2._plugins = (0, _reduce.default)(mergedPlugins).call(mergedPlugins, function (result, plugin) {
32333 (0, _keys.default)(plugin).forEach(function (hook) {
32334 if ({}.hasOwnProperty.call(plugin, hook) && hook !== 'name') {
32335 var _context26;
32336
32337 if (plugin.name) {
32338 ensureArray(plugin[hook]).forEach(function (value) {
32339 // eslint-disable-next-line no-param-reassign
32340 value._pluginName = plugin.name;
32341 });
32342 } // eslint-disable-next-line no-param-reassign
32343
32344
32345 result[hook] = (0, _concat.default)(_context26 = ensureArray(result[hook])).call(_context26, plugin[hook]);
32346 }
32347 });
32348 return result;
32349 }, {}); // onRealtimeCreate hook
32350
32351 applyDecorators(_this2._plugins.onRealtimeCreate, _assertThisInitialized(_this2));
32352 return _this2;
32353 }
32354
32355 var _proto = Realtime.prototype;
32356
32357 _proto._request = /*#__PURE__*/function () {
32358 var _request2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(_ref2) {
32359 var method, _url, _ref2$version, version, path, query, headers, data, url, _this$_options, appId, server, _yield$this$construct, api;
32360
32361 return _regeneratorRuntime.wrap(function _callee$(_context) {
32362 var _context27, _context28;
32363
32364 while (1) {
32365 switch (_context.prev = _context.next) {
32366 case 0:
32367 method = _ref2.method, _url = _ref2.url, _ref2$version = _ref2.version, version = _ref2$version === void 0 ? '1.1' : _ref2$version, path = _ref2.path, query = _ref2.query, headers = _ref2.headers, data = _ref2.data;
32368 url = _url;
32369
32370 if (url) {
32371 _context.next = 9;
32372 break;
32373 }
32374
32375 _this$_options = this._options, appId = _this$_options.appId, server = _this$_options.server;
32376 _context.next = 6;
32377 return this.constructor._getServerUrls({
32378 appId: appId,
32379 server: server
32380 });
32381
32382 case 6:
32383 _yield$this$construct = _context.sent;
32384 api = _yield$this$construct.api;
32385 url = (0, _concat.default)(_context27 = (0, _concat.default)(_context28 = "".concat(api, "/")).call(_context28, version)).call(_context27, path);
32386
32387 case 9:
32388 return _context.abrupt("return", request({
32389 url: url,
32390 method: method,
32391 query: query,
32392 headers: _objectSpread$2({
32393 'X-LC-Id': this._options.appId,
32394 'X-LC-Key': this._options.appKey
32395 }, headers),
32396 data: data
32397 }));
32398
32399 case 10:
32400 case "end":
32401 return _context.stop();
32402 }
32403 }
32404 }, _callee, this);
32405 }));
32406
32407 function _request(_x) {
32408 return _request2.apply(this, arguments);
32409 }
32410
32411 return _request;
32412 }();
32413
32414 _proto._open = function _open() {
32415 var _this3 = this;
32416
32417 if (this._openPromise) return this._openPromise;
32418 var format = 'protobuf2';
32419
32420 if (this._options.noBinary) {
32421 // 不发送 binary data,fallback to base64 string
32422 format = 'proto2base64';
32423 }
32424
32425 var version = 3;
32426 var protocol = {
32427 format: format,
32428 version: version
32429 };
32430 this._openPromise = new _promise.default(function (resolve, reject) {
32431 debug$6('No connection established, create a new one.');
32432 var connection = new Connection(function () {
32433 return _this3._getRTMServers(_this3._options);
32434 }, protocol);
32435 connection.on(OPEN, function () {
32436 return resolve(connection);
32437 }).on(ERROR, function (error) {
32438 delete _this3._openPromise;
32439 reject(error);
32440 }).on(EXPIRE, /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
32441 return _regeneratorRuntime.wrap(function _callee2$(_context2) {
32442 while (1) {
32443 switch (_context2.prev = _context2.next) {
32444 case 0:
32445 debug$6('Connection expired. Refresh endpoints.');
32446
32447 _this3._cache.set('endpoints', null, 0);
32448
32449 _context2.next = 4;
32450 return _this3._getRTMServers(_this3._options);
32451
32452 case 4:
32453 connection.urls = _context2.sent;
32454 connection.disconnect();
32455
32456 case 6:
32457 case "end":
32458 return _context2.stop();
32459 }
32460 }
32461 }, _callee2);
32462 }))).on(MESSAGE, _this3._dispatchCommand.bind(_this3));
32463 /**
32464 * 连接断开。
32465 * 连接断开可能是因为 SDK 进入了离线状态(see {@link Realtime#event:OFFLINE}),或长时间没有收到服务器心跳。
32466 * 连接断开后所有的网络操作都会失败,请在连接断开后禁用相关的 UI 元素。
32467 * @event Realtime#DISCONNECT
32468 */
32469
32470 /**
32471 * 计划在一段时间后尝试重新连接
32472 * @event Realtime#SCHEDULE
32473 * @param {Number} attempt 尝试重连的次数
32474 * @param {Number} delay 延迟的毫秒数
32475 */
32476
32477 /**
32478 * 正在尝试重新连接
32479 * @event Realtime#RETRY
32480 * @param {Number} attempt 尝试重连的次数
32481 */
32482
32483 /**
32484 * 连接恢复正常。
32485 * 请重新启用在 {@link Realtime#event:DISCONNECT} 事件中禁用的相关 UI 元素
32486 * @event Realtime#RECONNECT
32487 */
32488
32489 /**
32490 * 客户端连接断开
32491 * @event IMClient#DISCONNECT
32492 * @see Realtime#event:DISCONNECT
32493 * @since 3.2.0
32494 */
32495
32496 /**
32497 * 计划在一段时间后尝试重新连接
32498 * @event IMClient#SCHEDULE
32499 * @param {Number} attempt 尝试重连的次数
32500 * @param {Number} delay 延迟的毫秒数
32501 * @since 3.2.0
32502 */
32503
32504 /**
32505 * 正在尝试重新连接
32506 * @event IMClient#RETRY
32507 * @param {Number} attempt 尝试重连的次数
32508 * @since 3.2.0
32509 */
32510
32511 /**
32512 * 客户端进入离线状态。
32513 * 这通常意味着网络已断开,或者 {@link Realtime#pause} 被调用
32514 * @event Realtime#OFFLINE
32515 * @since 3.4.0
32516 */
32517
32518 /**
32519 * 客户端恢复在线状态
32520 * 这通常意味着网络已恢复,或者 {@link Realtime#resume} 被调用
32521 * @event Realtime#ONLINE
32522 * @since 3.4.0
32523 */
32524
32525 /**
32526 * 进入离线状态。
32527 * 这通常意味着网络已断开,或者 {@link Realtime#pause} 被调用
32528 * @event IMClient#OFFLINE
32529 * @since 3.4.0
32530 */
32531
32532 /**
32533 * 恢复在线状态
32534 * 这通常意味着网络已恢复,或者 {@link Realtime#resume} 被调用
32535 * @event IMClient#ONLINE
32536 * @since 3.4.0
32537 */
32538 // event proxy
32539
32540 [DISCONNECT, RECONNECT, RETRY, SCHEDULE, OFFLINE, ONLINE].forEach(function (event) {
32541 return connection.on(event, function () {
32542 var _context29;
32543
32544 for (var _len = arguments.length, payload = new Array(_len), _key = 0; _key < _len; _key++) {
32545 payload[_key] = arguments[_key];
32546 }
32547
32548 debug$6("".concat(event, " event emitted. %o"), payload);
32549
32550 _this3.emit.apply(_this3, (0, _concat.default)(_context29 = [event]).call(_context29, payload));
32551
32552 if (event !== RECONNECT) {
32553 internal(_this3).clients.forEach(function (client) {
32554 var _context30;
32555
32556 client.emit.apply(client, (0, _concat.default)(_context30 = [event]).call(_context30, payload));
32557 });
32558 }
32559 });
32560 }); // override handleClose
32561
32562 connection.handleClose = function handleClose(event) {
32563 var isFatal = [ErrorCode.APP_NOT_AVAILABLE, ErrorCode.INVALID_LOGIN, ErrorCode.INVALID_ORIGIN].some(function (errorCode) {
32564 return errorCode === event.code;
32565 });
32566
32567 if (isFatal) {
32568 // in these cases, SDK should throw.
32569 this["throw"](createError(event));
32570 } else {
32571 // reconnect
32572 this.disconnect();
32573 }
32574 };
32575
32576 internal(_this3).connection = connection;
32577 });
32578 return this._openPromise;
32579 };
32580
32581 _proto._getRTMServers = /*#__PURE__*/function () {
32582 var _getRTMServers2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(options) {
32583 var info, cachedEndPoints, _info, server, secondary, ttl;
32584
32585 return _regeneratorRuntime.wrap(function _callee3$(_context3) {
32586 while (1) {
32587 switch (_context3.prev = _context3.next) {
32588 case 0:
32589 if (!options.RTMServers) {
32590 _context3.next = 2;
32591 break;
32592 }
32593
32594 return _context3.abrupt("return", shuffle(ensureArray(options.RTMServers)));
32595
32596 case 2:
32597 cachedEndPoints = this._cache.get('endpoints');
32598
32599 if (!cachedEndPoints) {
32600 _context3.next = 7;
32601 break;
32602 }
32603
32604 info = cachedEndPoints;
32605 _context3.next = 14;
32606 break;
32607
32608 case 7:
32609 _context3.next = 9;
32610 return this.constructor._fetchRTMServers(options);
32611
32612 case 9:
32613 info = _context3.sent;
32614 _info = info, server = _info.server, secondary = _info.secondary, ttl = _info.ttl;
32615
32616 if (!(typeof server !== 'string' && typeof secondary !== 'string' && typeof ttl !== 'number')) {
32617 _context3.next = 13;
32618 break;
32619 }
32620
32621 throw new Error("malformed RTM route response: ".concat((0, _stringify.default)(info)));
32622
32623 case 13:
32624 this._cache.set('endpoints', info, info.ttl * 1000);
32625
32626 case 14:
32627 debug$6('endpoint info: %O', info);
32628 return _context3.abrupt("return", [info.server, info.secondary]);
32629
32630 case 16:
32631 case "end":
32632 return _context3.stop();
32633 }
32634 }
32635 }, _callee3, this);
32636 }));
32637
32638 function _getRTMServers(_x2) {
32639 return _getRTMServers2.apply(this, arguments);
32640 }
32641
32642 return _getRTMServers;
32643 }();
32644
32645 Realtime._getServerUrls = /*#__PURE__*/function () {
32646 var _getServerUrls2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(_ref4) {
32647 var appId, server, cachedRouter, defaultProtocol;
32648 return _regeneratorRuntime.wrap(function _callee4$(_context4) {
32649 while (1) {
32650 switch (_context4.prev = _context4.next) {
32651 case 0:
32652 appId = _ref4.appId, server = _ref4.server;
32653 debug$6('fetch server urls');
32654
32655 if (!server) {
32656 _context4.next = 6;
32657 break;
32658 }
32659
32660 if (!(typeof server !== 'string')) {
32661 _context4.next = 5;
32662 break;
32663 }
32664
32665 return _context4.abrupt("return", server);
32666
32667 case 5:
32668 return _context4.abrupt("return", {
32669 RTMRouter: server,
32670 api: server
32671 });
32672
32673 case 6:
32674 cachedRouter = routerCache.get(appId);
32675
32676 if (!cachedRouter) {
32677 _context4.next = 9;
32678 break;
32679 }
32680
32681 return _context4.abrupt("return", cachedRouter);
32682
32683 case 9:
32684 defaultProtocol = 'https://';
32685 return _context4.abrupt("return", request({
32686 url: 'https://app-router.com/2/route',
32687 query: {
32688 appId: appId
32689 },
32690 timeout: 20000
32691 }).then(tap(debug$6)).then(function (_ref5) {
32692 var _context31, _context32;
32693
32694 var RTMRouterServer = _ref5.rtm_router_server,
32695 APIServer = _ref5.api_server,
32696 _ref5$ttl = _ref5.ttl,
32697 ttl = _ref5$ttl === void 0 ? 3600 : _ref5$ttl;
32698
32699 if (!RTMRouterServer) {
32700 throw new Error('rtm router not exists');
32701 }
32702
32703 var serverUrls = {
32704 RTMRouter: (0, _concat.default)(_context31 = "".concat(defaultProtocol)).call(_context31, RTMRouterServer),
32705 api: (0, _concat.default)(_context32 = "".concat(defaultProtocol)).call(_context32, APIServer)
32706 };
32707 routerCache.set(appId, serverUrls, ttl * 1000);
32708 return serverUrls;
32709 })["catch"](function () {
32710 var _context33, _context34, _context35, _context36;
32711
32712 var id = (0, _slice.default)(appId).call(appId, 0, 8).toLowerCase();
32713 var domain = 'lncldglobal.com';
32714 return {
32715 RTMRouter: (0, _concat.default)(_context33 = (0, _concat.default)(_context34 = "".concat(defaultProtocol)).call(_context34, id, ".rtm.")).call(_context33, domain),
32716 api: (0, _concat.default)(_context35 = (0, _concat.default)(_context36 = "".concat(defaultProtocol)).call(_context36, id, ".api.")).call(_context35, domain)
32717 };
32718 }));
32719
32720 case 11:
32721 case "end":
32722 return _context4.stop();
32723 }
32724 }
32725 }, _callee4);
32726 }));
32727
32728 function _getServerUrls(_x3) {
32729 return _getServerUrls2.apply(this, arguments);
32730 }
32731
32732 return _getServerUrls;
32733 }();
32734
32735 Realtime._fetchRTMServers = function _fetchRTMServers(_ref6) {
32736 var appId = _ref6.appId,
32737 ssl = _ref6.ssl,
32738 server = _ref6.server,
32739 RTMServerName = _ref6.RTMServerName;
32740 debug$6('fetch endpoint info');
32741 return this._getServerUrls({
32742 appId: appId,
32743 server: server
32744 }).then(tap(debug$6)).then(function (_ref7) {
32745 var RTMRouter = _ref7.RTMRouter;
32746 return request({
32747 url: "".concat(RTMRouter, "/v1/route"),
32748 query: {
32749 appId: appId,
32750 secure: ssl,
32751 features: isWeapp ? 'wechat' : undefined,
32752 server: RTMServerName,
32753 _t: Date.now()
32754 },
32755 timeout: 20000
32756 }).then(tap(debug$6));
32757 });
32758 };
32759
32760 _proto._close = function _close() {
32761 if (this._openPromise) {
32762 this._openPromise.then(function (connection) {
32763 return connection.close();
32764 });
32765 }
32766
32767 delete this._openPromise;
32768 }
32769 /**
32770 * 手动进行重连。
32771 * SDK 在网络出现异常时会自动按照一定的时间间隔尝试重连,调用该方法会立即尝试重连并重置重连尝试计数器。
32772 * 只能在 `SCHEDULE` 事件之后,`RETRY` 事件之前调用,如果当前网络正常或者正在进行重连,调用该方法会抛异常。
32773 */
32774 ;
32775
32776 _proto.retry = function retry() {
32777 var _internal = internal(this),
32778 connection = _internal.connection;
32779
32780 if (!connection) {
32781 throw new Error('no connection established');
32782 }
32783
32784 if (connection.cannot('retry')) {
32785 throw new Error("retrying not allowed when not disconnected. the connection is now ".concat(connection.current));
32786 }
32787
32788 return connection.retry();
32789 }
32790 /**
32791 * 暂停,使 SDK 进入离线状态。
32792 * 你可以在网络断开、应用进入后台等时刻调用该方法让 SDK 进入离线状态,离线状态下不会尝试重连。
32793 * 在浏览器中 SDK 会自动监听网络变化,因此无需手动调用该方法。
32794 *
32795 * @since 3.4.0
32796 * @see Realtime#event:OFFLINE
32797 */
32798 ;
32799
32800 _proto.pause = function pause() {
32801 // 这个方法常常在网络断开、进入后台时被调用,此时 connection 可能没有建立或者已经 close。
32802 // 因此不像 retry,这个方法应该尽可能 loose
32803 var _internal2 = internal(this),
32804 connection = _internal2.connection;
32805
32806 if (!connection) return;
32807 if (connection.can('pause')) connection.pause();
32808 }
32809 /**
32810 * 恢复在线状态。
32811 * 你可以在网络恢复、应用回到前台等时刻调用该方法让 SDK 恢复在线状态,恢复在线状态后 SDK 会开始尝试重连。
32812 *
32813 * @since 3.4.0
32814 * @see Realtime#event:ONLINE
32815 */
32816 ;
32817
32818 _proto.resume = function resume() {
32819 // 与 pause 一样,这个方法应该尽可能 loose
32820 var _internal3 = internal(this),
32821 connection = _internal3.connection;
32822
32823 if (!connection) return;
32824 if (connection.can('resume')) connection.resume();
32825 };
32826
32827 _proto._registerPending = function _registerPending(value) {
32828 internal(this).pendingClients.add(value);
32829 };
32830
32831 _proto._deregisterPending = function _deregisterPending(client) {
32832 internal(this).pendingClients["delete"](client);
32833 };
32834
32835 _proto._register = function _register(client) {
32836 internal(this).clients.add(client);
32837 };
32838
32839 _proto._deregister = function _deregister(client) {
32840 var _this = internal(this);
32841
32842 _this.clients["delete"](client);
32843
32844 if (_this.clients.size + _this.pendingClients.size === 0) {
32845 this._close();
32846 }
32847 };
32848
32849 _proto._dispatchCommand = function _dispatchCommand(command) {
32850 return applyDispatcher(this._plugins.beforeCommandDispatch, [command, this]).then(function (shouldDispatch) {
32851 // no plugin handled this command
32852 if (shouldDispatch) return debug$6('[WARN] Unexpected message received: %O', trim(command));
32853 return false;
32854 });
32855 };
32856
32857 return Realtime;
32858}(EventEmitter); // For test purpose only
32859
32860
32861var polyfilledPromise = _promise.default;
32862exports.EventEmitter = EventEmitter;
32863exports.Promise = polyfilledPromise;
32864exports.Protocals = message;
32865exports.Protocols = message;
32866exports.Realtime = Realtime;
32867exports.debug = debug$2;
32868exports.getAdapter = getAdapter;
32869exports.setAdapters = setAdapters;
32870/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(78)))
32871
32872/***/ }),
32873/* 622 */
32874/***/ (function(module, exports, __webpack_require__) {
32875
32876module.exports = __webpack_require__(623);
32877
32878/***/ }),
32879/* 623 */
32880/***/ (function(module, exports, __webpack_require__) {
32881
32882var parent = __webpack_require__(624);
32883
32884module.exports = parent;
32885
32886
32887/***/ }),
32888/* 624 */
32889/***/ (function(module, exports, __webpack_require__) {
32890
32891__webpack_require__(625);
32892var path = __webpack_require__(7);
32893
32894module.exports = path.Object.freeze;
32895
32896
32897/***/ }),
32898/* 625 */
32899/***/ (function(module, exports, __webpack_require__) {
32900
32901var $ = __webpack_require__(0);
32902var FREEZING = __webpack_require__(263);
32903var fails = __webpack_require__(2);
32904var isObject = __webpack_require__(11);
32905var onFreeze = __webpack_require__(97).onFreeze;
32906
32907// eslint-disable-next-line es-x/no-object-freeze -- safe
32908var $freeze = Object.freeze;
32909var FAILS_ON_PRIMITIVES = fails(function () { $freeze(1); });
32910
32911// `Object.freeze` method
32912// https://tc39.es/ecma262/#sec-object.freeze
32913$({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES, sham: !FREEZING }, {
32914 freeze: function freeze(it) {
32915 return $freeze && isObject(it) ? $freeze(onFreeze(it)) : it;
32916 }
32917});
32918
32919
32920/***/ }),
32921/* 626 */
32922/***/ (function(module, exports, __webpack_require__) {
32923
32924// FF26- bug: ArrayBuffers are non-extensible, but Object.isExtensible does not report it
32925var fails = __webpack_require__(2);
32926
32927module.exports = fails(function () {
32928 if (typeof ArrayBuffer == 'function') {
32929 var buffer = new ArrayBuffer(8);
32930 // eslint-disable-next-line es-x/no-object-isextensible, es-x/no-object-defineproperty -- safe
32931 if (Object.isExtensible(buffer)) Object.defineProperty(buffer, 'a', { value: 8 });
32932 }
32933});
32934
32935
32936/***/ }),
32937/* 627 */
32938/***/ (function(module, exports, __webpack_require__) {
32939
32940var parent = __webpack_require__(628);
32941
32942module.exports = parent;
32943
32944
32945/***/ }),
32946/* 628 */
32947/***/ (function(module, exports, __webpack_require__) {
32948
32949__webpack_require__(629);
32950var path = __webpack_require__(7);
32951
32952module.exports = path.Object.assign;
32953
32954
32955/***/ }),
32956/* 629 */
32957/***/ (function(module, exports, __webpack_require__) {
32958
32959var $ = __webpack_require__(0);
32960var assign = __webpack_require__(630);
32961
32962// `Object.assign` method
32963// https://tc39.es/ecma262/#sec-object.assign
32964// eslint-disable-next-line es-x/no-object-assign -- required for testing
32965$({ target: 'Object', stat: true, arity: 2, forced: Object.assign !== assign }, {
32966 assign: assign
32967});
32968
32969
32970/***/ }),
32971/* 630 */
32972/***/ (function(module, exports, __webpack_require__) {
32973
32974"use strict";
32975
32976var DESCRIPTORS = __webpack_require__(14);
32977var uncurryThis = __webpack_require__(4);
32978var call = __webpack_require__(15);
32979var fails = __webpack_require__(2);
32980var objectKeys = __webpack_require__(107);
32981var getOwnPropertySymbolsModule = __webpack_require__(106);
32982var propertyIsEnumerableModule = __webpack_require__(121);
32983var toObject = __webpack_require__(33);
32984var IndexedObject = __webpack_require__(98);
32985
32986// eslint-disable-next-line es-x/no-object-assign -- safe
32987var $assign = Object.assign;
32988// eslint-disable-next-line es-x/no-object-defineproperty -- required for testing
32989var defineProperty = Object.defineProperty;
32990var concat = uncurryThis([].concat);
32991
32992// `Object.assign` method
32993// https://tc39.es/ecma262/#sec-object.assign
32994module.exports = !$assign || fails(function () {
32995 // should have correct order of operations (Edge bug)
32996 if (DESCRIPTORS && $assign({ b: 1 }, $assign(defineProperty({}, 'a', {
32997 enumerable: true,
32998 get: function () {
32999 defineProperty(this, 'b', {
33000 value: 3,
33001 enumerable: false
33002 });
33003 }
33004 }), { b: 2 })).b !== 1) return true;
33005 // should work with symbols and should have deterministic property order (V8 bug)
33006 var A = {};
33007 var B = {};
33008 // eslint-disable-next-line es-x/no-symbol -- safe
33009 var symbol = Symbol();
33010 var alphabet = 'abcdefghijklmnopqrst';
33011 A[symbol] = 7;
33012 alphabet.split('').forEach(function (chr) { B[chr] = chr; });
33013 return $assign({}, A)[symbol] != 7 || objectKeys($assign({}, B)).join('') != alphabet;
33014}) ? function assign(target, source) { // eslint-disable-line no-unused-vars -- required for `.length`
33015 var T = toObject(target);
33016 var argumentsLength = arguments.length;
33017 var index = 1;
33018 var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;
33019 var propertyIsEnumerable = propertyIsEnumerableModule.f;
33020 while (argumentsLength > index) {
33021 var S = IndexedObject(arguments[index++]);
33022 var keys = getOwnPropertySymbols ? concat(objectKeys(S), getOwnPropertySymbols(S)) : objectKeys(S);
33023 var length = keys.length;
33024 var j = 0;
33025 var key;
33026 while (length > j) {
33027 key = keys[j++];
33028 if (!DESCRIPTORS || call(propertyIsEnumerable, S, key)) T[key] = S[key];
33029 }
33030 } return T;
33031} : $assign;
33032
33033
33034/***/ }),
33035/* 631 */
33036/***/ (function(module, exports, __webpack_require__) {
33037
33038var parent = __webpack_require__(632);
33039
33040module.exports = parent;
33041
33042
33043/***/ }),
33044/* 632 */
33045/***/ (function(module, exports, __webpack_require__) {
33046
33047__webpack_require__(242);
33048var path = __webpack_require__(7);
33049
33050module.exports = path.Object.getOwnPropertySymbols;
33051
33052
33053/***/ }),
33054/* 633 */
33055/***/ (function(module, exports, __webpack_require__) {
33056
33057module.exports = __webpack_require__(634);
33058
33059/***/ }),
33060/* 634 */
33061/***/ (function(module, exports, __webpack_require__) {
33062
33063var parent = __webpack_require__(635);
33064
33065module.exports = parent;
33066
33067
33068/***/ }),
33069/* 635 */
33070/***/ (function(module, exports, __webpack_require__) {
33071
33072__webpack_require__(636);
33073var path = __webpack_require__(7);
33074
33075module.exports = path.Object.getOwnPropertyDescriptors;
33076
33077
33078/***/ }),
33079/* 636 */
33080/***/ (function(module, exports, __webpack_require__) {
33081
33082var $ = __webpack_require__(0);
33083var DESCRIPTORS = __webpack_require__(14);
33084var ownKeys = __webpack_require__(162);
33085var toIndexedObject = __webpack_require__(35);
33086var getOwnPropertyDescriptorModule = __webpack_require__(64);
33087var createProperty = __webpack_require__(93);
33088
33089// `Object.getOwnPropertyDescriptors` method
33090// https://tc39.es/ecma262/#sec-object.getownpropertydescriptors
33091$({ target: 'Object', stat: true, sham: !DESCRIPTORS }, {
33092 getOwnPropertyDescriptors: function getOwnPropertyDescriptors(object) {
33093 var O = toIndexedObject(object);
33094 var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
33095 var keys = ownKeys(O);
33096 var result = {};
33097 var index = 0;
33098 var key, descriptor;
33099 while (keys.length > index) {
33100 descriptor = getOwnPropertyDescriptor(O, key = keys[index++]);
33101 if (descriptor !== undefined) createProperty(result, key, descriptor);
33102 }
33103 return result;
33104 }
33105});
33106
33107
33108/***/ }),
33109/* 637 */
33110/***/ (function(module, exports, __webpack_require__) {
33111
33112module.exports = __webpack_require__(638);
33113
33114/***/ }),
33115/* 638 */
33116/***/ (function(module, exports, __webpack_require__) {
33117
33118var parent = __webpack_require__(639);
33119
33120module.exports = parent;
33121
33122
33123/***/ }),
33124/* 639 */
33125/***/ (function(module, exports, __webpack_require__) {
33126
33127__webpack_require__(640);
33128var path = __webpack_require__(7);
33129
33130var Object = path.Object;
33131
33132var defineProperties = module.exports = function defineProperties(T, D) {
33133 return Object.defineProperties(T, D);
33134};
33135
33136if (Object.defineProperties.sham) defineProperties.sham = true;
33137
33138
33139/***/ }),
33140/* 640 */
33141/***/ (function(module, exports, __webpack_require__) {
33142
33143var $ = __webpack_require__(0);
33144var DESCRIPTORS = __webpack_require__(14);
33145var defineProperties = __webpack_require__(129).f;
33146
33147// `Object.defineProperties` method
33148// https://tc39.es/ecma262/#sec-object.defineproperties
33149// eslint-disable-next-line es-x/no-object-defineproperties -- safe
33150$({ target: 'Object', stat: true, forced: Object.defineProperties !== defineProperties, sham: !DESCRIPTORS }, {
33151 defineProperties: defineProperties
33152});
33153
33154
33155/***/ }),
33156/* 641 */
33157/***/ (function(module, exports, __webpack_require__) {
33158
33159module.exports = __webpack_require__(642);
33160
33161/***/ }),
33162/* 642 */
33163/***/ (function(module, exports, __webpack_require__) {
33164
33165var parent = __webpack_require__(643);
33166__webpack_require__(46);
33167
33168module.exports = parent;
33169
33170
33171/***/ }),
33172/* 643 */
33173/***/ (function(module, exports, __webpack_require__) {
33174
33175__webpack_require__(43);
33176__webpack_require__(68);
33177__webpack_require__(644);
33178var path = __webpack_require__(7);
33179
33180module.exports = path.WeakMap;
33181
33182
33183/***/ }),
33184/* 644 */
33185/***/ (function(module, exports, __webpack_require__) {
33186
33187// TODO: Remove this module from `core-js@4` since it's replaced to module below
33188__webpack_require__(645);
33189
33190
33191/***/ }),
33192/* 645 */
33193/***/ (function(module, exports, __webpack_require__) {
33194
33195"use strict";
33196
33197var global = __webpack_require__(8);
33198var uncurryThis = __webpack_require__(4);
33199var defineBuiltIns = __webpack_require__(156);
33200var InternalMetadataModule = __webpack_require__(97);
33201var collection = __webpack_require__(267);
33202var collectionWeak = __webpack_require__(646);
33203var isObject = __webpack_require__(11);
33204var isExtensible = __webpack_require__(264);
33205var enforceInternalState = __webpack_require__(44).enforce;
33206var NATIVE_WEAK_MAP = __webpack_require__(168);
33207
33208var IS_IE11 = !global.ActiveXObject && 'ActiveXObject' in global;
33209var InternalWeakMap;
33210
33211var wrapper = function (init) {
33212 return function WeakMap() {
33213 return init(this, arguments.length ? arguments[0] : undefined);
33214 };
33215};
33216
33217// `WeakMap` constructor
33218// https://tc39.es/ecma262/#sec-weakmap-constructor
33219var $WeakMap = collection('WeakMap', wrapper, collectionWeak);
33220
33221// IE11 WeakMap frozen keys fix
33222// We can't use feature detection because it crash some old IE builds
33223// https://github.com/zloirock/core-js/issues/485
33224if (NATIVE_WEAK_MAP && IS_IE11) {
33225 InternalWeakMap = collectionWeak.getConstructor(wrapper, 'WeakMap', true);
33226 InternalMetadataModule.enable();
33227 var WeakMapPrototype = $WeakMap.prototype;
33228 var nativeDelete = uncurryThis(WeakMapPrototype['delete']);
33229 var nativeHas = uncurryThis(WeakMapPrototype.has);
33230 var nativeGet = uncurryThis(WeakMapPrototype.get);
33231 var nativeSet = uncurryThis(WeakMapPrototype.set);
33232 defineBuiltIns(WeakMapPrototype, {
33233 'delete': function (key) {
33234 if (isObject(key) && !isExtensible(key)) {
33235 var state = enforceInternalState(this);
33236 if (!state.frozen) state.frozen = new InternalWeakMap();
33237 return nativeDelete(this, key) || state.frozen['delete'](key);
33238 } return nativeDelete(this, key);
33239 },
33240 has: function has(key) {
33241 if (isObject(key) && !isExtensible(key)) {
33242 var state = enforceInternalState(this);
33243 if (!state.frozen) state.frozen = new InternalWeakMap();
33244 return nativeHas(this, key) || state.frozen.has(key);
33245 } return nativeHas(this, key);
33246 },
33247 get: function get(key) {
33248 if (isObject(key) && !isExtensible(key)) {
33249 var state = enforceInternalState(this);
33250 if (!state.frozen) state.frozen = new InternalWeakMap();
33251 return nativeHas(this, key) ? nativeGet(this, key) : state.frozen.get(key);
33252 } return nativeGet(this, key);
33253 },
33254 set: function set(key, value) {
33255 if (isObject(key) && !isExtensible(key)) {
33256 var state = enforceInternalState(this);
33257 if (!state.frozen) state.frozen = new InternalWeakMap();
33258 nativeHas(this, key) ? nativeSet(this, key, value) : state.frozen.set(key, value);
33259 } else nativeSet(this, key, value);
33260 return this;
33261 }
33262 });
33263}
33264
33265
33266/***/ }),
33267/* 646 */
33268/***/ (function(module, exports, __webpack_require__) {
33269
33270"use strict";
33271
33272var uncurryThis = __webpack_require__(4);
33273var defineBuiltIns = __webpack_require__(156);
33274var getWeakData = __webpack_require__(97).getWeakData;
33275var anObject = __webpack_require__(21);
33276var isObject = __webpack_require__(11);
33277var anInstance = __webpack_require__(110);
33278var iterate = __webpack_require__(41);
33279var ArrayIterationModule = __webpack_require__(75);
33280var hasOwn = __webpack_require__(13);
33281var InternalStateModule = __webpack_require__(44);
33282
33283var setInternalState = InternalStateModule.set;
33284var internalStateGetterFor = InternalStateModule.getterFor;
33285var find = ArrayIterationModule.find;
33286var findIndex = ArrayIterationModule.findIndex;
33287var splice = uncurryThis([].splice);
33288var id = 0;
33289
33290// fallback for uncaught frozen keys
33291var uncaughtFrozenStore = function (store) {
33292 return store.frozen || (store.frozen = new UncaughtFrozenStore());
33293};
33294
33295var UncaughtFrozenStore = function () {
33296 this.entries = [];
33297};
33298
33299var findUncaughtFrozen = function (store, key) {
33300 return find(store.entries, function (it) {
33301 return it[0] === key;
33302 });
33303};
33304
33305UncaughtFrozenStore.prototype = {
33306 get: function (key) {
33307 var entry = findUncaughtFrozen(this, key);
33308 if (entry) return entry[1];
33309 },
33310 has: function (key) {
33311 return !!findUncaughtFrozen(this, key);
33312 },
33313 set: function (key, value) {
33314 var entry = findUncaughtFrozen(this, key);
33315 if (entry) entry[1] = value;
33316 else this.entries.push([key, value]);
33317 },
33318 'delete': function (key) {
33319 var index = findIndex(this.entries, function (it) {
33320 return it[0] === key;
33321 });
33322 if (~index) splice(this.entries, index, 1);
33323 return !!~index;
33324 }
33325};
33326
33327module.exports = {
33328 getConstructor: function (wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER) {
33329 var Constructor = wrapper(function (that, iterable) {
33330 anInstance(that, Prototype);
33331 setInternalState(that, {
33332 type: CONSTRUCTOR_NAME,
33333 id: id++,
33334 frozen: undefined
33335 });
33336 if (iterable != undefined) iterate(iterable, that[ADDER], { that: that, AS_ENTRIES: IS_MAP });
33337 });
33338
33339 var Prototype = Constructor.prototype;
33340
33341 var getInternalState = internalStateGetterFor(CONSTRUCTOR_NAME);
33342
33343 var define = function (that, key, value) {
33344 var state = getInternalState(that);
33345 var data = getWeakData(anObject(key), true);
33346 if (data === true) uncaughtFrozenStore(state).set(key, value);
33347 else data[state.id] = value;
33348 return that;
33349 };
33350
33351 defineBuiltIns(Prototype, {
33352 // `{ WeakMap, WeakSet }.prototype.delete(key)` methods
33353 // https://tc39.es/ecma262/#sec-weakmap.prototype.delete
33354 // https://tc39.es/ecma262/#sec-weakset.prototype.delete
33355 'delete': function (key) {
33356 var state = getInternalState(this);
33357 if (!isObject(key)) return false;
33358 var data = getWeakData(key);
33359 if (data === true) return uncaughtFrozenStore(state)['delete'](key);
33360 return data && hasOwn(data, state.id) && delete data[state.id];
33361 },
33362 // `{ WeakMap, WeakSet }.prototype.has(key)` methods
33363 // https://tc39.es/ecma262/#sec-weakmap.prototype.has
33364 // https://tc39.es/ecma262/#sec-weakset.prototype.has
33365 has: function has(key) {
33366 var state = getInternalState(this);
33367 if (!isObject(key)) return false;
33368 var data = getWeakData(key);
33369 if (data === true) return uncaughtFrozenStore(state).has(key);
33370 return data && hasOwn(data, state.id);
33371 }
33372 });
33373
33374 defineBuiltIns(Prototype, IS_MAP ? {
33375 // `WeakMap.prototype.get(key)` method
33376 // https://tc39.es/ecma262/#sec-weakmap.prototype.get
33377 get: function get(key) {
33378 var state = getInternalState(this);
33379 if (isObject(key)) {
33380 var data = getWeakData(key);
33381 if (data === true) return uncaughtFrozenStore(state).get(key);
33382 return data ? data[state.id] : undefined;
33383 }
33384 },
33385 // `WeakMap.prototype.set(key, value)` method
33386 // https://tc39.es/ecma262/#sec-weakmap.prototype.set
33387 set: function set(key, value) {
33388 return define(this, key, value);
33389 }
33390 } : {
33391 // `WeakSet.prototype.add(value)` method
33392 // https://tc39.es/ecma262/#sec-weakset.prototype.add
33393 add: function add(value) {
33394 return define(this, value, true);
33395 }
33396 });
33397
33398 return Constructor;
33399 }
33400};
33401
33402
33403/***/ }),
33404/* 647 */
33405/***/ (function(module, exports, __webpack_require__) {
33406
33407var parent = __webpack_require__(648);
33408__webpack_require__(46);
33409
33410module.exports = parent;
33411
33412
33413/***/ }),
33414/* 648 */
33415/***/ (function(module, exports, __webpack_require__) {
33416
33417__webpack_require__(43);
33418__webpack_require__(68);
33419__webpack_require__(649);
33420__webpack_require__(70);
33421var path = __webpack_require__(7);
33422
33423module.exports = path.Set;
33424
33425
33426/***/ }),
33427/* 649 */
33428/***/ (function(module, exports, __webpack_require__) {
33429
33430// TODO: Remove this module from `core-js@4` since it's replaced to module below
33431__webpack_require__(650);
33432
33433
33434/***/ }),
33435/* 650 */
33436/***/ (function(module, exports, __webpack_require__) {
33437
33438"use strict";
33439
33440var collection = __webpack_require__(267);
33441var collectionStrong = __webpack_require__(651);
33442
33443// `Set` constructor
33444// https://tc39.es/ecma262/#sec-set-objects
33445collection('Set', function (init) {
33446 return function Set() { return init(this, arguments.length ? arguments[0] : undefined); };
33447}, collectionStrong);
33448
33449
33450/***/ }),
33451/* 651 */
33452/***/ (function(module, exports, __webpack_require__) {
33453
33454"use strict";
33455
33456var defineProperty = __webpack_require__(23).f;
33457var create = __webpack_require__(53);
33458var defineBuiltIns = __webpack_require__(156);
33459var bind = __webpack_require__(52);
33460var anInstance = __webpack_require__(110);
33461var iterate = __webpack_require__(41);
33462var defineIterator = __webpack_require__(133);
33463var setSpecies = __webpack_require__(171);
33464var DESCRIPTORS = __webpack_require__(14);
33465var fastKey = __webpack_require__(97).fastKey;
33466var InternalStateModule = __webpack_require__(44);
33467
33468var setInternalState = InternalStateModule.set;
33469var internalStateGetterFor = InternalStateModule.getterFor;
33470
33471module.exports = {
33472 getConstructor: function (wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER) {
33473 var Constructor = wrapper(function (that, iterable) {
33474 anInstance(that, Prototype);
33475 setInternalState(that, {
33476 type: CONSTRUCTOR_NAME,
33477 index: create(null),
33478 first: undefined,
33479 last: undefined,
33480 size: 0
33481 });
33482 if (!DESCRIPTORS) that.size = 0;
33483 if (iterable != undefined) iterate(iterable, that[ADDER], { that: that, AS_ENTRIES: IS_MAP });
33484 });
33485
33486 var Prototype = Constructor.prototype;
33487
33488 var getInternalState = internalStateGetterFor(CONSTRUCTOR_NAME);
33489
33490 var define = function (that, key, value) {
33491 var state = getInternalState(that);
33492 var entry = getEntry(that, key);
33493 var previous, index;
33494 // change existing entry
33495 if (entry) {
33496 entry.value = value;
33497 // create new entry
33498 } else {
33499 state.last = entry = {
33500 index: index = fastKey(key, true),
33501 key: key,
33502 value: value,
33503 previous: previous = state.last,
33504 next: undefined,
33505 removed: false
33506 };
33507 if (!state.first) state.first = entry;
33508 if (previous) previous.next = entry;
33509 if (DESCRIPTORS) state.size++;
33510 else that.size++;
33511 // add to index
33512 if (index !== 'F') state.index[index] = entry;
33513 } return that;
33514 };
33515
33516 var getEntry = function (that, key) {
33517 var state = getInternalState(that);
33518 // fast case
33519 var index = fastKey(key);
33520 var entry;
33521 if (index !== 'F') return state.index[index];
33522 // frozen object case
33523 for (entry = state.first; entry; entry = entry.next) {
33524 if (entry.key == key) return entry;
33525 }
33526 };
33527
33528 defineBuiltIns(Prototype, {
33529 // `{ Map, Set }.prototype.clear()` methods
33530 // https://tc39.es/ecma262/#sec-map.prototype.clear
33531 // https://tc39.es/ecma262/#sec-set.prototype.clear
33532 clear: function clear() {
33533 var that = this;
33534 var state = getInternalState(that);
33535 var data = state.index;
33536 var entry = state.first;
33537 while (entry) {
33538 entry.removed = true;
33539 if (entry.previous) entry.previous = entry.previous.next = undefined;
33540 delete data[entry.index];
33541 entry = entry.next;
33542 }
33543 state.first = state.last = undefined;
33544 if (DESCRIPTORS) state.size = 0;
33545 else that.size = 0;
33546 },
33547 // `{ Map, Set }.prototype.delete(key)` methods
33548 // https://tc39.es/ecma262/#sec-map.prototype.delete
33549 // https://tc39.es/ecma262/#sec-set.prototype.delete
33550 'delete': function (key) {
33551 var that = this;
33552 var state = getInternalState(that);
33553 var entry = getEntry(that, key);
33554 if (entry) {
33555 var next = entry.next;
33556 var prev = entry.previous;
33557 delete state.index[entry.index];
33558 entry.removed = true;
33559 if (prev) prev.next = next;
33560 if (next) next.previous = prev;
33561 if (state.first == entry) state.first = next;
33562 if (state.last == entry) state.last = prev;
33563 if (DESCRIPTORS) state.size--;
33564 else that.size--;
33565 } return !!entry;
33566 },
33567 // `{ Map, Set }.prototype.forEach(callbackfn, thisArg = undefined)` methods
33568 // https://tc39.es/ecma262/#sec-map.prototype.foreach
33569 // https://tc39.es/ecma262/#sec-set.prototype.foreach
33570 forEach: function forEach(callbackfn /* , that = undefined */) {
33571 var state = getInternalState(this);
33572 var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined);
33573 var entry;
33574 while (entry = entry ? entry.next : state.first) {
33575 boundFunction(entry.value, entry.key, this);
33576 // revert to the last existing entry
33577 while (entry && entry.removed) entry = entry.previous;
33578 }
33579 },
33580 // `{ Map, Set}.prototype.has(key)` methods
33581 // https://tc39.es/ecma262/#sec-map.prototype.has
33582 // https://tc39.es/ecma262/#sec-set.prototype.has
33583 has: function has(key) {
33584 return !!getEntry(this, key);
33585 }
33586 });
33587
33588 defineBuiltIns(Prototype, IS_MAP ? {
33589 // `Map.prototype.get(key)` method
33590 // https://tc39.es/ecma262/#sec-map.prototype.get
33591 get: function get(key) {
33592 var entry = getEntry(this, key);
33593 return entry && entry.value;
33594 },
33595 // `Map.prototype.set(key, value)` method
33596 // https://tc39.es/ecma262/#sec-map.prototype.set
33597 set: function set(key, value) {
33598 return define(this, key === 0 ? 0 : key, value);
33599 }
33600 } : {
33601 // `Set.prototype.add(value)` method
33602 // https://tc39.es/ecma262/#sec-set.prototype.add
33603 add: function add(value) {
33604 return define(this, value = value === 0 ? 0 : value, value);
33605 }
33606 });
33607 if (DESCRIPTORS) defineProperty(Prototype, 'size', {
33608 get: function () {
33609 return getInternalState(this).size;
33610 }
33611 });
33612 return Constructor;
33613 },
33614 setStrong: function (Constructor, CONSTRUCTOR_NAME, IS_MAP) {
33615 var ITERATOR_NAME = CONSTRUCTOR_NAME + ' Iterator';
33616 var getInternalCollectionState = internalStateGetterFor(CONSTRUCTOR_NAME);
33617 var getInternalIteratorState = internalStateGetterFor(ITERATOR_NAME);
33618 // `{ Map, Set }.prototype.{ keys, values, entries, @@iterator }()` methods
33619 // https://tc39.es/ecma262/#sec-map.prototype.entries
33620 // https://tc39.es/ecma262/#sec-map.prototype.keys
33621 // https://tc39.es/ecma262/#sec-map.prototype.values
33622 // https://tc39.es/ecma262/#sec-map.prototype-@@iterator
33623 // https://tc39.es/ecma262/#sec-set.prototype.entries
33624 // https://tc39.es/ecma262/#sec-set.prototype.keys
33625 // https://tc39.es/ecma262/#sec-set.prototype.values
33626 // https://tc39.es/ecma262/#sec-set.prototype-@@iterator
33627 defineIterator(Constructor, CONSTRUCTOR_NAME, function (iterated, kind) {
33628 setInternalState(this, {
33629 type: ITERATOR_NAME,
33630 target: iterated,
33631 state: getInternalCollectionState(iterated),
33632 kind: kind,
33633 last: undefined
33634 });
33635 }, function () {
33636 var state = getInternalIteratorState(this);
33637 var kind = state.kind;
33638 var entry = state.last;
33639 // revert to the last existing entry
33640 while (entry && entry.removed) entry = entry.previous;
33641 // get next entry
33642 if (!state.target || !(state.last = entry = entry ? entry.next : state.state.first)) {
33643 // or finish the iteration
33644 state.target = undefined;
33645 return { value: undefined, done: true };
33646 }
33647 // return step by kind
33648 if (kind == 'keys') return { value: entry.key, done: false };
33649 if (kind == 'values') return { value: entry.value, done: false };
33650 return { value: [entry.key, entry.value], done: false };
33651 }, IS_MAP ? 'entries' : 'values', !IS_MAP, true);
33652
33653 // `{ Map, Set }.prototype[@@species]` accessors
33654 // https://tc39.es/ecma262/#sec-get-map-@@species
33655 // https://tc39.es/ecma262/#sec-get-set-@@species
33656 setSpecies(CONSTRUCTOR_NAME);
33657 }
33658};
33659
33660
33661/***/ }),
33662/* 652 */
33663/***/ (function(module, exports, __webpack_require__) {
33664
33665var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*
33666 Copyright 2013 Daniel Wirtz <dcode@dcode.io>
33667
33668 Licensed under the Apache License, Version 2.0 (the "License");
33669 you may not use this file except in compliance with the License.
33670 You may obtain a copy of the License at
33671
33672 http://www.apache.org/licenses/LICENSE-2.0
33673
33674 Unless required by applicable law or agreed to in writing, software
33675 distributed under the License is distributed on an "AS IS" BASIS,
33676 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
33677 See the License for the specific language governing permissions and
33678 limitations under the License.
33679 */
33680
33681/**
33682 * @license protobuf.js (c) 2013 Daniel Wirtz <dcode@dcode.io>
33683 * Released under the Apache License, Version 2.0
33684 * see: https://github.com/dcodeIO/protobuf.js for details
33685 */
33686(function(global, factory) {
33687
33688 /* AMD */ if (true)
33689 !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(653)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
33690 __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
33691 (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
33692 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
33693 /* CommonJS */ else if (typeof require === "function" && typeof module === "object" && module && module["exports"])
33694 module["exports"] = factory(require("bytebuffer"), true);
33695 /* Global */ else
33696 (global["dcodeIO"] = global["dcodeIO"] || {})["ProtoBuf"] = factory(global["dcodeIO"]["ByteBuffer"]);
33697
33698})(this, function(ByteBuffer, isCommonJS) {
33699 "use strict";
33700
33701 /**
33702 * The ProtoBuf namespace.
33703 * @exports ProtoBuf
33704 * @namespace
33705 * @expose
33706 */
33707 var ProtoBuf = {};
33708
33709 /**
33710 * @type {!function(new: ByteBuffer, ...[*])}
33711 * @expose
33712 */
33713 ProtoBuf.ByteBuffer = ByteBuffer;
33714
33715 /**
33716 * @type {?function(new: Long, ...[*])}
33717 * @expose
33718 */
33719 ProtoBuf.Long = ByteBuffer.Long || null;
33720
33721 /**
33722 * ProtoBuf.js version.
33723 * @type {string}
33724 * @const
33725 * @expose
33726 */
33727 ProtoBuf.VERSION = "5.0.3";
33728
33729 /**
33730 * Wire types.
33731 * @type {Object.<string,number>}
33732 * @const
33733 * @expose
33734 */
33735 ProtoBuf.WIRE_TYPES = {};
33736
33737 /**
33738 * Varint wire type.
33739 * @type {number}
33740 * @expose
33741 */
33742 ProtoBuf.WIRE_TYPES.VARINT = 0;
33743
33744 /**
33745 * Fixed 64 bits wire type.
33746 * @type {number}
33747 * @const
33748 * @expose
33749 */
33750 ProtoBuf.WIRE_TYPES.BITS64 = 1;
33751
33752 /**
33753 * Length delimited wire type.
33754 * @type {number}
33755 * @const
33756 * @expose
33757 */
33758 ProtoBuf.WIRE_TYPES.LDELIM = 2;
33759
33760 /**
33761 * Start group wire type.
33762 * @type {number}
33763 * @const
33764 * @expose
33765 */
33766 ProtoBuf.WIRE_TYPES.STARTGROUP = 3;
33767
33768 /**
33769 * End group wire type.
33770 * @type {number}
33771 * @const
33772 * @expose
33773 */
33774 ProtoBuf.WIRE_TYPES.ENDGROUP = 4;
33775
33776 /**
33777 * Fixed 32 bits wire type.
33778 * @type {number}
33779 * @const
33780 * @expose
33781 */
33782 ProtoBuf.WIRE_TYPES.BITS32 = 5;
33783
33784 /**
33785 * Packable wire types.
33786 * @type {!Array.<number>}
33787 * @const
33788 * @expose
33789 */
33790 ProtoBuf.PACKABLE_WIRE_TYPES = [
33791 ProtoBuf.WIRE_TYPES.VARINT,
33792 ProtoBuf.WIRE_TYPES.BITS64,
33793 ProtoBuf.WIRE_TYPES.BITS32
33794 ];
33795
33796 /**
33797 * Types.
33798 * @dict
33799 * @type {!Object.<string,{name: string, wireType: number, defaultValue: *}>}
33800 * @const
33801 * @expose
33802 */
33803 ProtoBuf.TYPES = {
33804 // According to the protobuf spec.
33805 "int32": {
33806 name: "int32",
33807 wireType: ProtoBuf.WIRE_TYPES.VARINT,
33808 defaultValue: 0
33809 },
33810 "uint32": {
33811 name: "uint32",
33812 wireType: ProtoBuf.WIRE_TYPES.VARINT,
33813 defaultValue: 0
33814 },
33815 "sint32": {
33816 name: "sint32",
33817 wireType: ProtoBuf.WIRE_TYPES.VARINT,
33818 defaultValue: 0
33819 },
33820 "int64": {
33821 name: "int64",
33822 wireType: ProtoBuf.WIRE_TYPES.VARINT,
33823 defaultValue: ProtoBuf.Long ? ProtoBuf.Long.ZERO : undefined
33824 },
33825 "uint64": {
33826 name: "uint64",
33827 wireType: ProtoBuf.WIRE_TYPES.VARINT,
33828 defaultValue: ProtoBuf.Long ? ProtoBuf.Long.UZERO : undefined
33829 },
33830 "sint64": {
33831 name: "sint64",
33832 wireType: ProtoBuf.WIRE_TYPES.VARINT,
33833 defaultValue: ProtoBuf.Long ? ProtoBuf.Long.ZERO : undefined
33834 },
33835 "bool": {
33836 name: "bool",
33837 wireType: ProtoBuf.WIRE_TYPES.VARINT,
33838 defaultValue: false
33839 },
33840 "double": {
33841 name: "double",
33842 wireType: ProtoBuf.WIRE_TYPES.BITS64,
33843 defaultValue: 0
33844 },
33845 "string": {
33846 name: "string",
33847 wireType: ProtoBuf.WIRE_TYPES.LDELIM,
33848 defaultValue: ""
33849 },
33850 "bytes": {
33851 name: "bytes",
33852 wireType: ProtoBuf.WIRE_TYPES.LDELIM,
33853 defaultValue: null // overridden in the code, must be a unique instance
33854 },
33855 "fixed32": {
33856 name: "fixed32",
33857 wireType: ProtoBuf.WIRE_TYPES.BITS32,
33858 defaultValue: 0
33859 },
33860 "sfixed32": {
33861 name: "sfixed32",
33862 wireType: ProtoBuf.WIRE_TYPES.BITS32,
33863 defaultValue: 0
33864 },
33865 "fixed64": {
33866 name: "fixed64",
33867 wireType: ProtoBuf.WIRE_TYPES.BITS64,
33868 defaultValue: ProtoBuf.Long ? ProtoBuf.Long.UZERO : undefined
33869 },
33870 "sfixed64": {
33871 name: "sfixed64",
33872 wireType: ProtoBuf.WIRE_TYPES.BITS64,
33873 defaultValue: ProtoBuf.Long ? ProtoBuf.Long.ZERO : undefined
33874 },
33875 "float": {
33876 name: "float",
33877 wireType: ProtoBuf.WIRE_TYPES.BITS32,
33878 defaultValue: 0
33879 },
33880 "enum": {
33881 name: "enum",
33882 wireType: ProtoBuf.WIRE_TYPES.VARINT,
33883 defaultValue: 0
33884 },
33885 "message": {
33886 name: "message",
33887 wireType: ProtoBuf.WIRE_TYPES.LDELIM,
33888 defaultValue: null
33889 },
33890 "group": {
33891 name: "group",
33892 wireType: ProtoBuf.WIRE_TYPES.STARTGROUP,
33893 defaultValue: null
33894 }
33895 };
33896
33897 /**
33898 * Valid map key types.
33899 * @type {!Array.<!Object.<string,{name: string, wireType: number, defaultValue: *}>>}
33900 * @const
33901 * @expose
33902 */
33903 ProtoBuf.MAP_KEY_TYPES = [
33904 ProtoBuf.TYPES["int32"],
33905 ProtoBuf.TYPES["sint32"],
33906 ProtoBuf.TYPES["sfixed32"],
33907 ProtoBuf.TYPES["uint32"],
33908 ProtoBuf.TYPES["fixed32"],
33909 ProtoBuf.TYPES["int64"],
33910 ProtoBuf.TYPES["sint64"],
33911 ProtoBuf.TYPES["sfixed64"],
33912 ProtoBuf.TYPES["uint64"],
33913 ProtoBuf.TYPES["fixed64"],
33914 ProtoBuf.TYPES["bool"],
33915 ProtoBuf.TYPES["string"],
33916 ProtoBuf.TYPES["bytes"]
33917 ];
33918
33919 /**
33920 * Minimum field id.
33921 * @type {number}
33922 * @const
33923 * @expose
33924 */
33925 ProtoBuf.ID_MIN = 1;
33926
33927 /**
33928 * Maximum field id.
33929 * @type {number}
33930 * @const
33931 * @expose
33932 */
33933 ProtoBuf.ID_MAX = 0x1FFFFFFF;
33934
33935 /**
33936 * If set to `true`, field names will be converted from underscore notation to camel case. Defaults to `false`.
33937 * Must be set prior to parsing.
33938 * @type {boolean}
33939 * @expose
33940 */
33941 ProtoBuf.convertFieldsToCamelCase = false;
33942
33943 /**
33944 * By default, messages are populated with (setX, set_x) accessors for each field. This can be disabled by
33945 * setting this to `false` prior to building messages.
33946 * @type {boolean}
33947 * @expose
33948 */
33949 ProtoBuf.populateAccessors = true;
33950
33951 /**
33952 * By default, messages are populated with default values if a field is not present on the wire. To disable
33953 * this behavior, set this setting to `false`.
33954 * @type {boolean}
33955 * @expose
33956 */
33957 ProtoBuf.populateDefaults = true;
33958
33959 /**
33960 * @alias ProtoBuf.Util
33961 * @expose
33962 */
33963 ProtoBuf.Util = (function() {
33964 "use strict";
33965
33966 /**
33967 * ProtoBuf utilities.
33968 * @exports ProtoBuf.Util
33969 * @namespace
33970 */
33971 var Util = {};
33972
33973 /**
33974 * Flag if running in node or not.
33975 * @type {boolean}
33976 * @const
33977 * @expose
33978 */
33979 Util.IS_NODE = !!(
33980 typeof process === 'object' && process+'' === '[object process]' && !process['browser']
33981 );
33982
33983 /**
33984 * Constructs a XMLHttpRequest object.
33985 * @return {XMLHttpRequest}
33986 * @throws {Error} If XMLHttpRequest is not supported
33987 * @expose
33988 */
33989 Util.XHR = function() {
33990 // No dependencies please, ref: http://www.quirksmode.org/js/xmlhttp.html
33991 var XMLHttpFactories = [
33992 function () {return new XMLHttpRequest()},
33993 function () {return new ActiveXObject("Msxml2.XMLHTTP")},
33994 function () {return new ActiveXObject("Msxml3.XMLHTTP")},
33995 function () {return new ActiveXObject("Microsoft.XMLHTTP")}
33996 ];
33997 /** @type {?XMLHttpRequest} */
33998 var xhr = null;
33999 for (var i=0;i<XMLHttpFactories.length;i++) {
34000 try { xhr = XMLHttpFactories[i](); }
34001 catch (e) { continue; }
34002 break;
34003 }
34004 if (!xhr)
34005 throw Error("XMLHttpRequest is not supported");
34006 return xhr;
34007 };
34008
34009 /**
34010 * Fetches a resource.
34011 * @param {string} path Resource path
34012 * @param {function(?string)=} callback Callback receiving the resource's contents. If omitted the resource will
34013 * be fetched synchronously. If the request failed, contents will be null.
34014 * @return {?string|undefined} Resource contents if callback is omitted (null if the request failed), else undefined.
34015 * @expose
34016 */
34017 Util.fetch = function(path, callback) {
34018 if (callback && typeof callback != 'function')
34019 callback = null;
34020 if (Util.IS_NODE) {
34021 var fs = __webpack_require__(655);
34022 if (callback) {
34023 fs.readFile(path, function(err, data) {
34024 if (err)
34025 callback(null);
34026 else
34027 callback(""+data);
34028 });
34029 } else
34030 try {
34031 return fs.readFileSync(path);
34032 } catch (e) {
34033 return null;
34034 }
34035 } else {
34036 var xhr = Util.XHR();
34037 xhr.open('GET', path, callback ? true : false);
34038 // xhr.setRequestHeader('User-Agent', 'XMLHTTP/1.0');
34039 xhr.setRequestHeader('Accept', 'text/plain');
34040 if (typeof xhr.overrideMimeType === 'function') xhr.overrideMimeType('text/plain');
34041 if (callback) {
34042 xhr.onreadystatechange = function() {
34043 if (xhr.readyState != 4) return;
34044 if (/* remote */ xhr.status == 200 || /* local */ (xhr.status == 0 && typeof xhr.responseText === 'string'))
34045 callback(xhr.responseText);
34046 else
34047 callback(null);
34048 };
34049 if (xhr.readyState == 4)
34050 return;
34051 xhr.send(null);
34052 } else {
34053 xhr.send(null);
34054 if (/* remote */ xhr.status == 200 || /* local */ (xhr.status == 0 && typeof xhr.responseText === 'string'))
34055 return xhr.responseText;
34056 return null;
34057 }
34058 }
34059 };
34060
34061 /**
34062 * Converts a string to camel case.
34063 * @param {string} str
34064 * @returns {string}
34065 * @expose
34066 */
34067 Util.toCamelCase = function(str) {
34068 return str.replace(/_([a-zA-Z])/g, function ($0, $1) {
34069 return $1.toUpperCase();
34070 });
34071 };
34072
34073 return Util;
34074 })();
34075
34076 /**
34077 * Language expressions.
34078 * @type {!Object.<string,!RegExp>}
34079 * @expose
34080 */
34081 ProtoBuf.Lang = {
34082
34083 // Characters always ending a statement
34084 DELIM: /[\s\{\}=;:\[\],'"\(\)<>]/g,
34085
34086 // Field rules
34087 RULE: /^(?:required|optional|repeated|map)$/,
34088
34089 // Field types
34090 TYPE: /^(?:double|float|int32|uint32|sint32|int64|uint64|sint64|fixed32|sfixed32|fixed64|sfixed64|bool|string|bytes)$/,
34091
34092 // Names
34093 NAME: /^[a-zA-Z_][a-zA-Z_0-9]*$/,
34094
34095 // Type definitions
34096 TYPEDEF: /^[a-zA-Z][a-zA-Z_0-9]*$/,
34097
34098 // Type references
34099 TYPEREF: /^(?:\.?[a-zA-Z_][a-zA-Z_0-9]*)(?:\.[a-zA-Z_][a-zA-Z_0-9]*)*$/,
34100
34101 // Fully qualified type references
34102 FQTYPEREF: /^(?:\.[a-zA-Z_][a-zA-Z_0-9]*)+$/,
34103
34104 // All numbers
34105 NUMBER: /^-?(?:[1-9][0-9]*|0|0[xX][0-9a-fA-F]+|0[0-7]+|([0-9]*(\.[0-9]*)?([Ee][+-]?[0-9]+)?)|inf|nan)$/,
34106
34107 // Decimal numbers
34108 NUMBER_DEC: /^(?:[1-9][0-9]*|0)$/,
34109
34110 // Hexadecimal numbers
34111 NUMBER_HEX: /^0[xX][0-9a-fA-F]+$/,
34112
34113 // Octal numbers
34114 NUMBER_OCT: /^0[0-7]+$/,
34115
34116 // Floating point numbers
34117 NUMBER_FLT: /^([0-9]*(\.[0-9]*)?([Ee][+-]?[0-9]+)?|inf|nan)$/,
34118
34119 // Booleans
34120 BOOL: /^(?:true|false)$/i,
34121
34122 // Id numbers
34123 ID: /^(?:[1-9][0-9]*|0|0[xX][0-9a-fA-F]+|0[0-7]+)$/,
34124
34125 // Negative id numbers (enum values)
34126 NEGID: /^\-?(?:[1-9][0-9]*|0|0[xX][0-9a-fA-F]+|0[0-7]+)$/,
34127
34128 // Whitespaces
34129 WHITESPACE: /\s/,
34130
34131 // All strings
34132 STRING: /(?:"([^"\\]*(?:\\.[^"\\]*)*)")|(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g,
34133
34134 // Double quoted strings
34135 STRING_DQ: /(?:"([^"\\]*(?:\\.[^"\\]*)*)")/g,
34136
34137 // Single quoted strings
34138 STRING_SQ: /(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g
34139 };
34140
34141
34142 /**
34143 * @alias ProtoBuf.Reflect
34144 * @expose
34145 */
34146 ProtoBuf.Reflect = (function(ProtoBuf) {
34147 "use strict";
34148
34149 /**
34150 * Reflection types.
34151 * @exports ProtoBuf.Reflect
34152 * @namespace
34153 */
34154 var Reflect = {};
34155
34156 /**
34157 * Constructs a Reflect base class.
34158 * @exports ProtoBuf.Reflect.T
34159 * @constructor
34160 * @abstract
34161 * @param {!ProtoBuf.Builder} builder Builder reference
34162 * @param {?ProtoBuf.Reflect.T} parent Parent object
34163 * @param {string} name Object name
34164 */
34165 var T = function(builder, parent, name) {
34166
34167 /**
34168 * Builder reference.
34169 * @type {!ProtoBuf.Builder}
34170 * @expose
34171 */
34172 this.builder = builder;
34173
34174 /**
34175 * Parent object.
34176 * @type {?ProtoBuf.Reflect.T}
34177 * @expose
34178 */
34179 this.parent = parent;
34180
34181 /**
34182 * Object name in namespace.
34183 * @type {string}
34184 * @expose
34185 */
34186 this.name = name;
34187
34188 /**
34189 * Fully qualified class name
34190 * @type {string}
34191 * @expose
34192 */
34193 this.className;
34194 };
34195
34196 /**
34197 * @alias ProtoBuf.Reflect.T.prototype
34198 * @inner
34199 */
34200 var TPrototype = T.prototype;
34201
34202 /**
34203 * Returns the fully qualified name of this object.
34204 * @returns {string} Fully qualified name as of ".PATH.TO.THIS"
34205 * @expose
34206 */
34207 TPrototype.fqn = function() {
34208 var name = this.name,
34209 ptr = this;
34210 do {
34211 ptr = ptr.parent;
34212 if (ptr == null)
34213 break;
34214 name = ptr.name+"."+name;
34215 } while (true);
34216 return name;
34217 };
34218
34219 /**
34220 * Returns a string representation of this Reflect object (its fully qualified name).
34221 * @param {boolean=} includeClass Set to true to include the class name. Defaults to false.
34222 * @return String representation
34223 * @expose
34224 */
34225 TPrototype.toString = function(includeClass) {
34226 return (includeClass ? this.className + " " : "") + this.fqn();
34227 };
34228
34229 /**
34230 * Builds this type.
34231 * @throws {Error} If this type cannot be built directly
34232 * @expose
34233 */
34234 TPrototype.build = function() {
34235 throw Error(this.toString(true)+" cannot be built directly");
34236 };
34237
34238 /**
34239 * @alias ProtoBuf.Reflect.T
34240 * @expose
34241 */
34242 Reflect.T = T;
34243
34244 /**
34245 * Constructs a new Namespace.
34246 * @exports ProtoBuf.Reflect.Namespace
34247 * @param {!ProtoBuf.Builder} builder Builder reference
34248 * @param {?ProtoBuf.Reflect.Namespace} parent Namespace parent
34249 * @param {string} name Namespace name
34250 * @param {Object.<string,*>=} options Namespace options
34251 * @param {string?} syntax The syntax level of this definition (e.g., proto3)
34252 * @constructor
34253 * @extends ProtoBuf.Reflect.T
34254 */
34255 var Namespace = function(builder, parent, name, options, syntax) {
34256 T.call(this, builder, parent, name);
34257
34258 /**
34259 * @override
34260 */
34261 this.className = "Namespace";
34262
34263 /**
34264 * Children inside the namespace.
34265 * @type {!Array.<ProtoBuf.Reflect.T>}
34266 */
34267 this.children = [];
34268
34269 /**
34270 * Options.
34271 * @type {!Object.<string, *>}
34272 */
34273 this.options = options || {};
34274
34275 /**
34276 * Syntax level (e.g., proto2 or proto3).
34277 * @type {!string}
34278 */
34279 this.syntax = syntax || "proto2";
34280 };
34281
34282 /**
34283 * @alias ProtoBuf.Reflect.Namespace.prototype
34284 * @inner
34285 */
34286 var NamespacePrototype = Namespace.prototype = Object.create(T.prototype);
34287
34288 /**
34289 * Returns an array of the namespace's children.
34290 * @param {ProtoBuf.Reflect.T=} type Filter type (returns instances of this type only). Defaults to null (all children).
34291 * @return {Array.<ProtoBuf.Reflect.T>}
34292 * @expose
34293 */
34294 NamespacePrototype.getChildren = function(type) {
34295 type = type || null;
34296 if (type == null)
34297 return this.children.slice();
34298 var children = [];
34299 for (var i=0, k=this.children.length; i<k; ++i)
34300 if (this.children[i] instanceof type)
34301 children.push(this.children[i]);
34302 return children;
34303 };
34304
34305 /**
34306 * Adds a child to the namespace.
34307 * @param {ProtoBuf.Reflect.T} child Child
34308 * @throws {Error} If the child cannot be added (duplicate)
34309 * @expose
34310 */
34311 NamespacePrototype.addChild = function(child) {
34312 var other;
34313 if (other = this.getChild(child.name)) {
34314 // Try to revert camelcase transformation on collision
34315 if (other instanceof Message.Field && other.name !== other.originalName && this.getChild(other.originalName) === null)
34316 other.name = other.originalName; // Revert previous first (effectively keeps both originals)
34317 else if (child instanceof Message.Field && child.name !== child.originalName && this.getChild(child.originalName) === null)
34318 child.name = child.originalName;
34319 else
34320 throw Error("Duplicate name in namespace "+this.toString(true)+": "+child.name);
34321 }
34322 this.children.push(child);
34323 };
34324
34325 /**
34326 * Gets a child by its name or id.
34327 * @param {string|number} nameOrId Child name or id
34328 * @return {?ProtoBuf.Reflect.T} The child or null if not found
34329 * @expose
34330 */
34331 NamespacePrototype.getChild = function(nameOrId) {
34332 var key = typeof nameOrId === 'number' ? 'id' : 'name';
34333 for (var i=0, k=this.children.length; i<k; ++i)
34334 if (this.children[i][key] === nameOrId)
34335 return this.children[i];
34336 return null;
34337 };
34338
34339 /**
34340 * Resolves a reflect object inside of this namespace.
34341 * @param {string|!Array.<string>} qn Qualified name to resolve
34342 * @param {boolean=} excludeNonNamespace Excludes non-namespace types, defaults to `false`
34343 * @return {?ProtoBuf.Reflect.Namespace} The resolved type or null if not found
34344 * @expose
34345 */
34346 NamespacePrototype.resolve = function(qn, excludeNonNamespace) {
34347 var part = typeof qn === 'string' ? qn.split(".") : qn,
34348 ptr = this,
34349 i = 0;
34350 if (part[i] === "") { // Fully qualified name, e.g. ".My.Message'
34351 while (ptr.parent !== null)
34352 ptr = ptr.parent;
34353 i++;
34354 }
34355 var child;
34356 do {
34357 do {
34358 if (!(ptr instanceof Reflect.Namespace)) {
34359 ptr = null;
34360 break;
34361 }
34362 child = ptr.getChild(part[i]);
34363 if (!child || !(child instanceof Reflect.T) || (excludeNonNamespace && !(child instanceof Reflect.Namespace))) {
34364 ptr = null;
34365 break;
34366 }
34367 ptr = child; i++;
34368 } while (i < part.length);
34369 if (ptr != null)
34370 break; // Found
34371 // Else search the parent
34372 if (this.parent !== null)
34373 return this.parent.resolve(qn, excludeNonNamespace);
34374 } while (ptr != null);
34375 return ptr;
34376 };
34377
34378 /**
34379 * Determines the shortest qualified name of the specified type, if any, relative to this namespace.
34380 * @param {!ProtoBuf.Reflect.T} t Reflection type
34381 * @returns {string} The shortest qualified name or, if there is none, the fqn
34382 * @expose
34383 */
34384 NamespacePrototype.qn = function(t) {
34385 var part = [], ptr = t;
34386 do {
34387 part.unshift(ptr.name);
34388 ptr = ptr.parent;
34389 } while (ptr !== null);
34390 for (var len=1; len <= part.length; len++) {
34391 var qn = part.slice(part.length-len);
34392 if (t === this.resolve(qn, t instanceof Reflect.Namespace))
34393 return qn.join(".");
34394 }
34395 return t.fqn();
34396 };
34397
34398 /**
34399 * Builds the namespace and returns the runtime counterpart.
34400 * @return {Object.<string,Function|Object>} Runtime namespace
34401 * @expose
34402 */
34403 NamespacePrototype.build = function() {
34404 /** @dict */
34405 var ns = {};
34406 var children = this.children;
34407 for (var i=0, k=children.length, child; i<k; ++i) {
34408 child = children[i];
34409 if (child instanceof Namespace)
34410 ns[child.name] = child.build();
34411 }
34412 if (Object.defineProperty)
34413 Object.defineProperty(ns, "$options", { "value": this.buildOpt() });
34414 return ns;
34415 };
34416
34417 /**
34418 * Builds the namespace's '$options' property.
34419 * @return {Object.<string,*>}
34420 */
34421 NamespacePrototype.buildOpt = function() {
34422 var opt = {},
34423 keys = Object.keys(this.options);
34424 for (var i=0, k=keys.length; i<k; ++i) {
34425 var key = keys[i],
34426 val = this.options[keys[i]];
34427 // TODO: Options are not resolved, yet.
34428 // if (val instanceof Namespace) {
34429 // opt[key] = val.build();
34430 // } else {
34431 opt[key] = val;
34432 // }
34433 }
34434 return opt;
34435 };
34436
34437 /**
34438 * Gets the value assigned to the option with the specified name.
34439 * @param {string=} name Returns the option value if specified, otherwise all options are returned.
34440 * @return {*|Object.<string,*>}null} Option value or NULL if there is no such option
34441 */
34442 NamespacePrototype.getOption = function(name) {
34443 if (typeof name === 'undefined')
34444 return this.options;
34445 return typeof this.options[name] !== 'undefined' ? this.options[name] : null;
34446 };
34447
34448 /**
34449 * @alias ProtoBuf.Reflect.Namespace
34450 * @expose
34451 */
34452 Reflect.Namespace = Namespace;
34453
34454 /**
34455 * Constructs a new Element implementation that checks and converts values for a
34456 * particular field type, as appropriate.
34457 *
34458 * An Element represents a single value: either the value of a singular field,
34459 * or a value contained in one entry of a repeated field or map field. This
34460 * class does not implement these higher-level concepts; it only encapsulates
34461 * the low-level typechecking and conversion.
34462 *
34463 * @exports ProtoBuf.Reflect.Element
34464 * @param {{name: string, wireType: number}} type Resolved data type
34465 * @param {ProtoBuf.Reflect.T|null} resolvedType Resolved type, if relevant
34466 * (e.g. submessage field).
34467 * @param {boolean} isMapKey Is this element a Map key? The value will be
34468 * converted to string form if so.
34469 * @param {string} syntax Syntax level of defining message type, e.g.,
34470 * proto2 or proto3.
34471 * @param {string} name Name of the field containing this element (for error
34472 * messages)
34473 * @constructor
34474 */
34475 var Element = function(type, resolvedType, isMapKey, syntax, name) {
34476
34477 /**
34478 * Element type, as a string (e.g., int32).
34479 * @type {{name: string, wireType: number}}
34480 */
34481 this.type = type;
34482
34483 /**
34484 * Element type reference to submessage or enum definition, if needed.
34485 * @type {ProtoBuf.Reflect.T|null}
34486 */
34487 this.resolvedType = resolvedType;
34488
34489 /**
34490 * Element is a map key.
34491 * @type {boolean}
34492 */
34493 this.isMapKey = isMapKey;
34494
34495 /**
34496 * Syntax level of defining message type, e.g., proto2 or proto3.
34497 * @type {string}
34498 */
34499 this.syntax = syntax;
34500
34501 /**
34502 * Name of the field containing this element (for error messages)
34503 * @type {string}
34504 */
34505 this.name = name;
34506
34507 if (isMapKey && ProtoBuf.MAP_KEY_TYPES.indexOf(type) < 0)
34508 throw Error("Invalid map key type: " + type.name);
34509 };
34510
34511 var ElementPrototype = Element.prototype;
34512
34513 /**
34514 * Obtains a (new) default value for the specified type.
34515 * @param type {string|{name: string, wireType: number}} Field type
34516 * @returns {*} Default value
34517 * @inner
34518 */
34519 function mkDefault(type) {
34520 if (typeof type === 'string')
34521 type = ProtoBuf.TYPES[type];
34522 if (typeof type.defaultValue === 'undefined')
34523 throw Error("default value for type "+type.name+" is not supported");
34524 if (type == ProtoBuf.TYPES["bytes"])
34525 return new ByteBuffer(0);
34526 return type.defaultValue;
34527 }
34528
34529 /**
34530 * Returns the default value for this field in proto3.
34531 * @function
34532 * @param type {string|{name: string, wireType: number}} the field type
34533 * @returns {*} Default value
34534 */
34535 Element.defaultFieldValue = mkDefault;
34536
34537 /**
34538 * Makes a Long from a value.
34539 * @param {{low: number, high: number, unsigned: boolean}|string|number} value Value
34540 * @param {boolean=} unsigned Whether unsigned or not, defaults to reuse it from Long-like objects or to signed for
34541 * strings and numbers
34542 * @returns {!Long}
34543 * @throws {Error} If the value cannot be converted to a Long
34544 * @inner
34545 */
34546 function mkLong(value, unsigned) {
34547 if (value && typeof value.low === 'number' && typeof value.high === 'number' && typeof value.unsigned === 'boolean'
34548 && value.low === value.low && value.high === value.high)
34549 return new ProtoBuf.Long(value.low, value.high, typeof unsigned === 'undefined' ? value.unsigned : unsigned);
34550 if (typeof value === 'string')
34551 return ProtoBuf.Long.fromString(value, unsigned || false, 10);
34552 if (typeof value === 'number')
34553 return ProtoBuf.Long.fromNumber(value, unsigned || false);
34554 throw Error("not convertible to Long");
34555 }
34556
34557 ElementPrototype.toString = function() {
34558 return (this.name || '') + (this.isMapKey ? 'map' : 'value') + ' element';
34559 }
34560
34561 /**
34562 * Checks if the given value can be set for an element of this type (singular
34563 * field or one element of a repeated field or map).
34564 * @param {*} value Value to check
34565 * @return {*} Verified, maybe adjusted, value
34566 * @throws {Error} If the value cannot be verified for this element slot
34567 * @expose
34568 */
34569 ElementPrototype.verifyValue = function(value) {
34570 var self = this;
34571 function fail(val, msg) {
34572 throw Error("Illegal value for "+self.toString(true)+" of type "+self.type.name+": "+val+" ("+msg+")");
34573 }
34574 switch (this.type) {
34575 // Signed 32bit
34576 case ProtoBuf.TYPES["int32"]:
34577 case ProtoBuf.TYPES["sint32"]:
34578 case ProtoBuf.TYPES["sfixed32"]:
34579 // Account for !NaN: value === value
34580 if (typeof value !== 'number' || (value === value && value % 1 !== 0))
34581 fail(typeof value, "not an integer");
34582 return value > 4294967295 ? value | 0 : value;
34583
34584 // Unsigned 32bit
34585 case ProtoBuf.TYPES["uint32"]:
34586 case ProtoBuf.TYPES["fixed32"]:
34587 if (typeof value !== 'number' || (value === value && value % 1 !== 0))
34588 fail(typeof value, "not an integer");
34589 return value < 0 ? value >>> 0 : value;
34590
34591 // Signed 64bit
34592 case ProtoBuf.TYPES["int64"]:
34593 case ProtoBuf.TYPES["sint64"]:
34594 case ProtoBuf.TYPES["sfixed64"]: {
34595 if (ProtoBuf.Long)
34596 try {
34597 return mkLong(value, false);
34598 } catch (e) {
34599 fail(typeof value, e.message);
34600 }
34601 else
34602 fail(typeof value, "requires Long.js");
34603 }
34604
34605 // Unsigned 64bit
34606 case ProtoBuf.TYPES["uint64"]:
34607 case ProtoBuf.TYPES["fixed64"]: {
34608 if (ProtoBuf.Long)
34609 try {
34610 return mkLong(value, true);
34611 } catch (e) {
34612 fail(typeof value, e.message);
34613 }
34614 else
34615 fail(typeof value, "requires Long.js");
34616 }
34617
34618 // Bool
34619 case ProtoBuf.TYPES["bool"]:
34620 if (typeof value !== 'boolean')
34621 fail(typeof value, "not a boolean");
34622 return value;
34623
34624 // Float
34625 case ProtoBuf.TYPES["float"]:
34626 case ProtoBuf.TYPES["double"]:
34627 if (typeof value !== 'number')
34628 fail(typeof value, "not a number");
34629 return value;
34630
34631 // Length-delimited string
34632 case ProtoBuf.TYPES["string"]:
34633 if (typeof value !== 'string' && !(value && value instanceof String))
34634 fail(typeof value, "not a string");
34635 return ""+value; // Convert String object to string
34636
34637 // Length-delimited bytes
34638 case ProtoBuf.TYPES["bytes"]:
34639 if (ByteBuffer.isByteBuffer(value))
34640 return value;
34641 return ByteBuffer.wrap(value, "base64");
34642
34643 // Constant enum value
34644 case ProtoBuf.TYPES["enum"]: {
34645 var values = this.resolvedType.getChildren(ProtoBuf.Reflect.Enum.Value);
34646 for (i=0; i<values.length; i++)
34647 if (values[i].name == value)
34648 return values[i].id;
34649 else if (values[i].id == value)
34650 return values[i].id;
34651
34652 if (this.syntax === 'proto3') {
34653 // proto3: just make sure it's an integer.
34654 if (typeof value !== 'number' || (value === value && value % 1 !== 0))
34655 fail(typeof value, "not an integer");
34656 if (value > 4294967295 || value < 0)
34657 fail(typeof value, "not in range for uint32")
34658 return value;
34659 } else {
34660 // proto2 requires enum values to be valid.
34661 fail(value, "not a valid enum value");
34662 }
34663 }
34664 // Embedded message
34665 case ProtoBuf.TYPES["group"]:
34666 case ProtoBuf.TYPES["message"]: {
34667 if (!value || typeof value !== 'object')
34668 fail(typeof value, "object expected");
34669 if (value instanceof this.resolvedType.clazz)
34670 return value;
34671 if (value instanceof ProtoBuf.Builder.Message) {
34672 // Mismatched type: Convert to object (see: https://github.com/dcodeIO/ProtoBuf.js/issues/180)
34673 var obj = {};
34674 for (var i in value)
34675 if (value.hasOwnProperty(i))
34676 obj[i] = value[i];
34677 value = obj;
34678 }
34679 // Else let's try to construct one from a key-value object
34680 return new (this.resolvedType.clazz)(value); // May throw for a hundred of reasons
34681 }
34682 }
34683
34684 // We should never end here
34685 throw Error("[INTERNAL] Illegal value for "+this.toString(true)+": "+value+" (undefined type "+this.type+")");
34686 };
34687
34688 /**
34689 * Calculates the byte length of an element on the wire.
34690 * @param {number} id Field number
34691 * @param {*} value Field value
34692 * @returns {number} Byte length
34693 * @throws {Error} If the value cannot be calculated
34694 * @expose
34695 */
34696 ElementPrototype.calculateLength = function(id, value) {
34697 if (value === null) return 0; // Nothing to encode
34698 // Tag has already been written
34699 var n;
34700 switch (this.type) {
34701 case ProtoBuf.TYPES["int32"]:
34702 return value < 0 ? ByteBuffer.calculateVarint64(value) : ByteBuffer.calculateVarint32(value);
34703 case ProtoBuf.TYPES["uint32"]:
34704 return ByteBuffer.calculateVarint32(value);
34705 case ProtoBuf.TYPES["sint32"]:
34706 return ByteBuffer.calculateVarint32(ByteBuffer.zigZagEncode32(value));
34707 case ProtoBuf.TYPES["fixed32"]:
34708 case ProtoBuf.TYPES["sfixed32"]:
34709 case ProtoBuf.TYPES["float"]:
34710 return 4;
34711 case ProtoBuf.TYPES["int64"]:
34712 case ProtoBuf.TYPES["uint64"]:
34713 return ByteBuffer.calculateVarint64(value);
34714 case ProtoBuf.TYPES["sint64"]:
34715 return ByteBuffer.calculateVarint64(ByteBuffer.zigZagEncode64(value));
34716 case ProtoBuf.TYPES["fixed64"]:
34717 case ProtoBuf.TYPES["sfixed64"]:
34718 return 8;
34719 case ProtoBuf.TYPES["bool"]:
34720 return 1;
34721 case ProtoBuf.TYPES["enum"]:
34722 return ByteBuffer.calculateVarint32(value);
34723 case ProtoBuf.TYPES["double"]:
34724 return 8;
34725 case ProtoBuf.TYPES["string"]:
34726 n = ByteBuffer.calculateUTF8Bytes(value);
34727 return ByteBuffer.calculateVarint32(n) + n;
34728 case ProtoBuf.TYPES["bytes"]:
34729 if (value.remaining() < 0)
34730 throw Error("Illegal value for "+this.toString(true)+": "+value.remaining()+" bytes remaining");
34731 return ByteBuffer.calculateVarint32(value.remaining()) + value.remaining();
34732 case ProtoBuf.TYPES["message"]:
34733 n = this.resolvedType.calculate(value);
34734 return ByteBuffer.calculateVarint32(n) + n;
34735 case ProtoBuf.TYPES["group"]:
34736 n = this.resolvedType.calculate(value);
34737 return n + ByteBuffer.calculateVarint32((id << 3) | ProtoBuf.WIRE_TYPES.ENDGROUP);
34738 }
34739 // We should never end here
34740 throw Error("[INTERNAL] Illegal value to encode in "+this.toString(true)+": "+value+" (unknown type)");
34741 };
34742
34743 /**
34744 * Encodes a value to the specified buffer. Does not encode the key.
34745 * @param {number} id Field number
34746 * @param {*} value Field value
34747 * @param {ByteBuffer} buffer ByteBuffer to encode to
34748 * @return {ByteBuffer} The ByteBuffer for chaining
34749 * @throws {Error} If the value cannot be encoded
34750 * @expose
34751 */
34752 ElementPrototype.encodeValue = function(id, value, buffer) {
34753 if (value === null) return buffer; // Nothing to encode
34754 // Tag has already been written
34755
34756 switch (this.type) {
34757 // 32bit signed varint
34758 case ProtoBuf.TYPES["int32"]:
34759 // "If you use int32 or int64 as the type for a negative number, the resulting varint is always ten bytes
34760 // long – it is, effectively, treated like a very large unsigned integer." (see #122)
34761 if (value < 0)
34762 buffer.writeVarint64(value);
34763 else
34764 buffer.writeVarint32(value);
34765 break;
34766
34767 // 32bit unsigned varint
34768 case ProtoBuf.TYPES["uint32"]:
34769 buffer.writeVarint32(value);
34770 break;
34771
34772 // 32bit varint zig-zag
34773 case ProtoBuf.TYPES["sint32"]:
34774 buffer.writeVarint32ZigZag(value);
34775 break;
34776
34777 // Fixed unsigned 32bit
34778 case ProtoBuf.TYPES["fixed32"]:
34779 buffer.writeUint32(value);
34780 break;
34781
34782 // Fixed signed 32bit
34783 case ProtoBuf.TYPES["sfixed32"]:
34784 buffer.writeInt32(value);
34785 break;
34786
34787 // 64bit varint as-is
34788 case ProtoBuf.TYPES["int64"]:
34789 case ProtoBuf.TYPES["uint64"]:
34790 buffer.writeVarint64(value); // throws
34791 break;
34792
34793 // 64bit varint zig-zag
34794 case ProtoBuf.TYPES["sint64"]:
34795 buffer.writeVarint64ZigZag(value); // throws
34796 break;
34797
34798 // Fixed unsigned 64bit
34799 case ProtoBuf.TYPES["fixed64"]:
34800 buffer.writeUint64(value); // throws
34801 break;
34802
34803 // Fixed signed 64bit
34804 case ProtoBuf.TYPES["sfixed64"]:
34805 buffer.writeInt64(value); // throws
34806 break;
34807
34808 // Bool
34809 case ProtoBuf.TYPES["bool"]:
34810 if (typeof value === 'string')
34811 buffer.writeVarint32(value.toLowerCase() === 'false' ? 0 : !!value);
34812 else
34813 buffer.writeVarint32(value ? 1 : 0);
34814 break;
34815
34816 // Constant enum value
34817 case ProtoBuf.TYPES["enum"]:
34818 buffer.writeVarint32(value);
34819 break;
34820
34821 // 32bit float
34822 case ProtoBuf.TYPES["float"]:
34823 buffer.writeFloat32(value);
34824 break;
34825
34826 // 64bit float
34827 case ProtoBuf.TYPES["double"]:
34828 buffer.writeFloat64(value);
34829 break;
34830
34831 // Length-delimited string
34832 case ProtoBuf.TYPES["string"]:
34833 buffer.writeVString(value);
34834 break;
34835
34836 // Length-delimited bytes
34837 case ProtoBuf.TYPES["bytes"]:
34838 if (value.remaining() < 0)
34839 throw Error("Illegal value for "+this.toString(true)+": "+value.remaining()+" bytes remaining");
34840 var prevOffset = value.offset;
34841 buffer.writeVarint32(value.remaining());
34842 buffer.append(value);
34843 value.offset = prevOffset;
34844 break;
34845
34846 // Embedded message
34847 case ProtoBuf.TYPES["message"]:
34848 var bb = new ByteBuffer().LE();
34849 this.resolvedType.encode(value, bb);
34850 buffer.writeVarint32(bb.offset);
34851 buffer.append(bb.flip());
34852 break;
34853
34854 // Legacy group
34855 case ProtoBuf.TYPES["group"]:
34856 this.resolvedType.encode(value, buffer);
34857 buffer.writeVarint32((id << 3) | ProtoBuf.WIRE_TYPES.ENDGROUP);
34858 break;
34859
34860 default:
34861 // We should never end here
34862 throw Error("[INTERNAL] Illegal value to encode in "+this.toString(true)+": "+value+" (unknown type)");
34863 }
34864 return buffer;
34865 };
34866
34867 /**
34868 * Decode one element value from the specified buffer.
34869 * @param {ByteBuffer} buffer ByteBuffer to decode from
34870 * @param {number} wireType The field wire type
34871 * @param {number} id The field number
34872 * @return {*} Decoded value
34873 * @throws {Error} If the field cannot be decoded
34874 * @expose
34875 */
34876 ElementPrototype.decode = function(buffer, wireType, id) {
34877 if (wireType != this.type.wireType)
34878 throw Error("Unexpected wire type for element");
34879
34880 var value, nBytes;
34881 switch (this.type) {
34882 // 32bit signed varint
34883 case ProtoBuf.TYPES["int32"]:
34884 return buffer.readVarint32() | 0;
34885
34886 // 32bit unsigned varint
34887 case ProtoBuf.TYPES["uint32"]:
34888 return buffer.readVarint32() >>> 0;
34889
34890 // 32bit signed varint zig-zag
34891 case ProtoBuf.TYPES["sint32"]:
34892 return buffer.readVarint32ZigZag() | 0;
34893
34894 // Fixed 32bit unsigned
34895 case ProtoBuf.TYPES["fixed32"]:
34896 return buffer.readUint32() >>> 0;
34897
34898 case ProtoBuf.TYPES["sfixed32"]:
34899 return buffer.readInt32() | 0;
34900
34901 // 64bit signed varint
34902 case ProtoBuf.TYPES["int64"]:
34903 return buffer.readVarint64();
34904
34905 // 64bit unsigned varint
34906 case ProtoBuf.TYPES["uint64"]:
34907 return buffer.readVarint64().toUnsigned();
34908
34909 // 64bit signed varint zig-zag
34910 case ProtoBuf.TYPES["sint64"]:
34911 return buffer.readVarint64ZigZag();
34912
34913 // Fixed 64bit unsigned
34914 case ProtoBuf.TYPES["fixed64"]:
34915 return buffer.readUint64();
34916
34917 // Fixed 64bit signed
34918 case ProtoBuf.TYPES["sfixed64"]:
34919 return buffer.readInt64();
34920
34921 // Bool varint
34922 case ProtoBuf.TYPES["bool"]:
34923 return !!buffer.readVarint32();
34924
34925 // Constant enum value (varint)
34926 case ProtoBuf.TYPES["enum"]:
34927 // The following Builder.Message#set will already throw
34928 return buffer.readVarint32();
34929
34930 // 32bit float
34931 case ProtoBuf.TYPES["float"]:
34932 return buffer.readFloat();
34933
34934 // 64bit float
34935 case ProtoBuf.TYPES["double"]:
34936 return buffer.readDouble();
34937
34938 // Length-delimited string
34939 case ProtoBuf.TYPES["string"]:
34940 return buffer.readVString();
34941
34942 // Length-delimited bytes
34943 case ProtoBuf.TYPES["bytes"]: {
34944 nBytes = buffer.readVarint32();
34945 if (buffer.remaining() < nBytes)
34946 throw Error("Illegal number of bytes for "+this.toString(true)+": "+nBytes+" required but got only "+buffer.remaining());
34947 value = buffer.clone(); // Offset already set
34948 value.limit = value.offset+nBytes;
34949 buffer.offset += nBytes;
34950 return value;
34951 }
34952
34953 // Length-delimited embedded message
34954 case ProtoBuf.TYPES["message"]: {
34955 nBytes = buffer.readVarint32();
34956 return this.resolvedType.decode(buffer, nBytes);
34957 }
34958
34959 // Legacy group
34960 case ProtoBuf.TYPES["group"]:
34961 return this.resolvedType.decode(buffer, -1, id);
34962 }
34963
34964 // We should never end here
34965 throw Error("[INTERNAL] Illegal decode type");
34966 };
34967
34968 /**
34969 * Converts a value from a string to the canonical element type.
34970 *
34971 * Legal only when isMapKey is true.
34972 *
34973 * @param {string} str The string value
34974 * @returns {*} The value
34975 */
34976 ElementPrototype.valueFromString = function(str) {
34977 if (!this.isMapKey) {
34978 throw Error("valueFromString() called on non-map-key element");
34979 }
34980
34981 switch (this.type) {
34982 case ProtoBuf.TYPES["int32"]:
34983 case ProtoBuf.TYPES["sint32"]:
34984 case ProtoBuf.TYPES["sfixed32"]:
34985 case ProtoBuf.TYPES["uint32"]:
34986 case ProtoBuf.TYPES["fixed32"]:
34987 return this.verifyValue(parseInt(str));
34988
34989 case ProtoBuf.TYPES["int64"]:
34990 case ProtoBuf.TYPES["sint64"]:
34991 case ProtoBuf.TYPES["sfixed64"]:
34992 case ProtoBuf.TYPES["uint64"]:
34993 case ProtoBuf.TYPES["fixed64"]:
34994 // Long-based fields support conversions from string already.
34995 return this.verifyValue(str);
34996
34997 case ProtoBuf.TYPES["bool"]:
34998 return str === "true";
34999
35000 case ProtoBuf.TYPES["string"]:
35001 return this.verifyValue(str);
35002
35003 case ProtoBuf.TYPES["bytes"]:
35004 return ByteBuffer.fromBinary(str);
35005 }
35006 };
35007
35008 /**
35009 * Converts a value from the canonical element type to a string.
35010 *
35011 * It should be the case that `valueFromString(valueToString(val))` returns
35012 * a value equivalent to `verifyValue(val)` for every legal value of `val`
35013 * according to this element type.
35014 *
35015 * This may be used when the element must be stored or used as a string,
35016 * e.g., as a map key on an Object.
35017 *
35018 * Legal only when isMapKey is true.
35019 *
35020 * @param {*} val The value
35021 * @returns {string} The string form of the value.
35022 */
35023 ElementPrototype.valueToString = function(value) {
35024 if (!this.isMapKey) {
35025 throw Error("valueToString() called on non-map-key element");
35026 }
35027
35028 if (this.type === ProtoBuf.TYPES["bytes"]) {
35029 return value.toString("binary");
35030 } else {
35031 return value.toString();
35032 }
35033 };
35034
35035 /**
35036 * @alias ProtoBuf.Reflect.Element
35037 * @expose
35038 */
35039 Reflect.Element = Element;
35040
35041 /**
35042 * Constructs a new Message.
35043 * @exports ProtoBuf.Reflect.Message
35044 * @param {!ProtoBuf.Builder} builder Builder reference
35045 * @param {!ProtoBuf.Reflect.Namespace} parent Parent message or namespace
35046 * @param {string} name Message name
35047 * @param {Object.<string,*>=} options Message options
35048 * @param {boolean=} isGroup `true` if this is a legacy group
35049 * @param {string?} syntax The syntax level of this definition (e.g., proto3)
35050 * @constructor
35051 * @extends ProtoBuf.Reflect.Namespace
35052 */
35053 var Message = function(builder, parent, name, options, isGroup, syntax) {
35054 Namespace.call(this, builder, parent, name, options, syntax);
35055
35056 /**
35057 * @override
35058 */
35059 this.className = "Message";
35060
35061 /**
35062 * Extensions range.
35063 * @type {!Array.<number>|undefined}
35064 * @expose
35065 */
35066 this.extensions = undefined;
35067
35068 /**
35069 * Runtime message class.
35070 * @type {?function(new:ProtoBuf.Builder.Message)}
35071 * @expose
35072 */
35073 this.clazz = null;
35074
35075 /**
35076 * Whether this is a legacy group or not.
35077 * @type {boolean}
35078 * @expose
35079 */
35080 this.isGroup = !!isGroup;
35081
35082 // The following cached collections are used to efficiently iterate over or look up fields when decoding.
35083
35084 /**
35085 * Cached fields.
35086 * @type {?Array.<!ProtoBuf.Reflect.Message.Field>}
35087 * @private
35088 */
35089 this._fields = null;
35090
35091 /**
35092 * Cached fields by id.
35093 * @type {?Object.<number,!ProtoBuf.Reflect.Message.Field>}
35094 * @private
35095 */
35096 this._fieldsById = null;
35097
35098 /**
35099 * Cached fields by name.
35100 * @type {?Object.<string,!ProtoBuf.Reflect.Message.Field>}
35101 * @private
35102 */
35103 this._fieldsByName = null;
35104 };
35105
35106 /**
35107 * @alias ProtoBuf.Reflect.Message.prototype
35108 * @inner
35109 */
35110 var MessagePrototype = Message.prototype = Object.create(Namespace.prototype);
35111
35112 /**
35113 * Builds the message and returns the runtime counterpart, which is a fully functional class.
35114 * @see ProtoBuf.Builder.Message
35115 * @param {boolean=} rebuild Whether to rebuild or not, defaults to false
35116 * @return {ProtoBuf.Reflect.Message} Message class
35117 * @throws {Error} If the message cannot be built
35118 * @expose
35119 */
35120 MessagePrototype.build = function(rebuild) {
35121 if (this.clazz && !rebuild)
35122 return this.clazz;
35123
35124 // Create the runtime Message class in its own scope
35125 var clazz = (function(ProtoBuf, T) {
35126
35127 var fields = T.getChildren(ProtoBuf.Reflect.Message.Field),
35128 oneofs = T.getChildren(ProtoBuf.Reflect.Message.OneOf);
35129
35130 /**
35131 * Constructs a new runtime Message.
35132 * @name ProtoBuf.Builder.Message
35133 * @class Barebone of all runtime messages.
35134 * @param {!Object.<string,*>|string} values Preset values
35135 * @param {...string} var_args
35136 * @constructor
35137 * @throws {Error} If the message cannot be created
35138 */
35139 var Message = function(values, var_args) {
35140 ProtoBuf.Builder.Message.call(this);
35141
35142 // Create virtual oneof properties
35143 for (var i=0, k=oneofs.length; i<k; ++i)
35144 this[oneofs[i].name] = null;
35145 // Create fields and set default values
35146 for (i=0, k=fields.length; i<k; ++i) {
35147 var field = fields[i];
35148 this[field.name] =
35149 field.repeated ? [] :
35150 (field.map ? new ProtoBuf.Map(field) : null);
35151 if ((field.required || T.syntax === 'proto3') &&
35152 field.defaultValue !== null)
35153 this[field.name] = field.defaultValue;
35154 }
35155
35156 if (arguments.length > 0) {
35157 var value;
35158 // Set field values from a values object
35159 if (arguments.length === 1 && values !== null && typeof values === 'object' &&
35160 /* not _another_ Message */ (typeof values.encode !== 'function' || values instanceof Message) &&
35161 /* not a repeated field */ !Array.isArray(values) &&
35162 /* not a Map */ !(values instanceof ProtoBuf.Map) &&
35163 /* not a ByteBuffer */ !ByteBuffer.isByteBuffer(values) &&
35164 /* not an ArrayBuffer */ !(values instanceof ArrayBuffer) &&
35165 /* not a Long */ !(ProtoBuf.Long && values instanceof ProtoBuf.Long)) {
35166 this.$set(values);
35167 } else // Set field values from arguments, in declaration order
35168 for (i=0, k=arguments.length; i<k; ++i)
35169 if (typeof (value = arguments[i]) !== 'undefined')
35170 this.$set(fields[i].name, value); // May throw
35171 }
35172 };
35173
35174 /**
35175 * @alias ProtoBuf.Builder.Message.prototype
35176 * @inner
35177 */
35178 var MessagePrototype = Message.prototype = Object.create(ProtoBuf.Builder.Message.prototype);
35179
35180 /**
35181 * Adds a value to a repeated field.
35182 * @name ProtoBuf.Builder.Message#add
35183 * @function
35184 * @param {string} key Field name
35185 * @param {*} value Value to add
35186 * @param {boolean=} noAssert Whether to assert the value or not (asserts by default)
35187 * @returns {!ProtoBuf.Builder.Message} this
35188 * @throws {Error} If the value cannot be added
35189 * @expose
35190 */
35191 MessagePrototype.add = function(key, value, noAssert) {
35192 var field = T._fieldsByName[key];
35193 if (!noAssert) {
35194 if (!field)
35195 throw Error(this+"#"+key+" is undefined");
35196 if (!(field instanceof ProtoBuf.Reflect.Message.Field))
35197 throw Error(this+"#"+key+" is not a field: "+field.toString(true)); // May throw if it's an enum or embedded message
35198 if (!field.repeated)
35199 throw Error(this+"#"+key+" is not a repeated field");
35200 value = field.verifyValue(value, true);
35201 }
35202 if (this[key] === null)
35203 this[key] = [];
35204 this[key].push(value);
35205 return this;
35206 };
35207
35208 /**
35209 * Adds a value to a repeated field. This is an alias for {@link ProtoBuf.Builder.Message#add}.
35210 * @name ProtoBuf.Builder.Message#$add
35211 * @function
35212 * @param {string} key Field name
35213 * @param {*} value Value to add
35214 * @param {boolean=} noAssert Whether to assert the value or not (asserts by default)
35215 * @returns {!ProtoBuf.Builder.Message} this
35216 * @throws {Error} If the value cannot be added
35217 * @expose
35218 */
35219 MessagePrototype.$add = MessagePrototype.add;
35220
35221 /**
35222 * Sets a field's value.
35223 * @name ProtoBuf.Builder.Message#set
35224 * @function
35225 * @param {string|!Object.<string,*>} keyOrObj String key or plain object holding multiple values
35226 * @param {(*|boolean)=} value Value to set if key is a string, otherwise omitted
35227 * @param {boolean=} noAssert Whether to not assert for an actual field / proper value type, defaults to `false`
35228 * @returns {!ProtoBuf.Builder.Message} this
35229 * @throws {Error} If the value cannot be set
35230 * @expose
35231 */
35232 MessagePrototype.set = function(keyOrObj, value, noAssert) {
35233 if (keyOrObj && typeof keyOrObj === 'object') {
35234 noAssert = value;
35235 for (var ikey in keyOrObj) {
35236 // Check if virtual oneof field - don't set these
35237 if (keyOrObj.hasOwnProperty(ikey) && typeof (value = keyOrObj[ikey]) !== 'undefined' && T._oneofsByName[ikey] === undefined)
35238 this.$set(ikey, value, noAssert);
35239 }
35240 return this;
35241 }
35242 var field = T._fieldsByName[keyOrObj];
35243 if (!noAssert) {
35244 if (!field)
35245 throw Error(this+"#"+keyOrObj+" is not a field: undefined");
35246 if (!(field instanceof ProtoBuf.Reflect.Message.Field))
35247 throw Error(this+"#"+keyOrObj+" is not a field: "+field.toString(true));
35248 this[field.name] = (value = field.verifyValue(value)); // May throw
35249 } else
35250 this[keyOrObj] = value;
35251 if (field && field.oneof) { // Field is part of an OneOf (not a virtual OneOf field)
35252 var currentField = this[field.oneof.name]; // Virtual field references currently set field
35253 if (value !== null) {
35254 if (currentField !== null && currentField !== field.name)
35255 this[currentField] = null; // Clear currently set field
35256 this[field.oneof.name] = field.name; // Point virtual field at this field
35257 } else if (/* value === null && */currentField === keyOrObj)
35258 this[field.oneof.name] = null; // Clear virtual field (current field explicitly cleared)
35259 }
35260 return this;
35261 };
35262
35263 /**
35264 * Sets a field's value. This is an alias for [@link ProtoBuf.Builder.Message#set}.
35265 * @name ProtoBuf.Builder.Message#$set
35266 * @function
35267 * @param {string|!Object.<string,*>} keyOrObj String key or plain object holding multiple values
35268 * @param {(*|boolean)=} value Value to set if key is a string, otherwise omitted
35269 * @param {boolean=} noAssert Whether to not assert the value, defaults to `false`
35270 * @throws {Error} If the value cannot be set
35271 * @expose
35272 */
35273 MessagePrototype.$set = MessagePrototype.set;
35274
35275 /**
35276 * Gets a field's value.
35277 * @name ProtoBuf.Builder.Message#get
35278 * @function
35279 * @param {string} key Key
35280 * @param {boolean=} noAssert Whether to not assert for an actual field, defaults to `false`
35281 * @return {*} Value
35282 * @throws {Error} If there is no such field
35283 * @expose
35284 */
35285 MessagePrototype.get = function(key, noAssert) {
35286 if (noAssert)
35287 return this[key];
35288 var field = T._fieldsByName[key];
35289 if (!field || !(field instanceof ProtoBuf.Reflect.Message.Field))
35290 throw Error(this+"#"+key+" is not a field: undefined");
35291 if (!(field instanceof ProtoBuf.Reflect.Message.Field))
35292 throw Error(this+"#"+key+" is not a field: "+field.toString(true));
35293 return this[field.name];
35294 };
35295
35296 /**
35297 * Gets a field's value. This is an alias for {@link ProtoBuf.Builder.Message#$get}.
35298 * @name ProtoBuf.Builder.Message#$get
35299 * @function
35300 * @param {string} key Key
35301 * @return {*} Value
35302 * @throws {Error} If there is no such field
35303 * @expose
35304 */
35305 MessagePrototype.$get = MessagePrototype.get;
35306
35307 // Getters and setters
35308
35309 for (var i=0; i<fields.length; i++) {
35310 var field = fields[i];
35311 // no setters for extension fields as these are named by their fqn
35312 if (field instanceof ProtoBuf.Reflect.Message.ExtensionField)
35313 continue;
35314
35315 if (T.builder.options['populateAccessors'])
35316 (function(field) {
35317 // set/get[SomeValue]
35318 var Name = field.originalName.replace(/(_[a-zA-Z])/g, function(match) {
35319 return match.toUpperCase().replace('_','');
35320 });
35321 Name = Name.substring(0,1).toUpperCase() + Name.substring(1);
35322
35323 // set/get_[some_value] FIXME: Do we really need these?
35324 var name = field.originalName.replace(/([A-Z])/g, function(match) {
35325 return "_"+match;
35326 });
35327
35328 /**
35329 * The current field's unbound setter function.
35330 * @function
35331 * @param {*} value
35332 * @param {boolean=} noAssert
35333 * @returns {!ProtoBuf.Builder.Message}
35334 * @inner
35335 */
35336 var setter = function(value, noAssert) {
35337 this[field.name] = noAssert ? value : field.verifyValue(value);
35338 return this;
35339 };
35340
35341 /**
35342 * The current field's unbound getter function.
35343 * @function
35344 * @returns {*}
35345 * @inner
35346 */
35347 var getter = function() {
35348 return this[field.name];
35349 };
35350
35351 if (T.getChild("set"+Name) === null)
35352 /**
35353 * Sets a value. This method is present for each field, but only if there is no name conflict with
35354 * another field.
35355 * @name ProtoBuf.Builder.Message#set[SomeField]
35356 * @function
35357 * @param {*} value Value to set
35358 * @param {boolean=} noAssert Whether to not assert the value, defaults to `false`
35359 * @returns {!ProtoBuf.Builder.Message} this
35360 * @abstract
35361 * @throws {Error} If the value cannot be set
35362 */
35363 MessagePrototype["set"+Name] = setter;
35364
35365 if (T.getChild("set_"+name) === null)
35366 /**
35367 * Sets a value. This method is present for each field, but only if there is no name conflict with
35368 * another field.
35369 * @name ProtoBuf.Builder.Message#set_[some_field]
35370 * @function
35371 * @param {*} value Value to set
35372 * @param {boolean=} noAssert Whether to not assert the value, defaults to `false`
35373 * @returns {!ProtoBuf.Builder.Message} this
35374 * @abstract
35375 * @throws {Error} If the value cannot be set
35376 */
35377 MessagePrototype["set_"+name] = setter;
35378
35379 if (T.getChild("get"+Name) === null)
35380 /**
35381 * Gets a value. This method is present for each field, but only if there is no name conflict with
35382 * another field.
35383 * @name ProtoBuf.Builder.Message#get[SomeField]
35384 * @function
35385 * @abstract
35386 * @return {*} The value
35387 */
35388 MessagePrototype["get"+Name] = getter;
35389
35390 if (T.getChild("get_"+name) === null)
35391 /**
35392 * Gets a value. This method is present for each field, but only if there is no name conflict with
35393 * another field.
35394 * @name ProtoBuf.Builder.Message#get_[some_field]
35395 * @function
35396 * @return {*} The value
35397 * @abstract
35398 */
35399 MessagePrototype["get_"+name] = getter;
35400
35401 })(field);
35402 }
35403
35404 // En-/decoding
35405
35406 /**
35407 * Encodes the message.
35408 * @name ProtoBuf.Builder.Message#$encode
35409 * @function
35410 * @param {(!ByteBuffer|boolean)=} buffer ByteBuffer to encode to. Will create a new one and flip it if omitted.
35411 * @param {boolean=} noVerify Whether to not verify field values, defaults to `false`
35412 * @return {!ByteBuffer} Encoded message as a ByteBuffer
35413 * @throws {Error} If the message cannot be encoded or if required fields are missing. The later still
35414 * returns the encoded ByteBuffer in the `encoded` property on the error.
35415 * @expose
35416 * @see ProtoBuf.Builder.Message#encode64
35417 * @see ProtoBuf.Builder.Message#encodeHex
35418 * @see ProtoBuf.Builder.Message#encodeAB
35419 */
35420 MessagePrototype.encode = function(buffer, noVerify) {
35421 if (typeof buffer === 'boolean')
35422 noVerify = buffer,
35423 buffer = undefined;
35424 var isNew = false;
35425 if (!buffer)
35426 buffer = new ByteBuffer(),
35427 isNew = true;
35428 var le = buffer.littleEndian;
35429 try {
35430 T.encode(this, buffer.LE(), noVerify);
35431 return (isNew ? buffer.flip() : buffer).LE(le);
35432 } catch (e) {
35433 buffer.LE(le);
35434 throw(e);
35435 }
35436 };
35437
35438 /**
35439 * Encodes a message using the specified data payload.
35440 * @param {!Object.<string,*>} data Data payload
35441 * @param {(!ByteBuffer|boolean)=} buffer ByteBuffer to encode to. Will create a new one and flip it if omitted.
35442 * @param {boolean=} noVerify Whether to not verify field values, defaults to `false`
35443 * @return {!ByteBuffer} Encoded message as a ByteBuffer
35444 * @expose
35445 */
35446 Message.encode = function(data, buffer, noVerify) {
35447 return new Message(data).encode(buffer, noVerify);
35448 };
35449
35450 /**
35451 * Calculates the byte length of the message.
35452 * @name ProtoBuf.Builder.Message#calculate
35453 * @function
35454 * @returns {number} Byte length
35455 * @throws {Error} If the message cannot be calculated or if required fields are missing.
35456 * @expose
35457 */
35458 MessagePrototype.calculate = function() {
35459 return T.calculate(this);
35460 };
35461
35462 /**
35463 * Encodes the varint32 length-delimited message.
35464 * @name ProtoBuf.Builder.Message#encodeDelimited
35465 * @function
35466 * @param {(!ByteBuffer|boolean)=} buffer ByteBuffer to encode to. Will create a new one and flip it if omitted.
35467 * @param {boolean=} noVerify Whether to not verify field values, defaults to `false`
35468 * @return {!ByteBuffer} Encoded message as a ByteBuffer
35469 * @throws {Error} If the message cannot be encoded or if required fields are missing. The later still
35470 * returns the encoded ByteBuffer in the `encoded` property on the error.
35471 * @expose
35472 */
35473 MessagePrototype.encodeDelimited = function(buffer, noVerify) {
35474 var isNew = false;
35475 if (!buffer)
35476 buffer = new ByteBuffer(),
35477 isNew = true;
35478 var enc = new ByteBuffer().LE();
35479 T.encode(this, enc, noVerify).flip();
35480 buffer.writeVarint32(enc.remaining());
35481 buffer.append(enc);
35482 return isNew ? buffer.flip() : buffer;
35483 };
35484
35485 /**
35486 * Directly encodes the message to an ArrayBuffer.
35487 * @name ProtoBuf.Builder.Message#encodeAB
35488 * @function
35489 * @return {ArrayBuffer} Encoded message as ArrayBuffer
35490 * @throws {Error} If the message cannot be encoded or if required fields are missing. The later still
35491 * returns the encoded ArrayBuffer in the `encoded` property on the error.
35492 * @expose
35493 */
35494 MessagePrototype.encodeAB = function() {
35495 try {
35496 return this.encode().toArrayBuffer();
35497 } catch (e) {
35498 if (e["encoded"]) e["encoded"] = e["encoded"].toArrayBuffer();
35499 throw(e);
35500 }
35501 };
35502
35503 /**
35504 * Returns the message as an ArrayBuffer. This is an alias for {@link ProtoBuf.Builder.Message#encodeAB}.
35505 * @name ProtoBuf.Builder.Message#toArrayBuffer
35506 * @function
35507 * @return {ArrayBuffer} Encoded message as ArrayBuffer
35508 * @throws {Error} If the message cannot be encoded or if required fields are missing. The later still
35509 * returns the encoded ArrayBuffer in the `encoded` property on the error.
35510 * @expose
35511 */
35512 MessagePrototype.toArrayBuffer = MessagePrototype.encodeAB;
35513
35514 /**
35515 * Directly encodes the message to a node Buffer.
35516 * @name ProtoBuf.Builder.Message#encodeNB
35517 * @function
35518 * @return {!Buffer}
35519 * @throws {Error} If the message cannot be encoded, not running under node.js or if required fields are
35520 * missing. The later still returns the encoded node Buffer in the `encoded` property on the error.
35521 * @expose
35522 */
35523 MessagePrototype.encodeNB = function() {
35524 try {
35525 return this.encode().toBuffer();
35526 } catch (e) {
35527 if (e["encoded"]) e["encoded"] = e["encoded"].toBuffer();
35528 throw(e);
35529 }
35530 };
35531
35532 /**
35533 * Returns the message as a node Buffer. This is an alias for {@link ProtoBuf.Builder.Message#encodeNB}.
35534 * @name ProtoBuf.Builder.Message#toBuffer
35535 * @function
35536 * @return {!Buffer}
35537 * @throws {Error} If the message cannot be encoded or if required fields are missing. The later still
35538 * returns the encoded node Buffer in the `encoded` property on the error.
35539 * @expose
35540 */
35541 MessagePrototype.toBuffer = MessagePrototype.encodeNB;
35542
35543 /**
35544 * Directly encodes the message to a base64 encoded string.
35545 * @name ProtoBuf.Builder.Message#encode64
35546 * @function
35547 * @return {string} Base64 encoded string
35548 * @throws {Error} If the underlying buffer cannot be encoded or if required fields are missing. The later
35549 * still returns the encoded base64 string in the `encoded` property on the error.
35550 * @expose
35551 */
35552 MessagePrototype.encode64 = function() {
35553 try {
35554 return this.encode().toBase64();
35555 } catch (e) {
35556 if (e["encoded"]) e["encoded"] = e["encoded"].toBase64();
35557 throw(e);
35558 }
35559 };
35560
35561 /**
35562 * Returns the message as a base64 encoded string. This is an alias for {@link ProtoBuf.Builder.Message#encode64}.
35563 * @name ProtoBuf.Builder.Message#toBase64
35564 * @function
35565 * @return {string} Base64 encoded string
35566 * @throws {Error} If the message cannot be encoded or if required fields are missing. The later still
35567 * returns the encoded base64 string in the `encoded` property on the error.
35568 * @expose
35569 */
35570 MessagePrototype.toBase64 = MessagePrototype.encode64;
35571
35572 /**
35573 * Directly encodes the message to a hex encoded string.
35574 * @name ProtoBuf.Builder.Message#encodeHex
35575 * @function
35576 * @return {string} Hex encoded string
35577 * @throws {Error} If the underlying buffer cannot be encoded or if required fields are missing. The later
35578 * still returns the encoded hex string in the `encoded` property on the error.
35579 * @expose
35580 */
35581 MessagePrototype.encodeHex = function() {
35582 try {
35583 return this.encode().toHex();
35584 } catch (e) {
35585 if (e["encoded"]) e["encoded"] = e["encoded"].toHex();
35586 throw(e);
35587 }
35588 };
35589
35590 /**
35591 * Returns the message as a hex encoded string. This is an alias for {@link ProtoBuf.Builder.Message#encodeHex}.
35592 * @name ProtoBuf.Builder.Message#toHex
35593 * @function
35594 * @return {string} Hex encoded string
35595 * @throws {Error} If the message cannot be encoded or if required fields are missing. The later still
35596 * returns the encoded hex string in the `encoded` property on the error.
35597 * @expose
35598 */
35599 MessagePrototype.toHex = MessagePrototype.encodeHex;
35600
35601 /**
35602 * Clones a message object or field value to a raw object.
35603 * @param {*} obj Object to clone
35604 * @param {boolean} binaryAsBase64 Whether to include binary data as base64 strings or as a buffer otherwise
35605 * @param {boolean} longsAsStrings Whether to encode longs as strings
35606 * @param {!ProtoBuf.Reflect.T=} resolvedType The resolved field type if a field
35607 * @returns {*} Cloned object
35608 * @inner
35609 */
35610 function cloneRaw(obj, binaryAsBase64, longsAsStrings, resolvedType) {
35611 if (obj === null || typeof obj !== 'object') {
35612 // Convert enum values to their respective names
35613 if (resolvedType && resolvedType instanceof ProtoBuf.Reflect.Enum) {
35614 var name = ProtoBuf.Reflect.Enum.getName(resolvedType.object, obj);
35615 if (name !== null)
35616 return name;
35617 }
35618 // Pass-through string, number, boolean, null...
35619 return obj;
35620 }
35621 // Convert ByteBuffers to raw buffer or strings
35622 if (ByteBuffer.isByteBuffer(obj))
35623 return binaryAsBase64 ? obj.toBase64() : obj.toBuffer();
35624 // Convert Longs to proper objects or strings
35625 if (ProtoBuf.Long.isLong(obj))
35626 return longsAsStrings ? obj.toString() : ProtoBuf.Long.fromValue(obj);
35627 var clone;
35628 // Clone arrays
35629 if (Array.isArray(obj)) {
35630 clone = [];
35631 obj.forEach(function(v, k) {
35632 clone[k] = cloneRaw(v, binaryAsBase64, longsAsStrings, resolvedType);
35633 });
35634 return clone;
35635 }
35636 clone = {};
35637 // Convert maps to objects
35638 if (obj instanceof ProtoBuf.Map) {
35639 var it = obj.entries();
35640 for (var e = it.next(); !e.done; e = it.next())
35641 clone[obj.keyElem.valueToString(e.value[0])] = cloneRaw(e.value[1], binaryAsBase64, longsAsStrings, obj.valueElem.resolvedType);
35642 return clone;
35643 }
35644 // Everything else is a non-null object
35645 var type = obj.$type,
35646 field = undefined;
35647 for (var i in obj)
35648 if (obj.hasOwnProperty(i)) {
35649 if (type && (field = type.getChild(i)))
35650 clone[i] = cloneRaw(obj[i], binaryAsBase64, longsAsStrings, field.resolvedType);
35651 else
35652 clone[i] = cloneRaw(obj[i], binaryAsBase64, longsAsStrings);
35653 }
35654 return clone;
35655 }
35656
35657 /**
35658 * Returns the message's raw payload.
35659 * @param {boolean=} binaryAsBase64 Whether to include binary data as base64 strings instead of Buffers, defaults to `false`
35660 * @param {boolean} longsAsStrings Whether to encode longs as strings
35661 * @returns {Object.<string,*>} Raw payload
35662 * @expose
35663 */
35664 MessagePrototype.toRaw = function(binaryAsBase64, longsAsStrings) {
35665 return cloneRaw(this, !!binaryAsBase64, !!longsAsStrings, this.$type);
35666 };
35667
35668 /**
35669 * Encodes a message to JSON.
35670 * @returns {string} JSON string
35671 * @expose
35672 */
35673 MessagePrototype.encodeJSON = function() {
35674 return JSON.stringify(
35675 cloneRaw(this,
35676 /* binary-as-base64 */ true,
35677 /* longs-as-strings */ true,
35678 this.$type
35679 )
35680 );
35681 };
35682
35683 /**
35684 * Decodes a message from the specified buffer or string.
35685 * @name ProtoBuf.Builder.Message.decode
35686 * @function
35687 * @param {!ByteBuffer|!ArrayBuffer|!Buffer|string} buffer Buffer to decode from
35688 * @param {(number|string)=} length Message length. Defaults to decode all the remainig data.
35689 * @param {string=} enc Encoding if buffer is a string: hex, utf8 (not recommended), defaults to base64
35690 * @return {!ProtoBuf.Builder.Message} Decoded message
35691 * @throws {Error} If the message cannot be decoded or if required fields are missing. The later still
35692 * returns the decoded message with missing fields in the `decoded` property on the error.
35693 * @expose
35694 * @see ProtoBuf.Builder.Message.decode64
35695 * @see ProtoBuf.Builder.Message.decodeHex
35696 */
35697 Message.decode = function(buffer, length, enc) {
35698 if (typeof length === 'string')
35699 enc = length,
35700 length = -1;
35701 if (typeof buffer === 'string')
35702 buffer = ByteBuffer.wrap(buffer, enc ? enc : "base64");
35703 else if (!ByteBuffer.isByteBuffer(buffer))
35704 buffer = ByteBuffer.wrap(buffer); // May throw
35705 var le = buffer.littleEndian;
35706 try {
35707 var msg = T.decode(buffer.LE(), length);
35708 buffer.LE(le);
35709 return msg;
35710 } catch (e) {
35711 buffer.LE(le);
35712 throw(e);
35713 }
35714 };
35715
35716 /**
35717 * Decodes a varint32 length-delimited message from the specified buffer or string.
35718 * @name ProtoBuf.Builder.Message.decodeDelimited
35719 * @function
35720 * @param {!ByteBuffer|!ArrayBuffer|!Buffer|string} buffer Buffer to decode from
35721 * @param {string=} enc Encoding if buffer is a string: hex, utf8 (not recommended), defaults to base64
35722 * @return {ProtoBuf.Builder.Message} Decoded message or `null` if not enough bytes are available yet
35723 * @throws {Error} If the message cannot be decoded or if required fields are missing. The later still
35724 * returns the decoded message with missing fields in the `decoded` property on the error.
35725 * @expose
35726 */
35727 Message.decodeDelimited = function(buffer, enc) {
35728 if (typeof buffer === 'string')
35729 buffer = ByteBuffer.wrap(buffer, enc ? enc : "base64");
35730 else if (!ByteBuffer.isByteBuffer(buffer))
35731 buffer = ByteBuffer.wrap(buffer); // May throw
35732 if (buffer.remaining() < 1)
35733 return null;
35734 var off = buffer.offset,
35735 len = buffer.readVarint32();
35736 if (buffer.remaining() < len) {
35737 buffer.offset = off;
35738 return null;
35739 }
35740 try {
35741 var msg = T.decode(buffer.slice(buffer.offset, buffer.offset + len).LE());
35742 buffer.offset += len;
35743 return msg;
35744 } catch (err) {
35745 buffer.offset += len;
35746 throw err;
35747 }
35748 };
35749
35750 /**
35751 * Decodes the message from the specified base64 encoded string.
35752 * @name ProtoBuf.Builder.Message.decode64
35753 * @function
35754 * @param {string} str String to decode from
35755 * @return {!ProtoBuf.Builder.Message} Decoded message
35756 * @throws {Error} If the message cannot be decoded or if required fields are missing. The later still
35757 * returns the decoded message with missing fields in the `decoded` property on the error.
35758 * @expose
35759 */
35760 Message.decode64 = function(str) {
35761 return Message.decode(str, "base64");
35762 };
35763
35764 /**
35765 * Decodes the message from the specified hex encoded string.
35766 * @name ProtoBuf.Builder.Message.decodeHex
35767 * @function
35768 * @param {string} str String to decode from
35769 * @return {!ProtoBuf.Builder.Message} Decoded message
35770 * @throws {Error} If the message cannot be decoded or if required fields are missing. The later still
35771 * returns the decoded message with missing fields in the `decoded` property on the error.
35772 * @expose
35773 */
35774 Message.decodeHex = function(str) {
35775 return Message.decode(str, "hex");
35776 };
35777
35778 /**
35779 * Decodes the message from a JSON string.
35780 * @name ProtoBuf.Builder.Message.decodeJSON
35781 * @function
35782 * @param {string} str String to decode from
35783 * @return {!ProtoBuf.Builder.Message} Decoded message
35784 * @throws {Error} If the message cannot be decoded or if required fields are
35785 * missing.
35786 * @expose
35787 */
35788 Message.decodeJSON = function(str) {
35789 return new Message(JSON.parse(str));
35790 };
35791
35792 // Utility
35793
35794 /**
35795 * Returns a string representation of this Message.
35796 * @name ProtoBuf.Builder.Message#toString
35797 * @function
35798 * @return {string} String representation as of ".Fully.Qualified.MessageName"
35799 * @expose
35800 */
35801 MessagePrototype.toString = function() {
35802 return T.toString();
35803 };
35804
35805 // Properties
35806
35807 /**
35808 * Message options.
35809 * @name ProtoBuf.Builder.Message.$options
35810 * @type {Object.<string,*>}
35811 * @expose
35812 */
35813 var $optionsS; // cc needs this
35814
35815 /**
35816 * Message options.
35817 * @name ProtoBuf.Builder.Message#$options
35818 * @type {Object.<string,*>}
35819 * @expose
35820 */
35821 var $options;
35822
35823 /**
35824 * Reflection type.
35825 * @name ProtoBuf.Builder.Message.$type
35826 * @type {!ProtoBuf.Reflect.Message}
35827 * @expose
35828 */
35829 var $typeS;
35830
35831 /**
35832 * Reflection type.
35833 * @name ProtoBuf.Builder.Message#$type
35834 * @type {!ProtoBuf.Reflect.Message}
35835 * @expose
35836 */
35837 var $type;
35838
35839 if (Object.defineProperty)
35840 Object.defineProperty(Message, '$options', { "value": T.buildOpt() }),
35841 Object.defineProperty(MessagePrototype, "$options", { "value": Message["$options"] }),
35842 Object.defineProperty(Message, "$type", { "value": T }),
35843 Object.defineProperty(MessagePrototype, "$type", { "value": T });
35844
35845 return Message;
35846
35847 })(ProtoBuf, this);
35848
35849 // Static enums and prototyped sub-messages / cached collections
35850 this._fields = [];
35851 this._fieldsById = {};
35852 this._fieldsByName = {};
35853 this._oneofsByName = {};
35854 for (var i=0, k=this.children.length, child; i<k; i++) {
35855 child = this.children[i];
35856 if (child instanceof Enum || child instanceof Message || child instanceof Service) {
35857 if (clazz.hasOwnProperty(child.name))
35858 throw Error("Illegal reflect child of "+this.toString(true)+": "+child.toString(true)+" cannot override static property '"+child.name+"'");
35859 clazz[child.name] = child.build();
35860 } else if (child instanceof Message.Field)
35861 child.build(),
35862 this._fields.push(child),
35863 this._fieldsById[child.id] = child,
35864 this._fieldsByName[child.name] = child;
35865 else if (child instanceof Message.OneOf) {
35866 this._oneofsByName[child.name] = child;
35867 }
35868 else if (!(child instanceof Message.OneOf) && !(child instanceof Extension)) // Not built
35869 throw Error("Illegal reflect child of "+this.toString(true)+": "+this.children[i].toString(true));
35870 }
35871
35872 return this.clazz = clazz;
35873 };
35874
35875 /**
35876 * Encodes a runtime message's contents to the specified buffer.
35877 * @param {!ProtoBuf.Builder.Message} message Runtime message to encode
35878 * @param {ByteBuffer} buffer ByteBuffer to write to
35879 * @param {boolean=} noVerify Whether to not verify field values, defaults to `false`
35880 * @return {ByteBuffer} The ByteBuffer for chaining
35881 * @throws {Error} If required fields are missing or the message cannot be encoded for another reason
35882 * @expose
35883 */
35884 MessagePrototype.encode = function(message, buffer, noVerify) {
35885 var fieldMissing = null,
35886 field;
35887 for (var i=0, k=this._fields.length, val; i<k; ++i) {
35888 field = this._fields[i];
35889 val = message[field.name];
35890 if (field.required && val === null) {
35891 if (fieldMissing === null)
35892 fieldMissing = field;
35893 } else
35894 field.encode(noVerify ? val : field.verifyValue(val), buffer, message);
35895 }
35896 if (fieldMissing !== null) {
35897 var err = Error("Missing at least one required field for "+this.toString(true)+": "+fieldMissing);
35898 err["encoded"] = buffer; // Still expose what we got
35899 throw(err);
35900 }
35901 return buffer;
35902 };
35903
35904 /**
35905 * Calculates a runtime message's byte length.
35906 * @param {!ProtoBuf.Builder.Message} message Runtime message to encode
35907 * @returns {number} Byte length
35908 * @throws {Error} If required fields are missing or the message cannot be calculated for another reason
35909 * @expose
35910 */
35911 MessagePrototype.calculate = function(message) {
35912 for (var n=0, i=0, k=this._fields.length, field, val; i<k; ++i) {
35913 field = this._fields[i];
35914 val = message[field.name];
35915 if (field.required && val === null)
35916 throw Error("Missing at least one required field for "+this.toString(true)+": "+field);
35917 else
35918 n += field.calculate(val, message);
35919 }
35920 return n;
35921 };
35922
35923 /**
35924 * Skips all data until the end of the specified group has been reached.
35925 * @param {number} expectedId Expected GROUPEND id
35926 * @param {!ByteBuffer} buf ByteBuffer
35927 * @returns {boolean} `true` if a value as been skipped, `false` if the end has been reached
35928 * @throws {Error} If it wasn't possible to find the end of the group (buffer overrun or end tag mismatch)
35929 * @inner
35930 */
35931 function skipTillGroupEnd(expectedId, buf) {
35932 var tag = buf.readVarint32(), // Throws on OOB
35933 wireType = tag & 0x07,
35934 id = tag >>> 3;
35935 switch (wireType) {
35936 case ProtoBuf.WIRE_TYPES.VARINT:
35937 do tag = buf.readUint8();
35938 while ((tag & 0x80) === 0x80);
35939 break;
35940 case ProtoBuf.WIRE_TYPES.BITS64:
35941 buf.offset += 8;
35942 break;
35943 case ProtoBuf.WIRE_TYPES.LDELIM:
35944 tag = buf.readVarint32(); // reads the varint
35945 buf.offset += tag; // skips n bytes
35946 break;
35947 case ProtoBuf.WIRE_TYPES.STARTGROUP:
35948 skipTillGroupEnd(id, buf);
35949 break;
35950 case ProtoBuf.WIRE_TYPES.ENDGROUP:
35951 if (id === expectedId)
35952 return false;
35953 else
35954 throw Error("Illegal GROUPEND after unknown group: "+id+" ("+expectedId+" expected)");
35955 case ProtoBuf.WIRE_TYPES.BITS32:
35956 buf.offset += 4;
35957 break;
35958 default:
35959 throw Error("Illegal wire type in unknown group "+expectedId+": "+wireType);
35960 }
35961 return true;
35962 }
35963
35964 /**
35965 * Decodes an encoded message and returns the decoded message.
35966 * @param {ByteBuffer} buffer ByteBuffer to decode from
35967 * @param {number=} length Message length. Defaults to decode all remaining data.
35968 * @param {number=} expectedGroupEndId Expected GROUPEND id if this is a legacy group
35969 * @return {ProtoBuf.Builder.Message} Decoded message
35970 * @throws {Error} If the message cannot be decoded
35971 * @expose
35972 */
35973 MessagePrototype.decode = function(buffer, length, expectedGroupEndId) {
35974 if (typeof length !== 'number')
35975 length = -1;
35976 var start = buffer.offset,
35977 msg = new (this.clazz)(),
35978 tag, wireType, id, field;
35979 while (buffer.offset < start+length || (length === -1 && buffer.remaining() > 0)) {
35980 tag = buffer.readVarint32();
35981 wireType = tag & 0x07;
35982 id = tag >>> 3;
35983 if (wireType === ProtoBuf.WIRE_TYPES.ENDGROUP) {
35984 if (id !== expectedGroupEndId)
35985 throw Error("Illegal group end indicator for "+this.toString(true)+": "+id+" ("+(expectedGroupEndId ? expectedGroupEndId+" expected" : "not a group")+")");
35986 break;
35987 }
35988 if (!(field = this._fieldsById[id])) {
35989 // "messages created by your new code can be parsed by your old code: old binaries simply ignore the new field when parsing."
35990 switch (wireType) {
35991 case ProtoBuf.WIRE_TYPES.VARINT:
35992 buffer.readVarint32();
35993 break;
35994 case ProtoBuf.WIRE_TYPES.BITS32:
35995 buffer.offset += 4;
35996 break;
35997 case ProtoBuf.WIRE_TYPES.BITS64:
35998 buffer.offset += 8;
35999 break;
36000 case ProtoBuf.WIRE_TYPES.LDELIM:
36001 var len = buffer.readVarint32();
36002 buffer.offset += len;
36003 break;
36004 case ProtoBuf.WIRE_TYPES.STARTGROUP:
36005 while (skipTillGroupEnd(id, buffer)) {}
36006 break;
36007 default:
36008 throw Error("Illegal wire type for unknown field "+id+" in "+this.toString(true)+"#decode: "+wireType);
36009 }
36010 continue;
36011 }
36012 if (field.repeated && !field.options["packed"]) {
36013 msg[field.name].push(field.decode(wireType, buffer));
36014 } else if (field.map) {
36015 var keyval = field.decode(wireType, buffer);
36016 msg[field.name].set(keyval[0], keyval[1]);
36017 } else {
36018 msg[field.name] = field.decode(wireType, buffer);
36019 if (field.oneof) { // Field is part of an OneOf (not a virtual OneOf field)
36020 var currentField = msg[field.oneof.name]; // Virtual field references currently set field
36021 if (currentField !== null && currentField !== field.name)
36022 msg[currentField] = null; // Clear currently set field
36023 msg[field.oneof.name] = field.name; // Point virtual field at this field
36024 }
36025 }
36026 }
36027
36028 // Check if all required fields are present and set default values for optional fields that are not
36029 for (var i=0, k=this._fields.length; i<k; ++i) {
36030 field = this._fields[i];
36031 if (msg[field.name] === null) {
36032 if (this.syntax === "proto3") { // Proto3 sets default values by specification
36033 msg[field.name] = field.defaultValue;
36034 } else if (field.required) {
36035 var err = Error("Missing at least one required field for " + this.toString(true) + ": " + field.name);
36036 err["decoded"] = msg; // Still expose what we got
36037 throw(err);
36038 } else if (ProtoBuf.populateDefaults && field.defaultValue !== null)
36039 msg[field.name] = field.defaultValue;
36040 }
36041 }
36042 return msg;
36043 };
36044
36045 /**
36046 * @alias ProtoBuf.Reflect.Message
36047 * @expose
36048 */
36049 Reflect.Message = Message;
36050
36051 /**
36052 * Constructs a new Message Field.
36053 * @exports ProtoBuf.Reflect.Message.Field
36054 * @param {!ProtoBuf.Builder} builder Builder reference
36055 * @param {!ProtoBuf.Reflect.Message} message Message reference
36056 * @param {string} rule Rule, one of requried, optional, repeated
36057 * @param {string?} keytype Key data type, if any.
36058 * @param {string} type Data type, e.g. int32
36059 * @param {string} name Field name
36060 * @param {number} id Unique field id
36061 * @param {Object.<string,*>=} options Options
36062 * @param {!ProtoBuf.Reflect.Message.OneOf=} oneof Enclosing OneOf
36063 * @param {string?} syntax The syntax level of this definition (e.g., proto3)
36064 * @constructor
36065 * @extends ProtoBuf.Reflect.T
36066 */
36067 var Field = function(builder, message, rule, keytype, type, name, id, options, oneof, syntax) {
36068 T.call(this, builder, message, name);
36069
36070 /**
36071 * @override
36072 */
36073 this.className = "Message.Field";
36074
36075 /**
36076 * Message field required flag.
36077 * @type {boolean}
36078 * @expose
36079 */
36080 this.required = rule === "required";
36081
36082 /**
36083 * Message field repeated flag.
36084 * @type {boolean}
36085 * @expose
36086 */
36087 this.repeated = rule === "repeated";
36088
36089 /**
36090 * Message field map flag.
36091 * @type {boolean}
36092 * @expose
36093 */
36094 this.map = rule === "map";
36095
36096 /**
36097 * Message field key type. Type reference string if unresolved, protobuf
36098 * type if resolved. Valid only if this.map === true, null otherwise.
36099 * @type {string|{name: string, wireType: number}|null}
36100 * @expose
36101 */
36102 this.keyType = keytype || null;
36103
36104 /**
36105 * Message field type. Type reference string if unresolved, protobuf type if
36106 * resolved. In a map field, this is the value type.
36107 * @type {string|{name: string, wireType: number}}
36108 * @expose
36109 */
36110 this.type = type;
36111
36112 /**
36113 * Resolved type reference inside the global namespace.
36114 * @type {ProtoBuf.Reflect.T|null}
36115 * @expose
36116 */
36117 this.resolvedType = null;
36118
36119 /**
36120 * Unique message field id.
36121 * @type {number}
36122 * @expose
36123 */
36124 this.id = id;
36125
36126 /**
36127 * Message field options.
36128 * @type {!Object.<string,*>}
36129 * @dict
36130 * @expose
36131 */
36132 this.options = options || {};
36133
36134 /**
36135 * Default value.
36136 * @type {*}
36137 * @expose
36138 */
36139 this.defaultValue = null;
36140
36141 /**
36142 * Enclosing OneOf.
36143 * @type {?ProtoBuf.Reflect.Message.OneOf}
36144 * @expose
36145 */
36146 this.oneof = oneof || null;
36147
36148 /**
36149 * Syntax level of this definition (e.g., proto3).
36150 * @type {string}
36151 * @expose
36152 */
36153 this.syntax = syntax || 'proto2';
36154
36155 /**
36156 * Original field name.
36157 * @type {string}
36158 * @expose
36159 */
36160 this.originalName = this.name; // Used to revert camelcase transformation on naming collisions
36161
36162 /**
36163 * Element implementation. Created in build() after types are resolved.
36164 * @type {ProtoBuf.Element}
36165 * @expose
36166 */
36167 this.element = null;
36168
36169 /**
36170 * Key element implementation, for map fields. Created in build() after
36171 * types are resolved.
36172 * @type {ProtoBuf.Element}
36173 * @expose
36174 */
36175 this.keyElement = null;
36176
36177 // Convert field names to camel case notation if the override is set
36178 if (this.builder.options['convertFieldsToCamelCase'] && !(this instanceof Message.ExtensionField))
36179 this.name = ProtoBuf.Util.toCamelCase(this.name);
36180 };
36181
36182 /**
36183 * @alias ProtoBuf.Reflect.Message.Field.prototype
36184 * @inner
36185 */
36186 var FieldPrototype = Field.prototype = Object.create(T.prototype);
36187
36188 /**
36189 * Builds the field.
36190 * @override
36191 * @expose
36192 */
36193 FieldPrototype.build = function() {
36194 this.element = new Element(this.type, this.resolvedType, false, this.syntax, this.name);
36195 if (this.map)
36196 this.keyElement = new Element(this.keyType, undefined, true, this.syntax, this.name);
36197
36198 // In proto3, fields do not have field presence, and every field is set to
36199 // its type's default value ("", 0, 0.0, or false).
36200 if (this.syntax === 'proto3' && !this.repeated && !this.map)
36201 this.defaultValue = Element.defaultFieldValue(this.type);
36202
36203 // Otherwise, default values are present when explicitly specified
36204 else if (typeof this.options['default'] !== 'undefined')
36205 this.defaultValue = this.verifyValue(this.options['default']);
36206 };
36207
36208 /**
36209 * Checks if the given value can be set for this field.
36210 * @param {*} value Value to check
36211 * @param {boolean=} skipRepeated Whether to skip the repeated value check or not. Defaults to false.
36212 * @return {*} Verified, maybe adjusted, value
36213 * @throws {Error} If the value cannot be set for this field
36214 * @expose
36215 */
36216 FieldPrototype.verifyValue = function(value, skipRepeated) {
36217 skipRepeated = skipRepeated || false;
36218 var self = this;
36219 function fail(val, msg) {
36220 throw Error("Illegal value for "+self.toString(true)+" of type "+self.type.name+": "+val+" ("+msg+")");
36221 }
36222 if (value === null) { // NULL values for optional fields
36223 if (this.required)
36224 fail(typeof value, "required");
36225 if (this.syntax === 'proto3' && this.type !== ProtoBuf.TYPES["message"])
36226 fail(typeof value, "proto3 field without field presence cannot be null");
36227 return null;
36228 }
36229 var i;
36230 if (this.repeated && !skipRepeated) { // Repeated values as arrays
36231 if (!Array.isArray(value))
36232 value = [value];
36233 var res = [];
36234 for (i=0; i<value.length; i++)
36235 res.push(this.element.verifyValue(value[i]));
36236 return res;
36237 }
36238 if (this.map && !skipRepeated) { // Map values as objects
36239 if (!(value instanceof ProtoBuf.Map)) {
36240 // If not already a Map, attempt to convert.
36241 if (!(value instanceof Object)) {
36242 fail(typeof value,
36243 "expected ProtoBuf.Map or raw object for map field");
36244 }
36245 return new ProtoBuf.Map(this, value);
36246 } else {
36247 return value;
36248 }
36249 }
36250 // All non-repeated fields expect no array
36251 if (!this.repeated && Array.isArray(value))
36252 fail(typeof value, "no array expected");
36253
36254 return this.element.verifyValue(value);
36255 };
36256
36257 /**
36258 * Determines whether the field will have a presence on the wire given its
36259 * value.
36260 * @param {*} value Verified field value
36261 * @param {!ProtoBuf.Builder.Message} message Runtime message
36262 * @return {boolean} Whether the field will be present on the wire
36263 */
36264 FieldPrototype.hasWirePresence = function(value, message) {
36265 if (this.syntax !== 'proto3')
36266 return (value !== null);
36267 if (this.oneof && message[this.oneof.name] === this.name)
36268 return true;
36269 switch (this.type) {
36270 case ProtoBuf.TYPES["int32"]:
36271 case ProtoBuf.TYPES["sint32"]:
36272 case ProtoBuf.TYPES["sfixed32"]:
36273 case ProtoBuf.TYPES["uint32"]:
36274 case ProtoBuf.TYPES["fixed32"]:
36275 return value !== 0;
36276
36277 case ProtoBuf.TYPES["int64"]:
36278 case ProtoBuf.TYPES["sint64"]:
36279 case ProtoBuf.TYPES["sfixed64"]:
36280 case ProtoBuf.TYPES["uint64"]:
36281 case ProtoBuf.TYPES["fixed64"]:
36282 return value.low !== 0 || value.high !== 0;
36283
36284 case ProtoBuf.TYPES["bool"]:
36285 return value;
36286
36287 case ProtoBuf.TYPES["float"]:
36288 case ProtoBuf.TYPES["double"]:
36289 return value !== 0.0;
36290
36291 case ProtoBuf.TYPES["string"]:
36292 return value.length > 0;
36293
36294 case ProtoBuf.TYPES["bytes"]:
36295 return value.remaining() > 0;
36296
36297 case ProtoBuf.TYPES["enum"]:
36298 return value !== 0;
36299
36300 case ProtoBuf.TYPES["message"]:
36301 return value !== null;
36302 default:
36303 return true;
36304 }
36305 };
36306
36307 /**
36308 * Encodes the specified field value to the specified buffer.
36309 * @param {*} value Verified field value
36310 * @param {ByteBuffer} buffer ByteBuffer to encode to
36311 * @param {!ProtoBuf.Builder.Message} message Runtime message
36312 * @return {ByteBuffer} The ByteBuffer for chaining
36313 * @throws {Error} If the field cannot be encoded
36314 * @expose
36315 */
36316 FieldPrototype.encode = function(value, buffer, message) {
36317 if (this.type === null || typeof this.type !== 'object')
36318 throw Error("[INTERNAL] Unresolved type in "+this.toString(true)+": "+this.type);
36319 if (value === null || (this.repeated && value.length == 0))
36320 return buffer; // Optional omitted
36321 try {
36322 if (this.repeated) {
36323 var i;
36324 // "Only repeated fields of primitive numeric types (types which use the varint, 32-bit, or 64-bit wire
36325 // types) can be declared 'packed'."
36326 if (this.options["packed"] && ProtoBuf.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType) >= 0) {
36327 // "All of the elements of the field are packed into a single key-value pair with wire type 2
36328 // (length-delimited). Each element is encoded the same way it would be normally, except without a
36329 // tag preceding it."
36330 buffer.writeVarint32((this.id << 3) | ProtoBuf.WIRE_TYPES.LDELIM);
36331 buffer.ensureCapacity(buffer.offset += 1); // We do not know the length yet, so let's assume a varint of length 1
36332 var start = buffer.offset; // Remember where the contents begin
36333 for (i=0; i<value.length; i++)
36334 this.element.encodeValue(this.id, value[i], buffer);
36335 var len = buffer.offset-start,
36336 varintLen = ByteBuffer.calculateVarint32(len);
36337 if (varintLen > 1) { // We need to move the contents
36338 var contents = buffer.slice(start, buffer.offset);
36339 start += varintLen-1;
36340 buffer.offset = start;
36341 buffer.append(contents);
36342 }
36343 buffer.writeVarint32(len, start-varintLen);
36344 } else {
36345 // "If your message definition has repeated elements (without the [packed=true] option), the encoded
36346 // message has zero or more key-value pairs with the same tag number"
36347 for (i=0; i<value.length; i++)
36348 buffer.writeVarint32((this.id << 3) | this.type.wireType),
36349 this.element.encodeValue(this.id, value[i], buffer);
36350 }
36351 } else if (this.map) {
36352 // Write out each map entry as a submessage.
36353 value.forEach(function(val, key, m) {
36354 // Compute the length of the submessage (key, val) pair.
36355 var length =
36356 ByteBuffer.calculateVarint32((1 << 3) | this.keyType.wireType) +
36357 this.keyElement.calculateLength(1, key) +
36358 ByteBuffer.calculateVarint32((2 << 3) | this.type.wireType) +
36359 this.element.calculateLength(2, val);
36360
36361 // Submessage with wire type of length-delimited.
36362 buffer.writeVarint32((this.id << 3) | ProtoBuf.WIRE_TYPES.LDELIM);
36363 buffer.writeVarint32(length);
36364
36365 // Write out the key and val.
36366 buffer.writeVarint32((1 << 3) | this.keyType.wireType);
36367 this.keyElement.encodeValue(1, key, buffer);
36368 buffer.writeVarint32((2 << 3) | this.type.wireType);
36369 this.element.encodeValue(2, val, buffer);
36370 }, this);
36371 } else {
36372 if (this.hasWirePresence(value, message)) {
36373 buffer.writeVarint32((this.id << 3) | this.type.wireType);
36374 this.element.encodeValue(this.id, value, buffer);
36375 }
36376 }
36377 } catch (e) {
36378 throw Error("Illegal value for "+this.toString(true)+": "+value+" ("+e+")");
36379 }
36380 return buffer;
36381 };
36382
36383 /**
36384 * Calculates the length of this field's value on the network level.
36385 * @param {*} value Field value
36386 * @param {!ProtoBuf.Builder.Message} message Runtime message
36387 * @returns {number} Byte length
36388 * @expose
36389 */
36390 FieldPrototype.calculate = function(value, message) {
36391 value = this.verifyValue(value); // May throw
36392 if (this.type === null || typeof this.type !== 'object')
36393 throw Error("[INTERNAL] Unresolved type in "+this.toString(true)+": "+this.type);
36394 if (value === null || (this.repeated && value.length == 0))
36395 return 0; // Optional omitted
36396 var n = 0;
36397 try {
36398 if (this.repeated) {
36399 var i, ni;
36400 if (this.options["packed"] && ProtoBuf.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType) >= 0) {
36401 n += ByteBuffer.calculateVarint32((this.id << 3) | ProtoBuf.WIRE_TYPES.LDELIM);
36402 ni = 0;
36403 for (i=0; i<value.length; i++)
36404 ni += this.element.calculateLength(this.id, value[i]);
36405 n += ByteBuffer.calculateVarint32(ni);
36406 n += ni;
36407 } else {
36408 for (i=0; i<value.length; i++)
36409 n += ByteBuffer.calculateVarint32((this.id << 3) | this.type.wireType),
36410 n += this.element.calculateLength(this.id, value[i]);
36411 }
36412 } else if (this.map) {
36413 // Each map entry becomes a submessage.
36414 value.forEach(function(val, key, m) {
36415 // Compute the length of the submessage (key, val) pair.
36416 var length =
36417 ByteBuffer.calculateVarint32((1 << 3) | this.keyType.wireType) +
36418 this.keyElement.calculateLength(1, key) +
36419 ByteBuffer.calculateVarint32((2 << 3) | this.type.wireType) +
36420 this.element.calculateLength(2, val);
36421
36422 n += ByteBuffer.calculateVarint32((this.id << 3) | ProtoBuf.WIRE_TYPES.LDELIM);
36423 n += ByteBuffer.calculateVarint32(length);
36424 n += length;
36425 }, this);
36426 } else {
36427 if (this.hasWirePresence(value, message)) {
36428 n += ByteBuffer.calculateVarint32((this.id << 3) | this.type.wireType);
36429 n += this.element.calculateLength(this.id, value);
36430 }
36431 }
36432 } catch (e) {
36433 throw Error("Illegal value for "+this.toString(true)+": "+value+" ("+e+")");
36434 }
36435 return n;
36436 };
36437
36438 /**
36439 * Decode the field value from the specified buffer.
36440 * @param {number} wireType Leading wire type
36441 * @param {ByteBuffer} buffer ByteBuffer to decode from
36442 * @param {boolean=} skipRepeated Whether to skip the repeated check or not. Defaults to false.
36443 * @return {*} Decoded value: array for packed repeated fields, [key, value] for
36444 * map fields, or an individual value otherwise.
36445 * @throws {Error} If the field cannot be decoded
36446 * @expose
36447 */
36448 FieldPrototype.decode = function(wireType, buffer, skipRepeated) {
36449 var value, nBytes;
36450
36451 // We expect wireType to match the underlying type's wireType unless we see
36452 // a packed repeated field, or unless this is a map field.
36453 var wireTypeOK =
36454 (!this.map && wireType == this.type.wireType) ||
36455 (!skipRepeated && this.repeated && this.options["packed"] &&
36456 wireType == ProtoBuf.WIRE_TYPES.LDELIM) ||
36457 (this.map && wireType == ProtoBuf.WIRE_TYPES.LDELIM);
36458 if (!wireTypeOK)
36459 throw Error("Illegal wire type for field "+this.toString(true)+": "+wireType+" ("+this.type.wireType+" expected)");
36460
36461 // Handle packed repeated fields.
36462 if (wireType == ProtoBuf.WIRE_TYPES.LDELIM && this.repeated && this.options["packed"] && ProtoBuf.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType) >= 0) {
36463 if (!skipRepeated) {
36464 nBytes = buffer.readVarint32();
36465 nBytes = buffer.offset + nBytes; // Limit
36466 var values = [];
36467 while (buffer.offset < nBytes)
36468 values.push(this.decode(this.type.wireType, buffer, true));
36469 return values;
36470 }
36471 // Read the next value otherwise...
36472 }
36473
36474 // Handle maps.
36475 if (this.map) {
36476 // Read one (key, value) submessage, and return [key, value]
36477 var key = Element.defaultFieldValue(this.keyType);
36478 value = Element.defaultFieldValue(this.type);
36479
36480 // Read the length
36481 nBytes = buffer.readVarint32();
36482 if (buffer.remaining() < nBytes)
36483 throw Error("Illegal number of bytes for "+this.toString(true)+": "+nBytes+" required but got only "+buffer.remaining());
36484
36485 // Get a sub-buffer of this key/value submessage
36486 var msgbuf = buffer.clone();
36487 msgbuf.limit = msgbuf.offset + nBytes;
36488 buffer.offset += nBytes;
36489
36490 while (msgbuf.remaining() > 0) {
36491 var tag = msgbuf.readVarint32();
36492 wireType = tag & 0x07;
36493 var id = tag >>> 3;
36494 if (id === 1) {
36495 key = this.keyElement.decode(msgbuf, wireType, id);
36496 } else if (id === 2) {
36497 value = this.element.decode(msgbuf, wireType, id);
36498 } else {
36499 throw Error("Unexpected tag in map field key/value submessage");
36500 }
36501 }
36502
36503 return [key, value];
36504 }
36505
36506 // Handle singular and non-packed repeated field values.
36507 return this.element.decode(buffer, wireType, this.id);
36508 };
36509
36510 /**
36511 * @alias ProtoBuf.Reflect.Message.Field
36512 * @expose
36513 */
36514 Reflect.Message.Field = Field;
36515
36516 /**
36517 * Constructs a new Message ExtensionField.
36518 * @exports ProtoBuf.Reflect.Message.ExtensionField
36519 * @param {!ProtoBuf.Builder} builder Builder reference
36520 * @param {!ProtoBuf.Reflect.Message} message Message reference
36521 * @param {string} rule Rule, one of requried, optional, repeated
36522 * @param {string} type Data type, e.g. int32
36523 * @param {string} name Field name
36524 * @param {number} id Unique field id
36525 * @param {!Object.<string,*>=} options Options
36526 * @constructor
36527 * @extends ProtoBuf.Reflect.Message.Field
36528 */
36529 var ExtensionField = function(builder, message, rule, type, name, id, options) {
36530 Field.call(this, builder, message, rule, /* keytype = */ null, type, name, id, options);
36531
36532 /**
36533 * Extension reference.
36534 * @type {!ProtoBuf.Reflect.Extension}
36535 * @expose
36536 */
36537 this.extension;
36538 };
36539
36540 // Extends Field
36541 ExtensionField.prototype = Object.create(Field.prototype);
36542
36543 /**
36544 * @alias ProtoBuf.Reflect.Message.ExtensionField
36545 * @expose
36546 */
36547 Reflect.Message.ExtensionField = ExtensionField;
36548
36549 /**
36550 * Constructs a new Message OneOf.
36551 * @exports ProtoBuf.Reflect.Message.OneOf
36552 * @param {!ProtoBuf.Builder} builder Builder reference
36553 * @param {!ProtoBuf.Reflect.Message} message Message reference
36554 * @param {string} name OneOf name
36555 * @constructor
36556 * @extends ProtoBuf.Reflect.T
36557 */
36558 var OneOf = function(builder, message, name) {
36559 T.call(this, builder, message, name);
36560
36561 /**
36562 * Enclosed fields.
36563 * @type {!Array.<!ProtoBuf.Reflect.Message.Field>}
36564 * @expose
36565 */
36566 this.fields = [];
36567 };
36568
36569 /**
36570 * @alias ProtoBuf.Reflect.Message.OneOf
36571 * @expose
36572 */
36573 Reflect.Message.OneOf = OneOf;
36574
36575 /**
36576 * Constructs a new Enum.
36577 * @exports ProtoBuf.Reflect.Enum
36578 * @param {!ProtoBuf.Builder} builder Builder reference
36579 * @param {!ProtoBuf.Reflect.T} parent Parent Reflect object
36580 * @param {string} name Enum name
36581 * @param {Object.<string,*>=} options Enum options
36582 * @param {string?} syntax The syntax level (e.g., proto3)
36583 * @constructor
36584 * @extends ProtoBuf.Reflect.Namespace
36585 */
36586 var Enum = function(builder, parent, name, options, syntax) {
36587 Namespace.call(this, builder, parent, name, options, syntax);
36588
36589 /**
36590 * @override
36591 */
36592 this.className = "Enum";
36593
36594 /**
36595 * Runtime enum object.
36596 * @type {Object.<string,number>|null}
36597 * @expose
36598 */
36599 this.object = null;
36600 };
36601
36602 /**
36603 * Gets the string name of an enum value.
36604 * @param {!ProtoBuf.Builder.Enum} enm Runtime enum
36605 * @param {number} value Enum value
36606 * @returns {?string} Name or `null` if not present
36607 * @expose
36608 */
36609 Enum.getName = function(enm, value) {
36610 var keys = Object.keys(enm);
36611 for (var i=0, key; i<keys.length; ++i)
36612 if (enm[key = keys[i]] === value)
36613 return key;
36614 return null;
36615 };
36616
36617 /**
36618 * @alias ProtoBuf.Reflect.Enum.prototype
36619 * @inner
36620 */
36621 var EnumPrototype = Enum.prototype = Object.create(Namespace.prototype);
36622
36623 /**
36624 * Builds this enum and returns the runtime counterpart.
36625 * @param {boolean} rebuild Whether to rebuild or not, defaults to false
36626 * @returns {!Object.<string,number>}
36627 * @expose
36628 */
36629 EnumPrototype.build = function(rebuild) {
36630 if (this.object && !rebuild)
36631 return this.object;
36632 var enm = new ProtoBuf.Builder.Enum(),
36633 values = this.getChildren(Enum.Value);
36634 for (var i=0, k=values.length; i<k; ++i)
36635 enm[values[i]['name']] = values[i]['id'];
36636 if (Object.defineProperty)
36637 Object.defineProperty(enm, '$options', {
36638 "value": this.buildOpt(),
36639 "enumerable": false
36640 });
36641 return this.object = enm;
36642 };
36643
36644 /**
36645 * @alias ProtoBuf.Reflect.Enum
36646 * @expose
36647 */
36648 Reflect.Enum = Enum;
36649
36650 /**
36651 * Constructs a new Enum Value.
36652 * @exports ProtoBuf.Reflect.Enum.Value
36653 * @param {!ProtoBuf.Builder} builder Builder reference
36654 * @param {!ProtoBuf.Reflect.Enum} enm Enum reference
36655 * @param {string} name Field name
36656 * @param {number} id Unique field id
36657 * @constructor
36658 * @extends ProtoBuf.Reflect.T
36659 */
36660 var Value = function(builder, enm, name, id) {
36661 T.call(this, builder, enm, name);
36662
36663 /**
36664 * @override
36665 */
36666 this.className = "Enum.Value";
36667
36668 /**
36669 * Unique enum value id.
36670 * @type {number}
36671 * @expose
36672 */
36673 this.id = id;
36674 };
36675
36676 // Extends T
36677 Value.prototype = Object.create(T.prototype);
36678
36679 /**
36680 * @alias ProtoBuf.Reflect.Enum.Value
36681 * @expose
36682 */
36683 Reflect.Enum.Value = Value;
36684
36685 /**
36686 * An extension (field).
36687 * @exports ProtoBuf.Reflect.Extension
36688 * @constructor
36689 * @param {!ProtoBuf.Builder} builder Builder reference
36690 * @param {!ProtoBuf.Reflect.T} parent Parent object
36691 * @param {string} name Object name
36692 * @param {!ProtoBuf.Reflect.Message.Field} field Extension field
36693 */
36694 var Extension = function(builder, parent, name, field) {
36695 T.call(this, builder, parent, name);
36696
36697 /**
36698 * Extended message field.
36699 * @type {!ProtoBuf.Reflect.Message.Field}
36700 * @expose
36701 */
36702 this.field = field;
36703 };
36704
36705 // Extends T
36706 Extension.prototype = Object.create(T.prototype);
36707
36708 /**
36709 * @alias ProtoBuf.Reflect.Extension
36710 * @expose
36711 */
36712 Reflect.Extension = Extension;
36713
36714 /**
36715 * Constructs a new Service.
36716 * @exports ProtoBuf.Reflect.Service
36717 * @param {!ProtoBuf.Builder} builder Builder reference
36718 * @param {!ProtoBuf.Reflect.Namespace} root Root
36719 * @param {string} name Service name
36720 * @param {Object.<string,*>=} options Options
36721 * @constructor
36722 * @extends ProtoBuf.Reflect.Namespace
36723 */
36724 var Service = function(builder, root, name, options) {
36725 Namespace.call(this, builder, root, name, options);
36726
36727 /**
36728 * @override
36729 */
36730 this.className = "Service";
36731
36732 /**
36733 * Built runtime service class.
36734 * @type {?function(new:ProtoBuf.Builder.Service)}
36735 */
36736 this.clazz = null;
36737 };
36738
36739 /**
36740 * @alias ProtoBuf.Reflect.Service.prototype
36741 * @inner
36742 */
36743 var ServicePrototype = Service.prototype = Object.create(Namespace.prototype);
36744
36745 /**
36746 * Builds the service and returns the runtime counterpart, which is a fully functional class.
36747 * @see ProtoBuf.Builder.Service
36748 * @param {boolean=} rebuild Whether to rebuild or not
36749 * @return {Function} Service class
36750 * @throws {Error} If the message cannot be built
36751 * @expose
36752 */
36753 ServicePrototype.build = function(rebuild) {
36754 if (this.clazz && !rebuild)
36755 return this.clazz;
36756
36757 // Create the runtime Service class in its own scope
36758 return this.clazz = (function(ProtoBuf, T) {
36759
36760 /**
36761 * Constructs a new runtime Service.
36762 * @name ProtoBuf.Builder.Service
36763 * @param {function(string, ProtoBuf.Builder.Message, function(Error, ProtoBuf.Builder.Message=))=} rpcImpl RPC implementation receiving the method name and the message
36764 * @class Barebone of all runtime services.
36765 * @constructor
36766 * @throws {Error} If the service cannot be created
36767 */
36768 var Service = function(rpcImpl) {
36769 ProtoBuf.Builder.Service.call(this);
36770
36771 /**
36772 * Service implementation.
36773 * @name ProtoBuf.Builder.Service#rpcImpl
36774 * @type {!function(string, ProtoBuf.Builder.Message, function(Error, ProtoBuf.Builder.Message=))}
36775 * @expose
36776 */
36777 this.rpcImpl = rpcImpl || function(name, msg, callback) {
36778 // This is what a user has to implement: A function receiving the method name, the actual message to
36779 // send (type checked) and the callback that's either provided with the error as its first
36780 // argument or null and the actual response message.
36781 setTimeout(callback.bind(this, Error("Not implemented, see: https://github.com/dcodeIO/ProtoBuf.js/wiki/Services")), 0); // Must be async!
36782 };
36783 };
36784
36785 /**
36786 * @alias ProtoBuf.Builder.Service.prototype
36787 * @inner
36788 */
36789 var ServicePrototype = Service.prototype = Object.create(ProtoBuf.Builder.Service.prototype);
36790
36791 /**
36792 * Asynchronously performs an RPC call using the given RPC implementation.
36793 * @name ProtoBuf.Builder.Service.[Method]
36794 * @function
36795 * @param {!function(string, ProtoBuf.Builder.Message, function(Error, ProtoBuf.Builder.Message=))} rpcImpl RPC implementation
36796 * @param {ProtoBuf.Builder.Message} req Request
36797 * @param {function(Error, (ProtoBuf.Builder.Message|ByteBuffer|Buffer|string)=)} callback Callback receiving
36798 * the error if any and the response either as a pre-parsed message or as its raw bytes
36799 * @abstract
36800 */
36801
36802 /**
36803 * Asynchronously performs an RPC call using the instance's RPC implementation.
36804 * @name ProtoBuf.Builder.Service#[Method]
36805 * @function
36806 * @param {ProtoBuf.Builder.Message} req Request
36807 * @param {function(Error, (ProtoBuf.Builder.Message|ByteBuffer|Buffer|string)=)} callback Callback receiving
36808 * the error if any and the response either as a pre-parsed message or as its raw bytes
36809 * @abstract
36810 */
36811
36812 var rpc = T.getChildren(ProtoBuf.Reflect.Service.RPCMethod);
36813 for (var i=0; i<rpc.length; i++) {
36814 (function(method) {
36815
36816 // service#Method(message, callback)
36817 ServicePrototype[method.name] = function(req, callback) {
36818 try {
36819 try {
36820 // If given as a buffer, decode the request. Will throw a TypeError if not a valid buffer.
36821 req = method.resolvedRequestType.clazz.decode(ByteBuffer.wrap(req));
36822 } catch (err) {
36823 if (!(err instanceof TypeError))
36824 throw err;
36825 }
36826 if (req === null || typeof req !== 'object')
36827 throw Error("Illegal arguments");
36828 if (!(req instanceof method.resolvedRequestType.clazz))
36829 req = new method.resolvedRequestType.clazz(req);
36830 this.rpcImpl(method.fqn(), req, function(err, res) { // Assumes that this is properly async
36831 if (err) {
36832 callback(err);
36833 return;
36834 }
36835 // Coalesce to empty string when service response has empty content
36836 if (res === null)
36837 res = ''
36838 try { res = method.resolvedResponseType.clazz.decode(res); } catch (notABuffer) {}
36839 if (!res || !(res instanceof method.resolvedResponseType.clazz)) {
36840 callback(Error("Illegal response type received in service method "+ T.name+"#"+method.name));
36841 return;
36842 }
36843 callback(null, res);
36844 });
36845 } catch (err) {
36846 setTimeout(callback.bind(this, err), 0);
36847 }
36848 };
36849
36850 // Service.Method(rpcImpl, message, callback)
36851 Service[method.name] = function(rpcImpl, req, callback) {
36852 new Service(rpcImpl)[method.name](req, callback);
36853 };
36854
36855 if (Object.defineProperty)
36856 Object.defineProperty(Service[method.name], "$options", { "value": method.buildOpt() }),
36857 Object.defineProperty(ServicePrototype[method.name], "$options", { "value": Service[method.name]["$options"] });
36858 })(rpc[i]);
36859 }
36860
36861 // Properties
36862
36863 /**
36864 * Service options.
36865 * @name ProtoBuf.Builder.Service.$options
36866 * @type {Object.<string,*>}
36867 * @expose
36868 */
36869 var $optionsS; // cc needs this
36870
36871 /**
36872 * Service options.
36873 * @name ProtoBuf.Builder.Service#$options
36874 * @type {Object.<string,*>}
36875 * @expose
36876 */
36877 var $options;
36878
36879 /**
36880 * Reflection type.
36881 * @name ProtoBuf.Builder.Service.$type
36882 * @type {!ProtoBuf.Reflect.Service}
36883 * @expose
36884 */
36885 var $typeS;
36886
36887 /**
36888 * Reflection type.
36889 * @name ProtoBuf.Builder.Service#$type
36890 * @type {!ProtoBuf.Reflect.Service}
36891 * @expose
36892 */
36893 var $type;
36894
36895 if (Object.defineProperty)
36896 Object.defineProperty(Service, "$options", { "value": T.buildOpt() }),
36897 Object.defineProperty(ServicePrototype, "$options", { "value": Service["$options"] }),
36898 Object.defineProperty(Service, "$type", { "value": T }),
36899 Object.defineProperty(ServicePrototype, "$type", { "value": T });
36900
36901 return Service;
36902
36903 })(ProtoBuf, this);
36904 };
36905
36906 /**
36907 * @alias ProtoBuf.Reflect.Service
36908 * @expose
36909 */
36910 Reflect.Service = Service;
36911
36912 /**
36913 * Abstract service method.
36914 * @exports ProtoBuf.Reflect.Service.Method
36915 * @param {!ProtoBuf.Builder} builder Builder reference
36916 * @param {!ProtoBuf.Reflect.Service} svc Service
36917 * @param {string} name Method name
36918 * @param {Object.<string,*>=} options Options
36919 * @constructor
36920 * @extends ProtoBuf.Reflect.T
36921 */
36922 var Method = function(builder, svc, name, options) {
36923 T.call(this, builder, svc, name);
36924
36925 /**
36926 * @override
36927 */
36928 this.className = "Service.Method";
36929
36930 /**
36931 * Options.
36932 * @type {Object.<string, *>}
36933 * @expose
36934 */
36935 this.options = options || {};
36936 };
36937
36938 /**
36939 * @alias ProtoBuf.Reflect.Service.Method.prototype
36940 * @inner
36941 */
36942 var MethodPrototype = Method.prototype = Object.create(T.prototype);
36943
36944 /**
36945 * Builds the method's '$options' property.
36946 * @name ProtoBuf.Reflect.Service.Method#buildOpt
36947 * @function
36948 * @return {Object.<string,*>}
36949 */
36950 MethodPrototype.buildOpt = NamespacePrototype.buildOpt;
36951
36952 /**
36953 * @alias ProtoBuf.Reflect.Service.Method
36954 * @expose
36955 */
36956 Reflect.Service.Method = Method;
36957
36958 /**
36959 * RPC service method.
36960 * @exports ProtoBuf.Reflect.Service.RPCMethod
36961 * @param {!ProtoBuf.Builder} builder Builder reference
36962 * @param {!ProtoBuf.Reflect.Service} svc Service
36963 * @param {string} name Method name
36964 * @param {string} request Request message name
36965 * @param {string} response Response message name
36966 * @param {boolean} request_stream Whether requests are streamed
36967 * @param {boolean} response_stream Whether responses are streamed
36968 * @param {Object.<string,*>=} options Options
36969 * @constructor
36970 * @extends ProtoBuf.Reflect.Service.Method
36971 */
36972 var RPCMethod = function(builder, svc, name, request, response, request_stream, response_stream, options) {
36973 Method.call(this, builder, svc, name, options);
36974
36975 /**
36976 * @override
36977 */
36978 this.className = "Service.RPCMethod";
36979
36980 /**
36981 * Request message name.
36982 * @type {string}
36983 * @expose
36984 */
36985 this.requestName = request;
36986
36987 /**
36988 * Response message name.
36989 * @type {string}
36990 * @expose
36991 */
36992 this.responseName = response;
36993
36994 /**
36995 * Whether requests are streamed
36996 * @type {bool}
36997 * @expose
36998 */
36999 this.requestStream = request_stream;
37000
37001 /**
37002 * Whether responses are streamed
37003 * @type {bool}
37004 * @expose
37005 */
37006 this.responseStream = response_stream;
37007
37008 /**
37009 * Resolved request message type.
37010 * @type {ProtoBuf.Reflect.Message}
37011 * @expose
37012 */
37013 this.resolvedRequestType = null;
37014
37015 /**
37016 * Resolved response message type.
37017 * @type {ProtoBuf.Reflect.Message}
37018 * @expose
37019 */
37020 this.resolvedResponseType = null;
37021 };
37022
37023 // Extends Method
37024 RPCMethod.prototype = Object.create(Method.prototype);
37025
37026 /**
37027 * @alias ProtoBuf.Reflect.Service.RPCMethod
37028 * @expose
37029 */
37030 Reflect.Service.RPCMethod = RPCMethod;
37031
37032 return Reflect;
37033
37034 })(ProtoBuf);
37035
37036 /**
37037 * @alias ProtoBuf.Builder
37038 * @expose
37039 */
37040 ProtoBuf.Builder = (function(ProtoBuf, Lang, Reflect) {
37041 "use strict";
37042
37043 /**
37044 * Constructs a new Builder.
37045 * @exports ProtoBuf.Builder
37046 * @class Provides the functionality to build protocol messages.
37047 * @param {Object.<string,*>=} options Options
37048 * @constructor
37049 */
37050 var Builder = function(options) {
37051
37052 /**
37053 * Namespace.
37054 * @type {ProtoBuf.Reflect.Namespace}
37055 * @expose
37056 */
37057 this.ns = new Reflect.Namespace(this, null, ""); // Global namespace
37058
37059 /**
37060 * Namespace pointer.
37061 * @type {ProtoBuf.Reflect.T}
37062 * @expose
37063 */
37064 this.ptr = this.ns;
37065
37066 /**
37067 * Resolved flag.
37068 * @type {boolean}
37069 * @expose
37070 */
37071 this.resolved = false;
37072
37073 /**
37074 * The current building result.
37075 * @type {Object.<string,ProtoBuf.Builder.Message|Object>|null}
37076 * @expose
37077 */
37078 this.result = null;
37079
37080 /**
37081 * Imported files.
37082 * @type {Array.<string>}
37083 * @expose
37084 */
37085 this.files = {};
37086
37087 /**
37088 * Import root override.
37089 * @type {?string}
37090 * @expose
37091 */
37092 this.importRoot = null;
37093
37094 /**
37095 * Options.
37096 * @type {!Object.<string, *>}
37097 * @expose
37098 */
37099 this.options = options || {};
37100 };
37101
37102 /**
37103 * @alias ProtoBuf.Builder.prototype
37104 * @inner
37105 */
37106 var BuilderPrototype = Builder.prototype;
37107
37108 // ----- Definition tests -----
37109
37110 /**
37111 * Tests if a definition most likely describes a message.
37112 * @param {!Object} def
37113 * @returns {boolean}
37114 * @expose
37115 */
37116 Builder.isMessage = function(def) {
37117 // Messages require a string name
37118 if (typeof def["name"] !== 'string')
37119 return false;
37120 // Messages do not contain values (enum) or rpc methods (service)
37121 if (typeof def["values"] !== 'undefined' || typeof def["rpc"] !== 'undefined')
37122 return false;
37123 return true;
37124 };
37125
37126 /**
37127 * Tests if a definition most likely describes a message field.
37128 * @param {!Object} def
37129 * @returns {boolean}
37130 * @expose
37131 */
37132 Builder.isMessageField = function(def) {
37133 // Message fields require a string rule, name and type and an id
37134 if (typeof def["rule"] !== 'string' || typeof def["name"] !== 'string' || typeof def["type"] !== 'string' || typeof def["id"] === 'undefined')
37135 return false;
37136 return true;
37137 };
37138
37139 /**
37140 * Tests if a definition most likely describes an enum.
37141 * @param {!Object} def
37142 * @returns {boolean}
37143 * @expose
37144 */
37145 Builder.isEnum = function(def) {
37146 // Enums require a string name
37147 if (typeof def["name"] !== 'string')
37148 return false;
37149 // Enums require at least one value
37150 if (typeof def["values"] === 'undefined' || !Array.isArray(def["values"]) || def["values"].length === 0)
37151 return false;
37152 return true;
37153 };
37154
37155 /**
37156 * Tests if a definition most likely describes a service.
37157 * @param {!Object} def
37158 * @returns {boolean}
37159 * @expose
37160 */
37161 Builder.isService = function(def) {
37162 // Services require a string name and an rpc object
37163 if (typeof def["name"] !== 'string' || typeof def["rpc"] !== 'object' || !def["rpc"])
37164 return false;
37165 return true;
37166 };
37167
37168 /**
37169 * Tests if a definition most likely describes an extended message
37170 * @param {!Object} def
37171 * @returns {boolean}
37172 * @expose
37173 */
37174 Builder.isExtend = function(def) {
37175 // Extends rquire a string ref
37176 if (typeof def["ref"] !== 'string')
37177 return false;
37178 return true;
37179 };
37180
37181 // ----- Building -----
37182
37183 /**
37184 * Resets the pointer to the root namespace.
37185 * @returns {!ProtoBuf.Builder} this
37186 * @expose
37187 */
37188 BuilderPrototype.reset = function() {
37189 this.ptr = this.ns;
37190 return this;
37191 };
37192
37193 /**
37194 * Defines a namespace on top of the current pointer position and places the pointer on it.
37195 * @param {string} namespace
37196 * @return {!ProtoBuf.Builder} this
37197 * @expose
37198 */
37199 BuilderPrototype.define = function(namespace) {
37200 if (typeof namespace !== 'string' || !Lang.TYPEREF.test(namespace))
37201 throw Error("illegal namespace: "+namespace);
37202 namespace.split(".").forEach(function(part) {
37203 var ns = this.ptr.getChild(part);
37204 if (ns === null) // Keep existing
37205 this.ptr.addChild(ns = new Reflect.Namespace(this, this.ptr, part));
37206 this.ptr = ns;
37207 }, this);
37208 return this;
37209 };
37210
37211 /**
37212 * Creates the specified definitions at the current pointer position.
37213 * @param {!Array.<!Object>} defs Messages, enums or services to create
37214 * @returns {!ProtoBuf.Builder} this
37215 * @throws {Error} If a message definition is invalid
37216 * @expose
37217 */
37218 BuilderPrototype.create = function(defs) {
37219 if (!defs)
37220 return this; // Nothing to create
37221 if (!Array.isArray(defs))
37222 defs = [defs];
37223 else {
37224 if (defs.length === 0)
37225 return this;
37226 defs = defs.slice();
37227 }
37228
37229 // It's quite hard to keep track of scopes and memory here, so let's do this iteratively.
37230 var stack = [defs];
37231 while (stack.length > 0) {
37232 defs = stack.pop();
37233
37234 if (!Array.isArray(defs)) // Stack always contains entire namespaces
37235 throw Error("not a valid namespace: "+JSON.stringify(defs));
37236
37237 while (defs.length > 0) {
37238 var def = defs.shift(); // Namespaces always contain an array of messages, enums and services
37239
37240 if (Builder.isMessage(def)) {
37241 var obj = new Reflect.Message(this, this.ptr, def["name"], def["options"], def["isGroup"], def["syntax"]);
37242
37243 // Create OneOfs
37244 var oneofs = {};
37245 if (def["oneofs"])
37246 Object.keys(def["oneofs"]).forEach(function(name) {
37247 obj.addChild(oneofs[name] = new Reflect.Message.OneOf(this, obj, name));
37248 }, this);
37249
37250 // Create fields
37251 if (def["fields"])
37252 def["fields"].forEach(function(fld) {
37253 if (obj.getChild(fld["id"]|0) !== null)
37254 throw Error("duplicate or invalid field id in "+obj.name+": "+fld['id']);
37255 if (fld["options"] && typeof fld["options"] !== 'object')
37256 throw Error("illegal field options in "+obj.name+"#"+fld["name"]);
37257 var oneof = null;
37258 if (typeof fld["oneof"] === 'string' && !(oneof = oneofs[fld["oneof"]]))
37259 throw Error("illegal oneof in "+obj.name+"#"+fld["name"]+": "+fld["oneof"]);
37260 fld = new Reflect.Message.Field(this, obj, fld["rule"], fld["keytype"], fld["type"], fld["name"], fld["id"], fld["options"], oneof, def["syntax"]);
37261 if (oneof)
37262 oneof.fields.push(fld);
37263 obj.addChild(fld);
37264 }, this);
37265
37266 // Push children to stack
37267 var subObj = [];
37268 if (def["enums"])
37269 def["enums"].forEach(function(enm) {
37270 subObj.push(enm);
37271 });
37272 if (def["messages"])
37273 def["messages"].forEach(function(msg) {
37274 subObj.push(msg);
37275 });
37276 if (def["services"])
37277 def["services"].forEach(function(svc) {
37278 subObj.push(svc);
37279 });
37280
37281 // Set extension ranges
37282 if (def["extensions"]) {
37283 if (typeof def["extensions"][0] === 'number') // pre 5.0.1
37284 obj.extensions = [ def["extensions"] ];
37285 else
37286 obj.extensions = def["extensions"];
37287 }
37288
37289 // Create on top of current namespace
37290 this.ptr.addChild(obj);
37291 if (subObj.length > 0) {
37292 stack.push(defs); // Push the current level back
37293 defs = subObj; // Continue processing sub level
37294 subObj = null;
37295 this.ptr = obj; // And move the pointer to this namespace
37296 obj = null;
37297 continue;
37298 }
37299 subObj = null;
37300
37301 } else if (Builder.isEnum(def)) {
37302
37303 obj = new Reflect.Enum(this, this.ptr, def["name"], def["options"], def["syntax"]);
37304 def["values"].forEach(function(val) {
37305 obj.addChild(new Reflect.Enum.Value(this, obj, val["name"], val["id"]));
37306 }, this);
37307 this.ptr.addChild(obj);
37308
37309 } else if (Builder.isService(def)) {
37310
37311 obj = new Reflect.Service(this, this.ptr, def["name"], def["options"]);
37312 Object.keys(def["rpc"]).forEach(function(name) {
37313 var mtd = def["rpc"][name];
37314 obj.addChild(new Reflect.Service.RPCMethod(this, obj, name, mtd["request"], mtd["response"], !!mtd["request_stream"], !!mtd["response_stream"], mtd["options"]));
37315 }, this);
37316 this.ptr.addChild(obj);
37317
37318 } else if (Builder.isExtend(def)) {
37319
37320 obj = this.ptr.resolve(def["ref"], true);
37321 if (obj) {
37322 def["fields"].forEach(function(fld) {
37323 if (obj.getChild(fld['id']|0) !== null)
37324 throw Error("duplicate extended field id in "+obj.name+": "+fld['id']);
37325 // Check if field id is allowed to be extended
37326 if (obj.extensions) {
37327 var valid = false;
37328 obj.extensions.forEach(function(range) {
37329 if (fld["id"] >= range[0] && fld["id"] <= range[1])
37330 valid = true;
37331 });
37332 if (!valid)
37333 throw Error("illegal extended field id in "+obj.name+": "+fld['id']+" (not within valid ranges)");
37334 }
37335 // Convert extension field names to camel case notation if the override is set
37336 var name = fld["name"];
37337 if (this.options['convertFieldsToCamelCase'])
37338 name = ProtoBuf.Util.toCamelCase(name);
37339 // see #161: Extensions use their fully qualified name as their runtime key and...
37340 var field = new Reflect.Message.ExtensionField(this, obj, fld["rule"], fld["type"], this.ptr.fqn()+'.'+name, fld["id"], fld["options"]);
37341 // ...are added on top of the current namespace as an extension which is used for
37342 // resolving their type later on (the extension always keeps the original name to
37343 // prevent naming collisions)
37344 var ext = new Reflect.Extension(this, this.ptr, fld["name"], field);
37345 field.extension = ext;
37346 this.ptr.addChild(ext);
37347 obj.addChild(field);
37348 }, this);
37349
37350 } else if (!/\.?google\.protobuf\./.test(def["ref"])) // Silently skip internal extensions
37351 throw Error("extended message "+def["ref"]+" is not defined");
37352
37353 } else
37354 throw Error("not a valid definition: "+JSON.stringify(def));
37355
37356 def = null;
37357 obj = null;
37358 }
37359 // Break goes here
37360 defs = null;
37361 this.ptr = this.ptr.parent; // Namespace done, continue at parent
37362 }
37363 this.resolved = false; // Require re-resolve
37364 this.result = null; // Require re-build
37365 return this;
37366 };
37367
37368 /**
37369 * Propagates syntax to all children.
37370 * @param {!Object} parent
37371 * @inner
37372 */
37373 function propagateSyntax(parent) {
37374 if (parent['messages']) {
37375 parent['messages'].forEach(function(child) {
37376 child["syntax"] = parent["syntax"];
37377 propagateSyntax(child);
37378 });
37379 }
37380 if (parent['enums']) {
37381 parent['enums'].forEach(function(child) {
37382 child["syntax"] = parent["syntax"];
37383 });
37384 }
37385 }
37386
37387 /**
37388 * Imports another definition into this builder.
37389 * @param {Object.<string,*>} json Parsed import
37390 * @param {(string|{root: string, file: string})=} filename Imported file name
37391 * @returns {!ProtoBuf.Builder} this
37392 * @throws {Error} If the definition or file cannot be imported
37393 * @expose
37394 */
37395 BuilderPrototype["import"] = function(json, filename) {
37396 var delim = '/';
37397
37398 // Make sure to skip duplicate imports
37399
37400 if (typeof filename === 'string') {
37401
37402 if (ProtoBuf.Util.IS_NODE)
37403 filename = __webpack_require__(118)['resolve'](filename);
37404 if (this.files[filename] === true)
37405 return this.reset();
37406 this.files[filename] = true;
37407
37408 } else if (typeof filename === 'object') { // Object with root, file.
37409
37410 var root = filename.root;
37411 if (ProtoBuf.Util.IS_NODE)
37412 root = __webpack_require__(118)['resolve'](root);
37413 if (root.indexOf("\\") >= 0 || filename.file.indexOf("\\") >= 0)
37414 delim = '\\';
37415 var fname;
37416 if (ProtoBuf.Util.IS_NODE)
37417 fname = __webpack_require__(118)['join'](root, filename.file);
37418 else
37419 fname = root + delim + filename.file;
37420 if (this.files[fname] === true)
37421 return this.reset();
37422 this.files[fname] = true;
37423 }
37424
37425 // Import imports
37426
37427 if (json['imports'] && json['imports'].length > 0) {
37428 var importRoot,
37429 resetRoot = false;
37430
37431 if (typeof filename === 'object') { // If an import root is specified, override
37432
37433 this.importRoot = filename["root"]; resetRoot = true; // ... and reset afterwards
37434 importRoot = this.importRoot;
37435 filename = filename["file"];
37436 if (importRoot.indexOf("\\") >= 0 || filename.indexOf("\\") >= 0)
37437 delim = '\\';
37438
37439 } else if (typeof filename === 'string') {
37440
37441 if (this.importRoot) // If import root is overridden, use it
37442 importRoot = this.importRoot;
37443 else { // Otherwise compute from filename
37444 if (filename.indexOf("/") >= 0) { // Unix
37445 importRoot = filename.replace(/\/[^\/]*$/, "");
37446 if (/* /file.proto */ importRoot === "")
37447 importRoot = "/";
37448 } else if (filename.indexOf("\\") >= 0) { // Windows
37449 importRoot = filename.replace(/\\[^\\]*$/, "");
37450 delim = '\\';
37451 } else
37452 importRoot = ".";
37453 }
37454
37455 } else
37456 importRoot = null;
37457
37458 for (var i=0; i<json['imports'].length; i++) {
37459 if (typeof json['imports'][i] === 'string') { // Import file
37460 if (!importRoot)
37461 throw Error("cannot determine import root");
37462 var importFilename = json['imports'][i];
37463 if (importFilename === "google/protobuf/descriptor.proto")
37464 continue; // Not needed and therefore not used
37465 if (ProtoBuf.Util.IS_NODE)
37466 importFilename = __webpack_require__(118)['join'](importRoot, importFilename);
37467 else
37468 importFilename = importRoot + delim + importFilename;
37469 if (this.files[importFilename] === true)
37470 continue; // Already imported
37471 if (/\.proto$/i.test(importFilename) && !ProtoBuf.DotProto) // If this is a light build
37472 importFilename = importFilename.replace(/\.proto$/, ".json"); // always load the JSON file
37473 var contents = ProtoBuf.Util.fetch(importFilename);
37474 if (contents === null)
37475 throw Error("failed to import '"+importFilename+"' in '"+filename+"': file not found");
37476 if (/\.json$/i.test(importFilename)) // Always possible
37477 this["import"](JSON.parse(contents+""), importFilename); // May throw
37478 else
37479 this["import"](ProtoBuf.DotProto.Parser.parse(contents), importFilename); // May throw
37480 } else // Import structure
37481 if (!filename)
37482 this["import"](json['imports'][i]);
37483 else if (/\.(\w+)$/.test(filename)) // With extension: Append _importN to the name portion to make it unique
37484 this["import"](json['imports'][i], filename.replace(/^(.+)\.(\w+)$/, function($0, $1, $2) { return $1+"_import"+i+"."+$2; }));
37485 else // Without extension: Append _importN to make it unique
37486 this["import"](json['imports'][i], filename+"_import"+i);
37487 }
37488 if (resetRoot) // Reset import root override when all imports are done
37489 this.importRoot = null;
37490 }
37491
37492 // Import structures
37493
37494 if (json['package'])
37495 this.define(json['package']);
37496 if (json['syntax'])
37497 propagateSyntax(json);
37498 var base = this.ptr;
37499 if (json['options'])
37500 Object.keys(json['options']).forEach(function(key) {
37501 base.options[key] = json['options'][key];
37502 });
37503 if (json['messages'])
37504 this.create(json['messages']),
37505 this.ptr = base;
37506 if (json['enums'])
37507 this.create(json['enums']),
37508 this.ptr = base;
37509 if (json['services'])
37510 this.create(json['services']),
37511 this.ptr = base;
37512 if (json['extends'])
37513 this.create(json['extends']);
37514
37515 return this.reset();
37516 };
37517
37518 /**
37519 * Resolves all namespace objects.
37520 * @throws {Error} If a type cannot be resolved
37521 * @returns {!ProtoBuf.Builder} this
37522 * @expose
37523 */
37524 BuilderPrototype.resolveAll = function() {
37525 // Resolve all reflected objects
37526 var res;
37527 if (this.ptr == null || typeof this.ptr.type === 'object')
37528 return this; // Done (already resolved)
37529
37530 if (this.ptr instanceof Reflect.Namespace) { // Resolve children
37531
37532 this.ptr.children.forEach(function(child) {
37533 this.ptr = child;
37534 this.resolveAll();
37535 }, this);
37536
37537 } else if (this.ptr instanceof Reflect.Message.Field) { // Resolve type
37538
37539 if (!Lang.TYPE.test(this.ptr.type)) {
37540 if (!Lang.TYPEREF.test(this.ptr.type))
37541 throw Error("illegal type reference in "+this.ptr.toString(true)+": "+this.ptr.type);
37542 res = (this.ptr instanceof Reflect.Message.ExtensionField ? this.ptr.extension.parent : this.ptr.parent).resolve(this.ptr.type, true);
37543 if (!res)
37544 throw Error("unresolvable type reference in "+this.ptr.toString(true)+": "+this.ptr.type);
37545 this.ptr.resolvedType = res;
37546 if (res instanceof Reflect.Enum) {
37547 this.ptr.type = ProtoBuf.TYPES["enum"];
37548 if (this.ptr.syntax === 'proto3' && res.syntax !== 'proto3')
37549 throw Error("proto3 message cannot reference proto2 enum");
37550 }
37551 else if (res instanceof Reflect.Message)
37552 this.ptr.type = res.isGroup ? ProtoBuf.TYPES["group"] : ProtoBuf.TYPES["message"];
37553 else
37554 throw Error("illegal type reference in "+this.ptr.toString(true)+": "+this.ptr.type);
37555 } else
37556 this.ptr.type = ProtoBuf.TYPES[this.ptr.type];
37557
37558 // If it's a map field, also resolve the key type. The key type can be only a numeric, string, or bool type
37559 // (i.e., no enums or messages), so we don't need to resolve against the current namespace.
37560 if (this.ptr.map) {
37561 if (!Lang.TYPE.test(this.ptr.keyType))
37562 throw Error("illegal key type for map field in "+this.ptr.toString(true)+": "+this.ptr.keyType);
37563 this.ptr.keyType = ProtoBuf.TYPES[this.ptr.keyType];
37564 }
37565
37566 // If it's a repeated and packable field then proto3 mandates it should be packed by
37567 // default
37568 if (
37569 this.ptr.syntax === 'proto3' &&
37570 this.ptr.repeated && this.ptr.options.packed === undefined &&
37571 ProtoBuf.PACKABLE_WIRE_TYPES.indexOf(this.ptr.type.wireType) !== -1
37572 ) {
37573 this.ptr.options.packed = true;
37574 }
37575
37576 } else if (this.ptr instanceof ProtoBuf.Reflect.Service.Method) {
37577
37578 if (this.ptr instanceof ProtoBuf.Reflect.Service.RPCMethod) {
37579 res = this.ptr.parent.resolve(this.ptr.requestName, true);
37580 if (!res || !(res instanceof ProtoBuf.Reflect.Message))
37581 throw Error("Illegal type reference in "+this.ptr.toString(true)+": "+this.ptr.requestName);
37582 this.ptr.resolvedRequestType = res;
37583 res = this.ptr.parent.resolve(this.ptr.responseName, true);
37584 if (!res || !(res instanceof ProtoBuf.Reflect.Message))
37585 throw Error("Illegal type reference in "+this.ptr.toString(true)+": "+this.ptr.responseName);
37586 this.ptr.resolvedResponseType = res;
37587 } else // Should not happen as nothing else is implemented
37588 throw Error("illegal service type in "+this.ptr.toString(true));
37589
37590 } else if (
37591 !(this.ptr instanceof ProtoBuf.Reflect.Message.OneOf) && // Not built
37592 !(this.ptr instanceof ProtoBuf.Reflect.Extension) && // Not built
37593 !(this.ptr instanceof ProtoBuf.Reflect.Enum.Value) // Built in enum
37594 )
37595 throw Error("illegal object in namespace: "+typeof(this.ptr)+": "+this.ptr);
37596
37597 return this.reset();
37598 };
37599
37600 /**
37601 * Builds the protocol. This will first try to resolve all definitions and, if this has been successful,
37602 * return the built package.
37603 * @param {(string|Array.<string>)=} path Specifies what to return. If omitted, the entire namespace will be returned.
37604 * @returns {!ProtoBuf.Builder.Message|!Object.<string,*>}
37605 * @throws {Error} If a type could not be resolved
37606 * @expose
37607 */
37608 BuilderPrototype.build = function(path) {
37609 this.reset();
37610 if (!this.resolved)
37611 this.resolveAll(),
37612 this.resolved = true,
37613 this.result = null; // Require re-build
37614 if (this.result === null) // (Re-)Build
37615 this.result = this.ns.build();
37616 if (!path)
37617 return this.result;
37618 var part = typeof path === 'string' ? path.split(".") : path,
37619 ptr = this.result; // Build namespace pointer (no hasChild etc.)
37620 for (var i=0; i<part.length; i++)
37621 if (ptr[part[i]])
37622 ptr = ptr[part[i]];
37623 else {
37624 ptr = null;
37625 break;
37626 }
37627 return ptr;
37628 };
37629
37630 /**
37631 * Similar to {@link ProtoBuf.Builder#build}, but looks up the internal reflection descriptor.
37632 * @param {string=} path Specifies what to return. If omitted, the entire namespace wiil be returned.
37633 * @param {boolean=} excludeNonNamespace Excludes non-namespace types like fields, defaults to `false`
37634 * @returns {?ProtoBuf.Reflect.T} Reflection descriptor or `null` if not found
37635 */
37636 BuilderPrototype.lookup = function(path, excludeNonNamespace) {
37637 return path ? this.ns.resolve(path, excludeNonNamespace) : this.ns;
37638 };
37639
37640 /**
37641 * Returns a string representation of this object.
37642 * @return {string} String representation as of "Builder"
37643 * @expose
37644 */
37645 BuilderPrototype.toString = function() {
37646 return "Builder";
37647 };
37648
37649 // ----- Base classes -----
37650 // Exist for the sole purpose of being able to "... instanceof ProtoBuf.Builder.Message" etc.
37651
37652 /**
37653 * @alias ProtoBuf.Builder.Message
37654 */
37655 Builder.Message = function() {};
37656
37657 /**
37658 * @alias ProtoBuf.Builder.Enum
37659 */
37660 Builder.Enum = function() {};
37661
37662 /**
37663 * @alias ProtoBuf.Builder.Message
37664 */
37665 Builder.Service = function() {};
37666
37667 return Builder;
37668
37669 })(ProtoBuf, ProtoBuf.Lang, ProtoBuf.Reflect);
37670
37671 /**
37672 * @alias ProtoBuf.Map
37673 * @expose
37674 */
37675 ProtoBuf.Map = (function(ProtoBuf, Reflect) {
37676 "use strict";
37677
37678 /**
37679 * Constructs a new Map. A Map is a container that is used to implement map
37680 * fields on message objects. It closely follows the ES6 Map API; however,
37681 * it is distinct because we do not want to depend on external polyfills or
37682 * on ES6 itself.
37683 *
37684 * @exports ProtoBuf.Map
37685 * @param {!ProtoBuf.Reflect.Field} field Map field
37686 * @param {Object.<string,*>=} contents Initial contents
37687 * @constructor
37688 */
37689 var Map = function(field, contents) {
37690 if (!field.map)
37691 throw Error("field is not a map");
37692
37693 /**
37694 * The field corresponding to this map.
37695 * @type {!ProtoBuf.Reflect.Field}
37696 */
37697 this.field = field;
37698
37699 /**
37700 * Element instance corresponding to key type.
37701 * @type {!ProtoBuf.Reflect.Element}
37702 */
37703 this.keyElem = new Reflect.Element(field.keyType, null, true, field.syntax);
37704
37705 /**
37706 * Element instance corresponding to value type.
37707 * @type {!ProtoBuf.Reflect.Element}
37708 */
37709 this.valueElem = new Reflect.Element(field.type, field.resolvedType, false, field.syntax);
37710
37711 /**
37712 * Internal map: stores mapping of (string form of key) -> (key, value)
37713 * pair.
37714 *
37715 * We provide map semantics for arbitrary key types, but we build on top
37716 * of an Object, which has only string keys. In order to avoid the need
37717 * to convert a string key back to its native type in many situations,
37718 * we store the native key value alongside the value. Thus, we only need
37719 * a one-way mapping from a key type to its string form that guarantees
37720 * uniqueness and equality (i.e., str(K1) === str(K2) if and only if K1
37721 * === K2).
37722 *
37723 * @type {!Object<string, {key: *, value: *}>}
37724 */
37725 this.map = {};
37726
37727 /**
37728 * Returns the number of elements in the map.
37729 */
37730 Object.defineProperty(this, "size", {
37731 get: function() { return Object.keys(this.map).length; }
37732 });
37733
37734 // Fill initial contents from a raw object.
37735 if (contents) {
37736 var keys = Object.keys(contents);
37737 for (var i = 0; i < keys.length; i++) {
37738 var key = this.keyElem.valueFromString(keys[i]);
37739 var val = this.valueElem.verifyValue(contents[keys[i]]);
37740 this.map[this.keyElem.valueToString(key)] =
37741 { key: key, value: val };
37742 }
37743 }
37744 };
37745
37746 var MapPrototype = Map.prototype;
37747
37748 /**
37749 * Helper: return an iterator over an array.
37750 * @param {!Array<*>} arr the array
37751 * @returns {!Object} an iterator
37752 * @inner
37753 */
37754 function arrayIterator(arr) {
37755 var idx = 0;
37756 return {
37757 next: function() {
37758 if (idx < arr.length)
37759 return { done: false, value: arr[idx++] };
37760 return { done: true };
37761 }
37762 }
37763 }
37764
37765 /**
37766 * Clears the map.
37767 */
37768 MapPrototype.clear = function() {
37769 this.map = {};
37770 };
37771
37772 /**
37773 * Deletes a particular key from the map.
37774 * @returns {boolean} Whether any entry with this key was deleted.
37775 */
37776 MapPrototype["delete"] = function(key) {
37777 var keyValue = this.keyElem.valueToString(this.keyElem.verifyValue(key));
37778 var hadKey = keyValue in this.map;
37779 delete this.map[keyValue];
37780 return hadKey;
37781 };
37782
37783 /**
37784 * Returns an iterator over [key, value] pairs in the map.
37785 * @returns {Object} The iterator
37786 */
37787 MapPrototype.entries = function() {
37788 var entries = [];
37789 var strKeys = Object.keys(this.map);
37790 for (var i = 0, entry; i < strKeys.length; i++)
37791 entries.push([(entry=this.map[strKeys[i]]).key, entry.value]);
37792 return arrayIterator(entries);
37793 };
37794
37795 /**
37796 * Returns an iterator over keys in the map.
37797 * @returns {Object} The iterator
37798 */
37799 MapPrototype.keys = function() {
37800 var keys = [];
37801 var strKeys = Object.keys(this.map);
37802 for (var i = 0; i < strKeys.length; i++)
37803 keys.push(this.map[strKeys[i]].key);
37804 return arrayIterator(keys);
37805 };
37806
37807 /**
37808 * Returns an iterator over values in the map.
37809 * @returns {!Object} The iterator
37810 */
37811 MapPrototype.values = function() {
37812 var values = [];
37813 var strKeys = Object.keys(this.map);
37814 for (var i = 0; i < strKeys.length; i++)
37815 values.push(this.map[strKeys[i]].value);
37816 return arrayIterator(values);
37817 };
37818
37819 /**
37820 * Iterates over entries in the map, calling a function on each.
37821 * @param {function(this:*, *, *, *)} cb The callback to invoke with value, key, and map arguments.
37822 * @param {Object=} thisArg The `this` value for the callback
37823 */
37824 MapPrototype.forEach = function(cb, thisArg) {
37825 var strKeys = Object.keys(this.map);
37826 for (var i = 0, entry; i < strKeys.length; i++)
37827 cb.call(thisArg, (entry=this.map[strKeys[i]]).value, entry.key, this);
37828 };
37829
37830 /**
37831 * Sets a key in the map to the given value.
37832 * @param {*} key The key
37833 * @param {*} value The value
37834 * @returns {!ProtoBuf.Map} The map instance
37835 */
37836 MapPrototype.set = function(key, value) {
37837 var keyValue = this.keyElem.verifyValue(key);
37838 var valValue = this.valueElem.verifyValue(value);
37839 this.map[this.keyElem.valueToString(keyValue)] =
37840 { key: keyValue, value: valValue };
37841 return this;
37842 };
37843
37844 /**
37845 * Gets the value corresponding to a key in the map.
37846 * @param {*} key The key
37847 * @returns {*|undefined} The value, or `undefined` if key not present
37848 */
37849 MapPrototype.get = function(key) {
37850 var keyValue = this.keyElem.valueToString(this.keyElem.verifyValue(key));
37851 if (!(keyValue in this.map))
37852 return undefined;
37853 return this.map[keyValue].value;
37854 };
37855
37856 /**
37857 * Determines whether the given key is present in the map.
37858 * @param {*} key The key
37859 * @returns {boolean} `true` if the key is present
37860 */
37861 MapPrototype.has = function(key) {
37862 var keyValue = this.keyElem.valueToString(this.keyElem.verifyValue(key));
37863 return (keyValue in this.map);
37864 };
37865
37866 return Map;
37867 })(ProtoBuf, ProtoBuf.Reflect);
37868
37869
37870 /**
37871 * Constructs a new empty Builder.
37872 * @param {Object.<string,*>=} options Builder options, defaults to global options set on ProtoBuf
37873 * @return {!ProtoBuf.Builder} Builder
37874 * @expose
37875 */
37876 ProtoBuf.newBuilder = function(options) {
37877 options = options || {};
37878 if (typeof options['convertFieldsToCamelCase'] === 'undefined')
37879 options['convertFieldsToCamelCase'] = ProtoBuf.convertFieldsToCamelCase;
37880 if (typeof options['populateAccessors'] === 'undefined')
37881 options['populateAccessors'] = ProtoBuf.populateAccessors;
37882 return new ProtoBuf.Builder(options);
37883 };
37884
37885 /**
37886 * Loads a .json definition and returns the Builder.
37887 * @param {!*|string} json JSON definition
37888 * @param {(ProtoBuf.Builder|string|{root: string, file: string})=} builder Builder to append to. Will create a new one if omitted.
37889 * @param {(string|{root: string, file: string})=} filename The corresponding file name if known. Must be specified for imports.
37890 * @return {ProtoBuf.Builder} Builder to create new messages
37891 * @throws {Error} If the definition cannot be parsed or built
37892 * @expose
37893 */
37894 ProtoBuf.loadJson = function(json, builder, filename) {
37895 if (typeof builder === 'string' || (builder && typeof builder["file"] === 'string' && typeof builder["root"] === 'string'))
37896 filename = builder,
37897 builder = null;
37898 if (!builder || typeof builder !== 'object')
37899 builder = ProtoBuf.newBuilder();
37900 if (typeof json === 'string')
37901 json = JSON.parse(json);
37902 builder["import"](json, filename);
37903 builder.resolveAll();
37904 return builder;
37905 };
37906
37907 /**
37908 * Loads a .json file and returns the Builder.
37909 * @param {string|!{root: string, file: string}} filename Path to json file or an object specifying 'file' with
37910 * an overridden 'root' path for all imported files.
37911 * @param {function(?Error, !ProtoBuf.Builder=)=} callback Callback that will receive `null` as the first and
37912 * the Builder as its second argument on success, otherwise the error as its first argument. If omitted, the
37913 * file will be read synchronously and this function will return the Builder.
37914 * @param {ProtoBuf.Builder=} builder Builder to append to. Will create a new one if omitted.
37915 * @return {?ProtoBuf.Builder|undefined} The Builder if synchronous (no callback specified, will be NULL if the
37916 * request has failed), else undefined
37917 * @expose
37918 */
37919 ProtoBuf.loadJsonFile = function(filename, callback, builder) {
37920 if (callback && typeof callback === 'object')
37921 builder = callback,
37922 callback = null;
37923 else if (!callback || typeof callback !== 'function')
37924 callback = null;
37925 if (callback)
37926 return ProtoBuf.Util.fetch(typeof filename === 'string' ? filename : filename["root"]+"/"+filename["file"], function(contents) {
37927 if (contents === null) {
37928 callback(Error("Failed to fetch file"));
37929 return;
37930 }
37931 try {
37932 callback(null, ProtoBuf.loadJson(JSON.parse(contents), builder, filename));
37933 } catch (e) {
37934 callback(e);
37935 }
37936 });
37937 var contents = ProtoBuf.Util.fetch(typeof filename === 'object' ? filename["root"]+"/"+filename["file"] : filename);
37938 return contents === null ? null : ProtoBuf.loadJson(JSON.parse(contents), builder, filename);
37939 };
37940
37941 return ProtoBuf;
37942});
37943
37944
37945/***/ }),
37946/* 653 */
37947/***/ (function(module, exports, __webpack_require__) {
37948
37949var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*
37950 Copyright 2013-2014 Daniel Wirtz <dcode@dcode.io>
37951
37952 Licensed under the Apache License, Version 2.0 (the "License");
37953 you may not use this file except in compliance with the License.
37954 You may obtain a copy of the License at
37955
37956 http://www.apache.org/licenses/LICENSE-2.0
37957
37958 Unless required by applicable law or agreed to in writing, software
37959 distributed under the License is distributed on an "AS IS" BASIS,
37960 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
37961 See the License for the specific language governing permissions and
37962 limitations under the License.
37963 */
37964
37965/**
37966 * @license bytebuffer.js (c) 2015 Daniel Wirtz <dcode@dcode.io>
37967 * Backing buffer: ArrayBuffer, Accessor: Uint8Array
37968 * Released under the Apache License, Version 2.0
37969 * see: https://github.com/dcodeIO/bytebuffer.js for details
37970 */
37971(function(global, factory) {
37972
37973 /* AMD */ if (true)
37974 !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(654)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
37975 __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
37976 (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
37977 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
37978 /* CommonJS */ else if (typeof require === 'function' && typeof module === "object" && module && module["exports"])
37979 module['exports'] = (function() {
37980 var Long; try { Long = require("long"); } catch (e) {}
37981 return factory(Long);
37982 })();
37983 /* Global */ else
37984 (global["dcodeIO"] = global["dcodeIO"] || {})["ByteBuffer"] = factory(global["dcodeIO"]["Long"]);
37985
37986})(this, function(Long) {
37987 "use strict";
37988
37989 /**
37990 * Constructs a new ByteBuffer.
37991 * @class The swiss army knife for binary data in JavaScript.
37992 * @exports ByteBuffer
37993 * @constructor
37994 * @param {number=} capacity Initial capacity. Defaults to {@link ByteBuffer.DEFAULT_CAPACITY}.
37995 * @param {boolean=} littleEndian Whether to use little or big endian byte order. Defaults to
37996 * {@link ByteBuffer.DEFAULT_ENDIAN}.
37997 * @param {boolean=} noAssert Whether to skip assertions of offsets and values. Defaults to
37998 * {@link ByteBuffer.DEFAULT_NOASSERT}.
37999 * @expose
38000 */
38001 var ByteBuffer = function(capacity, littleEndian, noAssert) {
38002 if (typeof capacity === 'undefined')
38003 capacity = ByteBuffer.DEFAULT_CAPACITY;
38004 if (typeof littleEndian === 'undefined')
38005 littleEndian = ByteBuffer.DEFAULT_ENDIAN;
38006 if (typeof noAssert === 'undefined')
38007 noAssert = ByteBuffer.DEFAULT_NOASSERT;
38008 if (!noAssert) {
38009 capacity = capacity | 0;
38010 if (capacity < 0)
38011 throw RangeError("Illegal capacity");
38012 littleEndian = !!littleEndian;
38013 noAssert = !!noAssert;
38014 }
38015
38016 /**
38017 * Backing ArrayBuffer.
38018 * @type {!ArrayBuffer}
38019 * @expose
38020 */
38021 this.buffer = capacity === 0 ? EMPTY_BUFFER : new ArrayBuffer(capacity);
38022
38023 /**
38024 * Uint8Array utilized to manipulate the backing buffer. Becomes `null` if the backing buffer has a capacity of `0`.
38025 * @type {?Uint8Array}
38026 * @expose
38027 */
38028 this.view = capacity === 0 ? null : new Uint8Array(this.buffer);
38029
38030 /**
38031 * Absolute read/write offset.
38032 * @type {number}
38033 * @expose
38034 * @see ByteBuffer#flip
38035 * @see ByteBuffer#clear
38036 */
38037 this.offset = 0;
38038
38039 /**
38040 * Marked offset.
38041 * @type {number}
38042 * @expose
38043 * @see ByteBuffer#mark
38044 * @see ByteBuffer#reset
38045 */
38046 this.markedOffset = -1;
38047
38048 /**
38049 * Absolute limit of the contained data. Set to the backing buffer's capacity upon allocation.
38050 * @type {number}
38051 * @expose
38052 * @see ByteBuffer#flip
38053 * @see ByteBuffer#clear
38054 */
38055 this.limit = capacity;
38056
38057 /**
38058 * Whether to use little endian byte order, defaults to `false` for big endian.
38059 * @type {boolean}
38060 * @expose
38061 */
38062 this.littleEndian = littleEndian;
38063
38064 /**
38065 * Whether to skip assertions of offsets and values, defaults to `false`.
38066 * @type {boolean}
38067 * @expose
38068 */
38069 this.noAssert = noAssert;
38070 };
38071
38072 /**
38073 * ByteBuffer version.
38074 * @type {string}
38075 * @const
38076 * @expose
38077 */
38078 ByteBuffer.VERSION = "5.0.1";
38079
38080 /**
38081 * Little endian constant that can be used instead of its boolean value. Evaluates to `true`.
38082 * @type {boolean}
38083 * @const
38084 * @expose
38085 */
38086 ByteBuffer.LITTLE_ENDIAN = true;
38087
38088 /**
38089 * Big endian constant that can be used instead of its boolean value. Evaluates to `false`.
38090 * @type {boolean}
38091 * @const
38092 * @expose
38093 */
38094 ByteBuffer.BIG_ENDIAN = false;
38095
38096 /**
38097 * Default initial capacity of `16`.
38098 * @type {number}
38099 * @expose
38100 */
38101 ByteBuffer.DEFAULT_CAPACITY = 16;
38102
38103 /**
38104 * Default endianess of `false` for big endian.
38105 * @type {boolean}
38106 * @expose
38107 */
38108 ByteBuffer.DEFAULT_ENDIAN = ByteBuffer.BIG_ENDIAN;
38109
38110 /**
38111 * Default no assertions flag of `false`.
38112 * @type {boolean}
38113 * @expose
38114 */
38115 ByteBuffer.DEFAULT_NOASSERT = false;
38116
38117 /**
38118 * A `Long` class for representing a 64-bit two's-complement integer value. May be `null` if Long.js has not been loaded
38119 * and int64 support is not available.
38120 * @type {?Long}
38121 * @const
38122 * @see https://github.com/dcodeIO/long.js
38123 * @expose
38124 */
38125 ByteBuffer.Long = Long || null;
38126
38127 /**
38128 * @alias ByteBuffer.prototype
38129 * @inner
38130 */
38131 var ByteBufferPrototype = ByteBuffer.prototype;
38132
38133 /**
38134 * An indicator used to reliably determine if an object is a ByteBuffer or not.
38135 * @type {boolean}
38136 * @const
38137 * @expose
38138 * @private
38139 */
38140 ByteBufferPrototype.__isByteBuffer__;
38141
38142 Object.defineProperty(ByteBufferPrototype, "__isByteBuffer__", {
38143 value: true,
38144 enumerable: false,
38145 configurable: false
38146 });
38147
38148 // helpers
38149
38150 /**
38151 * @type {!ArrayBuffer}
38152 * @inner
38153 */
38154 var EMPTY_BUFFER = new ArrayBuffer(0);
38155
38156 /**
38157 * String.fromCharCode reference for compile-time renaming.
38158 * @type {function(...number):string}
38159 * @inner
38160 */
38161 var stringFromCharCode = String.fromCharCode;
38162
38163 /**
38164 * Creates a source function for a string.
38165 * @param {string} s String to read from
38166 * @returns {function():number|null} Source function returning the next char code respectively `null` if there are
38167 * no more characters left.
38168 * @throws {TypeError} If the argument is invalid
38169 * @inner
38170 */
38171 function stringSource(s) {
38172 var i=0; return function() {
38173 return i < s.length ? s.charCodeAt(i++) : null;
38174 };
38175 }
38176
38177 /**
38178 * Creates a destination function for a string.
38179 * @returns {function(number=):undefined|string} Destination function successively called with the next char code.
38180 * Returns the final string when called without arguments.
38181 * @inner
38182 */
38183 function stringDestination() {
38184 var cs = [], ps = []; return function() {
38185 if (arguments.length === 0)
38186 return ps.join('')+stringFromCharCode.apply(String, cs);
38187 if (cs.length + arguments.length > 1024)
38188 ps.push(stringFromCharCode.apply(String, cs)),
38189 cs.length = 0;
38190 Array.prototype.push.apply(cs, arguments);
38191 };
38192 }
38193
38194 /**
38195 * Gets the accessor type.
38196 * @returns {Function} `Buffer` under node.js, `Uint8Array` respectively `DataView` in the browser (classes)
38197 * @expose
38198 */
38199 ByteBuffer.accessor = function() {
38200 return Uint8Array;
38201 };
38202 /**
38203 * Allocates a new ByteBuffer backed by a buffer of the specified capacity.
38204 * @param {number=} capacity Initial capacity. Defaults to {@link ByteBuffer.DEFAULT_CAPACITY}.
38205 * @param {boolean=} littleEndian Whether to use little or big endian byte order. Defaults to
38206 * {@link ByteBuffer.DEFAULT_ENDIAN}.
38207 * @param {boolean=} noAssert Whether to skip assertions of offsets and values. Defaults to
38208 * {@link ByteBuffer.DEFAULT_NOASSERT}.
38209 * @returns {!ByteBuffer}
38210 * @expose
38211 */
38212 ByteBuffer.allocate = function(capacity, littleEndian, noAssert) {
38213 return new ByteBuffer(capacity, littleEndian, noAssert);
38214 };
38215
38216 /**
38217 * Concatenates multiple ByteBuffers into one.
38218 * @param {!Array.<!ByteBuffer|!ArrayBuffer|!Uint8Array|string>} buffers Buffers to concatenate
38219 * @param {(string|boolean)=} encoding String encoding if `buffers` contains a string ("base64", "hex", "binary",
38220 * defaults to "utf8")
38221 * @param {boolean=} littleEndian Whether to use little or big endian byte order for the resulting ByteBuffer. Defaults
38222 * to {@link ByteBuffer.DEFAULT_ENDIAN}.
38223 * @param {boolean=} noAssert Whether to skip assertions of offsets and values for the resulting ByteBuffer. Defaults to
38224 * {@link ByteBuffer.DEFAULT_NOASSERT}.
38225 * @returns {!ByteBuffer} Concatenated ByteBuffer
38226 * @expose
38227 */
38228 ByteBuffer.concat = function(buffers, encoding, littleEndian, noAssert) {
38229 if (typeof encoding === 'boolean' || typeof encoding !== 'string') {
38230 noAssert = littleEndian;
38231 littleEndian = encoding;
38232 encoding = undefined;
38233 }
38234 var capacity = 0;
38235 for (var i=0, k=buffers.length, length; i<k; ++i) {
38236 if (!ByteBuffer.isByteBuffer(buffers[i]))
38237 buffers[i] = ByteBuffer.wrap(buffers[i], encoding);
38238 length = buffers[i].limit - buffers[i].offset;
38239 if (length > 0) capacity += length;
38240 }
38241 if (capacity === 0)
38242 return new ByteBuffer(0, littleEndian, noAssert);
38243 var bb = new ByteBuffer(capacity, littleEndian, noAssert),
38244 bi;
38245 i=0; while (i<k) {
38246 bi = buffers[i++];
38247 length = bi.limit - bi.offset;
38248 if (length <= 0) continue;
38249 bb.view.set(bi.view.subarray(bi.offset, bi.limit), bb.offset);
38250 bb.offset += length;
38251 }
38252 bb.limit = bb.offset;
38253 bb.offset = 0;
38254 return bb;
38255 };
38256
38257 /**
38258 * Tests if the specified type is a ByteBuffer.
38259 * @param {*} bb ByteBuffer to test
38260 * @returns {boolean} `true` if it is a ByteBuffer, otherwise `false`
38261 * @expose
38262 */
38263 ByteBuffer.isByteBuffer = function(bb) {
38264 return (bb && bb["__isByteBuffer__"]) === true;
38265 };
38266 /**
38267 * Gets the backing buffer type.
38268 * @returns {Function} `Buffer` under node.js, `ArrayBuffer` in the browser (classes)
38269 * @expose
38270 */
38271 ByteBuffer.type = function() {
38272 return ArrayBuffer;
38273 };
38274 /**
38275 * Wraps a buffer or a string. Sets the allocated ByteBuffer's {@link ByteBuffer#offset} to `0` and its
38276 * {@link ByteBuffer#limit} to the length of the wrapped data.
38277 * @param {!ByteBuffer|!ArrayBuffer|!Uint8Array|string|!Array.<number>} buffer Anything that can be wrapped
38278 * @param {(string|boolean)=} encoding String encoding if `buffer` is a string ("base64", "hex", "binary", defaults to
38279 * "utf8")
38280 * @param {boolean=} littleEndian Whether to use little or big endian byte order. Defaults to
38281 * {@link ByteBuffer.DEFAULT_ENDIAN}.
38282 * @param {boolean=} noAssert Whether to skip assertions of offsets and values. Defaults to
38283 * {@link ByteBuffer.DEFAULT_NOASSERT}.
38284 * @returns {!ByteBuffer} A ByteBuffer wrapping `buffer`
38285 * @expose
38286 */
38287 ByteBuffer.wrap = function(buffer, encoding, littleEndian, noAssert) {
38288 if (typeof encoding !== 'string') {
38289 noAssert = littleEndian;
38290 littleEndian = encoding;
38291 encoding = undefined;
38292 }
38293 if (typeof buffer === 'string') {
38294 if (typeof encoding === 'undefined')
38295 encoding = "utf8";
38296 switch (encoding) {
38297 case "base64":
38298 return ByteBuffer.fromBase64(buffer, littleEndian);
38299 case "hex":
38300 return ByteBuffer.fromHex(buffer, littleEndian);
38301 case "binary":
38302 return ByteBuffer.fromBinary(buffer, littleEndian);
38303 case "utf8":
38304 return ByteBuffer.fromUTF8(buffer, littleEndian);
38305 case "debug":
38306 return ByteBuffer.fromDebug(buffer, littleEndian);
38307 default:
38308 throw Error("Unsupported encoding: "+encoding);
38309 }
38310 }
38311 if (buffer === null || typeof buffer !== 'object')
38312 throw TypeError("Illegal buffer");
38313 var bb;
38314 if (ByteBuffer.isByteBuffer(buffer)) {
38315 bb = ByteBufferPrototype.clone.call(buffer);
38316 bb.markedOffset = -1;
38317 return bb;
38318 }
38319 if (buffer instanceof Uint8Array) { // Extract ArrayBuffer from Uint8Array
38320 bb = new ByteBuffer(0, littleEndian, noAssert);
38321 if (buffer.length > 0) { // Avoid references to more than one EMPTY_BUFFER
38322 bb.buffer = buffer.buffer;
38323 bb.offset = buffer.byteOffset;
38324 bb.limit = buffer.byteOffset + buffer.byteLength;
38325 bb.view = new Uint8Array(buffer.buffer);
38326 }
38327 } else if (buffer instanceof ArrayBuffer) { // Reuse ArrayBuffer
38328 bb = new ByteBuffer(0, littleEndian, noAssert);
38329 if (buffer.byteLength > 0) {
38330 bb.buffer = buffer;
38331 bb.offset = 0;
38332 bb.limit = buffer.byteLength;
38333 bb.view = buffer.byteLength > 0 ? new Uint8Array(buffer) : null;
38334 }
38335 } else if (Object.prototype.toString.call(buffer) === "[object Array]") { // Create from octets
38336 bb = new ByteBuffer(buffer.length, littleEndian, noAssert);
38337 bb.limit = buffer.length;
38338 for (var i=0; i<buffer.length; ++i)
38339 bb.view[i] = buffer[i];
38340 } else
38341 throw TypeError("Illegal buffer"); // Otherwise fail
38342 return bb;
38343 };
38344
38345 /**
38346 * Writes the array as a bitset.
38347 * @param {Array<boolean>} value Array of booleans to write
38348 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `length` if omitted.
38349 * @returns {!ByteBuffer}
38350 * @expose
38351 */
38352 ByteBufferPrototype.writeBitSet = function(value, offset) {
38353 var relative = typeof offset === 'undefined';
38354 if (relative) offset = this.offset;
38355 if (!this.noAssert) {
38356 if (!(value instanceof Array))
38357 throw TypeError("Illegal BitSet: Not an array");
38358 if (typeof offset !== 'number' || offset % 1 !== 0)
38359 throw TypeError("Illegal offset: "+offset+" (not an integer)");
38360 offset >>>= 0;
38361 if (offset < 0 || offset + 0 > this.buffer.byteLength)
38362 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
38363 }
38364
38365 var start = offset,
38366 bits = value.length,
38367 bytes = (bits >> 3),
38368 bit = 0,
38369 k;
38370
38371 offset += this.writeVarint32(bits,offset);
38372
38373 while(bytes--) {
38374 k = (!!value[bit++] & 1) |
38375 ((!!value[bit++] & 1) << 1) |
38376 ((!!value[bit++] & 1) << 2) |
38377 ((!!value[bit++] & 1) << 3) |
38378 ((!!value[bit++] & 1) << 4) |
38379 ((!!value[bit++] & 1) << 5) |
38380 ((!!value[bit++] & 1) << 6) |
38381 ((!!value[bit++] & 1) << 7);
38382 this.writeByte(k,offset++);
38383 }
38384
38385 if(bit < bits) {
38386 var m = 0; k = 0;
38387 while(bit < bits) k = k | ((!!value[bit++] & 1) << (m++));
38388 this.writeByte(k,offset++);
38389 }
38390
38391 if (relative) {
38392 this.offset = offset;
38393 return this;
38394 }
38395 return offset - start;
38396 }
38397
38398 /**
38399 * Reads a BitSet as an array of booleans.
38400 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `length` if omitted.
38401 * @returns {Array<boolean>
38402 * @expose
38403 */
38404 ByteBufferPrototype.readBitSet = function(offset) {
38405 var relative = typeof offset === 'undefined';
38406 if (relative) offset = this.offset;
38407
38408 var ret = this.readVarint32(offset),
38409 bits = ret.value,
38410 bytes = (bits >> 3),
38411 bit = 0,
38412 value = [],
38413 k;
38414
38415 offset += ret.length;
38416
38417 while(bytes--) {
38418 k = this.readByte(offset++);
38419 value[bit++] = !!(k & 0x01);
38420 value[bit++] = !!(k & 0x02);
38421 value[bit++] = !!(k & 0x04);
38422 value[bit++] = !!(k & 0x08);
38423 value[bit++] = !!(k & 0x10);
38424 value[bit++] = !!(k & 0x20);
38425 value[bit++] = !!(k & 0x40);
38426 value[bit++] = !!(k & 0x80);
38427 }
38428
38429 if(bit < bits) {
38430 var m = 0;
38431 k = this.readByte(offset++);
38432 while(bit < bits) value[bit++] = !!((k >> (m++)) & 1);
38433 }
38434
38435 if (relative) {
38436 this.offset = offset;
38437 }
38438 return value;
38439 }
38440 /**
38441 * Reads the specified number of bytes.
38442 * @param {number} length Number of bytes to read
38443 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `length` if omitted.
38444 * @returns {!ByteBuffer}
38445 * @expose
38446 */
38447 ByteBufferPrototype.readBytes = function(length, offset) {
38448 var relative = typeof offset === 'undefined';
38449 if (relative) offset = this.offset;
38450 if (!this.noAssert) {
38451 if (typeof offset !== 'number' || offset % 1 !== 0)
38452 throw TypeError("Illegal offset: "+offset+" (not an integer)");
38453 offset >>>= 0;
38454 if (offset < 0 || offset + length > this.buffer.byteLength)
38455 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+length+") <= "+this.buffer.byteLength);
38456 }
38457 var slice = this.slice(offset, offset + length);
38458 if (relative) this.offset += length;
38459 return slice;
38460 };
38461
38462 /**
38463 * Writes a payload of bytes. This is an alias of {@link ByteBuffer#append}.
38464 * @function
38465 * @param {!ByteBuffer|!ArrayBuffer|!Uint8Array|string} source Data to write. If `source` is a ByteBuffer, its offsets
38466 * will be modified according to the performed read operation.
38467 * @param {(string|number)=} encoding Encoding if `data` is a string ("base64", "hex", "binary", defaults to "utf8")
38468 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by the number of bytes
38469 * written if omitted.
38470 * @returns {!ByteBuffer} this
38471 * @expose
38472 */
38473 ByteBufferPrototype.writeBytes = ByteBufferPrototype.append;
38474
38475 // types/ints/int8
38476
38477 /**
38478 * Writes an 8bit signed integer.
38479 * @param {number} value Value to write
38480 * @param {number=} offset Offset to write to. Will use and advance {@link ByteBuffer#offset} by `1` if omitted.
38481 * @returns {!ByteBuffer} this
38482 * @expose
38483 */
38484 ByteBufferPrototype.writeInt8 = function(value, offset) {
38485 var relative = typeof offset === 'undefined';
38486 if (relative) offset = this.offset;
38487 if (!this.noAssert) {
38488 if (typeof value !== 'number' || value % 1 !== 0)
38489 throw TypeError("Illegal value: "+value+" (not an integer)");
38490 value |= 0;
38491 if (typeof offset !== 'number' || offset % 1 !== 0)
38492 throw TypeError("Illegal offset: "+offset+" (not an integer)");
38493 offset >>>= 0;
38494 if (offset < 0 || offset + 0 > this.buffer.byteLength)
38495 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
38496 }
38497 offset += 1;
38498 var capacity0 = this.buffer.byteLength;
38499 if (offset > capacity0)
38500 this.resize((capacity0 *= 2) > offset ? capacity0 : offset);
38501 offset -= 1;
38502 this.view[offset] = value;
38503 if (relative) this.offset += 1;
38504 return this;
38505 };
38506
38507 /**
38508 * Writes an 8bit signed integer. This is an alias of {@link ByteBuffer#writeInt8}.
38509 * @function
38510 * @param {number} value Value to write
38511 * @param {number=} offset Offset to write to. Will use and advance {@link ByteBuffer#offset} by `1` if omitted.
38512 * @returns {!ByteBuffer} this
38513 * @expose
38514 */
38515 ByteBufferPrototype.writeByte = ByteBufferPrototype.writeInt8;
38516
38517 /**
38518 * Reads an 8bit signed integer.
38519 * @param {number=} offset Offset to read from. Will use and advance {@link ByteBuffer#offset} by `1` if omitted.
38520 * @returns {number} Value read
38521 * @expose
38522 */
38523 ByteBufferPrototype.readInt8 = function(offset) {
38524 var relative = typeof offset === 'undefined';
38525 if (relative) offset = this.offset;
38526 if (!this.noAssert) {
38527 if (typeof offset !== 'number' || offset % 1 !== 0)
38528 throw TypeError("Illegal offset: "+offset+" (not an integer)");
38529 offset >>>= 0;
38530 if (offset < 0 || offset + 1 > this.buffer.byteLength)
38531 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+1+") <= "+this.buffer.byteLength);
38532 }
38533 var value = this.view[offset];
38534 if ((value & 0x80) === 0x80) value = -(0xFF - value + 1); // Cast to signed
38535 if (relative) this.offset += 1;
38536 return value;
38537 };
38538
38539 /**
38540 * Reads an 8bit signed integer. This is an alias of {@link ByteBuffer#readInt8}.
38541 * @function
38542 * @param {number=} offset Offset to read from. Will use and advance {@link ByteBuffer#offset} by `1` if omitted.
38543 * @returns {number} Value read
38544 * @expose
38545 */
38546 ByteBufferPrototype.readByte = ByteBufferPrototype.readInt8;
38547
38548 /**
38549 * Writes an 8bit unsigned integer.
38550 * @param {number} value Value to write
38551 * @param {number=} offset Offset to write to. Will use and advance {@link ByteBuffer#offset} by `1` if omitted.
38552 * @returns {!ByteBuffer} this
38553 * @expose
38554 */
38555 ByteBufferPrototype.writeUint8 = function(value, offset) {
38556 var relative = typeof offset === 'undefined';
38557 if (relative) offset = this.offset;
38558 if (!this.noAssert) {
38559 if (typeof value !== 'number' || value % 1 !== 0)
38560 throw TypeError("Illegal value: "+value+" (not an integer)");
38561 value >>>= 0;
38562 if (typeof offset !== 'number' || offset % 1 !== 0)
38563 throw TypeError("Illegal offset: "+offset+" (not an integer)");
38564 offset >>>= 0;
38565 if (offset < 0 || offset + 0 > this.buffer.byteLength)
38566 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
38567 }
38568 offset += 1;
38569 var capacity1 = this.buffer.byteLength;
38570 if (offset > capacity1)
38571 this.resize((capacity1 *= 2) > offset ? capacity1 : offset);
38572 offset -= 1;
38573 this.view[offset] = value;
38574 if (relative) this.offset += 1;
38575 return this;
38576 };
38577
38578 /**
38579 * Writes an 8bit unsigned integer. This is an alias of {@link ByteBuffer#writeUint8}.
38580 * @function
38581 * @param {number} value Value to write
38582 * @param {number=} offset Offset to write to. Will use and advance {@link ByteBuffer#offset} by `1` if omitted.
38583 * @returns {!ByteBuffer} this
38584 * @expose
38585 */
38586 ByteBufferPrototype.writeUInt8 = ByteBufferPrototype.writeUint8;
38587
38588 /**
38589 * Reads an 8bit unsigned integer.
38590 * @param {number=} offset Offset to read from. Will use and advance {@link ByteBuffer#offset} by `1` if omitted.
38591 * @returns {number} Value read
38592 * @expose
38593 */
38594 ByteBufferPrototype.readUint8 = function(offset) {
38595 var relative = typeof offset === 'undefined';
38596 if (relative) offset = this.offset;
38597 if (!this.noAssert) {
38598 if (typeof offset !== 'number' || offset % 1 !== 0)
38599 throw TypeError("Illegal offset: "+offset+" (not an integer)");
38600 offset >>>= 0;
38601 if (offset < 0 || offset + 1 > this.buffer.byteLength)
38602 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+1+") <= "+this.buffer.byteLength);
38603 }
38604 var value = this.view[offset];
38605 if (relative) this.offset += 1;
38606 return value;
38607 };
38608
38609 /**
38610 * Reads an 8bit unsigned integer. This is an alias of {@link ByteBuffer#readUint8}.
38611 * @function
38612 * @param {number=} offset Offset to read from. Will use and advance {@link ByteBuffer#offset} by `1` if omitted.
38613 * @returns {number} Value read
38614 * @expose
38615 */
38616 ByteBufferPrototype.readUInt8 = ByteBufferPrototype.readUint8;
38617
38618 // types/ints/int16
38619
38620 /**
38621 * Writes a 16bit signed integer.
38622 * @param {number} value Value to write
38623 * @param {number=} offset Offset to write to. Will use and advance {@link ByteBuffer#offset} by `2` if omitted.
38624 * @throws {TypeError} If `offset` or `value` is not a valid number
38625 * @throws {RangeError} If `offset` is out of bounds
38626 * @expose
38627 */
38628 ByteBufferPrototype.writeInt16 = function(value, offset) {
38629 var relative = typeof offset === 'undefined';
38630 if (relative) offset = this.offset;
38631 if (!this.noAssert) {
38632 if (typeof value !== 'number' || value % 1 !== 0)
38633 throw TypeError("Illegal value: "+value+" (not an integer)");
38634 value |= 0;
38635 if (typeof offset !== 'number' || offset % 1 !== 0)
38636 throw TypeError("Illegal offset: "+offset+" (not an integer)");
38637 offset >>>= 0;
38638 if (offset < 0 || offset + 0 > this.buffer.byteLength)
38639 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
38640 }
38641 offset += 2;
38642 var capacity2 = this.buffer.byteLength;
38643 if (offset > capacity2)
38644 this.resize((capacity2 *= 2) > offset ? capacity2 : offset);
38645 offset -= 2;
38646 if (this.littleEndian) {
38647 this.view[offset+1] = (value & 0xFF00) >>> 8;
38648 this.view[offset ] = value & 0x00FF;
38649 } else {
38650 this.view[offset] = (value & 0xFF00) >>> 8;
38651 this.view[offset+1] = value & 0x00FF;
38652 }
38653 if (relative) this.offset += 2;
38654 return this;
38655 };
38656
38657 /**
38658 * Writes a 16bit signed integer. This is an alias of {@link ByteBuffer#writeInt16}.
38659 * @function
38660 * @param {number} value Value to write
38661 * @param {number=} offset Offset to write to. Will use and advance {@link ByteBuffer#offset} by `2` if omitted.
38662 * @throws {TypeError} If `offset` or `value` is not a valid number
38663 * @throws {RangeError} If `offset` is out of bounds
38664 * @expose
38665 */
38666 ByteBufferPrototype.writeShort = ByteBufferPrototype.writeInt16;
38667
38668 /**
38669 * Reads a 16bit signed integer.
38670 * @param {number=} offset Offset to read from. Will use and advance {@link ByteBuffer#offset} by `2` if omitted.
38671 * @returns {number} Value read
38672 * @throws {TypeError} If `offset` is not a valid number
38673 * @throws {RangeError} If `offset` is out of bounds
38674 * @expose
38675 */
38676 ByteBufferPrototype.readInt16 = function(offset) {
38677 var relative = typeof offset === 'undefined';
38678 if (relative) offset = this.offset;
38679 if (!this.noAssert) {
38680 if (typeof offset !== 'number' || offset % 1 !== 0)
38681 throw TypeError("Illegal offset: "+offset+" (not an integer)");
38682 offset >>>= 0;
38683 if (offset < 0 || offset + 2 > this.buffer.byteLength)
38684 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+2+") <= "+this.buffer.byteLength);
38685 }
38686 var value = 0;
38687 if (this.littleEndian) {
38688 value = this.view[offset ];
38689 value |= this.view[offset+1] << 8;
38690 } else {
38691 value = this.view[offset ] << 8;
38692 value |= this.view[offset+1];
38693 }
38694 if ((value & 0x8000) === 0x8000) value = -(0xFFFF - value + 1); // Cast to signed
38695 if (relative) this.offset += 2;
38696 return value;
38697 };
38698
38699 /**
38700 * Reads a 16bit signed integer. This is an alias of {@link ByteBuffer#readInt16}.
38701 * @function
38702 * @param {number=} offset Offset to read from. Will use and advance {@link ByteBuffer#offset} by `2` if omitted.
38703 * @returns {number} Value read
38704 * @throws {TypeError} If `offset` is not a valid number
38705 * @throws {RangeError} If `offset` is out of bounds
38706 * @expose
38707 */
38708 ByteBufferPrototype.readShort = ByteBufferPrototype.readInt16;
38709
38710 /**
38711 * Writes a 16bit unsigned integer.
38712 * @param {number} value Value to write
38713 * @param {number=} offset Offset to write to. Will use and advance {@link ByteBuffer#offset} by `2` if omitted.
38714 * @throws {TypeError} If `offset` or `value` is not a valid number
38715 * @throws {RangeError} If `offset` is out of bounds
38716 * @expose
38717 */
38718 ByteBufferPrototype.writeUint16 = function(value, offset) {
38719 var relative = typeof offset === 'undefined';
38720 if (relative) offset = this.offset;
38721 if (!this.noAssert) {
38722 if (typeof value !== 'number' || value % 1 !== 0)
38723 throw TypeError("Illegal value: "+value+" (not an integer)");
38724 value >>>= 0;
38725 if (typeof offset !== 'number' || offset % 1 !== 0)
38726 throw TypeError("Illegal offset: "+offset+" (not an integer)");
38727 offset >>>= 0;
38728 if (offset < 0 || offset + 0 > this.buffer.byteLength)
38729 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
38730 }
38731 offset += 2;
38732 var capacity3 = this.buffer.byteLength;
38733 if (offset > capacity3)
38734 this.resize((capacity3 *= 2) > offset ? capacity3 : offset);
38735 offset -= 2;
38736 if (this.littleEndian) {
38737 this.view[offset+1] = (value & 0xFF00) >>> 8;
38738 this.view[offset ] = value & 0x00FF;
38739 } else {
38740 this.view[offset] = (value & 0xFF00) >>> 8;
38741 this.view[offset+1] = value & 0x00FF;
38742 }
38743 if (relative) this.offset += 2;
38744 return this;
38745 };
38746
38747 /**
38748 * Writes a 16bit unsigned integer. This is an alias of {@link ByteBuffer#writeUint16}.
38749 * @function
38750 * @param {number} value Value to write
38751 * @param {number=} offset Offset to write to. Will use and advance {@link ByteBuffer#offset} by `2` if omitted.
38752 * @throws {TypeError} If `offset` or `value` is not a valid number
38753 * @throws {RangeError} If `offset` is out of bounds
38754 * @expose
38755 */
38756 ByteBufferPrototype.writeUInt16 = ByteBufferPrototype.writeUint16;
38757
38758 /**
38759 * Reads a 16bit unsigned integer.
38760 * @param {number=} offset Offset to read from. Will use and advance {@link ByteBuffer#offset} by `2` if omitted.
38761 * @returns {number} Value read
38762 * @throws {TypeError} If `offset` is not a valid number
38763 * @throws {RangeError} If `offset` is out of bounds
38764 * @expose
38765 */
38766 ByteBufferPrototype.readUint16 = function(offset) {
38767 var relative = typeof offset === 'undefined';
38768 if (relative) offset = this.offset;
38769 if (!this.noAssert) {
38770 if (typeof offset !== 'number' || offset % 1 !== 0)
38771 throw TypeError("Illegal offset: "+offset+" (not an integer)");
38772 offset >>>= 0;
38773 if (offset < 0 || offset + 2 > this.buffer.byteLength)
38774 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+2+") <= "+this.buffer.byteLength);
38775 }
38776 var value = 0;
38777 if (this.littleEndian) {
38778 value = this.view[offset ];
38779 value |= this.view[offset+1] << 8;
38780 } else {
38781 value = this.view[offset ] << 8;
38782 value |= this.view[offset+1];
38783 }
38784 if (relative) this.offset += 2;
38785 return value;
38786 };
38787
38788 /**
38789 * Reads a 16bit unsigned integer. This is an alias of {@link ByteBuffer#readUint16}.
38790 * @function
38791 * @param {number=} offset Offset to read from. Will use and advance {@link ByteBuffer#offset} by `2` if omitted.
38792 * @returns {number} Value read
38793 * @throws {TypeError} If `offset` is not a valid number
38794 * @throws {RangeError} If `offset` is out of bounds
38795 * @expose
38796 */
38797 ByteBufferPrototype.readUInt16 = ByteBufferPrototype.readUint16;
38798
38799 // types/ints/int32
38800
38801 /**
38802 * Writes a 32bit signed integer.
38803 * @param {number} value Value to write
38804 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `4` if omitted.
38805 * @expose
38806 */
38807 ByteBufferPrototype.writeInt32 = function(value, offset) {
38808 var relative = typeof offset === 'undefined';
38809 if (relative) offset = this.offset;
38810 if (!this.noAssert) {
38811 if (typeof value !== 'number' || value % 1 !== 0)
38812 throw TypeError("Illegal value: "+value+" (not an integer)");
38813 value |= 0;
38814 if (typeof offset !== 'number' || offset % 1 !== 0)
38815 throw TypeError("Illegal offset: "+offset+" (not an integer)");
38816 offset >>>= 0;
38817 if (offset < 0 || offset + 0 > this.buffer.byteLength)
38818 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
38819 }
38820 offset += 4;
38821 var capacity4 = this.buffer.byteLength;
38822 if (offset > capacity4)
38823 this.resize((capacity4 *= 2) > offset ? capacity4 : offset);
38824 offset -= 4;
38825 if (this.littleEndian) {
38826 this.view[offset+3] = (value >>> 24) & 0xFF;
38827 this.view[offset+2] = (value >>> 16) & 0xFF;
38828 this.view[offset+1] = (value >>> 8) & 0xFF;
38829 this.view[offset ] = value & 0xFF;
38830 } else {
38831 this.view[offset ] = (value >>> 24) & 0xFF;
38832 this.view[offset+1] = (value >>> 16) & 0xFF;
38833 this.view[offset+2] = (value >>> 8) & 0xFF;
38834 this.view[offset+3] = value & 0xFF;
38835 }
38836 if (relative) this.offset += 4;
38837 return this;
38838 };
38839
38840 /**
38841 * Writes a 32bit signed integer. This is an alias of {@link ByteBuffer#writeInt32}.
38842 * @param {number} value Value to write
38843 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `4` if omitted.
38844 * @expose
38845 */
38846 ByteBufferPrototype.writeInt = ByteBufferPrototype.writeInt32;
38847
38848 /**
38849 * Reads a 32bit signed integer.
38850 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `4` if omitted.
38851 * @returns {number} Value read
38852 * @expose
38853 */
38854 ByteBufferPrototype.readInt32 = function(offset) {
38855 var relative = typeof offset === 'undefined';
38856 if (relative) offset = this.offset;
38857 if (!this.noAssert) {
38858 if (typeof offset !== 'number' || offset % 1 !== 0)
38859 throw TypeError("Illegal offset: "+offset+" (not an integer)");
38860 offset >>>= 0;
38861 if (offset < 0 || offset + 4 > this.buffer.byteLength)
38862 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+4+") <= "+this.buffer.byteLength);
38863 }
38864 var value = 0;
38865 if (this.littleEndian) {
38866 value = this.view[offset+2] << 16;
38867 value |= this.view[offset+1] << 8;
38868 value |= this.view[offset ];
38869 value += this.view[offset+3] << 24 >>> 0;
38870 } else {
38871 value = this.view[offset+1] << 16;
38872 value |= this.view[offset+2] << 8;
38873 value |= this.view[offset+3];
38874 value += this.view[offset ] << 24 >>> 0;
38875 }
38876 value |= 0; // Cast to signed
38877 if (relative) this.offset += 4;
38878 return value;
38879 };
38880
38881 /**
38882 * Reads a 32bit signed integer. This is an alias of {@link ByteBuffer#readInt32}.
38883 * @param {number=} offset Offset to read from. Will use and advance {@link ByteBuffer#offset} by `4` if omitted.
38884 * @returns {number} Value read
38885 * @expose
38886 */
38887 ByteBufferPrototype.readInt = ByteBufferPrototype.readInt32;
38888
38889 /**
38890 * Writes a 32bit unsigned integer.
38891 * @param {number} value Value to write
38892 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `4` if omitted.
38893 * @expose
38894 */
38895 ByteBufferPrototype.writeUint32 = function(value, offset) {
38896 var relative = typeof offset === 'undefined';
38897 if (relative) offset = this.offset;
38898 if (!this.noAssert) {
38899 if (typeof value !== 'number' || value % 1 !== 0)
38900 throw TypeError("Illegal value: "+value+" (not an integer)");
38901 value >>>= 0;
38902 if (typeof offset !== 'number' || offset % 1 !== 0)
38903 throw TypeError("Illegal offset: "+offset+" (not an integer)");
38904 offset >>>= 0;
38905 if (offset < 0 || offset + 0 > this.buffer.byteLength)
38906 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
38907 }
38908 offset += 4;
38909 var capacity5 = this.buffer.byteLength;
38910 if (offset > capacity5)
38911 this.resize((capacity5 *= 2) > offset ? capacity5 : offset);
38912 offset -= 4;
38913 if (this.littleEndian) {
38914 this.view[offset+3] = (value >>> 24) & 0xFF;
38915 this.view[offset+2] = (value >>> 16) & 0xFF;
38916 this.view[offset+1] = (value >>> 8) & 0xFF;
38917 this.view[offset ] = value & 0xFF;
38918 } else {
38919 this.view[offset ] = (value >>> 24) & 0xFF;
38920 this.view[offset+1] = (value >>> 16) & 0xFF;
38921 this.view[offset+2] = (value >>> 8) & 0xFF;
38922 this.view[offset+3] = value & 0xFF;
38923 }
38924 if (relative) this.offset += 4;
38925 return this;
38926 };
38927
38928 /**
38929 * Writes a 32bit unsigned integer. This is an alias of {@link ByteBuffer#writeUint32}.
38930 * @function
38931 * @param {number} value Value to write
38932 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `4` if omitted.
38933 * @expose
38934 */
38935 ByteBufferPrototype.writeUInt32 = ByteBufferPrototype.writeUint32;
38936
38937 /**
38938 * Reads a 32bit unsigned integer.
38939 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `4` if omitted.
38940 * @returns {number} Value read
38941 * @expose
38942 */
38943 ByteBufferPrototype.readUint32 = function(offset) {
38944 var relative = typeof offset === 'undefined';
38945 if (relative) offset = this.offset;
38946 if (!this.noAssert) {
38947 if (typeof offset !== 'number' || offset % 1 !== 0)
38948 throw TypeError("Illegal offset: "+offset+" (not an integer)");
38949 offset >>>= 0;
38950 if (offset < 0 || offset + 4 > this.buffer.byteLength)
38951 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+4+") <= "+this.buffer.byteLength);
38952 }
38953 var value = 0;
38954 if (this.littleEndian) {
38955 value = this.view[offset+2] << 16;
38956 value |= this.view[offset+1] << 8;
38957 value |= this.view[offset ];
38958 value += this.view[offset+3] << 24 >>> 0;
38959 } else {
38960 value = this.view[offset+1] << 16;
38961 value |= this.view[offset+2] << 8;
38962 value |= this.view[offset+3];
38963 value += this.view[offset ] << 24 >>> 0;
38964 }
38965 if (relative) this.offset += 4;
38966 return value;
38967 };
38968
38969 /**
38970 * Reads a 32bit unsigned integer. This is an alias of {@link ByteBuffer#readUint32}.
38971 * @function
38972 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `4` if omitted.
38973 * @returns {number} Value read
38974 * @expose
38975 */
38976 ByteBufferPrototype.readUInt32 = ByteBufferPrototype.readUint32;
38977
38978 // types/ints/int64
38979
38980 if (Long) {
38981
38982 /**
38983 * Writes a 64bit signed integer.
38984 * @param {number|!Long} value Value to write
38985 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
38986 * @returns {!ByteBuffer} this
38987 * @expose
38988 */
38989 ByteBufferPrototype.writeInt64 = function(value, offset) {
38990 var relative = typeof offset === 'undefined';
38991 if (relative) offset = this.offset;
38992 if (!this.noAssert) {
38993 if (typeof value === 'number')
38994 value = Long.fromNumber(value);
38995 else if (typeof value === 'string')
38996 value = Long.fromString(value);
38997 else if (!(value && value instanceof Long))
38998 throw TypeError("Illegal value: "+value+" (not an integer or Long)");
38999 if (typeof offset !== 'number' || offset % 1 !== 0)
39000 throw TypeError("Illegal offset: "+offset+" (not an integer)");
39001 offset >>>= 0;
39002 if (offset < 0 || offset + 0 > this.buffer.byteLength)
39003 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
39004 }
39005 if (typeof value === 'number')
39006 value = Long.fromNumber(value);
39007 else if (typeof value === 'string')
39008 value = Long.fromString(value);
39009 offset += 8;
39010 var capacity6 = this.buffer.byteLength;
39011 if (offset > capacity6)
39012 this.resize((capacity6 *= 2) > offset ? capacity6 : offset);
39013 offset -= 8;
39014 var lo = value.low,
39015 hi = value.high;
39016 if (this.littleEndian) {
39017 this.view[offset+3] = (lo >>> 24) & 0xFF;
39018 this.view[offset+2] = (lo >>> 16) & 0xFF;
39019 this.view[offset+1] = (lo >>> 8) & 0xFF;
39020 this.view[offset ] = lo & 0xFF;
39021 offset += 4;
39022 this.view[offset+3] = (hi >>> 24) & 0xFF;
39023 this.view[offset+2] = (hi >>> 16) & 0xFF;
39024 this.view[offset+1] = (hi >>> 8) & 0xFF;
39025 this.view[offset ] = hi & 0xFF;
39026 } else {
39027 this.view[offset ] = (hi >>> 24) & 0xFF;
39028 this.view[offset+1] = (hi >>> 16) & 0xFF;
39029 this.view[offset+2] = (hi >>> 8) & 0xFF;
39030 this.view[offset+3] = hi & 0xFF;
39031 offset += 4;
39032 this.view[offset ] = (lo >>> 24) & 0xFF;
39033 this.view[offset+1] = (lo >>> 16) & 0xFF;
39034 this.view[offset+2] = (lo >>> 8) & 0xFF;
39035 this.view[offset+3] = lo & 0xFF;
39036 }
39037 if (relative) this.offset += 8;
39038 return this;
39039 };
39040
39041 /**
39042 * Writes a 64bit signed integer. This is an alias of {@link ByteBuffer#writeInt64}.
39043 * @param {number|!Long} value Value to write
39044 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
39045 * @returns {!ByteBuffer} this
39046 * @expose
39047 */
39048 ByteBufferPrototype.writeLong = ByteBufferPrototype.writeInt64;
39049
39050 /**
39051 * Reads a 64bit signed integer.
39052 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
39053 * @returns {!Long}
39054 * @expose
39055 */
39056 ByteBufferPrototype.readInt64 = function(offset) {
39057 var relative = typeof offset === 'undefined';
39058 if (relative) offset = this.offset;
39059 if (!this.noAssert) {
39060 if (typeof offset !== 'number' || offset % 1 !== 0)
39061 throw TypeError("Illegal offset: "+offset+" (not an integer)");
39062 offset >>>= 0;
39063 if (offset < 0 || offset + 8 > this.buffer.byteLength)
39064 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+8+") <= "+this.buffer.byteLength);
39065 }
39066 var lo = 0,
39067 hi = 0;
39068 if (this.littleEndian) {
39069 lo = this.view[offset+2] << 16;
39070 lo |= this.view[offset+1] << 8;
39071 lo |= this.view[offset ];
39072 lo += this.view[offset+3] << 24 >>> 0;
39073 offset += 4;
39074 hi = this.view[offset+2] << 16;
39075 hi |= this.view[offset+1] << 8;
39076 hi |= this.view[offset ];
39077 hi += this.view[offset+3] << 24 >>> 0;
39078 } else {
39079 hi = this.view[offset+1] << 16;
39080 hi |= this.view[offset+2] << 8;
39081 hi |= this.view[offset+3];
39082 hi += this.view[offset ] << 24 >>> 0;
39083 offset += 4;
39084 lo = this.view[offset+1] << 16;
39085 lo |= this.view[offset+2] << 8;
39086 lo |= this.view[offset+3];
39087 lo += this.view[offset ] << 24 >>> 0;
39088 }
39089 var value = new Long(lo, hi, false);
39090 if (relative) this.offset += 8;
39091 return value;
39092 };
39093
39094 /**
39095 * Reads a 64bit signed integer. This is an alias of {@link ByteBuffer#readInt64}.
39096 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
39097 * @returns {!Long}
39098 * @expose
39099 */
39100 ByteBufferPrototype.readLong = ByteBufferPrototype.readInt64;
39101
39102 /**
39103 * Writes a 64bit unsigned integer.
39104 * @param {number|!Long} value Value to write
39105 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
39106 * @returns {!ByteBuffer} this
39107 * @expose
39108 */
39109 ByteBufferPrototype.writeUint64 = function(value, offset) {
39110 var relative = typeof offset === 'undefined';
39111 if (relative) offset = this.offset;
39112 if (!this.noAssert) {
39113 if (typeof value === 'number')
39114 value = Long.fromNumber(value);
39115 else if (typeof value === 'string')
39116 value = Long.fromString(value);
39117 else if (!(value && value instanceof Long))
39118 throw TypeError("Illegal value: "+value+" (not an integer or Long)");
39119 if (typeof offset !== 'number' || offset % 1 !== 0)
39120 throw TypeError("Illegal offset: "+offset+" (not an integer)");
39121 offset >>>= 0;
39122 if (offset < 0 || offset + 0 > this.buffer.byteLength)
39123 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
39124 }
39125 if (typeof value === 'number')
39126 value = Long.fromNumber(value);
39127 else if (typeof value === 'string')
39128 value = Long.fromString(value);
39129 offset += 8;
39130 var capacity7 = this.buffer.byteLength;
39131 if (offset > capacity7)
39132 this.resize((capacity7 *= 2) > offset ? capacity7 : offset);
39133 offset -= 8;
39134 var lo = value.low,
39135 hi = value.high;
39136 if (this.littleEndian) {
39137 this.view[offset+3] = (lo >>> 24) & 0xFF;
39138 this.view[offset+2] = (lo >>> 16) & 0xFF;
39139 this.view[offset+1] = (lo >>> 8) & 0xFF;
39140 this.view[offset ] = lo & 0xFF;
39141 offset += 4;
39142 this.view[offset+3] = (hi >>> 24) & 0xFF;
39143 this.view[offset+2] = (hi >>> 16) & 0xFF;
39144 this.view[offset+1] = (hi >>> 8) & 0xFF;
39145 this.view[offset ] = hi & 0xFF;
39146 } else {
39147 this.view[offset ] = (hi >>> 24) & 0xFF;
39148 this.view[offset+1] = (hi >>> 16) & 0xFF;
39149 this.view[offset+2] = (hi >>> 8) & 0xFF;
39150 this.view[offset+3] = hi & 0xFF;
39151 offset += 4;
39152 this.view[offset ] = (lo >>> 24) & 0xFF;
39153 this.view[offset+1] = (lo >>> 16) & 0xFF;
39154 this.view[offset+2] = (lo >>> 8) & 0xFF;
39155 this.view[offset+3] = lo & 0xFF;
39156 }
39157 if (relative) this.offset += 8;
39158 return this;
39159 };
39160
39161 /**
39162 * Writes a 64bit unsigned integer. This is an alias of {@link ByteBuffer#writeUint64}.
39163 * @function
39164 * @param {number|!Long} value Value to write
39165 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
39166 * @returns {!ByteBuffer} this
39167 * @expose
39168 */
39169 ByteBufferPrototype.writeUInt64 = ByteBufferPrototype.writeUint64;
39170
39171 /**
39172 * Reads a 64bit unsigned integer.
39173 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
39174 * @returns {!Long}
39175 * @expose
39176 */
39177 ByteBufferPrototype.readUint64 = function(offset) {
39178 var relative = typeof offset === 'undefined';
39179 if (relative) offset = this.offset;
39180 if (!this.noAssert) {
39181 if (typeof offset !== 'number' || offset % 1 !== 0)
39182 throw TypeError("Illegal offset: "+offset+" (not an integer)");
39183 offset >>>= 0;
39184 if (offset < 0 || offset + 8 > this.buffer.byteLength)
39185 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+8+") <= "+this.buffer.byteLength);
39186 }
39187 var lo = 0,
39188 hi = 0;
39189 if (this.littleEndian) {
39190 lo = this.view[offset+2] << 16;
39191 lo |= this.view[offset+1] << 8;
39192 lo |= this.view[offset ];
39193 lo += this.view[offset+3] << 24 >>> 0;
39194 offset += 4;
39195 hi = this.view[offset+2] << 16;
39196 hi |= this.view[offset+1] << 8;
39197 hi |= this.view[offset ];
39198 hi += this.view[offset+3] << 24 >>> 0;
39199 } else {
39200 hi = this.view[offset+1] << 16;
39201 hi |= this.view[offset+2] << 8;
39202 hi |= this.view[offset+3];
39203 hi += this.view[offset ] << 24 >>> 0;
39204 offset += 4;
39205 lo = this.view[offset+1] << 16;
39206 lo |= this.view[offset+2] << 8;
39207 lo |= this.view[offset+3];
39208 lo += this.view[offset ] << 24 >>> 0;
39209 }
39210 var value = new Long(lo, hi, true);
39211 if (relative) this.offset += 8;
39212 return value;
39213 };
39214
39215 /**
39216 * Reads a 64bit unsigned integer. This is an alias of {@link ByteBuffer#readUint64}.
39217 * @function
39218 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
39219 * @returns {!Long}
39220 * @expose
39221 */
39222 ByteBufferPrototype.readUInt64 = ByteBufferPrototype.readUint64;
39223
39224 } // Long
39225
39226
39227 // types/floats/float32
39228
39229 /*
39230 ieee754 - https://github.com/feross/ieee754
39231
39232 The MIT License (MIT)
39233
39234 Copyright (c) Feross Aboukhadijeh
39235
39236 Permission is hereby granted, free of charge, to any person obtaining a copy
39237 of this software and associated documentation files (the "Software"), to deal
39238 in the Software without restriction, including without limitation the rights
39239 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
39240 copies of the Software, and to permit persons to whom the Software is
39241 furnished to do so, subject to the following conditions:
39242
39243 The above copyright notice and this permission notice shall be included in
39244 all copies or substantial portions of the Software.
39245
39246 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
39247 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
39248 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
39249 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
39250 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
39251 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
39252 THE SOFTWARE.
39253 */
39254
39255 /**
39256 * Reads an IEEE754 float from a byte array.
39257 * @param {!Array} buffer
39258 * @param {number} offset
39259 * @param {boolean} isLE
39260 * @param {number} mLen
39261 * @param {number} nBytes
39262 * @returns {number}
39263 * @inner
39264 */
39265 function ieee754_read(buffer, offset, isLE, mLen, nBytes) {
39266 var e, m,
39267 eLen = nBytes * 8 - mLen - 1,
39268 eMax = (1 << eLen) - 1,
39269 eBias = eMax >> 1,
39270 nBits = -7,
39271 i = isLE ? (nBytes - 1) : 0,
39272 d = isLE ? -1 : 1,
39273 s = buffer[offset + i];
39274
39275 i += d;
39276
39277 e = s & ((1 << (-nBits)) - 1);
39278 s >>= (-nBits);
39279 nBits += eLen;
39280 for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8) {}
39281
39282 m = e & ((1 << (-nBits)) - 1);
39283 e >>= (-nBits);
39284 nBits += mLen;
39285 for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8) {}
39286
39287 if (e === 0) {
39288 e = 1 - eBias;
39289 } else if (e === eMax) {
39290 return m ? NaN : ((s ? -1 : 1) * Infinity);
39291 } else {
39292 m = m + Math.pow(2, mLen);
39293 e = e - eBias;
39294 }
39295 return (s ? -1 : 1) * m * Math.pow(2, e - mLen);
39296 }
39297
39298 /**
39299 * Writes an IEEE754 float to a byte array.
39300 * @param {!Array} buffer
39301 * @param {number} value
39302 * @param {number} offset
39303 * @param {boolean} isLE
39304 * @param {number} mLen
39305 * @param {number} nBytes
39306 * @inner
39307 */
39308 function ieee754_write(buffer, value, offset, isLE, mLen, nBytes) {
39309 var e, m, c,
39310 eLen = nBytes * 8 - mLen - 1,
39311 eMax = (1 << eLen) - 1,
39312 eBias = eMax >> 1,
39313 rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0),
39314 i = isLE ? 0 : (nBytes - 1),
39315 d = isLE ? 1 : -1,
39316 s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0;
39317
39318 value = Math.abs(value);
39319
39320 if (isNaN(value) || value === Infinity) {
39321 m = isNaN(value) ? 1 : 0;
39322 e = eMax;
39323 } else {
39324 e = Math.floor(Math.log(value) / Math.LN2);
39325 if (value * (c = Math.pow(2, -e)) < 1) {
39326 e--;
39327 c *= 2;
39328 }
39329 if (e + eBias >= 1) {
39330 value += rt / c;
39331 } else {
39332 value += rt * Math.pow(2, 1 - eBias);
39333 }
39334 if (value * c >= 2) {
39335 e++;
39336 c /= 2;
39337 }
39338
39339 if (e + eBias >= eMax) {
39340 m = 0;
39341 e = eMax;
39342 } else if (e + eBias >= 1) {
39343 m = (value * c - 1) * Math.pow(2, mLen);
39344 e = e + eBias;
39345 } else {
39346 m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen);
39347 e = 0;
39348 }
39349 }
39350
39351 for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
39352
39353 e = (e << mLen) | m;
39354 eLen += mLen;
39355 for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
39356
39357 buffer[offset + i - d] |= s * 128;
39358 }
39359
39360 /**
39361 * Writes a 32bit float.
39362 * @param {number} value Value to write
39363 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `4` if omitted.
39364 * @returns {!ByteBuffer} this
39365 * @expose
39366 */
39367 ByteBufferPrototype.writeFloat32 = function(value, offset) {
39368 var relative = typeof offset === 'undefined';
39369 if (relative) offset = this.offset;
39370 if (!this.noAssert) {
39371 if (typeof value !== 'number')
39372 throw TypeError("Illegal value: "+value+" (not a number)");
39373 if (typeof offset !== 'number' || offset % 1 !== 0)
39374 throw TypeError("Illegal offset: "+offset+" (not an integer)");
39375 offset >>>= 0;
39376 if (offset < 0 || offset + 0 > this.buffer.byteLength)
39377 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
39378 }
39379 offset += 4;
39380 var capacity8 = this.buffer.byteLength;
39381 if (offset > capacity8)
39382 this.resize((capacity8 *= 2) > offset ? capacity8 : offset);
39383 offset -= 4;
39384 ieee754_write(this.view, value, offset, this.littleEndian, 23, 4);
39385 if (relative) this.offset += 4;
39386 return this;
39387 };
39388
39389 /**
39390 * Writes a 32bit float. This is an alias of {@link ByteBuffer#writeFloat32}.
39391 * @function
39392 * @param {number} value Value to write
39393 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `4` if omitted.
39394 * @returns {!ByteBuffer} this
39395 * @expose
39396 */
39397 ByteBufferPrototype.writeFloat = ByteBufferPrototype.writeFloat32;
39398
39399 /**
39400 * Reads a 32bit float.
39401 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `4` if omitted.
39402 * @returns {number}
39403 * @expose
39404 */
39405 ByteBufferPrototype.readFloat32 = function(offset) {
39406 var relative = typeof offset === 'undefined';
39407 if (relative) offset = this.offset;
39408 if (!this.noAssert) {
39409 if (typeof offset !== 'number' || offset % 1 !== 0)
39410 throw TypeError("Illegal offset: "+offset+" (not an integer)");
39411 offset >>>= 0;
39412 if (offset < 0 || offset + 4 > this.buffer.byteLength)
39413 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+4+") <= "+this.buffer.byteLength);
39414 }
39415 var value = ieee754_read(this.view, offset, this.littleEndian, 23, 4);
39416 if (relative) this.offset += 4;
39417 return value;
39418 };
39419
39420 /**
39421 * Reads a 32bit float. This is an alias of {@link ByteBuffer#readFloat32}.
39422 * @function
39423 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `4` if omitted.
39424 * @returns {number}
39425 * @expose
39426 */
39427 ByteBufferPrototype.readFloat = ByteBufferPrototype.readFloat32;
39428
39429 // types/floats/float64
39430
39431 /**
39432 * Writes a 64bit float.
39433 * @param {number} value Value to write
39434 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
39435 * @returns {!ByteBuffer} this
39436 * @expose
39437 */
39438 ByteBufferPrototype.writeFloat64 = function(value, offset) {
39439 var relative = typeof offset === 'undefined';
39440 if (relative) offset = this.offset;
39441 if (!this.noAssert) {
39442 if (typeof value !== 'number')
39443 throw TypeError("Illegal value: "+value+" (not a number)");
39444 if (typeof offset !== 'number' || offset % 1 !== 0)
39445 throw TypeError("Illegal offset: "+offset+" (not an integer)");
39446 offset >>>= 0;
39447 if (offset < 0 || offset + 0 > this.buffer.byteLength)
39448 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
39449 }
39450 offset += 8;
39451 var capacity9 = this.buffer.byteLength;
39452 if (offset > capacity9)
39453 this.resize((capacity9 *= 2) > offset ? capacity9 : offset);
39454 offset -= 8;
39455 ieee754_write(this.view, value, offset, this.littleEndian, 52, 8);
39456 if (relative) this.offset += 8;
39457 return this;
39458 };
39459
39460 /**
39461 * Writes a 64bit float. This is an alias of {@link ByteBuffer#writeFloat64}.
39462 * @function
39463 * @param {number} value Value to write
39464 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
39465 * @returns {!ByteBuffer} this
39466 * @expose
39467 */
39468 ByteBufferPrototype.writeDouble = ByteBufferPrototype.writeFloat64;
39469
39470 /**
39471 * Reads a 64bit float.
39472 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
39473 * @returns {number}
39474 * @expose
39475 */
39476 ByteBufferPrototype.readFloat64 = function(offset) {
39477 var relative = typeof offset === 'undefined';
39478 if (relative) offset = this.offset;
39479 if (!this.noAssert) {
39480 if (typeof offset !== 'number' || offset % 1 !== 0)
39481 throw TypeError("Illegal offset: "+offset+" (not an integer)");
39482 offset >>>= 0;
39483 if (offset < 0 || offset + 8 > this.buffer.byteLength)
39484 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+8+") <= "+this.buffer.byteLength);
39485 }
39486 var value = ieee754_read(this.view, offset, this.littleEndian, 52, 8);
39487 if (relative) this.offset += 8;
39488 return value;
39489 };
39490
39491 /**
39492 * Reads a 64bit float. This is an alias of {@link ByteBuffer#readFloat64}.
39493 * @function
39494 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
39495 * @returns {number}
39496 * @expose
39497 */
39498 ByteBufferPrototype.readDouble = ByteBufferPrototype.readFloat64;
39499
39500
39501 // types/varints/varint32
39502
39503 /**
39504 * Maximum number of bytes required to store a 32bit base 128 variable-length integer.
39505 * @type {number}
39506 * @const
39507 * @expose
39508 */
39509 ByteBuffer.MAX_VARINT32_BYTES = 5;
39510
39511 /**
39512 * Calculates the actual number of bytes required to store a 32bit base 128 variable-length integer.
39513 * @param {number} value Value to encode
39514 * @returns {number} Number of bytes required. Capped to {@link ByteBuffer.MAX_VARINT32_BYTES}
39515 * @expose
39516 */
39517 ByteBuffer.calculateVarint32 = function(value) {
39518 // ref: src/google/protobuf/io/coded_stream.cc
39519 value = value >>> 0;
39520 if (value < 1 << 7 ) return 1;
39521 else if (value < 1 << 14) return 2;
39522 else if (value < 1 << 21) return 3;
39523 else if (value < 1 << 28) return 4;
39524 else return 5;
39525 };
39526
39527 /**
39528 * Zigzag encodes a signed 32bit integer so that it can be effectively used with varint encoding.
39529 * @param {number} n Signed 32bit integer
39530 * @returns {number} Unsigned zigzag encoded 32bit integer
39531 * @expose
39532 */
39533 ByteBuffer.zigZagEncode32 = function(n) {
39534 return (((n |= 0) << 1) ^ (n >> 31)) >>> 0; // ref: src/google/protobuf/wire_format_lite.h
39535 };
39536
39537 /**
39538 * Decodes a zigzag encoded signed 32bit integer.
39539 * @param {number} n Unsigned zigzag encoded 32bit integer
39540 * @returns {number} Signed 32bit integer
39541 * @expose
39542 */
39543 ByteBuffer.zigZagDecode32 = function(n) {
39544 return ((n >>> 1) ^ -(n & 1)) | 0; // // ref: src/google/protobuf/wire_format_lite.h
39545 };
39546
39547 /**
39548 * Writes a 32bit base 128 variable-length integer.
39549 * @param {number} value Value to write
39550 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by the number of bytes
39551 * written if omitted.
39552 * @returns {!ByteBuffer|number} this if `offset` is omitted, else the actual number of bytes written
39553 * @expose
39554 */
39555 ByteBufferPrototype.writeVarint32 = function(value, offset) {
39556 var relative = typeof offset === 'undefined';
39557 if (relative) offset = this.offset;
39558 if (!this.noAssert) {
39559 if (typeof value !== 'number' || value % 1 !== 0)
39560 throw TypeError("Illegal value: "+value+" (not an integer)");
39561 value |= 0;
39562 if (typeof offset !== 'number' || offset % 1 !== 0)
39563 throw TypeError("Illegal offset: "+offset+" (not an integer)");
39564 offset >>>= 0;
39565 if (offset < 0 || offset + 0 > this.buffer.byteLength)
39566 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
39567 }
39568 var size = ByteBuffer.calculateVarint32(value),
39569 b;
39570 offset += size;
39571 var capacity10 = this.buffer.byteLength;
39572 if (offset > capacity10)
39573 this.resize((capacity10 *= 2) > offset ? capacity10 : offset);
39574 offset -= size;
39575 value >>>= 0;
39576 while (value >= 0x80) {
39577 b = (value & 0x7f) | 0x80;
39578 this.view[offset++] = b;
39579 value >>>= 7;
39580 }
39581 this.view[offset++] = value;
39582 if (relative) {
39583 this.offset = offset;
39584 return this;
39585 }
39586 return size;
39587 };
39588
39589 /**
39590 * Writes a zig-zag encoded (signed) 32bit base 128 variable-length integer.
39591 * @param {number} value Value to write
39592 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by the number of bytes
39593 * written if omitted.
39594 * @returns {!ByteBuffer|number} this if `offset` is omitted, else the actual number of bytes written
39595 * @expose
39596 */
39597 ByteBufferPrototype.writeVarint32ZigZag = function(value, offset) {
39598 return this.writeVarint32(ByteBuffer.zigZagEncode32(value), offset);
39599 };
39600
39601 /**
39602 * Reads a 32bit base 128 variable-length integer.
39603 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by the number of bytes
39604 * written if omitted.
39605 * @returns {number|!{value: number, length: number}} The value read if offset is omitted, else the value read
39606 * and the actual number of bytes read.
39607 * @throws {Error} If it's not a valid varint. Has a property `truncated = true` if there is not enough data available
39608 * to fully decode the varint.
39609 * @expose
39610 */
39611 ByteBufferPrototype.readVarint32 = function(offset) {
39612 var relative = typeof offset === 'undefined';
39613 if (relative) offset = this.offset;
39614 if (!this.noAssert) {
39615 if (typeof offset !== 'number' || offset % 1 !== 0)
39616 throw TypeError("Illegal offset: "+offset+" (not an integer)");
39617 offset >>>= 0;
39618 if (offset < 0 || offset + 1 > this.buffer.byteLength)
39619 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+1+") <= "+this.buffer.byteLength);
39620 }
39621 var c = 0,
39622 value = 0 >>> 0,
39623 b;
39624 do {
39625 if (!this.noAssert && offset > this.limit) {
39626 var err = Error("Truncated");
39627 err['truncated'] = true;
39628 throw err;
39629 }
39630 b = this.view[offset++];
39631 if (c < 5)
39632 value |= (b & 0x7f) << (7*c);
39633 ++c;
39634 } while ((b & 0x80) !== 0);
39635 value |= 0;
39636 if (relative) {
39637 this.offset = offset;
39638 return value;
39639 }
39640 return {
39641 "value": value,
39642 "length": c
39643 };
39644 };
39645
39646 /**
39647 * Reads a zig-zag encoded (signed) 32bit base 128 variable-length integer.
39648 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by the number of bytes
39649 * written if omitted.
39650 * @returns {number|!{value: number, length: number}} The value read if offset is omitted, else the value read
39651 * and the actual number of bytes read.
39652 * @throws {Error} If it's not a valid varint
39653 * @expose
39654 */
39655 ByteBufferPrototype.readVarint32ZigZag = function(offset) {
39656 var val = this.readVarint32(offset);
39657 if (typeof val === 'object')
39658 val["value"] = ByteBuffer.zigZagDecode32(val["value"]);
39659 else
39660 val = ByteBuffer.zigZagDecode32(val);
39661 return val;
39662 };
39663
39664 // types/varints/varint64
39665
39666 if (Long) {
39667
39668 /**
39669 * Maximum number of bytes required to store a 64bit base 128 variable-length integer.
39670 * @type {number}
39671 * @const
39672 * @expose
39673 */
39674 ByteBuffer.MAX_VARINT64_BYTES = 10;
39675
39676 /**
39677 * Calculates the actual number of bytes required to store a 64bit base 128 variable-length integer.
39678 * @param {number|!Long} value Value to encode
39679 * @returns {number} Number of bytes required. Capped to {@link ByteBuffer.MAX_VARINT64_BYTES}
39680 * @expose
39681 */
39682 ByteBuffer.calculateVarint64 = function(value) {
39683 if (typeof value === 'number')
39684 value = Long.fromNumber(value);
39685 else if (typeof value === 'string')
39686 value = Long.fromString(value);
39687 // ref: src/google/protobuf/io/coded_stream.cc
39688 var part0 = value.toInt() >>> 0,
39689 part1 = value.shiftRightUnsigned(28).toInt() >>> 0,
39690 part2 = value.shiftRightUnsigned(56).toInt() >>> 0;
39691 if (part2 == 0) {
39692 if (part1 == 0) {
39693 if (part0 < 1 << 14)
39694 return part0 < 1 << 7 ? 1 : 2;
39695 else
39696 return part0 < 1 << 21 ? 3 : 4;
39697 } else {
39698 if (part1 < 1 << 14)
39699 return part1 < 1 << 7 ? 5 : 6;
39700 else
39701 return part1 < 1 << 21 ? 7 : 8;
39702 }
39703 } else
39704 return part2 < 1 << 7 ? 9 : 10;
39705 };
39706
39707 /**
39708 * Zigzag encodes a signed 64bit integer so that it can be effectively used with varint encoding.
39709 * @param {number|!Long} value Signed long
39710 * @returns {!Long} Unsigned zigzag encoded long
39711 * @expose
39712 */
39713 ByteBuffer.zigZagEncode64 = function(value) {
39714 if (typeof value === 'number')
39715 value = Long.fromNumber(value, false);
39716 else if (typeof value === 'string')
39717 value = Long.fromString(value, false);
39718 else if (value.unsigned !== false) value = value.toSigned();
39719 // ref: src/google/protobuf/wire_format_lite.h
39720 return value.shiftLeft(1).xor(value.shiftRight(63)).toUnsigned();
39721 };
39722
39723 /**
39724 * Decodes a zigzag encoded signed 64bit integer.
39725 * @param {!Long|number} value Unsigned zigzag encoded long or JavaScript number
39726 * @returns {!Long} Signed long
39727 * @expose
39728 */
39729 ByteBuffer.zigZagDecode64 = function(value) {
39730 if (typeof value === 'number')
39731 value = Long.fromNumber(value, false);
39732 else if (typeof value === 'string')
39733 value = Long.fromString(value, false);
39734 else if (value.unsigned !== false) value = value.toSigned();
39735 // ref: src/google/protobuf/wire_format_lite.h
39736 return value.shiftRightUnsigned(1).xor(value.and(Long.ONE).toSigned().negate()).toSigned();
39737 };
39738
39739 /**
39740 * Writes a 64bit base 128 variable-length integer.
39741 * @param {number|Long} value Value to write
39742 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by the number of bytes
39743 * written if omitted.
39744 * @returns {!ByteBuffer|number} `this` if offset is omitted, else the actual number of bytes written.
39745 * @expose
39746 */
39747 ByteBufferPrototype.writeVarint64 = function(value, offset) {
39748 var relative = typeof offset === 'undefined';
39749 if (relative) offset = this.offset;
39750 if (!this.noAssert) {
39751 if (typeof value === 'number')
39752 value = Long.fromNumber(value);
39753 else if (typeof value === 'string')
39754 value = Long.fromString(value);
39755 else if (!(value && value instanceof Long))
39756 throw TypeError("Illegal value: "+value+" (not an integer or Long)");
39757 if (typeof offset !== 'number' || offset % 1 !== 0)
39758 throw TypeError("Illegal offset: "+offset+" (not an integer)");
39759 offset >>>= 0;
39760 if (offset < 0 || offset + 0 > this.buffer.byteLength)
39761 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
39762 }
39763 if (typeof value === 'number')
39764 value = Long.fromNumber(value, false);
39765 else if (typeof value === 'string')
39766 value = Long.fromString(value, false);
39767 else if (value.unsigned !== false) value = value.toSigned();
39768 var size = ByteBuffer.calculateVarint64(value),
39769 part0 = value.toInt() >>> 0,
39770 part1 = value.shiftRightUnsigned(28).toInt() >>> 0,
39771 part2 = value.shiftRightUnsigned(56).toInt() >>> 0;
39772 offset += size;
39773 var capacity11 = this.buffer.byteLength;
39774 if (offset > capacity11)
39775 this.resize((capacity11 *= 2) > offset ? capacity11 : offset);
39776 offset -= size;
39777 switch (size) {
39778 case 10: this.view[offset+9] = (part2 >>> 7) & 0x01;
39779 case 9 : this.view[offset+8] = size !== 9 ? (part2 ) | 0x80 : (part2 ) & 0x7F;
39780 case 8 : this.view[offset+7] = size !== 8 ? (part1 >>> 21) | 0x80 : (part1 >>> 21) & 0x7F;
39781 case 7 : this.view[offset+6] = size !== 7 ? (part1 >>> 14) | 0x80 : (part1 >>> 14) & 0x7F;
39782 case 6 : this.view[offset+5] = size !== 6 ? (part1 >>> 7) | 0x80 : (part1 >>> 7) & 0x7F;
39783 case 5 : this.view[offset+4] = size !== 5 ? (part1 ) | 0x80 : (part1 ) & 0x7F;
39784 case 4 : this.view[offset+3] = size !== 4 ? (part0 >>> 21) | 0x80 : (part0 >>> 21) & 0x7F;
39785 case 3 : this.view[offset+2] = size !== 3 ? (part0 >>> 14) | 0x80 : (part0 >>> 14) & 0x7F;
39786 case 2 : this.view[offset+1] = size !== 2 ? (part0 >>> 7) | 0x80 : (part0 >>> 7) & 0x7F;
39787 case 1 : this.view[offset ] = size !== 1 ? (part0 ) | 0x80 : (part0 ) & 0x7F;
39788 }
39789 if (relative) {
39790 this.offset += size;
39791 return this;
39792 } else {
39793 return size;
39794 }
39795 };
39796
39797 /**
39798 * Writes a zig-zag encoded 64bit base 128 variable-length integer.
39799 * @param {number|Long} value Value to write
39800 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by the number of bytes
39801 * written if omitted.
39802 * @returns {!ByteBuffer|number} `this` if offset is omitted, else the actual number of bytes written.
39803 * @expose
39804 */
39805 ByteBufferPrototype.writeVarint64ZigZag = function(value, offset) {
39806 return this.writeVarint64(ByteBuffer.zigZagEncode64(value), offset);
39807 };
39808
39809 /**
39810 * Reads a 64bit base 128 variable-length integer. Requires Long.js.
39811 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by the number of bytes
39812 * read if omitted.
39813 * @returns {!Long|!{value: Long, length: number}} The value read if offset is omitted, else the value read and
39814 * the actual number of bytes read.
39815 * @throws {Error} If it's not a valid varint
39816 * @expose
39817 */
39818 ByteBufferPrototype.readVarint64 = function(offset) {
39819 var relative = typeof offset === 'undefined';
39820 if (relative) offset = this.offset;
39821 if (!this.noAssert) {
39822 if (typeof offset !== 'number' || offset % 1 !== 0)
39823 throw TypeError("Illegal offset: "+offset+" (not an integer)");
39824 offset >>>= 0;
39825 if (offset < 0 || offset + 1 > this.buffer.byteLength)
39826 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+1+") <= "+this.buffer.byteLength);
39827 }
39828 // ref: src/google/protobuf/io/coded_stream.cc
39829 var start = offset,
39830 part0 = 0,
39831 part1 = 0,
39832 part2 = 0,
39833 b = 0;
39834 b = this.view[offset++]; part0 = (b & 0x7F) ; if ( b & 0x80 ) {
39835 b = this.view[offset++]; part0 |= (b & 0x7F) << 7; if ((b & 0x80) || (this.noAssert && typeof b === 'undefined')) {
39836 b = this.view[offset++]; part0 |= (b & 0x7F) << 14; if ((b & 0x80) || (this.noAssert && typeof b === 'undefined')) {
39837 b = this.view[offset++]; part0 |= (b & 0x7F) << 21; if ((b & 0x80) || (this.noAssert && typeof b === 'undefined')) {
39838 b = this.view[offset++]; part1 = (b & 0x7F) ; if ((b & 0x80) || (this.noAssert && typeof b === 'undefined')) {
39839 b = this.view[offset++]; part1 |= (b & 0x7F) << 7; if ((b & 0x80) || (this.noAssert && typeof b === 'undefined')) {
39840 b = this.view[offset++]; part1 |= (b & 0x7F) << 14; if ((b & 0x80) || (this.noAssert && typeof b === 'undefined')) {
39841 b = this.view[offset++]; part1 |= (b & 0x7F) << 21; if ((b & 0x80) || (this.noAssert && typeof b === 'undefined')) {
39842 b = this.view[offset++]; part2 = (b & 0x7F) ; if ((b & 0x80) || (this.noAssert && typeof b === 'undefined')) {
39843 b = this.view[offset++]; part2 |= (b & 0x7F) << 7; if ((b & 0x80) || (this.noAssert && typeof b === 'undefined')) {
39844 throw Error("Buffer overrun"); }}}}}}}}}}
39845 var value = Long.fromBits(part0 | (part1 << 28), (part1 >>> 4) | (part2) << 24, false);
39846 if (relative) {
39847 this.offset = offset;
39848 return value;
39849 } else {
39850 return {
39851 'value': value,
39852 'length': offset-start
39853 };
39854 }
39855 };
39856
39857 /**
39858 * Reads a zig-zag encoded 64bit base 128 variable-length integer. Requires Long.js.
39859 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by the number of bytes
39860 * read if omitted.
39861 * @returns {!Long|!{value: Long, length: number}} The value read if offset is omitted, else the value read and
39862 * the actual number of bytes read.
39863 * @throws {Error} If it's not a valid varint
39864 * @expose
39865 */
39866 ByteBufferPrototype.readVarint64ZigZag = function(offset) {
39867 var val = this.readVarint64(offset);
39868 if (val && val['value'] instanceof Long)
39869 val["value"] = ByteBuffer.zigZagDecode64(val["value"]);
39870 else
39871 val = ByteBuffer.zigZagDecode64(val);
39872 return val;
39873 };
39874
39875 } // Long
39876
39877
39878 // types/strings/cstring
39879
39880 /**
39881 * Writes a NULL-terminated UTF8 encoded string. For this to work the specified string must not contain any NULL
39882 * characters itself.
39883 * @param {string} str String to write
39884 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by the number of bytes
39885 * contained in `str` + 1 if omitted.
39886 * @returns {!ByteBuffer|number} this if offset is omitted, else the actual number of bytes written
39887 * @expose
39888 */
39889 ByteBufferPrototype.writeCString = function(str, offset) {
39890 var relative = typeof offset === 'undefined';
39891 if (relative) offset = this.offset;
39892 var i,
39893 k = str.length;
39894 if (!this.noAssert) {
39895 if (typeof str !== 'string')
39896 throw TypeError("Illegal str: Not a string");
39897 for (i=0; i<k; ++i) {
39898 if (str.charCodeAt(i) === 0)
39899 throw RangeError("Illegal str: Contains NULL-characters");
39900 }
39901 if (typeof offset !== 'number' || offset % 1 !== 0)
39902 throw TypeError("Illegal offset: "+offset+" (not an integer)");
39903 offset >>>= 0;
39904 if (offset < 0 || offset + 0 > this.buffer.byteLength)
39905 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
39906 }
39907 // UTF8 strings do not contain zero bytes in between except for the zero character, so:
39908 k = utfx.calculateUTF16asUTF8(stringSource(str))[1];
39909 offset += k+1;
39910 var capacity12 = this.buffer.byteLength;
39911 if (offset > capacity12)
39912 this.resize((capacity12 *= 2) > offset ? capacity12 : offset);
39913 offset -= k+1;
39914 utfx.encodeUTF16toUTF8(stringSource(str), function(b) {
39915 this.view[offset++] = b;
39916 }.bind(this));
39917 this.view[offset++] = 0;
39918 if (relative) {
39919 this.offset = offset;
39920 return this;
39921 }
39922 return k;
39923 };
39924
39925 /**
39926 * Reads a NULL-terminated UTF8 encoded string. For this to work the string read must not contain any NULL characters
39927 * itself.
39928 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by the number of bytes
39929 * read if omitted.
39930 * @returns {string|!{string: string, length: number}} The string read if offset is omitted, else the string
39931 * read and the actual number of bytes read.
39932 * @expose
39933 */
39934 ByteBufferPrototype.readCString = function(offset) {
39935 var relative = typeof offset === 'undefined';
39936 if (relative) offset = this.offset;
39937 if (!this.noAssert) {
39938 if (typeof offset !== 'number' || offset % 1 !== 0)
39939 throw TypeError("Illegal offset: "+offset+" (not an integer)");
39940 offset >>>= 0;
39941 if (offset < 0 || offset + 1 > this.buffer.byteLength)
39942 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+1+") <= "+this.buffer.byteLength);
39943 }
39944 var start = offset,
39945 temp;
39946 // UTF8 strings do not contain zero bytes in between except for the zero character itself, so:
39947 var sd, b = -1;
39948 utfx.decodeUTF8toUTF16(function() {
39949 if (b === 0) return null;
39950 if (offset >= this.limit)
39951 throw RangeError("Illegal range: Truncated data, "+offset+" < "+this.limit);
39952 b = this.view[offset++];
39953 return b === 0 ? null : b;
39954 }.bind(this), sd = stringDestination(), true);
39955 if (relative) {
39956 this.offset = offset;
39957 return sd();
39958 } else {
39959 return {
39960 "string": sd(),
39961 "length": offset - start
39962 };
39963 }
39964 };
39965
39966 // types/strings/istring
39967
39968 /**
39969 * Writes a length as uint32 prefixed UTF8 encoded string.
39970 * @param {string} str String to write
39971 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by the number of bytes
39972 * written if omitted.
39973 * @returns {!ByteBuffer|number} `this` if `offset` is omitted, else the actual number of bytes written
39974 * @expose
39975 * @see ByteBuffer#writeVarint32
39976 */
39977 ByteBufferPrototype.writeIString = function(str, offset) {
39978 var relative = typeof offset === 'undefined';
39979 if (relative) offset = this.offset;
39980 if (!this.noAssert) {
39981 if (typeof str !== 'string')
39982 throw TypeError("Illegal str: Not a string");
39983 if (typeof offset !== 'number' || offset % 1 !== 0)
39984 throw TypeError("Illegal offset: "+offset+" (not an integer)");
39985 offset >>>= 0;
39986 if (offset < 0 || offset + 0 > this.buffer.byteLength)
39987 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
39988 }
39989 var start = offset,
39990 k;
39991 k = utfx.calculateUTF16asUTF8(stringSource(str), this.noAssert)[1];
39992 offset += 4+k;
39993 var capacity13 = this.buffer.byteLength;
39994 if (offset > capacity13)
39995 this.resize((capacity13 *= 2) > offset ? capacity13 : offset);
39996 offset -= 4+k;
39997 if (this.littleEndian) {
39998 this.view[offset+3] = (k >>> 24) & 0xFF;
39999 this.view[offset+2] = (k >>> 16) & 0xFF;
40000 this.view[offset+1] = (k >>> 8) & 0xFF;
40001 this.view[offset ] = k & 0xFF;
40002 } else {
40003 this.view[offset ] = (k >>> 24) & 0xFF;
40004 this.view[offset+1] = (k >>> 16) & 0xFF;
40005 this.view[offset+2] = (k >>> 8) & 0xFF;
40006 this.view[offset+3] = k & 0xFF;
40007 }
40008 offset += 4;
40009 utfx.encodeUTF16toUTF8(stringSource(str), function(b) {
40010 this.view[offset++] = b;
40011 }.bind(this));
40012 if (offset !== start + 4 + k)
40013 throw RangeError("Illegal range: Truncated data, "+offset+" == "+(offset+4+k));
40014 if (relative) {
40015 this.offset = offset;
40016 return this;
40017 }
40018 return offset - start;
40019 };
40020
40021 /**
40022 * Reads a length as uint32 prefixed UTF8 encoded string.
40023 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by the number of bytes
40024 * read if omitted.
40025 * @returns {string|!{string: string, length: number}} The string read if offset is omitted, else the string
40026 * read and the actual number of bytes read.
40027 * @expose
40028 * @see ByteBuffer#readVarint32
40029 */
40030 ByteBufferPrototype.readIString = function(offset) {
40031 var relative = typeof offset === 'undefined';
40032 if (relative) offset = this.offset;
40033 if (!this.noAssert) {
40034 if (typeof offset !== 'number' || offset % 1 !== 0)
40035 throw TypeError("Illegal offset: "+offset+" (not an integer)");
40036 offset >>>= 0;
40037 if (offset < 0 || offset + 4 > this.buffer.byteLength)
40038 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+4+") <= "+this.buffer.byteLength);
40039 }
40040 var start = offset;
40041 var len = this.readUint32(offset);
40042 var str = this.readUTF8String(len, ByteBuffer.METRICS_BYTES, offset += 4);
40043 offset += str['length'];
40044 if (relative) {
40045 this.offset = offset;
40046 return str['string'];
40047 } else {
40048 return {
40049 'string': str['string'],
40050 'length': offset - start
40051 };
40052 }
40053 };
40054
40055 // types/strings/utf8string
40056
40057 /**
40058 * Metrics representing number of UTF8 characters. Evaluates to `c`.
40059 * @type {string}
40060 * @const
40061 * @expose
40062 */
40063 ByteBuffer.METRICS_CHARS = 'c';
40064
40065 /**
40066 * Metrics representing number of bytes. Evaluates to `b`.
40067 * @type {string}
40068 * @const
40069 * @expose
40070 */
40071 ByteBuffer.METRICS_BYTES = 'b';
40072
40073 /**
40074 * Writes an UTF8 encoded string.
40075 * @param {string} str String to write
40076 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} if omitted.
40077 * @returns {!ByteBuffer|number} this if offset is omitted, else the actual number of bytes written.
40078 * @expose
40079 */
40080 ByteBufferPrototype.writeUTF8String = function(str, offset) {
40081 var relative = typeof offset === 'undefined';
40082 if (relative) offset = this.offset;
40083 if (!this.noAssert) {
40084 if (typeof offset !== 'number' || offset % 1 !== 0)
40085 throw TypeError("Illegal offset: "+offset+" (not an integer)");
40086 offset >>>= 0;
40087 if (offset < 0 || offset + 0 > this.buffer.byteLength)
40088 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
40089 }
40090 var k;
40091 var start = offset;
40092 k = utfx.calculateUTF16asUTF8(stringSource(str))[1];
40093 offset += k;
40094 var capacity14 = this.buffer.byteLength;
40095 if (offset > capacity14)
40096 this.resize((capacity14 *= 2) > offset ? capacity14 : offset);
40097 offset -= k;
40098 utfx.encodeUTF16toUTF8(stringSource(str), function(b) {
40099 this.view[offset++] = b;
40100 }.bind(this));
40101 if (relative) {
40102 this.offset = offset;
40103 return this;
40104 }
40105 return offset - start;
40106 };
40107
40108 /**
40109 * Writes an UTF8 encoded string. This is an alias of {@link ByteBuffer#writeUTF8String}.
40110 * @function
40111 * @param {string} str String to write
40112 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} if omitted.
40113 * @returns {!ByteBuffer|number} this if offset is omitted, else the actual number of bytes written.
40114 * @expose
40115 */
40116 ByteBufferPrototype.writeString = ByteBufferPrototype.writeUTF8String;
40117
40118 /**
40119 * Calculates the number of UTF8 characters of a string. JavaScript itself uses UTF-16, so that a string's
40120 * `length` property does not reflect its actual UTF8 size if it contains code points larger than 0xFFFF.
40121 * @param {string} str String to calculate
40122 * @returns {number} Number of UTF8 characters
40123 * @expose
40124 */
40125 ByteBuffer.calculateUTF8Chars = function(str) {
40126 return utfx.calculateUTF16asUTF8(stringSource(str))[0];
40127 };
40128
40129 /**
40130 * Calculates the number of UTF8 bytes of a string.
40131 * @param {string} str String to calculate
40132 * @returns {number} Number of UTF8 bytes
40133 * @expose
40134 */
40135 ByteBuffer.calculateUTF8Bytes = function(str) {
40136 return utfx.calculateUTF16asUTF8(stringSource(str))[1];
40137 };
40138
40139 /**
40140 * Calculates the number of UTF8 bytes of a string. This is an alias of {@link ByteBuffer.calculateUTF8Bytes}.
40141 * @function
40142 * @param {string} str String to calculate
40143 * @returns {number} Number of UTF8 bytes
40144 * @expose
40145 */
40146 ByteBuffer.calculateString = ByteBuffer.calculateUTF8Bytes;
40147
40148 /**
40149 * Reads an UTF8 encoded string.
40150 * @param {number} length Number of characters or bytes to read.
40151 * @param {string=} metrics Metrics specifying what `length` is meant to count. Defaults to
40152 * {@link ByteBuffer.METRICS_CHARS}.
40153 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by the number of bytes
40154 * read if omitted.
40155 * @returns {string|!{string: string, length: number}} The string read if offset is omitted, else the string
40156 * read and the actual number of bytes read.
40157 * @expose
40158 */
40159 ByteBufferPrototype.readUTF8String = function(length, metrics, offset) {
40160 if (typeof metrics === 'number') {
40161 offset = metrics;
40162 metrics = undefined;
40163 }
40164 var relative = typeof offset === 'undefined';
40165 if (relative) offset = this.offset;
40166 if (typeof metrics === 'undefined') metrics = ByteBuffer.METRICS_CHARS;
40167 if (!this.noAssert) {
40168 if (typeof length !== 'number' || length % 1 !== 0)
40169 throw TypeError("Illegal length: "+length+" (not an integer)");
40170 length |= 0;
40171 if (typeof offset !== 'number' || offset % 1 !== 0)
40172 throw TypeError("Illegal offset: "+offset+" (not an integer)");
40173 offset >>>= 0;
40174 if (offset < 0 || offset + 0 > this.buffer.byteLength)
40175 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
40176 }
40177 var i = 0,
40178 start = offset,
40179 sd;
40180 if (metrics === ByteBuffer.METRICS_CHARS) { // The same for node and the browser
40181 sd = stringDestination();
40182 utfx.decodeUTF8(function() {
40183 return i < length && offset < this.limit ? this.view[offset++] : null;
40184 }.bind(this), function(cp) {
40185 ++i; utfx.UTF8toUTF16(cp, sd);
40186 });
40187 if (i !== length)
40188 throw RangeError("Illegal range: Truncated data, "+i+" == "+length);
40189 if (relative) {
40190 this.offset = offset;
40191 return sd();
40192 } else {
40193 return {
40194 "string": sd(),
40195 "length": offset - start
40196 };
40197 }
40198 } else if (metrics === ByteBuffer.METRICS_BYTES) {
40199 if (!this.noAssert) {
40200 if (typeof offset !== 'number' || offset % 1 !== 0)
40201 throw TypeError("Illegal offset: "+offset+" (not an integer)");
40202 offset >>>= 0;
40203 if (offset < 0 || offset + length > this.buffer.byteLength)
40204 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+length+") <= "+this.buffer.byteLength);
40205 }
40206 var k = offset + length;
40207 utfx.decodeUTF8toUTF16(function() {
40208 return offset < k ? this.view[offset++] : null;
40209 }.bind(this), sd = stringDestination(), this.noAssert);
40210 if (offset !== k)
40211 throw RangeError("Illegal range: Truncated data, "+offset+" == "+k);
40212 if (relative) {
40213 this.offset = offset;
40214 return sd();
40215 } else {
40216 return {
40217 'string': sd(),
40218 'length': offset - start
40219 };
40220 }
40221 } else
40222 throw TypeError("Unsupported metrics: "+metrics);
40223 };
40224
40225 /**
40226 * Reads an UTF8 encoded string. This is an alias of {@link ByteBuffer#readUTF8String}.
40227 * @function
40228 * @param {number} length Number of characters or bytes to read
40229 * @param {number=} metrics Metrics specifying what `n` is meant to count. Defaults to
40230 * {@link ByteBuffer.METRICS_CHARS}.
40231 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by the number of bytes
40232 * read if omitted.
40233 * @returns {string|!{string: string, length: number}} The string read if offset is omitted, else the string
40234 * read and the actual number of bytes read.
40235 * @expose
40236 */
40237 ByteBufferPrototype.readString = ByteBufferPrototype.readUTF8String;
40238
40239 // types/strings/vstring
40240
40241 /**
40242 * Writes a length as varint32 prefixed UTF8 encoded string.
40243 * @param {string} str String to write
40244 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by the number of bytes
40245 * written if omitted.
40246 * @returns {!ByteBuffer|number} `this` if `offset` is omitted, else the actual number of bytes written
40247 * @expose
40248 * @see ByteBuffer#writeVarint32
40249 */
40250 ByteBufferPrototype.writeVString = function(str, offset) {
40251 var relative = typeof offset === 'undefined';
40252 if (relative) offset = this.offset;
40253 if (!this.noAssert) {
40254 if (typeof str !== 'string')
40255 throw TypeError("Illegal str: Not a string");
40256 if (typeof offset !== 'number' || offset % 1 !== 0)
40257 throw TypeError("Illegal offset: "+offset+" (not an integer)");
40258 offset >>>= 0;
40259 if (offset < 0 || offset + 0 > this.buffer.byteLength)
40260 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
40261 }
40262 var start = offset,
40263 k, l;
40264 k = utfx.calculateUTF16asUTF8(stringSource(str), this.noAssert)[1];
40265 l = ByteBuffer.calculateVarint32(k);
40266 offset += l+k;
40267 var capacity15 = this.buffer.byteLength;
40268 if (offset > capacity15)
40269 this.resize((capacity15 *= 2) > offset ? capacity15 : offset);
40270 offset -= l+k;
40271 offset += this.writeVarint32(k, offset);
40272 utfx.encodeUTF16toUTF8(stringSource(str), function(b) {
40273 this.view[offset++] = b;
40274 }.bind(this));
40275 if (offset !== start+k+l)
40276 throw RangeError("Illegal range: Truncated data, "+offset+" == "+(offset+k+l));
40277 if (relative) {
40278 this.offset = offset;
40279 return this;
40280 }
40281 return offset - start;
40282 };
40283
40284 /**
40285 * Reads a length as varint32 prefixed UTF8 encoded string.
40286 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by the number of bytes
40287 * read if omitted.
40288 * @returns {string|!{string: string, length: number}} The string read if offset is omitted, else the string
40289 * read and the actual number of bytes read.
40290 * @expose
40291 * @see ByteBuffer#readVarint32
40292 */
40293 ByteBufferPrototype.readVString = function(offset) {
40294 var relative = typeof offset === 'undefined';
40295 if (relative) offset = this.offset;
40296 if (!this.noAssert) {
40297 if (typeof offset !== 'number' || offset % 1 !== 0)
40298 throw TypeError("Illegal offset: "+offset+" (not an integer)");
40299 offset >>>= 0;
40300 if (offset < 0 || offset + 1 > this.buffer.byteLength)
40301 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+1+") <= "+this.buffer.byteLength);
40302 }
40303 var start = offset;
40304 var len = this.readVarint32(offset);
40305 var str = this.readUTF8String(len['value'], ByteBuffer.METRICS_BYTES, offset += len['length']);
40306 offset += str['length'];
40307 if (relative) {
40308 this.offset = offset;
40309 return str['string'];
40310 } else {
40311 return {
40312 'string': str['string'],
40313 'length': offset - start
40314 };
40315 }
40316 };
40317
40318
40319 /**
40320 * Appends some data to this ByteBuffer. This will overwrite any contents behind the specified offset up to the appended
40321 * data's length.
40322 * @param {!ByteBuffer|!ArrayBuffer|!Uint8Array|string} source Data to append. If `source` is a ByteBuffer, its offsets
40323 * will be modified according to the performed read operation.
40324 * @param {(string|number)=} encoding Encoding if `data` is a string ("base64", "hex", "binary", defaults to "utf8")
40325 * @param {number=} offset Offset to append at. Will use and increase {@link ByteBuffer#offset} by the number of bytes
40326 * written if omitted.
40327 * @returns {!ByteBuffer} this
40328 * @expose
40329 * @example A relative `<01 02>03.append(<04 05>)` will result in `<01 02 04 05>, 04 05|`
40330 * @example An absolute `<01 02>03.append(04 05>, 1)` will result in `<01 04>05, 04 05|`
40331 */
40332 ByteBufferPrototype.append = function(source, encoding, offset) {
40333 if (typeof encoding === 'number' || typeof encoding !== 'string') {
40334 offset = encoding;
40335 encoding = undefined;
40336 }
40337 var relative = typeof offset === 'undefined';
40338 if (relative) offset = this.offset;
40339 if (!this.noAssert) {
40340 if (typeof offset !== 'number' || offset % 1 !== 0)
40341 throw TypeError("Illegal offset: "+offset+" (not an integer)");
40342 offset >>>= 0;
40343 if (offset < 0 || offset + 0 > this.buffer.byteLength)
40344 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
40345 }
40346 if (!(source instanceof ByteBuffer))
40347 source = ByteBuffer.wrap(source, encoding);
40348 var length = source.limit - source.offset;
40349 if (length <= 0) return this; // Nothing to append
40350 offset += length;
40351 var capacity16 = this.buffer.byteLength;
40352 if (offset > capacity16)
40353 this.resize((capacity16 *= 2) > offset ? capacity16 : offset);
40354 offset -= length;
40355 this.view.set(source.view.subarray(source.offset, source.limit), offset);
40356 source.offset += length;
40357 if (relative) this.offset += length;
40358 return this;
40359 };
40360
40361 /**
40362 * Appends this ByteBuffer's contents to another ByteBuffer. This will overwrite any contents at and after the
40363 specified offset up to the length of this ByteBuffer's data.
40364 * @param {!ByteBuffer} target Target ByteBuffer
40365 * @param {number=} offset Offset to append to. Will use and increase {@link ByteBuffer#offset} by the number of bytes
40366 * read if omitted.
40367 * @returns {!ByteBuffer} this
40368 * @expose
40369 * @see ByteBuffer#append
40370 */
40371 ByteBufferPrototype.appendTo = function(target, offset) {
40372 target.append(this, offset);
40373 return this;
40374 };
40375
40376 /**
40377 * Enables or disables assertions of argument types and offsets. Assertions are enabled by default but you can opt to
40378 * disable them if your code already makes sure that everything is valid.
40379 * @param {boolean} assert `true` to enable assertions, otherwise `false`
40380 * @returns {!ByteBuffer} this
40381 * @expose
40382 */
40383 ByteBufferPrototype.assert = function(assert) {
40384 this.noAssert = !assert;
40385 return this;
40386 };
40387
40388 /**
40389 * Gets the capacity of this ByteBuffer's backing buffer.
40390 * @returns {number} Capacity of the backing buffer
40391 * @expose
40392 */
40393 ByteBufferPrototype.capacity = function() {
40394 return this.buffer.byteLength;
40395 };
40396 /**
40397 * Clears this ByteBuffer's offsets by setting {@link ByteBuffer#offset} to `0` and {@link ByteBuffer#limit} to the
40398 * backing buffer's capacity. Discards {@link ByteBuffer#markedOffset}.
40399 * @returns {!ByteBuffer} this
40400 * @expose
40401 */
40402 ByteBufferPrototype.clear = function() {
40403 this.offset = 0;
40404 this.limit = this.buffer.byteLength;
40405 this.markedOffset = -1;
40406 return this;
40407 };
40408
40409 /**
40410 * Creates a cloned instance of this ByteBuffer, preset with this ByteBuffer's values for {@link ByteBuffer#offset},
40411 * {@link ByteBuffer#markedOffset} and {@link ByteBuffer#limit}.
40412 * @param {boolean=} copy Whether to copy the backing buffer or to return another view on the same, defaults to `false`
40413 * @returns {!ByteBuffer} Cloned instance
40414 * @expose
40415 */
40416 ByteBufferPrototype.clone = function(copy) {
40417 var bb = new ByteBuffer(0, this.littleEndian, this.noAssert);
40418 if (copy) {
40419 bb.buffer = new ArrayBuffer(this.buffer.byteLength);
40420 bb.view = new Uint8Array(bb.buffer);
40421 } else {
40422 bb.buffer = this.buffer;
40423 bb.view = this.view;
40424 }
40425 bb.offset = this.offset;
40426 bb.markedOffset = this.markedOffset;
40427 bb.limit = this.limit;
40428 return bb;
40429 };
40430
40431 /**
40432 * Compacts this ByteBuffer to be backed by a {@link ByteBuffer#buffer} of its contents' length. Contents are the bytes
40433 * between {@link ByteBuffer#offset} and {@link ByteBuffer#limit}. Will set `offset = 0` and `limit = capacity` and
40434 * adapt {@link ByteBuffer#markedOffset} to the same relative position if set.
40435 * @param {number=} begin Offset to start at, defaults to {@link ByteBuffer#offset}
40436 * @param {number=} end Offset to end at, defaults to {@link ByteBuffer#limit}
40437 * @returns {!ByteBuffer} this
40438 * @expose
40439 */
40440 ByteBufferPrototype.compact = function(begin, end) {
40441 if (typeof begin === 'undefined') begin = this.offset;
40442 if (typeof end === 'undefined') end = this.limit;
40443 if (!this.noAssert) {
40444 if (typeof begin !== 'number' || begin % 1 !== 0)
40445 throw TypeError("Illegal begin: Not an integer");
40446 begin >>>= 0;
40447 if (typeof end !== 'number' || end % 1 !== 0)
40448 throw TypeError("Illegal end: Not an integer");
40449 end >>>= 0;
40450 if (begin < 0 || begin > end || end > this.buffer.byteLength)
40451 throw RangeError("Illegal range: 0 <= "+begin+" <= "+end+" <= "+this.buffer.byteLength);
40452 }
40453 if (begin === 0 && end === this.buffer.byteLength)
40454 return this; // Already compacted
40455 var len = end - begin;
40456 if (len === 0) {
40457 this.buffer = EMPTY_BUFFER;
40458 this.view = null;
40459 if (this.markedOffset >= 0) this.markedOffset -= begin;
40460 this.offset = 0;
40461 this.limit = 0;
40462 return this;
40463 }
40464 var buffer = new ArrayBuffer(len);
40465 var view = new Uint8Array(buffer);
40466 view.set(this.view.subarray(begin, end));
40467 this.buffer = buffer;
40468 this.view = view;
40469 if (this.markedOffset >= 0) this.markedOffset -= begin;
40470 this.offset = 0;
40471 this.limit = len;
40472 return this;
40473 };
40474
40475 /**
40476 * Creates a copy of this ByteBuffer's contents. Contents are the bytes between {@link ByteBuffer#offset} and
40477 * {@link ByteBuffer#limit}.
40478 * @param {number=} begin Begin offset, defaults to {@link ByteBuffer#offset}.
40479 * @param {number=} end End offset, defaults to {@link ByteBuffer#limit}.
40480 * @returns {!ByteBuffer} Copy
40481 * @expose
40482 */
40483 ByteBufferPrototype.copy = function(begin, end) {
40484 if (typeof begin === 'undefined') begin = this.offset;
40485 if (typeof end === 'undefined') end = this.limit;
40486 if (!this.noAssert) {
40487 if (typeof begin !== 'number' || begin % 1 !== 0)
40488 throw TypeError("Illegal begin: Not an integer");
40489 begin >>>= 0;
40490 if (typeof end !== 'number' || end % 1 !== 0)
40491 throw TypeError("Illegal end: Not an integer");
40492 end >>>= 0;
40493 if (begin < 0 || begin > end || end > this.buffer.byteLength)
40494 throw RangeError("Illegal range: 0 <= "+begin+" <= "+end+" <= "+this.buffer.byteLength);
40495 }
40496 if (begin === end)
40497 return new ByteBuffer(0, this.littleEndian, this.noAssert);
40498 var capacity = end - begin,
40499 bb = new ByteBuffer(capacity, this.littleEndian, this.noAssert);
40500 bb.offset = 0;
40501 bb.limit = capacity;
40502 if (bb.markedOffset >= 0) bb.markedOffset -= begin;
40503 this.copyTo(bb, 0, begin, end);
40504 return bb;
40505 };
40506
40507 /**
40508 * Copies this ByteBuffer's contents to another ByteBuffer. Contents are the bytes between {@link ByteBuffer#offset} and
40509 * {@link ByteBuffer#limit}.
40510 * @param {!ByteBuffer} target Target ByteBuffer
40511 * @param {number=} targetOffset Offset to copy to. Will use and increase the target's {@link ByteBuffer#offset}
40512 * by the number of bytes copied if omitted.
40513 * @param {number=} sourceOffset Offset to start copying from. Will use and increase {@link ByteBuffer#offset} by the
40514 * number of bytes copied if omitted.
40515 * @param {number=} sourceLimit Offset to end copying from, defaults to {@link ByteBuffer#limit}
40516 * @returns {!ByteBuffer} this
40517 * @expose
40518 */
40519 ByteBufferPrototype.copyTo = function(target, targetOffset, sourceOffset, sourceLimit) {
40520 var relative,
40521 targetRelative;
40522 if (!this.noAssert) {
40523 if (!ByteBuffer.isByteBuffer(target))
40524 throw TypeError("Illegal target: Not a ByteBuffer");
40525 }
40526 targetOffset = (targetRelative = typeof targetOffset === 'undefined') ? target.offset : targetOffset | 0;
40527 sourceOffset = (relative = typeof sourceOffset === 'undefined') ? this.offset : sourceOffset | 0;
40528 sourceLimit = typeof sourceLimit === 'undefined' ? this.limit : sourceLimit | 0;
40529
40530 if (targetOffset < 0 || targetOffset > target.buffer.byteLength)
40531 throw RangeError("Illegal target range: 0 <= "+targetOffset+" <= "+target.buffer.byteLength);
40532 if (sourceOffset < 0 || sourceLimit > this.buffer.byteLength)
40533 throw RangeError("Illegal source range: 0 <= "+sourceOffset+" <= "+this.buffer.byteLength);
40534
40535 var len = sourceLimit - sourceOffset;
40536 if (len === 0)
40537 return target; // Nothing to copy
40538
40539 target.ensureCapacity(targetOffset + len);
40540
40541 target.view.set(this.view.subarray(sourceOffset, sourceLimit), targetOffset);
40542
40543 if (relative) this.offset += len;
40544 if (targetRelative) target.offset += len;
40545
40546 return this;
40547 };
40548
40549 /**
40550 * Makes sure that this ByteBuffer is backed by a {@link ByteBuffer#buffer} of at least the specified capacity. If the
40551 * current capacity is exceeded, it will be doubled. If double the current capacity is less than the required capacity,
40552 * the required capacity will be used instead.
40553 * @param {number} capacity Required capacity
40554 * @returns {!ByteBuffer} this
40555 * @expose
40556 */
40557 ByteBufferPrototype.ensureCapacity = function(capacity) {
40558 var current = this.buffer.byteLength;
40559 if (current < capacity)
40560 return this.resize((current *= 2) > capacity ? current : capacity);
40561 return this;
40562 };
40563
40564 /**
40565 * Overwrites this ByteBuffer's contents with the specified value. Contents are the bytes between
40566 * {@link ByteBuffer#offset} and {@link ByteBuffer#limit}.
40567 * @param {number|string} value Byte value to fill with. If given as a string, the first character is used.
40568 * @param {number=} begin Begin offset. Will use and increase {@link ByteBuffer#offset} by the number of bytes
40569 * written if omitted. defaults to {@link ByteBuffer#offset}.
40570 * @param {number=} end End offset, defaults to {@link ByteBuffer#limit}.
40571 * @returns {!ByteBuffer} this
40572 * @expose
40573 * @example `someByteBuffer.clear().fill(0)` fills the entire backing buffer with zeroes
40574 */
40575 ByteBufferPrototype.fill = function(value, begin, end) {
40576 var relative = typeof begin === 'undefined';
40577 if (relative) begin = this.offset;
40578 if (typeof value === 'string' && value.length > 0)
40579 value = value.charCodeAt(0);
40580 if (typeof begin === 'undefined') begin = this.offset;
40581 if (typeof end === 'undefined') end = this.limit;
40582 if (!this.noAssert) {
40583 if (typeof value !== 'number' || value % 1 !== 0)
40584 throw TypeError("Illegal value: "+value+" (not an integer)");
40585 value |= 0;
40586 if (typeof begin !== 'number' || begin % 1 !== 0)
40587 throw TypeError("Illegal begin: Not an integer");
40588 begin >>>= 0;
40589 if (typeof end !== 'number' || end % 1 !== 0)
40590 throw TypeError("Illegal end: Not an integer");
40591 end >>>= 0;
40592 if (begin < 0 || begin > end || end > this.buffer.byteLength)
40593 throw RangeError("Illegal range: 0 <= "+begin+" <= "+end+" <= "+this.buffer.byteLength);
40594 }
40595 if (begin >= end)
40596 return this; // Nothing to fill
40597 while (begin < end) this.view[begin++] = value;
40598 if (relative) this.offset = begin;
40599 return this;
40600 };
40601
40602 /**
40603 * Makes this ByteBuffer ready for a new sequence of write or relative read operations. Sets `limit = offset` and
40604 * `offset = 0`. Make sure always to flip a ByteBuffer when all relative read or write operations are complete.
40605 * @returns {!ByteBuffer} this
40606 * @expose
40607 */
40608 ByteBufferPrototype.flip = function() {
40609 this.limit = this.offset;
40610 this.offset = 0;
40611 return this;
40612 };
40613 /**
40614 * Marks an offset on this ByteBuffer to be used later.
40615 * @param {number=} offset Offset to mark. Defaults to {@link ByteBuffer#offset}.
40616 * @returns {!ByteBuffer} this
40617 * @throws {TypeError} If `offset` is not a valid number
40618 * @throws {RangeError} If `offset` is out of bounds
40619 * @see ByteBuffer#reset
40620 * @expose
40621 */
40622 ByteBufferPrototype.mark = function(offset) {
40623 offset = typeof offset === 'undefined' ? this.offset : offset;
40624 if (!this.noAssert) {
40625 if (typeof offset !== 'number' || offset % 1 !== 0)
40626 throw TypeError("Illegal offset: "+offset+" (not an integer)");
40627 offset >>>= 0;
40628 if (offset < 0 || offset + 0 > this.buffer.byteLength)
40629 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
40630 }
40631 this.markedOffset = offset;
40632 return this;
40633 };
40634 /**
40635 * Sets the byte order.
40636 * @param {boolean} littleEndian `true` for little endian byte order, `false` for big endian
40637 * @returns {!ByteBuffer} this
40638 * @expose
40639 */
40640 ByteBufferPrototype.order = function(littleEndian) {
40641 if (!this.noAssert) {
40642 if (typeof littleEndian !== 'boolean')
40643 throw TypeError("Illegal littleEndian: Not a boolean");
40644 }
40645 this.littleEndian = !!littleEndian;
40646 return this;
40647 };
40648
40649 /**
40650 * Switches (to) little endian byte order.
40651 * @param {boolean=} littleEndian Defaults to `true`, otherwise uses big endian
40652 * @returns {!ByteBuffer} this
40653 * @expose
40654 */
40655 ByteBufferPrototype.LE = function(littleEndian) {
40656 this.littleEndian = typeof littleEndian !== 'undefined' ? !!littleEndian : true;
40657 return this;
40658 };
40659
40660 /**
40661 * Switches (to) big endian byte order.
40662 * @param {boolean=} bigEndian Defaults to `true`, otherwise uses little endian
40663 * @returns {!ByteBuffer} this
40664 * @expose
40665 */
40666 ByteBufferPrototype.BE = function(bigEndian) {
40667 this.littleEndian = typeof bigEndian !== 'undefined' ? !bigEndian : false;
40668 return this;
40669 };
40670 /**
40671 * Prepends some data to this ByteBuffer. This will overwrite any contents before the specified offset up to the
40672 * prepended data's length. If there is not enough space available before the specified `offset`, the backing buffer
40673 * will be resized and its contents moved accordingly.
40674 * @param {!ByteBuffer|string|!ArrayBuffer} source Data to prepend. If `source` is a ByteBuffer, its offset will be
40675 * modified according to the performed read operation.
40676 * @param {(string|number)=} encoding Encoding if `data` is a string ("base64", "hex", "binary", defaults to "utf8")
40677 * @param {number=} offset Offset to prepend at. Will use and decrease {@link ByteBuffer#offset} by the number of bytes
40678 * prepended if omitted.
40679 * @returns {!ByteBuffer} this
40680 * @expose
40681 * @example A relative `00<01 02 03>.prepend(<04 05>)` results in `<04 05 01 02 03>, 04 05|`
40682 * @example An absolute `00<01 02 03>.prepend(<04 05>, 2)` results in `04<05 02 03>, 04 05|`
40683 */
40684 ByteBufferPrototype.prepend = function(source, encoding, offset) {
40685 if (typeof encoding === 'number' || typeof encoding !== 'string') {
40686 offset = encoding;
40687 encoding = undefined;
40688 }
40689 var relative = typeof offset === 'undefined';
40690 if (relative) offset = this.offset;
40691 if (!this.noAssert) {
40692 if (typeof offset !== 'number' || offset % 1 !== 0)
40693 throw TypeError("Illegal offset: "+offset+" (not an integer)");
40694 offset >>>= 0;
40695 if (offset < 0 || offset + 0 > this.buffer.byteLength)
40696 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
40697 }
40698 if (!(source instanceof ByteBuffer))
40699 source = ByteBuffer.wrap(source, encoding);
40700 var len = source.limit - source.offset;
40701 if (len <= 0) return this; // Nothing to prepend
40702 var diff = len - offset;
40703 if (diff > 0) { // Not enough space before offset, so resize + move
40704 var buffer = new ArrayBuffer(this.buffer.byteLength + diff);
40705 var view = new Uint8Array(buffer);
40706 view.set(this.view.subarray(offset, this.buffer.byteLength), len);
40707 this.buffer = buffer;
40708 this.view = view;
40709 this.offset += diff;
40710 if (this.markedOffset >= 0) this.markedOffset += diff;
40711 this.limit += diff;
40712 offset += diff;
40713 } else {
40714 var arrayView = new Uint8Array(this.buffer);
40715 }
40716 this.view.set(source.view.subarray(source.offset, source.limit), offset - len);
40717
40718 source.offset = source.limit;
40719 if (relative)
40720 this.offset -= len;
40721 return this;
40722 };
40723
40724 /**
40725 * Prepends this ByteBuffer to another ByteBuffer. This will overwrite any contents before the specified offset up to the
40726 * prepended data's length. If there is not enough space available before the specified `offset`, the backing buffer
40727 * will be resized and its contents moved accordingly.
40728 * @param {!ByteBuffer} target Target ByteBuffer
40729 * @param {number=} offset Offset to prepend at. Will use and decrease {@link ByteBuffer#offset} by the number of bytes
40730 * prepended if omitted.
40731 * @returns {!ByteBuffer} this
40732 * @expose
40733 * @see ByteBuffer#prepend
40734 */
40735 ByteBufferPrototype.prependTo = function(target, offset) {
40736 target.prepend(this, offset);
40737 return this;
40738 };
40739 /**
40740 * Prints debug information about this ByteBuffer's contents.
40741 * @param {function(string)=} out Output function to call, defaults to console.log
40742 * @expose
40743 */
40744 ByteBufferPrototype.printDebug = function(out) {
40745 if (typeof out !== 'function') out = console.log.bind(console);
40746 out(
40747 this.toString()+"\n"+
40748 "-------------------------------------------------------------------\n"+
40749 this.toDebug(/* columns */ true)
40750 );
40751 };
40752
40753 /**
40754 * Gets the number of remaining readable bytes. Contents are the bytes between {@link ByteBuffer#offset} and
40755 * {@link ByteBuffer#limit}, so this returns `limit - offset`.
40756 * @returns {number} Remaining readable bytes. May be negative if `offset > limit`.
40757 * @expose
40758 */
40759 ByteBufferPrototype.remaining = function() {
40760 return this.limit - this.offset;
40761 };
40762 /**
40763 * Resets this ByteBuffer's {@link ByteBuffer#offset}. If an offset has been marked through {@link ByteBuffer#mark}
40764 * before, `offset` will be set to {@link ByteBuffer#markedOffset}, which will then be discarded. If no offset has been
40765 * marked, sets `offset = 0`.
40766 * @returns {!ByteBuffer} this
40767 * @see ByteBuffer#mark
40768 * @expose
40769 */
40770 ByteBufferPrototype.reset = function() {
40771 if (this.markedOffset >= 0) {
40772 this.offset = this.markedOffset;
40773 this.markedOffset = -1;
40774 } else {
40775 this.offset = 0;
40776 }
40777 return this;
40778 };
40779 /**
40780 * Resizes this ByteBuffer to be backed by a buffer of at least the given capacity. Will do nothing if already that
40781 * large or larger.
40782 * @param {number} capacity Capacity required
40783 * @returns {!ByteBuffer} this
40784 * @throws {TypeError} If `capacity` is not a number
40785 * @throws {RangeError} If `capacity < 0`
40786 * @expose
40787 */
40788 ByteBufferPrototype.resize = function(capacity) {
40789 if (!this.noAssert) {
40790 if (typeof capacity !== 'number' || capacity % 1 !== 0)
40791 throw TypeError("Illegal capacity: "+capacity+" (not an integer)");
40792 capacity |= 0;
40793 if (capacity < 0)
40794 throw RangeError("Illegal capacity: 0 <= "+capacity);
40795 }
40796 if (this.buffer.byteLength < capacity) {
40797 var buffer = new ArrayBuffer(capacity);
40798 var view = new Uint8Array(buffer);
40799 view.set(this.view);
40800 this.buffer = buffer;
40801 this.view = view;
40802 }
40803 return this;
40804 };
40805 /**
40806 * Reverses this ByteBuffer's contents.
40807 * @param {number=} begin Offset to start at, defaults to {@link ByteBuffer#offset}
40808 * @param {number=} end Offset to end at, defaults to {@link ByteBuffer#limit}
40809 * @returns {!ByteBuffer} this
40810 * @expose
40811 */
40812 ByteBufferPrototype.reverse = function(begin, end) {
40813 if (typeof begin === 'undefined') begin = this.offset;
40814 if (typeof end === 'undefined') end = this.limit;
40815 if (!this.noAssert) {
40816 if (typeof begin !== 'number' || begin % 1 !== 0)
40817 throw TypeError("Illegal begin: Not an integer");
40818 begin >>>= 0;
40819 if (typeof end !== 'number' || end % 1 !== 0)
40820 throw TypeError("Illegal end: Not an integer");
40821 end >>>= 0;
40822 if (begin < 0 || begin > end || end > this.buffer.byteLength)
40823 throw RangeError("Illegal range: 0 <= "+begin+" <= "+end+" <= "+this.buffer.byteLength);
40824 }
40825 if (begin === end)
40826 return this; // Nothing to reverse
40827 Array.prototype.reverse.call(this.view.subarray(begin, end));
40828 return this;
40829 };
40830 /**
40831 * Skips the next `length` bytes. This will just advance
40832 * @param {number} length Number of bytes to skip. May also be negative to move the offset back.
40833 * @returns {!ByteBuffer} this
40834 * @expose
40835 */
40836 ByteBufferPrototype.skip = function(length) {
40837 if (!this.noAssert) {
40838 if (typeof length !== 'number' || length % 1 !== 0)
40839 throw TypeError("Illegal length: "+length+" (not an integer)");
40840 length |= 0;
40841 }
40842 var offset = this.offset + length;
40843 if (!this.noAssert) {
40844 if (offset < 0 || offset > this.buffer.byteLength)
40845 throw RangeError("Illegal length: 0 <= "+this.offset+" + "+length+" <= "+this.buffer.byteLength);
40846 }
40847 this.offset = offset;
40848 return this;
40849 };
40850
40851 /**
40852 * Slices this ByteBuffer by creating a cloned instance with `offset = begin` and `limit = end`.
40853 * @param {number=} begin Begin offset, defaults to {@link ByteBuffer#offset}.
40854 * @param {number=} end End offset, defaults to {@link ByteBuffer#limit}.
40855 * @returns {!ByteBuffer} Clone of this ByteBuffer with slicing applied, backed by the same {@link ByteBuffer#buffer}
40856 * @expose
40857 */
40858 ByteBufferPrototype.slice = function(begin, end) {
40859 if (typeof begin === 'undefined') begin = this.offset;
40860 if (typeof end === 'undefined') end = this.limit;
40861 if (!this.noAssert) {
40862 if (typeof begin !== 'number' || begin % 1 !== 0)
40863 throw TypeError("Illegal begin: Not an integer");
40864 begin >>>= 0;
40865 if (typeof end !== 'number' || end % 1 !== 0)
40866 throw TypeError("Illegal end: Not an integer");
40867 end >>>= 0;
40868 if (begin < 0 || begin > end || end > this.buffer.byteLength)
40869 throw RangeError("Illegal range: 0 <= "+begin+" <= "+end+" <= "+this.buffer.byteLength);
40870 }
40871 var bb = this.clone();
40872 bb.offset = begin;
40873 bb.limit = end;
40874 return bb;
40875 };
40876 /**
40877 * Returns a copy of the backing buffer that contains this ByteBuffer's contents. Contents are the bytes between
40878 * {@link ByteBuffer#offset} and {@link ByteBuffer#limit}.
40879 * @param {boolean=} forceCopy If `true` returns a copy, otherwise returns a view referencing the same memory if
40880 * possible. Defaults to `false`
40881 * @returns {!ArrayBuffer} Contents as an ArrayBuffer
40882 * @expose
40883 */
40884 ByteBufferPrototype.toBuffer = function(forceCopy) {
40885 var offset = this.offset,
40886 limit = this.limit;
40887 if (!this.noAssert) {
40888 if (typeof offset !== 'number' || offset % 1 !== 0)
40889 throw TypeError("Illegal offset: Not an integer");
40890 offset >>>= 0;
40891 if (typeof limit !== 'number' || limit % 1 !== 0)
40892 throw TypeError("Illegal limit: Not an integer");
40893 limit >>>= 0;
40894 if (offset < 0 || offset > limit || limit > this.buffer.byteLength)
40895 throw RangeError("Illegal range: 0 <= "+offset+" <= "+limit+" <= "+this.buffer.byteLength);
40896 }
40897 // NOTE: It's not possible to have another ArrayBuffer reference the same memory as the backing buffer. This is
40898 // possible with Uint8Array#subarray only, but we have to return an ArrayBuffer by contract. So:
40899 if (!forceCopy && offset === 0 && limit === this.buffer.byteLength)
40900 return this.buffer;
40901 if (offset === limit)
40902 return EMPTY_BUFFER;
40903 var buffer = new ArrayBuffer(limit - offset);
40904 new Uint8Array(buffer).set(new Uint8Array(this.buffer).subarray(offset, limit), 0);
40905 return buffer;
40906 };
40907
40908 /**
40909 * Returns a raw buffer compacted to contain this ByteBuffer's contents. Contents are the bytes between
40910 * {@link ByteBuffer#offset} and {@link ByteBuffer#limit}. This is an alias of {@link ByteBuffer#toBuffer}.
40911 * @function
40912 * @param {boolean=} forceCopy If `true` returns a copy, otherwise returns a view referencing the same memory.
40913 * Defaults to `false`
40914 * @returns {!ArrayBuffer} Contents as an ArrayBuffer
40915 * @expose
40916 */
40917 ByteBufferPrototype.toArrayBuffer = ByteBufferPrototype.toBuffer;
40918
40919 /**
40920 * Converts the ByteBuffer's contents to a string.
40921 * @param {string=} encoding Output encoding. Returns an informative string representation if omitted but also allows
40922 * direct conversion to "utf8", "hex", "base64" and "binary" encoding. "debug" returns a hex representation with
40923 * highlighted offsets.
40924 * @param {number=} begin Offset to begin at, defaults to {@link ByteBuffer#offset}
40925 * @param {number=} end Offset to end at, defaults to {@link ByteBuffer#limit}
40926 * @returns {string} String representation
40927 * @throws {Error} If `encoding` is invalid
40928 * @expose
40929 */
40930 ByteBufferPrototype.toString = function(encoding, begin, end) {
40931 if (typeof encoding === 'undefined')
40932 return "ByteBufferAB(offset="+this.offset+",markedOffset="+this.markedOffset+",limit="+this.limit+",capacity="+this.capacity()+")";
40933 if (typeof encoding === 'number')
40934 encoding = "utf8",
40935 begin = encoding,
40936 end = begin;
40937 switch (encoding) {
40938 case "utf8":
40939 return this.toUTF8(begin, end);
40940 case "base64":
40941 return this.toBase64(begin, end);
40942 case "hex":
40943 return this.toHex(begin, end);
40944 case "binary":
40945 return this.toBinary(begin, end);
40946 case "debug":
40947 return this.toDebug();
40948 case "columns":
40949 return this.toColumns();
40950 default:
40951 throw Error("Unsupported encoding: "+encoding);
40952 }
40953 };
40954
40955 // lxiv-embeddable
40956
40957 /**
40958 * lxiv-embeddable (c) 2014 Daniel Wirtz <dcode@dcode.io>
40959 * Released under the Apache License, Version 2.0
40960 * see: https://github.com/dcodeIO/lxiv for details
40961 */
40962 var lxiv = function() {
40963 "use strict";
40964
40965 /**
40966 * lxiv namespace.
40967 * @type {!Object.<string,*>}
40968 * @exports lxiv
40969 */
40970 var lxiv = {};
40971
40972 /**
40973 * Character codes for output.
40974 * @type {!Array.<number>}
40975 * @inner
40976 */
40977 var aout = [
40978 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
40979 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 97, 98, 99, 100, 101, 102,
40980 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118,
40981 119, 120, 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 43, 47
40982 ];
40983
40984 /**
40985 * Character codes for input.
40986 * @type {!Array.<number>}
40987 * @inner
40988 */
40989 var ain = [];
40990 for (var i=0, k=aout.length; i<k; ++i)
40991 ain[aout[i]] = i;
40992
40993 /**
40994 * Encodes bytes to base64 char codes.
40995 * @param {!function():number|null} src Bytes source as a function returning the next byte respectively `null` if
40996 * there are no more bytes left.
40997 * @param {!function(number)} dst Characters destination as a function successively called with each encoded char
40998 * code.
40999 */
41000 lxiv.encode = function(src, dst) {
41001 var b, t;
41002 while ((b = src()) !== null) {
41003 dst(aout[(b>>2)&0x3f]);
41004 t = (b&0x3)<<4;
41005 if ((b = src()) !== null) {
41006 t |= (b>>4)&0xf;
41007 dst(aout[(t|((b>>4)&0xf))&0x3f]);
41008 t = (b&0xf)<<2;
41009 if ((b = src()) !== null)
41010 dst(aout[(t|((b>>6)&0x3))&0x3f]),
41011 dst(aout[b&0x3f]);
41012 else
41013 dst(aout[t&0x3f]),
41014 dst(61);
41015 } else
41016 dst(aout[t&0x3f]),
41017 dst(61),
41018 dst(61);
41019 }
41020 };
41021
41022 /**
41023 * Decodes base64 char codes to bytes.
41024 * @param {!function():number|null} src Characters source as a function returning the next char code respectively
41025 * `null` if there are no more characters left.
41026 * @param {!function(number)} dst Bytes destination as a function successively called with the next byte.
41027 * @throws {Error} If a character code is invalid
41028 */
41029 lxiv.decode = function(src, dst) {
41030 var c, t1, t2;
41031 function fail(c) {
41032 throw Error("Illegal character code: "+c);
41033 }
41034 while ((c = src()) !== null) {
41035 t1 = ain[c];
41036 if (typeof t1 === 'undefined') fail(c);
41037 if ((c = src()) !== null) {
41038 t2 = ain[c];
41039 if (typeof t2 === 'undefined') fail(c);
41040 dst((t1<<2)>>>0|(t2&0x30)>>4);
41041 if ((c = src()) !== null) {
41042 t1 = ain[c];
41043 if (typeof t1 === 'undefined')
41044 if (c === 61) break; else fail(c);
41045 dst(((t2&0xf)<<4)>>>0|(t1&0x3c)>>2);
41046 if ((c = src()) !== null) {
41047 t2 = ain[c];
41048 if (typeof t2 === 'undefined')
41049 if (c === 61) break; else fail(c);
41050 dst(((t1&0x3)<<6)>>>0|t2);
41051 }
41052 }
41053 }
41054 }
41055 };
41056
41057 /**
41058 * Tests if a string is valid base64.
41059 * @param {string} str String to test
41060 * @returns {boolean} `true` if valid, otherwise `false`
41061 */
41062 lxiv.test = function(str) {
41063 return /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(str);
41064 };
41065
41066 return lxiv;
41067 }();
41068
41069 // encodings/base64
41070
41071 /**
41072 * Encodes this ByteBuffer's contents to a base64 encoded string.
41073 * @param {number=} begin Offset to begin at, defaults to {@link ByteBuffer#offset}.
41074 * @param {number=} end Offset to end at, defaults to {@link ByteBuffer#limit}.
41075 * @returns {string} Base64 encoded string
41076 * @throws {RangeError} If `begin` or `end` is out of bounds
41077 * @expose
41078 */
41079 ByteBufferPrototype.toBase64 = function(begin, end) {
41080 if (typeof begin === 'undefined')
41081 begin = this.offset;
41082 if (typeof end === 'undefined')
41083 end = this.limit;
41084 begin = begin | 0; end = end | 0;
41085 if (begin < 0 || end > this.capacity || begin > end)
41086 throw RangeError("begin, end");
41087 var sd; lxiv.encode(function() {
41088 return begin < end ? this.view[begin++] : null;
41089 }.bind(this), sd = stringDestination());
41090 return sd();
41091 };
41092
41093 /**
41094 * Decodes a base64 encoded string to a ByteBuffer.
41095 * @param {string} str String to decode
41096 * @param {boolean=} littleEndian Whether to use little or big endian byte order. Defaults to
41097 * {@link ByteBuffer.DEFAULT_ENDIAN}.
41098 * @returns {!ByteBuffer} ByteBuffer
41099 * @expose
41100 */
41101 ByteBuffer.fromBase64 = function(str, littleEndian) {
41102 if (typeof str !== 'string')
41103 throw TypeError("str");
41104 var bb = new ByteBuffer(str.length/4*3, littleEndian),
41105 i = 0;
41106 lxiv.decode(stringSource(str), function(b) {
41107 bb.view[i++] = b;
41108 });
41109 bb.limit = i;
41110 return bb;
41111 };
41112
41113 /**
41114 * Encodes a binary string to base64 like `window.btoa` does.
41115 * @param {string} str Binary string
41116 * @returns {string} Base64 encoded string
41117 * @see https://developer.mozilla.org/en-US/docs/Web/API/Window.btoa
41118 * @expose
41119 */
41120 ByteBuffer.btoa = function(str) {
41121 return ByteBuffer.fromBinary(str).toBase64();
41122 };
41123
41124 /**
41125 * Decodes a base64 encoded string to binary like `window.atob` does.
41126 * @param {string} b64 Base64 encoded string
41127 * @returns {string} Binary string
41128 * @see https://developer.mozilla.org/en-US/docs/Web/API/Window.atob
41129 * @expose
41130 */
41131 ByteBuffer.atob = function(b64) {
41132 return ByteBuffer.fromBase64(b64).toBinary();
41133 };
41134
41135 // encodings/binary
41136
41137 /**
41138 * Encodes this ByteBuffer to a binary encoded string, that is using only characters 0x00-0xFF as bytes.
41139 * @param {number=} begin Offset to begin at. Defaults to {@link ByteBuffer#offset}.
41140 * @param {number=} end Offset to end at. Defaults to {@link ByteBuffer#limit}.
41141 * @returns {string} Binary encoded string
41142 * @throws {RangeError} If `offset > limit`
41143 * @expose
41144 */
41145 ByteBufferPrototype.toBinary = function(begin, end) {
41146 if (typeof begin === 'undefined')
41147 begin = this.offset;
41148 if (typeof end === 'undefined')
41149 end = this.limit;
41150 begin |= 0; end |= 0;
41151 if (begin < 0 || end > this.capacity() || begin > end)
41152 throw RangeError("begin, end");
41153 if (begin === end)
41154 return "";
41155 var chars = [],
41156 parts = [];
41157 while (begin < end) {
41158 chars.push(this.view[begin++]);
41159 if (chars.length >= 1024)
41160 parts.push(String.fromCharCode.apply(String, chars)),
41161 chars = [];
41162 }
41163 return parts.join('') + String.fromCharCode.apply(String, chars);
41164 };
41165
41166 /**
41167 * Decodes a binary encoded string, that is using only characters 0x00-0xFF as bytes, to a ByteBuffer.
41168 * @param {string} str String to decode
41169 * @param {boolean=} littleEndian Whether to use little or big endian byte order. Defaults to
41170 * {@link ByteBuffer.DEFAULT_ENDIAN}.
41171 * @returns {!ByteBuffer} ByteBuffer
41172 * @expose
41173 */
41174 ByteBuffer.fromBinary = function(str, littleEndian) {
41175 if (typeof str !== 'string')
41176 throw TypeError("str");
41177 var i = 0,
41178 k = str.length,
41179 charCode,
41180 bb = new ByteBuffer(k, littleEndian);
41181 while (i<k) {
41182 charCode = str.charCodeAt(i);
41183 if (charCode > 0xff)
41184 throw RangeError("illegal char code: "+charCode);
41185 bb.view[i++] = charCode;
41186 }
41187 bb.limit = k;
41188 return bb;
41189 };
41190
41191 // encodings/debug
41192
41193 /**
41194 * Encodes this ByteBuffer to a hex encoded string with marked offsets. Offset symbols are:
41195 * * `<` : offset,
41196 * * `'` : markedOffset,
41197 * * `>` : limit,
41198 * * `|` : offset and limit,
41199 * * `[` : offset and markedOffset,
41200 * * `]` : markedOffset and limit,
41201 * * `!` : offset, markedOffset and limit
41202 * @param {boolean=} columns If `true` returns two columns hex + ascii, defaults to `false`
41203 * @returns {string|!Array.<string>} Debug string or array of lines if `asArray = true`
41204 * @expose
41205 * @example `>00'01 02<03` contains four bytes with `limit=0, markedOffset=1, offset=3`
41206 * @example `00[01 02 03>` contains four bytes with `offset=markedOffset=1, limit=4`
41207 * @example `00|01 02 03` contains four bytes with `offset=limit=1, markedOffset=-1`
41208 * @example `|` contains zero bytes with `offset=limit=0, markedOffset=-1`
41209 */
41210 ByteBufferPrototype.toDebug = function(columns) {
41211 var i = -1,
41212 k = this.buffer.byteLength,
41213 b,
41214 hex = "",
41215 asc = "",
41216 out = "";
41217 while (i<k) {
41218 if (i !== -1) {
41219 b = this.view[i];
41220 if (b < 0x10) hex += "0"+b.toString(16).toUpperCase();
41221 else hex += b.toString(16).toUpperCase();
41222 if (columns)
41223 asc += b > 32 && b < 127 ? String.fromCharCode(b) : '.';
41224 }
41225 ++i;
41226 if (columns) {
41227 if (i > 0 && i % 16 === 0 && i !== k) {
41228 while (hex.length < 3*16+3) hex += " ";
41229 out += hex+asc+"\n";
41230 hex = asc = "";
41231 }
41232 }
41233 if (i === this.offset && i === this.limit)
41234 hex += i === this.markedOffset ? "!" : "|";
41235 else if (i === this.offset)
41236 hex += i === this.markedOffset ? "[" : "<";
41237 else if (i === this.limit)
41238 hex += i === this.markedOffset ? "]" : ">";
41239 else
41240 hex += i === this.markedOffset ? "'" : (columns || (i !== 0 && i !== k) ? " " : "");
41241 }
41242 if (columns && hex !== " ") {
41243 while (hex.length < 3*16+3)
41244 hex += " ";
41245 out += hex + asc + "\n";
41246 }
41247 return columns ? out : hex;
41248 };
41249
41250 /**
41251 * Decodes a hex encoded string with marked offsets to a ByteBuffer.
41252 * @param {string} str Debug string to decode (not be generated with `columns = true`)
41253 * @param {boolean=} littleEndian Whether to use little or big endian byte order. Defaults to
41254 * {@link ByteBuffer.DEFAULT_ENDIAN}.
41255 * @param {boolean=} noAssert Whether to skip assertions of offsets and values. Defaults to
41256 * {@link ByteBuffer.DEFAULT_NOASSERT}.
41257 * @returns {!ByteBuffer} ByteBuffer
41258 * @expose
41259 * @see ByteBuffer#toDebug
41260 */
41261 ByteBuffer.fromDebug = function(str, littleEndian, noAssert) {
41262 var k = str.length,
41263 bb = new ByteBuffer(((k+1)/3)|0, littleEndian, noAssert);
41264 var i = 0, j = 0, ch, b,
41265 rs = false, // Require symbol next
41266 ho = false, hm = false, hl = false, // Already has offset (ho), markedOffset (hm), limit (hl)?
41267 fail = false;
41268 while (i<k) {
41269 switch (ch = str.charAt(i++)) {
41270 case '!':
41271 if (!noAssert) {
41272 if (ho || hm || hl) {
41273 fail = true;
41274 break;
41275 }
41276 ho = hm = hl = true;
41277 }
41278 bb.offset = bb.markedOffset = bb.limit = j;
41279 rs = false;
41280 break;
41281 case '|':
41282 if (!noAssert) {
41283 if (ho || hl) {
41284 fail = true;
41285 break;
41286 }
41287 ho = hl = true;
41288 }
41289 bb.offset = bb.limit = j;
41290 rs = false;
41291 break;
41292 case '[':
41293 if (!noAssert) {
41294 if (ho || hm) {
41295 fail = true;
41296 break;
41297 }
41298 ho = hm = true;
41299 }
41300 bb.offset = bb.markedOffset = j;
41301 rs = false;
41302 break;
41303 case '<':
41304 if (!noAssert) {
41305 if (ho) {
41306 fail = true;
41307 break;
41308 }
41309 ho = true;
41310 }
41311 bb.offset = j;
41312 rs = false;
41313 break;
41314 case ']':
41315 if (!noAssert) {
41316 if (hl || hm) {
41317 fail = true;
41318 break;
41319 }
41320 hl = hm = true;
41321 }
41322 bb.limit = bb.markedOffset = j;
41323 rs = false;
41324 break;
41325 case '>':
41326 if (!noAssert) {
41327 if (hl) {
41328 fail = true;
41329 break;
41330 }
41331 hl = true;
41332 }
41333 bb.limit = j;
41334 rs = false;
41335 break;
41336 case "'":
41337 if (!noAssert) {
41338 if (hm) {
41339 fail = true;
41340 break;
41341 }
41342 hm = true;
41343 }
41344 bb.markedOffset = j;
41345 rs = false;
41346 break;
41347 case ' ':
41348 rs = false;
41349 break;
41350 default:
41351 if (!noAssert) {
41352 if (rs) {
41353 fail = true;
41354 break;
41355 }
41356 }
41357 b = parseInt(ch+str.charAt(i++), 16);
41358 if (!noAssert) {
41359 if (isNaN(b) || b < 0 || b > 255)
41360 throw TypeError("Illegal str: Not a debug encoded string");
41361 }
41362 bb.view[j++] = b;
41363 rs = true;
41364 }
41365 if (fail)
41366 throw TypeError("Illegal str: Invalid symbol at "+i);
41367 }
41368 if (!noAssert) {
41369 if (!ho || !hl)
41370 throw TypeError("Illegal str: Missing offset or limit");
41371 if (j<bb.buffer.byteLength)
41372 throw TypeError("Illegal str: Not a debug encoded string (is it hex?) "+j+" < "+k);
41373 }
41374 return bb;
41375 };
41376
41377 // encodings/hex
41378
41379 /**
41380 * Encodes this ByteBuffer's contents to a hex encoded string.
41381 * @param {number=} begin Offset to begin at. Defaults to {@link ByteBuffer#offset}.
41382 * @param {number=} end Offset to end at. Defaults to {@link ByteBuffer#limit}.
41383 * @returns {string} Hex encoded string
41384 * @expose
41385 */
41386 ByteBufferPrototype.toHex = function(begin, end) {
41387 begin = typeof begin === 'undefined' ? this.offset : begin;
41388 end = typeof end === 'undefined' ? this.limit : end;
41389 if (!this.noAssert) {
41390 if (typeof begin !== 'number' || begin % 1 !== 0)
41391 throw TypeError("Illegal begin: Not an integer");
41392 begin >>>= 0;
41393 if (typeof end !== 'number' || end % 1 !== 0)
41394 throw TypeError("Illegal end: Not an integer");
41395 end >>>= 0;
41396 if (begin < 0 || begin > end || end > this.buffer.byteLength)
41397 throw RangeError("Illegal range: 0 <= "+begin+" <= "+end+" <= "+this.buffer.byteLength);
41398 }
41399 var out = new Array(end - begin),
41400 b;
41401 while (begin < end) {
41402 b = this.view[begin++];
41403 if (b < 0x10)
41404 out.push("0", b.toString(16));
41405 else out.push(b.toString(16));
41406 }
41407 return out.join('');
41408 };
41409
41410 /**
41411 * Decodes a hex encoded string to a ByteBuffer.
41412 * @param {string} str String to decode
41413 * @param {boolean=} littleEndian Whether to use little or big endian byte order. Defaults to
41414 * {@link ByteBuffer.DEFAULT_ENDIAN}.
41415 * @param {boolean=} noAssert Whether to skip assertions of offsets and values. Defaults to
41416 * {@link ByteBuffer.DEFAULT_NOASSERT}.
41417 * @returns {!ByteBuffer} ByteBuffer
41418 * @expose
41419 */
41420 ByteBuffer.fromHex = function(str, littleEndian, noAssert) {
41421 if (!noAssert) {
41422 if (typeof str !== 'string')
41423 throw TypeError("Illegal str: Not a string");
41424 if (str.length % 2 !== 0)
41425 throw TypeError("Illegal str: Length not a multiple of 2");
41426 }
41427 var k = str.length,
41428 bb = new ByteBuffer((k / 2) | 0, littleEndian),
41429 b;
41430 for (var i=0, j=0; i<k; i+=2) {
41431 b = parseInt(str.substring(i, i+2), 16);
41432 if (!noAssert)
41433 if (!isFinite(b) || b < 0 || b > 255)
41434 throw TypeError("Illegal str: Contains non-hex characters");
41435 bb.view[j++] = b;
41436 }
41437 bb.limit = j;
41438 return bb;
41439 };
41440
41441 // utfx-embeddable
41442
41443 /**
41444 * utfx-embeddable (c) 2014 Daniel Wirtz <dcode@dcode.io>
41445 * Released under the Apache License, Version 2.0
41446 * see: https://github.com/dcodeIO/utfx for details
41447 */
41448 var utfx = function() {
41449 "use strict";
41450
41451 /**
41452 * utfx namespace.
41453 * @inner
41454 * @type {!Object.<string,*>}
41455 */
41456 var utfx = {};
41457
41458 /**
41459 * Maximum valid code point.
41460 * @type {number}
41461 * @const
41462 */
41463 utfx.MAX_CODEPOINT = 0x10FFFF;
41464
41465 /**
41466 * Encodes UTF8 code points to UTF8 bytes.
41467 * @param {(!function():number|null) | number} src Code points source, either as a function returning the next code point
41468 * respectively `null` if there are no more code points left or a single numeric code point.
41469 * @param {!function(number)} dst Bytes destination as a function successively called with the next byte
41470 */
41471 utfx.encodeUTF8 = function(src, dst) {
41472 var cp = null;
41473 if (typeof src === 'number')
41474 cp = src,
41475 src = function() { return null; };
41476 while (cp !== null || (cp = src()) !== null) {
41477 if (cp < 0x80)
41478 dst(cp&0x7F);
41479 else if (cp < 0x800)
41480 dst(((cp>>6)&0x1F)|0xC0),
41481 dst((cp&0x3F)|0x80);
41482 else if (cp < 0x10000)
41483 dst(((cp>>12)&0x0F)|0xE0),
41484 dst(((cp>>6)&0x3F)|0x80),
41485 dst((cp&0x3F)|0x80);
41486 else
41487 dst(((cp>>18)&0x07)|0xF0),
41488 dst(((cp>>12)&0x3F)|0x80),
41489 dst(((cp>>6)&0x3F)|0x80),
41490 dst((cp&0x3F)|0x80);
41491 cp = null;
41492 }
41493 };
41494
41495 /**
41496 * Decodes UTF8 bytes to UTF8 code points.
41497 * @param {!function():number|null} src Bytes source as a function returning the next byte respectively `null` if there
41498 * are no more bytes left.
41499 * @param {!function(number)} dst Code points destination as a function successively called with each decoded code point.
41500 * @throws {RangeError} If a starting byte is invalid in UTF8
41501 * @throws {Error} If the last sequence is truncated. Has an array property `bytes` holding the
41502 * remaining bytes.
41503 */
41504 utfx.decodeUTF8 = function(src, dst) {
41505 var a, b, c, d, fail = function(b) {
41506 b = b.slice(0, b.indexOf(null));
41507 var err = Error(b.toString());
41508 err.name = "TruncatedError";
41509 err['bytes'] = b;
41510 throw err;
41511 };
41512 while ((a = src()) !== null) {
41513 if ((a&0x80) === 0)
41514 dst(a);
41515 else if ((a&0xE0) === 0xC0)
41516 ((b = src()) === null) && fail([a, b]),
41517 dst(((a&0x1F)<<6) | (b&0x3F));
41518 else if ((a&0xF0) === 0xE0)
41519 ((b=src()) === null || (c=src()) === null) && fail([a, b, c]),
41520 dst(((a&0x0F)<<12) | ((b&0x3F)<<6) | (c&0x3F));
41521 else if ((a&0xF8) === 0xF0)
41522 ((b=src()) === null || (c=src()) === null || (d=src()) === null) && fail([a, b, c ,d]),
41523 dst(((a&0x07)<<18) | ((b&0x3F)<<12) | ((c&0x3F)<<6) | (d&0x3F));
41524 else throw RangeError("Illegal starting byte: "+a);
41525 }
41526 };
41527
41528 /**
41529 * Converts UTF16 characters to UTF8 code points.
41530 * @param {!function():number|null} src Characters source as a function returning the next char code respectively
41531 * `null` if there are no more characters left.
41532 * @param {!function(number)} dst Code points destination as a function successively called with each converted code
41533 * point.
41534 */
41535 utfx.UTF16toUTF8 = function(src, dst) {
41536 var c1, c2 = null;
41537 while (true) {
41538 if ((c1 = c2 !== null ? c2 : src()) === null)
41539 break;
41540 if (c1 >= 0xD800 && c1 <= 0xDFFF) {
41541 if ((c2 = src()) !== null) {
41542 if (c2 >= 0xDC00 && c2 <= 0xDFFF) {
41543 dst((c1-0xD800)*0x400+c2-0xDC00+0x10000);
41544 c2 = null; continue;
41545 }
41546 }
41547 }
41548 dst(c1);
41549 }
41550 if (c2 !== null) dst(c2);
41551 };
41552
41553 /**
41554 * Converts UTF8 code points to UTF16 characters.
41555 * @param {(!function():number|null) | number} src Code points source, either as a function returning the next code point
41556 * respectively `null` if there are no more code points left or a single numeric code point.
41557 * @param {!function(number)} dst Characters destination as a function successively called with each converted char code.
41558 * @throws {RangeError} If a code point is out of range
41559 */
41560 utfx.UTF8toUTF16 = function(src, dst) {
41561 var cp = null;
41562 if (typeof src === 'number')
41563 cp = src, src = function() { return null; };
41564 while (cp !== null || (cp = src()) !== null) {
41565 if (cp <= 0xFFFF)
41566 dst(cp);
41567 else
41568 cp -= 0x10000,
41569 dst((cp>>10)+0xD800),
41570 dst((cp%0x400)+0xDC00);
41571 cp = null;
41572 }
41573 };
41574
41575 /**
41576 * Converts and encodes UTF16 characters to UTF8 bytes.
41577 * @param {!function():number|null} src Characters source as a function returning the next char code respectively `null`
41578 * if there are no more characters left.
41579 * @param {!function(number)} dst Bytes destination as a function successively called with the next byte.
41580 */
41581 utfx.encodeUTF16toUTF8 = function(src, dst) {
41582 utfx.UTF16toUTF8(src, function(cp) {
41583 utfx.encodeUTF8(cp, dst);
41584 });
41585 };
41586
41587 /**
41588 * Decodes and converts UTF8 bytes to UTF16 characters.
41589 * @param {!function():number|null} src Bytes source as a function returning the next byte respectively `null` if there
41590 * are no more bytes left.
41591 * @param {!function(number)} dst Characters destination as a function successively called with each converted char code.
41592 * @throws {RangeError} If a starting byte is invalid in UTF8
41593 * @throws {Error} If the last sequence is truncated. Has an array property `bytes` holding the remaining bytes.
41594 */
41595 utfx.decodeUTF8toUTF16 = function(src, dst) {
41596 utfx.decodeUTF8(src, function(cp) {
41597 utfx.UTF8toUTF16(cp, dst);
41598 });
41599 };
41600
41601 /**
41602 * Calculates the byte length of an UTF8 code point.
41603 * @param {number} cp UTF8 code point
41604 * @returns {number} Byte length
41605 */
41606 utfx.calculateCodePoint = function(cp) {
41607 return (cp < 0x80) ? 1 : (cp < 0x800) ? 2 : (cp < 0x10000) ? 3 : 4;
41608 };
41609
41610 /**
41611 * Calculates the number of UTF8 bytes required to store UTF8 code points.
41612 * @param {(!function():number|null)} src Code points source as a function returning the next code point respectively
41613 * `null` if there are no more code points left.
41614 * @returns {number} The number of UTF8 bytes required
41615 */
41616 utfx.calculateUTF8 = function(src) {
41617 var cp, l=0;
41618 while ((cp = src()) !== null)
41619 l += (cp < 0x80) ? 1 : (cp < 0x800) ? 2 : (cp < 0x10000) ? 3 : 4;
41620 return l;
41621 };
41622
41623 /**
41624 * Calculates the number of UTF8 code points respectively UTF8 bytes required to store UTF16 char codes.
41625 * @param {(!function():number|null)} src Characters source as a function returning the next char code respectively
41626 * `null` if there are no more characters left.
41627 * @returns {!Array.<number>} The number of UTF8 code points at index 0 and the number of UTF8 bytes required at index 1.
41628 */
41629 utfx.calculateUTF16asUTF8 = function(src) {
41630 var n=0, l=0;
41631 utfx.UTF16toUTF8(src, function(cp) {
41632 ++n; l += (cp < 0x80) ? 1 : (cp < 0x800) ? 2 : (cp < 0x10000) ? 3 : 4;
41633 });
41634 return [n,l];
41635 };
41636
41637 return utfx;
41638 }();
41639
41640 // encodings/utf8
41641
41642 /**
41643 * Encodes this ByteBuffer's contents between {@link ByteBuffer#offset} and {@link ByteBuffer#limit} to an UTF8 encoded
41644 * string.
41645 * @returns {string} Hex encoded string
41646 * @throws {RangeError} If `offset > limit`
41647 * @expose
41648 */
41649 ByteBufferPrototype.toUTF8 = function(begin, end) {
41650 if (typeof begin === 'undefined') begin = this.offset;
41651 if (typeof end === 'undefined') end = this.limit;
41652 if (!this.noAssert) {
41653 if (typeof begin !== 'number' || begin % 1 !== 0)
41654 throw TypeError("Illegal begin: Not an integer");
41655 begin >>>= 0;
41656 if (typeof end !== 'number' || end % 1 !== 0)
41657 throw TypeError("Illegal end: Not an integer");
41658 end >>>= 0;
41659 if (begin < 0 || begin > end || end > this.buffer.byteLength)
41660 throw RangeError("Illegal range: 0 <= "+begin+" <= "+end+" <= "+this.buffer.byteLength);
41661 }
41662 var sd; try {
41663 utfx.decodeUTF8toUTF16(function() {
41664 return begin < end ? this.view[begin++] : null;
41665 }.bind(this), sd = stringDestination());
41666 } catch (e) {
41667 if (begin !== end)
41668 throw RangeError("Illegal range: Truncated data, "+begin+" != "+end);
41669 }
41670 return sd();
41671 };
41672
41673 /**
41674 * Decodes an UTF8 encoded string to a ByteBuffer.
41675 * @param {string} str String to decode
41676 * @param {boolean=} littleEndian Whether to use little or big endian byte order. Defaults to
41677 * {@link ByteBuffer.DEFAULT_ENDIAN}.
41678 * @param {boolean=} noAssert Whether to skip assertions of offsets and values. Defaults to
41679 * {@link ByteBuffer.DEFAULT_NOASSERT}.
41680 * @returns {!ByteBuffer} ByteBuffer
41681 * @expose
41682 */
41683 ByteBuffer.fromUTF8 = function(str, littleEndian, noAssert) {
41684 if (!noAssert)
41685 if (typeof str !== 'string')
41686 throw TypeError("Illegal str: Not a string");
41687 var bb = new ByteBuffer(utfx.calculateUTF16asUTF8(stringSource(str), true)[1], littleEndian, noAssert),
41688 i = 0;
41689 utfx.encodeUTF16toUTF8(stringSource(str), function(b) {
41690 bb.view[i++] = b;
41691 });
41692 bb.limit = i;
41693 return bb;
41694 };
41695
41696 return ByteBuffer;
41697});
41698
41699
41700/***/ }),
41701/* 654 */
41702/***/ (function(module, exports, __webpack_require__) {
41703
41704var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*
41705 Copyright 2013 Daniel Wirtz <dcode@dcode.io>
41706 Copyright 2009 The Closure Library Authors. All Rights Reserved.
41707
41708 Licensed under the Apache License, Version 2.0 (the "License");
41709 you may not use this file except in compliance with the License.
41710 You may obtain a copy of the License at
41711
41712 http://www.apache.org/licenses/LICENSE-2.0
41713
41714 Unless required by applicable law or agreed to in writing, software
41715 distributed under the License is distributed on an "AS-IS" BASIS,
41716 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
41717 See the License for the specific language governing permissions and
41718 limitations under the License.
41719 */
41720
41721/**
41722 * @license long.js (c) 2013 Daniel Wirtz <dcode@dcode.io>
41723 * Released under the Apache License, Version 2.0
41724 * see: https://github.com/dcodeIO/long.js for details
41725 */
41726(function(global, factory) {
41727
41728 /* AMD */ if (true)
41729 !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
41730 __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
41731 (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
41732 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
41733 /* CommonJS */ else if (typeof require === 'function' && typeof module === "object" && module && module["exports"])
41734 module["exports"] = factory();
41735 /* Global */ else
41736 (global["dcodeIO"] = global["dcodeIO"] || {})["Long"] = factory();
41737
41738})(this, function() {
41739 "use strict";
41740
41741 /**
41742 * Constructs a 64 bit two's-complement integer, given its low and high 32 bit values as *signed* integers.
41743 * See the from* functions below for more convenient ways of constructing Longs.
41744 * @exports Long
41745 * @class A Long class for representing a 64 bit two's-complement integer value.
41746 * @param {number} low The low (signed) 32 bits of the long
41747 * @param {number} high The high (signed) 32 bits of the long
41748 * @param {boolean=} unsigned Whether unsigned or not, defaults to `false` for signed
41749 * @constructor
41750 */
41751 function Long(low, high, unsigned) {
41752
41753 /**
41754 * The low 32 bits as a signed value.
41755 * @type {number}
41756 */
41757 this.low = low | 0;
41758
41759 /**
41760 * The high 32 bits as a signed value.
41761 * @type {number}
41762 */
41763 this.high = high | 0;
41764
41765 /**
41766 * Whether unsigned or not.
41767 * @type {boolean}
41768 */
41769 this.unsigned = !!unsigned;
41770 }
41771
41772 // The internal representation of a long is the two given signed, 32-bit values.
41773 // We use 32-bit pieces because these are the size of integers on which
41774 // Javascript performs bit-operations. For operations like addition and
41775 // multiplication, we split each number into 16 bit pieces, which can easily be
41776 // multiplied within Javascript's floating-point representation without overflow
41777 // or change in sign.
41778 //
41779 // In the algorithms below, we frequently reduce the negative case to the
41780 // positive case by negating the input(s) and then post-processing the result.
41781 // Note that we must ALWAYS check specially whether those values are MIN_VALUE
41782 // (-2^63) because -MIN_VALUE == MIN_VALUE (since 2^63 cannot be represented as
41783 // a positive number, it overflows back into a negative). Not handling this
41784 // case would often result in infinite recursion.
41785 //
41786 // Common constant values ZERO, ONE, NEG_ONE, etc. are defined below the from*
41787 // methods on which they depend.
41788
41789 /**
41790 * An indicator used to reliably determine if an object is a Long or not.
41791 * @type {boolean}
41792 * @const
41793 * @private
41794 */
41795 Long.prototype.__isLong__;
41796
41797 Object.defineProperty(Long.prototype, "__isLong__", {
41798 value: true,
41799 enumerable: false,
41800 configurable: false
41801 });
41802
41803 /**
41804 * @function
41805 * @param {*} obj Object
41806 * @returns {boolean}
41807 * @inner
41808 */
41809 function isLong(obj) {
41810 return (obj && obj["__isLong__"]) === true;
41811 }
41812
41813 /**
41814 * Tests if the specified object is a Long.
41815 * @function
41816 * @param {*} obj Object
41817 * @returns {boolean}
41818 */
41819 Long.isLong = isLong;
41820
41821 /**
41822 * A cache of the Long representations of small integer values.
41823 * @type {!Object}
41824 * @inner
41825 */
41826 var INT_CACHE = {};
41827
41828 /**
41829 * A cache of the Long representations of small unsigned integer values.
41830 * @type {!Object}
41831 * @inner
41832 */
41833 var UINT_CACHE = {};
41834
41835 /**
41836 * @param {number} value
41837 * @param {boolean=} unsigned
41838 * @returns {!Long}
41839 * @inner
41840 */
41841 function fromInt(value, unsigned) {
41842 var obj, cachedObj, cache;
41843 if (unsigned) {
41844 value >>>= 0;
41845 if (cache = (0 <= value && value < 256)) {
41846 cachedObj = UINT_CACHE[value];
41847 if (cachedObj)
41848 return cachedObj;
41849 }
41850 obj = fromBits(value, (value | 0) < 0 ? -1 : 0, true);
41851 if (cache)
41852 UINT_CACHE[value] = obj;
41853 return obj;
41854 } else {
41855 value |= 0;
41856 if (cache = (-128 <= value && value < 128)) {
41857 cachedObj = INT_CACHE[value];
41858 if (cachedObj)
41859 return cachedObj;
41860 }
41861 obj = fromBits(value, value < 0 ? -1 : 0, false);
41862 if (cache)
41863 INT_CACHE[value] = obj;
41864 return obj;
41865 }
41866 }
41867
41868 /**
41869 * Returns a Long representing the given 32 bit integer value.
41870 * @function
41871 * @param {number} value The 32 bit integer in question
41872 * @param {boolean=} unsigned Whether unsigned or not, defaults to `false` for signed
41873 * @returns {!Long} The corresponding Long value
41874 */
41875 Long.fromInt = fromInt;
41876
41877 /**
41878 * @param {number} value
41879 * @param {boolean=} unsigned
41880 * @returns {!Long}
41881 * @inner
41882 */
41883 function fromNumber(value, unsigned) {
41884 if (isNaN(value) || !isFinite(value))
41885 return unsigned ? UZERO : ZERO;
41886 if (unsigned) {
41887 if (value < 0)
41888 return UZERO;
41889 if (value >= TWO_PWR_64_DBL)
41890 return MAX_UNSIGNED_VALUE;
41891 } else {
41892 if (value <= -TWO_PWR_63_DBL)
41893 return MIN_VALUE;
41894 if (value + 1 >= TWO_PWR_63_DBL)
41895 return MAX_VALUE;
41896 }
41897 if (value < 0)
41898 return fromNumber(-value, unsigned).neg();
41899 return fromBits((value % TWO_PWR_32_DBL) | 0, (value / TWO_PWR_32_DBL) | 0, unsigned);
41900 }
41901
41902 /**
41903 * Returns a Long representing the given value, provided that it is a finite number. Otherwise, zero is returned.
41904 * @function
41905 * @param {number} value The number in question
41906 * @param {boolean=} unsigned Whether unsigned or not, defaults to `false` for signed
41907 * @returns {!Long} The corresponding Long value
41908 */
41909 Long.fromNumber = fromNumber;
41910
41911 /**
41912 * @param {number} lowBits
41913 * @param {number} highBits
41914 * @param {boolean=} unsigned
41915 * @returns {!Long}
41916 * @inner
41917 */
41918 function fromBits(lowBits, highBits, unsigned) {
41919 return new Long(lowBits, highBits, unsigned);
41920 }
41921
41922 /**
41923 * Returns a Long representing the 64 bit integer that comes by concatenating the given low and high bits. Each is
41924 * assumed to use 32 bits.
41925 * @function
41926 * @param {number} lowBits The low 32 bits
41927 * @param {number} highBits The high 32 bits
41928 * @param {boolean=} unsigned Whether unsigned or not, defaults to `false` for signed
41929 * @returns {!Long} The corresponding Long value
41930 */
41931 Long.fromBits = fromBits;
41932
41933 /**
41934 * @function
41935 * @param {number} base
41936 * @param {number} exponent
41937 * @returns {number}
41938 * @inner
41939 */
41940 var pow_dbl = Math.pow; // Used 4 times (4*8 to 15+4)
41941
41942 /**
41943 * @param {string} str
41944 * @param {(boolean|number)=} unsigned
41945 * @param {number=} radix
41946 * @returns {!Long}
41947 * @inner
41948 */
41949 function fromString(str, unsigned, radix) {
41950 if (str.length === 0)
41951 throw Error('empty string');
41952 if (str === "NaN" || str === "Infinity" || str === "+Infinity" || str === "-Infinity")
41953 return ZERO;
41954 if (typeof unsigned === 'number') {
41955 // For goog.math.long compatibility
41956 radix = unsigned,
41957 unsigned = false;
41958 } else {
41959 unsigned = !! unsigned;
41960 }
41961 radix = radix || 10;
41962 if (radix < 2 || 36 < radix)
41963 throw RangeError('radix');
41964
41965 var p;
41966 if ((p = str.indexOf('-')) > 0)
41967 throw Error('interior hyphen');
41968 else if (p === 0) {
41969 return fromString(str.substring(1), unsigned, radix).neg();
41970 }
41971
41972 // Do several (8) digits each time through the loop, so as to
41973 // minimize the calls to the very expensive emulated div.
41974 var radixToPower = fromNumber(pow_dbl(radix, 8));
41975
41976 var result = ZERO;
41977 for (var i = 0; i < str.length; i += 8) {
41978 var size = Math.min(8, str.length - i),
41979 value = parseInt(str.substring(i, i + size), radix);
41980 if (size < 8) {
41981 var power = fromNumber(pow_dbl(radix, size));
41982 result = result.mul(power).add(fromNumber(value));
41983 } else {
41984 result = result.mul(radixToPower);
41985 result = result.add(fromNumber(value));
41986 }
41987 }
41988 result.unsigned = unsigned;
41989 return result;
41990 }
41991
41992 /**
41993 * Returns a Long representation of the given string, written using the specified radix.
41994 * @function
41995 * @param {string} str The textual representation of the Long
41996 * @param {(boolean|number)=} unsigned Whether unsigned or not, defaults to `false` for signed
41997 * @param {number=} radix The radix in which the text is written (2-36), defaults to 10
41998 * @returns {!Long} The corresponding Long value
41999 */
42000 Long.fromString = fromString;
42001
42002 /**
42003 * @function
42004 * @param {!Long|number|string|!{low: number, high: number, unsigned: boolean}} val
42005 * @returns {!Long}
42006 * @inner
42007 */
42008 function fromValue(val) {
42009 if (val /* is compatible */ instanceof Long)
42010 return val;
42011 if (typeof val === 'number')
42012 return fromNumber(val);
42013 if (typeof val === 'string')
42014 return fromString(val);
42015 // Throws for non-objects, converts non-instanceof Long:
42016 return fromBits(val.low, val.high, val.unsigned);
42017 }
42018
42019 /**
42020 * Converts the specified value to a Long.
42021 * @function
42022 * @param {!Long|number|string|!{low: number, high: number, unsigned: boolean}} val Value
42023 * @returns {!Long}
42024 */
42025 Long.fromValue = fromValue;
42026
42027 // NOTE: the compiler should inline these constant values below and then remove these variables, so there should be
42028 // no runtime penalty for these.
42029
42030 /**
42031 * @type {number}
42032 * @const
42033 * @inner
42034 */
42035 var TWO_PWR_16_DBL = 1 << 16;
42036
42037 /**
42038 * @type {number}
42039 * @const
42040 * @inner
42041 */
42042 var TWO_PWR_24_DBL = 1 << 24;
42043
42044 /**
42045 * @type {number}
42046 * @const
42047 * @inner
42048 */
42049 var TWO_PWR_32_DBL = TWO_PWR_16_DBL * TWO_PWR_16_DBL;
42050
42051 /**
42052 * @type {number}
42053 * @const
42054 * @inner
42055 */
42056 var TWO_PWR_64_DBL = TWO_PWR_32_DBL * TWO_PWR_32_DBL;
42057
42058 /**
42059 * @type {number}
42060 * @const
42061 * @inner
42062 */
42063 var TWO_PWR_63_DBL = TWO_PWR_64_DBL / 2;
42064
42065 /**
42066 * @type {!Long}
42067 * @const
42068 * @inner
42069 */
42070 var TWO_PWR_24 = fromInt(TWO_PWR_24_DBL);
42071
42072 /**
42073 * @type {!Long}
42074 * @inner
42075 */
42076 var ZERO = fromInt(0);
42077
42078 /**
42079 * Signed zero.
42080 * @type {!Long}
42081 */
42082 Long.ZERO = ZERO;
42083
42084 /**
42085 * @type {!Long}
42086 * @inner
42087 */
42088 var UZERO = fromInt(0, true);
42089
42090 /**
42091 * Unsigned zero.
42092 * @type {!Long}
42093 */
42094 Long.UZERO = UZERO;
42095
42096 /**
42097 * @type {!Long}
42098 * @inner
42099 */
42100 var ONE = fromInt(1);
42101
42102 /**
42103 * Signed one.
42104 * @type {!Long}
42105 */
42106 Long.ONE = ONE;
42107
42108 /**
42109 * @type {!Long}
42110 * @inner
42111 */
42112 var UONE = fromInt(1, true);
42113
42114 /**
42115 * Unsigned one.
42116 * @type {!Long}
42117 */
42118 Long.UONE = UONE;
42119
42120 /**
42121 * @type {!Long}
42122 * @inner
42123 */
42124 var NEG_ONE = fromInt(-1);
42125
42126 /**
42127 * Signed negative one.
42128 * @type {!Long}
42129 */
42130 Long.NEG_ONE = NEG_ONE;
42131
42132 /**
42133 * @type {!Long}
42134 * @inner
42135 */
42136 var MAX_VALUE = fromBits(0xFFFFFFFF|0, 0x7FFFFFFF|0, false);
42137
42138 /**
42139 * Maximum signed value.
42140 * @type {!Long}
42141 */
42142 Long.MAX_VALUE = MAX_VALUE;
42143
42144 /**
42145 * @type {!Long}
42146 * @inner
42147 */
42148 var MAX_UNSIGNED_VALUE = fromBits(0xFFFFFFFF|0, 0xFFFFFFFF|0, true);
42149
42150 /**
42151 * Maximum unsigned value.
42152 * @type {!Long}
42153 */
42154 Long.MAX_UNSIGNED_VALUE = MAX_UNSIGNED_VALUE;
42155
42156 /**
42157 * @type {!Long}
42158 * @inner
42159 */
42160 var MIN_VALUE = fromBits(0, 0x80000000|0, false);
42161
42162 /**
42163 * Minimum signed value.
42164 * @type {!Long}
42165 */
42166 Long.MIN_VALUE = MIN_VALUE;
42167
42168 /**
42169 * @alias Long.prototype
42170 * @inner
42171 */
42172 var LongPrototype = Long.prototype;
42173
42174 /**
42175 * Converts the Long to a 32 bit integer, assuming it is a 32 bit integer.
42176 * @returns {number}
42177 */
42178 LongPrototype.toInt = function toInt() {
42179 return this.unsigned ? this.low >>> 0 : this.low;
42180 };
42181
42182 /**
42183 * Converts the Long to a the nearest floating-point representation of this value (double, 53 bit mantissa).
42184 * @returns {number}
42185 */
42186 LongPrototype.toNumber = function toNumber() {
42187 if (this.unsigned)
42188 return ((this.high >>> 0) * TWO_PWR_32_DBL) + (this.low >>> 0);
42189 return this.high * TWO_PWR_32_DBL + (this.low >>> 0);
42190 };
42191
42192 /**
42193 * Converts the Long to a string written in the specified radix.
42194 * @param {number=} radix Radix (2-36), defaults to 10
42195 * @returns {string}
42196 * @override
42197 * @throws {RangeError} If `radix` is out of range
42198 */
42199 LongPrototype.toString = function toString(radix) {
42200 radix = radix || 10;
42201 if (radix < 2 || 36 < radix)
42202 throw RangeError('radix');
42203 if (this.isZero())
42204 return '0';
42205 if (this.isNegative()) { // Unsigned Longs are never negative
42206 if (this.eq(MIN_VALUE)) {
42207 // We need to change the Long value before it can be negated, so we remove
42208 // the bottom-most digit in this base and then recurse to do the rest.
42209 var radixLong = fromNumber(radix),
42210 div = this.div(radixLong),
42211 rem1 = div.mul(radixLong).sub(this);
42212 return div.toString(radix) + rem1.toInt().toString(radix);
42213 } else
42214 return '-' + this.neg().toString(radix);
42215 }
42216
42217 // Do several (6) digits each time through the loop, so as to
42218 // minimize the calls to the very expensive emulated div.
42219 var radixToPower = fromNumber(pow_dbl(radix, 6), this.unsigned),
42220 rem = this;
42221 var result = '';
42222 while (true) {
42223 var remDiv = rem.div(radixToPower),
42224 intval = rem.sub(remDiv.mul(radixToPower)).toInt() >>> 0,
42225 digits = intval.toString(radix);
42226 rem = remDiv;
42227 if (rem.isZero())
42228 return digits + result;
42229 else {
42230 while (digits.length < 6)
42231 digits = '0' + digits;
42232 result = '' + digits + result;
42233 }
42234 }
42235 };
42236
42237 /**
42238 * Gets the high 32 bits as a signed integer.
42239 * @returns {number} Signed high bits
42240 */
42241 LongPrototype.getHighBits = function getHighBits() {
42242 return this.high;
42243 };
42244
42245 /**
42246 * Gets the high 32 bits as an unsigned integer.
42247 * @returns {number} Unsigned high bits
42248 */
42249 LongPrototype.getHighBitsUnsigned = function getHighBitsUnsigned() {
42250 return this.high >>> 0;
42251 };
42252
42253 /**
42254 * Gets the low 32 bits as a signed integer.
42255 * @returns {number} Signed low bits
42256 */
42257 LongPrototype.getLowBits = function getLowBits() {
42258 return this.low;
42259 };
42260
42261 /**
42262 * Gets the low 32 bits as an unsigned integer.
42263 * @returns {number} Unsigned low bits
42264 */
42265 LongPrototype.getLowBitsUnsigned = function getLowBitsUnsigned() {
42266 return this.low >>> 0;
42267 };
42268
42269 /**
42270 * Gets the number of bits needed to represent the absolute value of this Long.
42271 * @returns {number}
42272 */
42273 LongPrototype.getNumBitsAbs = function getNumBitsAbs() {
42274 if (this.isNegative()) // Unsigned Longs are never negative
42275 return this.eq(MIN_VALUE) ? 64 : this.neg().getNumBitsAbs();
42276 var val = this.high != 0 ? this.high : this.low;
42277 for (var bit = 31; bit > 0; bit--)
42278 if ((val & (1 << bit)) != 0)
42279 break;
42280 return this.high != 0 ? bit + 33 : bit + 1;
42281 };
42282
42283 /**
42284 * Tests if this Long's value equals zero.
42285 * @returns {boolean}
42286 */
42287 LongPrototype.isZero = function isZero() {
42288 return this.high === 0 && this.low === 0;
42289 };
42290
42291 /**
42292 * Tests if this Long's value is negative.
42293 * @returns {boolean}
42294 */
42295 LongPrototype.isNegative = function isNegative() {
42296 return !this.unsigned && this.high < 0;
42297 };
42298
42299 /**
42300 * Tests if this Long's value is positive.
42301 * @returns {boolean}
42302 */
42303 LongPrototype.isPositive = function isPositive() {
42304 return this.unsigned || this.high >= 0;
42305 };
42306
42307 /**
42308 * Tests if this Long's value is odd.
42309 * @returns {boolean}
42310 */
42311 LongPrototype.isOdd = function isOdd() {
42312 return (this.low & 1) === 1;
42313 };
42314
42315 /**
42316 * Tests if this Long's value is even.
42317 * @returns {boolean}
42318 */
42319 LongPrototype.isEven = function isEven() {
42320 return (this.low & 1) === 0;
42321 };
42322
42323 /**
42324 * Tests if this Long's value equals the specified's.
42325 * @param {!Long|number|string} other Other value
42326 * @returns {boolean}
42327 */
42328 LongPrototype.equals = function equals(other) {
42329 if (!isLong(other))
42330 other = fromValue(other);
42331 if (this.unsigned !== other.unsigned && (this.high >>> 31) === 1 && (other.high >>> 31) === 1)
42332 return false;
42333 return this.high === other.high && this.low === other.low;
42334 };
42335
42336 /**
42337 * Tests if this Long's value equals the specified's. This is an alias of {@link Long#equals}.
42338 * @function
42339 * @param {!Long|number|string} other Other value
42340 * @returns {boolean}
42341 */
42342 LongPrototype.eq = LongPrototype.equals;
42343
42344 /**
42345 * Tests if this Long's value differs from the specified's.
42346 * @param {!Long|number|string} other Other value
42347 * @returns {boolean}
42348 */
42349 LongPrototype.notEquals = function notEquals(other) {
42350 return !this.eq(/* validates */ other);
42351 };
42352
42353 /**
42354 * Tests if this Long's value differs from the specified's. This is an alias of {@link Long#notEquals}.
42355 * @function
42356 * @param {!Long|number|string} other Other value
42357 * @returns {boolean}
42358 */
42359 LongPrototype.neq = LongPrototype.notEquals;
42360
42361 /**
42362 * Tests if this Long's value is less than the specified's.
42363 * @param {!Long|number|string} other Other value
42364 * @returns {boolean}
42365 */
42366 LongPrototype.lessThan = function lessThan(other) {
42367 return this.comp(/* validates */ other) < 0;
42368 };
42369
42370 /**
42371 * Tests if this Long's value is less than the specified's. This is an alias of {@link Long#lessThan}.
42372 * @function
42373 * @param {!Long|number|string} other Other value
42374 * @returns {boolean}
42375 */
42376 LongPrototype.lt = LongPrototype.lessThan;
42377
42378 /**
42379 * Tests if this Long's value is less than or equal the specified's.
42380 * @param {!Long|number|string} other Other value
42381 * @returns {boolean}
42382 */
42383 LongPrototype.lessThanOrEqual = function lessThanOrEqual(other) {
42384 return this.comp(/* validates */ other) <= 0;
42385 };
42386
42387 /**
42388 * Tests if this Long's value is less than or equal the specified's. This is an alias of {@link Long#lessThanOrEqual}.
42389 * @function
42390 * @param {!Long|number|string} other Other value
42391 * @returns {boolean}
42392 */
42393 LongPrototype.lte = LongPrototype.lessThanOrEqual;
42394
42395 /**
42396 * Tests if this Long's value is greater than the specified's.
42397 * @param {!Long|number|string} other Other value
42398 * @returns {boolean}
42399 */
42400 LongPrototype.greaterThan = function greaterThan(other) {
42401 return this.comp(/* validates */ other) > 0;
42402 };
42403
42404 /**
42405 * Tests if this Long's value is greater than the specified's. This is an alias of {@link Long#greaterThan}.
42406 * @function
42407 * @param {!Long|number|string} other Other value
42408 * @returns {boolean}
42409 */
42410 LongPrototype.gt = LongPrototype.greaterThan;
42411
42412 /**
42413 * Tests if this Long's value is greater than or equal the specified's.
42414 * @param {!Long|number|string} other Other value
42415 * @returns {boolean}
42416 */
42417 LongPrototype.greaterThanOrEqual = function greaterThanOrEqual(other) {
42418 return this.comp(/* validates */ other) >= 0;
42419 };
42420
42421 /**
42422 * Tests if this Long's value is greater than or equal the specified's. This is an alias of {@link Long#greaterThanOrEqual}.
42423 * @function
42424 * @param {!Long|number|string} other Other value
42425 * @returns {boolean}
42426 */
42427 LongPrototype.gte = LongPrototype.greaterThanOrEqual;
42428
42429 /**
42430 * Compares this Long's value with the specified's.
42431 * @param {!Long|number|string} other Other value
42432 * @returns {number} 0 if they are the same, 1 if the this is greater and -1
42433 * if the given one is greater
42434 */
42435 LongPrototype.compare = function compare(other) {
42436 if (!isLong(other))
42437 other = fromValue(other);
42438 if (this.eq(other))
42439 return 0;
42440 var thisNeg = this.isNegative(),
42441 otherNeg = other.isNegative();
42442 if (thisNeg && !otherNeg)
42443 return -1;
42444 if (!thisNeg && otherNeg)
42445 return 1;
42446 // At this point the sign bits are the same
42447 if (!this.unsigned)
42448 return this.sub(other).isNegative() ? -1 : 1;
42449 // Both are positive if at least one is unsigned
42450 return (other.high >>> 0) > (this.high >>> 0) || (other.high === this.high && (other.low >>> 0) > (this.low >>> 0)) ? -1 : 1;
42451 };
42452
42453 /**
42454 * Compares this Long's value with the specified's. This is an alias of {@link Long#compare}.
42455 * @function
42456 * @param {!Long|number|string} other Other value
42457 * @returns {number} 0 if they are the same, 1 if the this is greater and -1
42458 * if the given one is greater
42459 */
42460 LongPrototype.comp = LongPrototype.compare;
42461
42462 /**
42463 * Negates this Long's value.
42464 * @returns {!Long} Negated Long
42465 */
42466 LongPrototype.negate = function negate() {
42467 if (!this.unsigned && this.eq(MIN_VALUE))
42468 return MIN_VALUE;
42469 return this.not().add(ONE);
42470 };
42471
42472 /**
42473 * Negates this Long's value. This is an alias of {@link Long#negate}.
42474 * @function
42475 * @returns {!Long} Negated Long
42476 */
42477 LongPrototype.neg = LongPrototype.negate;
42478
42479 /**
42480 * Returns the sum of this and the specified Long.
42481 * @param {!Long|number|string} addend Addend
42482 * @returns {!Long} Sum
42483 */
42484 LongPrototype.add = function add(addend) {
42485 if (!isLong(addend))
42486 addend = fromValue(addend);
42487
42488 // Divide each number into 4 chunks of 16 bits, and then sum the chunks.
42489
42490 var a48 = this.high >>> 16;
42491 var a32 = this.high & 0xFFFF;
42492 var a16 = this.low >>> 16;
42493 var a00 = this.low & 0xFFFF;
42494
42495 var b48 = addend.high >>> 16;
42496 var b32 = addend.high & 0xFFFF;
42497 var b16 = addend.low >>> 16;
42498 var b00 = addend.low & 0xFFFF;
42499
42500 var c48 = 0, c32 = 0, c16 = 0, c00 = 0;
42501 c00 += a00 + b00;
42502 c16 += c00 >>> 16;
42503 c00 &= 0xFFFF;
42504 c16 += a16 + b16;
42505 c32 += c16 >>> 16;
42506 c16 &= 0xFFFF;
42507 c32 += a32 + b32;
42508 c48 += c32 >>> 16;
42509 c32 &= 0xFFFF;
42510 c48 += a48 + b48;
42511 c48 &= 0xFFFF;
42512 return fromBits((c16 << 16) | c00, (c48 << 16) | c32, this.unsigned);
42513 };
42514
42515 /**
42516 * Returns the difference of this and the specified Long.
42517 * @param {!Long|number|string} subtrahend Subtrahend
42518 * @returns {!Long} Difference
42519 */
42520 LongPrototype.subtract = function subtract(subtrahend) {
42521 if (!isLong(subtrahend))
42522 subtrahend = fromValue(subtrahend);
42523 return this.add(subtrahend.neg());
42524 };
42525
42526 /**
42527 * Returns the difference of this and the specified Long. This is an alias of {@link Long#subtract}.
42528 * @function
42529 * @param {!Long|number|string} subtrahend Subtrahend
42530 * @returns {!Long} Difference
42531 */
42532 LongPrototype.sub = LongPrototype.subtract;
42533
42534 /**
42535 * Returns the product of this and the specified Long.
42536 * @param {!Long|number|string} multiplier Multiplier
42537 * @returns {!Long} Product
42538 */
42539 LongPrototype.multiply = function multiply(multiplier) {
42540 if (this.isZero())
42541 return ZERO;
42542 if (!isLong(multiplier))
42543 multiplier = fromValue(multiplier);
42544 if (multiplier.isZero())
42545 return ZERO;
42546 if (this.eq(MIN_VALUE))
42547 return multiplier.isOdd() ? MIN_VALUE : ZERO;
42548 if (multiplier.eq(MIN_VALUE))
42549 return this.isOdd() ? MIN_VALUE : ZERO;
42550
42551 if (this.isNegative()) {
42552 if (multiplier.isNegative())
42553 return this.neg().mul(multiplier.neg());
42554 else
42555 return this.neg().mul(multiplier).neg();
42556 } else if (multiplier.isNegative())
42557 return this.mul(multiplier.neg()).neg();
42558
42559 // If both longs are small, use float multiplication
42560 if (this.lt(TWO_PWR_24) && multiplier.lt(TWO_PWR_24))
42561 return fromNumber(this.toNumber() * multiplier.toNumber(), this.unsigned);
42562
42563 // Divide each long into 4 chunks of 16 bits, and then add up 4x4 products.
42564 // We can skip products that would overflow.
42565
42566 var a48 = this.high >>> 16;
42567 var a32 = this.high & 0xFFFF;
42568 var a16 = this.low >>> 16;
42569 var a00 = this.low & 0xFFFF;
42570
42571 var b48 = multiplier.high >>> 16;
42572 var b32 = multiplier.high & 0xFFFF;
42573 var b16 = multiplier.low >>> 16;
42574 var b00 = multiplier.low & 0xFFFF;
42575
42576 var c48 = 0, c32 = 0, c16 = 0, c00 = 0;
42577 c00 += a00 * b00;
42578 c16 += c00 >>> 16;
42579 c00 &= 0xFFFF;
42580 c16 += a16 * b00;
42581 c32 += c16 >>> 16;
42582 c16 &= 0xFFFF;
42583 c16 += a00 * b16;
42584 c32 += c16 >>> 16;
42585 c16 &= 0xFFFF;
42586 c32 += a32 * b00;
42587 c48 += c32 >>> 16;
42588 c32 &= 0xFFFF;
42589 c32 += a16 * b16;
42590 c48 += c32 >>> 16;
42591 c32 &= 0xFFFF;
42592 c32 += a00 * b32;
42593 c48 += c32 >>> 16;
42594 c32 &= 0xFFFF;
42595 c48 += a48 * b00 + a32 * b16 + a16 * b32 + a00 * b48;
42596 c48 &= 0xFFFF;
42597 return fromBits((c16 << 16) | c00, (c48 << 16) | c32, this.unsigned);
42598 };
42599
42600 /**
42601 * Returns the product of this and the specified Long. This is an alias of {@link Long#multiply}.
42602 * @function
42603 * @param {!Long|number|string} multiplier Multiplier
42604 * @returns {!Long} Product
42605 */
42606 LongPrototype.mul = LongPrototype.multiply;
42607
42608 /**
42609 * Returns this Long divided by the specified. The result is signed if this Long is signed or
42610 * unsigned if this Long is unsigned.
42611 * @param {!Long|number|string} divisor Divisor
42612 * @returns {!Long} Quotient
42613 */
42614 LongPrototype.divide = function divide(divisor) {
42615 if (!isLong(divisor))
42616 divisor = fromValue(divisor);
42617 if (divisor.isZero())
42618 throw Error('division by zero');
42619 if (this.isZero())
42620 return this.unsigned ? UZERO : ZERO;
42621 var approx, rem, res;
42622 if (!this.unsigned) {
42623 // This section is only relevant for signed longs and is derived from the
42624 // closure library as a whole.
42625 if (this.eq(MIN_VALUE)) {
42626 if (divisor.eq(ONE) || divisor.eq(NEG_ONE))
42627 return MIN_VALUE; // recall that -MIN_VALUE == MIN_VALUE
42628 else if (divisor.eq(MIN_VALUE))
42629 return ONE;
42630 else {
42631 // At this point, we have |other| >= 2, so |this/other| < |MIN_VALUE|.
42632 var halfThis = this.shr(1);
42633 approx = halfThis.div(divisor).shl(1);
42634 if (approx.eq(ZERO)) {
42635 return divisor.isNegative() ? ONE : NEG_ONE;
42636 } else {
42637 rem = this.sub(divisor.mul(approx));
42638 res = approx.add(rem.div(divisor));
42639 return res;
42640 }
42641 }
42642 } else if (divisor.eq(MIN_VALUE))
42643 return this.unsigned ? UZERO : ZERO;
42644 if (this.isNegative()) {
42645 if (divisor.isNegative())
42646 return this.neg().div(divisor.neg());
42647 return this.neg().div(divisor).neg();
42648 } else if (divisor.isNegative())
42649 return this.div(divisor.neg()).neg();
42650 res = ZERO;
42651 } else {
42652 // The algorithm below has not been made for unsigned longs. It's therefore
42653 // required to take special care of the MSB prior to running it.
42654 if (!divisor.unsigned)
42655 divisor = divisor.toUnsigned();
42656 if (divisor.gt(this))
42657 return UZERO;
42658 if (divisor.gt(this.shru(1))) // 15 >>> 1 = 7 ; with divisor = 8 ; true
42659 return UONE;
42660 res = UZERO;
42661 }
42662
42663 // Repeat the following until the remainder is less than other: find a
42664 // floating-point that approximates remainder / other *from below*, add this
42665 // into the result, and subtract it from the remainder. It is critical that
42666 // the approximate value is less than or equal to the real value so that the
42667 // remainder never becomes negative.
42668 rem = this;
42669 while (rem.gte(divisor)) {
42670 // Approximate the result of division. This may be a little greater or
42671 // smaller than the actual value.
42672 approx = Math.max(1, Math.floor(rem.toNumber() / divisor.toNumber()));
42673
42674 // We will tweak the approximate result by changing it in the 48-th digit or
42675 // the smallest non-fractional digit, whichever is larger.
42676 var log2 = Math.ceil(Math.log(approx) / Math.LN2),
42677 delta = (log2 <= 48) ? 1 : pow_dbl(2, log2 - 48),
42678
42679 // Decrease the approximation until it is smaller than the remainder. Note
42680 // that if it is too large, the product overflows and is negative.
42681 approxRes = fromNumber(approx),
42682 approxRem = approxRes.mul(divisor);
42683 while (approxRem.isNegative() || approxRem.gt(rem)) {
42684 approx -= delta;
42685 approxRes = fromNumber(approx, this.unsigned);
42686 approxRem = approxRes.mul(divisor);
42687 }
42688
42689 // We know the answer can't be zero... and actually, zero would cause
42690 // infinite recursion since we would make no progress.
42691 if (approxRes.isZero())
42692 approxRes = ONE;
42693
42694 res = res.add(approxRes);
42695 rem = rem.sub(approxRem);
42696 }
42697 return res;
42698 };
42699
42700 /**
42701 * Returns this Long divided by the specified. This is an alias of {@link Long#divide}.
42702 * @function
42703 * @param {!Long|number|string} divisor Divisor
42704 * @returns {!Long} Quotient
42705 */
42706 LongPrototype.div = LongPrototype.divide;
42707
42708 /**
42709 * Returns this Long modulo the specified.
42710 * @param {!Long|number|string} divisor Divisor
42711 * @returns {!Long} Remainder
42712 */
42713 LongPrototype.modulo = function modulo(divisor) {
42714 if (!isLong(divisor))
42715 divisor = fromValue(divisor);
42716 return this.sub(this.div(divisor).mul(divisor));
42717 };
42718
42719 /**
42720 * Returns this Long modulo the specified. This is an alias of {@link Long#modulo}.
42721 * @function
42722 * @param {!Long|number|string} divisor Divisor
42723 * @returns {!Long} Remainder
42724 */
42725 LongPrototype.mod = LongPrototype.modulo;
42726
42727 /**
42728 * Returns the bitwise NOT of this Long.
42729 * @returns {!Long}
42730 */
42731 LongPrototype.not = function not() {
42732 return fromBits(~this.low, ~this.high, this.unsigned);
42733 };
42734
42735 /**
42736 * Returns the bitwise AND of this Long and the specified.
42737 * @param {!Long|number|string} other Other Long
42738 * @returns {!Long}
42739 */
42740 LongPrototype.and = function and(other) {
42741 if (!isLong(other))
42742 other = fromValue(other);
42743 return fromBits(this.low & other.low, this.high & other.high, this.unsigned);
42744 };
42745
42746 /**
42747 * Returns the bitwise OR of this Long and the specified.
42748 * @param {!Long|number|string} other Other Long
42749 * @returns {!Long}
42750 */
42751 LongPrototype.or = function or(other) {
42752 if (!isLong(other))
42753 other = fromValue(other);
42754 return fromBits(this.low | other.low, this.high | other.high, this.unsigned);
42755 };
42756
42757 /**
42758 * Returns the bitwise XOR of this Long and the given one.
42759 * @param {!Long|number|string} other Other Long
42760 * @returns {!Long}
42761 */
42762 LongPrototype.xor = function xor(other) {
42763 if (!isLong(other))
42764 other = fromValue(other);
42765 return fromBits(this.low ^ other.low, this.high ^ other.high, this.unsigned);
42766 };
42767
42768 /**
42769 * Returns this Long with bits shifted to the left by the given amount.
42770 * @param {number|!Long} numBits Number of bits
42771 * @returns {!Long} Shifted Long
42772 */
42773 LongPrototype.shiftLeft = function shiftLeft(numBits) {
42774 if (isLong(numBits))
42775 numBits = numBits.toInt();
42776 if ((numBits &= 63) === 0)
42777 return this;
42778 else if (numBits < 32)
42779 return fromBits(this.low << numBits, (this.high << numBits) | (this.low >>> (32 - numBits)), this.unsigned);
42780 else
42781 return fromBits(0, this.low << (numBits - 32), this.unsigned);
42782 };
42783
42784 /**
42785 * Returns this Long with bits shifted to the left by the given amount. This is an alias of {@link Long#shiftLeft}.
42786 * @function
42787 * @param {number|!Long} numBits Number of bits
42788 * @returns {!Long} Shifted Long
42789 */
42790 LongPrototype.shl = LongPrototype.shiftLeft;
42791
42792 /**
42793 * Returns this Long with bits arithmetically shifted to the right by the given amount.
42794 * @param {number|!Long} numBits Number of bits
42795 * @returns {!Long} Shifted Long
42796 */
42797 LongPrototype.shiftRight = function shiftRight(numBits) {
42798 if (isLong(numBits))
42799 numBits = numBits.toInt();
42800 if ((numBits &= 63) === 0)
42801 return this;
42802 else if (numBits < 32)
42803 return fromBits((this.low >>> numBits) | (this.high << (32 - numBits)), this.high >> numBits, this.unsigned);
42804 else
42805 return fromBits(this.high >> (numBits - 32), this.high >= 0 ? 0 : -1, this.unsigned);
42806 };
42807
42808 /**
42809 * Returns this Long with bits arithmetically shifted to the right by the given amount. This is an alias of {@link Long#shiftRight}.
42810 * @function
42811 * @param {number|!Long} numBits Number of bits
42812 * @returns {!Long} Shifted Long
42813 */
42814 LongPrototype.shr = LongPrototype.shiftRight;
42815
42816 /**
42817 * Returns this Long with bits logically shifted to the right by the given amount.
42818 * @param {number|!Long} numBits Number of bits
42819 * @returns {!Long} Shifted Long
42820 */
42821 LongPrototype.shiftRightUnsigned = function shiftRightUnsigned(numBits) {
42822 if (isLong(numBits))
42823 numBits = numBits.toInt();
42824 numBits &= 63;
42825 if (numBits === 0)
42826 return this;
42827 else {
42828 var high = this.high;
42829 if (numBits < 32) {
42830 var low = this.low;
42831 return fromBits((low >>> numBits) | (high << (32 - numBits)), high >>> numBits, this.unsigned);
42832 } else if (numBits === 32)
42833 return fromBits(high, 0, this.unsigned);
42834 else
42835 return fromBits(high >>> (numBits - 32), 0, this.unsigned);
42836 }
42837 };
42838
42839 /**
42840 * Returns this Long with bits logically shifted to the right by the given amount. This is an alias of {@link Long#shiftRightUnsigned}.
42841 * @function
42842 * @param {number|!Long} numBits Number of bits
42843 * @returns {!Long} Shifted Long
42844 */
42845 LongPrototype.shru = LongPrototype.shiftRightUnsigned;
42846
42847 /**
42848 * Converts this Long to signed.
42849 * @returns {!Long} Signed long
42850 */
42851 LongPrototype.toSigned = function toSigned() {
42852 if (!this.unsigned)
42853 return this;
42854 return fromBits(this.low, this.high, false);
42855 };
42856
42857 /**
42858 * Converts this Long to unsigned.
42859 * @returns {!Long} Unsigned long
42860 */
42861 LongPrototype.toUnsigned = function toUnsigned() {
42862 if (this.unsigned)
42863 return this;
42864 return fromBits(this.low, this.high, true);
42865 };
42866
42867 /**
42868 * Converts this Long to its byte representation.
42869 * @param {boolean=} le Whether little or big endian, defaults to big endian
42870 * @returns {!Array.<number>} Byte representation
42871 */
42872 LongPrototype.toBytes = function(le) {
42873 return le ? this.toBytesLE() : this.toBytesBE();
42874 }
42875
42876 /**
42877 * Converts this Long to its little endian byte representation.
42878 * @returns {!Array.<number>} Little endian byte representation
42879 */
42880 LongPrototype.toBytesLE = function() {
42881 var hi = this.high,
42882 lo = this.low;
42883 return [
42884 lo & 0xff,
42885 (lo >>> 8) & 0xff,
42886 (lo >>> 16) & 0xff,
42887 (lo >>> 24) & 0xff,
42888 hi & 0xff,
42889 (hi >>> 8) & 0xff,
42890 (hi >>> 16) & 0xff,
42891 (hi >>> 24) & 0xff
42892 ];
42893 }
42894
42895 /**
42896 * Converts this Long to its big endian byte representation.
42897 * @returns {!Array.<number>} Big endian byte representation
42898 */
42899 LongPrototype.toBytesBE = function() {
42900 var hi = this.high,
42901 lo = this.low;
42902 return [
42903 (hi >>> 24) & 0xff,
42904 (hi >>> 16) & 0xff,
42905 (hi >>> 8) & 0xff,
42906 hi & 0xff,
42907 (lo >>> 24) & 0xff,
42908 (lo >>> 16) & 0xff,
42909 (lo >>> 8) & 0xff,
42910 lo & 0xff
42911 ];
42912 }
42913
42914 return Long;
42915});
42916
42917
42918/***/ }),
42919/* 655 */
42920/***/ (function(module, exports) {
42921
42922/* (ignored) */
42923
42924/***/ }),
42925/* 656 */
42926/***/ (function(module, exports, __webpack_require__) {
42927
42928"use strict";
42929
42930
42931var _interopRequireDefault = __webpack_require__(1);
42932
42933var _slice = _interopRequireDefault(__webpack_require__(34));
42934
42935var _getOwnPropertySymbols = _interopRequireDefault(__webpack_require__(266));
42936
42937var _concat = _interopRequireDefault(__webpack_require__(19));
42938
42939var has = Object.prototype.hasOwnProperty,
42940 prefix = '~';
42941/**
42942 * Constructor to create a storage for our `EE` objects.
42943 * An `Events` instance is a plain object whose properties are event names.
42944 *
42945 * @constructor
42946 * @private
42947 */
42948
42949function Events() {} //
42950// We try to not inherit from `Object.prototype`. In some engines creating an
42951// instance in this way is faster than calling `Object.create(null)` directly.
42952// If `Object.create(null)` is not supported we prefix the event names with a
42953// character to make sure that the built-in object properties are not
42954// overridden or used as an attack vector.
42955//
42956
42957
42958if (Object.create) {
42959 Events.prototype = Object.create(null); //
42960 // This hack is needed because the `__proto__` property is still inherited in
42961 // some old browsers like Android 4, iPhone 5.1, Opera 11 and Safari 5.
42962 //
42963
42964 if (!new Events().__proto__) prefix = false;
42965}
42966/**
42967 * Representation of a single event listener.
42968 *
42969 * @param {Function} fn The listener function.
42970 * @param {*} context The context to invoke the listener with.
42971 * @param {Boolean} [once=false] Specify if the listener is a one-time listener.
42972 * @constructor
42973 * @private
42974 */
42975
42976
42977function EE(fn, context, once) {
42978 this.fn = fn;
42979 this.context = context;
42980 this.once = once || false;
42981}
42982/**
42983 * Add a listener for a given event.
42984 *
42985 * @param {EventEmitter} emitter Reference to the `EventEmitter` instance.
42986 * @param {(String|Symbol)} event The event name.
42987 * @param {Function} fn The listener function.
42988 * @param {*} context The context to invoke the listener with.
42989 * @param {Boolean} once Specify if the listener is a one-time listener.
42990 * @returns {EventEmitter}
42991 * @private
42992 */
42993
42994
42995function addListener(emitter, event, fn, context, once) {
42996 if (typeof fn !== 'function') {
42997 throw new TypeError('The listener must be a function');
42998 }
42999
43000 var listener = new EE(fn, context || emitter, once),
43001 evt = prefix ? prefix + event : event;
43002 if (!emitter._events[evt]) emitter._events[evt] = listener, emitter._eventsCount++;else if (!emitter._events[evt].fn) emitter._events[evt].push(listener);else emitter._events[evt] = [emitter._events[evt], listener];
43003 return emitter;
43004}
43005/**
43006 * Clear event by name.
43007 *
43008 * @param {EventEmitter} emitter Reference to the `EventEmitter` instance.
43009 * @param {(String|Symbol)} evt The Event name.
43010 * @private
43011 */
43012
43013
43014function clearEvent(emitter, evt) {
43015 if (--emitter._eventsCount === 0) emitter._events = new Events();else delete emitter._events[evt];
43016}
43017/**
43018 * Minimal `EventEmitter` interface that is molded against the Node.js
43019 * `EventEmitter` interface.
43020 *
43021 * @constructor
43022 * @public
43023 */
43024
43025
43026function EventEmitter() {
43027 this._events = new Events();
43028 this._eventsCount = 0;
43029}
43030/**
43031 * Return an array listing the events for which the emitter has registered
43032 * listeners.
43033 *
43034 * @returns {Array}
43035 * @public
43036 */
43037
43038
43039EventEmitter.prototype.eventNames = function eventNames() {
43040 var names = [],
43041 events,
43042 name;
43043 if (this._eventsCount === 0) return names;
43044
43045 for (name in events = this._events) {
43046 if (has.call(events, name)) names.push(prefix ? (0, _slice.default)(name).call(name, 1) : name);
43047 }
43048
43049 if (_getOwnPropertySymbols.default) {
43050 return (0, _concat.default)(names).call(names, (0, _getOwnPropertySymbols.default)(events));
43051 }
43052
43053 return names;
43054};
43055/**
43056 * Return the listeners registered for a given event.
43057 *
43058 * @param {(String|Symbol)} event The event name.
43059 * @returns {Array} The registered listeners.
43060 * @public
43061 */
43062
43063
43064EventEmitter.prototype.listeners = function listeners(event) {
43065 var evt = prefix ? prefix + event : event,
43066 handlers = this._events[evt];
43067 if (!handlers) return [];
43068 if (handlers.fn) return [handlers.fn];
43069
43070 for (var i = 0, l = handlers.length, ee = new Array(l); i < l; i++) {
43071 ee[i] = handlers[i].fn;
43072 }
43073
43074 return ee;
43075};
43076/**
43077 * Return the number of listeners listening to a given event.
43078 *
43079 * @param {(String|Symbol)} event The event name.
43080 * @returns {Number} The number of listeners.
43081 * @public
43082 */
43083
43084
43085EventEmitter.prototype.listenerCount = function listenerCount(event) {
43086 var evt = prefix ? prefix + event : event,
43087 listeners = this._events[evt];
43088 if (!listeners) return 0;
43089 if (listeners.fn) return 1;
43090 return listeners.length;
43091};
43092/**
43093 * Calls each of the listeners registered for a given event.
43094 *
43095 * @param {(String|Symbol)} event The event name.
43096 * @returns {Boolean} `true` if the event had listeners, else `false`.
43097 * @public
43098 */
43099
43100
43101EventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {
43102 var evt = prefix ? prefix + event : event;
43103 if (!this._events[evt]) return false;
43104 var listeners = this._events[evt],
43105 len = arguments.length,
43106 args,
43107 i;
43108
43109 if (listeners.fn) {
43110 if (listeners.once) this.removeListener(event, listeners.fn, undefined, true);
43111
43112 switch (len) {
43113 case 1:
43114 return listeners.fn.call(listeners.context), true;
43115
43116 case 2:
43117 return listeners.fn.call(listeners.context, a1), true;
43118
43119 case 3:
43120 return listeners.fn.call(listeners.context, a1, a2), true;
43121
43122 case 4:
43123 return listeners.fn.call(listeners.context, a1, a2, a3), true;
43124
43125 case 5:
43126 return listeners.fn.call(listeners.context, a1, a2, a3, a4), true;
43127
43128 case 6:
43129 return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true;
43130 }
43131
43132 for (i = 1, args = new Array(len - 1); i < len; i++) {
43133 args[i - 1] = arguments[i];
43134 }
43135
43136 listeners.fn.apply(listeners.context, args);
43137 } else {
43138 var length = listeners.length,
43139 j;
43140
43141 for (i = 0; i < length; i++) {
43142 if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true);
43143
43144 switch (len) {
43145 case 1:
43146 listeners[i].fn.call(listeners[i].context);
43147 break;
43148
43149 case 2:
43150 listeners[i].fn.call(listeners[i].context, a1);
43151 break;
43152
43153 case 3:
43154 listeners[i].fn.call(listeners[i].context, a1, a2);
43155 break;
43156
43157 case 4:
43158 listeners[i].fn.call(listeners[i].context, a1, a2, a3);
43159 break;
43160
43161 default:
43162 if (!args) for (j = 1, args = new Array(len - 1); j < len; j++) {
43163 args[j - 1] = arguments[j];
43164 }
43165 listeners[i].fn.apply(listeners[i].context, args);
43166 }
43167 }
43168 }
43169
43170 return true;
43171};
43172/**
43173 * Add a listener for a given event.
43174 *
43175 * @param {(String|Symbol)} event The event name.
43176 * @param {Function} fn The listener function.
43177 * @param {*} [context=this] The context to invoke the listener with.
43178 * @returns {EventEmitter} `this`.
43179 * @public
43180 */
43181
43182
43183EventEmitter.prototype.on = function on(event, fn, context) {
43184 return addListener(this, event, fn, context, false);
43185};
43186/**
43187 * Add a one-time listener for a given event.
43188 *
43189 * @param {(String|Symbol)} event The event name.
43190 * @param {Function} fn The listener function.
43191 * @param {*} [context=this] The context to invoke the listener with.
43192 * @returns {EventEmitter} `this`.
43193 * @public
43194 */
43195
43196
43197EventEmitter.prototype.once = function once(event, fn, context) {
43198 return addListener(this, event, fn, context, true);
43199};
43200/**
43201 * Remove the listeners of a given event.
43202 *
43203 * @param {(String|Symbol)} event The event name.
43204 * @param {Function} fn Only remove the listeners that match this function.
43205 * @param {*} context Only remove the listeners that have this context.
43206 * @param {Boolean} once Only remove one-time listeners.
43207 * @returns {EventEmitter} `this`.
43208 * @public
43209 */
43210
43211
43212EventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) {
43213 var evt = prefix ? prefix + event : event;
43214 if (!this._events[evt]) return this;
43215
43216 if (!fn) {
43217 clearEvent(this, evt);
43218 return this;
43219 }
43220
43221 var listeners = this._events[evt];
43222
43223 if (listeners.fn) {
43224 if (listeners.fn === fn && (!once || listeners.once) && (!context || listeners.context === context)) {
43225 clearEvent(this, evt);
43226 }
43227 } else {
43228 for (var i = 0, events = [], length = listeners.length; i < length; i++) {
43229 if (listeners[i].fn !== fn || once && !listeners[i].once || context && listeners[i].context !== context) {
43230 events.push(listeners[i]);
43231 }
43232 } //
43233 // Reset the array, or remove it completely if we have no more listeners.
43234 //
43235
43236
43237 if (events.length) this._events[evt] = events.length === 1 ? events[0] : events;else clearEvent(this, evt);
43238 }
43239
43240 return this;
43241};
43242/**
43243 * Remove all listeners, or those of the specified event.
43244 *
43245 * @param {(String|Symbol)} [event] The event name.
43246 * @returns {EventEmitter} `this`.
43247 * @public
43248 */
43249
43250
43251EventEmitter.prototype.removeAllListeners = function removeAllListeners(event) {
43252 var evt;
43253
43254 if (event) {
43255 evt = prefix ? prefix + event : event;
43256 if (this._events[evt]) clearEvent(this, evt);
43257 } else {
43258 this._events = new Events();
43259 this._eventsCount = 0;
43260 }
43261
43262 return this;
43263}; //
43264// Alias methods names because people roll like that.
43265//
43266
43267
43268EventEmitter.prototype.off = EventEmitter.prototype.removeListener;
43269EventEmitter.prototype.addListener = EventEmitter.prototype.on; //
43270// Expose the prefix.
43271//
43272
43273EventEmitter.prefixed = prefix; //
43274// Allow `EventEmitter` to be imported as module namespace.
43275//
43276
43277EventEmitter.EventEmitter = EventEmitter; //
43278// Expose the module.
43279//
43280
43281if (true) {
43282 module.exports = EventEmitter;
43283}
43284
43285/***/ }),
43286/* 657 */
43287/***/ (function(module, exports, __webpack_require__) {
43288
43289module.exports = __webpack_require__(658);
43290
43291
43292/***/ }),
43293/* 658 */
43294/***/ (function(module, exports, __webpack_require__) {
43295
43296/**
43297 * Copyright (c) 2014-present, Facebook, Inc.
43298 *
43299 * This source code is licensed under the MIT license found in the
43300 * LICENSE file in the root directory of this source tree.
43301 */
43302
43303var runtime = (function (exports) {
43304 "use strict";
43305
43306 var Op = Object.prototype;
43307 var hasOwn = Op.hasOwnProperty;
43308 var undefined; // More compressible than void 0.
43309 var $Symbol = typeof Symbol === "function" ? Symbol : {};
43310 var iteratorSymbol = $Symbol.iterator || "@@iterator";
43311 var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
43312 var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
43313
43314 function define(obj, key, value) {
43315 Object.defineProperty(obj, key, {
43316 value: value,
43317 enumerable: true,
43318 configurable: true,
43319 writable: true
43320 });
43321 return obj[key];
43322 }
43323 try {
43324 // IE 8 has a broken Object.defineProperty that only works on DOM objects.
43325 define({}, "");
43326 } catch (err) {
43327 define = function(obj, key, value) {
43328 return obj[key] = value;
43329 };
43330 }
43331
43332 function wrap(innerFn, outerFn, self, tryLocsList) {
43333 // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.
43334 var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
43335 var generator = Object.create(protoGenerator.prototype);
43336 var context = new Context(tryLocsList || []);
43337
43338 // The ._invoke method unifies the implementations of the .next,
43339 // .throw, and .return methods.
43340 generator._invoke = makeInvokeMethod(innerFn, self, context);
43341
43342 return generator;
43343 }
43344 exports.wrap = wrap;
43345
43346 // Try/catch helper to minimize deoptimizations. Returns a completion
43347 // record like context.tryEntries[i].completion. This interface could
43348 // have been (and was previously) designed to take a closure to be
43349 // invoked without arguments, but in all the cases we care about we
43350 // already have an existing method we want to call, so there's no need
43351 // to create a new function object. We can even get away with assuming
43352 // the method takes exactly one argument, since that happens to be true
43353 // in every case, so we don't have to touch the arguments object. The
43354 // only additional allocation required is the completion record, which
43355 // has a stable shape and so hopefully should be cheap to allocate.
43356 function tryCatch(fn, obj, arg) {
43357 try {
43358 return { type: "normal", arg: fn.call(obj, arg) };
43359 } catch (err) {
43360 return { type: "throw", arg: err };
43361 }
43362 }
43363
43364 var GenStateSuspendedStart = "suspendedStart";
43365 var GenStateSuspendedYield = "suspendedYield";
43366 var GenStateExecuting = "executing";
43367 var GenStateCompleted = "completed";
43368
43369 // Returning this object from the innerFn has the same effect as
43370 // breaking out of the dispatch switch statement.
43371 var ContinueSentinel = {};
43372
43373 // Dummy constructor functions that we use as the .constructor and
43374 // .constructor.prototype properties for functions that return Generator
43375 // objects. For full spec compliance, you may wish to configure your
43376 // minifier not to mangle the names of these two functions.
43377 function Generator() {}
43378 function GeneratorFunction() {}
43379 function GeneratorFunctionPrototype() {}
43380
43381 // This is a polyfill for %IteratorPrototype% for environments that
43382 // don't natively support it.
43383 var IteratorPrototype = {};
43384 IteratorPrototype[iteratorSymbol] = function () {
43385 return this;
43386 };
43387
43388 var getProto = Object.getPrototypeOf;
43389 var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
43390 if (NativeIteratorPrototype &&
43391 NativeIteratorPrototype !== Op &&
43392 hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
43393 // This environment has a native %IteratorPrototype%; use it instead
43394 // of the polyfill.
43395 IteratorPrototype = NativeIteratorPrototype;
43396 }
43397
43398 var Gp = GeneratorFunctionPrototype.prototype =
43399 Generator.prototype = Object.create(IteratorPrototype);
43400 GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;
43401 GeneratorFunctionPrototype.constructor = GeneratorFunction;
43402 GeneratorFunction.displayName = define(
43403 GeneratorFunctionPrototype,
43404 toStringTagSymbol,
43405 "GeneratorFunction"
43406 );
43407
43408 // Helper for defining the .next, .throw, and .return methods of the
43409 // Iterator interface in terms of a single ._invoke method.
43410 function defineIteratorMethods(prototype) {
43411 ["next", "throw", "return"].forEach(function(method) {
43412 define(prototype, method, function(arg) {
43413 return this._invoke(method, arg);
43414 });
43415 });
43416 }
43417
43418 exports.isGeneratorFunction = function(genFun) {
43419 var ctor = typeof genFun === "function" && genFun.constructor;
43420 return ctor
43421 ? ctor === GeneratorFunction ||
43422 // For the native GeneratorFunction constructor, the best we can
43423 // do is to check its .name property.
43424 (ctor.displayName || ctor.name) === "GeneratorFunction"
43425 : false;
43426 };
43427
43428 exports.mark = function(genFun) {
43429 if (Object.setPrototypeOf) {
43430 Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
43431 } else {
43432 genFun.__proto__ = GeneratorFunctionPrototype;
43433 define(genFun, toStringTagSymbol, "GeneratorFunction");
43434 }
43435 genFun.prototype = Object.create(Gp);
43436 return genFun;
43437 };
43438
43439 // Within the body of any async function, `await x` is transformed to
43440 // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
43441 // `hasOwn.call(value, "__await")` to determine if the yielded value is
43442 // meant to be awaited.
43443 exports.awrap = function(arg) {
43444 return { __await: arg };
43445 };
43446
43447 function AsyncIterator(generator, PromiseImpl) {
43448 function invoke(method, arg, resolve, reject) {
43449 var record = tryCatch(generator[method], generator, arg);
43450 if (record.type === "throw") {
43451 reject(record.arg);
43452 } else {
43453 var result = record.arg;
43454 var value = result.value;
43455 if (value &&
43456 typeof value === "object" &&
43457 hasOwn.call(value, "__await")) {
43458 return PromiseImpl.resolve(value.__await).then(function(value) {
43459 invoke("next", value, resolve, reject);
43460 }, function(err) {
43461 invoke("throw", err, resolve, reject);
43462 });
43463 }
43464
43465 return PromiseImpl.resolve(value).then(function(unwrapped) {
43466 // When a yielded Promise is resolved, its final value becomes
43467 // the .value of the Promise<{value,done}> result for the
43468 // current iteration.
43469 result.value = unwrapped;
43470 resolve(result);
43471 }, function(error) {
43472 // If a rejected Promise was yielded, throw the rejection back
43473 // into the async generator function so it can be handled there.
43474 return invoke("throw", error, resolve, reject);
43475 });
43476 }
43477 }
43478
43479 var previousPromise;
43480
43481 function enqueue(method, arg) {
43482 function callInvokeWithMethodAndArg() {
43483 return new PromiseImpl(function(resolve, reject) {
43484 invoke(method, arg, resolve, reject);
43485 });
43486 }
43487
43488 return previousPromise =
43489 // If enqueue has been called before, then we want to wait until
43490 // all previous Promises have been resolved before calling invoke,
43491 // so that results are always delivered in the correct order. If
43492 // enqueue has not been called before, then it is important to
43493 // call invoke immediately, without waiting on a callback to fire,
43494 // so that the async generator function has the opportunity to do
43495 // any necessary setup in a predictable way. This predictability
43496 // is why the Promise constructor synchronously invokes its
43497 // executor callback, and why async functions synchronously
43498 // execute code before the first await. Since we implement simple
43499 // async functions in terms of async generators, it is especially
43500 // important to get this right, even though it requires care.
43501 previousPromise ? previousPromise.then(
43502 callInvokeWithMethodAndArg,
43503 // Avoid propagating failures to Promises returned by later
43504 // invocations of the iterator.
43505 callInvokeWithMethodAndArg
43506 ) : callInvokeWithMethodAndArg();
43507 }
43508
43509 // Define the unified helper method that is used to implement .next,
43510 // .throw, and .return (see defineIteratorMethods).
43511 this._invoke = enqueue;
43512 }
43513
43514 defineIteratorMethods(AsyncIterator.prototype);
43515 AsyncIterator.prototype[asyncIteratorSymbol] = function () {
43516 return this;
43517 };
43518 exports.AsyncIterator = AsyncIterator;
43519
43520 // Note that simple async functions are implemented on top of
43521 // AsyncIterator objects; they just return a Promise for the value of
43522 // the final result produced by the iterator.
43523 exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) {
43524 if (PromiseImpl === void 0) PromiseImpl = Promise;
43525
43526 var iter = new AsyncIterator(
43527 wrap(innerFn, outerFn, self, tryLocsList),
43528 PromiseImpl
43529 );
43530
43531 return exports.isGeneratorFunction(outerFn)
43532 ? iter // If outerFn is a generator, return the full iterator.
43533 : iter.next().then(function(result) {
43534 return result.done ? result.value : iter.next();
43535 });
43536 };
43537
43538 function makeInvokeMethod(innerFn, self, context) {
43539 var state = GenStateSuspendedStart;
43540
43541 return function invoke(method, arg) {
43542 if (state === GenStateExecuting) {
43543 throw new Error("Generator is already running");
43544 }
43545
43546 if (state === GenStateCompleted) {
43547 if (method === "throw") {
43548 throw arg;
43549 }
43550
43551 // Be forgiving, per 25.3.3.3.3 of the spec:
43552 // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
43553 return doneResult();
43554 }
43555
43556 context.method = method;
43557 context.arg = arg;
43558
43559 while (true) {
43560 var delegate = context.delegate;
43561 if (delegate) {
43562 var delegateResult = maybeInvokeDelegate(delegate, context);
43563 if (delegateResult) {
43564 if (delegateResult === ContinueSentinel) continue;
43565 return delegateResult;
43566 }
43567 }
43568
43569 if (context.method === "next") {
43570 // Setting context._sent for legacy support of Babel's
43571 // function.sent implementation.
43572 context.sent = context._sent = context.arg;
43573
43574 } else if (context.method === "throw") {
43575 if (state === GenStateSuspendedStart) {
43576 state = GenStateCompleted;
43577 throw context.arg;
43578 }
43579
43580 context.dispatchException(context.arg);
43581
43582 } else if (context.method === "return") {
43583 context.abrupt("return", context.arg);
43584 }
43585
43586 state = GenStateExecuting;
43587
43588 var record = tryCatch(innerFn, self, context);
43589 if (record.type === "normal") {
43590 // If an exception is thrown from innerFn, we leave state ===
43591 // GenStateExecuting and loop back for another invocation.
43592 state = context.done
43593 ? GenStateCompleted
43594 : GenStateSuspendedYield;
43595
43596 if (record.arg === ContinueSentinel) {
43597 continue;
43598 }
43599
43600 return {
43601 value: record.arg,
43602 done: context.done
43603 };
43604
43605 } else if (record.type === "throw") {
43606 state = GenStateCompleted;
43607 // Dispatch the exception by looping back around to the
43608 // context.dispatchException(context.arg) call above.
43609 context.method = "throw";
43610 context.arg = record.arg;
43611 }
43612 }
43613 };
43614 }
43615
43616 // Call delegate.iterator[context.method](context.arg) and handle the
43617 // result, either by returning a { value, done } result from the
43618 // delegate iterator, or by modifying context.method and context.arg,
43619 // setting context.delegate to null, and returning the ContinueSentinel.
43620 function maybeInvokeDelegate(delegate, context) {
43621 var method = delegate.iterator[context.method];
43622 if (method === undefined) {
43623 // A .throw or .return when the delegate iterator has no .throw
43624 // method always terminates the yield* loop.
43625 context.delegate = null;
43626
43627 if (context.method === "throw") {
43628 // Note: ["return"] must be used for ES3 parsing compatibility.
43629 if (delegate.iterator["return"]) {
43630 // If the delegate iterator has a return method, give it a
43631 // chance to clean up.
43632 context.method = "return";
43633 context.arg = undefined;
43634 maybeInvokeDelegate(delegate, context);
43635
43636 if (context.method === "throw") {
43637 // If maybeInvokeDelegate(context) changed context.method from
43638 // "return" to "throw", let that override the TypeError below.
43639 return ContinueSentinel;
43640 }
43641 }
43642
43643 context.method = "throw";
43644 context.arg = new TypeError(
43645 "The iterator does not provide a 'throw' method");
43646 }
43647
43648 return ContinueSentinel;
43649 }
43650
43651 var record = tryCatch(method, delegate.iterator, context.arg);
43652
43653 if (record.type === "throw") {
43654 context.method = "throw";
43655 context.arg = record.arg;
43656 context.delegate = null;
43657 return ContinueSentinel;
43658 }
43659
43660 var info = record.arg;
43661
43662 if (! info) {
43663 context.method = "throw";
43664 context.arg = new TypeError("iterator result is not an object");
43665 context.delegate = null;
43666 return ContinueSentinel;
43667 }
43668
43669 if (info.done) {
43670 // Assign the result of the finished delegate to the temporary
43671 // variable specified by delegate.resultName (see delegateYield).
43672 context[delegate.resultName] = info.value;
43673
43674 // Resume execution at the desired location (see delegateYield).
43675 context.next = delegate.nextLoc;
43676
43677 // If context.method was "throw" but the delegate handled the
43678 // exception, let the outer generator proceed normally. If
43679 // context.method was "next", forget context.arg since it has been
43680 // "consumed" by the delegate iterator. If context.method was
43681 // "return", allow the original .return call to continue in the
43682 // outer generator.
43683 if (context.method !== "return") {
43684 context.method = "next";
43685 context.arg = undefined;
43686 }
43687
43688 } else {
43689 // Re-yield the result returned by the delegate method.
43690 return info;
43691 }
43692
43693 // The delegate iterator is finished, so forget it and continue with
43694 // the outer generator.
43695 context.delegate = null;
43696 return ContinueSentinel;
43697 }
43698
43699 // Define Generator.prototype.{next,throw,return} in terms of the
43700 // unified ._invoke helper method.
43701 defineIteratorMethods(Gp);
43702
43703 define(Gp, toStringTagSymbol, "Generator");
43704
43705 // A Generator should always return itself as the iterator object when the
43706 // @@iterator function is called on it. Some browsers' implementations of the
43707 // iterator prototype chain incorrectly implement this, causing the Generator
43708 // object to not be returned from this call. This ensures that doesn't happen.
43709 // See https://github.com/facebook/regenerator/issues/274 for more details.
43710 Gp[iteratorSymbol] = function() {
43711 return this;
43712 };
43713
43714 Gp.toString = function() {
43715 return "[object Generator]";
43716 };
43717
43718 function pushTryEntry(locs) {
43719 var entry = { tryLoc: locs[0] };
43720
43721 if (1 in locs) {
43722 entry.catchLoc = locs[1];
43723 }
43724
43725 if (2 in locs) {
43726 entry.finallyLoc = locs[2];
43727 entry.afterLoc = locs[3];
43728 }
43729
43730 this.tryEntries.push(entry);
43731 }
43732
43733 function resetTryEntry(entry) {
43734 var record = entry.completion || {};
43735 record.type = "normal";
43736 delete record.arg;
43737 entry.completion = record;
43738 }
43739
43740 function Context(tryLocsList) {
43741 // The root entry object (effectively a try statement without a catch
43742 // or a finally block) gives us a place to store values thrown from
43743 // locations where there is no enclosing try statement.
43744 this.tryEntries = [{ tryLoc: "root" }];
43745 tryLocsList.forEach(pushTryEntry, this);
43746 this.reset(true);
43747 }
43748
43749 exports.keys = function(object) {
43750 var keys = [];
43751 for (var key in object) {
43752 keys.push(key);
43753 }
43754 keys.reverse();
43755
43756 // Rather than returning an object with a next method, we keep
43757 // things simple and return the next function itself.
43758 return function next() {
43759 while (keys.length) {
43760 var key = keys.pop();
43761 if (key in object) {
43762 next.value = key;
43763 next.done = false;
43764 return next;
43765 }
43766 }
43767
43768 // To avoid creating an additional object, we just hang the .value
43769 // and .done properties off the next function object itself. This
43770 // also ensures that the minifier will not anonymize the function.
43771 next.done = true;
43772 return next;
43773 };
43774 };
43775
43776 function values(iterable) {
43777 if (iterable) {
43778 var iteratorMethod = iterable[iteratorSymbol];
43779 if (iteratorMethod) {
43780 return iteratorMethod.call(iterable);
43781 }
43782
43783 if (typeof iterable.next === "function") {
43784 return iterable;
43785 }
43786
43787 if (!isNaN(iterable.length)) {
43788 var i = -1, next = function next() {
43789 while (++i < iterable.length) {
43790 if (hasOwn.call(iterable, i)) {
43791 next.value = iterable[i];
43792 next.done = false;
43793 return next;
43794 }
43795 }
43796
43797 next.value = undefined;
43798 next.done = true;
43799
43800 return next;
43801 };
43802
43803 return next.next = next;
43804 }
43805 }
43806
43807 // Return an iterator with no values.
43808 return { next: doneResult };
43809 }
43810 exports.values = values;
43811
43812 function doneResult() {
43813 return { value: undefined, done: true };
43814 }
43815
43816 Context.prototype = {
43817 constructor: Context,
43818
43819 reset: function(skipTempReset) {
43820 this.prev = 0;
43821 this.next = 0;
43822 // Resetting context._sent for legacy support of Babel's
43823 // function.sent implementation.
43824 this.sent = this._sent = undefined;
43825 this.done = false;
43826 this.delegate = null;
43827
43828 this.method = "next";
43829 this.arg = undefined;
43830
43831 this.tryEntries.forEach(resetTryEntry);
43832
43833 if (!skipTempReset) {
43834 for (var name in this) {
43835 // Not sure about the optimal order of these conditions:
43836 if (name.charAt(0) === "t" &&
43837 hasOwn.call(this, name) &&
43838 !isNaN(+name.slice(1))) {
43839 this[name] = undefined;
43840 }
43841 }
43842 }
43843 },
43844
43845 stop: function() {
43846 this.done = true;
43847
43848 var rootEntry = this.tryEntries[0];
43849 var rootRecord = rootEntry.completion;
43850 if (rootRecord.type === "throw") {
43851 throw rootRecord.arg;
43852 }
43853
43854 return this.rval;
43855 },
43856
43857 dispatchException: function(exception) {
43858 if (this.done) {
43859 throw exception;
43860 }
43861
43862 var context = this;
43863 function handle(loc, caught) {
43864 record.type = "throw";
43865 record.arg = exception;
43866 context.next = loc;
43867
43868 if (caught) {
43869 // If the dispatched exception was caught by a catch block,
43870 // then let that catch block handle the exception normally.
43871 context.method = "next";
43872 context.arg = undefined;
43873 }
43874
43875 return !! caught;
43876 }
43877
43878 for (var i = this.tryEntries.length - 1; i >= 0; --i) {
43879 var entry = this.tryEntries[i];
43880 var record = entry.completion;
43881
43882 if (entry.tryLoc === "root") {
43883 // Exception thrown outside of any try block that could handle
43884 // it, so set the completion value of the entire function to
43885 // throw the exception.
43886 return handle("end");
43887 }
43888
43889 if (entry.tryLoc <= this.prev) {
43890 var hasCatch = hasOwn.call(entry, "catchLoc");
43891 var hasFinally = hasOwn.call(entry, "finallyLoc");
43892
43893 if (hasCatch && hasFinally) {
43894 if (this.prev < entry.catchLoc) {
43895 return handle(entry.catchLoc, true);
43896 } else if (this.prev < entry.finallyLoc) {
43897 return handle(entry.finallyLoc);
43898 }
43899
43900 } else if (hasCatch) {
43901 if (this.prev < entry.catchLoc) {
43902 return handle(entry.catchLoc, true);
43903 }
43904
43905 } else if (hasFinally) {
43906 if (this.prev < entry.finallyLoc) {
43907 return handle(entry.finallyLoc);
43908 }
43909
43910 } else {
43911 throw new Error("try statement without catch or finally");
43912 }
43913 }
43914 }
43915 },
43916
43917 abrupt: function(type, arg) {
43918 for (var i = this.tryEntries.length - 1; i >= 0; --i) {
43919 var entry = this.tryEntries[i];
43920 if (entry.tryLoc <= this.prev &&
43921 hasOwn.call(entry, "finallyLoc") &&
43922 this.prev < entry.finallyLoc) {
43923 var finallyEntry = entry;
43924 break;
43925 }
43926 }
43927
43928 if (finallyEntry &&
43929 (type === "break" ||
43930 type === "continue") &&
43931 finallyEntry.tryLoc <= arg &&
43932 arg <= finallyEntry.finallyLoc) {
43933 // Ignore the finally entry if control is not jumping to a
43934 // location outside the try/catch block.
43935 finallyEntry = null;
43936 }
43937
43938 var record = finallyEntry ? finallyEntry.completion : {};
43939 record.type = type;
43940 record.arg = arg;
43941
43942 if (finallyEntry) {
43943 this.method = "next";
43944 this.next = finallyEntry.finallyLoc;
43945 return ContinueSentinel;
43946 }
43947
43948 return this.complete(record);
43949 },
43950
43951 complete: function(record, afterLoc) {
43952 if (record.type === "throw") {
43953 throw record.arg;
43954 }
43955
43956 if (record.type === "break" ||
43957 record.type === "continue") {
43958 this.next = record.arg;
43959 } else if (record.type === "return") {
43960 this.rval = this.arg = record.arg;
43961 this.method = "return";
43962 this.next = "end";
43963 } else if (record.type === "normal" && afterLoc) {
43964 this.next = afterLoc;
43965 }
43966
43967 return ContinueSentinel;
43968 },
43969
43970 finish: function(finallyLoc) {
43971 for (var i = this.tryEntries.length - 1; i >= 0; --i) {
43972 var entry = this.tryEntries[i];
43973 if (entry.finallyLoc === finallyLoc) {
43974 this.complete(entry.completion, entry.afterLoc);
43975 resetTryEntry(entry);
43976 return ContinueSentinel;
43977 }
43978 }
43979 },
43980
43981 "catch": function(tryLoc) {
43982 for (var i = this.tryEntries.length - 1; i >= 0; --i) {
43983 var entry = this.tryEntries[i];
43984 if (entry.tryLoc === tryLoc) {
43985 var record = entry.completion;
43986 if (record.type === "throw") {
43987 var thrown = record.arg;
43988 resetTryEntry(entry);
43989 }
43990 return thrown;
43991 }
43992 }
43993
43994 // The context.catch method must only be called with a location
43995 // argument that corresponds to a known catch block.
43996 throw new Error("illegal catch attempt");
43997 },
43998
43999 delegateYield: function(iterable, resultName, nextLoc) {
44000 this.delegate = {
44001 iterator: values(iterable),
44002 resultName: resultName,
44003 nextLoc: nextLoc
44004 };
44005
44006 if (this.method === "next") {
44007 // Deliberately forget the last sent value so that we don't
44008 // accidentally pass it on to the delegate.
44009 this.arg = undefined;
44010 }
44011
44012 return ContinueSentinel;
44013 }
44014 };
44015
44016 // Regardless of whether this script is executing as a CommonJS module
44017 // or not, return the runtime object so that we can declare the variable
44018 // regeneratorRuntime in the outer scope, which allows this module to be
44019 // injected easily by `bin/regenerator --include-runtime script.js`.
44020 return exports;
44021
44022}(
44023 // If this script is executing as a CommonJS module, use module.exports
44024 // as the regeneratorRuntime namespace. Otherwise create a new empty
44025 // object. Either way, the resulting object will be used to initialize
44026 // the regeneratorRuntime variable at the top of this file.
44027 true ? module.exports : {}
44028));
44029
44030try {
44031 regeneratorRuntime = runtime;
44032} catch (accidentalStrictMode) {
44033 // This module should not be running in strict mode, so the above
44034 // assignment should always work unless something is misconfigured. Just
44035 // in case runtime.js accidentally runs in strict mode, we can escape
44036 // strict mode using a global Function call. This could conceivably fail
44037 // if a Content Security Policy forbids using Function, but in that case
44038 // the proper solution is to fix the accidental strict mode problem. If
44039 // you've misconfigured your bundler to force strict mode and applied a
44040 // CSP to forbid Function, and you're not willing to fix either of those
44041 // problems, please detail your unique predicament in a GitHub issue.
44042 Function("r", "regeneratorRuntime = r")(runtime);
44043}
44044
44045
44046/***/ }),
44047/* 659 */
44048/***/ (function(module, exports) {
44049
44050function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
44051 try {
44052 var info = gen[key](arg);
44053 var value = info.value;
44054 } catch (error) {
44055 reject(error);
44056 return;
44057 }
44058
44059 if (info.done) {
44060 resolve(value);
44061 } else {
44062 Promise.resolve(value).then(_next, _throw);
44063 }
44064}
44065
44066function _asyncToGenerator(fn) {
44067 return function () {
44068 var self = this,
44069 args = arguments;
44070 return new Promise(function (resolve, reject) {
44071 var gen = fn.apply(self, args);
44072
44073 function _next(value) {
44074 asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
44075 }
44076
44077 function _throw(err) {
44078 asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
44079 }
44080
44081 _next(undefined);
44082 });
44083 };
44084}
44085
44086module.exports = _asyncToGenerator;
44087
44088/***/ }),
44089/* 660 */
44090/***/ (function(module, exports, __webpack_require__) {
44091
44092var arrayWithoutHoles = __webpack_require__(661);
44093
44094var iterableToArray = __webpack_require__(270);
44095
44096var unsupportedIterableToArray = __webpack_require__(271);
44097
44098var nonIterableSpread = __webpack_require__(662);
44099
44100function _toConsumableArray(arr) {
44101 return arrayWithoutHoles(arr) || iterableToArray(arr) || unsupportedIterableToArray(arr) || nonIterableSpread();
44102}
44103
44104module.exports = _toConsumableArray;
44105
44106/***/ }),
44107/* 661 */
44108/***/ (function(module, exports, __webpack_require__) {
44109
44110var arrayLikeToArray = __webpack_require__(269);
44111
44112function _arrayWithoutHoles(arr) {
44113 if (Array.isArray(arr)) return arrayLikeToArray(arr);
44114}
44115
44116module.exports = _arrayWithoutHoles;
44117
44118/***/ }),
44119/* 662 */
44120/***/ (function(module, exports) {
44121
44122function _nonIterableSpread() {
44123 throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
44124}
44125
44126module.exports = _nonIterableSpread;
44127
44128/***/ }),
44129/* 663 */
44130/***/ (function(module, exports) {
44131
44132function _defineProperty(obj, key, value) {
44133 if (key in obj) {
44134 Object.defineProperty(obj, key, {
44135 value: value,
44136 enumerable: true,
44137 configurable: true,
44138 writable: true
44139 });
44140 } else {
44141 obj[key] = value;
44142 }
44143
44144 return obj;
44145}
44146
44147module.exports = _defineProperty;
44148
44149/***/ }),
44150/* 664 */
44151/***/ (function(module, exports, __webpack_require__) {
44152
44153var objectWithoutPropertiesLoose = __webpack_require__(665);
44154
44155function _objectWithoutProperties(source, excluded) {
44156 if (source == null) return {};
44157 var target = objectWithoutPropertiesLoose(source, excluded);
44158 var key, i;
44159
44160 if (Object.getOwnPropertySymbols) {
44161 var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
44162
44163 for (i = 0; i < sourceSymbolKeys.length; i++) {
44164 key = sourceSymbolKeys[i];
44165 if (excluded.indexOf(key) >= 0) continue;
44166 if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
44167 target[key] = source[key];
44168 }
44169 }
44170
44171 return target;
44172}
44173
44174module.exports = _objectWithoutProperties;
44175
44176/***/ }),
44177/* 665 */
44178/***/ (function(module, exports) {
44179
44180function _objectWithoutPropertiesLoose(source, excluded) {
44181 if (source == null) return {};
44182 var target = {};
44183 var sourceKeys = Object.keys(source);
44184 var key, i;
44185
44186 for (i = 0; i < sourceKeys.length; i++) {
44187 key = sourceKeys[i];
44188 if (excluded.indexOf(key) >= 0) continue;
44189 target[key] = source[key];
44190 }
44191
44192 return target;
44193}
44194
44195module.exports = _objectWithoutPropertiesLoose;
44196
44197/***/ }),
44198/* 666 */
44199/***/ (function(module, exports) {
44200
44201function _assertThisInitialized(self) {
44202 if (self === void 0) {
44203 throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
44204 }
44205
44206 return self;
44207}
44208
44209module.exports = _assertThisInitialized;
44210
44211/***/ }),
44212/* 667 */
44213/***/ (function(module, exports) {
44214
44215function _inheritsLoose(subClass, superClass) {
44216 subClass.prototype = Object.create(superClass.prototype);
44217 subClass.prototype.constructor = subClass;
44218 subClass.__proto__ = superClass;
44219}
44220
44221module.exports = _inheritsLoose;
44222
44223/***/ }),
44224/* 668 */
44225/***/ (function(module, exports, __webpack_require__) {
44226
44227var arrayShuffle = __webpack_require__(669),
44228 baseShuffle = __webpack_require__(672),
44229 isArray = __webpack_require__(277);
44230
44231/**
44232 * Creates an array of shuffled values, using a version of the
44233 * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle).
44234 *
44235 * @static
44236 * @memberOf _
44237 * @since 0.1.0
44238 * @category Collection
44239 * @param {Array|Object} collection The collection to shuffle.
44240 * @returns {Array} Returns the new shuffled array.
44241 * @example
44242 *
44243 * _.shuffle([1, 2, 3, 4]);
44244 * // => [4, 1, 3, 2]
44245 */
44246function shuffle(collection) {
44247 var func = isArray(collection) ? arrayShuffle : baseShuffle;
44248 return func(collection);
44249}
44250
44251module.exports = shuffle;
44252
44253
44254/***/ }),
44255/* 669 */
44256/***/ (function(module, exports, __webpack_require__) {
44257
44258var copyArray = __webpack_require__(670),
44259 shuffleSelf = __webpack_require__(272);
44260
44261/**
44262 * A specialized version of `_.shuffle` for arrays.
44263 *
44264 * @private
44265 * @param {Array} array The array to shuffle.
44266 * @returns {Array} Returns the new shuffled array.
44267 */
44268function arrayShuffle(array) {
44269 return shuffleSelf(copyArray(array));
44270}
44271
44272module.exports = arrayShuffle;
44273
44274
44275/***/ }),
44276/* 670 */
44277/***/ (function(module, exports) {
44278
44279/**
44280 * Copies the values of `source` to `array`.
44281 *
44282 * @private
44283 * @param {Array} source The array to copy values from.
44284 * @param {Array} [array=[]] The array to copy values to.
44285 * @returns {Array} Returns `array`.
44286 */
44287function copyArray(source, array) {
44288 var index = -1,
44289 length = source.length;
44290
44291 array || (array = Array(length));
44292 while (++index < length) {
44293 array[index] = source[index];
44294 }
44295 return array;
44296}
44297
44298module.exports = copyArray;
44299
44300
44301/***/ }),
44302/* 671 */
44303/***/ (function(module, exports) {
44304
44305/* Built-in method references for those with the same name as other `lodash` methods. */
44306var nativeFloor = Math.floor,
44307 nativeRandom = Math.random;
44308
44309/**
44310 * The base implementation of `_.random` without support for returning
44311 * floating-point numbers.
44312 *
44313 * @private
44314 * @param {number} lower The lower bound.
44315 * @param {number} upper The upper bound.
44316 * @returns {number} Returns the random number.
44317 */
44318function baseRandom(lower, upper) {
44319 return lower + nativeFloor(nativeRandom() * (upper - lower + 1));
44320}
44321
44322module.exports = baseRandom;
44323
44324
44325/***/ }),
44326/* 672 */
44327/***/ (function(module, exports, __webpack_require__) {
44328
44329var shuffleSelf = __webpack_require__(272),
44330 values = __webpack_require__(273);
44331
44332/**
44333 * The base implementation of `_.shuffle`.
44334 *
44335 * @private
44336 * @param {Array|Object} collection The collection to shuffle.
44337 * @returns {Array} Returns the new shuffled array.
44338 */
44339function baseShuffle(collection) {
44340 return shuffleSelf(values(collection));
44341}
44342
44343module.exports = baseShuffle;
44344
44345
44346/***/ }),
44347/* 673 */
44348/***/ (function(module, exports, __webpack_require__) {
44349
44350var arrayMap = __webpack_require__(674);
44351
44352/**
44353 * The base implementation of `_.values` and `_.valuesIn` which creates an
44354 * array of `object` property values corresponding to the property names
44355 * of `props`.
44356 *
44357 * @private
44358 * @param {Object} object The object to query.
44359 * @param {Array} props The property names to get values for.
44360 * @returns {Object} Returns the array of property values.
44361 */
44362function baseValues(object, props) {
44363 return arrayMap(props, function(key) {
44364 return object[key];
44365 });
44366}
44367
44368module.exports = baseValues;
44369
44370
44371/***/ }),
44372/* 674 */
44373/***/ (function(module, exports) {
44374
44375/**
44376 * A specialized version of `_.map` for arrays without support for iteratee
44377 * shorthands.
44378 *
44379 * @private
44380 * @param {Array} [array] The array to iterate over.
44381 * @param {Function} iteratee The function invoked per iteration.
44382 * @returns {Array} Returns the new mapped array.
44383 */
44384function arrayMap(array, iteratee) {
44385 var index = -1,
44386 length = array == null ? 0 : array.length,
44387 result = Array(length);
44388
44389 while (++index < length) {
44390 result[index] = iteratee(array[index], index, array);
44391 }
44392 return result;
44393}
44394
44395module.exports = arrayMap;
44396
44397
44398/***/ }),
44399/* 675 */
44400/***/ (function(module, exports, __webpack_require__) {
44401
44402var arrayLikeKeys = __webpack_require__(676),
44403 baseKeys = __webpack_require__(689),
44404 isArrayLike = __webpack_require__(692);
44405
44406/**
44407 * Creates an array of the own enumerable property names of `object`.
44408 *
44409 * **Note:** Non-object values are coerced to objects. See the
44410 * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
44411 * for more details.
44412 *
44413 * @static
44414 * @since 0.1.0
44415 * @memberOf _
44416 * @category Object
44417 * @param {Object} object The object to query.
44418 * @returns {Array} Returns the array of property names.
44419 * @example
44420 *
44421 * function Foo() {
44422 * this.a = 1;
44423 * this.b = 2;
44424 * }
44425 *
44426 * Foo.prototype.c = 3;
44427 *
44428 * _.keys(new Foo);
44429 * // => ['a', 'b'] (iteration order is not guaranteed)
44430 *
44431 * _.keys('hi');
44432 * // => ['0', '1']
44433 */
44434function keys(object) {
44435 return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
44436}
44437
44438module.exports = keys;
44439
44440
44441/***/ }),
44442/* 676 */
44443/***/ (function(module, exports, __webpack_require__) {
44444
44445var baseTimes = __webpack_require__(677),
44446 isArguments = __webpack_require__(678),
44447 isArray = __webpack_require__(277),
44448 isBuffer = __webpack_require__(682),
44449 isIndex = __webpack_require__(684),
44450 isTypedArray = __webpack_require__(685);
44451
44452/** Used for built-in method references. */
44453var objectProto = Object.prototype;
44454
44455/** Used to check objects for own properties. */
44456var hasOwnProperty = objectProto.hasOwnProperty;
44457
44458/**
44459 * Creates an array of the enumerable property names of the array-like `value`.
44460 *
44461 * @private
44462 * @param {*} value The value to query.
44463 * @param {boolean} inherited Specify returning inherited property names.
44464 * @returns {Array} Returns the array of property names.
44465 */
44466function arrayLikeKeys(value, inherited) {
44467 var isArr = isArray(value),
44468 isArg = !isArr && isArguments(value),
44469 isBuff = !isArr && !isArg && isBuffer(value),
44470 isType = !isArr && !isArg && !isBuff && isTypedArray(value),
44471 skipIndexes = isArr || isArg || isBuff || isType,
44472 result = skipIndexes ? baseTimes(value.length, String) : [],
44473 length = result.length;
44474
44475 for (var key in value) {
44476 if ((inherited || hasOwnProperty.call(value, key)) &&
44477 !(skipIndexes && (
44478 // Safari 9 has enumerable `arguments.length` in strict mode.
44479 key == 'length' ||
44480 // Node.js 0.10 has enumerable non-index properties on buffers.
44481 (isBuff && (key == 'offset' || key == 'parent')) ||
44482 // PhantomJS 2 has enumerable non-index properties on typed arrays.
44483 (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
44484 // Skip index properties.
44485 isIndex(key, length)
44486 ))) {
44487 result.push(key);
44488 }
44489 }
44490 return result;
44491}
44492
44493module.exports = arrayLikeKeys;
44494
44495
44496/***/ }),
44497/* 677 */
44498/***/ (function(module, exports) {
44499
44500/**
44501 * The base implementation of `_.times` without support for iteratee shorthands
44502 * or max array length checks.
44503 *
44504 * @private
44505 * @param {number} n The number of times to invoke `iteratee`.
44506 * @param {Function} iteratee The function invoked per iteration.
44507 * @returns {Array} Returns the array of results.
44508 */
44509function baseTimes(n, iteratee) {
44510 var index = -1,
44511 result = Array(n);
44512
44513 while (++index < n) {
44514 result[index] = iteratee(index);
44515 }
44516 return result;
44517}
44518
44519module.exports = baseTimes;
44520
44521
44522/***/ }),
44523/* 678 */
44524/***/ (function(module, exports, __webpack_require__) {
44525
44526var baseIsArguments = __webpack_require__(679),
44527 isObjectLike = __webpack_require__(120);
44528
44529/** Used for built-in method references. */
44530var objectProto = Object.prototype;
44531
44532/** Used to check objects for own properties. */
44533var hasOwnProperty = objectProto.hasOwnProperty;
44534
44535/** Built-in value references. */
44536var propertyIsEnumerable = objectProto.propertyIsEnumerable;
44537
44538/**
44539 * Checks if `value` is likely an `arguments` object.
44540 *
44541 * @static
44542 * @memberOf _
44543 * @since 0.1.0
44544 * @category Lang
44545 * @param {*} value The value to check.
44546 * @returns {boolean} Returns `true` if `value` is an `arguments` object,
44547 * else `false`.
44548 * @example
44549 *
44550 * _.isArguments(function() { return arguments; }());
44551 * // => true
44552 *
44553 * _.isArguments([1, 2, 3]);
44554 * // => false
44555 */
44556var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
44557 return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&
44558 !propertyIsEnumerable.call(value, 'callee');
44559};
44560
44561module.exports = isArguments;
44562
44563
44564/***/ }),
44565/* 679 */
44566/***/ (function(module, exports, __webpack_require__) {
44567
44568var baseGetTag = __webpack_require__(119),
44569 isObjectLike = __webpack_require__(120);
44570
44571/** `Object#toString` result references. */
44572var argsTag = '[object Arguments]';
44573
44574/**
44575 * The base implementation of `_.isArguments`.
44576 *
44577 * @private
44578 * @param {*} value The value to check.
44579 * @returns {boolean} Returns `true` if `value` is an `arguments` object,
44580 */
44581function baseIsArguments(value) {
44582 return isObjectLike(value) && baseGetTag(value) == argsTag;
44583}
44584
44585module.exports = baseIsArguments;
44586
44587
44588/***/ }),
44589/* 680 */
44590/***/ (function(module, exports, __webpack_require__) {
44591
44592var Symbol = __webpack_require__(274);
44593
44594/** Used for built-in method references. */
44595var objectProto = Object.prototype;
44596
44597/** Used to check objects for own properties. */
44598var hasOwnProperty = objectProto.hasOwnProperty;
44599
44600/**
44601 * Used to resolve the
44602 * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
44603 * of values.
44604 */
44605var nativeObjectToString = objectProto.toString;
44606
44607/** Built-in value references. */
44608var symToStringTag = Symbol ? Symbol.toStringTag : undefined;
44609
44610/**
44611 * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
44612 *
44613 * @private
44614 * @param {*} value The value to query.
44615 * @returns {string} Returns the raw `toStringTag`.
44616 */
44617function getRawTag(value) {
44618 var isOwn = hasOwnProperty.call(value, symToStringTag),
44619 tag = value[symToStringTag];
44620
44621 try {
44622 value[symToStringTag] = undefined;
44623 var unmasked = true;
44624 } catch (e) {}
44625
44626 var result = nativeObjectToString.call(value);
44627 if (unmasked) {
44628 if (isOwn) {
44629 value[symToStringTag] = tag;
44630 } else {
44631 delete value[symToStringTag];
44632 }
44633 }
44634 return result;
44635}
44636
44637module.exports = getRawTag;
44638
44639
44640/***/ }),
44641/* 681 */
44642/***/ (function(module, exports) {
44643
44644/** Used for built-in method references. */
44645var objectProto = Object.prototype;
44646
44647/**
44648 * Used to resolve the
44649 * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
44650 * of values.
44651 */
44652var nativeObjectToString = objectProto.toString;
44653
44654/**
44655 * Converts `value` to a string using `Object.prototype.toString`.
44656 *
44657 * @private
44658 * @param {*} value The value to convert.
44659 * @returns {string} Returns the converted string.
44660 */
44661function objectToString(value) {
44662 return nativeObjectToString.call(value);
44663}
44664
44665module.exports = objectToString;
44666
44667
44668/***/ }),
44669/* 682 */
44670/***/ (function(module, exports, __webpack_require__) {
44671
44672/* WEBPACK VAR INJECTION */(function(module) {var root = __webpack_require__(275),
44673 stubFalse = __webpack_require__(683);
44674
44675/** Detect free variable `exports`. */
44676var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;
44677
44678/** Detect free variable `module`. */
44679var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
44680
44681/** Detect the popular CommonJS extension `module.exports`. */
44682var moduleExports = freeModule && freeModule.exports === freeExports;
44683
44684/** Built-in value references. */
44685var Buffer = moduleExports ? root.Buffer : undefined;
44686
44687/* Built-in method references for those with the same name as other `lodash` methods. */
44688var nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined;
44689
44690/**
44691 * Checks if `value` is a buffer.
44692 *
44693 * @static
44694 * @memberOf _
44695 * @since 4.3.0
44696 * @category Lang
44697 * @param {*} value The value to check.
44698 * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
44699 * @example
44700 *
44701 * _.isBuffer(new Buffer(2));
44702 * // => true
44703 *
44704 * _.isBuffer(new Uint8Array(2));
44705 * // => false
44706 */
44707var isBuffer = nativeIsBuffer || stubFalse;
44708
44709module.exports = isBuffer;
44710
44711/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(278)(module)))
44712
44713/***/ }),
44714/* 683 */
44715/***/ (function(module, exports) {
44716
44717/**
44718 * This method returns `false`.
44719 *
44720 * @static
44721 * @memberOf _
44722 * @since 4.13.0
44723 * @category Util
44724 * @returns {boolean} Returns `false`.
44725 * @example
44726 *
44727 * _.times(2, _.stubFalse);
44728 * // => [false, false]
44729 */
44730function stubFalse() {
44731 return false;
44732}
44733
44734module.exports = stubFalse;
44735
44736
44737/***/ }),
44738/* 684 */
44739/***/ (function(module, exports) {
44740
44741/** Used as references for various `Number` constants. */
44742var MAX_SAFE_INTEGER = 9007199254740991;
44743
44744/** Used to detect unsigned integer values. */
44745var reIsUint = /^(?:0|[1-9]\d*)$/;
44746
44747/**
44748 * Checks if `value` is a valid array-like index.
44749 *
44750 * @private
44751 * @param {*} value The value to check.
44752 * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
44753 * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
44754 */
44755function isIndex(value, length) {
44756 var type = typeof value;
44757 length = length == null ? MAX_SAFE_INTEGER : length;
44758
44759 return !!length &&
44760 (type == 'number' ||
44761 (type != 'symbol' && reIsUint.test(value))) &&
44762 (value > -1 && value % 1 == 0 && value < length);
44763}
44764
44765module.exports = isIndex;
44766
44767
44768/***/ }),
44769/* 685 */
44770/***/ (function(module, exports, __webpack_require__) {
44771
44772var baseIsTypedArray = __webpack_require__(686),
44773 baseUnary = __webpack_require__(687),
44774 nodeUtil = __webpack_require__(688);
44775
44776/* Node.js helper references. */
44777var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
44778
44779/**
44780 * Checks if `value` is classified as a typed array.
44781 *
44782 * @static
44783 * @memberOf _
44784 * @since 3.0.0
44785 * @category Lang
44786 * @param {*} value The value to check.
44787 * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
44788 * @example
44789 *
44790 * _.isTypedArray(new Uint8Array);
44791 * // => true
44792 *
44793 * _.isTypedArray([]);
44794 * // => false
44795 */
44796var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
44797
44798module.exports = isTypedArray;
44799
44800
44801/***/ }),
44802/* 686 */
44803/***/ (function(module, exports, __webpack_require__) {
44804
44805var baseGetTag = __webpack_require__(119),
44806 isLength = __webpack_require__(279),
44807 isObjectLike = __webpack_require__(120);
44808
44809/** `Object#toString` result references. */
44810var argsTag = '[object Arguments]',
44811 arrayTag = '[object Array]',
44812 boolTag = '[object Boolean]',
44813 dateTag = '[object Date]',
44814 errorTag = '[object Error]',
44815 funcTag = '[object Function]',
44816 mapTag = '[object Map]',
44817 numberTag = '[object Number]',
44818 objectTag = '[object Object]',
44819 regexpTag = '[object RegExp]',
44820 setTag = '[object Set]',
44821 stringTag = '[object String]',
44822 weakMapTag = '[object WeakMap]';
44823
44824var arrayBufferTag = '[object ArrayBuffer]',
44825 dataViewTag = '[object DataView]',
44826 float32Tag = '[object Float32Array]',
44827 float64Tag = '[object Float64Array]',
44828 int8Tag = '[object Int8Array]',
44829 int16Tag = '[object Int16Array]',
44830 int32Tag = '[object Int32Array]',
44831 uint8Tag = '[object Uint8Array]',
44832 uint8ClampedTag = '[object Uint8ClampedArray]',
44833 uint16Tag = '[object Uint16Array]',
44834 uint32Tag = '[object Uint32Array]';
44835
44836/** Used to identify `toStringTag` values of typed arrays. */
44837var typedArrayTags = {};
44838typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
44839typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
44840typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
44841typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
44842typedArrayTags[uint32Tag] = true;
44843typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
44844typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
44845typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
44846typedArrayTags[errorTag] = typedArrayTags[funcTag] =
44847typedArrayTags[mapTag] = typedArrayTags[numberTag] =
44848typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
44849typedArrayTags[setTag] = typedArrayTags[stringTag] =
44850typedArrayTags[weakMapTag] = false;
44851
44852/**
44853 * The base implementation of `_.isTypedArray` without Node.js optimizations.
44854 *
44855 * @private
44856 * @param {*} value The value to check.
44857 * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
44858 */
44859function baseIsTypedArray(value) {
44860 return isObjectLike(value) &&
44861 isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
44862}
44863
44864module.exports = baseIsTypedArray;
44865
44866
44867/***/ }),
44868/* 687 */
44869/***/ (function(module, exports) {
44870
44871/**
44872 * The base implementation of `_.unary` without support for storing metadata.
44873 *
44874 * @private
44875 * @param {Function} func The function to cap arguments for.
44876 * @returns {Function} Returns the new capped function.
44877 */
44878function baseUnary(func) {
44879 return function(value) {
44880 return func(value);
44881 };
44882}
44883
44884module.exports = baseUnary;
44885
44886
44887/***/ }),
44888/* 688 */
44889/***/ (function(module, exports, __webpack_require__) {
44890
44891/* WEBPACK VAR INJECTION */(function(module) {var freeGlobal = __webpack_require__(276);
44892
44893/** Detect free variable `exports`. */
44894var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;
44895
44896/** Detect free variable `module`. */
44897var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
44898
44899/** Detect the popular CommonJS extension `module.exports`. */
44900var moduleExports = freeModule && freeModule.exports === freeExports;
44901
44902/** Detect free variable `process` from Node.js. */
44903var freeProcess = moduleExports && freeGlobal.process;
44904
44905/** Used to access faster Node.js helpers. */
44906var nodeUtil = (function() {
44907 try {
44908 // Use `util.types` for Node.js 10+.
44909 var types = freeModule && freeModule.require && freeModule.require('util').types;
44910
44911 if (types) {
44912 return types;
44913 }
44914
44915 // Legacy `process.binding('util')` for Node.js < 10.
44916 return freeProcess && freeProcess.binding && freeProcess.binding('util');
44917 } catch (e) {}
44918}());
44919
44920module.exports = nodeUtil;
44921
44922/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(278)(module)))
44923
44924/***/ }),
44925/* 689 */
44926/***/ (function(module, exports, __webpack_require__) {
44927
44928var isPrototype = __webpack_require__(690),
44929 nativeKeys = __webpack_require__(691);
44930
44931/** Used for built-in method references. */
44932var objectProto = Object.prototype;
44933
44934/** Used to check objects for own properties. */
44935var hasOwnProperty = objectProto.hasOwnProperty;
44936
44937/**
44938 * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
44939 *
44940 * @private
44941 * @param {Object} object The object to query.
44942 * @returns {Array} Returns the array of property names.
44943 */
44944function baseKeys(object) {
44945 if (!isPrototype(object)) {
44946 return nativeKeys(object);
44947 }
44948 var result = [];
44949 for (var key in Object(object)) {
44950 if (hasOwnProperty.call(object, key) && key != 'constructor') {
44951 result.push(key);
44952 }
44953 }
44954 return result;
44955}
44956
44957module.exports = baseKeys;
44958
44959
44960/***/ }),
44961/* 690 */
44962/***/ (function(module, exports) {
44963
44964/** Used for built-in method references. */
44965var objectProto = Object.prototype;
44966
44967/**
44968 * Checks if `value` is likely a prototype object.
44969 *
44970 * @private
44971 * @param {*} value The value to check.
44972 * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
44973 */
44974function isPrototype(value) {
44975 var Ctor = value && value.constructor,
44976 proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
44977
44978 return value === proto;
44979}
44980
44981module.exports = isPrototype;
44982
44983
44984/***/ }),
44985/* 691 */
44986/***/ (function(module, exports, __webpack_require__) {
44987
44988var overArg = __webpack_require__(280);
44989
44990/* Built-in method references for those with the same name as other `lodash` methods. */
44991var nativeKeys = overArg(Object.keys, Object);
44992
44993module.exports = nativeKeys;
44994
44995
44996/***/ }),
44997/* 692 */
44998/***/ (function(module, exports, __webpack_require__) {
44999
45000var isFunction = __webpack_require__(693),
45001 isLength = __webpack_require__(279);
45002
45003/**
45004 * Checks if `value` is array-like. A value is considered array-like if it's
45005 * not a function and has a `value.length` that's an integer greater than or
45006 * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
45007 *
45008 * @static
45009 * @memberOf _
45010 * @since 4.0.0
45011 * @category Lang
45012 * @param {*} value The value to check.
45013 * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
45014 * @example
45015 *
45016 * _.isArrayLike([1, 2, 3]);
45017 * // => true
45018 *
45019 * _.isArrayLike(document.body.children);
45020 * // => true
45021 *
45022 * _.isArrayLike('abc');
45023 * // => true
45024 *
45025 * _.isArrayLike(_.noop);
45026 * // => false
45027 */
45028function isArrayLike(value) {
45029 return value != null && isLength(value.length) && !isFunction(value);
45030}
45031
45032module.exports = isArrayLike;
45033
45034
45035/***/ }),
45036/* 693 */
45037/***/ (function(module, exports, __webpack_require__) {
45038
45039var baseGetTag = __webpack_require__(119),
45040 isObject = __webpack_require__(694);
45041
45042/** `Object#toString` result references. */
45043var asyncTag = '[object AsyncFunction]',
45044 funcTag = '[object Function]',
45045 genTag = '[object GeneratorFunction]',
45046 proxyTag = '[object Proxy]';
45047
45048/**
45049 * Checks if `value` is classified as a `Function` object.
45050 *
45051 * @static
45052 * @memberOf _
45053 * @since 0.1.0
45054 * @category Lang
45055 * @param {*} value The value to check.
45056 * @returns {boolean} Returns `true` if `value` is a function, else `false`.
45057 * @example
45058 *
45059 * _.isFunction(_);
45060 * // => true
45061 *
45062 * _.isFunction(/abc/);
45063 * // => false
45064 */
45065function isFunction(value) {
45066 if (!isObject(value)) {
45067 return false;
45068 }
45069 // The use of `Object#toString` avoids issues with the `typeof` operator
45070 // in Safari 9 which returns 'object' for typed arrays and other constructors.
45071 var tag = baseGetTag(value);
45072 return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
45073}
45074
45075module.exports = isFunction;
45076
45077
45078/***/ }),
45079/* 694 */
45080/***/ (function(module, exports) {
45081
45082/**
45083 * Checks if `value` is the
45084 * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
45085 * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
45086 *
45087 * @static
45088 * @memberOf _
45089 * @since 0.1.0
45090 * @category Lang
45091 * @param {*} value The value to check.
45092 * @returns {boolean} Returns `true` if `value` is an object, else `false`.
45093 * @example
45094 *
45095 * _.isObject({});
45096 * // => true
45097 *
45098 * _.isObject([1, 2, 3]);
45099 * // => true
45100 *
45101 * _.isObject(_.noop);
45102 * // => true
45103 *
45104 * _.isObject(null);
45105 * // => false
45106 */
45107function isObject(value) {
45108 var type = typeof value;
45109 return value != null && (type == 'object' || type == 'function');
45110}
45111
45112module.exports = isObject;
45113
45114
45115/***/ }),
45116/* 695 */
45117/***/ (function(module, exports, __webpack_require__) {
45118
45119var arrayWithHoles = __webpack_require__(696);
45120
45121var iterableToArray = __webpack_require__(270);
45122
45123var unsupportedIterableToArray = __webpack_require__(271);
45124
45125var nonIterableRest = __webpack_require__(697);
45126
45127function _toArray(arr) {
45128 return arrayWithHoles(arr) || iterableToArray(arr) || unsupportedIterableToArray(arr) || nonIterableRest();
45129}
45130
45131module.exports = _toArray;
45132
45133/***/ }),
45134/* 696 */
45135/***/ (function(module, exports) {
45136
45137function _arrayWithHoles(arr) {
45138 if (Array.isArray(arr)) return arr;
45139}
45140
45141module.exports = _arrayWithHoles;
45142
45143/***/ }),
45144/* 697 */
45145/***/ (function(module, exports) {
45146
45147function _nonIterableRest() {
45148 throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
45149}
45150
45151module.exports = _nonIterableRest;
45152
45153/***/ }),
45154/* 698 */
45155/***/ (function(module, exports) {
45156
45157function _defineProperties(target, props) {
45158 for (var i = 0; i < props.length; i++) {
45159 var descriptor = props[i];
45160 descriptor.enumerable = descriptor.enumerable || false;
45161 descriptor.configurable = true;
45162 if ("value" in descriptor) descriptor.writable = true;
45163 Object.defineProperty(target, descriptor.key, descriptor);
45164 }
45165}
45166
45167function _createClass(Constructor, protoProps, staticProps) {
45168 if (protoProps) _defineProperties(Constructor.prototype, protoProps);
45169 if (staticProps) _defineProperties(Constructor, staticProps);
45170 return Constructor;
45171}
45172
45173module.exports = _createClass;
45174
45175/***/ }),
45176/* 699 */
45177/***/ (function(module, exports) {
45178
45179function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) {
45180 var desc = {};
45181 Object.keys(descriptor).forEach(function (key) {
45182 desc[key] = descriptor[key];
45183 });
45184 desc.enumerable = !!desc.enumerable;
45185 desc.configurable = !!desc.configurable;
45186
45187 if ('value' in desc || desc.initializer) {
45188 desc.writable = true;
45189 }
45190
45191 desc = decorators.slice().reverse().reduce(function (desc, decorator) {
45192 return decorator(target, property, desc) || desc;
45193 }, desc);
45194
45195 if (context && desc.initializer !== void 0) {
45196 desc.value = desc.initializer ? desc.initializer.call(context) : void 0;
45197 desc.initializer = undefined;
45198 }
45199
45200 if (desc.initializer === void 0) {
45201 Object.defineProperty(target, property, desc);
45202 desc = null;
45203 }
45204
45205 return desc;
45206}
45207
45208module.exports = _applyDecoratedDescriptor;
45209
45210/***/ }),
45211/* 700 */
45212/***/ (function(module, exports, __webpack_require__) {
45213
45214/*
45215
45216 Javascript State Machine Library - https://github.com/jakesgordon/javascript-state-machine
45217
45218 Copyright (c) 2012, 2013, 2014, 2015, Jake Gordon and contributors
45219 Released under the MIT license - https://github.com/jakesgordon/javascript-state-machine/blob/master/LICENSE
45220
45221*/
45222
45223(function () {
45224
45225 var StateMachine = {
45226
45227 //---------------------------------------------------------------------------
45228
45229 VERSION: "2.4.0",
45230
45231 //---------------------------------------------------------------------------
45232
45233 Result: {
45234 SUCCEEDED: 1, // the event transitioned successfully from one state to another
45235 NOTRANSITION: 2, // the event was successfull but no state transition was necessary
45236 CANCELLED: 3, // the event was cancelled by the caller in a beforeEvent callback
45237 PENDING: 4 // the event is asynchronous and the caller is in control of when the transition occurs
45238 },
45239
45240 Error: {
45241 INVALID_TRANSITION: 100, // caller tried to fire an event that was innapropriate in the current state
45242 PENDING_TRANSITION: 200, // caller tried to fire an event while an async transition was still pending
45243 INVALID_CALLBACK: 300 // caller provided callback function threw an exception
45244 },
45245
45246 WILDCARD: '*',
45247 ASYNC: 'async',
45248
45249 //---------------------------------------------------------------------------
45250
45251 create: function(cfg, target) {
45252
45253 var initial = (typeof cfg.initial == 'string') ? { state: cfg.initial } : cfg.initial; // allow for a simple string, or an object with { state: 'foo', event: 'setup', defer: true|false }
45254 var terminal = cfg.terminal || cfg['final'];
45255 var fsm = target || cfg.target || {};
45256 var events = cfg.events || [];
45257 var callbacks = cfg.callbacks || {};
45258 var map = {}; // track state transitions allowed for an event { event: { from: [ to ] } }
45259 var transitions = {}; // track events allowed from a state { state: [ event ] }
45260
45261 var add = function(e) {
45262 var from = Array.isArray(e.from) ? e.from : (e.from ? [e.from] : [StateMachine.WILDCARD]); // allow 'wildcard' transition if 'from' is not specified
45263 map[e.name] = map[e.name] || {};
45264 for (var n = 0 ; n < from.length ; n++) {
45265 transitions[from[n]] = transitions[from[n]] || [];
45266 transitions[from[n]].push(e.name);
45267
45268 map[e.name][from[n]] = e.to || from[n]; // allow no-op transition if 'to' is not specified
45269 }
45270 if (e.to)
45271 transitions[e.to] = transitions[e.to] || [];
45272 };
45273
45274 if (initial) {
45275 initial.event = initial.event || 'startup';
45276 add({ name: initial.event, from: 'none', to: initial.state });
45277 }
45278
45279 for(var n = 0 ; n < events.length ; n++)
45280 add(events[n]);
45281
45282 for(var name in map) {
45283 if (map.hasOwnProperty(name))
45284 fsm[name] = StateMachine.buildEvent(name, map[name]);
45285 }
45286
45287 for(var name in callbacks) {
45288 if (callbacks.hasOwnProperty(name))
45289 fsm[name] = callbacks[name]
45290 }
45291
45292 fsm.current = 'none';
45293 fsm.is = function(state) { return Array.isArray(state) ? (state.indexOf(this.current) >= 0) : (this.current === state); };
45294 fsm.can = function(event) { return !this.transition && (map[event] !== undefined) && (map[event].hasOwnProperty(this.current) || map[event].hasOwnProperty(StateMachine.WILDCARD)); }
45295 fsm.cannot = function(event) { return !this.can(event); };
45296 fsm.transitions = function() { return (transitions[this.current] || []).concat(transitions[StateMachine.WILDCARD] || []); };
45297 fsm.isFinished = function() { return this.is(terminal); };
45298 fsm.error = cfg.error || function(name, from, to, args, error, msg, e) { throw e || msg; }; // default behavior when something unexpected happens is to throw an exception, but caller can override this behavior if desired (see github issue #3 and #17)
45299 fsm.states = function() { return Object.keys(transitions).sort() };
45300
45301 if (initial && !initial.defer)
45302 fsm[initial.event]();
45303
45304 return fsm;
45305
45306 },
45307
45308 //===========================================================================
45309
45310 doCallback: function(fsm, func, name, from, to, args) {
45311 if (func) {
45312 try {
45313 return func.apply(fsm, [name, from, to].concat(args));
45314 }
45315 catch(e) {
45316 return fsm.error(name, from, to, args, StateMachine.Error.INVALID_CALLBACK, "an exception occurred in a caller-provided callback function", e);
45317 }
45318 }
45319 },
45320
45321 beforeAnyEvent: function(fsm, name, from, to, args) { return StateMachine.doCallback(fsm, fsm['onbeforeevent'], name, from, to, args); },
45322 afterAnyEvent: function(fsm, name, from, to, args) { return StateMachine.doCallback(fsm, fsm['onafterevent'] || fsm['onevent'], name, from, to, args); },
45323 leaveAnyState: function(fsm, name, from, to, args) { return StateMachine.doCallback(fsm, fsm['onleavestate'], name, from, to, args); },
45324 enterAnyState: function(fsm, name, from, to, args) { return StateMachine.doCallback(fsm, fsm['onenterstate'] || fsm['onstate'], name, from, to, args); },
45325 changeState: function(fsm, name, from, to, args) { return StateMachine.doCallback(fsm, fsm['onchangestate'], name, from, to, args); },
45326
45327 beforeThisEvent: function(fsm, name, from, to, args) { return StateMachine.doCallback(fsm, fsm['onbefore' + name], name, from, to, args); },
45328 afterThisEvent: function(fsm, name, from, to, args) { return StateMachine.doCallback(fsm, fsm['onafter' + name] || fsm['on' + name], name, from, to, args); },
45329 leaveThisState: function(fsm, name, from, to, args) { return StateMachine.doCallback(fsm, fsm['onleave' + from], name, from, to, args); },
45330 enterThisState: function(fsm, name, from, to, args) { return StateMachine.doCallback(fsm, fsm['onenter' + to] || fsm['on' + to], name, from, to, args); },
45331
45332 beforeEvent: function(fsm, name, from, to, args) {
45333 if ((false === StateMachine.beforeThisEvent(fsm, name, from, to, args)) ||
45334 (false === StateMachine.beforeAnyEvent( fsm, name, from, to, args)))
45335 return false;
45336 },
45337
45338 afterEvent: function(fsm, name, from, to, args) {
45339 StateMachine.afterThisEvent(fsm, name, from, to, args);
45340 StateMachine.afterAnyEvent( fsm, name, from, to, args);
45341 },
45342
45343 leaveState: function(fsm, name, from, to, args) {
45344 var specific = StateMachine.leaveThisState(fsm, name, from, to, args),
45345 general = StateMachine.leaveAnyState( fsm, name, from, to, args);
45346 if ((false === specific) || (false === general))
45347 return false;
45348 else if ((StateMachine.ASYNC === specific) || (StateMachine.ASYNC === general))
45349 return StateMachine.ASYNC;
45350 },
45351
45352 enterState: function(fsm, name, from, to, args) {
45353 StateMachine.enterThisState(fsm, name, from, to, args);
45354 StateMachine.enterAnyState( fsm, name, from, to, args);
45355 },
45356
45357 //===========================================================================
45358
45359 buildEvent: function(name, map) {
45360 return function() {
45361
45362 var from = this.current;
45363 var to = map[from] || (map[StateMachine.WILDCARD] != StateMachine.WILDCARD ? map[StateMachine.WILDCARD] : from) || from;
45364 var args = Array.prototype.slice.call(arguments); // turn arguments into pure array
45365
45366 if (this.transition)
45367 return this.error(name, from, to, args, StateMachine.Error.PENDING_TRANSITION, "event " + name + " inappropriate because previous transition did not complete");
45368
45369 if (this.cannot(name))
45370 return this.error(name, from, to, args, StateMachine.Error.INVALID_TRANSITION, "event " + name + " inappropriate in current state " + this.current);
45371
45372 if (false === StateMachine.beforeEvent(this, name, from, to, args))
45373 return StateMachine.Result.CANCELLED;
45374
45375 if (from === to) {
45376 StateMachine.afterEvent(this, name, from, to, args);
45377 return StateMachine.Result.NOTRANSITION;
45378 }
45379
45380 // prepare a transition method for use EITHER lower down, or by caller if they want an async transition (indicated by an ASYNC return value from leaveState)
45381 var fsm = this;
45382 this.transition = function() {
45383 fsm.transition = null; // this method should only ever be called once
45384 fsm.current = to;
45385 StateMachine.enterState( fsm, name, from, to, args);
45386 StateMachine.changeState(fsm, name, from, to, args);
45387 StateMachine.afterEvent( fsm, name, from, to, args);
45388 return StateMachine.Result.SUCCEEDED;
45389 };
45390 this.transition.cancel = function() { // provide a way for caller to cancel async transition if desired (issue #22)
45391 fsm.transition = null;
45392 StateMachine.afterEvent(fsm, name, from, to, args);
45393 }
45394
45395 var leave = StateMachine.leaveState(this, name, from, to, args);
45396 if (false === leave) {
45397 this.transition = null;
45398 return StateMachine.Result.CANCELLED;
45399 }
45400 else if (StateMachine.ASYNC === leave) {
45401 return StateMachine.Result.PENDING;
45402 }
45403 else {
45404 if (this.transition) // need to check in case user manually called transition() but forgot to return StateMachine.ASYNC
45405 return this.transition();
45406 }
45407
45408 };
45409 }
45410
45411 }; // StateMachine
45412
45413 //===========================================================================
45414
45415 //======
45416 // NODE
45417 //======
45418 if (true) {
45419 if (typeof module !== 'undefined' && module.exports) {
45420 exports = module.exports = StateMachine;
45421 }
45422 exports.StateMachine = StateMachine;
45423 }
45424 //============
45425 // AMD/REQUIRE
45426 //============
45427 else if (typeof define === 'function' && define.amd) {
45428 define(function(require) { return StateMachine; });
45429 }
45430 //========
45431 // BROWSER
45432 //========
45433 else if (typeof window !== 'undefined') {
45434 window.StateMachine = StateMachine;
45435 }
45436 //===========
45437 // WEB WORKER
45438 //===========
45439 else if (typeof self !== 'undefined') {
45440 self.StateMachine = StateMachine;
45441 }
45442
45443}());
45444
45445
45446/***/ }),
45447/* 701 */
45448/***/ (function(module, exports) {
45449
45450function _typeof(obj) {
45451 "@babel/helpers - typeof";
45452
45453 if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
45454 module.exports = _typeof = function _typeof(obj) {
45455 return typeof obj;
45456 };
45457 } else {
45458 module.exports = _typeof = function _typeof(obj) {
45459 return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
45460 };
45461 }
45462
45463 return _typeof(obj);
45464}
45465
45466module.exports = _typeof;
45467
45468/***/ }),
45469/* 702 */
45470/***/ (function(module, exports, __webpack_require__) {
45471
45472var baseGetTag = __webpack_require__(119),
45473 getPrototype = __webpack_require__(703),
45474 isObjectLike = __webpack_require__(120);
45475
45476/** `Object#toString` result references. */
45477var objectTag = '[object Object]';
45478
45479/** Used for built-in method references. */
45480var funcProto = Function.prototype,
45481 objectProto = Object.prototype;
45482
45483/** Used to resolve the decompiled source of functions. */
45484var funcToString = funcProto.toString;
45485
45486/** Used to check objects for own properties. */
45487var hasOwnProperty = objectProto.hasOwnProperty;
45488
45489/** Used to infer the `Object` constructor. */
45490var objectCtorString = funcToString.call(Object);
45491
45492/**
45493 * Checks if `value` is a plain object, that is, an object created by the
45494 * `Object` constructor or one with a `[[Prototype]]` of `null`.
45495 *
45496 * @static
45497 * @memberOf _
45498 * @since 0.8.0
45499 * @category Lang
45500 * @param {*} value The value to check.
45501 * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
45502 * @example
45503 *
45504 * function Foo() {
45505 * this.a = 1;
45506 * }
45507 *
45508 * _.isPlainObject(new Foo);
45509 * // => false
45510 *
45511 * _.isPlainObject([1, 2, 3]);
45512 * // => false
45513 *
45514 * _.isPlainObject({ 'x': 0, 'y': 0 });
45515 * // => true
45516 *
45517 * _.isPlainObject(Object.create(null));
45518 * // => true
45519 */
45520function isPlainObject(value) {
45521 if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
45522 return false;
45523 }
45524 var proto = getPrototype(value);
45525 if (proto === null) {
45526 return true;
45527 }
45528 var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
45529 return typeof Ctor == 'function' && Ctor instanceof Ctor &&
45530 funcToString.call(Ctor) == objectCtorString;
45531}
45532
45533module.exports = isPlainObject;
45534
45535
45536/***/ }),
45537/* 703 */
45538/***/ (function(module, exports, __webpack_require__) {
45539
45540var overArg = __webpack_require__(280);
45541
45542/** Built-in value references. */
45543var getPrototype = overArg(Object.getPrototypeOf, Object);
45544
45545module.exports = getPrototype;
45546
45547
45548/***/ }),
45549/* 704 */
45550/***/ (function(module, exports, __webpack_require__) {
45551
45552"use strict";
45553var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
45554
45555var _interopRequireDefault = __webpack_require__(1);
45556
45557var _isIterable2 = _interopRequireDefault(__webpack_require__(262));
45558
45559var _from = _interopRequireDefault(__webpack_require__(152));
45560
45561var _set = _interopRequireDefault(__webpack_require__(268));
45562
45563var _concat = _interopRequireDefault(__webpack_require__(19));
45564
45565var _assign = _interopRequireDefault(__webpack_require__(265));
45566
45567var _map = _interopRequireDefault(__webpack_require__(37));
45568
45569var _defineProperty = _interopRequireDefault(__webpack_require__(94));
45570
45571var _typeof2 = _interopRequireDefault(__webpack_require__(95));
45572
45573(function (global, factory) {
45574 ( false ? "undefined" : (0, _typeof2.default)(exports)) === 'object' && typeof module !== 'undefined' ? factory(exports, __webpack_require__(155)) : true ? !(__WEBPACK_AMD_DEFINE_ARRAY__ = [exports, __webpack_require__(155)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
45575 __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
45576 (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
45577 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)) : (global = global || self, factory(global.AV = global.AV || {}, global.AV));
45578})(void 0, function (exports, core) {
45579 'use strict';
45580
45581 function _inheritsLoose(subClass, superClass) {
45582 subClass.prototype = Object.create(superClass.prototype);
45583 subClass.prototype.constructor = subClass;
45584 subClass.__proto__ = superClass;
45585 }
45586
45587 function _toConsumableArray(arr) {
45588 return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread();
45589 }
45590
45591 function _arrayWithoutHoles(arr) {
45592 if (Array.isArray(arr)) {
45593 for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) {
45594 arr2[i] = arr[i];
45595 }
45596
45597 return arr2;
45598 }
45599 }
45600
45601 function _iterableToArray(iter) {
45602 if ((0, _isIterable2.default)(Object(iter)) || Object.prototype.toString.call(iter) === "[object Arguments]") return (0, _from.default)(iter);
45603 }
45604
45605 function _nonIterableSpread() {
45606 throw new TypeError("Invalid attempt to spread non-iterable instance");
45607 }
45608 /* eslint-disable import/no-unresolved */
45609
45610
45611 if (!core.Protocals) {
45612 throw new Error('LeanCloud Realtime SDK not installed');
45613 }
45614
45615 var CommandType = core.Protocals.CommandType,
45616 GenericCommand = core.Protocals.GenericCommand,
45617 AckCommand = core.Protocals.AckCommand;
45618
45619 var warn = function warn(error) {
45620 return console.warn(error.message);
45621 };
45622
45623 var LiveQueryClient = /*#__PURE__*/function (_EventEmitter) {
45624 _inheritsLoose(LiveQueryClient, _EventEmitter);
45625
45626 function LiveQueryClient(appId, subscriptionId, connection) {
45627 var _this;
45628
45629 _this = _EventEmitter.call(this) || this;
45630 _this._appId = appId;
45631 _this.id = subscriptionId;
45632 _this._connection = connection;
45633 _this._eventemitter = new core.EventEmitter();
45634 _this._querys = new _set.default();
45635 return _this;
45636 }
45637
45638 var _proto = LiveQueryClient.prototype;
45639
45640 _proto._send = function _send(cmd) {
45641 var _context;
45642
45643 var _this$_connection;
45644
45645 for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
45646 args[_key - 1] = arguments[_key];
45647 }
45648
45649 return (_this$_connection = this._connection).send.apply(_this$_connection, (0, _concat.default)(_context = [(0, _assign.default)(cmd, {
45650 appId: this._appId,
45651 installationId: this.id,
45652 service: 1
45653 })]).call(_context, args));
45654 };
45655
45656 _proto._open = function _open() {
45657 return this._send(new GenericCommand({
45658 cmd: CommandType.login
45659 }));
45660 };
45661
45662 _proto.close = function close() {
45663 var _ee = this._eventemitter;
45664
45665 _ee.emit('beforeclose');
45666
45667 return this._send(new GenericCommand({
45668 cmd: CommandType.logout
45669 })).then(function () {
45670 return _ee.emit('close');
45671 });
45672 };
45673
45674 _proto.register = function register(liveQuery) {
45675 this._querys.add(liveQuery);
45676 };
45677
45678 _proto.deregister = function deregister(liveQuery) {
45679 var _this2 = this;
45680
45681 this._querys.delete(liveQuery);
45682
45683 setTimeout(function () {
45684 if (!_this2._querys.size) _this2.close().catch(warn);
45685 }, 0);
45686 };
45687
45688 _proto._dispatchCommand = function _dispatchCommand(command) {
45689 if (command.cmd !== CommandType.data) {
45690 this.emit('unhandledmessage', command);
45691 return core.Promise.resolve();
45692 }
45693
45694 return this._dispatchDataCommand(command);
45695 };
45696
45697 _proto._dispatchDataCommand = function _dispatchDataCommand(_ref) {
45698 var _ref$dataMessage = _ref.dataMessage,
45699 ids = _ref$dataMessage.ids,
45700 msg = _ref$dataMessage.msg;
45701 this.emit('message', (0, _map.default)(msg).call(msg, function (_ref2) {
45702 var data = _ref2.data;
45703 return JSON.parse(data);
45704 })); // send ack
45705
45706 var command = new GenericCommand({
45707 cmd: CommandType.ack,
45708 ackMessage: new AckCommand({
45709 ids: ids
45710 })
45711 });
45712 return this._send(command, false).catch(warn);
45713 };
45714
45715 return LiveQueryClient;
45716 }(core.EventEmitter);
45717
45718 var finalize = function finalize(callback) {
45719 return [// eslint-disable-next-line no-sequences
45720 function (value) {
45721 return callback(), value;
45722 }, function (error) {
45723 callback();
45724 throw error;
45725 }];
45726 };
45727
45728 var onRealtimeCreate = function onRealtimeCreate(realtime) {
45729 /* eslint-disable no-param-reassign */
45730 realtime._liveQueryClients = {};
45731
45732 realtime.createLiveQueryClient = function (subscriptionId) {
45733 var _realtime$_open$then;
45734
45735 if (realtime._liveQueryClients[subscriptionId] !== undefined) {
45736 return core.Promise.resolve(realtime._liveQueryClients[subscriptionId]);
45737 }
45738
45739 var promise = (_realtime$_open$then = realtime._open().then(function (connection) {
45740 var client = new LiveQueryClient(realtime._options.appId, subscriptionId, connection);
45741 connection.on('reconnect', function () {
45742 return client._open().then(function () {
45743 return client.emit('reconnect');
45744 }, function (error) {
45745 return client.emit('reconnecterror', error);
45746 });
45747 });
45748
45749 client._eventemitter.on('beforeclose', function () {
45750 delete realtime._liveQueryClients[client.id];
45751 }, realtime);
45752
45753 client._eventemitter.on('close', function () {
45754 realtime._deregister(client);
45755 }, realtime);
45756
45757 return client._open().then(function () {
45758 realtime._liveQueryClients[client.id] = client;
45759
45760 realtime._register(client);
45761
45762 return client;
45763 });
45764 })).then.apply(_realtime$_open$then, _toConsumableArray(finalize(function () {
45765 if (realtime._deregisterPending) realtime._deregisterPending(promise);
45766 })));
45767
45768 realtime._liveQueryClients[subscriptionId] = promise;
45769 if (realtime._registerPending) realtime._registerPending(promise);
45770 return promise;
45771 };
45772 /* eslint-enable no-param-reassign */
45773
45774 };
45775
45776 var beforeCommandDispatch = function beforeCommandDispatch(command, realtime) {
45777 var isLiveQueryCommand = command.installationId && command.service === 1;
45778 if (!isLiveQueryCommand) return true;
45779 var targetClient = realtime._liveQueryClients[command.installationId];
45780
45781 if (targetClient) {
45782 targetClient._dispatchCommand(command).catch(function (error) {
45783 return console.warn(error);
45784 });
45785 } else {
45786 console.warn('Unexpected message received without any live client match: %O', command);
45787 }
45788
45789 return false;
45790 }; // eslint-disable-next-line import/prefer-default-export
45791
45792
45793 var LiveQueryPlugin = {
45794 name: 'leancloud-realtime-plugin-live-query',
45795 onRealtimeCreate: onRealtimeCreate,
45796 beforeCommandDispatch: beforeCommandDispatch
45797 };
45798 exports.LiveQueryPlugin = LiveQueryPlugin;
45799 (0, _defineProperty.default)(exports, '__esModule', {
45800 value: true
45801 });
45802});
45803
45804/***/ })
45805/******/ ]);
45806});
45807//# sourceMappingURL=av-live-query.js.map
\No newline at end of file