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}; // Suppress the date string format warning in Weixin DevTools
1296// Link: https://developers.weixin.qq.com/community/minihome/doc/00080c6f244718053550067736b401
1297
1298
1299var parseDate = typeof wx === 'undefined' ? function (iso8601) {
1300 return new Date(iso8601);
1301} : function (iso8601) {
1302 return new Date(Date.parse(iso8601));
1303};
1304
1305var setValue = function setValue(target, key, value) {
1306 // '.' is not allowed in Class keys, escaping is not in concern now.
1307 var segs = key.split('.');
1308 var lastSeg = segs.pop();
1309 var currentTarget = target;
1310 segs.forEach(function (seg) {
1311 if (currentTarget[seg] === undefined) currentTarget[seg] = {};
1312 currentTarget = currentTarget[seg];
1313 });
1314 currentTarget[lastSeg] = value;
1315 return target;
1316};
1317
1318var findValue = function findValue(target, key) {
1319 var segs = key.split('.');
1320 var firstSeg = segs[0];
1321 var lastSeg = segs.pop();
1322 var currentTarget = target;
1323
1324 for (var i = 0; i < segs.length; i++) {
1325 currentTarget = currentTarget[segs[i]];
1326
1327 if (currentTarget === undefined) {
1328 return [undefined, undefined, lastSeg];
1329 }
1330 }
1331
1332 var value = currentTarget[lastSeg];
1333 return [value, currentTarget, lastSeg, firstSeg];
1334};
1335
1336var isPlainObject = function isPlainObject(obj) {
1337 return _.isObject(obj) && (0, _getPrototypeOf.default)(obj) === Object.prototype;
1338};
1339
1340var continueWhile = function continueWhile(predicate, asyncFunction) {
1341 if (predicate()) {
1342 return asyncFunction().then(function () {
1343 return continueWhile(predicate, asyncFunction);
1344 });
1345 }
1346
1347 return _promise.default.resolve();
1348};
1349
1350module.exports = {
1351 isNullOrUndefined: isNullOrUndefined,
1352 ensureArray: ensureArray,
1353 transformFetchOptions: transformFetchOptions,
1354 getSessionToken: getSessionToken,
1355 tap: tap,
1356 inherits: inherits,
1357 parseDate: parseDate,
1358 setValue: setValue,
1359 findValue: findValue,
1360 isPlainObject: isPlainObject,
1361 continueWhile: continueWhile
1362};
1363
1364/***/ }),
1365/* 33 */
1366/***/ (function(module, exports, __webpack_require__) {
1367
1368var requireObjectCoercible = __webpack_require__(81);
1369
1370var $Object = Object;
1371
1372// `ToObject` abstract operation
1373// https://tc39.es/ecma262/#sec-toobject
1374module.exports = function (argument) {
1375 return $Object(requireObjectCoercible(argument));
1376};
1377
1378
1379/***/ }),
1380/* 34 */
1381/***/ (function(module, exports, __webpack_require__) {
1382
1383module.exports = __webpack_require__(238);
1384
1385/***/ }),
1386/* 35 */
1387/***/ (function(module, exports, __webpack_require__) {
1388
1389// toObject with fallback for non-array-like ES3 strings
1390var IndexedObject = __webpack_require__(98);
1391var requireObjectCoercible = __webpack_require__(81);
1392
1393module.exports = function (it) {
1394 return IndexedObject(requireObjectCoercible(it));
1395};
1396
1397
1398/***/ }),
1399/* 36 */
1400/***/ (function(module, exports) {
1401
1402module.exports = true;
1403
1404
1405/***/ }),
1406/* 37 */
1407/***/ (function(module, exports, __webpack_require__) {
1408
1409module.exports = __webpack_require__(398);
1410
1411/***/ }),
1412/* 38 */
1413/***/ (function(module, exports, __webpack_require__) {
1414
1415module.exports = __webpack_require__(405);
1416
1417/***/ }),
1418/* 39 */
1419/***/ (function(module, exports, __webpack_require__) {
1420
1421var DESCRIPTORS = __webpack_require__(14);
1422var definePropertyModule = __webpack_require__(23);
1423var createPropertyDescriptor = __webpack_require__(49);
1424
1425module.exports = DESCRIPTORS ? function (object, key, value) {
1426 return definePropertyModule.f(object, key, createPropertyDescriptor(1, value));
1427} : function (object, key, value) {
1428 object[key] = value;
1429 return object;
1430};
1431
1432
1433/***/ }),
1434/* 40 */
1435/***/ (function(module, exports, __webpack_require__) {
1436
1437var toLength = __webpack_require__(295);
1438
1439// `LengthOfArrayLike` abstract operation
1440// https://tc39.es/ecma262/#sec-lengthofarraylike
1441module.exports = function (obj) {
1442 return toLength(obj.length);
1443};
1444
1445
1446/***/ }),
1447/* 41 */
1448/***/ (function(module, exports, __webpack_require__) {
1449
1450var bind = __webpack_require__(52);
1451var call = __webpack_require__(15);
1452var anObject = __webpack_require__(21);
1453var tryToString = __webpack_require__(67);
1454var isArrayIteratorMethod = __webpack_require__(165);
1455var lengthOfArrayLike = __webpack_require__(40);
1456var isPrototypeOf = __webpack_require__(16);
1457var getIterator = __webpack_require__(166);
1458var getIteratorMethod = __webpack_require__(108);
1459var iteratorClose = __webpack_require__(167);
1460
1461var $TypeError = TypeError;
1462
1463var Result = function (stopped, result) {
1464 this.stopped = stopped;
1465 this.result = result;
1466};
1467
1468var ResultPrototype = Result.prototype;
1469
1470module.exports = function (iterable, unboundFunction, options) {
1471 var that = options && options.that;
1472 var AS_ENTRIES = !!(options && options.AS_ENTRIES);
1473 var IS_ITERATOR = !!(options && options.IS_ITERATOR);
1474 var INTERRUPTED = !!(options && options.INTERRUPTED);
1475 var fn = bind(unboundFunction, that);
1476 var iterator, iterFn, index, length, result, next, step;
1477
1478 var stop = function (condition) {
1479 if (iterator) iteratorClose(iterator, 'normal', condition);
1480 return new Result(true, condition);
1481 };
1482
1483 var callFn = function (value) {
1484 if (AS_ENTRIES) {
1485 anObject(value);
1486 return INTERRUPTED ? fn(value[0], value[1], stop) : fn(value[0], value[1]);
1487 } return INTERRUPTED ? fn(value, stop) : fn(value);
1488 };
1489
1490 if (IS_ITERATOR) {
1491 iterator = iterable;
1492 } else {
1493 iterFn = getIteratorMethod(iterable);
1494 if (!iterFn) throw $TypeError(tryToString(iterable) + ' is not iterable');
1495 // optimisation for array iterators
1496 if (isArrayIteratorMethod(iterFn)) {
1497 for (index = 0, length = lengthOfArrayLike(iterable); length > index; index++) {
1498 result = callFn(iterable[index]);
1499 if (result && isPrototypeOf(ResultPrototype, result)) return result;
1500 } return new Result(false);
1501 }
1502 iterator = getIterator(iterable, iterFn);
1503 }
1504
1505 next = iterator.next;
1506 while (!(step = call(next, iterator)).done) {
1507 try {
1508 result = callFn(step.value);
1509 } catch (error) {
1510 iteratorClose(iterator, 'throw', error);
1511 }
1512 if (typeof result == 'object' && result && isPrototypeOf(ResultPrototype, result)) return result;
1513 } return new Result(false);
1514};
1515
1516
1517/***/ }),
1518/* 42 */
1519/***/ (function(module, exports, __webpack_require__) {
1520
1521var classof = __webpack_require__(55);
1522
1523var $String = String;
1524
1525module.exports = function (argument) {
1526 if (classof(argument) === 'Symbol') throw TypeError('Cannot convert a Symbol value to a string');
1527 return $String(argument);
1528};
1529
1530
1531/***/ }),
1532/* 43 */
1533/***/ (function(module, exports, __webpack_require__) {
1534
1535"use strict";
1536
1537var toIndexedObject = __webpack_require__(35);
1538var addToUnscopables = __webpack_require__(131);
1539var Iterators = __webpack_require__(54);
1540var InternalStateModule = __webpack_require__(44);
1541var defineProperty = __webpack_require__(23).f;
1542var defineIterator = __webpack_require__(133);
1543var IS_PURE = __webpack_require__(36);
1544var DESCRIPTORS = __webpack_require__(14);
1545
1546var ARRAY_ITERATOR = 'Array Iterator';
1547var setInternalState = InternalStateModule.set;
1548var getInternalState = InternalStateModule.getterFor(ARRAY_ITERATOR);
1549
1550// `Array.prototype.entries` method
1551// https://tc39.es/ecma262/#sec-array.prototype.entries
1552// `Array.prototype.keys` method
1553// https://tc39.es/ecma262/#sec-array.prototype.keys
1554// `Array.prototype.values` method
1555// https://tc39.es/ecma262/#sec-array.prototype.values
1556// `Array.prototype[@@iterator]` method
1557// https://tc39.es/ecma262/#sec-array.prototype-@@iterator
1558// `CreateArrayIterator` internal method
1559// https://tc39.es/ecma262/#sec-createarrayiterator
1560module.exports = defineIterator(Array, 'Array', function (iterated, kind) {
1561 setInternalState(this, {
1562 type: ARRAY_ITERATOR,
1563 target: toIndexedObject(iterated), // target
1564 index: 0, // next index
1565 kind: kind // kind
1566 });
1567// `%ArrayIteratorPrototype%.next` method
1568// https://tc39.es/ecma262/#sec-%arrayiteratorprototype%.next
1569}, function () {
1570 var state = getInternalState(this);
1571 var target = state.target;
1572 var kind = state.kind;
1573 var index = state.index++;
1574 if (!target || index >= target.length) {
1575 state.target = undefined;
1576 return { value: undefined, done: true };
1577 }
1578 if (kind == 'keys') return { value: index, done: false };
1579 if (kind == 'values') return { value: target[index], done: false };
1580 return { value: [index, target[index]], done: false };
1581}, 'values');
1582
1583// argumentsList[@@iterator] is %ArrayProto_values%
1584// https://tc39.es/ecma262/#sec-createunmappedargumentsobject
1585// https://tc39.es/ecma262/#sec-createmappedargumentsobject
1586var values = Iterators.Arguments = Iterators.Array;
1587
1588// https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
1589addToUnscopables('keys');
1590addToUnscopables('values');
1591addToUnscopables('entries');
1592
1593// V8 ~ Chrome 45- bug
1594if (!IS_PURE && DESCRIPTORS && values.name !== 'values') try {
1595 defineProperty(values, 'name', { value: 'values' });
1596} catch (error) { /* empty */ }
1597
1598
1599/***/ }),
1600/* 44 */
1601/***/ (function(module, exports, __webpack_require__) {
1602
1603var NATIVE_WEAK_MAP = __webpack_require__(168);
1604var global = __webpack_require__(8);
1605var uncurryThis = __webpack_require__(4);
1606var isObject = __webpack_require__(11);
1607var createNonEnumerableProperty = __webpack_require__(39);
1608var hasOwn = __webpack_require__(13);
1609var shared = __webpack_require__(123);
1610var sharedKey = __webpack_require__(103);
1611var hiddenKeys = __webpack_require__(83);
1612
1613var OBJECT_ALREADY_INITIALIZED = 'Object already initialized';
1614var TypeError = global.TypeError;
1615var WeakMap = global.WeakMap;
1616var set, get, has;
1617
1618var enforce = function (it) {
1619 return has(it) ? get(it) : set(it, {});
1620};
1621
1622var getterFor = function (TYPE) {
1623 return function (it) {
1624 var state;
1625 if (!isObject(it) || (state = get(it)).type !== TYPE) {
1626 throw TypeError('Incompatible receiver, ' + TYPE + ' required');
1627 } return state;
1628 };
1629};
1630
1631if (NATIVE_WEAK_MAP || shared.state) {
1632 var store = shared.state || (shared.state = new WeakMap());
1633 var wmget = uncurryThis(store.get);
1634 var wmhas = uncurryThis(store.has);
1635 var wmset = uncurryThis(store.set);
1636 set = function (it, metadata) {
1637 if (wmhas(store, it)) throw new TypeError(OBJECT_ALREADY_INITIALIZED);
1638 metadata.facade = it;
1639 wmset(store, it, metadata);
1640 return metadata;
1641 };
1642 get = function (it) {
1643 return wmget(store, it) || {};
1644 };
1645 has = function (it) {
1646 return wmhas(store, it);
1647 };
1648} else {
1649 var STATE = sharedKey('state');
1650 hiddenKeys[STATE] = true;
1651 set = function (it, metadata) {
1652 if (hasOwn(it, STATE)) throw new TypeError(OBJECT_ALREADY_INITIALIZED);
1653 metadata.facade = it;
1654 createNonEnumerableProperty(it, STATE, metadata);
1655 return metadata;
1656 };
1657 get = function (it) {
1658 return hasOwn(it, STATE) ? it[STATE] : {};
1659 };
1660 has = function (it) {
1661 return hasOwn(it, STATE);
1662 };
1663}
1664
1665module.exports = {
1666 set: set,
1667 get: get,
1668 has: has,
1669 enforce: enforce,
1670 getterFor: getterFor
1671};
1672
1673
1674/***/ }),
1675/* 45 */
1676/***/ (function(module, exports, __webpack_require__) {
1677
1678var createNonEnumerableProperty = __webpack_require__(39);
1679
1680module.exports = function (target, key, value, options) {
1681 if (options && options.enumerable) target[key] = value;
1682 else createNonEnumerableProperty(target, key, value);
1683 return target;
1684};
1685
1686
1687/***/ }),
1688/* 46 */
1689/***/ (function(module, exports, __webpack_require__) {
1690
1691__webpack_require__(43);
1692var DOMIterables = __webpack_require__(320);
1693var global = __webpack_require__(8);
1694var classof = __webpack_require__(55);
1695var createNonEnumerableProperty = __webpack_require__(39);
1696var Iterators = __webpack_require__(54);
1697var wellKnownSymbol = __webpack_require__(5);
1698
1699var TO_STRING_TAG = wellKnownSymbol('toStringTag');
1700
1701for (var COLLECTION_NAME in DOMIterables) {
1702 var Collection = global[COLLECTION_NAME];
1703 var CollectionPrototype = Collection && Collection.prototype;
1704 if (CollectionPrototype && classof(CollectionPrototype) !== TO_STRING_TAG) {
1705 createNonEnumerableProperty(CollectionPrototype, TO_STRING_TAG, COLLECTION_NAME);
1706 }
1707 Iterators[COLLECTION_NAME] = Iterators.Array;
1708}
1709
1710
1711/***/ }),
1712/* 47 */
1713/***/ (function(module, __webpack_exports__, __webpack_require__) {
1714
1715"use strict";
1716/* harmony export (immutable) */ __webpack_exports__["a"] = has;
1717/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(6);
1718
1719
1720// Internal function to check whether `key` is an own property name of `obj`.
1721function has(obj, key) {
1722 return obj != null && __WEBPACK_IMPORTED_MODULE_0__setup_js__["i" /* hasOwnProperty */].call(obj, key);
1723}
1724
1725
1726/***/ }),
1727/* 48 */
1728/***/ (function(module, exports, __webpack_require__) {
1729
1730"use strict";
1731
1732
1733var _interopRequireDefault = __webpack_require__(1);
1734
1735var _setPrototypeOf = _interopRequireDefault(__webpack_require__(420));
1736
1737var _getPrototypeOf = _interopRequireDefault(__webpack_require__(231));
1738
1739var _ = __webpack_require__(3);
1740/**
1741 * @class AV.Error
1742 */
1743
1744
1745function AVError(code, message) {
1746 if (this instanceof AVError ? this.constructor : void 0) {
1747 var error = new Error(message);
1748 (0, _setPrototypeOf.default)(error, (0, _getPrototypeOf.default)(this));
1749 error.code = code;
1750 return error;
1751 }
1752
1753 return new AVError(code, message);
1754}
1755
1756AVError.prototype = Object.create(Error.prototype, {
1757 constructor: {
1758 value: Error,
1759 enumerable: false,
1760 writable: true,
1761 configurable: true
1762 }
1763});
1764(0, _setPrototypeOf.default)(AVError, Error);
1765
1766_.extend(AVError,
1767/** @lends AV.Error */
1768{
1769 /**
1770 * Error code indicating some error other than those enumerated here.
1771 * @constant
1772 */
1773 OTHER_CAUSE: -1,
1774
1775 /**
1776 * Error code indicating that something has gone wrong with the server.
1777 * If you get this error code, it is AV's fault.
1778 * @constant
1779 */
1780 INTERNAL_SERVER_ERROR: 1,
1781
1782 /**
1783 * Error code indicating the connection to the AV servers failed.
1784 * @constant
1785 */
1786 CONNECTION_FAILED: 100,
1787
1788 /**
1789 * Error code indicating the specified object doesn't exist.
1790 * @constant
1791 */
1792 OBJECT_NOT_FOUND: 101,
1793
1794 /**
1795 * Error code indicating you tried to query with a datatype that doesn't
1796 * support it, like exact matching an array or object.
1797 * @constant
1798 */
1799 INVALID_QUERY: 102,
1800
1801 /**
1802 * Error code indicating a missing or invalid classname. Classnames are
1803 * case-sensitive. They must start with a letter, and a-zA-Z0-9_ are the
1804 * only valid characters.
1805 * @constant
1806 */
1807 INVALID_CLASS_NAME: 103,
1808
1809 /**
1810 * Error code indicating an unspecified object id.
1811 * @constant
1812 */
1813 MISSING_OBJECT_ID: 104,
1814
1815 /**
1816 * Error code indicating an invalid key name. Keys are case-sensitive. They
1817 * must start with a letter, and a-zA-Z0-9_ are the only valid characters.
1818 * @constant
1819 */
1820 INVALID_KEY_NAME: 105,
1821
1822 /**
1823 * Error code indicating a malformed pointer. You should not see this unless
1824 * you have been mucking about changing internal AV code.
1825 * @constant
1826 */
1827 INVALID_POINTER: 106,
1828
1829 /**
1830 * Error code indicating that badly formed JSON was received upstream. This
1831 * either indicates you have done something unusual with modifying how
1832 * things encode to JSON, or the network is failing badly.
1833 * @constant
1834 */
1835 INVALID_JSON: 107,
1836
1837 /**
1838 * Error code indicating that the feature you tried to access is only
1839 * available internally for testing purposes.
1840 * @constant
1841 */
1842 COMMAND_UNAVAILABLE: 108,
1843
1844 /**
1845 * You must call AV.initialize before using the AV library.
1846 * @constant
1847 */
1848 NOT_INITIALIZED: 109,
1849
1850 /**
1851 * Error code indicating that a field was set to an inconsistent type.
1852 * @constant
1853 */
1854 INCORRECT_TYPE: 111,
1855
1856 /**
1857 * Error code indicating an invalid channel name. A channel name is either
1858 * an empty string (the broadcast channel) or contains only a-zA-Z0-9_
1859 * characters.
1860 * @constant
1861 */
1862 INVALID_CHANNEL_NAME: 112,
1863
1864 /**
1865 * Error code indicating that push is misconfigured.
1866 * @constant
1867 */
1868 PUSH_MISCONFIGURED: 115,
1869
1870 /**
1871 * Error code indicating that the object is too large.
1872 * @constant
1873 */
1874 OBJECT_TOO_LARGE: 116,
1875
1876 /**
1877 * Error code indicating that the operation isn't allowed for clients.
1878 * @constant
1879 */
1880 OPERATION_FORBIDDEN: 119,
1881
1882 /**
1883 * Error code indicating the result was not found in the cache.
1884 * @constant
1885 */
1886 CACHE_MISS: 120,
1887
1888 /**
1889 * Error code indicating that an invalid key was used in a nested
1890 * JSONObject.
1891 * @constant
1892 */
1893 INVALID_NESTED_KEY: 121,
1894
1895 /**
1896 * Error code indicating that an invalid filename was used for AVFile.
1897 * A valid file name contains only a-zA-Z0-9_. characters and is between 1
1898 * and 128 characters.
1899 * @constant
1900 */
1901 INVALID_FILE_NAME: 122,
1902
1903 /**
1904 * Error code indicating an invalid ACL was provided.
1905 * @constant
1906 */
1907 INVALID_ACL: 123,
1908
1909 /**
1910 * Error code indicating that the request timed out on the server. Typically
1911 * this indicates that the request is too expensive to run.
1912 * @constant
1913 */
1914 TIMEOUT: 124,
1915
1916 /**
1917 * Error code indicating that the email address was invalid.
1918 * @constant
1919 */
1920 INVALID_EMAIL_ADDRESS: 125,
1921
1922 /**
1923 * Error code indicating a missing content type.
1924 * @constant
1925 */
1926 MISSING_CONTENT_TYPE: 126,
1927
1928 /**
1929 * Error code indicating a missing content length.
1930 * @constant
1931 */
1932 MISSING_CONTENT_LENGTH: 127,
1933
1934 /**
1935 * Error code indicating an invalid content length.
1936 * @constant
1937 */
1938 INVALID_CONTENT_LENGTH: 128,
1939
1940 /**
1941 * Error code indicating a file that was too large.
1942 * @constant
1943 */
1944 FILE_TOO_LARGE: 129,
1945
1946 /**
1947 * Error code indicating an error saving a file.
1948 * @constant
1949 */
1950 FILE_SAVE_ERROR: 130,
1951
1952 /**
1953 * Error code indicating an error deleting a file.
1954 * @constant
1955 */
1956 FILE_DELETE_ERROR: 153,
1957
1958 /**
1959 * Error code indicating that a unique field was given a value that is
1960 * already taken.
1961 * @constant
1962 */
1963 DUPLICATE_VALUE: 137,
1964
1965 /**
1966 * Error code indicating that a role's name is invalid.
1967 * @constant
1968 */
1969 INVALID_ROLE_NAME: 139,
1970
1971 /**
1972 * Error code indicating that an application quota was exceeded. Upgrade to
1973 * resolve.
1974 * @constant
1975 */
1976 EXCEEDED_QUOTA: 140,
1977
1978 /**
1979 * Error code indicating that a Cloud Code script failed.
1980 * @constant
1981 */
1982 SCRIPT_FAILED: 141,
1983
1984 /**
1985 * Error code indicating that a Cloud Code validation failed.
1986 * @constant
1987 */
1988 VALIDATION_ERROR: 142,
1989
1990 /**
1991 * Error code indicating that invalid image data was provided.
1992 * @constant
1993 */
1994 INVALID_IMAGE_DATA: 150,
1995
1996 /**
1997 * Error code indicating an unsaved file.
1998 * @constant
1999 */
2000 UNSAVED_FILE_ERROR: 151,
2001
2002 /**
2003 * Error code indicating an invalid push time.
2004 * @constant
2005 */
2006 INVALID_PUSH_TIME_ERROR: 152,
2007
2008 /**
2009 * Error code indicating that the username is missing or empty.
2010 * @constant
2011 */
2012 USERNAME_MISSING: 200,
2013
2014 /**
2015 * Error code indicating that the password is missing or empty.
2016 * @constant
2017 */
2018 PASSWORD_MISSING: 201,
2019
2020 /**
2021 * Error code indicating that the username has already been taken.
2022 * @constant
2023 */
2024 USERNAME_TAKEN: 202,
2025
2026 /**
2027 * Error code indicating that the email has already been taken.
2028 * @constant
2029 */
2030 EMAIL_TAKEN: 203,
2031
2032 /**
2033 * Error code indicating that the email is missing, but must be specified.
2034 * @constant
2035 */
2036 EMAIL_MISSING: 204,
2037
2038 /**
2039 * Error code indicating that a user with the specified email was not found.
2040 * @constant
2041 */
2042 EMAIL_NOT_FOUND: 205,
2043
2044 /**
2045 * Error code indicating that a user object without a valid session could
2046 * not be altered.
2047 * @constant
2048 */
2049 SESSION_MISSING: 206,
2050
2051 /**
2052 * Error code indicating that a user can only be created through signup.
2053 * @constant
2054 */
2055 MUST_CREATE_USER_THROUGH_SIGNUP: 207,
2056
2057 /**
2058 * Error code indicating that an an account being linked is already linked
2059 * to another user.
2060 * @constant
2061 */
2062 ACCOUNT_ALREADY_LINKED: 208,
2063
2064 /**
2065 * Error code indicating that a user cannot be linked to an account because
2066 * that account's id could not be found.
2067 * @constant
2068 */
2069 LINKED_ID_MISSING: 250,
2070
2071 /**
2072 * Error code indicating that a user with a linked (e.g. Facebook) account
2073 * has an invalid session.
2074 * @constant
2075 */
2076 INVALID_LINKED_SESSION: 251,
2077
2078 /**
2079 * Error code indicating that a service being linked (e.g. Facebook or
2080 * Twitter) is unsupported.
2081 * @constant
2082 */
2083 UNSUPPORTED_SERVICE: 252,
2084
2085 /**
2086 * Error code indicating a real error code is unavailable because
2087 * we had to use an XDomainRequest object to allow CORS requests in
2088 * Internet Explorer, which strips the body from HTTP responses that have
2089 * a non-2XX status code.
2090 * @constant
2091 */
2092 X_DOMAIN_REQUEST: 602
2093});
2094
2095module.exports = AVError;
2096
2097/***/ }),
2098/* 49 */
2099/***/ (function(module, exports) {
2100
2101module.exports = function (bitmap, value) {
2102 return {
2103 enumerable: !(bitmap & 1),
2104 configurable: !(bitmap & 2),
2105 writable: !(bitmap & 4),
2106 value: value
2107 };
2108};
2109
2110
2111/***/ }),
2112/* 50 */
2113/***/ (function(module, exports, __webpack_require__) {
2114
2115var uncurryThis = __webpack_require__(4);
2116
2117var toString = uncurryThis({}.toString);
2118var stringSlice = uncurryThis(''.slice);
2119
2120module.exports = function (it) {
2121 return stringSlice(toString(it), 8, -1);
2122};
2123
2124
2125/***/ }),
2126/* 51 */
2127/***/ (function(module, exports, __webpack_require__) {
2128
2129var getBuiltIn = __webpack_require__(20);
2130
2131module.exports = getBuiltIn('navigator', 'userAgent') || '';
2132
2133
2134/***/ }),
2135/* 52 */
2136/***/ (function(module, exports, __webpack_require__) {
2137
2138var uncurryThis = __webpack_require__(4);
2139var aCallable = __webpack_require__(29);
2140var NATIVE_BIND = __webpack_require__(80);
2141
2142var bind = uncurryThis(uncurryThis.bind);
2143
2144// optional / simple context binding
2145module.exports = function (fn, that) {
2146 aCallable(fn);
2147 return that === undefined ? fn : NATIVE_BIND ? bind(fn, that) : function (/* ...args */) {
2148 return fn.apply(that, arguments);
2149 };
2150};
2151
2152
2153/***/ }),
2154/* 53 */
2155/***/ (function(module, exports, __webpack_require__) {
2156
2157/* global ActiveXObject -- old IE, WSH */
2158var anObject = __webpack_require__(21);
2159var definePropertiesModule = __webpack_require__(129);
2160var enumBugKeys = __webpack_require__(128);
2161var hiddenKeys = __webpack_require__(83);
2162var html = __webpack_require__(164);
2163var documentCreateElement = __webpack_require__(124);
2164var sharedKey = __webpack_require__(103);
2165
2166var GT = '>';
2167var LT = '<';
2168var PROTOTYPE = 'prototype';
2169var SCRIPT = 'script';
2170var IE_PROTO = sharedKey('IE_PROTO');
2171
2172var EmptyConstructor = function () { /* empty */ };
2173
2174var scriptTag = function (content) {
2175 return LT + SCRIPT + GT + content + LT + '/' + SCRIPT + GT;
2176};
2177
2178// Create object with fake `null` prototype: use ActiveX Object with cleared prototype
2179var NullProtoObjectViaActiveX = function (activeXDocument) {
2180 activeXDocument.write(scriptTag(''));
2181 activeXDocument.close();
2182 var temp = activeXDocument.parentWindow.Object;
2183 activeXDocument = null; // avoid memory leak
2184 return temp;
2185};
2186
2187// Create object with fake `null` prototype: use iframe Object with cleared prototype
2188var NullProtoObjectViaIFrame = function () {
2189 // Thrash, waste and sodomy: IE GC bug
2190 var iframe = documentCreateElement('iframe');
2191 var JS = 'java' + SCRIPT + ':';
2192 var iframeDocument;
2193 iframe.style.display = 'none';
2194 html.appendChild(iframe);
2195 // https://github.com/zloirock/core-js/issues/475
2196 iframe.src = String(JS);
2197 iframeDocument = iframe.contentWindow.document;
2198 iframeDocument.open();
2199 iframeDocument.write(scriptTag('document.F=Object'));
2200 iframeDocument.close();
2201 return iframeDocument.F;
2202};
2203
2204// Check for document.domain and active x support
2205// No need to use active x approach when document.domain is not set
2206// see https://github.com/es-shims/es5-shim/issues/150
2207// variation of https://github.com/kitcambridge/es5-shim/commit/4f738ac066346
2208// avoid IE GC bug
2209var activeXDocument;
2210var NullProtoObject = function () {
2211 try {
2212 activeXDocument = new ActiveXObject('htmlfile');
2213 } catch (error) { /* ignore */ }
2214 NullProtoObject = typeof document != 'undefined'
2215 ? document.domain && activeXDocument
2216 ? NullProtoObjectViaActiveX(activeXDocument) // old IE
2217 : NullProtoObjectViaIFrame()
2218 : NullProtoObjectViaActiveX(activeXDocument); // WSH
2219 var length = enumBugKeys.length;
2220 while (length--) delete NullProtoObject[PROTOTYPE][enumBugKeys[length]];
2221 return NullProtoObject();
2222};
2223
2224hiddenKeys[IE_PROTO] = true;
2225
2226// `Object.create` method
2227// https://tc39.es/ecma262/#sec-object.create
2228// eslint-disable-next-line es-x/no-object-create -- safe
2229module.exports = Object.create || function create(O, Properties) {
2230 var result;
2231 if (O !== null) {
2232 EmptyConstructor[PROTOTYPE] = anObject(O);
2233 result = new EmptyConstructor();
2234 EmptyConstructor[PROTOTYPE] = null;
2235 // add "__proto__" for Object.getPrototypeOf polyfill
2236 result[IE_PROTO] = O;
2237 } else result = NullProtoObject();
2238 return Properties === undefined ? result : definePropertiesModule.f(result, Properties);
2239};
2240
2241
2242/***/ }),
2243/* 54 */
2244/***/ (function(module, exports) {
2245
2246module.exports = {};
2247
2248
2249/***/ }),
2250/* 55 */
2251/***/ (function(module, exports, __webpack_require__) {
2252
2253var TO_STRING_TAG_SUPPORT = __webpack_require__(130);
2254var isCallable = __webpack_require__(9);
2255var classofRaw = __webpack_require__(50);
2256var wellKnownSymbol = __webpack_require__(5);
2257
2258var TO_STRING_TAG = wellKnownSymbol('toStringTag');
2259var $Object = Object;
2260
2261// ES3 wrong here
2262var CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) == 'Arguments';
2263
2264// fallback for IE11 Script Access Denied error
2265var tryGet = function (it, key) {
2266 try {
2267 return it[key];
2268 } catch (error) { /* empty */ }
2269};
2270
2271// getting tag from ES6+ `Object.prototype.toString`
2272module.exports = TO_STRING_TAG_SUPPORT ? classofRaw : function (it) {
2273 var O, tag, result;
2274 return it === undefined ? 'Undefined' : it === null ? 'Null'
2275 // @@toStringTag case
2276 : typeof (tag = tryGet(O = $Object(it), TO_STRING_TAG)) == 'string' ? tag
2277 // builtinTag case
2278 : CORRECT_ARGUMENTS ? classofRaw(O)
2279 // ES3 arguments fallback
2280 : (result = classofRaw(O)) == 'Object' && isCallable(O.callee) ? 'Arguments' : result;
2281};
2282
2283
2284/***/ }),
2285/* 56 */
2286/***/ (function(module, exports, __webpack_require__) {
2287
2288var TO_STRING_TAG_SUPPORT = __webpack_require__(130);
2289var defineProperty = __webpack_require__(23).f;
2290var createNonEnumerableProperty = __webpack_require__(39);
2291var hasOwn = __webpack_require__(13);
2292var toString = __webpack_require__(301);
2293var wellKnownSymbol = __webpack_require__(5);
2294
2295var TO_STRING_TAG = wellKnownSymbol('toStringTag');
2296
2297module.exports = function (it, TAG, STATIC, SET_METHOD) {
2298 if (it) {
2299 var target = STATIC ? it : it.prototype;
2300 if (!hasOwn(target, TO_STRING_TAG)) {
2301 defineProperty(target, TO_STRING_TAG, { configurable: true, value: TAG });
2302 }
2303 if (SET_METHOD && !TO_STRING_TAG_SUPPORT) {
2304 createNonEnumerableProperty(target, 'toString', toString);
2305 }
2306 }
2307};
2308
2309
2310/***/ }),
2311/* 57 */
2312/***/ (function(module, exports, __webpack_require__) {
2313
2314"use strict";
2315
2316var aCallable = __webpack_require__(29);
2317
2318var PromiseCapability = function (C) {
2319 var resolve, reject;
2320 this.promise = new C(function ($$resolve, $$reject) {
2321 if (resolve !== undefined || reject !== undefined) throw TypeError('Bad Promise constructor');
2322 resolve = $$resolve;
2323 reject = $$reject;
2324 });
2325 this.resolve = aCallable(resolve);
2326 this.reject = aCallable(reject);
2327};
2328
2329// `NewPromiseCapability` abstract operation
2330// https://tc39.es/ecma262/#sec-newpromisecapability
2331module.exports.f = function (C) {
2332 return new PromiseCapability(C);
2333};
2334
2335
2336/***/ }),
2337/* 58 */
2338/***/ (function(module, __webpack_exports__, __webpack_require__) {
2339
2340"use strict";
2341/* harmony export (immutable) */ __webpack_exports__["a"] = isObject;
2342// Is a given variable an object?
2343function isObject(obj) {
2344 var type = typeof obj;
2345 return type === 'function' || type === 'object' && !!obj;
2346}
2347
2348
2349/***/ }),
2350/* 59 */
2351/***/ (function(module, __webpack_exports__, __webpack_require__) {
2352
2353"use strict";
2354/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(6);
2355/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__tagTester_js__ = __webpack_require__(18);
2356
2357
2358
2359// Is a given value an array?
2360// Delegates to ECMA5's native `Array.isArray`.
2361/* harmony default export */ __webpack_exports__["a"] = (__WEBPACK_IMPORTED_MODULE_0__setup_js__["k" /* nativeIsArray */] || Object(__WEBPACK_IMPORTED_MODULE_1__tagTester_js__["a" /* default */])('Array'));
2362
2363
2364/***/ }),
2365/* 60 */
2366/***/ (function(module, __webpack_exports__, __webpack_require__) {
2367
2368"use strict";
2369/* harmony export (immutable) */ __webpack_exports__["a"] = each;
2370/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__optimizeCb_js__ = __webpack_require__(89);
2371/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isArrayLike_js__ = __webpack_require__(26);
2372/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__keys_js__ = __webpack_require__(17);
2373
2374
2375
2376
2377// The cornerstone for collection functions, an `each`
2378// implementation, aka `forEach`.
2379// Handles raw objects in addition to array-likes. Treats all
2380// sparse array-likes as if they were dense.
2381function each(obj, iteratee, context) {
2382 iteratee = Object(__WEBPACK_IMPORTED_MODULE_0__optimizeCb_js__["a" /* default */])(iteratee, context);
2383 var i, length;
2384 if (Object(__WEBPACK_IMPORTED_MODULE_1__isArrayLike_js__["a" /* default */])(obj)) {
2385 for (i = 0, length = obj.length; i < length; i++) {
2386 iteratee(obj[i], i, obj);
2387 }
2388 } else {
2389 var _keys = Object(__WEBPACK_IMPORTED_MODULE_2__keys_js__["a" /* default */])(obj);
2390 for (i = 0, length = _keys.length; i < length; i++) {
2391 iteratee(obj[_keys[i]], _keys[i], obj);
2392 }
2393 }
2394 return obj;
2395}
2396
2397
2398/***/ }),
2399/* 61 */
2400/***/ (function(module, exports, __webpack_require__) {
2401
2402module.exports = __webpack_require__(407);
2403
2404/***/ }),
2405/* 62 */
2406/***/ (function(module, exports, __webpack_require__) {
2407
2408module.exports = __webpack_require__(411);
2409
2410/***/ }),
2411/* 63 */
2412/***/ (function(module, exports, __webpack_require__) {
2413
2414"use strict";
2415
2416
2417function _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); }
2418
2419/* eslint-env browser */
2420
2421/**
2422 * This is the web browser implementation of `debug()`.
2423 */
2424exports.log = log;
2425exports.formatArgs = formatArgs;
2426exports.save = save;
2427exports.load = load;
2428exports.useColors = useColors;
2429exports.storage = localstorage();
2430/**
2431 * Colors.
2432 */
2433
2434exports.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'];
2435/**
2436 * Currently only WebKit-based Web Inspectors, Firefox >= v31,
2437 * and the Firebug extension (any Firefox version) are known
2438 * to support "%c" CSS customizations.
2439 *
2440 * TODO: add a `localStorage` variable to explicitly enable/disable colors
2441 */
2442// eslint-disable-next-line complexity
2443
2444function useColors() {
2445 // NB: In an Electron preload script, document will be defined but not fully
2446 // initialized. Since we know we're in Chrome, we'll just detect this case
2447 // explicitly
2448 if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) {
2449 return true;
2450 } // Internet Explorer and Edge do not support colors.
2451
2452
2453 if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
2454 return false;
2455 } // Is webkit? http://stackoverflow.com/a/16459606/376773
2456 // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
2457
2458
2459 return typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || // Is firebug? http://stackoverflow.com/a/398120/376773
2460 typeof window !== 'undefined' && window.console && (window.console.firebug || window.console.exception && window.console.table) || // Is firefox >= v31?
2461 // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
2462 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
2463 typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/);
2464}
2465/**
2466 * Colorize log arguments if enabled.
2467 *
2468 * @api public
2469 */
2470
2471
2472function formatArgs(args) {
2473 args[0] = (this.useColors ? '%c' : '') + this.namespace + (this.useColors ? ' %c' : ' ') + args[0] + (this.useColors ? '%c ' : ' ') + '+' + module.exports.humanize(this.diff);
2474
2475 if (!this.useColors) {
2476 return;
2477 }
2478
2479 var c = 'color: ' + this.color;
2480 args.splice(1, 0, c, 'color: inherit'); // The final "%c" is somewhat tricky, because there could be other
2481 // arguments passed either before or after the %c, so we need to
2482 // figure out the correct index to insert the CSS into
2483
2484 var index = 0;
2485 var lastC = 0;
2486 args[0].replace(/%[a-zA-Z%]/g, function (match) {
2487 if (match === '%%') {
2488 return;
2489 }
2490
2491 index++;
2492
2493 if (match === '%c') {
2494 // We only are interested in the *last* %c
2495 // (the user may have provided their own)
2496 lastC = index;
2497 }
2498 });
2499 args.splice(lastC, 0, c);
2500}
2501/**
2502 * Invokes `console.log()` when available.
2503 * No-op when `console.log` is not a "function".
2504 *
2505 * @api public
2506 */
2507
2508
2509function log() {
2510 var _console;
2511
2512 // This hackery is required for IE8/9, where
2513 // the `console.log` function doesn't have 'apply'
2514 return (typeof console === "undefined" ? "undefined" : _typeof(console)) === 'object' && console.log && (_console = console).log.apply(_console, arguments);
2515}
2516/**
2517 * Save `namespaces`.
2518 *
2519 * @param {String} namespaces
2520 * @api private
2521 */
2522
2523
2524function save(namespaces) {
2525 try {
2526 if (namespaces) {
2527 exports.storage.setItem('debug', namespaces);
2528 } else {
2529 exports.storage.removeItem('debug');
2530 }
2531 } catch (error) {// Swallow
2532 // XXX (@Qix-) should we be logging these?
2533 }
2534}
2535/**
2536 * Load `namespaces`.
2537 *
2538 * @return {String} returns the previously persisted debug modes
2539 * @api private
2540 */
2541
2542
2543function load() {
2544 var r;
2545
2546 try {
2547 r = exports.storage.getItem('debug');
2548 } catch (error) {} // Swallow
2549 // XXX (@Qix-) should we be logging these?
2550 // If debug isn't set in LS, and we're in Electron, try to load $DEBUG
2551
2552
2553 if (!r && typeof process !== 'undefined' && 'env' in process) {
2554 r = process.env.DEBUG;
2555 }
2556
2557 return r;
2558}
2559/**
2560 * Localstorage attempts to return the localstorage.
2561 *
2562 * This is necessary because safari throws
2563 * when a user disables cookies/localstorage
2564 * and you attempt to access it.
2565 *
2566 * @return {LocalStorage}
2567 * @api private
2568 */
2569
2570
2571function localstorage() {
2572 try {
2573 // TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context
2574 // The Browser also has localStorage in the global context.
2575 return localStorage;
2576 } catch (error) {// Swallow
2577 // XXX (@Qix-) should we be logging these?
2578 }
2579}
2580
2581module.exports = __webpack_require__(416)(exports);
2582var formatters = module.exports.formatters;
2583/**
2584 * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
2585 */
2586
2587formatters.j = function (v) {
2588 try {
2589 return JSON.stringify(v);
2590 } catch (error) {
2591 return '[UnexpectedJSONParseError]: ' + error.message;
2592 }
2593};
2594
2595
2596
2597/***/ }),
2598/* 64 */
2599/***/ (function(module, exports, __webpack_require__) {
2600
2601var DESCRIPTORS = __webpack_require__(14);
2602var call = __webpack_require__(15);
2603var propertyIsEnumerableModule = __webpack_require__(121);
2604var createPropertyDescriptor = __webpack_require__(49);
2605var toIndexedObject = __webpack_require__(35);
2606var toPropertyKey = __webpack_require__(99);
2607var hasOwn = __webpack_require__(13);
2608var IE8_DOM_DEFINE = __webpack_require__(158);
2609
2610// eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
2611var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
2612
2613// `Object.getOwnPropertyDescriptor` method
2614// https://tc39.es/ecma262/#sec-object.getownpropertydescriptor
2615exports.f = DESCRIPTORS ? $getOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {
2616 O = toIndexedObject(O);
2617 P = toPropertyKey(P);
2618 if (IE8_DOM_DEFINE) try {
2619 return $getOwnPropertyDescriptor(O, P);
2620 } catch (error) { /* empty */ }
2621 if (hasOwn(O, P)) return createPropertyDescriptor(!call(propertyIsEnumerableModule.f, O, P), O[P]);
2622};
2623
2624
2625/***/ }),
2626/* 65 */
2627/***/ (function(module, exports, __webpack_require__) {
2628
2629/* eslint-disable es-x/no-symbol -- required for testing */
2630var V8_VERSION = __webpack_require__(66);
2631var fails = __webpack_require__(2);
2632
2633// eslint-disable-next-line es-x/no-object-getownpropertysymbols -- required for testing
2634module.exports = !!Object.getOwnPropertySymbols && !fails(function () {
2635 var symbol = Symbol();
2636 // Chrome 38 Symbol has incorrect toString conversion
2637 // `get-own-property-symbols` polyfill symbols converted to object are not Symbol instances
2638 return !String(symbol) || !(Object(symbol) instanceof Symbol) ||
2639 // Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances
2640 !Symbol.sham && V8_VERSION && V8_VERSION < 41;
2641});
2642
2643
2644/***/ }),
2645/* 66 */
2646/***/ (function(module, exports, __webpack_require__) {
2647
2648var global = __webpack_require__(8);
2649var userAgent = __webpack_require__(51);
2650
2651var process = global.process;
2652var Deno = global.Deno;
2653var versions = process && process.versions || Deno && Deno.version;
2654var v8 = versions && versions.v8;
2655var match, version;
2656
2657if (v8) {
2658 match = v8.split('.');
2659 // in old Chrome, versions of V8 isn't V8 = Chrome / 10
2660 // but their correct versions are not interesting for us
2661 version = match[0] > 0 && match[0] < 4 ? 1 : +(match[0] + match[1]);
2662}
2663
2664// BrowserFS NodeJS `process` polyfill incorrectly set `.v8` to `0.0`
2665// so check `userAgent` even if `.v8` exists, but 0
2666if (!version && userAgent) {
2667 match = userAgent.match(/Edge\/(\d+)/);
2668 if (!match || match[1] >= 74) {
2669 match = userAgent.match(/Chrome\/(\d+)/);
2670 if (match) version = +match[1];
2671 }
2672}
2673
2674module.exports = version;
2675
2676
2677/***/ }),
2678/* 67 */
2679/***/ (function(module, exports) {
2680
2681var $String = String;
2682
2683module.exports = function (argument) {
2684 try {
2685 return $String(argument);
2686 } catch (error) {
2687 return 'Object';
2688 }
2689};
2690
2691
2692/***/ }),
2693/* 68 */
2694/***/ (function(module, exports) {
2695
2696// empty
2697
2698
2699/***/ }),
2700/* 69 */
2701/***/ (function(module, exports, __webpack_require__) {
2702
2703var global = __webpack_require__(8);
2704
2705module.exports = global.Promise;
2706
2707
2708/***/ }),
2709/* 70 */
2710/***/ (function(module, exports, __webpack_require__) {
2711
2712"use strict";
2713
2714var charAt = __webpack_require__(319).charAt;
2715var toString = __webpack_require__(42);
2716var InternalStateModule = __webpack_require__(44);
2717var defineIterator = __webpack_require__(133);
2718
2719var STRING_ITERATOR = 'String Iterator';
2720var setInternalState = InternalStateModule.set;
2721var getInternalState = InternalStateModule.getterFor(STRING_ITERATOR);
2722
2723// `String.prototype[@@iterator]` method
2724// https://tc39.es/ecma262/#sec-string.prototype-@@iterator
2725defineIterator(String, 'String', function (iterated) {
2726 setInternalState(this, {
2727 type: STRING_ITERATOR,
2728 string: toString(iterated),
2729 index: 0
2730 });
2731// `%StringIteratorPrototype%.next` method
2732// https://tc39.es/ecma262/#sec-%stringiteratorprototype%.next
2733}, function next() {
2734 var state = getInternalState(this);
2735 var string = state.string;
2736 var index = state.index;
2737 var point;
2738 if (index >= string.length) return { value: undefined, done: true };
2739 point = charAt(string, index);
2740 state.index += point.length;
2741 return { value: point, done: false };
2742});
2743
2744
2745/***/ }),
2746/* 71 */
2747/***/ (function(module, __webpack_exports__, __webpack_require__) {
2748
2749"use strict";
2750/* harmony export (immutable) */ __webpack_exports__["a"] = values;
2751/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__keys_js__ = __webpack_require__(17);
2752
2753
2754// Retrieve the values of an object's properties.
2755function values(obj) {
2756 var _keys = Object(__WEBPACK_IMPORTED_MODULE_0__keys_js__["a" /* default */])(obj);
2757 var length = _keys.length;
2758 var values = Array(length);
2759 for (var i = 0; i < length; i++) {
2760 values[i] = obj[_keys[i]];
2761 }
2762 return values;
2763}
2764
2765
2766/***/ }),
2767/* 72 */
2768/***/ (function(module, __webpack_exports__, __webpack_require__) {
2769
2770"use strict";
2771/* harmony export (immutable) */ __webpack_exports__["a"] = flatten;
2772/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__getLength_js__ = __webpack_require__(31);
2773/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isArrayLike_js__ = __webpack_require__(26);
2774/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__isArray_js__ = __webpack_require__(59);
2775/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__isArguments_js__ = __webpack_require__(137);
2776
2777
2778
2779
2780
2781// Internal implementation of a recursive `flatten` function.
2782function flatten(input, depth, strict, output) {
2783 output = output || [];
2784 if (!depth && depth !== 0) {
2785 depth = Infinity;
2786 } else if (depth <= 0) {
2787 return output.concat(input);
2788 }
2789 var idx = output.length;
2790 for (var i = 0, length = Object(__WEBPACK_IMPORTED_MODULE_0__getLength_js__["a" /* default */])(input); i < length; i++) {
2791 var value = input[i];
2792 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))) {
2793 // Flatten current level of array or arguments object.
2794 if (depth > 1) {
2795 flatten(value, depth - 1, strict, output);
2796 idx = output.length;
2797 } else {
2798 var j = 0, len = value.length;
2799 while (j < len) output[idx++] = value[j++];
2800 }
2801 } else if (!strict) {
2802 output[idx++] = value;
2803 }
2804 }
2805 return output;
2806}
2807
2808
2809/***/ }),
2810/* 73 */
2811/***/ (function(module, __webpack_exports__, __webpack_require__) {
2812
2813"use strict";
2814/* harmony export (immutable) */ __webpack_exports__["a"] = map;
2815/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(22);
2816/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isArrayLike_js__ = __webpack_require__(26);
2817/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__keys_js__ = __webpack_require__(17);
2818
2819
2820
2821
2822// Return the results of applying the iteratee to each element.
2823function map(obj, iteratee, context) {
2824 iteratee = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(iteratee, context);
2825 var _keys = !Object(__WEBPACK_IMPORTED_MODULE_1__isArrayLike_js__["a" /* default */])(obj) && Object(__WEBPACK_IMPORTED_MODULE_2__keys_js__["a" /* default */])(obj),
2826 length = (_keys || obj).length,
2827 results = Array(length);
2828 for (var index = 0; index < length; index++) {
2829 var currentKey = _keys ? _keys[index] : index;
2830 results[index] = iteratee(obj[currentKey], currentKey, obj);
2831 }
2832 return results;
2833}
2834
2835
2836/***/ }),
2837/* 74 */
2838/***/ (function(module, exports, __webpack_require__) {
2839
2840"use strict";
2841/* WEBPACK VAR INJECTION */(function(global) {
2842
2843var _interopRequireDefault = __webpack_require__(1);
2844
2845var _promise = _interopRequireDefault(__webpack_require__(12));
2846
2847var _concat = _interopRequireDefault(__webpack_require__(19));
2848
2849var _map = _interopRequireDefault(__webpack_require__(37));
2850
2851var _keys = _interopRequireDefault(__webpack_require__(149));
2852
2853var _stringify = _interopRequireDefault(__webpack_require__(38));
2854
2855var _indexOf = _interopRequireDefault(__webpack_require__(61));
2856
2857var _keys2 = _interopRequireDefault(__webpack_require__(62));
2858
2859var _ = __webpack_require__(3);
2860
2861var uuid = __webpack_require__(230);
2862
2863var debug = __webpack_require__(63);
2864
2865var _require = __webpack_require__(32),
2866 inherits = _require.inherits,
2867 parseDate = _require.parseDate;
2868
2869var version = __webpack_require__(233);
2870
2871var _require2 = __webpack_require__(76),
2872 setAdapters = _require2.setAdapters,
2873 adapterManager = _require2.adapterManager;
2874
2875var AV = global.AV || {}; // All internal configuration items
2876
2877AV._config = {
2878 serverURLs: {},
2879 useMasterKey: false,
2880 production: null,
2881 realtime: null,
2882 requestTimeout: null
2883};
2884var initialUserAgent = "LeanCloud-JS-SDK/".concat(version); // configs shared by all AV instances
2885
2886AV._sharedConfig = {
2887 userAgent: initialUserAgent,
2888 liveQueryRealtime: null
2889};
2890adapterManager.on('platformInfo', function (platformInfo) {
2891 var ua = initialUserAgent;
2892
2893 if (platformInfo) {
2894 if (platformInfo.userAgent) {
2895 ua = platformInfo.userAgent;
2896 } else {
2897 var comments = platformInfo.name;
2898
2899 if (platformInfo.version) {
2900 comments += "/".concat(platformInfo.version);
2901 }
2902
2903 if (platformInfo.extra) {
2904 comments += "; ".concat(platformInfo.extra);
2905 }
2906
2907 ua += " (".concat(comments, ")");
2908 }
2909 }
2910
2911 AV._sharedConfig.userAgent = ua;
2912});
2913/**
2914 * Contains all AV API classes and functions.
2915 * @namespace AV
2916 */
2917
2918/**
2919 * Returns prefix for localStorage keys used by this instance of AV.
2920 * @param {String} path The relative suffix to append to it.
2921 * null or undefined is treated as the empty string.
2922 * @return {String} The full key name.
2923 * @private
2924 */
2925
2926AV._getAVPath = function (path) {
2927 if (!AV.applicationId) {
2928 throw new Error('You need to call AV.initialize before using AV.');
2929 }
2930
2931 if (!path) {
2932 path = '';
2933 }
2934
2935 if (!_.isString(path)) {
2936 throw new Error("Tried to get a localStorage path that wasn't a String.");
2937 }
2938
2939 if (path[0] === '/') {
2940 path = path.substring(1);
2941 }
2942
2943 return 'AV/' + AV.applicationId + '/' + path;
2944};
2945/**
2946 * Returns the unique string for this app on this machine.
2947 * Gets reset when localStorage is cleared.
2948 * @private
2949 */
2950
2951
2952AV._installationId = null;
2953
2954AV._getInstallationId = function () {
2955 // See if it's cached in RAM.
2956 if (AV._installationId) {
2957 return _promise.default.resolve(AV._installationId);
2958 } // Try to get it from localStorage.
2959
2960
2961 var path = AV._getAVPath('installationId');
2962
2963 return AV.localStorage.getItemAsync(path).then(function (_installationId) {
2964 AV._installationId = _installationId;
2965
2966 if (!AV._installationId) {
2967 // It wasn't in localStorage, so create a new one.
2968 AV._installationId = _installationId = uuid();
2969 return AV.localStorage.setItemAsync(path, _installationId).then(function () {
2970 return _installationId;
2971 });
2972 }
2973
2974 return _installationId;
2975 });
2976};
2977
2978AV._subscriptionId = null;
2979
2980AV._refreshSubscriptionId = function () {
2981 var path = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : AV._getAVPath('subscriptionId');
2982 var subscriptionId = AV._subscriptionId = uuid();
2983 return AV.localStorage.setItemAsync(path, subscriptionId).then(function () {
2984 return subscriptionId;
2985 });
2986};
2987
2988AV._getSubscriptionId = function () {
2989 // See if it's cached in RAM.
2990 if (AV._subscriptionId) {
2991 return _promise.default.resolve(AV._subscriptionId);
2992 } // Try to get it from localStorage.
2993
2994
2995 var path = AV._getAVPath('subscriptionId');
2996
2997 return AV.localStorage.getItemAsync(path).then(function (_subscriptionId) {
2998 AV._subscriptionId = _subscriptionId;
2999
3000 if (!AV._subscriptionId) {
3001 // It wasn't in localStorage, so create a new one.
3002 _subscriptionId = AV._refreshSubscriptionId(path);
3003 }
3004
3005 return _subscriptionId;
3006 });
3007};
3008
3009AV._parseDate = parseDate; // A self-propagating extend function.
3010
3011AV._extend = function (protoProps, classProps) {
3012 var child = inherits(this, protoProps, classProps);
3013 child.extend = this.extend;
3014 return child;
3015};
3016/**
3017 * Converts a value in a AV Object into the appropriate representation.
3018 * This is the JS equivalent of Java's AV.maybeReferenceAndEncode(Object)
3019 * if seenObjects is falsey. Otherwise any AV.Objects not in
3020 * seenObjects will be fully embedded rather than encoded
3021 * as a pointer. This array will be used to prevent going into an infinite
3022 * loop because we have circular references. If <seenObjects>
3023 * is set, then none of the AV Objects that are serialized can be dirty.
3024 * @private
3025 */
3026
3027
3028AV._encode = function (value, seenObjects, disallowObjects) {
3029 var full = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
3030
3031 if (value instanceof AV.Object) {
3032 if (disallowObjects) {
3033 throw new Error('AV.Objects not allowed here');
3034 }
3035
3036 if (!seenObjects || _.include(seenObjects, value) || !value._hasData) {
3037 return value._toPointer();
3038 }
3039
3040 return value._toFullJSON((0, _concat.default)(seenObjects).call(seenObjects, value), full);
3041 }
3042
3043 if (value instanceof AV.ACL) {
3044 return value.toJSON();
3045 }
3046
3047 if (_.isDate(value)) {
3048 return full ? {
3049 __type: 'Date',
3050 iso: value.toJSON()
3051 } : value.toJSON();
3052 }
3053
3054 if (value instanceof AV.GeoPoint) {
3055 return value.toJSON();
3056 }
3057
3058 if (_.isArray(value)) {
3059 return (0, _map.default)(_).call(_, value, function (x) {
3060 return AV._encode(x, seenObjects, disallowObjects, full);
3061 });
3062 }
3063
3064 if (_.isRegExp(value)) {
3065 return value.source;
3066 }
3067
3068 if (value instanceof AV.Relation) {
3069 return value.toJSON();
3070 }
3071
3072 if (value instanceof AV.Op) {
3073 return value.toJSON();
3074 }
3075
3076 if (value instanceof AV.File) {
3077 if (!value.url() && !value.id) {
3078 throw new Error('Tried to save an object containing an unsaved file.');
3079 }
3080
3081 return value._toFullJSON(seenObjects, full);
3082 }
3083
3084 if (_.isObject(value)) {
3085 return _.mapObject(value, function (v, k) {
3086 return AV._encode(v, seenObjects, disallowObjects, full);
3087 });
3088 }
3089
3090 return value;
3091};
3092/**
3093 * The inverse function of AV._encode.
3094 * @private
3095 */
3096
3097
3098AV._decode = function (value, key) {
3099 if (!_.isObject(value) || _.isDate(value)) {
3100 return value;
3101 }
3102
3103 if (_.isArray(value)) {
3104 return (0, _map.default)(_).call(_, value, function (v) {
3105 return AV._decode(v);
3106 });
3107 }
3108
3109 if (value instanceof AV.Object) {
3110 return value;
3111 }
3112
3113 if (value instanceof AV.File) {
3114 return value;
3115 }
3116
3117 if (value instanceof AV.Op) {
3118 return value;
3119 }
3120
3121 if (value instanceof AV.GeoPoint) {
3122 return value;
3123 }
3124
3125 if (value instanceof AV.ACL) {
3126 return value;
3127 }
3128
3129 if (key === 'ACL') {
3130 return new AV.ACL(value);
3131 }
3132
3133 if (value.__op) {
3134 return AV.Op._decode(value);
3135 }
3136
3137 var className;
3138
3139 if (value.__type === 'Pointer') {
3140 className = value.className;
3141
3142 var pointer = AV.Object._create(className);
3143
3144 if ((0, _keys.default)(value).length > 3) {
3145 var v = _.clone(value);
3146
3147 delete v.__type;
3148 delete v.className;
3149
3150 pointer._finishFetch(v, true);
3151 } else {
3152 pointer._finishFetch({
3153 objectId: value.objectId
3154 }, false);
3155 }
3156
3157 return pointer;
3158 }
3159
3160 if (value.__type === 'Object') {
3161 // It's an Object included in a query result.
3162 className = value.className;
3163
3164 var _v = _.clone(value);
3165
3166 delete _v.__type;
3167 delete _v.className;
3168
3169 var object = AV.Object._create(className);
3170
3171 object._finishFetch(_v, true);
3172
3173 return object;
3174 }
3175
3176 if (value.__type === 'Date') {
3177 return AV._parseDate(value.iso);
3178 }
3179
3180 if (value.__type === 'GeoPoint') {
3181 return new AV.GeoPoint({
3182 latitude: value.latitude,
3183 longitude: value.longitude
3184 });
3185 }
3186
3187 if (value.__type === 'Relation') {
3188 if (!key) throw new Error('key missing decoding a Relation');
3189 var relation = new AV.Relation(null, key);
3190 relation.targetClassName = value.className;
3191 return relation;
3192 }
3193
3194 if (value.__type === 'File') {
3195 var file = new AV.File(value.name);
3196
3197 var _v2 = _.clone(value);
3198
3199 delete _v2.__type;
3200
3201 file._finishFetch(_v2);
3202
3203 return file;
3204 }
3205
3206 return _.mapObject(value, AV._decode);
3207};
3208/**
3209 * The inverse function of {@link AV.Object#toFullJSON}.
3210 * @since 3.0.0
3211 * @method
3212 * @param {Object}
3213 * return {AV.Object|AV.File|any}
3214 */
3215
3216
3217AV.parseJSON = AV._decode;
3218/**
3219 * Similar to JSON.parse, except that AV internal types will be used if possible.
3220 * Inverse to {@link AV.stringify}
3221 * @since 3.14.0
3222 * @param {string} text the string to parse.
3223 * @return {AV.Object|AV.File|any}
3224 */
3225
3226AV.parse = function (text) {
3227 return AV.parseJSON(JSON.parse(text));
3228};
3229/**
3230 * Serialize a target containing AV.Object, similar to JSON.stringify.
3231 * Inverse to {@link AV.parse}
3232 * @since 3.14.0
3233 * @return {string}
3234 */
3235
3236
3237AV.stringify = function (target) {
3238 return (0, _stringify.default)(AV._encode(target, [], false, true));
3239};
3240
3241AV._encodeObjectOrArray = function (value) {
3242 var encodeAVObject = function encodeAVObject(object) {
3243 if (object && object._toFullJSON) {
3244 object = object._toFullJSON([]);
3245 }
3246
3247 return _.mapObject(object, function (value) {
3248 return AV._encode(value, []);
3249 });
3250 };
3251
3252 if (_.isArray(value)) {
3253 return (0, _map.default)(value).call(value, function (object) {
3254 return encodeAVObject(object);
3255 });
3256 } else {
3257 return encodeAVObject(value);
3258 }
3259};
3260
3261AV._arrayEach = _.each;
3262/**
3263 * Does a deep traversal of every item in object, calling func on every one.
3264 * @param {Object} object The object or array to traverse deeply.
3265 * @param {Function} func The function to call for every item. It will
3266 * be passed the item as an argument. If it returns a truthy value, that
3267 * value will replace the item in its parent container.
3268 * @returns {} the result of calling func on the top-level object itself.
3269 * @private
3270 */
3271
3272AV._traverse = function (object, func, seen) {
3273 if (object instanceof AV.Object) {
3274 seen = seen || [];
3275
3276 if ((0, _indexOf.default)(_).call(_, seen, object) >= 0) {
3277 // We've already visited this object in this call.
3278 return;
3279 }
3280
3281 seen.push(object);
3282
3283 AV._traverse(object.attributes, func, seen);
3284
3285 return func(object);
3286 }
3287
3288 if (object instanceof AV.Relation || object instanceof AV.File) {
3289 // Nothing needs to be done, but we don't want to recurse into the
3290 // object's parent infinitely, so we catch this case.
3291 return func(object);
3292 }
3293
3294 if (_.isArray(object)) {
3295 _.each(object, function (child, index) {
3296 var newChild = AV._traverse(child, func, seen);
3297
3298 if (newChild) {
3299 object[index] = newChild;
3300 }
3301 });
3302
3303 return func(object);
3304 }
3305
3306 if (_.isObject(object)) {
3307 AV._each(object, function (child, key) {
3308 var newChild = AV._traverse(child, func, seen);
3309
3310 if (newChild) {
3311 object[key] = newChild;
3312 }
3313 });
3314
3315 return func(object);
3316 }
3317
3318 return func(object);
3319};
3320/**
3321 * This is like _.each, except:
3322 * * it doesn't work for so-called array-like objects,
3323 * * it does work for dictionaries with a "length" attribute.
3324 * @private
3325 */
3326
3327
3328AV._objectEach = AV._each = function (obj, callback) {
3329 if (_.isObject(obj)) {
3330 _.each((0, _keys2.default)(_).call(_, obj), function (key) {
3331 callback(obj[key], key);
3332 });
3333 } else {
3334 _.each(obj, callback);
3335 }
3336};
3337/**
3338 * @namespace
3339 * @since 3.14.0
3340 */
3341
3342
3343AV.debug = {
3344 /**
3345 * Enable debug
3346 */
3347 enable: function enable() {
3348 var namespaces = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'leancloud*';
3349 return debug.enable(namespaces);
3350 },
3351
3352 /**
3353 * Disable debug
3354 */
3355 disable: debug.disable
3356};
3357/**
3358 * Specify Adapters
3359 * @since 4.4.0
3360 * @function
3361 * @param {Adapters} newAdapters See {@link https://url.leanapp.cn/adapter-type-definitions @leancloud/adapter-types} for detailed definitions.
3362 */
3363
3364AV.setAdapters = setAdapters;
3365module.exports = AV;
3366/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(78)))
3367
3368/***/ }),
3369/* 75 */
3370/***/ (function(module, exports, __webpack_require__) {
3371
3372var bind = __webpack_require__(52);
3373var uncurryThis = __webpack_require__(4);
3374var IndexedObject = __webpack_require__(98);
3375var toObject = __webpack_require__(33);
3376var lengthOfArrayLike = __webpack_require__(40);
3377var arraySpeciesCreate = __webpack_require__(228);
3378
3379var push = uncurryThis([].push);
3380
3381// `Array.prototype.{ forEach, map, filter, some, every, find, findIndex, filterReject }` methods implementation
3382var createMethod = function (TYPE) {
3383 var IS_MAP = TYPE == 1;
3384 var IS_FILTER = TYPE == 2;
3385 var IS_SOME = TYPE == 3;
3386 var IS_EVERY = TYPE == 4;
3387 var IS_FIND_INDEX = TYPE == 6;
3388 var IS_FILTER_REJECT = TYPE == 7;
3389 var NO_HOLES = TYPE == 5 || IS_FIND_INDEX;
3390 return function ($this, callbackfn, that, specificCreate) {
3391 var O = toObject($this);
3392 var self = IndexedObject(O);
3393 var boundFunction = bind(callbackfn, that);
3394 var length = lengthOfArrayLike(self);
3395 var index = 0;
3396 var create = specificCreate || arraySpeciesCreate;
3397 var target = IS_MAP ? create($this, length) : IS_FILTER || IS_FILTER_REJECT ? create($this, 0) : undefined;
3398 var value, result;
3399 for (;length > index; index++) if (NO_HOLES || index in self) {
3400 value = self[index];
3401 result = boundFunction(value, index, O);
3402 if (TYPE) {
3403 if (IS_MAP) target[index] = result; // map
3404 else if (result) switch (TYPE) {
3405 case 3: return true; // some
3406 case 5: return value; // find
3407 case 6: return index; // findIndex
3408 case 2: push(target, value); // filter
3409 } else switch (TYPE) {
3410 case 4: return false; // every
3411 case 7: push(target, value); // filterReject
3412 }
3413 }
3414 }
3415 return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : target;
3416 };
3417};
3418
3419module.exports = {
3420 // `Array.prototype.forEach` method
3421 // https://tc39.es/ecma262/#sec-array.prototype.foreach
3422 forEach: createMethod(0),
3423 // `Array.prototype.map` method
3424 // https://tc39.es/ecma262/#sec-array.prototype.map
3425 map: createMethod(1),
3426 // `Array.prototype.filter` method
3427 // https://tc39.es/ecma262/#sec-array.prototype.filter
3428 filter: createMethod(2),
3429 // `Array.prototype.some` method
3430 // https://tc39.es/ecma262/#sec-array.prototype.some
3431 some: createMethod(3),
3432 // `Array.prototype.every` method
3433 // https://tc39.es/ecma262/#sec-array.prototype.every
3434 every: createMethod(4),
3435 // `Array.prototype.find` method
3436 // https://tc39.es/ecma262/#sec-array.prototype.find
3437 find: createMethod(5),
3438 // `Array.prototype.findIndex` method
3439 // https://tc39.es/ecma262/#sec-array.prototype.findIndex
3440 findIndex: createMethod(6),
3441 // `Array.prototype.filterReject` method
3442 // https://github.com/tc39/proposal-array-filtering
3443 filterReject: createMethod(7)
3444};
3445
3446
3447/***/ }),
3448/* 76 */
3449/***/ (function(module, exports, __webpack_require__) {
3450
3451"use strict";
3452
3453
3454var _interopRequireDefault = __webpack_require__(1);
3455
3456var _keys = _interopRequireDefault(__webpack_require__(62));
3457
3458var _ = __webpack_require__(3);
3459
3460var EventEmitter = __webpack_require__(234);
3461
3462var _require = __webpack_require__(32),
3463 inherits = _require.inherits;
3464
3465var AdapterManager = inherits(EventEmitter, {
3466 constructor: function constructor() {
3467 EventEmitter.apply(this);
3468 this._adapters = {};
3469 },
3470 getAdapter: function getAdapter(name) {
3471 var adapter = this._adapters[name];
3472
3473 if (adapter === undefined) {
3474 throw new Error("".concat(name, " adapter is not configured"));
3475 }
3476
3477 return adapter;
3478 },
3479 setAdapters: function setAdapters(newAdapters) {
3480 var _this = this;
3481
3482 _.extend(this._adapters, newAdapters);
3483
3484 (0, _keys.default)(_).call(_, newAdapters).forEach(function (name) {
3485 return _this.emit(name, newAdapters[name]);
3486 });
3487 }
3488});
3489var adapterManager = new AdapterManager();
3490module.exports = {
3491 getAdapter: adapterManager.getAdapter.bind(adapterManager),
3492 setAdapters: adapterManager.setAdapters.bind(adapterManager),
3493 adapterManager: adapterManager
3494};
3495
3496/***/ }),
3497/* 77 */
3498/***/ (function(module, exports, __webpack_require__) {
3499
3500module.exports = __webpack_require__(241);
3501
3502/***/ }),
3503/* 78 */
3504/***/ (function(module, exports) {
3505
3506var g;
3507
3508// This works in non-strict mode
3509g = (function() {
3510 return this;
3511})();
3512
3513try {
3514 // This works if eval is allowed (see CSP)
3515 g = g || Function("return this")() || (1,eval)("this");
3516} catch(e) {
3517 // This works if the window reference is available
3518 if(typeof window === "object")
3519 g = window;
3520}
3521
3522// g can still be undefined, but nothing to do about it...
3523// We return undefined, instead of nothing here, so it's
3524// easier to handle this case. if(!global) { ...}
3525
3526module.exports = g;
3527
3528
3529/***/ }),
3530/* 79 */
3531/***/ (function(module, exports, __webpack_require__) {
3532
3533var NATIVE_BIND = __webpack_require__(80);
3534
3535var FunctionPrototype = Function.prototype;
3536var apply = FunctionPrototype.apply;
3537var call = FunctionPrototype.call;
3538
3539// eslint-disable-next-line es-x/no-reflect -- safe
3540module.exports = typeof Reflect == 'object' && Reflect.apply || (NATIVE_BIND ? call.bind(apply) : function () {
3541 return call.apply(apply, arguments);
3542});
3543
3544
3545/***/ }),
3546/* 80 */
3547/***/ (function(module, exports, __webpack_require__) {
3548
3549var fails = __webpack_require__(2);
3550
3551module.exports = !fails(function () {
3552 // eslint-disable-next-line es-x/no-function-prototype-bind -- safe
3553 var test = (function () { /* empty */ }).bind();
3554 // eslint-disable-next-line no-prototype-builtins -- safe
3555 return typeof test != 'function' || test.hasOwnProperty('prototype');
3556});
3557
3558
3559/***/ }),
3560/* 81 */
3561/***/ (function(module, exports) {
3562
3563var $TypeError = TypeError;
3564
3565// `RequireObjectCoercible` abstract operation
3566// https://tc39.es/ecma262/#sec-requireobjectcoercible
3567module.exports = function (it) {
3568 if (it == undefined) throw $TypeError("Can't call method on " + it);
3569 return it;
3570};
3571
3572
3573/***/ }),
3574/* 82 */
3575/***/ (function(module, exports, __webpack_require__) {
3576
3577var IS_PURE = __webpack_require__(36);
3578var store = __webpack_require__(123);
3579
3580(module.exports = function (key, value) {
3581 return store[key] || (store[key] = value !== undefined ? value : {});
3582})('versions', []).push({
3583 version: '3.23.3',
3584 mode: IS_PURE ? 'pure' : 'global',
3585 copyright: '© 2014-2022 Denis Pushkarev (zloirock.ru)',
3586 license: 'https://github.com/zloirock/core-js/blob/v3.23.3/LICENSE',
3587 source: 'https://github.com/zloirock/core-js'
3588});
3589
3590
3591/***/ }),
3592/* 83 */
3593/***/ (function(module, exports) {
3594
3595module.exports = {};
3596
3597
3598/***/ }),
3599/* 84 */
3600/***/ (function(module, exports) {
3601
3602module.exports = function (exec) {
3603 try {
3604 return { error: false, value: exec() };
3605 } catch (error) {
3606 return { error: true, value: error };
3607 }
3608};
3609
3610
3611/***/ }),
3612/* 85 */
3613/***/ (function(module, exports, __webpack_require__) {
3614
3615var global = __webpack_require__(8);
3616var NativePromiseConstructor = __webpack_require__(69);
3617var isCallable = __webpack_require__(9);
3618var isForced = __webpack_require__(159);
3619var inspectSource = __webpack_require__(132);
3620var wellKnownSymbol = __webpack_require__(5);
3621var IS_BROWSER = __webpack_require__(310);
3622var IS_PURE = __webpack_require__(36);
3623var V8_VERSION = __webpack_require__(66);
3624
3625var NativePromisePrototype = NativePromiseConstructor && NativePromiseConstructor.prototype;
3626var SPECIES = wellKnownSymbol('species');
3627var SUBCLASSING = false;
3628var NATIVE_PROMISE_REJECTION_EVENT = isCallable(global.PromiseRejectionEvent);
3629
3630var FORCED_PROMISE_CONSTRUCTOR = isForced('Promise', function () {
3631 var PROMISE_CONSTRUCTOR_SOURCE = inspectSource(NativePromiseConstructor);
3632 var GLOBAL_CORE_JS_PROMISE = PROMISE_CONSTRUCTOR_SOURCE !== String(NativePromiseConstructor);
3633 // V8 6.6 (Node 10 and Chrome 66) have a bug with resolving custom thenables
3634 // https://bugs.chromium.org/p/chromium/issues/detail?id=830565
3635 // We can't detect it synchronously, so just check versions
3636 if (!GLOBAL_CORE_JS_PROMISE && V8_VERSION === 66) return true;
3637 // We need Promise#{ catch, finally } in the pure version for preventing prototype pollution
3638 if (IS_PURE && !(NativePromisePrototype['catch'] && NativePromisePrototype['finally'])) return true;
3639 // We can't use @@species feature detection in V8 since it causes
3640 // deoptimization and performance degradation
3641 // https://github.com/zloirock/core-js/issues/679
3642 if (V8_VERSION >= 51 && /native code/.test(PROMISE_CONSTRUCTOR_SOURCE)) return false;
3643 // Detect correctness of subclassing with @@species support
3644 var promise = new NativePromiseConstructor(function (resolve) { resolve(1); });
3645 var FakePromise = function (exec) {
3646 exec(function () { /* empty */ }, function () { /* empty */ });
3647 };
3648 var constructor = promise.constructor = {};
3649 constructor[SPECIES] = FakePromise;
3650 SUBCLASSING = promise.then(function () { /* empty */ }) instanceof FakePromise;
3651 if (!SUBCLASSING) return true;
3652 // Unhandled rejections tracking support, NodeJS Promise without it fails @@species test
3653 return !GLOBAL_CORE_JS_PROMISE && IS_BROWSER && !NATIVE_PROMISE_REJECTION_EVENT;
3654});
3655
3656module.exports = {
3657 CONSTRUCTOR: FORCED_PROMISE_CONSTRUCTOR,
3658 REJECTION_EVENT: NATIVE_PROMISE_REJECTION_EVENT,
3659 SUBCLASSING: SUBCLASSING
3660};
3661
3662
3663/***/ }),
3664/* 86 */
3665/***/ (function(module, __webpack_exports__, __webpack_require__) {
3666
3667"use strict";
3668/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return hasStringTagBug; });
3669/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return isIE11; });
3670/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(6);
3671/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__hasObjectTag_js__ = __webpack_require__(327);
3672
3673
3674
3675// In IE 10 - Edge 13, `DataView` has string tag `'[object Object]'`.
3676// In IE 11, the most common among them, this problem also applies to
3677// `Map`, `WeakMap` and `Set`.
3678var hasStringTagBug = (
3679 __WEBPACK_IMPORTED_MODULE_0__setup_js__["s" /* supportsDataView */] && Object(__WEBPACK_IMPORTED_MODULE_1__hasObjectTag_js__["a" /* default */])(new DataView(new ArrayBuffer(8)))
3680 ),
3681 isIE11 = (typeof Map !== 'undefined' && Object(__WEBPACK_IMPORTED_MODULE_1__hasObjectTag_js__["a" /* default */])(new Map));
3682
3683
3684/***/ }),
3685/* 87 */
3686/***/ (function(module, __webpack_exports__, __webpack_require__) {
3687
3688"use strict";
3689/* harmony export (immutable) */ __webpack_exports__["a"] = allKeys;
3690/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isObject_js__ = __webpack_require__(58);
3691/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__setup_js__ = __webpack_require__(6);
3692/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__collectNonEnumProps_js__ = __webpack_require__(189);
3693
3694
3695
3696
3697// Retrieve all the enumerable property names of an object.
3698function allKeys(obj) {
3699 if (!Object(__WEBPACK_IMPORTED_MODULE_0__isObject_js__["a" /* default */])(obj)) return [];
3700 var keys = [];
3701 for (var key in obj) keys.push(key);
3702 // Ahem, IE < 9.
3703 if (__WEBPACK_IMPORTED_MODULE_1__setup_js__["h" /* hasEnumBug */]) Object(__WEBPACK_IMPORTED_MODULE_2__collectNonEnumProps_js__["a" /* default */])(obj, keys);
3704 return keys;
3705}
3706
3707
3708/***/ }),
3709/* 88 */
3710/***/ (function(module, __webpack_exports__, __webpack_require__) {
3711
3712"use strict";
3713/* harmony export (immutable) */ __webpack_exports__["a"] = toPath;
3714/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__underscore_js__ = __webpack_require__(25);
3715/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__toPath_js__ = __webpack_require__(198);
3716
3717
3718
3719// Internal wrapper for `_.toPath` to enable minification.
3720// Similar to `cb` for `_.iteratee`.
3721function toPath(path) {
3722 return __WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */].toPath(path);
3723}
3724
3725
3726/***/ }),
3727/* 89 */
3728/***/ (function(module, __webpack_exports__, __webpack_require__) {
3729
3730"use strict";
3731/* harmony export (immutable) */ __webpack_exports__["a"] = optimizeCb;
3732// Internal function that returns an efficient (for current engines) version
3733// of the passed-in callback, to be repeatedly applied in other Underscore
3734// functions.
3735function optimizeCb(func, context, argCount) {
3736 if (context === void 0) return func;
3737 switch (argCount == null ? 3 : argCount) {
3738 case 1: return function(value) {
3739 return func.call(context, value);
3740 };
3741 // The 2-argument case is omitted because we’re not using it.
3742 case 3: return function(value, index, collection) {
3743 return func.call(context, value, index, collection);
3744 };
3745 case 4: return function(accumulator, value, index, collection) {
3746 return func.call(context, accumulator, value, index, collection);
3747 };
3748 }
3749 return function() {
3750 return func.apply(context, arguments);
3751 };
3752}
3753
3754
3755/***/ }),
3756/* 90 */
3757/***/ (function(module, __webpack_exports__, __webpack_require__) {
3758
3759"use strict";
3760/* harmony export (immutable) */ __webpack_exports__["a"] = filter;
3761/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(22);
3762/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__each_js__ = __webpack_require__(60);
3763
3764
3765
3766// Return all the elements that pass a truth test.
3767function filter(obj, predicate, context) {
3768 var results = [];
3769 predicate = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(predicate, context);
3770 Object(__WEBPACK_IMPORTED_MODULE_1__each_js__["a" /* default */])(obj, function(value, index, list) {
3771 if (predicate(value, index, list)) results.push(value);
3772 });
3773 return results;
3774}
3775
3776
3777/***/ }),
3778/* 91 */
3779/***/ (function(module, __webpack_exports__, __webpack_require__) {
3780
3781"use strict";
3782/* harmony export (immutable) */ __webpack_exports__["a"] = contains;
3783/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__ = __webpack_require__(26);
3784/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__values_js__ = __webpack_require__(71);
3785/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__indexOf_js__ = __webpack_require__(214);
3786
3787
3788
3789
3790// Determine if the array or object contains a given item (using `===`).
3791function contains(obj, item, fromIndex, guard) {
3792 if (!Object(__WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__["a" /* default */])(obj)) obj = Object(__WEBPACK_IMPORTED_MODULE_1__values_js__["a" /* default */])(obj);
3793 if (typeof fromIndex != 'number' || guard) fromIndex = 0;
3794 return Object(__WEBPACK_IMPORTED_MODULE_2__indexOf_js__["a" /* default */])(obj, item, fromIndex) >= 0;
3795}
3796
3797
3798/***/ }),
3799/* 92 */
3800/***/ (function(module, exports, __webpack_require__) {
3801
3802var classof = __webpack_require__(50);
3803
3804// `IsArray` abstract operation
3805// https://tc39.es/ecma262/#sec-isarray
3806// eslint-disable-next-line es-x/no-array-isarray -- safe
3807module.exports = Array.isArray || function isArray(argument) {
3808 return classof(argument) == 'Array';
3809};
3810
3811
3812/***/ }),
3813/* 93 */
3814/***/ (function(module, exports, __webpack_require__) {
3815
3816"use strict";
3817
3818var toPropertyKey = __webpack_require__(99);
3819var definePropertyModule = __webpack_require__(23);
3820var createPropertyDescriptor = __webpack_require__(49);
3821
3822module.exports = function (object, key, value) {
3823 var propertyKey = toPropertyKey(key);
3824 if (propertyKey in object) definePropertyModule.f(object, propertyKey, createPropertyDescriptor(0, value));
3825 else object[propertyKey] = value;
3826};
3827
3828
3829/***/ }),
3830/* 94 */
3831/***/ (function(module, exports, __webpack_require__) {
3832
3833module.exports = __webpack_require__(239);
3834
3835/***/ }),
3836/* 95 */
3837/***/ (function(module, exports, __webpack_require__) {
3838
3839var _Symbol = __webpack_require__(240);
3840
3841var _Symbol$iterator = __webpack_require__(462);
3842
3843function _typeof(obj) {
3844 "@babel/helpers - typeof";
3845
3846 return (module.exports = _typeof = "function" == typeof _Symbol && "symbol" == typeof _Symbol$iterator ? function (obj) {
3847 return typeof obj;
3848 } : function (obj) {
3849 return obj && "function" == typeof _Symbol && obj.constructor === _Symbol && obj !== _Symbol.prototype ? "symbol" : typeof obj;
3850 }, module.exports.__esModule = true, module.exports["default"] = module.exports), _typeof(obj);
3851}
3852
3853module.exports = _typeof, module.exports.__esModule = true, module.exports["default"] = module.exports;
3854
3855/***/ }),
3856/* 96 */
3857/***/ (function(module, exports, __webpack_require__) {
3858
3859module.exports = __webpack_require__(475);
3860
3861/***/ }),
3862/* 97 */
3863/***/ (function(module, exports, __webpack_require__) {
3864
3865var $ = __webpack_require__(0);
3866var uncurryThis = __webpack_require__(4);
3867var hiddenKeys = __webpack_require__(83);
3868var isObject = __webpack_require__(11);
3869var hasOwn = __webpack_require__(13);
3870var defineProperty = __webpack_require__(23).f;
3871var getOwnPropertyNamesModule = __webpack_require__(105);
3872var getOwnPropertyNamesExternalModule = __webpack_require__(243);
3873var isExtensible = __webpack_require__(264);
3874var uid = __webpack_require__(101);
3875var FREEZING = __webpack_require__(263);
3876
3877var REQUIRED = false;
3878var METADATA = uid('meta');
3879var id = 0;
3880
3881var setMetadata = function (it) {
3882 defineProperty(it, METADATA, { value: {
3883 objectID: 'O' + id++, // object ID
3884 weakData: {} // weak collections IDs
3885 } });
3886};
3887
3888var fastKey = function (it, create) {
3889 // return a primitive with prefix
3890 if (!isObject(it)) return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it;
3891 if (!hasOwn(it, METADATA)) {
3892 // can't set metadata to uncaught frozen object
3893 if (!isExtensible(it)) return 'F';
3894 // not necessary to add metadata
3895 if (!create) return 'E';
3896 // add missing metadata
3897 setMetadata(it);
3898 // return object ID
3899 } return it[METADATA].objectID;
3900};
3901
3902var getWeakData = function (it, create) {
3903 if (!hasOwn(it, METADATA)) {
3904 // can't set metadata to uncaught frozen object
3905 if (!isExtensible(it)) return true;
3906 // not necessary to add metadata
3907 if (!create) return false;
3908 // add missing metadata
3909 setMetadata(it);
3910 // return the store of weak collections IDs
3911 } return it[METADATA].weakData;
3912};
3913
3914// add metadata on freeze-family methods calling
3915var onFreeze = function (it) {
3916 if (FREEZING && REQUIRED && isExtensible(it) && !hasOwn(it, METADATA)) setMetadata(it);
3917 return it;
3918};
3919
3920var enable = function () {
3921 meta.enable = function () { /* empty */ };
3922 REQUIRED = true;
3923 var getOwnPropertyNames = getOwnPropertyNamesModule.f;
3924 var splice = uncurryThis([].splice);
3925 var test = {};
3926 test[METADATA] = 1;
3927
3928 // prevent exposing of metadata key
3929 if (getOwnPropertyNames(test).length) {
3930 getOwnPropertyNamesModule.f = function (it) {
3931 var result = getOwnPropertyNames(it);
3932 for (var i = 0, length = result.length; i < length; i++) {
3933 if (result[i] === METADATA) {
3934 splice(result, i, 1);
3935 break;
3936 }
3937 } return result;
3938 };
3939
3940 $({ target: 'Object', stat: true, forced: true }, {
3941 getOwnPropertyNames: getOwnPropertyNamesExternalModule.f
3942 });
3943 }
3944};
3945
3946var meta = module.exports = {
3947 enable: enable,
3948 fastKey: fastKey,
3949 getWeakData: getWeakData,
3950 onFreeze: onFreeze
3951};
3952
3953hiddenKeys[METADATA] = true;
3954
3955
3956/***/ }),
3957/* 98 */
3958/***/ (function(module, exports, __webpack_require__) {
3959
3960var uncurryThis = __webpack_require__(4);
3961var fails = __webpack_require__(2);
3962var classof = __webpack_require__(50);
3963
3964var $Object = Object;
3965var split = uncurryThis(''.split);
3966
3967// fallback for non-array-like ES3 and non-enumerable old V8 strings
3968module.exports = fails(function () {
3969 // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
3970 // eslint-disable-next-line no-prototype-builtins -- safe
3971 return !$Object('z').propertyIsEnumerable(0);
3972}) ? function (it) {
3973 return classof(it) == 'String' ? split(it, '') : $Object(it);
3974} : $Object;
3975
3976
3977/***/ }),
3978/* 99 */
3979/***/ (function(module, exports, __webpack_require__) {
3980
3981var toPrimitive = __webpack_require__(289);
3982var isSymbol = __webpack_require__(100);
3983
3984// `ToPropertyKey` abstract operation
3985// https://tc39.es/ecma262/#sec-topropertykey
3986module.exports = function (argument) {
3987 var key = toPrimitive(argument, 'string');
3988 return isSymbol(key) ? key : key + '';
3989};
3990
3991
3992/***/ }),
3993/* 100 */
3994/***/ (function(module, exports, __webpack_require__) {
3995
3996var getBuiltIn = __webpack_require__(20);
3997var isCallable = __webpack_require__(9);
3998var isPrototypeOf = __webpack_require__(16);
3999var USE_SYMBOL_AS_UID = __webpack_require__(157);
4000
4001var $Object = Object;
4002
4003module.exports = USE_SYMBOL_AS_UID ? function (it) {
4004 return typeof it == 'symbol';
4005} : function (it) {
4006 var $Symbol = getBuiltIn('Symbol');
4007 return isCallable($Symbol) && isPrototypeOf($Symbol.prototype, $Object(it));
4008};
4009
4010
4011/***/ }),
4012/* 101 */
4013/***/ (function(module, exports, __webpack_require__) {
4014
4015var uncurryThis = __webpack_require__(4);
4016
4017var id = 0;
4018var postfix = Math.random();
4019var toString = uncurryThis(1.0.toString);
4020
4021module.exports = function (key) {
4022 return 'Symbol(' + (key === undefined ? '' : key) + ')_' + toString(++id + postfix, 36);
4023};
4024
4025
4026/***/ }),
4027/* 102 */
4028/***/ (function(module, exports, __webpack_require__) {
4029
4030var hasOwn = __webpack_require__(13);
4031var isCallable = __webpack_require__(9);
4032var toObject = __webpack_require__(33);
4033var sharedKey = __webpack_require__(103);
4034var CORRECT_PROTOTYPE_GETTER = __webpack_require__(161);
4035
4036var IE_PROTO = sharedKey('IE_PROTO');
4037var $Object = Object;
4038var ObjectPrototype = $Object.prototype;
4039
4040// `Object.getPrototypeOf` method
4041// https://tc39.es/ecma262/#sec-object.getprototypeof
4042// eslint-disable-next-line es-x/no-object-getprototypeof -- safe
4043module.exports = CORRECT_PROTOTYPE_GETTER ? $Object.getPrototypeOf : function (O) {
4044 var object = toObject(O);
4045 if (hasOwn(object, IE_PROTO)) return object[IE_PROTO];
4046 var constructor = object.constructor;
4047 if (isCallable(constructor) && object instanceof constructor) {
4048 return constructor.prototype;
4049 } return object instanceof $Object ? ObjectPrototype : null;
4050};
4051
4052
4053/***/ }),
4054/* 103 */
4055/***/ (function(module, exports, __webpack_require__) {
4056
4057var shared = __webpack_require__(82);
4058var uid = __webpack_require__(101);
4059
4060var keys = shared('keys');
4061
4062module.exports = function (key) {
4063 return keys[key] || (keys[key] = uid(key));
4064};
4065
4066
4067/***/ }),
4068/* 104 */
4069/***/ (function(module, exports, __webpack_require__) {
4070
4071/* eslint-disable no-proto -- safe */
4072var uncurryThis = __webpack_require__(4);
4073var anObject = __webpack_require__(21);
4074var aPossiblePrototype = __webpack_require__(292);
4075
4076// `Object.setPrototypeOf` method
4077// https://tc39.es/ecma262/#sec-object.setprototypeof
4078// Works with __proto__ only. Old v8 can't work with null proto objects.
4079// eslint-disable-next-line es-x/no-object-setprototypeof -- safe
4080module.exports = Object.setPrototypeOf || ('__proto__' in {} ? function () {
4081 var CORRECT_SETTER = false;
4082 var test = {};
4083 var setter;
4084 try {
4085 // eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
4086 setter = uncurryThis(Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set);
4087 setter(test, []);
4088 CORRECT_SETTER = test instanceof Array;
4089 } catch (error) { /* empty */ }
4090 return function setPrototypeOf(O, proto) {
4091 anObject(O);
4092 aPossiblePrototype(proto);
4093 if (CORRECT_SETTER) setter(O, proto);
4094 else O.__proto__ = proto;
4095 return O;
4096 };
4097}() : undefined);
4098
4099
4100/***/ }),
4101/* 105 */
4102/***/ (function(module, exports, __webpack_require__) {
4103
4104var internalObjectKeys = __webpack_require__(163);
4105var enumBugKeys = __webpack_require__(128);
4106
4107var hiddenKeys = enumBugKeys.concat('length', 'prototype');
4108
4109// `Object.getOwnPropertyNames` method
4110// https://tc39.es/ecma262/#sec-object.getownpropertynames
4111// eslint-disable-next-line es-x/no-object-getownpropertynames -- safe
4112exports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
4113 return internalObjectKeys(O, hiddenKeys);
4114};
4115
4116
4117/***/ }),
4118/* 106 */
4119/***/ (function(module, exports) {
4120
4121// eslint-disable-next-line es-x/no-object-getownpropertysymbols -- safe
4122exports.f = Object.getOwnPropertySymbols;
4123
4124
4125/***/ }),
4126/* 107 */
4127/***/ (function(module, exports, __webpack_require__) {
4128
4129var internalObjectKeys = __webpack_require__(163);
4130var enumBugKeys = __webpack_require__(128);
4131
4132// `Object.keys` method
4133// https://tc39.es/ecma262/#sec-object.keys
4134// eslint-disable-next-line es-x/no-object-keys -- safe
4135module.exports = Object.keys || function keys(O) {
4136 return internalObjectKeys(O, enumBugKeys);
4137};
4138
4139
4140/***/ }),
4141/* 108 */
4142/***/ (function(module, exports, __webpack_require__) {
4143
4144var classof = __webpack_require__(55);
4145var getMethod = __webpack_require__(122);
4146var Iterators = __webpack_require__(54);
4147var wellKnownSymbol = __webpack_require__(5);
4148
4149var ITERATOR = wellKnownSymbol('iterator');
4150
4151module.exports = function (it) {
4152 if (it != undefined) return getMethod(it, ITERATOR)
4153 || getMethod(it, '@@iterator')
4154 || Iterators[classof(it)];
4155};
4156
4157
4158/***/ }),
4159/* 109 */
4160/***/ (function(module, exports, __webpack_require__) {
4161
4162var classof = __webpack_require__(50);
4163var global = __webpack_require__(8);
4164
4165module.exports = classof(global.process) == 'process';
4166
4167
4168/***/ }),
4169/* 110 */
4170/***/ (function(module, exports, __webpack_require__) {
4171
4172var isPrototypeOf = __webpack_require__(16);
4173
4174var $TypeError = TypeError;
4175
4176module.exports = function (it, Prototype) {
4177 if (isPrototypeOf(Prototype, it)) return it;
4178 throw $TypeError('Incorrect invocation');
4179};
4180
4181
4182/***/ }),
4183/* 111 */
4184/***/ (function(module, exports, __webpack_require__) {
4185
4186var uncurryThis = __webpack_require__(4);
4187var fails = __webpack_require__(2);
4188var isCallable = __webpack_require__(9);
4189var classof = __webpack_require__(55);
4190var getBuiltIn = __webpack_require__(20);
4191var inspectSource = __webpack_require__(132);
4192
4193var noop = function () { /* empty */ };
4194var empty = [];
4195var construct = getBuiltIn('Reflect', 'construct');
4196var constructorRegExp = /^\s*(?:class|function)\b/;
4197var exec = uncurryThis(constructorRegExp.exec);
4198var INCORRECT_TO_STRING = !constructorRegExp.exec(noop);
4199
4200var isConstructorModern = function isConstructor(argument) {
4201 if (!isCallable(argument)) return false;
4202 try {
4203 construct(noop, empty, argument);
4204 return true;
4205 } catch (error) {
4206 return false;
4207 }
4208};
4209
4210var isConstructorLegacy = function isConstructor(argument) {
4211 if (!isCallable(argument)) return false;
4212 switch (classof(argument)) {
4213 case 'AsyncFunction':
4214 case 'GeneratorFunction':
4215 case 'AsyncGeneratorFunction': return false;
4216 }
4217 try {
4218 // we can't check .prototype since constructors produced by .bind haven't it
4219 // `Function#toString` throws on some built-it function in some legacy engines
4220 // (for example, `DOMQuad` and similar in FF41-)
4221 return INCORRECT_TO_STRING || !!exec(constructorRegExp, inspectSource(argument));
4222 } catch (error) {
4223 return true;
4224 }
4225};
4226
4227isConstructorLegacy.sham = true;
4228
4229// `IsConstructor` abstract operation
4230// https://tc39.es/ecma262/#sec-isconstructor
4231module.exports = !construct || fails(function () {
4232 var called;
4233 return isConstructorModern(isConstructorModern.call)
4234 || !isConstructorModern(Object)
4235 || !isConstructorModern(function () { called = true; })
4236 || called;
4237}) ? isConstructorLegacy : isConstructorModern;
4238
4239
4240/***/ }),
4241/* 112 */
4242/***/ (function(module, exports, __webpack_require__) {
4243
4244var uncurryThis = __webpack_require__(4);
4245
4246module.exports = uncurryThis([].slice);
4247
4248
4249/***/ }),
4250/* 113 */
4251/***/ (function(module, __webpack_exports__, __webpack_require__) {
4252
4253"use strict";
4254/* harmony export (immutable) */ __webpack_exports__["a"] = matcher;
4255/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__extendOwn_js__ = __webpack_require__(141);
4256/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isMatch_js__ = __webpack_require__(190);
4257
4258
4259
4260// Returns a predicate for checking whether an object has a given set of
4261// `key:value` pairs.
4262function matcher(attrs) {
4263 attrs = Object(__WEBPACK_IMPORTED_MODULE_0__extendOwn_js__["a" /* default */])({}, attrs);
4264 return function(obj) {
4265 return Object(__WEBPACK_IMPORTED_MODULE_1__isMatch_js__["a" /* default */])(obj, attrs);
4266 };
4267}
4268
4269
4270/***/ }),
4271/* 114 */
4272/***/ (function(module, __webpack_exports__, __webpack_require__) {
4273
4274"use strict";
4275/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(24);
4276/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__executeBound_js__ = __webpack_require__(206);
4277/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__underscore_js__ = __webpack_require__(25);
4278
4279
4280
4281
4282// Partially apply a function by creating a version that has had some of its
4283// arguments pre-filled, without changing its dynamic `this` context. `_` acts
4284// as a placeholder by default, allowing any combination of arguments to be
4285// pre-filled. Set `_.partial.placeholder` for a custom placeholder argument.
4286var partial = Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(func, boundArgs) {
4287 var placeholder = partial.placeholder;
4288 var bound = function() {
4289 var position = 0, length = boundArgs.length;
4290 var args = Array(length);
4291 for (var i = 0; i < length; i++) {
4292 args[i] = boundArgs[i] === placeholder ? arguments[position++] : boundArgs[i];
4293 }
4294 while (position < arguments.length) args.push(arguments[position++]);
4295 return Object(__WEBPACK_IMPORTED_MODULE_1__executeBound_js__["a" /* default */])(func, bound, this, this, args);
4296 };
4297 return bound;
4298});
4299
4300partial.placeholder = __WEBPACK_IMPORTED_MODULE_2__underscore_js__["a" /* default */];
4301/* harmony default export */ __webpack_exports__["a"] = (partial);
4302
4303
4304/***/ }),
4305/* 115 */
4306/***/ (function(module, __webpack_exports__, __webpack_require__) {
4307
4308"use strict";
4309/* harmony export (immutable) */ __webpack_exports__["a"] = group;
4310/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(22);
4311/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__each_js__ = __webpack_require__(60);
4312
4313
4314
4315// An internal function used for aggregate "group by" operations.
4316function group(behavior, partition) {
4317 return function(obj, iteratee, context) {
4318 var result = partition ? [[], []] : {};
4319 iteratee = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(iteratee, context);
4320 Object(__WEBPACK_IMPORTED_MODULE_1__each_js__["a" /* default */])(obj, function(value, index) {
4321 var key = iteratee(value, index, obj);
4322 behavior(result, value, key);
4323 });
4324 return result;
4325 };
4326}
4327
4328
4329/***/ }),
4330/* 116 */
4331/***/ (function(module, exports, __webpack_require__) {
4332
4333var fails = __webpack_require__(2);
4334var wellKnownSymbol = __webpack_require__(5);
4335var V8_VERSION = __webpack_require__(66);
4336
4337var SPECIES = wellKnownSymbol('species');
4338
4339module.exports = function (METHOD_NAME) {
4340 // We can't use this feature detection in V8 since it causes
4341 // deoptimization and serious performance degradation
4342 // https://github.com/zloirock/core-js/issues/677
4343 return V8_VERSION >= 51 || !fails(function () {
4344 var array = [];
4345 var constructor = array.constructor = {};
4346 constructor[SPECIES] = function () {
4347 return { foo: 1 };
4348 };
4349 return array[METHOD_NAME](Boolean).foo !== 1;
4350 });
4351};
4352
4353
4354/***/ }),
4355/* 117 */
4356/***/ (function(module, exports, __webpack_require__) {
4357
4358"use strict";
4359
4360
4361var _interopRequireDefault = __webpack_require__(1);
4362
4363var _typeof2 = _interopRequireDefault(__webpack_require__(95));
4364
4365var _filter = _interopRequireDefault(__webpack_require__(249));
4366
4367var _map = _interopRequireDefault(__webpack_require__(37));
4368
4369var _keys = _interopRequireDefault(__webpack_require__(149));
4370
4371var _stringify = _interopRequireDefault(__webpack_require__(38));
4372
4373var _concat = _interopRequireDefault(__webpack_require__(19));
4374
4375var _ = __webpack_require__(3);
4376
4377var _require = __webpack_require__(250),
4378 timeout = _require.timeout;
4379
4380var debug = __webpack_require__(63);
4381
4382var debugRequest = debug('leancloud:request');
4383var debugRequestError = debug('leancloud:request:error');
4384
4385var _require2 = __webpack_require__(76),
4386 getAdapter = _require2.getAdapter;
4387
4388var requestsCount = 0;
4389
4390var ajax = function ajax(_ref) {
4391 var method = _ref.method,
4392 url = _ref.url,
4393 query = _ref.query,
4394 data = _ref.data,
4395 _ref$headers = _ref.headers,
4396 headers = _ref$headers === void 0 ? {} : _ref$headers,
4397 time = _ref.timeout,
4398 onprogress = _ref.onprogress;
4399
4400 if (query) {
4401 var _context, _context2, _context4;
4402
4403 var queryString = (0, _filter.default)(_context = (0, _map.default)(_context2 = (0, _keys.default)(query)).call(_context2, function (key) {
4404 var _context3;
4405
4406 var value = query[key];
4407 if (value === undefined) return undefined;
4408 var v = (0, _typeof2.default)(value) === 'object' ? (0, _stringify.default)(value) : value;
4409 return (0, _concat.default)(_context3 = "".concat(encodeURIComponent(key), "=")).call(_context3, encodeURIComponent(v));
4410 })).call(_context, function (qs) {
4411 return qs;
4412 }).join('&');
4413 url = (0, _concat.default)(_context4 = "".concat(url, "?")).call(_context4, queryString);
4414 }
4415
4416 var count = requestsCount++;
4417 debugRequest('request(%d) %s %s %o %o %o', count, method, url, query, data, headers);
4418 var request = getAdapter('request');
4419 var promise = request(url, {
4420 method: method,
4421 headers: headers,
4422 data: data,
4423 onprogress: onprogress
4424 }).then(function (response) {
4425 debugRequest('response(%d) %d %O %o', count, response.status, response.data || response.text, response.header);
4426
4427 if (response.ok === false) {
4428 var error = new Error();
4429 error.response = response;
4430 throw error;
4431 }
4432
4433 return response.data;
4434 }).catch(function (error) {
4435 if (error.response) {
4436 if (!debug.enabled('leancloud:request')) {
4437 debugRequestError('request(%d) %s %s %o %o %o', count, method, url, query, data, headers);
4438 }
4439
4440 debugRequestError('response(%d) %d %O %o', count, error.response.status, error.response.data || error.response.text, error.response.header);
4441 error.statusCode = error.response.status;
4442 error.responseText = error.response.text;
4443 error.response = error.response.data;
4444 }
4445
4446 throw error;
4447 });
4448 return time ? timeout(promise, time) : promise;
4449};
4450
4451module.exports = ajax;
4452
4453/***/ }),
4454/* 118 */
4455/***/ (function(module, exports) {
4456
4457/* (ignored) */
4458
4459/***/ }),
4460/* 119 */
4461/***/ (function(module, exports, __webpack_require__) {
4462
4463var Symbol = __webpack_require__(274),
4464 getRawTag = __webpack_require__(680),
4465 objectToString = __webpack_require__(681);
4466
4467/** `Object#toString` result references. */
4468var nullTag = '[object Null]',
4469 undefinedTag = '[object Undefined]';
4470
4471/** Built-in value references. */
4472var symToStringTag = Symbol ? Symbol.toStringTag : undefined;
4473
4474/**
4475 * The base implementation of `getTag` without fallbacks for buggy environments.
4476 *
4477 * @private
4478 * @param {*} value The value to query.
4479 * @returns {string} Returns the `toStringTag`.
4480 */
4481function baseGetTag(value) {
4482 if (value == null) {
4483 return value === undefined ? undefinedTag : nullTag;
4484 }
4485 return (symToStringTag && symToStringTag in Object(value))
4486 ? getRawTag(value)
4487 : objectToString(value);
4488}
4489
4490module.exports = baseGetTag;
4491
4492
4493/***/ }),
4494/* 120 */
4495/***/ (function(module, exports) {
4496
4497/**
4498 * Checks if `value` is object-like. A value is object-like if it's not `null`
4499 * and has a `typeof` result of "object".
4500 *
4501 * @static
4502 * @memberOf _
4503 * @since 4.0.0
4504 * @category Lang
4505 * @param {*} value The value to check.
4506 * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
4507 * @example
4508 *
4509 * _.isObjectLike({});
4510 * // => true
4511 *
4512 * _.isObjectLike([1, 2, 3]);
4513 * // => true
4514 *
4515 * _.isObjectLike(_.noop);
4516 * // => false
4517 *
4518 * _.isObjectLike(null);
4519 * // => false
4520 */
4521function isObjectLike(value) {
4522 return value != null && typeof value == 'object';
4523}
4524
4525module.exports = isObjectLike;
4526
4527
4528/***/ }),
4529/* 121 */
4530/***/ (function(module, exports, __webpack_require__) {
4531
4532"use strict";
4533
4534var $propertyIsEnumerable = {}.propertyIsEnumerable;
4535// eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
4536var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
4537
4538// Nashorn ~ JDK8 bug
4539var NASHORN_BUG = getOwnPropertyDescriptor && !$propertyIsEnumerable.call({ 1: 2 }, 1);
4540
4541// `Object.prototype.propertyIsEnumerable` method implementation
4542// https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable
4543exports.f = NASHORN_BUG ? function propertyIsEnumerable(V) {
4544 var descriptor = getOwnPropertyDescriptor(this, V);
4545 return !!descriptor && descriptor.enumerable;
4546} : $propertyIsEnumerable;
4547
4548
4549/***/ }),
4550/* 122 */
4551/***/ (function(module, exports, __webpack_require__) {
4552
4553var aCallable = __webpack_require__(29);
4554
4555// `GetMethod` abstract operation
4556// https://tc39.es/ecma262/#sec-getmethod
4557module.exports = function (V, P) {
4558 var func = V[P];
4559 return func == null ? undefined : aCallable(func);
4560};
4561
4562
4563/***/ }),
4564/* 123 */
4565/***/ (function(module, exports, __webpack_require__) {
4566
4567var global = __webpack_require__(8);
4568var defineGlobalProperty = __webpack_require__(291);
4569
4570var SHARED = '__core-js_shared__';
4571var store = global[SHARED] || defineGlobalProperty(SHARED, {});
4572
4573module.exports = store;
4574
4575
4576/***/ }),
4577/* 124 */
4578/***/ (function(module, exports, __webpack_require__) {
4579
4580var global = __webpack_require__(8);
4581var isObject = __webpack_require__(11);
4582
4583var document = global.document;
4584// typeof document.createElement is 'object' in old IE
4585var EXISTS = isObject(document) && isObject(document.createElement);
4586
4587module.exports = function (it) {
4588 return EXISTS ? document.createElement(it) : {};
4589};
4590
4591
4592/***/ }),
4593/* 125 */
4594/***/ (function(module, exports, __webpack_require__) {
4595
4596var toIndexedObject = __webpack_require__(35);
4597var toAbsoluteIndex = __webpack_require__(126);
4598var lengthOfArrayLike = __webpack_require__(40);
4599
4600// `Array.prototype.{ indexOf, includes }` methods implementation
4601var createMethod = function (IS_INCLUDES) {
4602 return function ($this, el, fromIndex) {
4603 var O = toIndexedObject($this);
4604 var length = lengthOfArrayLike(O);
4605 var index = toAbsoluteIndex(fromIndex, length);
4606 var value;
4607 // Array#includes uses SameValueZero equality algorithm
4608 // eslint-disable-next-line no-self-compare -- NaN check
4609 if (IS_INCLUDES && el != el) while (length > index) {
4610 value = O[index++];
4611 // eslint-disable-next-line no-self-compare -- NaN check
4612 if (value != value) return true;
4613 // Array#indexOf ignores holes, Array#includes - not
4614 } else for (;length > index; index++) {
4615 if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;
4616 } return !IS_INCLUDES && -1;
4617 };
4618};
4619
4620module.exports = {
4621 // `Array.prototype.includes` method
4622 // https://tc39.es/ecma262/#sec-array.prototype.includes
4623 includes: createMethod(true),
4624 // `Array.prototype.indexOf` method
4625 // https://tc39.es/ecma262/#sec-array.prototype.indexof
4626 indexOf: createMethod(false)
4627};
4628
4629
4630/***/ }),
4631/* 126 */
4632/***/ (function(module, exports, __webpack_require__) {
4633
4634var toIntegerOrInfinity = __webpack_require__(127);
4635
4636var max = Math.max;
4637var min = Math.min;
4638
4639// Helper for a popular repeating case of the spec:
4640// Let integer be ? ToInteger(index).
4641// If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length).
4642module.exports = function (index, length) {
4643 var integer = toIntegerOrInfinity(index);
4644 return integer < 0 ? max(integer + length, 0) : min(integer, length);
4645};
4646
4647
4648/***/ }),
4649/* 127 */
4650/***/ (function(module, exports, __webpack_require__) {
4651
4652var trunc = __webpack_require__(294);
4653
4654// `ToIntegerOrInfinity` abstract operation
4655// https://tc39.es/ecma262/#sec-tointegerorinfinity
4656module.exports = function (argument) {
4657 var number = +argument;
4658 // eslint-disable-next-line no-self-compare -- NaN check
4659 return number !== number || number === 0 ? 0 : trunc(number);
4660};
4661
4662
4663/***/ }),
4664/* 128 */
4665/***/ (function(module, exports) {
4666
4667// IE8- don't enum bug keys
4668module.exports = [
4669 'constructor',
4670 'hasOwnProperty',
4671 'isPrototypeOf',
4672 'propertyIsEnumerable',
4673 'toLocaleString',
4674 'toString',
4675 'valueOf'
4676];
4677
4678
4679/***/ }),
4680/* 129 */
4681/***/ (function(module, exports, __webpack_require__) {
4682
4683var DESCRIPTORS = __webpack_require__(14);
4684var V8_PROTOTYPE_DEFINE_BUG = __webpack_require__(160);
4685var definePropertyModule = __webpack_require__(23);
4686var anObject = __webpack_require__(21);
4687var toIndexedObject = __webpack_require__(35);
4688var objectKeys = __webpack_require__(107);
4689
4690// `Object.defineProperties` method
4691// https://tc39.es/ecma262/#sec-object.defineproperties
4692// eslint-disable-next-line es-x/no-object-defineproperties -- safe
4693exports.f = DESCRIPTORS && !V8_PROTOTYPE_DEFINE_BUG ? Object.defineProperties : function defineProperties(O, Properties) {
4694 anObject(O);
4695 var props = toIndexedObject(Properties);
4696 var keys = objectKeys(Properties);
4697 var length = keys.length;
4698 var index = 0;
4699 var key;
4700 while (length > index) definePropertyModule.f(O, key = keys[index++], props[key]);
4701 return O;
4702};
4703
4704
4705/***/ }),
4706/* 130 */
4707/***/ (function(module, exports, __webpack_require__) {
4708
4709var wellKnownSymbol = __webpack_require__(5);
4710
4711var TO_STRING_TAG = wellKnownSymbol('toStringTag');
4712var test = {};
4713
4714test[TO_STRING_TAG] = 'z';
4715
4716module.exports = String(test) === '[object z]';
4717
4718
4719/***/ }),
4720/* 131 */
4721/***/ (function(module, exports) {
4722
4723module.exports = function () { /* empty */ };
4724
4725
4726/***/ }),
4727/* 132 */
4728/***/ (function(module, exports, __webpack_require__) {
4729
4730var uncurryThis = __webpack_require__(4);
4731var isCallable = __webpack_require__(9);
4732var store = __webpack_require__(123);
4733
4734var functionToString = uncurryThis(Function.toString);
4735
4736// this helper broken in `core-js@3.4.1-3.4.4`, so we can't use `shared` helper
4737if (!isCallable(store.inspectSource)) {
4738 store.inspectSource = function (it) {
4739 return functionToString(it);
4740 };
4741}
4742
4743module.exports = store.inspectSource;
4744
4745
4746/***/ }),
4747/* 133 */
4748/***/ (function(module, exports, __webpack_require__) {
4749
4750"use strict";
4751
4752var $ = __webpack_require__(0);
4753var call = __webpack_require__(15);
4754var IS_PURE = __webpack_require__(36);
4755var FunctionName = __webpack_require__(169);
4756var isCallable = __webpack_require__(9);
4757var createIteratorConstructor = __webpack_require__(300);
4758var getPrototypeOf = __webpack_require__(102);
4759var setPrototypeOf = __webpack_require__(104);
4760var setToStringTag = __webpack_require__(56);
4761var createNonEnumerableProperty = __webpack_require__(39);
4762var defineBuiltIn = __webpack_require__(45);
4763var wellKnownSymbol = __webpack_require__(5);
4764var Iterators = __webpack_require__(54);
4765var IteratorsCore = __webpack_require__(170);
4766
4767var PROPER_FUNCTION_NAME = FunctionName.PROPER;
4768var CONFIGURABLE_FUNCTION_NAME = FunctionName.CONFIGURABLE;
4769var IteratorPrototype = IteratorsCore.IteratorPrototype;
4770var BUGGY_SAFARI_ITERATORS = IteratorsCore.BUGGY_SAFARI_ITERATORS;
4771var ITERATOR = wellKnownSymbol('iterator');
4772var KEYS = 'keys';
4773var VALUES = 'values';
4774var ENTRIES = 'entries';
4775
4776var returnThis = function () { return this; };
4777
4778module.exports = function (Iterable, NAME, IteratorConstructor, next, DEFAULT, IS_SET, FORCED) {
4779 createIteratorConstructor(IteratorConstructor, NAME, next);
4780
4781 var getIterationMethod = function (KIND) {
4782 if (KIND === DEFAULT && defaultIterator) return defaultIterator;
4783 if (!BUGGY_SAFARI_ITERATORS && KIND in IterablePrototype) return IterablePrototype[KIND];
4784 switch (KIND) {
4785 case KEYS: return function keys() { return new IteratorConstructor(this, KIND); };
4786 case VALUES: return function values() { return new IteratorConstructor(this, KIND); };
4787 case ENTRIES: return function entries() { return new IteratorConstructor(this, KIND); };
4788 } return function () { return new IteratorConstructor(this); };
4789 };
4790
4791 var TO_STRING_TAG = NAME + ' Iterator';
4792 var INCORRECT_VALUES_NAME = false;
4793 var IterablePrototype = Iterable.prototype;
4794 var nativeIterator = IterablePrototype[ITERATOR]
4795 || IterablePrototype['@@iterator']
4796 || DEFAULT && IterablePrototype[DEFAULT];
4797 var defaultIterator = !BUGGY_SAFARI_ITERATORS && nativeIterator || getIterationMethod(DEFAULT);
4798 var anyNativeIterator = NAME == 'Array' ? IterablePrototype.entries || nativeIterator : nativeIterator;
4799 var CurrentIteratorPrototype, methods, KEY;
4800
4801 // fix native
4802 if (anyNativeIterator) {
4803 CurrentIteratorPrototype = getPrototypeOf(anyNativeIterator.call(new Iterable()));
4804 if (CurrentIteratorPrototype !== Object.prototype && CurrentIteratorPrototype.next) {
4805 if (!IS_PURE && getPrototypeOf(CurrentIteratorPrototype) !== IteratorPrototype) {
4806 if (setPrototypeOf) {
4807 setPrototypeOf(CurrentIteratorPrototype, IteratorPrototype);
4808 } else if (!isCallable(CurrentIteratorPrototype[ITERATOR])) {
4809 defineBuiltIn(CurrentIteratorPrototype, ITERATOR, returnThis);
4810 }
4811 }
4812 // Set @@toStringTag to native iterators
4813 setToStringTag(CurrentIteratorPrototype, TO_STRING_TAG, true, true);
4814 if (IS_PURE) Iterators[TO_STRING_TAG] = returnThis;
4815 }
4816 }
4817
4818 // fix Array.prototype.{ values, @@iterator }.name in V8 / FF
4819 if (PROPER_FUNCTION_NAME && DEFAULT == VALUES && nativeIterator && nativeIterator.name !== VALUES) {
4820 if (!IS_PURE && CONFIGURABLE_FUNCTION_NAME) {
4821 createNonEnumerableProperty(IterablePrototype, 'name', VALUES);
4822 } else {
4823 INCORRECT_VALUES_NAME = true;
4824 defaultIterator = function values() { return call(nativeIterator, this); };
4825 }
4826 }
4827
4828 // export additional methods
4829 if (DEFAULT) {
4830 methods = {
4831 values: getIterationMethod(VALUES),
4832 keys: IS_SET ? defaultIterator : getIterationMethod(KEYS),
4833 entries: getIterationMethod(ENTRIES)
4834 };
4835 if (FORCED) for (KEY in methods) {
4836 if (BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME || !(KEY in IterablePrototype)) {
4837 defineBuiltIn(IterablePrototype, KEY, methods[KEY]);
4838 }
4839 } else $({ target: NAME, proto: true, forced: BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME }, methods);
4840 }
4841
4842 // define iterator
4843 if ((!IS_PURE || FORCED) && IterablePrototype[ITERATOR] !== defaultIterator) {
4844 defineBuiltIn(IterablePrototype, ITERATOR, defaultIterator, { name: DEFAULT });
4845 }
4846 Iterators[NAME] = defaultIterator;
4847
4848 return methods;
4849};
4850
4851
4852/***/ }),
4853/* 134 */
4854/***/ (function(module, __webpack_exports__, __webpack_require__) {
4855
4856"use strict";
4857Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
4858/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(6);
4859/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "VERSION", function() { return __WEBPACK_IMPORTED_MODULE_0__setup_js__["e"]; });
4860/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__restArguments_js__ = __webpack_require__(24);
4861/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "restArguments", function() { return __WEBPACK_IMPORTED_MODULE_1__restArguments_js__["a"]; });
4862/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__isObject_js__ = __webpack_require__(58);
4863/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isObject", function() { return __WEBPACK_IMPORTED_MODULE_2__isObject_js__["a"]; });
4864/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__isNull_js__ = __webpack_require__(322);
4865/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isNull", function() { return __WEBPACK_IMPORTED_MODULE_3__isNull_js__["a"]; });
4866/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__isUndefined_js__ = __webpack_require__(179);
4867/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isUndefined", function() { return __WEBPACK_IMPORTED_MODULE_4__isUndefined_js__["a"]; });
4868/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__isBoolean_js__ = __webpack_require__(180);
4869/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isBoolean", function() { return __WEBPACK_IMPORTED_MODULE_5__isBoolean_js__["a"]; });
4870/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__isElement_js__ = __webpack_require__(323);
4871/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isElement", function() { return __WEBPACK_IMPORTED_MODULE_6__isElement_js__["a"]; });
4872/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__isString_js__ = __webpack_require__(135);
4873/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isString", function() { return __WEBPACK_IMPORTED_MODULE_7__isString_js__["a"]; });
4874/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__isNumber_js__ = __webpack_require__(181);
4875/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isNumber", function() { return __WEBPACK_IMPORTED_MODULE_8__isNumber_js__["a"]; });
4876/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__isDate_js__ = __webpack_require__(324);
4877/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isDate", function() { return __WEBPACK_IMPORTED_MODULE_9__isDate_js__["a"]; });
4878/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__isRegExp_js__ = __webpack_require__(325);
4879/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isRegExp", function() { return __WEBPACK_IMPORTED_MODULE_10__isRegExp_js__["a"]; });
4880/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__isError_js__ = __webpack_require__(326);
4881/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isError", function() { return __WEBPACK_IMPORTED_MODULE_11__isError_js__["a"]; });
4882/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__isSymbol_js__ = __webpack_require__(182);
4883/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isSymbol", function() { return __WEBPACK_IMPORTED_MODULE_12__isSymbol_js__["a"]; });
4884/* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__isArrayBuffer_js__ = __webpack_require__(183);
4885/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isArrayBuffer", function() { return __WEBPACK_IMPORTED_MODULE_13__isArrayBuffer_js__["a"]; });
4886/* harmony import */ var __WEBPACK_IMPORTED_MODULE_14__isDataView_js__ = __webpack_require__(136);
4887/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isDataView", function() { return __WEBPACK_IMPORTED_MODULE_14__isDataView_js__["a"]; });
4888/* harmony import */ var __WEBPACK_IMPORTED_MODULE_15__isArray_js__ = __webpack_require__(59);
4889/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isArray", function() { return __WEBPACK_IMPORTED_MODULE_15__isArray_js__["a"]; });
4890/* harmony import */ var __WEBPACK_IMPORTED_MODULE_16__isFunction_js__ = __webpack_require__(30);
4891/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isFunction", function() { return __WEBPACK_IMPORTED_MODULE_16__isFunction_js__["a"]; });
4892/* harmony import */ var __WEBPACK_IMPORTED_MODULE_17__isArguments_js__ = __webpack_require__(137);
4893/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isArguments", function() { return __WEBPACK_IMPORTED_MODULE_17__isArguments_js__["a"]; });
4894/* harmony import */ var __WEBPACK_IMPORTED_MODULE_18__isFinite_js__ = __webpack_require__(328);
4895/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isFinite", function() { return __WEBPACK_IMPORTED_MODULE_18__isFinite_js__["a"]; });
4896/* harmony import */ var __WEBPACK_IMPORTED_MODULE_19__isNaN_js__ = __webpack_require__(184);
4897/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isNaN", function() { return __WEBPACK_IMPORTED_MODULE_19__isNaN_js__["a"]; });
4898/* harmony import */ var __WEBPACK_IMPORTED_MODULE_20__isTypedArray_js__ = __webpack_require__(185);
4899/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isTypedArray", function() { return __WEBPACK_IMPORTED_MODULE_20__isTypedArray_js__["a"]; });
4900/* harmony import */ var __WEBPACK_IMPORTED_MODULE_21__isEmpty_js__ = __webpack_require__(330);
4901/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isEmpty", function() { return __WEBPACK_IMPORTED_MODULE_21__isEmpty_js__["a"]; });
4902/* harmony import */ var __WEBPACK_IMPORTED_MODULE_22__isMatch_js__ = __webpack_require__(190);
4903/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isMatch", function() { return __WEBPACK_IMPORTED_MODULE_22__isMatch_js__["a"]; });
4904/* harmony import */ var __WEBPACK_IMPORTED_MODULE_23__isEqual_js__ = __webpack_require__(331);
4905/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isEqual", function() { return __WEBPACK_IMPORTED_MODULE_23__isEqual_js__["a"]; });
4906/* harmony import */ var __WEBPACK_IMPORTED_MODULE_24__isMap_js__ = __webpack_require__(333);
4907/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isMap", function() { return __WEBPACK_IMPORTED_MODULE_24__isMap_js__["a"]; });
4908/* harmony import */ var __WEBPACK_IMPORTED_MODULE_25__isWeakMap_js__ = __webpack_require__(334);
4909/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isWeakMap", function() { return __WEBPACK_IMPORTED_MODULE_25__isWeakMap_js__["a"]; });
4910/* harmony import */ var __WEBPACK_IMPORTED_MODULE_26__isSet_js__ = __webpack_require__(335);
4911/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isSet", function() { return __WEBPACK_IMPORTED_MODULE_26__isSet_js__["a"]; });
4912/* harmony import */ var __WEBPACK_IMPORTED_MODULE_27__isWeakSet_js__ = __webpack_require__(336);
4913/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isWeakSet", function() { return __WEBPACK_IMPORTED_MODULE_27__isWeakSet_js__["a"]; });
4914/* harmony import */ var __WEBPACK_IMPORTED_MODULE_28__keys_js__ = __webpack_require__(17);
4915/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "keys", function() { return __WEBPACK_IMPORTED_MODULE_28__keys_js__["a"]; });
4916/* harmony import */ var __WEBPACK_IMPORTED_MODULE_29__allKeys_js__ = __webpack_require__(87);
4917/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "allKeys", function() { return __WEBPACK_IMPORTED_MODULE_29__allKeys_js__["a"]; });
4918/* harmony import */ var __WEBPACK_IMPORTED_MODULE_30__values_js__ = __webpack_require__(71);
4919/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "values", function() { return __WEBPACK_IMPORTED_MODULE_30__values_js__["a"]; });
4920/* harmony import */ var __WEBPACK_IMPORTED_MODULE_31__pairs_js__ = __webpack_require__(337);
4921/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "pairs", function() { return __WEBPACK_IMPORTED_MODULE_31__pairs_js__["a"]; });
4922/* harmony import */ var __WEBPACK_IMPORTED_MODULE_32__invert_js__ = __webpack_require__(191);
4923/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "invert", function() { return __WEBPACK_IMPORTED_MODULE_32__invert_js__["a"]; });
4924/* harmony import */ var __WEBPACK_IMPORTED_MODULE_33__functions_js__ = __webpack_require__(192);
4925/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "functions", function() { return __WEBPACK_IMPORTED_MODULE_33__functions_js__["a"]; });
4926/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "methods", function() { return __WEBPACK_IMPORTED_MODULE_33__functions_js__["a"]; });
4927/* harmony import */ var __WEBPACK_IMPORTED_MODULE_34__extend_js__ = __webpack_require__(193);
4928/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "extend", function() { return __WEBPACK_IMPORTED_MODULE_34__extend_js__["a"]; });
4929/* harmony import */ var __WEBPACK_IMPORTED_MODULE_35__extendOwn_js__ = __webpack_require__(141);
4930/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "extendOwn", function() { return __WEBPACK_IMPORTED_MODULE_35__extendOwn_js__["a"]; });
4931/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "assign", function() { return __WEBPACK_IMPORTED_MODULE_35__extendOwn_js__["a"]; });
4932/* harmony import */ var __WEBPACK_IMPORTED_MODULE_36__defaults_js__ = __webpack_require__(194);
4933/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "defaults", function() { return __WEBPACK_IMPORTED_MODULE_36__defaults_js__["a"]; });
4934/* harmony import */ var __WEBPACK_IMPORTED_MODULE_37__create_js__ = __webpack_require__(338);
4935/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "create", function() { return __WEBPACK_IMPORTED_MODULE_37__create_js__["a"]; });
4936/* harmony import */ var __WEBPACK_IMPORTED_MODULE_38__clone_js__ = __webpack_require__(196);
4937/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "clone", function() { return __WEBPACK_IMPORTED_MODULE_38__clone_js__["a"]; });
4938/* harmony import */ var __WEBPACK_IMPORTED_MODULE_39__tap_js__ = __webpack_require__(339);
4939/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "tap", function() { return __WEBPACK_IMPORTED_MODULE_39__tap_js__["a"]; });
4940/* harmony import */ var __WEBPACK_IMPORTED_MODULE_40__get_js__ = __webpack_require__(197);
4941/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "get", function() { return __WEBPACK_IMPORTED_MODULE_40__get_js__["a"]; });
4942/* harmony import */ var __WEBPACK_IMPORTED_MODULE_41__has_js__ = __webpack_require__(340);
4943/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "has", function() { return __WEBPACK_IMPORTED_MODULE_41__has_js__["a"]; });
4944/* harmony import */ var __WEBPACK_IMPORTED_MODULE_42__mapObject_js__ = __webpack_require__(341);
4945/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "mapObject", function() { return __WEBPACK_IMPORTED_MODULE_42__mapObject_js__["a"]; });
4946/* harmony import */ var __WEBPACK_IMPORTED_MODULE_43__identity_js__ = __webpack_require__(143);
4947/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "identity", function() { return __WEBPACK_IMPORTED_MODULE_43__identity_js__["a"]; });
4948/* harmony import */ var __WEBPACK_IMPORTED_MODULE_44__constant_js__ = __webpack_require__(186);
4949/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "constant", function() { return __WEBPACK_IMPORTED_MODULE_44__constant_js__["a"]; });
4950/* harmony import */ var __WEBPACK_IMPORTED_MODULE_45__noop_js__ = __webpack_require__(201);
4951/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "noop", function() { return __WEBPACK_IMPORTED_MODULE_45__noop_js__["a"]; });
4952/* harmony import */ var __WEBPACK_IMPORTED_MODULE_46__toPath_js__ = __webpack_require__(198);
4953/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "toPath", function() { return __WEBPACK_IMPORTED_MODULE_46__toPath_js__["a"]; });
4954/* harmony import */ var __WEBPACK_IMPORTED_MODULE_47__property_js__ = __webpack_require__(144);
4955/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "property", function() { return __WEBPACK_IMPORTED_MODULE_47__property_js__["a"]; });
4956/* harmony import */ var __WEBPACK_IMPORTED_MODULE_48__propertyOf_js__ = __webpack_require__(342);
4957/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "propertyOf", function() { return __WEBPACK_IMPORTED_MODULE_48__propertyOf_js__["a"]; });
4958/* harmony import */ var __WEBPACK_IMPORTED_MODULE_49__matcher_js__ = __webpack_require__(113);
4959/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "matcher", function() { return __WEBPACK_IMPORTED_MODULE_49__matcher_js__["a"]; });
4960/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "matches", function() { return __WEBPACK_IMPORTED_MODULE_49__matcher_js__["a"]; });
4961/* harmony import */ var __WEBPACK_IMPORTED_MODULE_50__times_js__ = __webpack_require__(343);
4962/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "times", function() { return __WEBPACK_IMPORTED_MODULE_50__times_js__["a"]; });
4963/* harmony import */ var __WEBPACK_IMPORTED_MODULE_51__random_js__ = __webpack_require__(202);
4964/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "random", function() { return __WEBPACK_IMPORTED_MODULE_51__random_js__["a"]; });
4965/* harmony import */ var __WEBPACK_IMPORTED_MODULE_52__now_js__ = __webpack_require__(145);
4966/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "now", function() { return __WEBPACK_IMPORTED_MODULE_52__now_js__["a"]; });
4967/* harmony import */ var __WEBPACK_IMPORTED_MODULE_53__escape_js__ = __webpack_require__(344);
4968/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "escape", function() { return __WEBPACK_IMPORTED_MODULE_53__escape_js__["a"]; });
4969/* harmony import */ var __WEBPACK_IMPORTED_MODULE_54__unescape_js__ = __webpack_require__(345);
4970/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "unescape", function() { return __WEBPACK_IMPORTED_MODULE_54__unescape_js__["a"]; });
4971/* harmony import */ var __WEBPACK_IMPORTED_MODULE_55__templateSettings_js__ = __webpack_require__(205);
4972/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "templateSettings", function() { return __WEBPACK_IMPORTED_MODULE_55__templateSettings_js__["a"]; });
4973/* harmony import */ var __WEBPACK_IMPORTED_MODULE_56__template_js__ = __webpack_require__(347);
4974/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "template", function() { return __WEBPACK_IMPORTED_MODULE_56__template_js__["a"]; });
4975/* harmony import */ var __WEBPACK_IMPORTED_MODULE_57__result_js__ = __webpack_require__(348);
4976/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "result", function() { return __WEBPACK_IMPORTED_MODULE_57__result_js__["a"]; });
4977/* harmony import */ var __WEBPACK_IMPORTED_MODULE_58__uniqueId_js__ = __webpack_require__(349);
4978/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "uniqueId", function() { return __WEBPACK_IMPORTED_MODULE_58__uniqueId_js__["a"]; });
4979/* harmony import */ var __WEBPACK_IMPORTED_MODULE_59__chain_js__ = __webpack_require__(350);
4980/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "chain", function() { return __WEBPACK_IMPORTED_MODULE_59__chain_js__["a"]; });
4981/* harmony import */ var __WEBPACK_IMPORTED_MODULE_60__iteratee_js__ = __webpack_require__(200);
4982/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "iteratee", function() { return __WEBPACK_IMPORTED_MODULE_60__iteratee_js__["a"]; });
4983/* harmony import */ var __WEBPACK_IMPORTED_MODULE_61__partial_js__ = __webpack_require__(114);
4984/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "partial", function() { return __WEBPACK_IMPORTED_MODULE_61__partial_js__["a"]; });
4985/* harmony import */ var __WEBPACK_IMPORTED_MODULE_62__bind_js__ = __webpack_require__(207);
4986/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "bind", function() { return __WEBPACK_IMPORTED_MODULE_62__bind_js__["a"]; });
4987/* harmony import */ var __WEBPACK_IMPORTED_MODULE_63__bindAll_js__ = __webpack_require__(351);
4988/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "bindAll", function() { return __WEBPACK_IMPORTED_MODULE_63__bindAll_js__["a"]; });
4989/* harmony import */ var __WEBPACK_IMPORTED_MODULE_64__memoize_js__ = __webpack_require__(352);
4990/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "memoize", function() { return __WEBPACK_IMPORTED_MODULE_64__memoize_js__["a"]; });
4991/* harmony import */ var __WEBPACK_IMPORTED_MODULE_65__delay_js__ = __webpack_require__(208);
4992/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "delay", function() { return __WEBPACK_IMPORTED_MODULE_65__delay_js__["a"]; });
4993/* harmony import */ var __WEBPACK_IMPORTED_MODULE_66__defer_js__ = __webpack_require__(353);
4994/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "defer", function() { return __WEBPACK_IMPORTED_MODULE_66__defer_js__["a"]; });
4995/* harmony import */ var __WEBPACK_IMPORTED_MODULE_67__throttle_js__ = __webpack_require__(354);
4996/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "throttle", function() { return __WEBPACK_IMPORTED_MODULE_67__throttle_js__["a"]; });
4997/* harmony import */ var __WEBPACK_IMPORTED_MODULE_68__debounce_js__ = __webpack_require__(355);
4998/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "debounce", function() { return __WEBPACK_IMPORTED_MODULE_68__debounce_js__["a"]; });
4999/* harmony import */ var __WEBPACK_IMPORTED_MODULE_69__wrap_js__ = __webpack_require__(356);
5000/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "wrap", function() { return __WEBPACK_IMPORTED_MODULE_69__wrap_js__["a"]; });
5001/* harmony import */ var __WEBPACK_IMPORTED_MODULE_70__negate_js__ = __webpack_require__(146);
5002/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "negate", function() { return __WEBPACK_IMPORTED_MODULE_70__negate_js__["a"]; });
5003/* harmony import */ var __WEBPACK_IMPORTED_MODULE_71__compose_js__ = __webpack_require__(357);
5004/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "compose", function() { return __WEBPACK_IMPORTED_MODULE_71__compose_js__["a"]; });
5005/* harmony import */ var __WEBPACK_IMPORTED_MODULE_72__after_js__ = __webpack_require__(358);
5006/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "after", function() { return __WEBPACK_IMPORTED_MODULE_72__after_js__["a"]; });
5007/* harmony import */ var __WEBPACK_IMPORTED_MODULE_73__before_js__ = __webpack_require__(209);
5008/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "before", function() { return __WEBPACK_IMPORTED_MODULE_73__before_js__["a"]; });
5009/* harmony import */ var __WEBPACK_IMPORTED_MODULE_74__once_js__ = __webpack_require__(359);
5010/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "once", function() { return __WEBPACK_IMPORTED_MODULE_74__once_js__["a"]; });
5011/* harmony import */ var __WEBPACK_IMPORTED_MODULE_75__findKey_js__ = __webpack_require__(210);
5012/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "findKey", function() { return __WEBPACK_IMPORTED_MODULE_75__findKey_js__["a"]; });
5013/* harmony import */ var __WEBPACK_IMPORTED_MODULE_76__findIndex_js__ = __webpack_require__(147);
5014/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "findIndex", function() { return __WEBPACK_IMPORTED_MODULE_76__findIndex_js__["a"]; });
5015/* harmony import */ var __WEBPACK_IMPORTED_MODULE_77__findLastIndex_js__ = __webpack_require__(212);
5016/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "findLastIndex", function() { return __WEBPACK_IMPORTED_MODULE_77__findLastIndex_js__["a"]; });
5017/* harmony import */ var __WEBPACK_IMPORTED_MODULE_78__sortedIndex_js__ = __webpack_require__(213);
5018/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "sortedIndex", function() { return __WEBPACK_IMPORTED_MODULE_78__sortedIndex_js__["a"]; });
5019/* harmony import */ var __WEBPACK_IMPORTED_MODULE_79__indexOf_js__ = __webpack_require__(214);
5020/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "indexOf", function() { return __WEBPACK_IMPORTED_MODULE_79__indexOf_js__["a"]; });
5021/* harmony import */ var __WEBPACK_IMPORTED_MODULE_80__lastIndexOf_js__ = __webpack_require__(360);
5022/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "lastIndexOf", function() { return __WEBPACK_IMPORTED_MODULE_80__lastIndexOf_js__["a"]; });
5023/* harmony import */ var __WEBPACK_IMPORTED_MODULE_81__find_js__ = __webpack_require__(216);
5024/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "find", function() { return __WEBPACK_IMPORTED_MODULE_81__find_js__["a"]; });
5025/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "detect", function() { return __WEBPACK_IMPORTED_MODULE_81__find_js__["a"]; });
5026/* harmony import */ var __WEBPACK_IMPORTED_MODULE_82__findWhere_js__ = __webpack_require__(361);
5027/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "findWhere", function() { return __WEBPACK_IMPORTED_MODULE_82__findWhere_js__["a"]; });
5028/* harmony import */ var __WEBPACK_IMPORTED_MODULE_83__each_js__ = __webpack_require__(60);
5029/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "each", function() { return __WEBPACK_IMPORTED_MODULE_83__each_js__["a"]; });
5030/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "forEach", function() { return __WEBPACK_IMPORTED_MODULE_83__each_js__["a"]; });
5031/* harmony import */ var __WEBPACK_IMPORTED_MODULE_84__map_js__ = __webpack_require__(73);
5032/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "map", function() { return __WEBPACK_IMPORTED_MODULE_84__map_js__["a"]; });
5033/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "collect", function() { return __WEBPACK_IMPORTED_MODULE_84__map_js__["a"]; });
5034/* harmony import */ var __WEBPACK_IMPORTED_MODULE_85__reduce_js__ = __webpack_require__(362);
5035/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "reduce", function() { return __WEBPACK_IMPORTED_MODULE_85__reduce_js__["a"]; });
5036/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "foldl", function() { return __WEBPACK_IMPORTED_MODULE_85__reduce_js__["a"]; });
5037/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "inject", function() { return __WEBPACK_IMPORTED_MODULE_85__reduce_js__["a"]; });
5038/* harmony import */ var __WEBPACK_IMPORTED_MODULE_86__reduceRight_js__ = __webpack_require__(363);
5039/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "reduceRight", function() { return __WEBPACK_IMPORTED_MODULE_86__reduceRight_js__["a"]; });
5040/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "foldr", function() { return __WEBPACK_IMPORTED_MODULE_86__reduceRight_js__["a"]; });
5041/* harmony import */ var __WEBPACK_IMPORTED_MODULE_87__filter_js__ = __webpack_require__(90);
5042/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "filter", function() { return __WEBPACK_IMPORTED_MODULE_87__filter_js__["a"]; });
5043/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "select", function() { return __WEBPACK_IMPORTED_MODULE_87__filter_js__["a"]; });
5044/* harmony import */ var __WEBPACK_IMPORTED_MODULE_88__reject_js__ = __webpack_require__(364);
5045/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "reject", function() { return __WEBPACK_IMPORTED_MODULE_88__reject_js__["a"]; });
5046/* harmony import */ var __WEBPACK_IMPORTED_MODULE_89__every_js__ = __webpack_require__(365);
5047/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "every", function() { return __WEBPACK_IMPORTED_MODULE_89__every_js__["a"]; });
5048/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "all", function() { return __WEBPACK_IMPORTED_MODULE_89__every_js__["a"]; });
5049/* harmony import */ var __WEBPACK_IMPORTED_MODULE_90__some_js__ = __webpack_require__(366);
5050/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "some", function() { return __WEBPACK_IMPORTED_MODULE_90__some_js__["a"]; });
5051/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "any", function() { return __WEBPACK_IMPORTED_MODULE_90__some_js__["a"]; });
5052/* harmony import */ var __WEBPACK_IMPORTED_MODULE_91__contains_js__ = __webpack_require__(91);
5053/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "contains", function() { return __WEBPACK_IMPORTED_MODULE_91__contains_js__["a"]; });
5054/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "includes", function() { return __WEBPACK_IMPORTED_MODULE_91__contains_js__["a"]; });
5055/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "include", function() { return __WEBPACK_IMPORTED_MODULE_91__contains_js__["a"]; });
5056/* harmony import */ var __WEBPACK_IMPORTED_MODULE_92__invoke_js__ = __webpack_require__(367);
5057/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "invoke", function() { return __WEBPACK_IMPORTED_MODULE_92__invoke_js__["a"]; });
5058/* harmony import */ var __WEBPACK_IMPORTED_MODULE_93__pluck_js__ = __webpack_require__(148);
5059/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "pluck", function() { return __WEBPACK_IMPORTED_MODULE_93__pluck_js__["a"]; });
5060/* harmony import */ var __WEBPACK_IMPORTED_MODULE_94__where_js__ = __webpack_require__(368);
5061/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "where", function() { return __WEBPACK_IMPORTED_MODULE_94__where_js__["a"]; });
5062/* harmony import */ var __WEBPACK_IMPORTED_MODULE_95__max_js__ = __webpack_require__(218);
5063/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "max", function() { return __WEBPACK_IMPORTED_MODULE_95__max_js__["a"]; });
5064/* harmony import */ var __WEBPACK_IMPORTED_MODULE_96__min_js__ = __webpack_require__(369);
5065/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "min", function() { return __WEBPACK_IMPORTED_MODULE_96__min_js__["a"]; });
5066/* harmony import */ var __WEBPACK_IMPORTED_MODULE_97__shuffle_js__ = __webpack_require__(370);
5067/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "shuffle", function() { return __WEBPACK_IMPORTED_MODULE_97__shuffle_js__["a"]; });
5068/* harmony import */ var __WEBPACK_IMPORTED_MODULE_98__sample_js__ = __webpack_require__(219);
5069/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "sample", function() { return __WEBPACK_IMPORTED_MODULE_98__sample_js__["a"]; });
5070/* harmony import */ var __WEBPACK_IMPORTED_MODULE_99__sortBy_js__ = __webpack_require__(371);
5071/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "sortBy", function() { return __WEBPACK_IMPORTED_MODULE_99__sortBy_js__["a"]; });
5072/* harmony import */ var __WEBPACK_IMPORTED_MODULE_100__groupBy_js__ = __webpack_require__(372);
5073/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "groupBy", function() { return __WEBPACK_IMPORTED_MODULE_100__groupBy_js__["a"]; });
5074/* harmony import */ var __WEBPACK_IMPORTED_MODULE_101__indexBy_js__ = __webpack_require__(373);
5075/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "indexBy", function() { return __WEBPACK_IMPORTED_MODULE_101__indexBy_js__["a"]; });
5076/* harmony import */ var __WEBPACK_IMPORTED_MODULE_102__countBy_js__ = __webpack_require__(374);
5077/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "countBy", function() { return __WEBPACK_IMPORTED_MODULE_102__countBy_js__["a"]; });
5078/* harmony import */ var __WEBPACK_IMPORTED_MODULE_103__partition_js__ = __webpack_require__(375);
5079/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "partition", function() { return __WEBPACK_IMPORTED_MODULE_103__partition_js__["a"]; });
5080/* harmony import */ var __WEBPACK_IMPORTED_MODULE_104__toArray_js__ = __webpack_require__(376);
5081/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "toArray", function() { return __WEBPACK_IMPORTED_MODULE_104__toArray_js__["a"]; });
5082/* harmony import */ var __WEBPACK_IMPORTED_MODULE_105__size_js__ = __webpack_require__(377);
5083/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "size", function() { return __WEBPACK_IMPORTED_MODULE_105__size_js__["a"]; });
5084/* harmony import */ var __WEBPACK_IMPORTED_MODULE_106__pick_js__ = __webpack_require__(220);
5085/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "pick", function() { return __WEBPACK_IMPORTED_MODULE_106__pick_js__["a"]; });
5086/* harmony import */ var __WEBPACK_IMPORTED_MODULE_107__omit_js__ = __webpack_require__(379);
5087/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "omit", function() { return __WEBPACK_IMPORTED_MODULE_107__omit_js__["a"]; });
5088/* harmony import */ var __WEBPACK_IMPORTED_MODULE_108__first_js__ = __webpack_require__(380);
5089/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "first", function() { return __WEBPACK_IMPORTED_MODULE_108__first_js__["a"]; });
5090/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "head", function() { return __WEBPACK_IMPORTED_MODULE_108__first_js__["a"]; });
5091/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "take", function() { return __WEBPACK_IMPORTED_MODULE_108__first_js__["a"]; });
5092/* harmony import */ var __WEBPACK_IMPORTED_MODULE_109__initial_js__ = __webpack_require__(221);
5093/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "initial", function() { return __WEBPACK_IMPORTED_MODULE_109__initial_js__["a"]; });
5094/* harmony import */ var __WEBPACK_IMPORTED_MODULE_110__last_js__ = __webpack_require__(381);
5095/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "last", function() { return __WEBPACK_IMPORTED_MODULE_110__last_js__["a"]; });
5096/* harmony import */ var __WEBPACK_IMPORTED_MODULE_111__rest_js__ = __webpack_require__(222);
5097/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "rest", function() { return __WEBPACK_IMPORTED_MODULE_111__rest_js__["a"]; });
5098/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "tail", function() { return __WEBPACK_IMPORTED_MODULE_111__rest_js__["a"]; });
5099/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "drop", function() { return __WEBPACK_IMPORTED_MODULE_111__rest_js__["a"]; });
5100/* harmony import */ var __WEBPACK_IMPORTED_MODULE_112__compact_js__ = __webpack_require__(382);
5101/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "compact", function() { return __WEBPACK_IMPORTED_MODULE_112__compact_js__["a"]; });
5102/* harmony import */ var __WEBPACK_IMPORTED_MODULE_113__flatten_js__ = __webpack_require__(383);
5103/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "flatten", function() { return __WEBPACK_IMPORTED_MODULE_113__flatten_js__["a"]; });
5104/* harmony import */ var __WEBPACK_IMPORTED_MODULE_114__without_js__ = __webpack_require__(384);
5105/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "without", function() { return __WEBPACK_IMPORTED_MODULE_114__without_js__["a"]; });
5106/* harmony import */ var __WEBPACK_IMPORTED_MODULE_115__uniq_js__ = __webpack_require__(224);
5107/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "uniq", function() { return __WEBPACK_IMPORTED_MODULE_115__uniq_js__["a"]; });
5108/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "unique", function() { return __WEBPACK_IMPORTED_MODULE_115__uniq_js__["a"]; });
5109/* harmony import */ var __WEBPACK_IMPORTED_MODULE_116__union_js__ = __webpack_require__(385);
5110/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "union", function() { return __WEBPACK_IMPORTED_MODULE_116__union_js__["a"]; });
5111/* harmony import */ var __WEBPACK_IMPORTED_MODULE_117__intersection_js__ = __webpack_require__(386);
5112/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "intersection", function() { return __WEBPACK_IMPORTED_MODULE_117__intersection_js__["a"]; });
5113/* harmony import */ var __WEBPACK_IMPORTED_MODULE_118__difference_js__ = __webpack_require__(223);
5114/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "difference", function() { return __WEBPACK_IMPORTED_MODULE_118__difference_js__["a"]; });
5115/* harmony import */ var __WEBPACK_IMPORTED_MODULE_119__unzip_js__ = __webpack_require__(225);
5116/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "unzip", function() { return __WEBPACK_IMPORTED_MODULE_119__unzip_js__["a"]; });
5117/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "transpose", function() { return __WEBPACK_IMPORTED_MODULE_119__unzip_js__["a"]; });
5118/* harmony import */ var __WEBPACK_IMPORTED_MODULE_120__zip_js__ = __webpack_require__(387);
5119/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "zip", function() { return __WEBPACK_IMPORTED_MODULE_120__zip_js__["a"]; });
5120/* harmony import */ var __WEBPACK_IMPORTED_MODULE_121__object_js__ = __webpack_require__(388);
5121/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "object", function() { return __WEBPACK_IMPORTED_MODULE_121__object_js__["a"]; });
5122/* harmony import */ var __WEBPACK_IMPORTED_MODULE_122__range_js__ = __webpack_require__(389);
5123/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "range", function() { return __WEBPACK_IMPORTED_MODULE_122__range_js__["a"]; });
5124/* harmony import */ var __WEBPACK_IMPORTED_MODULE_123__chunk_js__ = __webpack_require__(390);
5125/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "chunk", function() { return __WEBPACK_IMPORTED_MODULE_123__chunk_js__["a"]; });
5126/* harmony import */ var __WEBPACK_IMPORTED_MODULE_124__mixin_js__ = __webpack_require__(391);
5127/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "mixin", function() { return __WEBPACK_IMPORTED_MODULE_124__mixin_js__["a"]; });
5128/* harmony import */ var __WEBPACK_IMPORTED_MODULE_125__underscore_array_methods_js__ = __webpack_require__(392);
5129/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return __WEBPACK_IMPORTED_MODULE_125__underscore_array_methods_js__["a"]; });
5130// Named Exports
5131// =============
5132
5133// Underscore.js 1.12.1
5134// https://underscorejs.org
5135// (c) 2009-2020 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
5136// Underscore may be freely distributed under the MIT license.
5137
5138// Baseline setup.
5139
5140
5141
5142// Object Functions
5143// ----------------
5144// Our most fundamental functions operate on any JavaScript object.
5145// Most functions in Underscore depend on at least one function in this section.
5146
5147// A group of functions that check the types of core JavaScript values.
5148// These are often informally referred to as the "isType" functions.
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176// Functions that treat an object as a dictionary of key-value pairs.
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193// Utility Functions
5194// -----------------
5195// A bit of a grab bag: Predicate-generating functions for use with filters and
5196// loops, string escaping and templating, create random numbers and unique ids,
5197// and functions that facilitate Underscore's chaining and iteration conventions.
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217// Function (ahem) Functions
5218// -------------------------
5219// These functions take a function as an argument and return a new function
5220// as the result. Also known as higher-order functions.
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236// Finders
5237// -------
5238// Functions that extract (the position of) a single element from an object
5239// or array based on some criterion.
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249// Collection Functions
5250// --------------------
5251// Functions that work on any collection of elements: either an array, or
5252// an object of key-value pairs.
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277// `_.pick` and `_.omit` are actually object functions, but we put
5278// them here in order to create a more natural reading order in the
5279// monolithic build as they depend on `_.contains`.
5280
5281
5282
5283// Array Functions
5284// ---------------
5285// Functions that operate on arrays (and array-likes) only, because they’re
5286// expressed in terms of operations on an ordered list of values.
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304// OOP
5305// ---
5306// These modules support the "object-oriented" calling style. See also
5307// `underscore.js` and `index-default.js`.
5308
5309
5310
5311
5312/***/ }),
5313/* 135 */
5314/***/ (function(module, __webpack_exports__, __webpack_require__) {
5315
5316"use strict";
5317/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(18);
5318
5319
5320/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('String'));
5321
5322
5323/***/ }),
5324/* 136 */
5325/***/ (function(module, __webpack_exports__, __webpack_require__) {
5326
5327"use strict";
5328/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(18);
5329/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isFunction_js__ = __webpack_require__(30);
5330/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__isArrayBuffer_js__ = __webpack_require__(183);
5331/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__stringTagBug_js__ = __webpack_require__(86);
5332
5333
5334
5335
5336
5337var isDataView = Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('DataView');
5338
5339// In IE 10 - Edge 13, we need a different heuristic
5340// to determine whether an object is a `DataView`.
5341function ie10IsDataView(obj) {
5342 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);
5343}
5344
5345/* harmony default export */ __webpack_exports__["a"] = (__WEBPACK_IMPORTED_MODULE_3__stringTagBug_js__["a" /* hasStringTagBug */] ? ie10IsDataView : isDataView);
5346
5347
5348/***/ }),
5349/* 137 */
5350/***/ (function(module, __webpack_exports__, __webpack_require__) {
5351
5352"use strict";
5353/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(18);
5354/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__has_js__ = __webpack_require__(47);
5355
5356
5357
5358var isArguments = Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('Arguments');
5359
5360// Define a fallback version of the method in browsers (ahem, IE < 9), where
5361// there isn't any inspectable "Arguments" type.
5362(function() {
5363 if (!isArguments(arguments)) {
5364 isArguments = function(obj) {
5365 return Object(__WEBPACK_IMPORTED_MODULE_1__has_js__["a" /* default */])(obj, 'callee');
5366 };
5367 }
5368}());
5369
5370/* harmony default export */ __webpack_exports__["a"] = (isArguments);
5371
5372
5373/***/ }),
5374/* 138 */
5375/***/ (function(module, __webpack_exports__, __webpack_require__) {
5376
5377"use strict";
5378/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__shallowProperty_js__ = __webpack_require__(188);
5379
5380
5381// Internal helper to obtain the `byteLength` property of an object.
5382/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__shallowProperty_js__["a" /* default */])('byteLength'));
5383
5384
5385/***/ }),
5386/* 139 */
5387/***/ (function(module, __webpack_exports__, __webpack_require__) {
5388
5389"use strict";
5390/* harmony export (immutable) */ __webpack_exports__["a"] = ie11fingerprint;
5391/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return mapMethods; });
5392/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return weakMapMethods; });
5393/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return setMethods; });
5394/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__getLength_js__ = __webpack_require__(31);
5395/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isFunction_js__ = __webpack_require__(30);
5396/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__allKeys_js__ = __webpack_require__(87);
5397
5398
5399
5400
5401// Since the regular `Object.prototype.toString` type tests don't work for
5402// some types in IE 11, we use a fingerprinting heuristic instead, based
5403// on the methods. It's not great, but it's the best we got.
5404// The fingerprint method lists are defined below.
5405function ie11fingerprint(methods) {
5406 var length = Object(__WEBPACK_IMPORTED_MODULE_0__getLength_js__["a" /* default */])(methods);
5407 return function(obj) {
5408 if (obj == null) return false;
5409 // `Map`, `WeakMap` and `Set` have no enumerable keys.
5410 var keys = Object(__WEBPACK_IMPORTED_MODULE_2__allKeys_js__["a" /* default */])(obj);
5411 if (Object(__WEBPACK_IMPORTED_MODULE_0__getLength_js__["a" /* default */])(keys)) return false;
5412 for (var i = 0; i < length; i++) {
5413 if (!Object(__WEBPACK_IMPORTED_MODULE_1__isFunction_js__["a" /* default */])(obj[methods[i]])) return false;
5414 }
5415 // If we are testing against `WeakMap`, we need to ensure that
5416 // `obj` doesn't have a `forEach` method in order to distinguish
5417 // it from a regular `Map`.
5418 return methods !== weakMapMethods || !Object(__WEBPACK_IMPORTED_MODULE_1__isFunction_js__["a" /* default */])(obj[forEachName]);
5419 };
5420}
5421
5422// In the interest of compact minification, we write
5423// each string in the fingerprints only once.
5424var forEachName = 'forEach',
5425 hasName = 'has',
5426 commonInit = ['clear', 'delete'],
5427 mapTail = ['get', hasName, 'set'];
5428
5429// `Map`, `WeakMap` and `Set` each have slightly different
5430// combinations of the above sublists.
5431var mapMethods = commonInit.concat(forEachName, mapTail),
5432 weakMapMethods = commonInit.concat(mapTail),
5433 setMethods = ['add'].concat(commonInit, forEachName, hasName);
5434
5435
5436/***/ }),
5437/* 140 */
5438/***/ (function(module, __webpack_exports__, __webpack_require__) {
5439
5440"use strict";
5441/* harmony export (immutable) */ __webpack_exports__["a"] = createAssigner;
5442// An internal function for creating assigner functions.
5443function createAssigner(keysFunc, defaults) {
5444 return function(obj) {
5445 var length = arguments.length;
5446 if (defaults) obj = Object(obj);
5447 if (length < 2 || obj == null) return obj;
5448 for (var index = 1; index < length; index++) {
5449 var source = arguments[index],
5450 keys = keysFunc(source),
5451 l = keys.length;
5452 for (var i = 0; i < l; i++) {
5453 var key = keys[i];
5454 if (!defaults || obj[key] === void 0) obj[key] = source[key];
5455 }
5456 }
5457 return obj;
5458 };
5459}
5460
5461
5462/***/ }),
5463/* 141 */
5464/***/ (function(module, __webpack_exports__, __webpack_require__) {
5465
5466"use strict";
5467/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createAssigner_js__ = __webpack_require__(140);
5468/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__keys_js__ = __webpack_require__(17);
5469
5470
5471
5472// Assigns a given object with all the own properties in the passed-in
5473// object(s).
5474// (https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object/assign)
5475/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createAssigner_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__keys_js__["a" /* default */]));
5476
5477
5478/***/ }),
5479/* 142 */
5480/***/ (function(module, __webpack_exports__, __webpack_require__) {
5481
5482"use strict";
5483/* harmony export (immutable) */ __webpack_exports__["a"] = deepGet;
5484// Internal function to obtain a nested property in `obj` along `path`.
5485function deepGet(obj, path) {
5486 var length = path.length;
5487 for (var i = 0; i < length; i++) {
5488 if (obj == null) return void 0;
5489 obj = obj[path[i]];
5490 }
5491 return length ? obj : void 0;
5492}
5493
5494
5495/***/ }),
5496/* 143 */
5497/***/ (function(module, __webpack_exports__, __webpack_require__) {
5498
5499"use strict";
5500/* harmony export (immutable) */ __webpack_exports__["a"] = identity;
5501// Keep the identity function around for default iteratees.
5502function identity(value) {
5503 return value;
5504}
5505
5506
5507/***/ }),
5508/* 144 */
5509/***/ (function(module, __webpack_exports__, __webpack_require__) {
5510
5511"use strict";
5512/* harmony export (immutable) */ __webpack_exports__["a"] = property;
5513/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__deepGet_js__ = __webpack_require__(142);
5514/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__toPath_js__ = __webpack_require__(88);
5515
5516
5517
5518// Creates a function that, when passed an object, will traverse that object’s
5519// properties down the given `path`, specified as an array of keys or indices.
5520function property(path) {
5521 path = Object(__WEBPACK_IMPORTED_MODULE_1__toPath_js__["a" /* default */])(path);
5522 return function(obj) {
5523 return Object(__WEBPACK_IMPORTED_MODULE_0__deepGet_js__["a" /* default */])(obj, path);
5524 };
5525}
5526
5527
5528/***/ }),
5529/* 145 */
5530/***/ (function(module, __webpack_exports__, __webpack_require__) {
5531
5532"use strict";
5533// A (possibly faster) way to get the current timestamp as an integer.
5534/* harmony default export */ __webpack_exports__["a"] = (Date.now || function() {
5535 return new Date().getTime();
5536});
5537
5538
5539/***/ }),
5540/* 146 */
5541/***/ (function(module, __webpack_exports__, __webpack_require__) {
5542
5543"use strict";
5544/* harmony export (immutable) */ __webpack_exports__["a"] = negate;
5545// Returns a negated version of the passed-in predicate.
5546function negate(predicate) {
5547 return function() {
5548 return !predicate.apply(this, arguments);
5549 };
5550}
5551
5552
5553/***/ }),
5554/* 147 */
5555/***/ (function(module, __webpack_exports__, __webpack_require__) {
5556
5557"use strict";
5558/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createPredicateIndexFinder_js__ = __webpack_require__(211);
5559
5560
5561// Returns the first index on an array-like that passes a truth test.
5562/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createPredicateIndexFinder_js__["a" /* default */])(1));
5563
5564
5565/***/ }),
5566/* 148 */
5567/***/ (function(module, __webpack_exports__, __webpack_require__) {
5568
5569"use strict";
5570/* harmony export (immutable) */ __webpack_exports__["a"] = pluck;
5571/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__map_js__ = __webpack_require__(73);
5572/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__property_js__ = __webpack_require__(144);
5573
5574
5575
5576// Convenience version of a common use case of `_.map`: fetching a property.
5577function pluck(obj, key) {
5578 return Object(__WEBPACK_IMPORTED_MODULE_0__map_js__["a" /* default */])(obj, Object(__WEBPACK_IMPORTED_MODULE_1__property_js__["a" /* default */])(key));
5579}
5580
5581
5582/***/ }),
5583/* 149 */
5584/***/ (function(module, exports, __webpack_require__) {
5585
5586module.exports = __webpack_require__(402);
5587
5588/***/ }),
5589/* 150 */
5590/***/ (function(module, exports, __webpack_require__) {
5591
5592"use strict";
5593
5594var fails = __webpack_require__(2);
5595
5596module.exports = function (METHOD_NAME, argument) {
5597 var method = [][METHOD_NAME];
5598 return !!method && fails(function () {
5599 // eslint-disable-next-line no-useless-call -- required for testing
5600 method.call(null, argument || function () { return 1; }, 1);
5601 });
5602};
5603
5604
5605/***/ }),
5606/* 151 */
5607/***/ (function(module, exports, __webpack_require__) {
5608
5609var wellKnownSymbol = __webpack_require__(5);
5610
5611exports.f = wellKnownSymbol;
5612
5613
5614/***/ }),
5615/* 152 */
5616/***/ (function(module, exports, __webpack_require__) {
5617
5618module.exports = __webpack_require__(251);
5619
5620/***/ }),
5621/* 153 */
5622/***/ (function(module, exports, __webpack_require__) {
5623
5624module.exports = __webpack_require__(504);
5625
5626/***/ }),
5627/* 154 */
5628/***/ (function(module, exports, __webpack_require__) {
5629
5630module.exports = __webpack_require__(248);
5631
5632/***/ }),
5633/* 155 */
5634/***/ (function(module, exports, __webpack_require__) {
5635
5636"use strict";
5637
5638
5639module.exports = __webpack_require__(621);
5640
5641/***/ }),
5642/* 156 */
5643/***/ (function(module, exports, __webpack_require__) {
5644
5645var defineBuiltIn = __webpack_require__(45);
5646
5647module.exports = function (target, src, options) {
5648 for (var key in src) {
5649 if (options && options.unsafe && target[key]) target[key] = src[key];
5650 else defineBuiltIn(target, key, src[key], options);
5651 } return target;
5652};
5653
5654
5655/***/ }),
5656/* 157 */
5657/***/ (function(module, exports, __webpack_require__) {
5658
5659/* eslint-disable es-x/no-symbol -- required for testing */
5660var NATIVE_SYMBOL = __webpack_require__(65);
5661
5662module.exports = NATIVE_SYMBOL
5663 && !Symbol.sham
5664 && typeof Symbol.iterator == 'symbol';
5665
5666
5667/***/ }),
5668/* 158 */
5669/***/ (function(module, exports, __webpack_require__) {
5670
5671var DESCRIPTORS = __webpack_require__(14);
5672var fails = __webpack_require__(2);
5673var createElement = __webpack_require__(124);
5674
5675// Thanks to IE8 for its funny defineProperty
5676module.exports = !DESCRIPTORS && !fails(function () {
5677 // eslint-disable-next-line es-x/no-object-defineproperty -- required for testing
5678 return Object.defineProperty(createElement('div'), 'a', {
5679 get: function () { return 7; }
5680 }).a != 7;
5681});
5682
5683
5684/***/ }),
5685/* 159 */
5686/***/ (function(module, exports, __webpack_require__) {
5687
5688var fails = __webpack_require__(2);
5689var isCallable = __webpack_require__(9);
5690
5691var replacement = /#|\.prototype\./;
5692
5693var isForced = function (feature, detection) {
5694 var value = data[normalize(feature)];
5695 return value == POLYFILL ? true
5696 : value == NATIVE ? false
5697 : isCallable(detection) ? fails(detection)
5698 : !!detection;
5699};
5700
5701var normalize = isForced.normalize = function (string) {
5702 return String(string).replace(replacement, '.').toLowerCase();
5703};
5704
5705var data = isForced.data = {};
5706var NATIVE = isForced.NATIVE = 'N';
5707var POLYFILL = isForced.POLYFILL = 'P';
5708
5709module.exports = isForced;
5710
5711
5712/***/ }),
5713/* 160 */
5714/***/ (function(module, exports, __webpack_require__) {
5715
5716var DESCRIPTORS = __webpack_require__(14);
5717var fails = __webpack_require__(2);
5718
5719// V8 ~ Chrome 36-
5720// https://bugs.chromium.org/p/v8/issues/detail?id=3334
5721module.exports = DESCRIPTORS && fails(function () {
5722 // eslint-disable-next-line es-x/no-object-defineproperty -- required for testing
5723 return Object.defineProperty(function () { /* empty */ }, 'prototype', {
5724 value: 42,
5725 writable: false
5726 }).prototype != 42;
5727});
5728
5729
5730/***/ }),
5731/* 161 */
5732/***/ (function(module, exports, __webpack_require__) {
5733
5734var fails = __webpack_require__(2);
5735
5736module.exports = !fails(function () {
5737 function F() { /* empty */ }
5738 F.prototype.constructor = null;
5739 // eslint-disable-next-line es-x/no-object-getprototypeof -- required for testing
5740 return Object.getPrototypeOf(new F()) !== F.prototype;
5741});
5742
5743
5744/***/ }),
5745/* 162 */
5746/***/ (function(module, exports, __webpack_require__) {
5747
5748var getBuiltIn = __webpack_require__(20);
5749var uncurryThis = __webpack_require__(4);
5750var getOwnPropertyNamesModule = __webpack_require__(105);
5751var getOwnPropertySymbolsModule = __webpack_require__(106);
5752var anObject = __webpack_require__(21);
5753
5754var concat = uncurryThis([].concat);
5755
5756// all object keys, includes non-enumerable and symbols
5757module.exports = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) {
5758 var keys = getOwnPropertyNamesModule.f(anObject(it));
5759 var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;
5760 return getOwnPropertySymbols ? concat(keys, getOwnPropertySymbols(it)) : keys;
5761};
5762
5763
5764/***/ }),
5765/* 163 */
5766/***/ (function(module, exports, __webpack_require__) {
5767
5768var uncurryThis = __webpack_require__(4);
5769var hasOwn = __webpack_require__(13);
5770var toIndexedObject = __webpack_require__(35);
5771var indexOf = __webpack_require__(125).indexOf;
5772var hiddenKeys = __webpack_require__(83);
5773
5774var push = uncurryThis([].push);
5775
5776module.exports = function (object, names) {
5777 var O = toIndexedObject(object);
5778 var i = 0;
5779 var result = [];
5780 var key;
5781 for (key in O) !hasOwn(hiddenKeys, key) && hasOwn(O, key) && push(result, key);
5782 // Don't enum bug & hidden keys
5783 while (names.length > i) if (hasOwn(O, key = names[i++])) {
5784 ~indexOf(result, key) || push(result, key);
5785 }
5786 return result;
5787};
5788
5789
5790/***/ }),
5791/* 164 */
5792/***/ (function(module, exports, __webpack_require__) {
5793
5794var getBuiltIn = __webpack_require__(20);
5795
5796module.exports = getBuiltIn('document', 'documentElement');
5797
5798
5799/***/ }),
5800/* 165 */
5801/***/ (function(module, exports, __webpack_require__) {
5802
5803var wellKnownSymbol = __webpack_require__(5);
5804var Iterators = __webpack_require__(54);
5805
5806var ITERATOR = wellKnownSymbol('iterator');
5807var ArrayPrototype = Array.prototype;
5808
5809// check on default Array iterator
5810module.exports = function (it) {
5811 return it !== undefined && (Iterators.Array === it || ArrayPrototype[ITERATOR] === it);
5812};
5813
5814
5815/***/ }),
5816/* 166 */
5817/***/ (function(module, exports, __webpack_require__) {
5818
5819var call = __webpack_require__(15);
5820var aCallable = __webpack_require__(29);
5821var anObject = __webpack_require__(21);
5822var tryToString = __webpack_require__(67);
5823var getIteratorMethod = __webpack_require__(108);
5824
5825var $TypeError = TypeError;
5826
5827module.exports = function (argument, usingIterator) {
5828 var iteratorMethod = arguments.length < 2 ? getIteratorMethod(argument) : usingIterator;
5829 if (aCallable(iteratorMethod)) return anObject(call(iteratorMethod, argument));
5830 throw $TypeError(tryToString(argument) + ' is not iterable');
5831};
5832
5833
5834/***/ }),
5835/* 167 */
5836/***/ (function(module, exports, __webpack_require__) {
5837
5838var call = __webpack_require__(15);
5839var anObject = __webpack_require__(21);
5840var getMethod = __webpack_require__(122);
5841
5842module.exports = function (iterator, kind, value) {
5843 var innerResult, innerError;
5844 anObject(iterator);
5845 try {
5846 innerResult = getMethod(iterator, 'return');
5847 if (!innerResult) {
5848 if (kind === 'throw') throw value;
5849 return value;
5850 }
5851 innerResult = call(innerResult, iterator);
5852 } catch (error) {
5853 innerError = true;
5854 innerResult = error;
5855 }
5856 if (kind === 'throw') throw value;
5857 if (innerError) throw innerResult;
5858 anObject(innerResult);
5859 return value;
5860};
5861
5862
5863/***/ }),
5864/* 168 */
5865/***/ (function(module, exports, __webpack_require__) {
5866
5867var global = __webpack_require__(8);
5868var isCallable = __webpack_require__(9);
5869var inspectSource = __webpack_require__(132);
5870
5871var WeakMap = global.WeakMap;
5872
5873module.exports = isCallable(WeakMap) && /native code/.test(inspectSource(WeakMap));
5874
5875
5876/***/ }),
5877/* 169 */
5878/***/ (function(module, exports, __webpack_require__) {
5879
5880var DESCRIPTORS = __webpack_require__(14);
5881var hasOwn = __webpack_require__(13);
5882
5883var FunctionPrototype = Function.prototype;
5884// eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
5885var getDescriptor = DESCRIPTORS && Object.getOwnPropertyDescriptor;
5886
5887var EXISTS = hasOwn(FunctionPrototype, 'name');
5888// additional protection from minified / mangled / dropped function names
5889var PROPER = EXISTS && (function something() { /* empty */ }).name === 'something';
5890var CONFIGURABLE = EXISTS && (!DESCRIPTORS || (DESCRIPTORS && getDescriptor(FunctionPrototype, 'name').configurable));
5891
5892module.exports = {
5893 EXISTS: EXISTS,
5894 PROPER: PROPER,
5895 CONFIGURABLE: CONFIGURABLE
5896};
5897
5898
5899/***/ }),
5900/* 170 */
5901/***/ (function(module, exports, __webpack_require__) {
5902
5903"use strict";
5904
5905var fails = __webpack_require__(2);
5906var isCallable = __webpack_require__(9);
5907var create = __webpack_require__(53);
5908var getPrototypeOf = __webpack_require__(102);
5909var defineBuiltIn = __webpack_require__(45);
5910var wellKnownSymbol = __webpack_require__(5);
5911var IS_PURE = __webpack_require__(36);
5912
5913var ITERATOR = wellKnownSymbol('iterator');
5914var BUGGY_SAFARI_ITERATORS = false;
5915
5916// `%IteratorPrototype%` object
5917// https://tc39.es/ecma262/#sec-%iteratorprototype%-object
5918var IteratorPrototype, PrototypeOfArrayIteratorPrototype, arrayIterator;
5919
5920/* eslint-disable es-x/no-array-prototype-keys -- safe */
5921if ([].keys) {
5922 arrayIterator = [].keys();
5923 // Safari 8 has buggy iterators w/o `next`
5924 if (!('next' in arrayIterator)) BUGGY_SAFARI_ITERATORS = true;
5925 else {
5926 PrototypeOfArrayIteratorPrototype = getPrototypeOf(getPrototypeOf(arrayIterator));
5927 if (PrototypeOfArrayIteratorPrototype !== Object.prototype) IteratorPrototype = PrototypeOfArrayIteratorPrototype;
5928 }
5929}
5930
5931var NEW_ITERATOR_PROTOTYPE = IteratorPrototype == undefined || fails(function () {
5932 var test = {};
5933 // FF44- legacy iterators case
5934 return IteratorPrototype[ITERATOR].call(test) !== test;
5935});
5936
5937if (NEW_ITERATOR_PROTOTYPE) IteratorPrototype = {};
5938else if (IS_PURE) IteratorPrototype = create(IteratorPrototype);
5939
5940// `%IteratorPrototype%[@@iterator]()` method
5941// https://tc39.es/ecma262/#sec-%iteratorprototype%-@@iterator
5942if (!isCallable(IteratorPrototype[ITERATOR])) {
5943 defineBuiltIn(IteratorPrototype, ITERATOR, function () {
5944 return this;
5945 });
5946}
5947
5948module.exports = {
5949 IteratorPrototype: IteratorPrototype,
5950 BUGGY_SAFARI_ITERATORS: BUGGY_SAFARI_ITERATORS
5951};
5952
5953
5954/***/ }),
5955/* 171 */
5956/***/ (function(module, exports, __webpack_require__) {
5957
5958"use strict";
5959
5960var getBuiltIn = __webpack_require__(20);
5961var definePropertyModule = __webpack_require__(23);
5962var wellKnownSymbol = __webpack_require__(5);
5963var DESCRIPTORS = __webpack_require__(14);
5964
5965var SPECIES = wellKnownSymbol('species');
5966
5967module.exports = function (CONSTRUCTOR_NAME) {
5968 var Constructor = getBuiltIn(CONSTRUCTOR_NAME);
5969 var defineProperty = definePropertyModule.f;
5970
5971 if (DESCRIPTORS && Constructor && !Constructor[SPECIES]) {
5972 defineProperty(Constructor, SPECIES, {
5973 configurable: true,
5974 get: function () { return this; }
5975 });
5976 }
5977};
5978
5979
5980/***/ }),
5981/* 172 */
5982/***/ (function(module, exports, __webpack_require__) {
5983
5984var anObject = __webpack_require__(21);
5985var aConstructor = __webpack_require__(173);
5986var wellKnownSymbol = __webpack_require__(5);
5987
5988var SPECIES = wellKnownSymbol('species');
5989
5990// `SpeciesConstructor` abstract operation
5991// https://tc39.es/ecma262/#sec-speciesconstructor
5992module.exports = function (O, defaultConstructor) {
5993 var C = anObject(O).constructor;
5994 var S;
5995 return C === undefined || (S = anObject(C)[SPECIES]) == undefined ? defaultConstructor : aConstructor(S);
5996};
5997
5998
5999/***/ }),
6000/* 173 */
6001/***/ (function(module, exports, __webpack_require__) {
6002
6003var isConstructor = __webpack_require__(111);
6004var tryToString = __webpack_require__(67);
6005
6006var $TypeError = TypeError;
6007
6008// `Assert: IsConstructor(argument) is true`
6009module.exports = function (argument) {
6010 if (isConstructor(argument)) return argument;
6011 throw $TypeError(tryToString(argument) + ' is not a constructor');
6012};
6013
6014
6015/***/ }),
6016/* 174 */
6017/***/ (function(module, exports, __webpack_require__) {
6018
6019var global = __webpack_require__(8);
6020var apply = __webpack_require__(79);
6021var bind = __webpack_require__(52);
6022var isCallable = __webpack_require__(9);
6023var hasOwn = __webpack_require__(13);
6024var fails = __webpack_require__(2);
6025var html = __webpack_require__(164);
6026var arraySlice = __webpack_require__(112);
6027var createElement = __webpack_require__(124);
6028var validateArgumentsLength = __webpack_require__(304);
6029var IS_IOS = __webpack_require__(175);
6030var IS_NODE = __webpack_require__(109);
6031
6032var set = global.setImmediate;
6033var clear = global.clearImmediate;
6034var process = global.process;
6035var Dispatch = global.Dispatch;
6036var Function = global.Function;
6037var MessageChannel = global.MessageChannel;
6038var String = global.String;
6039var counter = 0;
6040var queue = {};
6041var ONREADYSTATECHANGE = 'onreadystatechange';
6042var location, defer, channel, port;
6043
6044try {
6045 // Deno throws a ReferenceError on `location` access without `--location` flag
6046 location = global.location;
6047} catch (error) { /* empty */ }
6048
6049var run = function (id) {
6050 if (hasOwn(queue, id)) {
6051 var fn = queue[id];
6052 delete queue[id];
6053 fn();
6054 }
6055};
6056
6057var runner = function (id) {
6058 return function () {
6059 run(id);
6060 };
6061};
6062
6063var listener = function (event) {
6064 run(event.data);
6065};
6066
6067var post = function (id) {
6068 // old engines have not location.origin
6069 global.postMessage(String(id), location.protocol + '//' + location.host);
6070};
6071
6072// Node.js 0.9+ & IE10+ has setImmediate, otherwise:
6073if (!set || !clear) {
6074 set = function setImmediate(handler) {
6075 validateArgumentsLength(arguments.length, 1);
6076 var fn = isCallable(handler) ? handler : Function(handler);
6077 var args = arraySlice(arguments, 1);
6078 queue[++counter] = function () {
6079 apply(fn, undefined, args);
6080 };
6081 defer(counter);
6082 return counter;
6083 };
6084 clear = function clearImmediate(id) {
6085 delete queue[id];
6086 };
6087 // Node.js 0.8-
6088 if (IS_NODE) {
6089 defer = function (id) {
6090 process.nextTick(runner(id));
6091 };
6092 // Sphere (JS game engine) Dispatch API
6093 } else if (Dispatch && Dispatch.now) {
6094 defer = function (id) {
6095 Dispatch.now(runner(id));
6096 };
6097 // Browsers with MessageChannel, includes WebWorkers
6098 // except iOS - https://github.com/zloirock/core-js/issues/624
6099 } else if (MessageChannel && !IS_IOS) {
6100 channel = new MessageChannel();
6101 port = channel.port2;
6102 channel.port1.onmessage = listener;
6103 defer = bind(port.postMessage, port);
6104 // Browsers with postMessage, skip WebWorkers
6105 // IE8 has postMessage, but it's sync & typeof its postMessage is 'object'
6106 } else if (
6107 global.addEventListener &&
6108 isCallable(global.postMessage) &&
6109 !global.importScripts &&
6110 location && location.protocol !== 'file:' &&
6111 !fails(post)
6112 ) {
6113 defer = post;
6114 global.addEventListener('message', listener, false);
6115 // IE8-
6116 } else if (ONREADYSTATECHANGE in createElement('script')) {
6117 defer = function (id) {
6118 html.appendChild(createElement('script'))[ONREADYSTATECHANGE] = function () {
6119 html.removeChild(this);
6120 run(id);
6121 };
6122 };
6123 // Rest old browsers
6124 } else {
6125 defer = function (id) {
6126 setTimeout(runner(id), 0);
6127 };
6128 }
6129}
6130
6131module.exports = {
6132 set: set,
6133 clear: clear
6134};
6135
6136
6137/***/ }),
6138/* 175 */
6139/***/ (function(module, exports, __webpack_require__) {
6140
6141var userAgent = __webpack_require__(51);
6142
6143module.exports = /(?:ipad|iphone|ipod).*applewebkit/i.test(userAgent);
6144
6145
6146/***/ }),
6147/* 176 */
6148/***/ (function(module, exports, __webpack_require__) {
6149
6150var NativePromiseConstructor = __webpack_require__(69);
6151var checkCorrectnessOfIteration = __webpack_require__(177);
6152var FORCED_PROMISE_CONSTRUCTOR = __webpack_require__(85).CONSTRUCTOR;
6153
6154module.exports = FORCED_PROMISE_CONSTRUCTOR || !checkCorrectnessOfIteration(function (iterable) {
6155 NativePromiseConstructor.all(iterable).then(undefined, function () { /* empty */ });
6156});
6157
6158
6159/***/ }),
6160/* 177 */
6161/***/ (function(module, exports, __webpack_require__) {
6162
6163var wellKnownSymbol = __webpack_require__(5);
6164
6165var ITERATOR = wellKnownSymbol('iterator');
6166var SAFE_CLOSING = false;
6167
6168try {
6169 var called = 0;
6170 var iteratorWithReturn = {
6171 next: function () {
6172 return { done: !!called++ };
6173 },
6174 'return': function () {
6175 SAFE_CLOSING = true;
6176 }
6177 };
6178 iteratorWithReturn[ITERATOR] = function () {
6179 return this;
6180 };
6181 // eslint-disable-next-line es-x/no-array-from, no-throw-literal -- required for testing
6182 Array.from(iteratorWithReturn, function () { throw 2; });
6183} catch (error) { /* empty */ }
6184
6185module.exports = function (exec, SKIP_CLOSING) {
6186 if (!SKIP_CLOSING && !SAFE_CLOSING) return false;
6187 var ITERATION_SUPPORT = false;
6188 try {
6189 var object = {};
6190 object[ITERATOR] = function () {
6191 return {
6192 next: function () {
6193 return { done: ITERATION_SUPPORT = true };
6194 }
6195 };
6196 };
6197 exec(object);
6198 } catch (error) { /* empty */ }
6199 return ITERATION_SUPPORT;
6200};
6201
6202
6203/***/ }),
6204/* 178 */
6205/***/ (function(module, exports, __webpack_require__) {
6206
6207var anObject = __webpack_require__(21);
6208var isObject = __webpack_require__(11);
6209var newPromiseCapability = __webpack_require__(57);
6210
6211module.exports = function (C, x) {
6212 anObject(C);
6213 if (isObject(x) && x.constructor === C) return x;
6214 var promiseCapability = newPromiseCapability.f(C);
6215 var resolve = promiseCapability.resolve;
6216 resolve(x);
6217 return promiseCapability.promise;
6218};
6219
6220
6221/***/ }),
6222/* 179 */
6223/***/ (function(module, __webpack_exports__, __webpack_require__) {
6224
6225"use strict";
6226/* harmony export (immutable) */ __webpack_exports__["a"] = isUndefined;
6227// Is a given variable undefined?
6228function isUndefined(obj) {
6229 return obj === void 0;
6230}
6231
6232
6233/***/ }),
6234/* 180 */
6235/***/ (function(module, __webpack_exports__, __webpack_require__) {
6236
6237"use strict";
6238/* harmony export (immutable) */ __webpack_exports__["a"] = isBoolean;
6239/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(6);
6240
6241
6242// Is a given value a boolean?
6243function isBoolean(obj) {
6244 return obj === true || obj === false || __WEBPACK_IMPORTED_MODULE_0__setup_js__["t" /* toString */].call(obj) === '[object Boolean]';
6245}
6246
6247
6248/***/ }),
6249/* 181 */
6250/***/ (function(module, __webpack_exports__, __webpack_require__) {
6251
6252"use strict";
6253/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(18);
6254
6255
6256/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('Number'));
6257
6258
6259/***/ }),
6260/* 182 */
6261/***/ (function(module, __webpack_exports__, __webpack_require__) {
6262
6263"use strict";
6264/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(18);
6265
6266
6267/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('Symbol'));
6268
6269
6270/***/ }),
6271/* 183 */
6272/***/ (function(module, __webpack_exports__, __webpack_require__) {
6273
6274"use strict";
6275/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(18);
6276
6277
6278/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('ArrayBuffer'));
6279
6280
6281/***/ }),
6282/* 184 */
6283/***/ (function(module, __webpack_exports__, __webpack_require__) {
6284
6285"use strict";
6286/* harmony export (immutable) */ __webpack_exports__["a"] = isNaN;
6287/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(6);
6288/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isNumber_js__ = __webpack_require__(181);
6289
6290
6291
6292// Is the given value `NaN`?
6293function isNaN(obj) {
6294 return Object(__WEBPACK_IMPORTED_MODULE_1__isNumber_js__["a" /* default */])(obj) && Object(__WEBPACK_IMPORTED_MODULE_0__setup_js__["g" /* _isNaN */])(obj);
6295}
6296
6297
6298/***/ }),
6299/* 185 */
6300/***/ (function(module, __webpack_exports__, __webpack_require__) {
6301
6302"use strict";
6303/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(6);
6304/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isDataView_js__ = __webpack_require__(136);
6305/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__constant_js__ = __webpack_require__(186);
6306/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__isBufferLike_js__ = __webpack_require__(329);
6307
6308
6309
6310
6311
6312// Is a given value a typed array?
6313var typedArrayPattern = /\[object ((I|Ui)nt(8|16|32)|Float(32|64)|Uint8Clamped|Big(I|Ui)nt64)Array\]/;
6314function isTypedArray(obj) {
6315 // `ArrayBuffer.isView` is the most future-proof, so use it when available.
6316 // Otherwise, fall back on the above regular expression.
6317 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)) :
6318 Object(__WEBPACK_IMPORTED_MODULE_3__isBufferLike_js__["a" /* default */])(obj) && typedArrayPattern.test(__WEBPACK_IMPORTED_MODULE_0__setup_js__["t" /* toString */].call(obj));
6319}
6320
6321/* 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));
6322
6323
6324/***/ }),
6325/* 186 */
6326/***/ (function(module, __webpack_exports__, __webpack_require__) {
6327
6328"use strict";
6329/* harmony export (immutable) */ __webpack_exports__["a"] = constant;
6330// Predicate-generating function. Often useful outside of Underscore.
6331function constant(value) {
6332 return function() {
6333 return value;
6334 };
6335}
6336
6337
6338/***/ }),
6339/* 187 */
6340/***/ (function(module, __webpack_exports__, __webpack_require__) {
6341
6342"use strict";
6343/* harmony export (immutable) */ __webpack_exports__["a"] = createSizePropertyCheck;
6344/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(6);
6345
6346
6347// Common internal logic for `isArrayLike` and `isBufferLike`.
6348function createSizePropertyCheck(getSizeProperty) {
6349 return function(collection) {
6350 var sizeProperty = getSizeProperty(collection);
6351 return typeof sizeProperty == 'number' && sizeProperty >= 0 && sizeProperty <= __WEBPACK_IMPORTED_MODULE_0__setup_js__["b" /* MAX_ARRAY_INDEX */];
6352 }
6353}
6354
6355
6356/***/ }),
6357/* 188 */
6358/***/ (function(module, __webpack_exports__, __webpack_require__) {
6359
6360"use strict";
6361/* harmony export (immutable) */ __webpack_exports__["a"] = shallowProperty;
6362// Internal helper to generate a function to obtain property `key` from `obj`.
6363function shallowProperty(key) {
6364 return function(obj) {
6365 return obj == null ? void 0 : obj[key];
6366 };
6367}
6368
6369
6370/***/ }),
6371/* 189 */
6372/***/ (function(module, __webpack_exports__, __webpack_require__) {
6373
6374"use strict";
6375/* harmony export (immutable) */ __webpack_exports__["a"] = collectNonEnumProps;
6376/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(6);
6377/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isFunction_js__ = __webpack_require__(30);
6378/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__has_js__ = __webpack_require__(47);
6379
6380
6381
6382
6383// Internal helper to create a simple lookup structure.
6384// `collectNonEnumProps` used to depend on `_.contains`, but this led to
6385// circular imports. `emulatedSet` is a one-off solution that only works for
6386// arrays of strings.
6387function emulatedSet(keys) {
6388 var hash = {};
6389 for (var l = keys.length, i = 0; i < l; ++i) hash[keys[i]] = true;
6390 return {
6391 contains: function(key) { return hash[key]; },
6392 push: function(key) {
6393 hash[key] = true;
6394 return keys.push(key);
6395 }
6396 };
6397}
6398
6399// Internal helper. Checks `keys` for the presence of keys in IE < 9 that won't
6400// be iterated by `for key in ...` and thus missed. Extends `keys` in place if
6401// needed.
6402function collectNonEnumProps(obj, keys) {
6403 keys = emulatedSet(keys);
6404 var nonEnumIdx = __WEBPACK_IMPORTED_MODULE_0__setup_js__["n" /* nonEnumerableProps */].length;
6405 var constructor = obj.constructor;
6406 var proto = Object(__WEBPACK_IMPORTED_MODULE_1__isFunction_js__["a" /* default */])(constructor) && constructor.prototype || __WEBPACK_IMPORTED_MODULE_0__setup_js__["c" /* ObjProto */];
6407
6408 // Constructor is a special case.
6409 var prop = 'constructor';
6410 if (Object(__WEBPACK_IMPORTED_MODULE_2__has_js__["a" /* default */])(obj, prop) && !keys.contains(prop)) keys.push(prop);
6411
6412 while (nonEnumIdx--) {
6413 prop = __WEBPACK_IMPORTED_MODULE_0__setup_js__["n" /* nonEnumerableProps */][nonEnumIdx];
6414 if (prop in obj && obj[prop] !== proto[prop] && !keys.contains(prop)) {
6415 keys.push(prop);
6416 }
6417 }
6418}
6419
6420
6421/***/ }),
6422/* 190 */
6423/***/ (function(module, __webpack_exports__, __webpack_require__) {
6424
6425"use strict";
6426/* harmony export (immutable) */ __webpack_exports__["a"] = isMatch;
6427/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__keys_js__ = __webpack_require__(17);
6428
6429
6430// Returns whether an object has a given set of `key:value` pairs.
6431function isMatch(object, attrs) {
6432 var _keys = Object(__WEBPACK_IMPORTED_MODULE_0__keys_js__["a" /* default */])(attrs), length = _keys.length;
6433 if (object == null) return !length;
6434 var obj = Object(object);
6435 for (var i = 0; i < length; i++) {
6436 var key = _keys[i];
6437 if (attrs[key] !== obj[key] || !(key in obj)) return false;
6438 }
6439 return true;
6440}
6441
6442
6443/***/ }),
6444/* 191 */
6445/***/ (function(module, __webpack_exports__, __webpack_require__) {
6446
6447"use strict";
6448/* harmony export (immutable) */ __webpack_exports__["a"] = invert;
6449/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__keys_js__ = __webpack_require__(17);
6450
6451
6452// Invert the keys and values of an object. The values must be serializable.
6453function invert(obj) {
6454 var result = {};
6455 var _keys = Object(__WEBPACK_IMPORTED_MODULE_0__keys_js__["a" /* default */])(obj);
6456 for (var i = 0, length = _keys.length; i < length; i++) {
6457 result[obj[_keys[i]]] = _keys[i];
6458 }
6459 return result;
6460}
6461
6462
6463/***/ }),
6464/* 192 */
6465/***/ (function(module, __webpack_exports__, __webpack_require__) {
6466
6467"use strict";
6468/* harmony export (immutable) */ __webpack_exports__["a"] = functions;
6469/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isFunction_js__ = __webpack_require__(30);
6470
6471
6472// Return a sorted list of the function names available on the object.
6473function functions(obj) {
6474 var names = [];
6475 for (var key in obj) {
6476 if (Object(__WEBPACK_IMPORTED_MODULE_0__isFunction_js__["a" /* default */])(obj[key])) names.push(key);
6477 }
6478 return names.sort();
6479}
6480
6481
6482/***/ }),
6483/* 193 */
6484/***/ (function(module, __webpack_exports__, __webpack_require__) {
6485
6486"use strict";
6487/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createAssigner_js__ = __webpack_require__(140);
6488/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__allKeys_js__ = __webpack_require__(87);
6489
6490
6491
6492// Extend a given object with all the properties in passed-in object(s).
6493/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createAssigner_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__allKeys_js__["a" /* default */]));
6494
6495
6496/***/ }),
6497/* 194 */
6498/***/ (function(module, __webpack_exports__, __webpack_require__) {
6499
6500"use strict";
6501/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createAssigner_js__ = __webpack_require__(140);
6502/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__allKeys_js__ = __webpack_require__(87);
6503
6504
6505
6506// Fill in a given object with default properties.
6507/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createAssigner_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__allKeys_js__["a" /* default */], true));
6508
6509
6510/***/ }),
6511/* 195 */
6512/***/ (function(module, __webpack_exports__, __webpack_require__) {
6513
6514"use strict";
6515/* harmony export (immutable) */ __webpack_exports__["a"] = baseCreate;
6516/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isObject_js__ = __webpack_require__(58);
6517/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__setup_js__ = __webpack_require__(6);
6518
6519
6520
6521// Create a naked function reference for surrogate-prototype-swapping.
6522function ctor() {
6523 return function(){};
6524}
6525
6526// An internal function for creating a new object that inherits from another.
6527function baseCreate(prototype) {
6528 if (!Object(__WEBPACK_IMPORTED_MODULE_0__isObject_js__["a" /* default */])(prototype)) return {};
6529 if (__WEBPACK_IMPORTED_MODULE_1__setup_js__["j" /* nativeCreate */]) return Object(__WEBPACK_IMPORTED_MODULE_1__setup_js__["j" /* nativeCreate */])(prototype);
6530 var Ctor = ctor();
6531 Ctor.prototype = prototype;
6532 var result = new Ctor;
6533 Ctor.prototype = null;
6534 return result;
6535}
6536
6537
6538/***/ }),
6539/* 196 */
6540/***/ (function(module, __webpack_exports__, __webpack_require__) {
6541
6542"use strict";
6543/* harmony export (immutable) */ __webpack_exports__["a"] = clone;
6544/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isObject_js__ = __webpack_require__(58);
6545/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isArray_js__ = __webpack_require__(59);
6546/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__extend_js__ = __webpack_require__(193);
6547
6548
6549
6550
6551// Create a (shallow-cloned) duplicate of an object.
6552function clone(obj) {
6553 if (!Object(__WEBPACK_IMPORTED_MODULE_0__isObject_js__["a" /* default */])(obj)) return obj;
6554 return Object(__WEBPACK_IMPORTED_MODULE_1__isArray_js__["a" /* default */])(obj) ? obj.slice() : Object(__WEBPACK_IMPORTED_MODULE_2__extend_js__["a" /* default */])({}, obj);
6555}
6556
6557
6558/***/ }),
6559/* 197 */
6560/***/ (function(module, __webpack_exports__, __webpack_require__) {
6561
6562"use strict";
6563/* harmony export (immutable) */ __webpack_exports__["a"] = get;
6564/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__toPath_js__ = __webpack_require__(88);
6565/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__deepGet_js__ = __webpack_require__(142);
6566/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__isUndefined_js__ = __webpack_require__(179);
6567
6568
6569
6570
6571// Get the value of the (deep) property on `path` from `object`.
6572// If any property in `path` does not exist or if the value is
6573// `undefined`, return `defaultValue` instead.
6574// The `path` is normalized through `_.toPath`.
6575function get(object, path, defaultValue) {
6576 var value = Object(__WEBPACK_IMPORTED_MODULE_1__deepGet_js__["a" /* default */])(object, Object(__WEBPACK_IMPORTED_MODULE_0__toPath_js__["a" /* default */])(path));
6577 return Object(__WEBPACK_IMPORTED_MODULE_2__isUndefined_js__["a" /* default */])(value) ? defaultValue : value;
6578}
6579
6580
6581/***/ }),
6582/* 198 */
6583/***/ (function(module, __webpack_exports__, __webpack_require__) {
6584
6585"use strict";
6586/* harmony export (immutable) */ __webpack_exports__["a"] = toPath;
6587/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__underscore_js__ = __webpack_require__(25);
6588/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isArray_js__ = __webpack_require__(59);
6589
6590
6591
6592// Normalize a (deep) property `path` to array.
6593// Like `_.iteratee`, this function can be customized.
6594function toPath(path) {
6595 return Object(__WEBPACK_IMPORTED_MODULE_1__isArray_js__["a" /* default */])(path) ? path : [path];
6596}
6597__WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */].toPath = toPath;
6598
6599
6600/***/ }),
6601/* 199 */
6602/***/ (function(module, __webpack_exports__, __webpack_require__) {
6603
6604"use strict";
6605/* harmony export (immutable) */ __webpack_exports__["a"] = baseIteratee;
6606/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__identity_js__ = __webpack_require__(143);
6607/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isFunction_js__ = __webpack_require__(30);
6608/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__isObject_js__ = __webpack_require__(58);
6609/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__isArray_js__ = __webpack_require__(59);
6610/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__matcher_js__ = __webpack_require__(113);
6611/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__property_js__ = __webpack_require__(144);
6612/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__optimizeCb_js__ = __webpack_require__(89);
6613
6614
6615
6616
6617
6618
6619
6620
6621// An internal function to generate callbacks that can be applied to each
6622// element in a collection, returning the desired result — either `_.identity`,
6623// an arbitrary callback, a property matcher, or a property accessor.
6624function baseIteratee(value, context, argCount) {
6625 if (value == null) return __WEBPACK_IMPORTED_MODULE_0__identity_js__["a" /* default */];
6626 if (Object(__WEBPACK_IMPORTED_MODULE_1__isFunction_js__["a" /* default */])(value)) return Object(__WEBPACK_IMPORTED_MODULE_6__optimizeCb_js__["a" /* default */])(value, context, argCount);
6627 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);
6628 return Object(__WEBPACK_IMPORTED_MODULE_5__property_js__["a" /* default */])(value);
6629}
6630
6631
6632/***/ }),
6633/* 200 */
6634/***/ (function(module, __webpack_exports__, __webpack_require__) {
6635
6636"use strict";
6637/* harmony export (immutable) */ __webpack_exports__["a"] = iteratee;
6638/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__underscore_js__ = __webpack_require__(25);
6639/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__baseIteratee_js__ = __webpack_require__(199);
6640
6641
6642
6643// External wrapper for our callback generator. Users may customize
6644// `_.iteratee` if they want additional predicate/iteratee shorthand styles.
6645// This abstraction hides the internal-only `argCount` argument.
6646function iteratee(value, context) {
6647 return Object(__WEBPACK_IMPORTED_MODULE_1__baseIteratee_js__["a" /* default */])(value, context, Infinity);
6648}
6649__WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */].iteratee = iteratee;
6650
6651
6652/***/ }),
6653/* 201 */
6654/***/ (function(module, __webpack_exports__, __webpack_require__) {
6655
6656"use strict";
6657/* harmony export (immutable) */ __webpack_exports__["a"] = noop;
6658// Predicate-generating function. Often useful outside of Underscore.
6659function noop(){}
6660
6661
6662/***/ }),
6663/* 202 */
6664/***/ (function(module, __webpack_exports__, __webpack_require__) {
6665
6666"use strict";
6667/* harmony export (immutable) */ __webpack_exports__["a"] = random;
6668// Return a random integer between `min` and `max` (inclusive).
6669function random(min, max) {
6670 if (max == null) {
6671 max = min;
6672 min = 0;
6673 }
6674 return min + Math.floor(Math.random() * (max - min + 1));
6675}
6676
6677
6678/***/ }),
6679/* 203 */
6680/***/ (function(module, __webpack_exports__, __webpack_require__) {
6681
6682"use strict";
6683/* harmony export (immutable) */ __webpack_exports__["a"] = createEscaper;
6684/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__keys_js__ = __webpack_require__(17);
6685
6686
6687// Internal helper to generate functions for escaping and unescaping strings
6688// to/from HTML interpolation.
6689function createEscaper(map) {
6690 var escaper = function(match) {
6691 return map[match];
6692 };
6693 // Regexes for identifying a key that needs to be escaped.
6694 var source = '(?:' + Object(__WEBPACK_IMPORTED_MODULE_0__keys_js__["a" /* default */])(map).join('|') + ')';
6695 var testRegexp = RegExp(source);
6696 var replaceRegexp = RegExp(source, 'g');
6697 return function(string) {
6698 string = string == null ? '' : '' + string;
6699 return testRegexp.test(string) ? string.replace(replaceRegexp, escaper) : string;
6700 };
6701}
6702
6703
6704/***/ }),
6705/* 204 */
6706/***/ (function(module, __webpack_exports__, __webpack_require__) {
6707
6708"use strict";
6709// Internal list of HTML entities for escaping.
6710/* harmony default export */ __webpack_exports__["a"] = ({
6711 '&': '&amp;',
6712 '<': '&lt;',
6713 '>': '&gt;',
6714 '"': '&quot;',
6715 "'": '&#x27;',
6716 '`': '&#x60;'
6717});
6718
6719
6720/***/ }),
6721/* 205 */
6722/***/ (function(module, __webpack_exports__, __webpack_require__) {
6723
6724"use strict";
6725/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__underscore_js__ = __webpack_require__(25);
6726
6727
6728// By default, Underscore uses ERB-style template delimiters. Change the
6729// following template settings to use alternative delimiters.
6730/* harmony default export */ __webpack_exports__["a"] = (__WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */].templateSettings = {
6731 evaluate: /<%([\s\S]+?)%>/g,
6732 interpolate: /<%=([\s\S]+?)%>/g,
6733 escape: /<%-([\s\S]+?)%>/g
6734});
6735
6736
6737/***/ }),
6738/* 206 */
6739/***/ (function(module, __webpack_exports__, __webpack_require__) {
6740
6741"use strict";
6742/* harmony export (immutable) */ __webpack_exports__["a"] = executeBound;
6743/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__baseCreate_js__ = __webpack_require__(195);
6744/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isObject_js__ = __webpack_require__(58);
6745
6746
6747
6748// Internal function to execute `sourceFunc` bound to `context` with optional
6749// `args`. Determines whether to execute a function as a constructor or as a
6750// normal function.
6751function executeBound(sourceFunc, boundFunc, context, callingContext, args) {
6752 if (!(callingContext instanceof boundFunc)) return sourceFunc.apply(context, args);
6753 var self = Object(__WEBPACK_IMPORTED_MODULE_0__baseCreate_js__["a" /* default */])(sourceFunc.prototype);
6754 var result = sourceFunc.apply(self, args);
6755 if (Object(__WEBPACK_IMPORTED_MODULE_1__isObject_js__["a" /* default */])(result)) return result;
6756 return self;
6757}
6758
6759
6760/***/ }),
6761/* 207 */
6762/***/ (function(module, __webpack_exports__, __webpack_require__) {
6763
6764"use strict";
6765/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(24);
6766/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isFunction_js__ = __webpack_require__(30);
6767/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__executeBound_js__ = __webpack_require__(206);
6768
6769
6770
6771
6772// Create a function bound to a given object (assigning `this`, and arguments,
6773// optionally).
6774/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(func, context, args) {
6775 if (!Object(__WEBPACK_IMPORTED_MODULE_1__isFunction_js__["a" /* default */])(func)) throw new TypeError('Bind must be called on a function');
6776 var bound = Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(callArgs) {
6777 return Object(__WEBPACK_IMPORTED_MODULE_2__executeBound_js__["a" /* default */])(func, bound, context, this, args.concat(callArgs));
6778 });
6779 return bound;
6780}));
6781
6782
6783/***/ }),
6784/* 208 */
6785/***/ (function(module, __webpack_exports__, __webpack_require__) {
6786
6787"use strict";
6788/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(24);
6789
6790
6791// Delays a function for the given number of milliseconds, and then calls
6792// it with the arguments supplied.
6793/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(func, wait, args) {
6794 return setTimeout(function() {
6795 return func.apply(null, args);
6796 }, wait);
6797}));
6798
6799
6800/***/ }),
6801/* 209 */
6802/***/ (function(module, __webpack_exports__, __webpack_require__) {
6803
6804"use strict";
6805/* harmony export (immutable) */ __webpack_exports__["a"] = before;
6806// Returns a function that will only be executed up to (but not including) the
6807// Nth call.
6808function before(times, func) {
6809 var memo;
6810 return function() {
6811 if (--times > 0) {
6812 memo = func.apply(this, arguments);
6813 }
6814 if (times <= 1) func = null;
6815 return memo;
6816 };
6817}
6818
6819
6820/***/ }),
6821/* 210 */
6822/***/ (function(module, __webpack_exports__, __webpack_require__) {
6823
6824"use strict";
6825/* harmony export (immutable) */ __webpack_exports__["a"] = findKey;
6826/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(22);
6827/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__keys_js__ = __webpack_require__(17);
6828
6829
6830
6831// Returns the first key on an object that passes a truth test.
6832function findKey(obj, predicate, context) {
6833 predicate = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(predicate, context);
6834 var _keys = Object(__WEBPACK_IMPORTED_MODULE_1__keys_js__["a" /* default */])(obj), key;
6835 for (var i = 0, length = _keys.length; i < length; i++) {
6836 key = _keys[i];
6837 if (predicate(obj[key], key, obj)) return key;
6838 }
6839}
6840
6841
6842/***/ }),
6843/* 211 */
6844/***/ (function(module, __webpack_exports__, __webpack_require__) {
6845
6846"use strict";
6847/* harmony export (immutable) */ __webpack_exports__["a"] = createPredicateIndexFinder;
6848/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(22);
6849/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__getLength_js__ = __webpack_require__(31);
6850
6851
6852
6853// Internal function to generate `_.findIndex` and `_.findLastIndex`.
6854function createPredicateIndexFinder(dir) {
6855 return function(array, predicate, context) {
6856 predicate = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(predicate, context);
6857 var length = Object(__WEBPACK_IMPORTED_MODULE_1__getLength_js__["a" /* default */])(array);
6858 var index = dir > 0 ? 0 : length - 1;
6859 for (; index >= 0 && index < length; index += dir) {
6860 if (predicate(array[index], index, array)) return index;
6861 }
6862 return -1;
6863 };
6864}
6865
6866
6867/***/ }),
6868/* 212 */
6869/***/ (function(module, __webpack_exports__, __webpack_require__) {
6870
6871"use strict";
6872/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createPredicateIndexFinder_js__ = __webpack_require__(211);
6873
6874
6875// Returns the last index on an array-like that passes a truth test.
6876/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createPredicateIndexFinder_js__["a" /* default */])(-1));
6877
6878
6879/***/ }),
6880/* 213 */
6881/***/ (function(module, __webpack_exports__, __webpack_require__) {
6882
6883"use strict";
6884/* harmony export (immutable) */ __webpack_exports__["a"] = sortedIndex;
6885/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(22);
6886/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__getLength_js__ = __webpack_require__(31);
6887
6888
6889
6890// Use a comparator function to figure out the smallest index at which
6891// an object should be inserted so as to maintain order. Uses binary search.
6892function sortedIndex(array, obj, iteratee, context) {
6893 iteratee = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(iteratee, context, 1);
6894 var value = iteratee(obj);
6895 var low = 0, high = Object(__WEBPACK_IMPORTED_MODULE_1__getLength_js__["a" /* default */])(array);
6896 while (low < high) {
6897 var mid = Math.floor((low + high) / 2);
6898 if (iteratee(array[mid]) < value) low = mid + 1; else high = mid;
6899 }
6900 return low;
6901}
6902
6903
6904/***/ }),
6905/* 214 */
6906/***/ (function(module, __webpack_exports__, __webpack_require__) {
6907
6908"use strict";
6909/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__sortedIndex_js__ = __webpack_require__(213);
6910/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__findIndex_js__ = __webpack_require__(147);
6911/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__createIndexFinder_js__ = __webpack_require__(215);
6912
6913
6914
6915
6916// Return the position of the first occurrence of an item in an array,
6917// or -1 if the item is not included in the array.
6918// If the array is large and already in sort order, pass `true`
6919// for **isSorted** to use binary search.
6920/* 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 */]));
6921
6922
6923/***/ }),
6924/* 215 */
6925/***/ (function(module, __webpack_exports__, __webpack_require__) {
6926
6927"use strict";
6928/* harmony export (immutable) */ __webpack_exports__["a"] = createIndexFinder;
6929/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__getLength_js__ = __webpack_require__(31);
6930/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__setup_js__ = __webpack_require__(6);
6931/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__isNaN_js__ = __webpack_require__(184);
6932
6933
6934
6935
6936// Internal function to generate the `_.indexOf` and `_.lastIndexOf` functions.
6937function createIndexFinder(dir, predicateFind, sortedIndex) {
6938 return function(array, item, idx) {
6939 var i = 0, length = Object(__WEBPACK_IMPORTED_MODULE_0__getLength_js__["a" /* default */])(array);
6940 if (typeof idx == 'number') {
6941 if (dir > 0) {
6942 i = idx >= 0 ? idx : Math.max(idx + length, i);
6943 } else {
6944 length = idx >= 0 ? Math.min(idx + 1, length) : idx + length + 1;
6945 }
6946 } else if (sortedIndex && idx && length) {
6947 idx = sortedIndex(array, item);
6948 return array[idx] === item ? idx : -1;
6949 }
6950 if (item !== item) {
6951 idx = predicateFind(__WEBPACK_IMPORTED_MODULE_1__setup_js__["q" /* slice */].call(array, i, length), __WEBPACK_IMPORTED_MODULE_2__isNaN_js__["a" /* default */]);
6952 return idx >= 0 ? idx + i : -1;
6953 }
6954 for (idx = dir > 0 ? i : length - 1; idx >= 0 && idx < length; idx += dir) {
6955 if (array[idx] === item) return idx;
6956 }
6957 return -1;
6958 };
6959}
6960
6961
6962/***/ }),
6963/* 216 */
6964/***/ (function(module, __webpack_exports__, __webpack_require__) {
6965
6966"use strict";
6967/* harmony export (immutable) */ __webpack_exports__["a"] = find;
6968/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__ = __webpack_require__(26);
6969/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__findIndex_js__ = __webpack_require__(147);
6970/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__findKey_js__ = __webpack_require__(210);
6971
6972
6973
6974
6975// Return the first value which passes a truth test.
6976function find(obj, predicate, context) {
6977 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 */];
6978 var key = keyFinder(obj, predicate, context);
6979 if (key !== void 0 && key !== -1) return obj[key];
6980}
6981
6982
6983/***/ }),
6984/* 217 */
6985/***/ (function(module, __webpack_exports__, __webpack_require__) {
6986
6987"use strict";
6988/* harmony export (immutable) */ __webpack_exports__["a"] = createReduce;
6989/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__ = __webpack_require__(26);
6990/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__keys_js__ = __webpack_require__(17);
6991/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__optimizeCb_js__ = __webpack_require__(89);
6992
6993
6994
6995
6996// Internal helper to create a reducing function, iterating left or right.
6997function createReduce(dir) {
6998 // Wrap code that reassigns argument variables in a separate function than
6999 // the one that accesses `arguments.length` to avoid a perf hit. (#1991)
7000 var reducer = function(obj, iteratee, memo, initial) {
7001 var _keys = !Object(__WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__["a" /* default */])(obj) && Object(__WEBPACK_IMPORTED_MODULE_1__keys_js__["a" /* default */])(obj),
7002 length = (_keys || obj).length,
7003 index = dir > 0 ? 0 : length - 1;
7004 if (!initial) {
7005 memo = obj[_keys ? _keys[index] : index];
7006 index += dir;
7007 }
7008 for (; index >= 0 && index < length; index += dir) {
7009 var currentKey = _keys ? _keys[index] : index;
7010 memo = iteratee(memo, obj[currentKey], currentKey, obj);
7011 }
7012 return memo;
7013 };
7014
7015 return function(obj, iteratee, memo, context) {
7016 var initial = arguments.length >= 3;
7017 return reducer(obj, Object(__WEBPACK_IMPORTED_MODULE_2__optimizeCb_js__["a" /* default */])(iteratee, context, 4), memo, initial);
7018 };
7019}
7020
7021
7022/***/ }),
7023/* 218 */
7024/***/ (function(module, __webpack_exports__, __webpack_require__) {
7025
7026"use strict";
7027/* harmony export (immutable) */ __webpack_exports__["a"] = max;
7028/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__ = __webpack_require__(26);
7029/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__values_js__ = __webpack_require__(71);
7030/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__cb_js__ = __webpack_require__(22);
7031/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__each_js__ = __webpack_require__(60);
7032
7033
7034
7035
7036
7037// Return the maximum element (or element-based computation).
7038function max(obj, iteratee, context) {
7039 var result = -Infinity, lastComputed = -Infinity,
7040 value, computed;
7041 if (iteratee == null || typeof iteratee == 'number' && typeof obj[0] != 'object' && obj != null) {
7042 obj = Object(__WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__["a" /* default */])(obj) ? obj : Object(__WEBPACK_IMPORTED_MODULE_1__values_js__["a" /* default */])(obj);
7043 for (var i = 0, length = obj.length; i < length; i++) {
7044 value = obj[i];
7045 if (value != null && value > result) {
7046 result = value;
7047 }
7048 }
7049 } else {
7050 iteratee = Object(__WEBPACK_IMPORTED_MODULE_2__cb_js__["a" /* default */])(iteratee, context);
7051 Object(__WEBPACK_IMPORTED_MODULE_3__each_js__["a" /* default */])(obj, function(v, index, list) {
7052 computed = iteratee(v, index, list);
7053 if (computed > lastComputed || computed === -Infinity && result === -Infinity) {
7054 result = v;
7055 lastComputed = computed;
7056 }
7057 });
7058 }
7059 return result;
7060}
7061
7062
7063/***/ }),
7064/* 219 */
7065/***/ (function(module, __webpack_exports__, __webpack_require__) {
7066
7067"use strict";
7068/* harmony export (immutable) */ __webpack_exports__["a"] = sample;
7069/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__ = __webpack_require__(26);
7070/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__clone_js__ = __webpack_require__(196);
7071/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__values_js__ = __webpack_require__(71);
7072/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__getLength_js__ = __webpack_require__(31);
7073/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__random_js__ = __webpack_require__(202);
7074
7075
7076
7077
7078
7079
7080// Sample **n** random values from a collection using the modern version of the
7081// [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher–Yates_shuffle).
7082// If **n** is not specified, returns a single random element.
7083// The internal `guard` argument allows it to work with `_.map`.
7084function sample(obj, n, guard) {
7085 if (n == null || guard) {
7086 if (!Object(__WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__["a" /* default */])(obj)) obj = Object(__WEBPACK_IMPORTED_MODULE_2__values_js__["a" /* default */])(obj);
7087 return obj[Object(__WEBPACK_IMPORTED_MODULE_4__random_js__["a" /* default */])(obj.length - 1)];
7088 }
7089 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);
7090 var length = Object(__WEBPACK_IMPORTED_MODULE_3__getLength_js__["a" /* default */])(sample);
7091 n = Math.max(Math.min(n, length), 0);
7092 var last = length - 1;
7093 for (var index = 0; index < n; index++) {
7094 var rand = Object(__WEBPACK_IMPORTED_MODULE_4__random_js__["a" /* default */])(index, last);
7095 var temp = sample[index];
7096 sample[index] = sample[rand];
7097 sample[rand] = temp;
7098 }
7099 return sample.slice(0, n);
7100}
7101
7102
7103/***/ }),
7104/* 220 */
7105/***/ (function(module, __webpack_exports__, __webpack_require__) {
7106
7107"use strict";
7108/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(24);
7109/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isFunction_js__ = __webpack_require__(30);
7110/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__optimizeCb_js__ = __webpack_require__(89);
7111/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__allKeys_js__ = __webpack_require__(87);
7112/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__keyInObj_js__ = __webpack_require__(378);
7113/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__flatten_js__ = __webpack_require__(72);
7114
7115
7116
7117
7118
7119
7120
7121// Return a copy of the object only containing the allowed properties.
7122/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(obj, keys) {
7123 var result = {}, iteratee = keys[0];
7124 if (obj == null) return result;
7125 if (Object(__WEBPACK_IMPORTED_MODULE_1__isFunction_js__["a" /* default */])(iteratee)) {
7126 if (keys.length > 1) iteratee = Object(__WEBPACK_IMPORTED_MODULE_2__optimizeCb_js__["a" /* default */])(iteratee, keys[1]);
7127 keys = Object(__WEBPACK_IMPORTED_MODULE_3__allKeys_js__["a" /* default */])(obj);
7128 } else {
7129 iteratee = __WEBPACK_IMPORTED_MODULE_4__keyInObj_js__["a" /* default */];
7130 keys = Object(__WEBPACK_IMPORTED_MODULE_5__flatten_js__["a" /* default */])(keys, false, false);
7131 obj = Object(obj);
7132 }
7133 for (var i = 0, length = keys.length; i < length; i++) {
7134 var key = keys[i];
7135 var value = obj[key];
7136 if (iteratee(value, key, obj)) result[key] = value;
7137 }
7138 return result;
7139}));
7140
7141
7142/***/ }),
7143/* 221 */
7144/***/ (function(module, __webpack_exports__, __webpack_require__) {
7145
7146"use strict";
7147/* harmony export (immutable) */ __webpack_exports__["a"] = initial;
7148/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(6);
7149
7150
7151// Returns everything but the last entry of the array. Especially useful on
7152// the arguments object. Passing **n** will return all the values in
7153// the array, excluding the last N.
7154function initial(array, n, guard) {
7155 return __WEBPACK_IMPORTED_MODULE_0__setup_js__["q" /* slice */].call(array, 0, Math.max(0, array.length - (n == null || guard ? 1 : n)));
7156}
7157
7158
7159/***/ }),
7160/* 222 */
7161/***/ (function(module, __webpack_exports__, __webpack_require__) {
7162
7163"use strict";
7164/* harmony export (immutable) */ __webpack_exports__["a"] = rest;
7165/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(6);
7166
7167
7168// Returns everything but the first entry of the `array`. Especially useful on
7169// the `arguments` object. Passing an **n** will return the rest N values in the
7170// `array`.
7171function rest(array, n, guard) {
7172 return __WEBPACK_IMPORTED_MODULE_0__setup_js__["q" /* slice */].call(array, n == null || guard ? 1 : n);
7173}
7174
7175
7176/***/ }),
7177/* 223 */
7178/***/ (function(module, __webpack_exports__, __webpack_require__) {
7179
7180"use strict";
7181/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(24);
7182/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__flatten_js__ = __webpack_require__(72);
7183/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__filter_js__ = __webpack_require__(90);
7184/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__contains_js__ = __webpack_require__(91);
7185
7186
7187
7188
7189
7190// Take the difference between one array and a number of other arrays.
7191// Only the elements present in just the first array will remain.
7192/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(array, rest) {
7193 rest = Object(__WEBPACK_IMPORTED_MODULE_1__flatten_js__["a" /* default */])(rest, true, true);
7194 return Object(__WEBPACK_IMPORTED_MODULE_2__filter_js__["a" /* default */])(array, function(value){
7195 return !Object(__WEBPACK_IMPORTED_MODULE_3__contains_js__["a" /* default */])(rest, value);
7196 });
7197}));
7198
7199
7200/***/ }),
7201/* 224 */
7202/***/ (function(module, __webpack_exports__, __webpack_require__) {
7203
7204"use strict";
7205/* harmony export (immutable) */ __webpack_exports__["a"] = uniq;
7206/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isBoolean_js__ = __webpack_require__(180);
7207/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__cb_js__ = __webpack_require__(22);
7208/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__getLength_js__ = __webpack_require__(31);
7209/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__contains_js__ = __webpack_require__(91);
7210
7211
7212
7213
7214
7215// Produce a duplicate-free version of the array. If the array has already
7216// been sorted, you have the option of using a faster algorithm.
7217// The faster algorithm will not work with an iteratee if the iteratee
7218// is not a one-to-one function, so providing an iteratee will disable
7219// the faster algorithm.
7220function uniq(array, isSorted, iteratee, context) {
7221 if (!Object(__WEBPACK_IMPORTED_MODULE_0__isBoolean_js__["a" /* default */])(isSorted)) {
7222 context = iteratee;
7223 iteratee = isSorted;
7224 isSorted = false;
7225 }
7226 if (iteratee != null) iteratee = Object(__WEBPACK_IMPORTED_MODULE_1__cb_js__["a" /* default */])(iteratee, context);
7227 var result = [];
7228 var seen = [];
7229 for (var i = 0, length = Object(__WEBPACK_IMPORTED_MODULE_2__getLength_js__["a" /* default */])(array); i < length; i++) {
7230 var value = array[i],
7231 computed = iteratee ? iteratee(value, i, array) : value;
7232 if (isSorted && !iteratee) {
7233 if (!i || seen !== computed) result.push(value);
7234 seen = computed;
7235 } else if (iteratee) {
7236 if (!Object(__WEBPACK_IMPORTED_MODULE_3__contains_js__["a" /* default */])(seen, computed)) {
7237 seen.push(computed);
7238 result.push(value);
7239 }
7240 } else if (!Object(__WEBPACK_IMPORTED_MODULE_3__contains_js__["a" /* default */])(result, value)) {
7241 result.push(value);
7242 }
7243 }
7244 return result;
7245}
7246
7247
7248/***/ }),
7249/* 225 */
7250/***/ (function(module, __webpack_exports__, __webpack_require__) {
7251
7252"use strict";
7253/* harmony export (immutable) */ __webpack_exports__["a"] = unzip;
7254/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__max_js__ = __webpack_require__(218);
7255/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__getLength_js__ = __webpack_require__(31);
7256/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__pluck_js__ = __webpack_require__(148);
7257
7258
7259
7260
7261// Complement of zip. Unzip accepts an array of arrays and groups
7262// each array's elements on shared indices.
7263function unzip(array) {
7264 var length = array && Object(__WEBPACK_IMPORTED_MODULE_0__max_js__["a" /* default */])(array, __WEBPACK_IMPORTED_MODULE_1__getLength_js__["a" /* default */]).length || 0;
7265 var result = Array(length);
7266
7267 for (var index = 0; index < length; index++) {
7268 result[index] = Object(__WEBPACK_IMPORTED_MODULE_2__pluck_js__["a" /* default */])(array, index);
7269 }
7270 return result;
7271}
7272
7273
7274/***/ }),
7275/* 226 */
7276/***/ (function(module, __webpack_exports__, __webpack_require__) {
7277
7278"use strict";
7279/* harmony export (immutable) */ __webpack_exports__["a"] = chainResult;
7280/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__underscore_js__ = __webpack_require__(25);
7281
7282
7283// Helper function to continue chaining intermediate results.
7284function chainResult(instance, obj) {
7285 return instance._chain ? Object(__WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */])(obj).chain() : obj;
7286}
7287
7288
7289/***/ }),
7290/* 227 */
7291/***/ (function(module, exports, __webpack_require__) {
7292
7293"use strict";
7294
7295var $ = __webpack_require__(0);
7296var fails = __webpack_require__(2);
7297var isArray = __webpack_require__(92);
7298var isObject = __webpack_require__(11);
7299var toObject = __webpack_require__(33);
7300var lengthOfArrayLike = __webpack_require__(40);
7301var doesNotExceedSafeInteger = __webpack_require__(396);
7302var createProperty = __webpack_require__(93);
7303var arraySpeciesCreate = __webpack_require__(228);
7304var arrayMethodHasSpeciesSupport = __webpack_require__(116);
7305var wellKnownSymbol = __webpack_require__(5);
7306var V8_VERSION = __webpack_require__(66);
7307
7308var IS_CONCAT_SPREADABLE = wellKnownSymbol('isConcatSpreadable');
7309
7310// We can't use this feature detection in V8 since it causes
7311// deoptimization and serious performance degradation
7312// https://github.com/zloirock/core-js/issues/679
7313var IS_CONCAT_SPREADABLE_SUPPORT = V8_VERSION >= 51 || !fails(function () {
7314 var array = [];
7315 array[IS_CONCAT_SPREADABLE] = false;
7316 return array.concat()[0] !== array;
7317});
7318
7319var SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('concat');
7320
7321var isConcatSpreadable = function (O) {
7322 if (!isObject(O)) return false;
7323 var spreadable = O[IS_CONCAT_SPREADABLE];
7324 return spreadable !== undefined ? !!spreadable : isArray(O);
7325};
7326
7327var FORCED = !IS_CONCAT_SPREADABLE_SUPPORT || !SPECIES_SUPPORT;
7328
7329// `Array.prototype.concat` method
7330// https://tc39.es/ecma262/#sec-array.prototype.concat
7331// with adding support of @@isConcatSpreadable and @@species
7332$({ target: 'Array', proto: true, arity: 1, forced: FORCED }, {
7333 // eslint-disable-next-line no-unused-vars -- required for `.length`
7334 concat: function concat(arg) {
7335 var O = toObject(this);
7336 var A = arraySpeciesCreate(O, 0);
7337 var n = 0;
7338 var i, k, length, len, E;
7339 for (i = -1, length = arguments.length; i < length; i++) {
7340 E = i === -1 ? O : arguments[i];
7341 if (isConcatSpreadable(E)) {
7342 len = lengthOfArrayLike(E);
7343 doesNotExceedSafeInteger(n + len);
7344 for (k = 0; k < len; k++, n++) if (k in E) createProperty(A, n, E[k]);
7345 } else {
7346 doesNotExceedSafeInteger(n + 1);
7347 createProperty(A, n++, E);
7348 }
7349 }
7350 A.length = n;
7351 return A;
7352 }
7353});
7354
7355
7356/***/ }),
7357/* 228 */
7358/***/ (function(module, exports, __webpack_require__) {
7359
7360var arraySpeciesConstructor = __webpack_require__(397);
7361
7362// `ArraySpeciesCreate` abstract operation
7363// https://tc39.es/ecma262/#sec-arrayspeciescreate
7364module.exports = function (originalArray, length) {
7365 return new (arraySpeciesConstructor(originalArray))(length === 0 ? 0 : length);
7366};
7367
7368
7369/***/ }),
7370/* 229 */
7371/***/ (function(module, exports, __webpack_require__) {
7372
7373var $ = __webpack_require__(0);
7374var getBuiltIn = __webpack_require__(20);
7375var apply = __webpack_require__(79);
7376var call = __webpack_require__(15);
7377var uncurryThis = __webpack_require__(4);
7378var fails = __webpack_require__(2);
7379var isArray = __webpack_require__(92);
7380var isCallable = __webpack_require__(9);
7381var isObject = __webpack_require__(11);
7382var isSymbol = __webpack_require__(100);
7383var arraySlice = __webpack_require__(112);
7384var NATIVE_SYMBOL = __webpack_require__(65);
7385
7386var $stringify = getBuiltIn('JSON', 'stringify');
7387var exec = uncurryThis(/./.exec);
7388var charAt = uncurryThis(''.charAt);
7389var charCodeAt = uncurryThis(''.charCodeAt);
7390var replace = uncurryThis(''.replace);
7391var numberToString = uncurryThis(1.0.toString);
7392
7393var tester = /[\uD800-\uDFFF]/g;
7394var low = /^[\uD800-\uDBFF]$/;
7395var hi = /^[\uDC00-\uDFFF]$/;
7396
7397var WRONG_SYMBOLS_CONVERSION = !NATIVE_SYMBOL || fails(function () {
7398 var symbol = getBuiltIn('Symbol')();
7399 // MS Edge converts symbol values to JSON as {}
7400 return $stringify([symbol]) != '[null]'
7401 // WebKit converts symbol values to JSON as null
7402 || $stringify({ a: symbol }) != '{}'
7403 // V8 throws on boxed symbols
7404 || $stringify(Object(symbol)) != '{}';
7405});
7406
7407// https://github.com/tc39/proposal-well-formed-stringify
7408var ILL_FORMED_UNICODE = fails(function () {
7409 return $stringify('\uDF06\uD834') !== '"\\udf06\\ud834"'
7410 || $stringify('\uDEAD') !== '"\\udead"';
7411});
7412
7413var stringifyWithSymbolsFix = function (it, replacer) {
7414 var args = arraySlice(arguments);
7415 var $replacer = replacer;
7416 if (!isObject(replacer) && it === undefined || isSymbol(it)) return; // IE8 returns string on undefined
7417 if (!isArray(replacer)) replacer = function (key, value) {
7418 if (isCallable($replacer)) value = call($replacer, this, key, value);
7419 if (!isSymbol(value)) return value;
7420 };
7421 args[1] = replacer;
7422 return apply($stringify, null, args);
7423};
7424
7425var fixIllFormed = function (match, offset, string) {
7426 var prev = charAt(string, offset - 1);
7427 var next = charAt(string, offset + 1);
7428 if ((exec(low, match) && !exec(hi, next)) || (exec(hi, match) && !exec(low, prev))) {
7429 return '\\u' + numberToString(charCodeAt(match, 0), 16);
7430 } return match;
7431};
7432
7433if ($stringify) {
7434 // `JSON.stringify` method
7435 // https://tc39.es/ecma262/#sec-json.stringify
7436 $({ target: 'JSON', stat: true, arity: 3, forced: WRONG_SYMBOLS_CONVERSION || ILL_FORMED_UNICODE }, {
7437 // eslint-disable-next-line no-unused-vars -- required for `.length`
7438 stringify: function stringify(it, replacer, space) {
7439 var args = arraySlice(arguments);
7440 var result = apply(WRONG_SYMBOLS_CONVERSION ? stringifyWithSymbolsFix : $stringify, null, args);
7441 return ILL_FORMED_UNICODE && typeof result == 'string' ? replace(result, tester, fixIllFormed) : result;
7442 }
7443 });
7444}
7445
7446
7447/***/ }),
7448/* 230 */
7449/***/ (function(module, exports, __webpack_require__) {
7450
7451var rng = __webpack_require__(414);
7452var bytesToUuid = __webpack_require__(415);
7453
7454function v4(options, buf, offset) {
7455 var i = buf && offset || 0;
7456
7457 if (typeof(options) == 'string') {
7458 buf = options === 'binary' ? new Array(16) : null;
7459 options = null;
7460 }
7461 options = options || {};
7462
7463 var rnds = options.random || (options.rng || rng)();
7464
7465 // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
7466 rnds[6] = (rnds[6] & 0x0f) | 0x40;
7467 rnds[8] = (rnds[8] & 0x3f) | 0x80;
7468
7469 // Copy bytes to buffer, if provided
7470 if (buf) {
7471 for (var ii = 0; ii < 16; ++ii) {
7472 buf[i + ii] = rnds[ii];
7473 }
7474 }
7475
7476 return buf || bytesToUuid(rnds);
7477}
7478
7479module.exports = v4;
7480
7481
7482/***/ }),
7483/* 231 */
7484/***/ (function(module, exports, __webpack_require__) {
7485
7486module.exports = __webpack_require__(232);
7487
7488/***/ }),
7489/* 232 */
7490/***/ (function(module, exports, __webpack_require__) {
7491
7492var parent = __webpack_require__(418);
7493
7494module.exports = parent;
7495
7496
7497/***/ }),
7498/* 233 */
7499/***/ (function(module, exports, __webpack_require__) {
7500
7501"use strict";
7502
7503
7504module.exports = '4.15.1';
7505
7506/***/ }),
7507/* 234 */
7508/***/ (function(module, exports, __webpack_require__) {
7509
7510"use strict";
7511
7512
7513var has = Object.prototype.hasOwnProperty
7514 , prefix = '~';
7515
7516/**
7517 * Constructor to create a storage for our `EE` objects.
7518 * An `Events` instance is a plain object whose properties are event names.
7519 *
7520 * @constructor
7521 * @api private
7522 */
7523function Events() {}
7524
7525//
7526// We try to not inherit from `Object.prototype`. In some engines creating an
7527// instance in this way is faster than calling `Object.create(null)` directly.
7528// If `Object.create(null)` is not supported we prefix the event names with a
7529// character to make sure that the built-in object properties are not
7530// overridden or used as an attack vector.
7531//
7532if (Object.create) {
7533 Events.prototype = Object.create(null);
7534
7535 //
7536 // This hack is needed because the `__proto__` property is still inherited in
7537 // some old browsers like Android 4, iPhone 5.1, Opera 11 and Safari 5.
7538 //
7539 if (!new Events().__proto__) prefix = false;
7540}
7541
7542/**
7543 * Representation of a single event listener.
7544 *
7545 * @param {Function} fn The listener function.
7546 * @param {Mixed} context The context to invoke the listener with.
7547 * @param {Boolean} [once=false] Specify if the listener is a one-time listener.
7548 * @constructor
7549 * @api private
7550 */
7551function EE(fn, context, once) {
7552 this.fn = fn;
7553 this.context = context;
7554 this.once = once || false;
7555}
7556
7557/**
7558 * Minimal `EventEmitter` interface that is molded against the Node.js
7559 * `EventEmitter` interface.
7560 *
7561 * @constructor
7562 * @api public
7563 */
7564function EventEmitter() {
7565 this._events = new Events();
7566 this._eventsCount = 0;
7567}
7568
7569/**
7570 * Return an array listing the events for which the emitter has registered
7571 * listeners.
7572 *
7573 * @returns {Array}
7574 * @api public
7575 */
7576EventEmitter.prototype.eventNames = function eventNames() {
7577 var names = []
7578 , events
7579 , name;
7580
7581 if (this._eventsCount === 0) return names;
7582
7583 for (name in (events = this._events)) {
7584 if (has.call(events, name)) names.push(prefix ? name.slice(1) : name);
7585 }
7586
7587 if (Object.getOwnPropertySymbols) {
7588 return names.concat(Object.getOwnPropertySymbols(events));
7589 }
7590
7591 return names;
7592};
7593
7594/**
7595 * Return the listeners registered for a given event.
7596 *
7597 * @param {String|Symbol} event The event name.
7598 * @param {Boolean} exists Only check if there are listeners.
7599 * @returns {Array|Boolean}
7600 * @api public
7601 */
7602EventEmitter.prototype.listeners = function listeners(event, exists) {
7603 var evt = prefix ? prefix + event : event
7604 , available = this._events[evt];
7605
7606 if (exists) return !!available;
7607 if (!available) return [];
7608 if (available.fn) return [available.fn];
7609
7610 for (var i = 0, l = available.length, ee = new Array(l); i < l; i++) {
7611 ee[i] = available[i].fn;
7612 }
7613
7614 return ee;
7615};
7616
7617/**
7618 * Calls each of the listeners registered for a given event.
7619 *
7620 * @param {String|Symbol} event The event name.
7621 * @returns {Boolean} `true` if the event had listeners, else `false`.
7622 * @api public
7623 */
7624EventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {
7625 var evt = prefix ? prefix + event : event;
7626
7627 if (!this._events[evt]) return false;
7628
7629 var listeners = this._events[evt]
7630 , len = arguments.length
7631 , args
7632 , i;
7633
7634 if (listeners.fn) {
7635 if (listeners.once) this.removeListener(event, listeners.fn, undefined, true);
7636
7637 switch (len) {
7638 case 1: return listeners.fn.call(listeners.context), true;
7639 case 2: return listeners.fn.call(listeners.context, a1), true;
7640 case 3: return listeners.fn.call(listeners.context, a1, a2), true;
7641 case 4: return listeners.fn.call(listeners.context, a1, a2, a3), true;
7642 case 5: return listeners.fn.call(listeners.context, a1, a2, a3, a4), true;
7643 case 6: return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true;
7644 }
7645
7646 for (i = 1, args = new Array(len -1); i < len; i++) {
7647 args[i - 1] = arguments[i];
7648 }
7649
7650 listeners.fn.apply(listeners.context, args);
7651 } else {
7652 var length = listeners.length
7653 , j;
7654
7655 for (i = 0; i < length; i++) {
7656 if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true);
7657
7658 switch (len) {
7659 case 1: listeners[i].fn.call(listeners[i].context); break;
7660 case 2: listeners[i].fn.call(listeners[i].context, a1); break;
7661 case 3: listeners[i].fn.call(listeners[i].context, a1, a2); break;
7662 case 4: listeners[i].fn.call(listeners[i].context, a1, a2, a3); break;
7663 default:
7664 if (!args) for (j = 1, args = new Array(len -1); j < len; j++) {
7665 args[j - 1] = arguments[j];
7666 }
7667
7668 listeners[i].fn.apply(listeners[i].context, args);
7669 }
7670 }
7671 }
7672
7673 return true;
7674};
7675
7676/**
7677 * Add a listener for a given event.
7678 *
7679 * @param {String|Symbol} event The event name.
7680 * @param {Function} fn The listener function.
7681 * @param {Mixed} [context=this] The context to invoke the listener with.
7682 * @returns {EventEmitter} `this`.
7683 * @api public
7684 */
7685EventEmitter.prototype.on = function on(event, fn, context) {
7686 var listener = new EE(fn, context || this)
7687 , evt = prefix ? prefix + event : event;
7688
7689 if (!this._events[evt]) this._events[evt] = listener, this._eventsCount++;
7690 else if (!this._events[evt].fn) this._events[evt].push(listener);
7691 else this._events[evt] = [this._events[evt], listener];
7692
7693 return this;
7694};
7695
7696/**
7697 * Add a one-time listener for a given event.
7698 *
7699 * @param {String|Symbol} event The event name.
7700 * @param {Function} fn The listener function.
7701 * @param {Mixed} [context=this] The context to invoke the listener with.
7702 * @returns {EventEmitter} `this`.
7703 * @api public
7704 */
7705EventEmitter.prototype.once = function once(event, fn, context) {
7706 var listener = new EE(fn, context || this, true)
7707 , evt = prefix ? prefix + event : event;
7708
7709 if (!this._events[evt]) this._events[evt] = listener, this._eventsCount++;
7710 else if (!this._events[evt].fn) this._events[evt].push(listener);
7711 else this._events[evt] = [this._events[evt], listener];
7712
7713 return this;
7714};
7715
7716/**
7717 * Remove the listeners of a given event.
7718 *
7719 * @param {String|Symbol} event The event name.
7720 * @param {Function} fn Only remove the listeners that match this function.
7721 * @param {Mixed} context Only remove the listeners that have this context.
7722 * @param {Boolean} once Only remove one-time listeners.
7723 * @returns {EventEmitter} `this`.
7724 * @api public
7725 */
7726EventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) {
7727 var evt = prefix ? prefix + event : event;
7728
7729 if (!this._events[evt]) return this;
7730 if (!fn) {
7731 if (--this._eventsCount === 0) this._events = new Events();
7732 else delete this._events[evt];
7733 return this;
7734 }
7735
7736 var listeners = this._events[evt];
7737
7738 if (listeners.fn) {
7739 if (
7740 listeners.fn === fn
7741 && (!once || listeners.once)
7742 && (!context || listeners.context === context)
7743 ) {
7744 if (--this._eventsCount === 0) this._events = new Events();
7745 else delete this._events[evt];
7746 }
7747 } else {
7748 for (var i = 0, events = [], length = listeners.length; i < length; i++) {
7749 if (
7750 listeners[i].fn !== fn
7751 || (once && !listeners[i].once)
7752 || (context && listeners[i].context !== context)
7753 ) {
7754 events.push(listeners[i]);
7755 }
7756 }
7757
7758 //
7759 // Reset the array, or remove it completely if we have no more listeners.
7760 //
7761 if (events.length) this._events[evt] = events.length === 1 ? events[0] : events;
7762 else if (--this._eventsCount === 0) this._events = new Events();
7763 else delete this._events[evt];
7764 }
7765
7766 return this;
7767};
7768
7769/**
7770 * Remove all listeners, or those of the specified event.
7771 *
7772 * @param {String|Symbol} [event] The event name.
7773 * @returns {EventEmitter} `this`.
7774 * @api public
7775 */
7776EventEmitter.prototype.removeAllListeners = function removeAllListeners(event) {
7777 var evt;
7778
7779 if (event) {
7780 evt = prefix ? prefix + event : event;
7781 if (this._events[evt]) {
7782 if (--this._eventsCount === 0) this._events = new Events();
7783 else delete this._events[evt];
7784 }
7785 } else {
7786 this._events = new Events();
7787 this._eventsCount = 0;
7788 }
7789
7790 return this;
7791};
7792
7793//
7794// Alias methods names because people roll like that.
7795//
7796EventEmitter.prototype.off = EventEmitter.prototype.removeListener;
7797EventEmitter.prototype.addListener = EventEmitter.prototype.on;
7798
7799//
7800// This function doesn't apply anymore.
7801//
7802EventEmitter.prototype.setMaxListeners = function setMaxListeners() {
7803 return this;
7804};
7805
7806//
7807// Expose the prefix.
7808//
7809EventEmitter.prefixed = prefix;
7810
7811//
7812// Allow `EventEmitter` to be imported as module namespace.
7813//
7814EventEmitter.EventEmitter = EventEmitter;
7815
7816//
7817// Expose the module.
7818//
7819if (true) {
7820 module.exports = EventEmitter;
7821}
7822
7823
7824/***/ }),
7825/* 235 */
7826/***/ (function(module, exports, __webpack_require__) {
7827
7828"use strict";
7829
7830
7831var _interopRequireDefault = __webpack_require__(1);
7832
7833var _promise = _interopRequireDefault(__webpack_require__(12));
7834
7835var _require = __webpack_require__(76),
7836 getAdapter = _require.getAdapter;
7837
7838var syncApiNames = ['getItem', 'setItem', 'removeItem', 'clear'];
7839var localStorage = {
7840 get async() {
7841 return getAdapter('storage').async;
7842 }
7843
7844}; // wrap sync apis with async ones.
7845
7846syncApiNames.forEach(function (apiName) {
7847 localStorage[apiName + 'Async'] = function () {
7848 var storage = getAdapter('storage');
7849 return _promise.default.resolve(storage[apiName].apply(storage, arguments));
7850 };
7851
7852 localStorage[apiName] = function () {
7853 var storage = getAdapter('storage');
7854
7855 if (!storage.async) {
7856 return storage[apiName].apply(storage, arguments);
7857 }
7858
7859 var error = new Error('Synchronous API [' + apiName + '] is not available in this runtime.');
7860 error.code = 'SYNC_API_NOT_AVAILABLE';
7861 throw error;
7862 };
7863});
7864module.exports = localStorage;
7865
7866/***/ }),
7867/* 236 */
7868/***/ (function(module, exports, __webpack_require__) {
7869
7870"use strict";
7871
7872
7873var _interopRequireDefault = __webpack_require__(1);
7874
7875var _concat = _interopRequireDefault(__webpack_require__(19));
7876
7877var _stringify = _interopRequireDefault(__webpack_require__(38));
7878
7879var storage = __webpack_require__(235);
7880
7881var AV = __webpack_require__(74);
7882
7883var removeAsync = exports.removeAsync = storage.removeItemAsync.bind(storage);
7884
7885var getCacheData = function getCacheData(cacheData, key) {
7886 try {
7887 cacheData = JSON.parse(cacheData);
7888 } catch (e) {
7889 return null;
7890 }
7891
7892 if (cacheData) {
7893 var expired = cacheData.expiredAt && cacheData.expiredAt < Date.now();
7894
7895 if (!expired) {
7896 return cacheData.value;
7897 }
7898
7899 return removeAsync(key).then(function () {
7900 return null;
7901 });
7902 }
7903
7904 return null;
7905};
7906
7907exports.getAsync = function (key) {
7908 var _context;
7909
7910 key = (0, _concat.default)(_context = "AV/".concat(AV.applicationId, "/")).call(_context, key);
7911 return storage.getItemAsync(key).then(function (cache) {
7912 return getCacheData(cache, key);
7913 });
7914};
7915
7916exports.setAsync = function (key, value, ttl) {
7917 var _context2;
7918
7919 var cache = {
7920 value: value
7921 };
7922
7923 if (typeof ttl === 'number') {
7924 cache.expiredAt = Date.now() + ttl;
7925 }
7926
7927 return storage.setItemAsync((0, _concat.default)(_context2 = "AV/".concat(AV.applicationId, "/")).call(_context2, key), (0, _stringify.default)(cache));
7928};
7929
7930/***/ }),
7931/* 237 */
7932/***/ (function(module, exports, __webpack_require__) {
7933
7934var parent = __webpack_require__(421);
7935
7936module.exports = parent;
7937
7938
7939/***/ }),
7940/* 238 */
7941/***/ (function(module, exports, __webpack_require__) {
7942
7943var parent = __webpack_require__(424);
7944
7945module.exports = parent;
7946
7947
7948/***/ }),
7949/* 239 */
7950/***/ (function(module, exports, __webpack_require__) {
7951
7952var parent = __webpack_require__(427);
7953
7954module.exports = parent;
7955
7956
7957/***/ }),
7958/* 240 */
7959/***/ (function(module, exports, __webpack_require__) {
7960
7961module.exports = __webpack_require__(430);
7962
7963/***/ }),
7964/* 241 */
7965/***/ (function(module, exports, __webpack_require__) {
7966
7967var parent = __webpack_require__(433);
7968__webpack_require__(46);
7969
7970module.exports = parent;
7971
7972
7973/***/ }),
7974/* 242 */
7975/***/ (function(module, exports, __webpack_require__) {
7976
7977// TODO: Remove this module from `core-js@4` since it's split to modules listed below
7978__webpack_require__(434);
7979__webpack_require__(435);
7980__webpack_require__(436);
7981__webpack_require__(229);
7982__webpack_require__(437);
7983
7984
7985/***/ }),
7986/* 243 */
7987/***/ (function(module, exports, __webpack_require__) {
7988
7989/* eslint-disable es-x/no-object-getownpropertynames -- safe */
7990var classof = __webpack_require__(50);
7991var toIndexedObject = __webpack_require__(35);
7992var $getOwnPropertyNames = __webpack_require__(105).f;
7993var arraySlice = __webpack_require__(244);
7994
7995var windowNames = typeof window == 'object' && window && Object.getOwnPropertyNames
7996 ? Object.getOwnPropertyNames(window) : [];
7997
7998var getWindowNames = function (it) {
7999 try {
8000 return $getOwnPropertyNames(it);
8001 } catch (error) {
8002 return arraySlice(windowNames);
8003 }
8004};
8005
8006// fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window
8007module.exports.f = function getOwnPropertyNames(it) {
8008 return windowNames && classof(it) == 'Window'
8009 ? getWindowNames(it)
8010 : $getOwnPropertyNames(toIndexedObject(it));
8011};
8012
8013
8014/***/ }),
8015/* 244 */
8016/***/ (function(module, exports, __webpack_require__) {
8017
8018var toAbsoluteIndex = __webpack_require__(126);
8019var lengthOfArrayLike = __webpack_require__(40);
8020var createProperty = __webpack_require__(93);
8021
8022var $Array = Array;
8023var max = Math.max;
8024
8025module.exports = function (O, start, end) {
8026 var length = lengthOfArrayLike(O);
8027 var k = toAbsoluteIndex(start, length);
8028 var fin = toAbsoluteIndex(end === undefined ? length : end, length);
8029 var result = $Array(max(fin - k, 0));
8030 for (var n = 0; k < fin; k++, n++) createProperty(result, n, O[k]);
8031 result.length = n;
8032 return result;
8033};
8034
8035
8036/***/ }),
8037/* 245 */
8038/***/ (function(module, exports, __webpack_require__) {
8039
8040var call = __webpack_require__(15);
8041var getBuiltIn = __webpack_require__(20);
8042var wellKnownSymbol = __webpack_require__(5);
8043var defineBuiltIn = __webpack_require__(45);
8044
8045module.exports = function () {
8046 var Symbol = getBuiltIn('Symbol');
8047 var SymbolPrototype = Symbol && Symbol.prototype;
8048 var valueOf = SymbolPrototype && SymbolPrototype.valueOf;
8049 var TO_PRIMITIVE = wellKnownSymbol('toPrimitive');
8050
8051 if (SymbolPrototype && !SymbolPrototype[TO_PRIMITIVE]) {
8052 // `Symbol.prototype[@@toPrimitive]` method
8053 // https://tc39.es/ecma262/#sec-symbol.prototype-@@toprimitive
8054 // eslint-disable-next-line no-unused-vars -- required for .length
8055 defineBuiltIn(SymbolPrototype, TO_PRIMITIVE, function (hint) {
8056 return call(valueOf, this);
8057 }, { arity: 1 });
8058 }
8059};
8060
8061
8062/***/ }),
8063/* 246 */
8064/***/ (function(module, exports, __webpack_require__) {
8065
8066var NATIVE_SYMBOL = __webpack_require__(65);
8067
8068/* eslint-disable es-x/no-symbol -- safe */
8069module.exports = NATIVE_SYMBOL && !!Symbol['for'] && !!Symbol.keyFor;
8070
8071
8072/***/ }),
8073/* 247 */
8074/***/ (function(module, exports, __webpack_require__) {
8075
8076var defineWellKnownSymbol = __webpack_require__(10);
8077
8078// `Symbol.iterator` well-known symbol
8079// https://tc39.es/ecma262/#sec-symbol.iterator
8080defineWellKnownSymbol('iterator');
8081
8082
8083/***/ }),
8084/* 248 */
8085/***/ (function(module, exports, __webpack_require__) {
8086
8087var parent = __webpack_require__(466);
8088__webpack_require__(46);
8089
8090module.exports = parent;
8091
8092
8093/***/ }),
8094/* 249 */
8095/***/ (function(module, exports, __webpack_require__) {
8096
8097module.exports = __webpack_require__(467);
8098
8099/***/ }),
8100/* 250 */
8101/***/ (function(module, exports, __webpack_require__) {
8102
8103"use strict";
8104// Copyright (c) 2015-2017 David M. Lee, II
8105
8106
8107/**
8108 * Local reference to TimeoutError
8109 * @private
8110 */
8111var TimeoutError;
8112
8113/**
8114 * Rejects a promise with a {@link TimeoutError} if it does not settle within
8115 * the specified timeout.
8116 *
8117 * @param {Promise} promise The promise.
8118 * @param {number} timeoutMillis Number of milliseconds to wait on settling.
8119 * @returns {Promise} Either resolves/rejects with `promise`, or rejects with
8120 * `TimeoutError`, whichever settles first.
8121 */
8122var timeout = module.exports.timeout = function(promise, timeoutMillis) {
8123 var error = new TimeoutError(),
8124 timeout;
8125
8126 return Promise.race([
8127 promise,
8128 new Promise(function(resolve, reject) {
8129 timeout = setTimeout(function() {
8130 reject(error);
8131 }, timeoutMillis);
8132 }),
8133 ]).then(function(v) {
8134 clearTimeout(timeout);
8135 return v;
8136 }, function(err) {
8137 clearTimeout(timeout);
8138 throw err;
8139 });
8140};
8141
8142/**
8143 * Exception indicating that the timeout expired.
8144 */
8145TimeoutError = module.exports.TimeoutError = function() {
8146 Error.call(this)
8147 this.stack = Error().stack
8148 this.message = 'Timeout';
8149};
8150
8151TimeoutError.prototype = Object.create(Error.prototype);
8152TimeoutError.prototype.name = "TimeoutError";
8153
8154
8155/***/ }),
8156/* 251 */
8157/***/ (function(module, exports, __webpack_require__) {
8158
8159var parent = __webpack_require__(483);
8160
8161module.exports = parent;
8162
8163
8164/***/ }),
8165/* 252 */
8166/***/ (function(module, exports, __webpack_require__) {
8167
8168module.exports = __webpack_require__(487);
8169
8170/***/ }),
8171/* 253 */
8172/***/ (function(module, exports, __webpack_require__) {
8173
8174"use strict";
8175
8176var uncurryThis = __webpack_require__(4);
8177var aCallable = __webpack_require__(29);
8178var isObject = __webpack_require__(11);
8179var hasOwn = __webpack_require__(13);
8180var arraySlice = __webpack_require__(112);
8181var NATIVE_BIND = __webpack_require__(80);
8182
8183var $Function = Function;
8184var concat = uncurryThis([].concat);
8185var join = uncurryThis([].join);
8186var factories = {};
8187
8188var construct = function (C, argsLength, args) {
8189 if (!hasOwn(factories, argsLength)) {
8190 for (var list = [], i = 0; i < argsLength; i++) list[i] = 'a[' + i + ']';
8191 factories[argsLength] = $Function('C,a', 'return new C(' + join(list, ',') + ')');
8192 } return factories[argsLength](C, args);
8193};
8194
8195// `Function.prototype.bind` method implementation
8196// https://tc39.es/ecma262/#sec-function.prototype.bind
8197module.exports = NATIVE_BIND ? $Function.bind : function bind(that /* , ...args */) {
8198 var F = aCallable(this);
8199 var Prototype = F.prototype;
8200 var partArgs = arraySlice(arguments, 1);
8201 var boundFunction = function bound(/* args... */) {
8202 var args = concat(partArgs, arraySlice(arguments));
8203 return this instanceof boundFunction ? construct(F, args.length, args) : F.apply(that, args);
8204 };
8205 if (isObject(Prototype)) boundFunction.prototype = Prototype;
8206 return boundFunction;
8207};
8208
8209
8210/***/ }),
8211/* 254 */
8212/***/ (function(module, exports, __webpack_require__) {
8213
8214module.exports = __webpack_require__(508);
8215
8216/***/ }),
8217/* 255 */
8218/***/ (function(module, exports, __webpack_require__) {
8219
8220module.exports = __webpack_require__(511);
8221
8222/***/ }),
8223/* 256 */
8224/***/ (function(module, exports) {
8225
8226var charenc = {
8227 // UTF-8 encoding
8228 utf8: {
8229 // Convert a string to a byte array
8230 stringToBytes: function(str) {
8231 return charenc.bin.stringToBytes(unescape(encodeURIComponent(str)));
8232 },
8233
8234 // Convert a byte array to a string
8235 bytesToString: function(bytes) {
8236 return decodeURIComponent(escape(charenc.bin.bytesToString(bytes)));
8237 }
8238 },
8239
8240 // Binary encoding
8241 bin: {
8242 // Convert a string to a byte array
8243 stringToBytes: function(str) {
8244 for (var bytes = [], i = 0; i < str.length; i++)
8245 bytes.push(str.charCodeAt(i) & 0xFF);
8246 return bytes;
8247 },
8248
8249 // Convert a byte array to a string
8250 bytesToString: function(bytes) {
8251 for (var str = [], i = 0; i < bytes.length; i++)
8252 str.push(String.fromCharCode(bytes[i]));
8253 return str.join('');
8254 }
8255 }
8256};
8257
8258module.exports = charenc;
8259
8260
8261/***/ }),
8262/* 257 */
8263/***/ (function(module, exports, __webpack_require__) {
8264
8265module.exports = __webpack_require__(555);
8266
8267/***/ }),
8268/* 258 */
8269/***/ (function(module, exports, __webpack_require__) {
8270
8271"use strict";
8272
8273
8274var adapters = __webpack_require__(572);
8275
8276module.exports = function (AV) {
8277 AV.setAdapters(adapters);
8278 return AV;
8279};
8280
8281/***/ }),
8282/* 259 */
8283/***/ (function(module, exports) {
8284
8285// a string of all valid unicode whitespaces
8286module.exports = '\u0009\u000A\u000B\u000C\u000D\u0020\u00A0\u1680\u2000\u2001\u2002' +
8287 '\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF';
8288
8289
8290/***/ }),
8291/* 260 */
8292/***/ (function(module, exports, __webpack_require__) {
8293
8294"use strict";
8295
8296
8297var _interopRequireDefault = __webpack_require__(1);
8298
8299var _symbol = _interopRequireDefault(__webpack_require__(77));
8300
8301var _iterator = _interopRequireDefault(__webpack_require__(154));
8302
8303function _typeof(obj) {
8304 "@babel/helpers - typeof";
8305
8306 if (typeof _symbol.default === "function" && typeof _iterator.default === "symbol") {
8307 _typeof = function _typeof(obj) {
8308 return typeof obj;
8309 };
8310 } else {
8311 _typeof = function _typeof(obj) {
8312 return obj && typeof _symbol.default === "function" && obj.constructor === _symbol.default && obj !== _symbol.default.prototype ? "symbol" : typeof obj;
8313 };
8314 }
8315
8316 return _typeof(obj);
8317}
8318/**
8319 * Check if `obj` is an object.
8320 *
8321 * @param {Object} obj
8322 * @return {Boolean}
8323 * @api private
8324 */
8325
8326
8327function isObject(obj) {
8328 return obj !== null && _typeof(obj) === 'object';
8329}
8330
8331module.exports = isObject;
8332
8333/***/ }),
8334/* 261 */
8335/***/ (function(module, exports, __webpack_require__) {
8336
8337module.exports = __webpack_require__(608);
8338
8339/***/ }),
8340/* 262 */
8341/***/ (function(module, exports, __webpack_require__) {
8342
8343module.exports = __webpack_require__(614);
8344
8345/***/ }),
8346/* 263 */
8347/***/ (function(module, exports, __webpack_require__) {
8348
8349var fails = __webpack_require__(2);
8350
8351module.exports = !fails(function () {
8352 // eslint-disable-next-line es-x/no-object-isextensible, es-x/no-object-preventextensions -- required for testing
8353 return Object.isExtensible(Object.preventExtensions({}));
8354});
8355
8356
8357/***/ }),
8358/* 264 */
8359/***/ (function(module, exports, __webpack_require__) {
8360
8361var fails = __webpack_require__(2);
8362var isObject = __webpack_require__(11);
8363var classof = __webpack_require__(50);
8364var ARRAY_BUFFER_NON_EXTENSIBLE = __webpack_require__(626);
8365
8366// eslint-disable-next-line es-x/no-object-isextensible -- safe
8367var $isExtensible = Object.isExtensible;
8368var FAILS_ON_PRIMITIVES = fails(function () { $isExtensible(1); });
8369
8370// `Object.isExtensible` method
8371// https://tc39.es/ecma262/#sec-object.isextensible
8372module.exports = (FAILS_ON_PRIMITIVES || ARRAY_BUFFER_NON_EXTENSIBLE) ? function isExtensible(it) {
8373 if (!isObject(it)) return false;
8374 if (ARRAY_BUFFER_NON_EXTENSIBLE && classof(it) == 'ArrayBuffer') return false;
8375 return $isExtensible ? $isExtensible(it) : true;
8376} : $isExtensible;
8377
8378
8379/***/ }),
8380/* 265 */
8381/***/ (function(module, exports, __webpack_require__) {
8382
8383module.exports = __webpack_require__(627);
8384
8385/***/ }),
8386/* 266 */
8387/***/ (function(module, exports, __webpack_require__) {
8388
8389module.exports = __webpack_require__(631);
8390
8391/***/ }),
8392/* 267 */
8393/***/ (function(module, exports, __webpack_require__) {
8394
8395"use strict";
8396
8397var $ = __webpack_require__(0);
8398var global = __webpack_require__(8);
8399var InternalMetadataModule = __webpack_require__(97);
8400var fails = __webpack_require__(2);
8401var createNonEnumerableProperty = __webpack_require__(39);
8402var iterate = __webpack_require__(41);
8403var anInstance = __webpack_require__(110);
8404var isCallable = __webpack_require__(9);
8405var isObject = __webpack_require__(11);
8406var setToStringTag = __webpack_require__(56);
8407var defineProperty = __webpack_require__(23).f;
8408var forEach = __webpack_require__(75).forEach;
8409var DESCRIPTORS = __webpack_require__(14);
8410var InternalStateModule = __webpack_require__(44);
8411
8412var setInternalState = InternalStateModule.set;
8413var internalStateGetterFor = InternalStateModule.getterFor;
8414
8415module.exports = function (CONSTRUCTOR_NAME, wrapper, common) {
8416 var IS_MAP = CONSTRUCTOR_NAME.indexOf('Map') !== -1;
8417 var IS_WEAK = CONSTRUCTOR_NAME.indexOf('Weak') !== -1;
8418 var ADDER = IS_MAP ? 'set' : 'add';
8419 var NativeConstructor = global[CONSTRUCTOR_NAME];
8420 var NativePrototype = NativeConstructor && NativeConstructor.prototype;
8421 var exported = {};
8422 var Constructor;
8423
8424 if (!DESCRIPTORS || !isCallable(NativeConstructor)
8425 || !(IS_WEAK || NativePrototype.forEach && !fails(function () { new NativeConstructor().entries().next(); }))
8426 ) {
8427 // create collection constructor
8428 Constructor = common.getConstructor(wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER);
8429 InternalMetadataModule.enable();
8430 } else {
8431 Constructor = wrapper(function (target, iterable) {
8432 setInternalState(anInstance(target, Prototype), {
8433 type: CONSTRUCTOR_NAME,
8434 collection: new NativeConstructor()
8435 });
8436 if (iterable != undefined) iterate(iterable, target[ADDER], { that: target, AS_ENTRIES: IS_MAP });
8437 });
8438
8439 var Prototype = Constructor.prototype;
8440
8441 var getInternalState = internalStateGetterFor(CONSTRUCTOR_NAME);
8442
8443 forEach(['add', 'clear', 'delete', 'forEach', 'get', 'has', 'set', 'keys', 'values', 'entries'], function (KEY) {
8444 var IS_ADDER = KEY == 'add' || KEY == 'set';
8445 if (KEY in NativePrototype && !(IS_WEAK && KEY == 'clear')) {
8446 createNonEnumerableProperty(Prototype, KEY, function (a, b) {
8447 var collection = getInternalState(this).collection;
8448 if (!IS_ADDER && IS_WEAK && !isObject(a)) return KEY == 'get' ? undefined : false;
8449 var result = collection[KEY](a === 0 ? 0 : a, b);
8450 return IS_ADDER ? this : result;
8451 });
8452 }
8453 });
8454
8455 IS_WEAK || defineProperty(Prototype, 'size', {
8456 configurable: true,
8457 get: function () {
8458 return getInternalState(this).collection.size;
8459 }
8460 });
8461 }
8462
8463 setToStringTag(Constructor, CONSTRUCTOR_NAME, false, true);
8464
8465 exported[CONSTRUCTOR_NAME] = Constructor;
8466 $({ global: true, forced: true }, exported);
8467
8468 if (!IS_WEAK) common.setStrong(Constructor, CONSTRUCTOR_NAME, IS_MAP);
8469
8470 return Constructor;
8471};
8472
8473
8474/***/ }),
8475/* 268 */
8476/***/ (function(module, exports, __webpack_require__) {
8477
8478module.exports = __webpack_require__(647);
8479
8480/***/ }),
8481/* 269 */
8482/***/ (function(module, exports) {
8483
8484function _arrayLikeToArray(arr, len) {
8485 if (len == null || len > arr.length) len = arr.length;
8486
8487 for (var i = 0, arr2 = new Array(len); i < len; i++) {
8488 arr2[i] = arr[i];
8489 }
8490
8491 return arr2;
8492}
8493
8494module.exports = _arrayLikeToArray;
8495
8496/***/ }),
8497/* 270 */
8498/***/ (function(module, exports) {
8499
8500function _iterableToArray(iter) {
8501 if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter);
8502}
8503
8504module.exports = _iterableToArray;
8505
8506/***/ }),
8507/* 271 */
8508/***/ (function(module, exports, __webpack_require__) {
8509
8510var arrayLikeToArray = __webpack_require__(269);
8511
8512function _unsupportedIterableToArray(o, minLen) {
8513 if (!o) return;
8514 if (typeof o === "string") return arrayLikeToArray(o, minLen);
8515 var n = Object.prototype.toString.call(o).slice(8, -1);
8516 if (n === "Object" && o.constructor) n = o.constructor.name;
8517 if (n === "Map" || n === "Set") return Array.from(o);
8518 if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return arrayLikeToArray(o, minLen);
8519}
8520
8521module.exports = _unsupportedIterableToArray;
8522
8523/***/ }),
8524/* 272 */
8525/***/ (function(module, exports, __webpack_require__) {
8526
8527var baseRandom = __webpack_require__(671);
8528
8529/**
8530 * A specialized version of `_.shuffle` which mutates and sets the size of `array`.
8531 *
8532 * @private
8533 * @param {Array} array The array to shuffle.
8534 * @param {number} [size=array.length] The size of `array`.
8535 * @returns {Array} Returns `array`.
8536 */
8537function shuffleSelf(array, size) {
8538 var index = -1,
8539 length = array.length,
8540 lastIndex = length - 1;
8541
8542 size = size === undefined ? length : size;
8543 while (++index < size) {
8544 var rand = baseRandom(index, lastIndex),
8545 value = array[rand];
8546
8547 array[rand] = array[index];
8548 array[index] = value;
8549 }
8550 array.length = size;
8551 return array;
8552}
8553
8554module.exports = shuffleSelf;
8555
8556
8557/***/ }),
8558/* 273 */
8559/***/ (function(module, exports, __webpack_require__) {
8560
8561var baseValues = __webpack_require__(673),
8562 keys = __webpack_require__(675);
8563
8564/**
8565 * Creates an array of the own enumerable string keyed property values of `object`.
8566 *
8567 * **Note:** Non-object values are coerced to objects.
8568 *
8569 * @static
8570 * @since 0.1.0
8571 * @memberOf _
8572 * @category Object
8573 * @param {Object} object The object to query.
8574 * @returns {Array} Returns the array of property values.
8575 * @example
8576 *
8577 * function Foo() {
8578 * this.a = 1;
8579 * this.b = 2;
8580 * }
8581 *
8582 * Foo.prototype.c = 3;
8583 *
8584 * _.values(new Foo);
8585 * // => [1, 2] (iteration order is not guaranteed)
8586 *
8587 * _.values('hi');
8588 * // => ['h', 'i']
8589 */
8590function values(object) {
8591 return object == null ? [] : baseValues(object, keys(object));
8592}
8593
8594module.exports = values;
8595
8596
8597/***/ }),
8598/* 274 */
8599/***/ (function(module, exports, __webpack_require__) {
8600
8601var root = __webpack_require__(275);
8602
8603/** Built-in value references. */
8604var Symbol = root.Symbol;
8605
8606module.exports = Symbol;
8607
8608
8609/***/ }),
8610/* 275 */
8611/***/ (function(module, exports, __webpack_require__) {
8612
8613var freeGlobal = __webpack_require__(276);
8614
8615/** Detect free variable `self`. */
8616var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
8617
8618/** Used as a reference to the global object. */
8619var root = freeGlobal || freeSelf || Function('return this')();
8620
8621module.exports = root;
8622
8623
8624/***/ }),
8625/* 276 */
8626/***/ (function(module, exports, __webpack_require__) {
8627
8628/* WEBPACK VAR INJECTION */(function(global) {/** Detect free variable `global` from Node.js. */
8629var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
8630
8631module.exports = freeGlobal;
8632
8633/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(78)))
8634
8635/***/ }),
8636/* 277 */
8637/***/ (function(module, exports) {
8638
8639/**
8640 * Checks if `value` is classified as an `Array` object.
8641 *
8642 * @static
8643 * @memberOf _
8644 * @since 0.1.0
8645 * @category Lang
8646 * @param {*} value The value to check.
8647 * @returns {boolean} Returns `true` if `value` is an array, else `false`.
8648 * @example
8649 *
8650 * _.isArray([1, 2, 3]);
8651 * // => true
8652 *
8653 * _.isArray(document.body.children);
8654 * // => false
8655 *
8656 * _.isArray('abc');
8657 * // => false
8658 *
8659 * _.isArray(_.noop);
8660 * // => false
8661 */
8662var isArray = Array.isArray;
8663
8664module.exports = isArray;
8665
8666
8667/***/ }),
8668/* 278 */
8669/***/ (function(module, exports) {
8670
8671module.exports = function(module) {
8672 if(!module.webpackPolyfill) {
8673 module.deprecate = function() {};
8674 module.paths = [];
8675 // module.parent = undefined by default
8676 if(!module.children) module.children = [];
8677 Object.defineProperty(module, "loaded", {
8678 enumerable: true,
8679 get: function() {
8680 return module.l;
8681 }
8682 });
8683 Object.defineProperty(module, "id", {
8684 enumerable: true,
8685 get: function() {
8686 return module.i;
8687 }
8688 });
8689 module.webpackPolyfill = 1;
8690 }
8691 return module;
8692};
8693
8694
8695/***/ }),
8696/* 279 */
8697/***/ (function(module, exports) {
8698
8699/** Used as references for various `Number` constants. */
8700var MAX_SAFE_INTEGER = 9007199254740991;
8701
8702/**
8703 * Checks if `value` is a valid array-like length.
8704 *
8705 * **Note:** This method is loosely based on
8706 * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
8707 *
8708 * @static
8709 * @memberOf _
8710 * @since 4.0.0
8711 * @category Lang
8712 * @param {*} value The value to check.
8713 * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
8714 * @example
8715 *
8716 * _.isLength(3);
8717 * // => true
8718 *
8719 * _.isLength(Number.MIN_VALUE);
8720 * // => false
8721 *
8722 * _.isLength(Infinity);
8723 * // => false
8724 *
8725 * _.isLength('3');
8726 * // => false
8727 */
8728function isLength(value) {
8729 return typeof value == 'number' &&
8730 value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
8731}
8732
8733module.exports = isLength;
8734
8735
8736/***/ }),
8737/* 280 */
8738/***/ (function(module, exports) {
8739
8740/**
8741 * Creates a unary function that invokes `func` with its argument transformed.
8742 *
8743 * @private
8744 * @param {Function} func The function to wrap.
8745 * @param {Function} transform The argument transform.
8746 * @returns {Function} Returns the new function.
8747 */
8748function overArg(func, transform) {
8749 return function(arg) {
8750 return func(transform(arg));
8751 };
8752}
8753
8754module.exports = overArg;
8755
8756
8757/***/ }),
8758/* 281 */
8759/***/ (function(module, exports, __webpack_require__) {
8760
8761"use strict";
8762
8763
8764var AV = __webpack_require__(282);
8765
8766var useLiveQuery = __webpack_require__(620);
8767
8768var useAdatpers = __webpack_require__(258);
8769
8770module.exports = useAdatpers(useLiveQuery(AV));
8771
8772/***/ }),
8773/* 282 */
8774/***/ (function(module, exports, __webpack_require__) {
8775
8776"use strict";
8777
8778
8779var AV = __webpack_require__(283);
8780
8781var useAdatpers = __webpack_require__(258);
8782
8783module.exports = useAdatpers(AV);
8784
8785/***/ }),
8786/* 283 */
8787/***/ (function(module, exports, __webpack_require__) {
8788
8789"use strict";
8790
8791
8792module.exports = __webpack_require__(284);
8793
8794/***/ }),
8795/* 284 */
8796/***/ (function(module, exports, __webpack_require__) {
8797
8798"use strict";
8799
8800
8801var _interopRequireDefault = __webpack_require__(1);
8802
8803var _promise = _interopRequireDefault(__webpack_require__(12));
8804
8805/*!
8806 * LeanCloud JavaScript SDK
8807 * https://leancloud.cn
8808 *
8809 * Copyright 2016 LeanCloud.cn, Inc.
8810 * The LeanCloud JavaScript SDK is freely distributable under the MIT license.
8811 */
8812var _ = __webpack_require__(3);
8813
8814var AV = __webpack_require__(74);
8815
8816AV._ = _;
8817AV.version = __webpack_require__(233);
8818AV.Promise = _promise.default;
8819AV.localStorage = __webpack_require__(235);
8820AV.Cache = __webpack_require__(236);
8821AV.Error = __webpack_require__(48);
8822
8823__webpack_require__(423);
8824
8825__webpack_require__(471)(AV);
8826
8827__webpack_require__(472)(AV);
8828
8829__webpack_require__(473)(AV);
8830
8831__webpack_require__(474)(AV);
8832
8833__webpack_require__(479)(AV);
8834
8835__webpack_require__(480)(AV);
8836
8837__webpack_require__(533)(AV);
8838
8839__webpack_require__(558)(AV);
8840
8841__webpack_require__(559)(AV);
8842
8843__webpack_require__(561)(AV);
8844
8845__webpack_require__(562)(AV);
8846
8847__webpack_require__(563)(AV);
8848
8849__webpack_require__(564)(AV);
8850
8851__webpack_require__(565)(AV);
8852
8853__webpack_require__(566)(AV);
8854
8855__webpack_require__(567)(AV);
8856
8857__webpack_require__(568)(AV);
8858
8859__webpack_require__(569)(AV);
8860
8861AV.Conversation = __webpack_require__(570);
8862
8863__webpack_require__(571);
8864
8865module.exports = AV;
8866/**
8867 * Options to controll the authentication for an operation
8868 * @typedef {Object} AuthOptions
8869 * @property {String} [sessionToken] Specify a user to excute the operation as.
8870 * @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.
8871 * @property {Boolean} [useMasterKey] Indicates whether masterKey is used for this operation. Only valid when masterKey is set.
8872 */
8873
8874/**
8875 * Options to controll the authentication for an SMS operation
8876 * @typedef {Object} SMSAuthOptions
8877 * @property {String} [sessionToken] Specify a user to excute the operation as.
8878 * @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.
8879 * @property {Boolean} [useMasterKey] Indicates whether masterKey is used for this operation. Only valid when masterKey is set.
8880 * @property {String} [validateToken] a validate token returned by {@link AV.Cloud.verifyCaptcha}
8881 */
8882
8883/***/ }),
8884/* 285 */
8885/***/ (function(module, exports, __webpack_require__) {
8886
8887var parent = __webpack_require__(286);
8888__webpack_require__(46);
8889
8890module.exports = parent;
8891
8892
8893/***/ }),
8894/* 286 */
8895/***/ (function(module, exports, __webpack_require__) {
8896
8897__webpack_require__(287);
8898__webpack_require__(43);
8899__webpack_require__(68);
8900__webpack_require__(302);
8901__webpack_require__(316);
8902__webpack_require__(317);
8903__webpack_require__(318);
8904__webpack_require__(70);
8905var path = __webpack_require__(7);
8906
8907module.exports = path.Promise;
8908
8909
8910/***/ }),
8911/* 287 */
8912/***/ (function(module, exports, __webpack_require__) {
8913
8914// TODO: Remove this module from `core-js@4` since it's replaced to module below
8915__webpack_require__(288);
8916
8917
8918/***/ }),
8919/* 288 */
8920/***/ (function(module, exports, __webpack_require__) {
8921
8922"use strict";
8923
8924var $ = __webpack_require__(0);
8925var isPrototypeOf = __webpack_require__(16);
8926var getPrototypeOf = __webpack_require__(102);
8927var setPrototypeOf = __webpack_require__(104);
8928var copyConstructorProperties = __webpack_require__(293);
8929var create = __webpack_require__(53);
8930var createNonEnumerableProperty = __webpack_require__(39);
8931var createPropertyDescriptor = __webpack_require__(49);
8932var clearErrorStack = __webpack_require__(296);
8933var installErrorCause = __webpack_require__(297);
8934var iterate = __webpack_require__(41);
8935var normalizeStringArgument = __webpack_require__(298);
8936var wellKnownSymbol = __webpack_require__(5);
8937var ERROR_STACK_INSTALLABLE = __webpack_require__(299);
8938
8939var TO_STRING_TAG = wellKnownSymbol('toStringTag');
8940var $Error = Error;
8941var push = [].push;
8942
8943var $AggregateError = function AggregateError(errors, message /* , options */) {
8944 var options = arguments.length > 2 ? arguments[2] : undefined;
8945 var isInstance = isPrototypeOf(AggregateErrorPrototype, this);
8946 var that;
8947 if (setPrototypeOf) {
8948 that = setPrototypeOf(new $Error(), isInstance ? getPrototypeOf(this) : AggregateErrorPrototype);
8949 } else {
8950 that = isInstance ? this : create(AggregateErrorPrototype);
8951 createNonEnumerableProperty(that, TO_STRING_TAG, 'Error');
8952 }
8953 if (message !== undefined) createNonEnumerableProperty(that, 'message', normalizeStringArgument(message));
8954 if (ERROR_STACK_INSTALLABLE) createNonEnumerableProperty(that, 'stack', clearErrorStack(that.stack, 1));
8955 installErrorCause(that, options);
8956 var errorsArray = [];
8957 iterate(errors, push, { that: errorsArray });
8958 createNonEnumerableProperty(that, 'errors', errorsArray);
8959 return that;
8960};
8961
8962if (setPrototypeOf) setPrototypeOf($AggregateError, $Error);
8963else copyConstructorProperties($AggregateError, $Error, { name: true });
8964
8965var AggregateErrorPrototype = $AggregateError.prototype = create($Error.prototype, {
8966 constructor: createPropertyDescriptor(1, $AggregateError),
8967 message: createPropertyDescriptor(1, ''),
8968 name: createPropertyDescriptor(1, 'AggregateError')
8969});
8970
8971// `AggregateError` constructor
8972// https://tc39.es/ecma262/#sec-aggregate-error-constructor
8973$({ global: true, constructor: true, arity: 2 }, {
8974 AggregateError: $AggregateError
8975});
8976
8977
8978/***/ }),
8979/* 289 */
8980/***/ (function(module, exports, __webpack_require__) {
8981
8982var call = __webpack_require__(15);
8983var isObject = __webpack_require__(11);
8984var isSymbol = __webpack_require__(100);
8985var getMethod = __webpack_require__(122);
8986var ordinaryToPrimitive = __webpack_require__(290);
8987var wellKnownSymbol = __webpack_require__(5);
8988
8989var $TypeError = TypeError;
8990var TO_PRIMITIVE = wellKnownSymbol('toPrimitive');
8991
8992// `ToPrimitive` abstract operation
8993// https://tc39.es/ecma262/#sec-toprimitive
8994module.exports = function (input, pref) {
8995 if (!isObject(input) || isSymbol(input)) return input;
8996 var exoticToPrim = getMethod(input, TO_PRIMITIVE);
8997 var result;
8998 if (exoticToPrim) {
8999 if (pref === undefined) pref = 'default';
9000 result = call(exoticToPrim, input, pref);
9001 if (!isObject(result) || isSymbol(result)) return result;
9002 throw $TypeError("Can't convert object to primitive value");
9003 }
9004 if (pref === undefined) pref = 'number';
9005 return ordinaryToPrimitive(input, pref);
9006};
9007
9008
9009/***/ }),
9010/* 290 */
9011/***/ (function(module, exports, __webpack_require__) {
9012
9013var call = __webpack_require__(15);
9014var isCallable = __webpack_require__(9);
9015var isObject = __webpack_require__(11);
9016
9017var $TypeError = TypeError;
9018
9019// `OrdinaryToPrimitive` abstract operation
9020// https://tc39.es/ecma262/#sec-ordinarytoprimitive
9021module.exports = function (input, pref) {
9022 var fn, val;
9023 if (pref === 'string' && isCallable(fn = input.toString) && !isObject(val = call(fn, input))) return val;
9024 if (isCallable(fn = input.valueOf) && !isObject(val = call(fn, input))) return val;
9025 if (pref !== 'string' && isCallable(fn = input.toString) && !isObject(val = call(fn, input))) return val;
9026 throw $TypeError("Can't convert object to primitive value");
9027};
9028
9029
9030/***/ }),
9031/* 291 */
9032/***/ (function(module, exports, __webpack_require__) {
9033
9034var global = __webpack_require__(8);
9035
9036// eslint-disable-next-line es-x/no-object-defineproperty -- safe
9037var defineProperty = Object.defineProperty;
9038
9039module.exports = function (key, value) {
9040 try {
9041 defineProperty(global, key, { value: value, configurable: true, writable: true });
9042 } catch (error) {
9043 global[key] = value;
9044 } return value;
9045};
9046
9047
9048/***/ }),
9049/* 292 */
9050/***/ (function(module, exports, __webpack_require__) {
9051
9052var isCallable = __webpack_require__(9);
9053
9054var $String = String;
9055var $TypeError = TypeError;
9056
9057module.exports = function (argument) {
9058 if (typeof argument == 'object' || isCallable(argument)) return argument;
9059 throw $TypeError("Can't set " + $String(argument) + ' as a prototype');
9060};
9061
9062
9063/***/ }),
9064/* 293 */
9065/***/ (function(module, exports, __webpack_require__) {
9066
9067var hasOwn = __webpack_require__(13);
9068var ownKeys = __webpack_require__(162);
9069var getOwnPropertyDescriptorModule = __webpack_require__(64);
9070var definePropertyModule = __webpack_require__(23);
9071
9072module.exports = function (target, source, exceptions) {
9073 var keys = ownKeys(source);
9074 var defineProperty = definePropertyModule.f;
9075 var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
9076 for (var i = 0; i < keys.length; i++) {
9077 var key = keys[i];
9078 if (!hasOwn(target, key) && !(exceptions && hasOwn(exceptions, key))) {
9079 defineProperty(target, key, getOwnPropertyDescriptor(source, key));
9080 }
9081 }
9082};
9083
9084
9085/***/ }),
9086/* 294 */
9087/***/ (function(module, exports) {
9088
9089var ceil = Math.ceil;
9090var floor = Math.floor;
9091
9092// `Math.trunc` method
9093// https://tc39.es/ecma262/#sec-math.trunc
9094// eslint-disable-next-line es-x/no-math-trunc -- safe
9095module.exports = Math.trunc || function trunc(x) {
9096 var n = +x;
9097 return (n > 0 ? floor : ceil)(n);
9098};
9099
9100
9101/***/ }),
9102/* 295 */
9103/***/ (function(module, exports, __webpack_require__) {
9104
9105var toIntegerOrInfinity = __webpack_require__(127);
9106
9107var min = Math.min;
9108
9109// `ToLength` abstract operation
9110// https://tc39.es/ecma262/#sec-tolength
9111module.exports = function (argument) {
9112 return argument > 0 ? min(toIntegerOrInfinity(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991
9113};
9114
9115
9116/***/ }),
9117/* 296 */
9118/***/ (function(module, exports, __webpack_require__) {
9119
9120var uncurryThis = __webpack_require__(4);
9121
9122var $Error = Error;
9123var replace = uncurryThis(''.replace);
9124
9125var TEST = (function (arg) { return String($Error(arg).stack); })('zxcasd');
9126var V8_OR_CHAKRA_STACK_ENTRY = /\n\s*at [^:]*:[^\n]*/;
9127var IS_V8_OR_CHAKRA_STACK = V8_OR_CHAKRA_STACK_ENTRY.test(TEST);
9128
9129module.exports = function (stack, dropEntries) {
9130 if (IS_V8_OR_CHAKRA_STACK && typeof stack == 'string' && !$Error.prepareStackTrace) {
9131 while (dropEntries--) stack = replace(stack, V8_OR_CHAKRA_STACK_ENTRY, '');
9132 } return stack;
9133};
9134
9135
9136/***/ }),
9137/* 297 */
9138/***/ (function(module, exports, __webpack_require__) {
9139
9140var isObject = __webpack_require__(11);
9141var createNonEnumerableProperty = __webpack_require__(39);
9142
9143// `InstallErrorCause` abstract operation
9144// https://tc39.es/proposal-error-cause/#sec-errorobjects-install-error-cause
9145module.exports = function (O, options) {
9146 if (isObject(options) && 'cause' in options) {
9147 createNonEnumerableProperty(O, 'cause', options.cause);
9148 }
9149};
9150
9151
9152/***/ }),
9153/* 298 */
9154/***/ (function(module, exports, __webpack_require__) {
9155
9156var toString = __webpack_require__(42);
9157
9158module.exports = function (argument, $default) {
9159 return argument === undefined ? arguments.length < 2 ? '' : $default : toString(argument);
9160};
9161
9162
9163/***/ }),
9164/* 299 */
9165/***/ (function(module, exports, __webpack_require__) {
9166
9167var fails = __webpack_require__(2);
9168var createPropertyDescriptor = __webpack_require__(49);
9169
9170module.exports = !fails(function () {
9171 var error = Error('a');
9172 if (!('stack' in error)) return true;
9173 // eslint-disable-next-line es-x/no-object-defineproperty -- safe
9174 Object.defineProperty(error, 'stack', createPropertyDescriptor(1, 7));
9175 return error.stack !== 7;
9176});
9177
9178
9179/***/ }),
9180/* 300 */
9181/***/ (function(module, exports, __webpack_require__) {
9182
9183"use strict";
9184
9185var IteratorPrototype = __webpack_require__(170).IteratorPrototype;
9186var create = __webpack_require__(53);
9187var createPropertyDescriptor = __webpack_require__(49);
9188var setToStringTag = __webpack_require__(56);
9189var Iterators = __webpack_require__(54);
9190
9191var returnThis = function () { return this; };
9192
9193module.exports = function (IteratorConstructor, NAME, next, ENUMERABLE_NEXT) {
9194 var TO_STRING_TAG = NAME + ' Iterator';
9195 IteratorConstructor.prototype = create(IteratorPrototype, { next: createPropertyDescriptor(+!ENUMERABLE_NEXT, next) });
9196 setToStringTag(IteratorConstructor, TO_STRING_TAG, false, true);
9197 Iterators[TO_STRING_TAG] = returnThis;
9198 return IteratorConstructor;
9199};
9200
9201
9202/***/ }),
9203/* 301 */
9204/***/ (function(module, exports, __webpack_require__) {
9205
9206"use strict";
9207
9208var TO_STRING_TAG_SUPPORT = __webpack_require__(130);
9209var classof = __webpack_require__(55);
9210
9211// `Object.prototype.toString` method implementation
9212// https://tc39.es/ecma262/#sec-object.prototype.tostring
9213module.exports = TO_STRING_TAG_SUPPORT ? {}.toString : function toString() {
9214 return '[object ' + classof(this) + ']';
9215};
9216
9217
9218/***/ }),
9219/* 302 */
9220/***/ (function(module, exports, __webpack_require__) {
9221
9222// TODO: Remove this module from `core-js@4` since it's split to modules listed below
9223__webpack_require__(303);
9224__webpack_require__(311);
9225__webpack_require__(312);
9226__webpack_require__(313);
9227__webpack_require__(314);
9228__webpack_require__(315);
9229
9230
9231/***/ }),
9232/* 303 */
9233/***/ (function(module, exports, __webpack_require__) {
9234
9235"use strict";
9236
9237var $ = __webpack_require__(0);
9238var IS_PURE = __webpack_require__(36);
9239var IS_NODE = __webpack_require__(109);
9240var global = __webpack_require__(8);
9241var call = __webpack_require__(15);
9242var defineBuiltIn = __webpack_require__(45);
9243var setPrototypeOf = __webpack_require__(104);
9244var setToStringTag = __webpack_require__(56);
9245var setSpecies = __webpack_require__(171);
9246var aCallable = __webpack_require__(29);
9247var isCallable = __webpack_require__(9);
9248var isObject = __webpack_require__(11);
9249var anInstance = __webpack_require__(110);
9250var speciesConstructor = __webpack_require__(172);
9251var task = __webpack_require__(174).set;
9252var microtask = __webpack_require__(305);
9253var hostReportErrors = __webpack_require__(308);
9254var perform = __webpack_require__(84);
9255var Queue = __webpack_require__(309);
9256var InternalStateModule = __webpack_require__(44);
9257var NativePromiseConstructor = __webpack_require__(69);
9258var PromiseConstructorDetection = __webpack_require__(85);
9259var newPromiseCapabilityModule = __webpack_require__(57);
9260
9261var PROMISE = 'Promise';
9262var FORCED_PROMISE_CONSTRUCTOR = PromiseConstructorDetection.CONSTRUCTOR;
9263var NATIVE_PROMISE_REJECTION_EVENT = PromiseConstructorDetection.REJECTION_EVENT;
9264var NATIVE_PROMISE_SUBCLASSING = PromiseConstructorDetection.SUBCLASSING;
9265var getInternalPromiseState = InternalStateModule.getterFor(PROMISE);
9266var setInternalState = InternalStateModule.set;
9267var NativePromisePrototype = NativePromiseConstructor && NativePromiseConstructor.prototype;
9268var PromiseConstructor = NativePromiseConstructor;
9269var PromisePrototype = NativePromisePrototype;
9270var TypeError = global.TypeError;
9271var document = global.document;
9272var process = global.process;
9273var newPromiseCapability = newPromiseCapabilityModule.f;
9274var newGenericPromiseCapability = newPromiseCapability;
9275
9276var DISPATCH_EVENT = !!(document && document.createEvent && global.dispatchEvent);
9277var UNHANDLED_REJECTION = 'unhandledrejection';
9278var REJECTION_HANDLED = 'rejectionhandled';
9279var PENDING = 0;
9280var FULFILLED = 1;
9281var REJECTED = 2;
9282var HANDLED = 1;
9283var UNHANDLED = 2;
9284
9285var Internal, OwnPromiseCapability, PromiseWrapper, nativeThen;
9286
9287// helpers
9288var isThenable = function (it) {
9289 var then;
9290 return isObject(it) && isCallable(then = it.then) ? then : false;
9291};
9292
9293var callReaction = function (reaction, state) {
9294 var value = state.value;
9295 var ok = state.state == FULFILLED;
9296 var handler = ok ? reaction.ok : reaction.fail;
9297 var resolve = reaction.resolve;
9298 var reject = reaction.reject;
9299 var domain = reaction.domain;
9300 var result, then, exited;
9301 try {
9302 if (handler) {
9303 if (!ok) {
9304 if (state.rejection === UNHANDLED) onHandleUnhandled(state);
9305 state.rejection = HANDLED;
9306 }
9307 if (handler === true) result = value;
9308 else {
9309 if (domain) domain.enter();
9310 result = handler(value); // can throw
9311 if (domain) {
9312 domain.exit();
9313 exited = true;
9314 }
9315 }
9316 if (result === reaction.promise) {
9317 reject(TypeError('Promise-chain cycle'));
9318 } else if (then = isThenable(result)) {
9319 call(then, result, resolve, reject);
9320 } else resolve(result);
9321 } else reject(value);
9322 } catch (error) {
9323 if (domain && !exited) domain.exit();
9324 reject(error);
9325 }
9326};
9327
9328var notify = function (state, isReject) {
9329 if (state.notified) return;
9330 state.notified = true;
9331 microtask(function () {
9332 var reactions = state.reactions;
9333 var reaction;
9334 while (reaction = reactions.get()) {
9335 callReaction(reaction, state);
9336 }
9337 state.notified = false;
9338 if (isReject && !state.rejection) onUnhandled(state);
9339 });
9340};
9341
9342var dispatchEvent = function (name, promise, reason) {
9343 var event, handler;
9344 if (DISPATCH_EVENT) {
9345 event = document.createEvent('Event');
9346 event.promise = promise;
9347 event.reason = reason;
9348 event.initEvent(name, false, true);
9349 global.dispatchEvent(event);
9350 } else event = { promise: promise, reason: reason };
9351 if (!NATIVE_PROMISE_REJECTION_EVENT && (handler = global['on' + name])) handler(event);
9352 else if (name === UNHANDLED_REJECTION) hostReportErrors('Unhandled promise rejection', reason);
9353};
9354
9355var onUnhandled = function (state) {
9356 call(task, global, function () {
9357 var promise = state.facade;
9358 var value = state.value;
9359 var IS_UNHANDLED = isUnhandled(state);
9360 var result;
9361 if (IS_UNHANDLED) {
9362 result = perform(function () {
9363 if (IS_NODE) {
9364 process.emit('unhandledRejection', value, promise);
9365 } else dispatchEvent(UNHANDLED_REJECTION, promise, value);
9366 });
9367 // Browsers should not trigger `rejectionHandled` event if it was handled here, NodeJS - should
9368 state.rejection = IS_NODE || isUnhandled(state) ? UNHANDLED : HANDLED;
9369 if (result.error) throw result.value;
9370 }
9371 });
9372};
9373
9374var isUnhandled = function (state) {
9375 return state.rejection !== HANDLED && !state.parent;
9376};
9377
9378var onHandleUnhandled = function (state) {
9379 call(task, global, function () {
9380 var promise = state.facade;
9381 if (IS_NODE) {
9382 process.emit('rejectionHandled', promise);
9383 } else dispatchEvent(REJECTION_HANDLED, promise, state.value);
9384 });
9385};
9386
9387var bind = function (fn, state, unwrap) {
9388 return function (value) {
9389 fn(state, value, unwrap);
9390 };
9391};
9392
9393var internalReject = function (state, value, unwrap) {
9394 if (state.done) return;
9395 state.done = true;
9396 if (unwrap) state = unwrap;
9397 state.value = value;
9398 state.state = REJECTED;
9399 notify(state, true);
9400};
9401
9402var internalResolve = function (state, value, unwrap) {
9403 if (state.done) return;
9404 state.done = true;
9405 if (unwrap) state = unwrap;
9406 try {
9407 if (state.facade === value) throw TypeError("Promise can't be resolved itself");
9408 var then = isThenable(value);
9409 if (then) {
9410 microtask(function () {
9411 var wrapper = { done: false };
9412 try {
9413 call(then, value,
9414 bind(internalResolve, wrapper, state),
9415 bind(internalReject, wrapper, state)
9416 );
9417 } catch (error) {
9418 internalReject(wrapper, error, state);
9419 }
9420 });
9421 } else {
9422 state.value = value;
9423 state.state = FULFILLED;
9424 notify(state, false);
9425 }
9426 } catch (error) {
9427 internalReject({ done: false }, error, state);
9428 }
9429};
9430
9431// constructor polyfill
9432if (FORCED_PROMISE_CONSTRUCTOR) {
9433 // 25.4.3.1 Promise(executor)
9434 PromiseConstructor = function Promise(executor) {
9435 anInstance(this, PromisePrototype);
9436 aCallable(executor);
9437 call(Internal, this);
9438 var state = getInternalPromiseState(this);
9439 try {
9440 executor(bind(internalResolve, state), bind(internalReject, state));
9441 } catch (error) {
9442 internalReject(state, error);
9443 }
9444 };
9445
9446 PromisePrototype = PromiseConstructor.prototype;
9447
9448 // eslint-disable-next-line no-unused-vars -- required for `.length`
9449 Internal = function Promise(executor) {
9450 setInternalState(this, {
9451 type: PROMISE,
9452 done: false,
9453 notified: false,
9454 parent: false,
9455 reactions: new Queue(),
9456 rejection: false,
9457 state: PENDING,
9458 value: undefined
9459 });
9460 };
9461
9462 // `Promise.prototype.then` method
9463 // https://tc39.es/ecma262/#sec-promise.prototype.then
9464 Internal.prototype = defineBuiltIn(PromisePrototype, 'then', function then(onFulfilled, onRejected) {
9465 var state = getInternalPromiseState(this);
9466 var reaction = newPromiseCapability(speciesConstructor(this, PromiseConstructor));
9467 state.parent = true;
9468 reaction.ok = isCallable(onFulfilled) ? onFulfilled : true;
9469 reaction.fail = isCallable(onRejected) && onRejected;
9470 reaction.domain = IS_NODE ? process.domain : undefined;
9471 if (state.state == PENDING) state.reactions.add(reaction);
9472 else microtask(function () {
9473 callReaction(reaction, state);
9474 });
9475 return reaction.promise;
9476 });
9477
9478 OwnPromiseCapability = function () {
9479 var promise = new Internal();
9480 var state = getInternalPromiseState(promise);
9481 this.promise = promise;
9482 this.resolve = bind(internalResolve, state);
9483 this.reject = bind(internalReject, state);
9484 };
9485
9486 newPromiseCapabilityModule.f = newPromiseCapability = function (C) {
9487 return C === PromiseConstructor || C === PromiseWrapper
9488 ? new OwnPromiseCapability(C)
9489 : newGenericPromiseCapability(C);
9490 };
9491
9492 if (!IS_PURE && isCallable(NativePromiseConstructor) && NativePromisePrototype !== Object.prototype) {
9493 nativeThen = NativePromisePrototype.then;
9494
9495 if (!NATIVE_PROMISE_SUBCLASSING) {
9496 // make `Promise#then` return a polyfilled `Promise` for native promise-based APIs
9497 defineBuiltIn(NativePromisePrototype, 'then', function then(onFulfilled, onRejected) {
9498 var that = this;
9499 return new PromiseConstructor(function (resolve, reject) {
9500 call(nativeThen, that, resolve, reject);
9501 }).then(onFulfilled, onRejected);
9502 // https://github.com/zloirock/core-js/issues/640
9503 }, { unsafe: true });
9504 }
9505
9506 // make `.constructor === Promise` work for native promise-based APIs
9507 try {
9508 delete NativePromisePrototype.constructor;
9509 } catch (error) { /* empty */ }
9510
9511 // make `instanceof Promise` work for native promise-based APIs
9512 if (setPrototypeOf) {
9513 setPrototypeOf(NativePromisePrototype, PromisePrototype);
9514 }
9515 }
9516}
9517
9518$({ global: true, constructor: true, wrap: true, forced: FORCED_PROMISE_CONSTRUCTOR }, {
9519 Promise: PromiseConstructor
9520});
9521
9522setToStringTag(PromiseConstructor, PROMISE, false, true);
9523setSpecies(PROMISE);
9524
9525
9526/***/ }),
9527/* 304 */
9528/***/ (function(module, exports) {
9529
9530var $TypeError = TypeError;
9531
9532module.exports = function (passed, required) {
9533 if (passed < required) throw $TypeError('Not enough arguments');
9534 return passed;
9535};
9536
9537
9538/***/ }),
9539/* 305 */
9540/***/ (function(module, exports, __webpack_require__) {
9541
9542var global = __webpack_require__(8);
9543var bind = __webpack_require__(52);
9544var getOwnPropertyDescriptor = __webpack_require__(64).f;
9545var macrotask = __webpack_require__(174).set;
9546var IS_IOS = __webpack_require__(175);
9547var IS_IOS_PEBBLE = __webpack_require__(306);
9548var IS_WEBOS_WEBKIT = __webpack_require__(307);
9549var IS_NODE = __webpack_require__(109);
9550
9551var MutationObserver = global.MutationObserver || global.WebKitMutationObserver;
9552var document = global.document;
9553var process = global.process;
9554var Promise = global.Promise;
9555// Node.js 11 shows ExperimentalWarning on getting `queueMicrotask`
9556var queueMicrotaskDescriptor = getOwnPropertyDescriptor(global, 'queueMicrotask');
9557var queueMicrotask = queueMicrotaskDescriptor && queueMicrotaskDescriptor.value;
9558
9559var flush, head, last, notify, toggle, node, promise, then;
9560
9561// modern engines have queueMicrotask method
9562if (!queueMicrotask) {
9563 flush = function () {
9564 var parent, fn;
9565 if (IS_NODE && (parent = process.domain)) parent.exit();
9566 while (head) {
9567 fn = head.fn;
9568 head = head.next;
9569 try {
9570 fn();
9571 } catch (error) {
9572 if (head) notify();
9573 else last = undefined;
9574 throw error;
9575 }
9576 } last = undefined;
9577 if (parent) parent.enter();
9578 };
9579
9580 // browsers with MutationObserver, except iOS - https://github.com/zloirock/core-js/issues/339
9581 // also except WebOS Webkit https://github.com/zloirock/core-js/issues/898
9582 if (!IS_IOS && !IS_NODE && !IS_WEBOS_WEBKIT && MutationObserver && document) {
9583 toggle = true;
9584 node = document.createTextNode('');
9585 new MutationObserver(flush).observe(node, { characterData: true });
9586 notify = function () {
9587 node.data = toggle = !toggle;
9588 };
9589 // environments with maybe non-completely correct, but existent Promise
9590 } else if (!IS_IOS_PEBBLE && Promise && Promise.resolve) {
9591 // Promise.resolve without an argument throws an error in LG WebOS 2
9592 promise = Promise.resolve(undefined);
9593 // workaround of WebKit ~ iOS Safari 10.1 bug
9594 promise.constructor = Promise;
9595 then = bind(promise.then, promise);
9596 notify = function () {
9597 then(flush);
9598 };
9599 // Node.js without promises
9600 } else if (IS_NODE) {
9601 notify = function () {
9602 process.nextTick(flush);
9603 };
9604 // for other environments - macrotask based on:
9605 // - setImmediate
9606 // - MessageChannel
9607 // - window.postMessage
9608 // - onreadystatechange
9609 // - setTimeout
9610 } else {
9611 // strange IE + webpack dev server bug - use .bind(global)
9612 macrotask = bind(macrotask, global);
9613 notify = function () {
9614 macrotask(flush);
9615 };
9616 }
9617}
9618
9619module.exports = queueMicrotask || function (fn) {
9620 var task = { fn: fn, next: undefined };
9621 if (last) last.next = task;
9622 if (!head) {
9623 head = task;
9624 notify();
9625 } last = task;
9626};
9627
9628
9629/***/ }),
9630/* 306 */
9631/***/ (function(module, exports, __webpack_require__) {
9632
9633var userAgent = __webpack_require__(51);
9634var global = __webpack_require__(8);
9635
9636module.exports = /ipad|iphone|ipod/i.test(userAgent) && global.Pebble !== undefined;
9637
9638
9639/***/ }),
9640/* 307 */
9641/***/ (function(module, exports, __webpack_require__) {
9642
9643var userAgent = __webpack_require__(51);
9644
9645module.exports = /web0s(?!.*chrome)/i.test(userAgent);
9646
9647
9648/***/ }),
9649/* 308 */
9650/***/ (function(module, exports, __webpack_require__) {
9651
9652var global = __webpack_require__(8);
9653
9654module.exports = function (a, b) {
9655 var console = global.console;
9656 if (console && console.error) {
9657 arguments.length == 1 ? console.error(a) : console.error(a, b);
9658 }
9659};
9660
9661
9662/***/ }),
9663/* 309 */
9664/***/ (function(module, exports) {
9665
9666var Queue = function () {
9667 this.head = null;
9668 this.tail = null;
9669};
9670
9671Queue.prototype = {
9672 add: function (item) {
9673 var entry = { item: item, next: null };
9674 if (this.head) this.tail.next = entry;
9675 else this.head = entry;
9676 this.tail = entry;
9677 },
9678 get: function () {
9679 var entry = this.head;
9680 if (entry) {
9681 this.head = entry.next;
9682 if (this.tail === entry) this.tail = null;
9683 return entry.item;
9684 }
9685 }
9686};
9687
9688module.exports = Queue;
9689
9690
9691/***/ }),
9692/* 310 */
9693/***/ (function(module, exports) {
9694
9695module.exports = typeof window == 'object' && typeof Deno != 'object';
9696
9697
9698/***/ }),
9699/* 311 */
9700/***/ (function(module, exports, __webpack_require__) {
9701
9702"use strict";
9703
9704var $ = __webpack_require__(0);
9705var call = __webpack_require__(15);
9706var aCallable = __webpack_require__(29);
9707var newPromiseCapabilityModule = __webpack_require__(57);
9708var perform = __webpack_require__(84);
9709var iterate = __webpack_require__(41);
9710var PROMISE_STATICS_INCORRECT_ITERATION = __webpack_require__(176);
9711
9712// `Promise.all` method
9713// https://tc39.es/ecma262/#sec-promise.all
9714$({ target: 'Promise', stat: true, forced: PROMISE_STATICS_INCORRECT_ITERATION }, {
9715 all: function all(iterable) {
9716 var C = this;
9717 var capability = newPromiseCapabilityModule.f(C);
9718 var resolve = capability.resolve;
9719 var reject = capability.reject;
9720 var result = perform(function () {
9721 var $promiseResolve = aCallable(C.resolve);
9722 var values = [];
9723 var counter = 0;
9724 var remaining = 1;
9725 iterate(iterable, function (promise) {
9726 var index = counter++;
9727 var alreadyCalled = false;
9728 remaining++;
9729 call($promiseResolve, C, promise).then(function (value) {
9730 if (alreadyCalled) return;
9731 alreadyCalled = true;
9732 values[index] = value;
9733 --remaining || resolve(values);
9734 }, reject);
9735 });
9736 --remaining || resolve(values);
9737 });
9738 if (result.error) reject(result.value);
9739 return capability.promise;
9740 }
9741});
9742
9743
9744/***/ }),
9745/* 312 */
9746/***/ (function(module, exports, __webpack_require__) {
9747
9748"use strict";
9749
9750var $ = __webpack_require__(0);
9751var IS_PURE = __webpack_require__(36);
9752var FORCED_PROMISE_CONSTRUCTOR = __webpack_require__(85).CONSTRUCTOR;
9753var NativePromiseConstructor = __webpack_require__(69);
9754var getBuiltIn = __webpack_require__(20);
9755var isCallable = __webpack_require__(9);
9756var defineBuiltIn = __webpack_require__(45);
9757
9758var NativePromisePrototype = NativePromiseConstructor && NativePromiseConstructor.prototype;
9759
9760// `Promise.prototype.catch` method
9761// https://tc39.es/ecma262/#sec-promise.prototype.catch
9762$({ target: 'Promise', proto: true, forced: FORCED_PROMISE_CONSTRUCTOR, real: true }, {
9763 'catch': function (onRejected) {
9764 return this.then(undefined, onRejected);
9765 }
9766});
9767
9768// makes sure that native promise-based APIs `Promise#catch` properly works with patched `Promise#then`
9769if (!IS_PURE && isCallable(NativePromiseConstructor)) {
9770 var method = getBuiltIn('Promise').prototype['catch'];
9771 if (NativePromisePrototype['catch'] !== method) {
9772 defineBuiltIn(NativePromisePrototype, 'catch', method, { unsafe: true });
9773 }
9774}
9775
9776
9777/***/ }),
9778/* 313 */
9779/***/ (function(module, exports, __webpack_require__) {
9780
9781"use strict";
9782
9783var $ = __webpack_require__(0);
9784var call = __webpack_require__(15);
9785var aCallable = __webpack_require__(29);
9786var newPromiseCapabilityModule = __webpack_require__(57);
9787var perform = __webpack_require__(84);
9788var iterate = __webpack_require__(41);
9789var PROMISE_STATICS_INCORRECT_ITERATION = __webpack_require__(176);
9790
9791// `Promise.race` method
9792// https://tc39.es/ecma262/#sec-promise.race
9793$({ target: 'Promise', stat: true, forced: PROMISE_STATICS_INCORRECT_ITERATION }, {
9794 race: function race(iterable) {
9795 var C = this;
9796 var capability = newPromiseCapabilityModule.f(C);
9797 var reject = capability.reject;
9798 var result = perform(function () {
9799 var $promiseResolve = aCallable(C.resolve);
9800 iterate(iterable, function (promise) {
9801 call($promiseResolve, C, promise).then(capability.resolve, reject);
9802 });
9803 });
9804 if (result.error) reject(result.value);
9805 return capability.promise;
9806 }
9807});
9808
9809
9810/***/ }),
9811/* 314 */
9812/***/ (function(module, exports, __webpack_require__) {
9813
9814"use strict";
9815
9816var $ = __webpack_require__(0);
9817var call = __webpack_require__(15);
9818var newPromiseCapabilityModule = __webpack_require__(57);
9819var FORCED_PROMISE_CONSTRUCTOR = __webpack_require__(85).CONSTRUCTOR;
9820
9821// `Promise.reject` method
9822// https://tc39.es/ecma262/#sec-promise.reject
9823$({ target: 'Promise', stat: true, forced: FORCED_PROMISE_CONSTRUCTOR }, {
9824 reject: function reject(r) {
9825 var capability = newPromiseCapabilityModule.f(this);
9826 call(capability.reject, undefined, r);
9827 return capability.promise;
9828 }
9829});
9830
9831
9832/***/ }),
9833/* 315 */
9834/***/ (function(module, exports, __webpack_require__) {
9835
9836"use strict";
9837
9838var $ = __webpack_require__(0);
9839var getBuiltIn = __webpack_require__(20);
9840var IS_PURE = __webpack_require__(36);
9841var NativePromiseConstructor = __webpack_require__(69);
9842var FORCED_PROMISE_CONSTRUCTOR = __webpack_require__(85).CONSTRUCTOR;
9843var promiseResolve = __webpack_require__(178);
9844
9845var PromiseConstructorWrapper = getBuiltIn('Promise');
9846var CHECK_WRAPPER = IS_PURE && !FORCED_PROMISE_CONSTRUCTOR;
9847
9848// `Promise.resolve` method
9849// https://tc39.es/ecma262/#sec-promise.resolve
9850$({ target: 'Promise', stat: true, forced: IS_PURE || FORCED_PROMISE_CONSTRUCTOR }, {
9851 resolve: function resolve(x) {
9852 return promiseResolve(CHECK_WRAPPER && this === PromiseConstructorWrapper ? NativePromiseConstructor : this, x);
9853 }
9854});
9855
9856
9857/***/ }),
9858/* 316 */
9859/***/ (function(module, exports, __webpack_require__) {
9860
9861"use strict";
9862
9863var $ = __webpack_require__(0);
9864var call = __webpack_require__(15);
9865var aCallable = __webpack_require__(29);
9866var newPromiseCapabilityModule = __webpack_require__(57);
9867var perform = __webpack_require__(84);
9868var iterate = __webpack_require__(41);
9869
9870// `Promise.allSettled` method
9871// https://tc39.es/ecma262/#sec-promise.allsettled
9872$({ target: 'Promise', stat: true }, {
9873 allSettled: function allSettled(iterable) {
9874 var C = this;
9875 var capability = newPromiseCapabilityModule.f(C);
9876 var resolve = capability.resolve;
9877 var reject = capability.reject;
9878 var result = perform(function () {
9879 var promiseResolve = aCallable(C.resolve);
9880 var values = [];
9881 var counter = 0;
9882 var remaining = 1;
9883 iterate(iterable, function (promise) {
9884 var index = counter++;
9885 var alreadyCalled = false;
9886 remaining++;
9887 call(promiseResolve, C, promise).then(function (value) {
9888 if (alreadyCalled) return;
9889 alreadyCalled = true;
9890 values[index] = { status: 'fulfilled', value: value };
9891 --remaining || resolve(values);
9892 }, function (error) {
9893 if (alreadyCalled) return;
9894 alreadyCalled = true;
9895 values[index] = { status: 'rejected', reason: error };
9896 --remaining || resolve(values);
9897 });
9898 });
9899 --remaining || resolve(values);
9900 });
9901 if (result.error) reject(result.value);
9902 return capability.promise;
9903 }
9904});
9905
9906
9907/***/ }),
9908/* 317 */
9909/***/ (function(module, exports, __webpack_require__) {
9910
9911"use strict";
9912
9913var $ = __webpack_require__(0);
9914var call = __webpack_require__(15);
9915var aCallable = __webpack_require__(29);
9916var getBuiltIn = __webpack_require__(20);
9917var newPromiseCapabilityModule = __webpack_require__(57);
9918var perform = __webpack_require__(84);
9919var iterate = __webpack_require__(41);
9920
9921var PROMISE_ANY_ERROR = 'No one promise resolved';
9922
9923// `Promise.any` method
9924// https://tc39.es/ecma262/#sec-promise.any
9925$({ target: 'Promise', stat: true }, {
9926 any: function any(iterable) {
9927 var C = this;
9928 var AggregateError = getBuiltIn('AggregateError');
9929 var capability = newPromiseCapabilityModule.f(C);
9930 var resolve = capability.resolve;
9931 var reject = capability.reject;
9932 var result = perform(function () {
9933 var promiseResolve = aCallable(C.resolve);
9934 var errors = [];
9935 var counter = 0;
9936 var remaining = 1;
9937 var alreadyResolved = false;
9938 iterate(iterable, function (promise) {
9939 var index = counter++;
9940 var alreadyRejected = false;
9941 remaining++;
9942 call(promiseResolve, C, promise).then(function (value) {
9943 if (alreadyRejected || alreadyResolved) return;
9944 alreadyResolved = true;
9945 resolve(value);
9946 }, function (error) {
9947 if (alreadyRejected || alreadyResolved) return;
9948 alreadyRejected = true;
9949 errors[index] = error;
9950 --remaining || reject(new AggregateError(errors, PROMISE_ANY_ERROR));
9951 });
9952 });
9953 --remaining || reject(new AggregateError(errors, PROMISE_ANY_ERROR));
9954 });
9955 if (result.error) reject(result.value);
9956 return capability.promise;
9957 }
9958});
9959
9960
9961/***/ }),
9962/* 318 */
9963/***/ (function(module, exports, __webpack_require__) {
9964
9965"use strict";
9966
9967var $ = __webpack_require__(0);
9968var IS_PURE = __webpack_require__(36);
9969var NativePromiseConstructor = __webpack_require__(69);
9970var fails = __webpack_require__(2);
9971var getBuiltIn = __webpack_require__(20);
9972var isCallable = __webpack_require__(9);
9973var speciesConstructor = __webpack_require__(172);
9974var promiseResolve = __webpack_require__(178);
9975var defineBuiltIn = __webpack_require__(45);
9976
9977var NativePromisePrototype = NativePromiseConstructor && NativePromiseConstructor.prototype;
9978
9979// Safari bug https://bugs.webkit.org/show_bug.cgi?id=200829
9980var NON_GENERIC = !!NativePromiseConstructor && fails(function () {
9981 // eslint-disable-next-line unicorn/no-thenable -- required for testing
9982 NativePromisePrototype['finally'].call({ then: function () { /* empty */ } }, function () { /* empty */ });
9983});
9984
9985// `Promise.prototype.finally` method
9986// https://tc39.es/ecma262/#sec-promise.prototype.finally
9987$({ target: 'Promise', proto: true, real: true, forced: NON_GENERIC }, {
9988 'finally': function (onFinally) {
9989 var C = speciesConstructor(this, getBuiltIn('Promise'));
9990 var isFunction = isCallable(onFinally);
9991 return this.then(
9992 isFunction ? function (x) {
9993 return promiseResolve(C, onFinally()).then(function () { return x; });
9994 } : onFinally,
9995 isFunction ? function (e) {
9996 return promiseResolve(C, onFinally()).then(function () { throw e; });
9997 } : onFinally
9998 );
9999 }
10000});
10001
10002// makes sure that native promise-based APIs `Promise#finally` properly works with patched `Promise#then`
10003if (!IS_PURE && isCallable(NativePromiseConstructor)) {
10004 var method = getBuiltIn('Promise').prototype['finally'];
10005 if (NativePromisePrototype['finally'] !== method) {
10006 defineBuiltIn(NativePromisePrototype, 'finally', method, { unsafe: true });
10007 }
10008}
10009
10010
10011/***/ }),
10012/* 319 */
10013/***/ (function(module, exports, __webpack_require__) {
10014
10015var uncurryThis = __webpack_require__(4);
10016var toIntegerOrInfinity = __webpack_require__(127);
10017var toString = __webpack_require__(42);
10018var requireObjectCoercible = __webpack_require__(81);
10019
10020var charAt = uncurryThis(''.charAt);
10021var charCodeAt = uncurryThis(''.charCodeAt);
10022var stringSlice = uncurryThis(''.slice);
10023
10024var createMethod = function (CONVERT_TO_STRING) {
10025 return function ($this, pos) {
10026 var S = toString(requireObjectCoercible($this));
10027 var position = toIntegerOrInfinity(pos);
10028 var size = S.length;
10029 var first, second;
10030 if (position < 0 || position >= size) return CONVERT_TO_STRING ? '' : undefined;
10031 first = charCodeAt(S, position);
10032 return first < 0xD800 || first > 0xDBFF || position + 1 === size
10033 || (second = charCodeAt(S, position + 1)) < 0xDC00 || second > 0xDFFF
10034 ? CONVERT_TO_STRING
10035 ? charAt(S, position)
10036 : first
10037 : CONVERT_TO_STRING
10038 ? stringSlice(S, position, position + 2)
10039 : (first - 0xD800 << 10) + (second - 0xDC00) + 0x10000;
10040 };
10041};
10042
10043module.exports = {
10044 // `String.prototype.codePointAt` method
10045 // https://tc39.es/ecma262/#sec-string.prototype.codepointat
10046 codeAt: createMethod(false),
10047 // `String.prototype.at` method
10048 // https://github.com/mathiasbynens/String.prototype.at
10049 charAt: createMethod(true)
10050};
10051
10052
10053/***/ }),
10054/* 320 */
10055/***/ (function(module, exports) {
10056
10057// iterable DOM collections
10058// flag - `iterable` interface - 'entries', 'keys', 'values', 'forEach' methods
10059module.exports = {
10060 CSSRuleList: 0,
10061 CSSStyleDeclaration: 0,
10062 CSSValueList: 0,
10063 ClientRectList: 0,
10064 DOMRectList: 0,
10065 DOMStringList: 0,
10066 DOMTokenList: 1,
10067 DataTransferItemList: 0,
10068 FileList: 0,
10069 HTMLAllCollection: 0,
10070 HTMLCollection: 0,
10071 HTMLFormElement: 0,
10072 HTMLSelectElement: 0,
10073 MediaList: 0,
10074 MimeTypeArray: 0,
10075 NamedNodeMap: 0,
10076 NodeList: 1,
10077 PaintRequestList: 0,
10078 Plugin: 0,
10079 PluginArray: 0,
10080 SVGLengthList: 0,
10081 SVGNumberList: 0,
10082 SVGPathSegList: 0,
10083 SVGPointList: 0,
10084 SVGStringList: 0,
10085 SVGTransformList: 0,
10086 SourceBufferList: 0,
10087 StyleSheetList: 0,
10088 TextTrackCueList: 0,
10089 TextTrackList: 0,
10090 TouchList: 0
10091};
10092
10093
10094/***/ }),
10095/* 321 */
10096/***/ (function(module, __webpack_exports__, __webpack_require__) {
10097
10098"use strict";
10099/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__index_js__ = __webpack_require__(134);
10100// Default Export
10101// ==============
10102// In this module, we mix our bundled exports into the `_` object and export
10103// the result. This is analogous to setting `module.exports = _` in CommonJS.
10104// Hence, this module is also the entry point of our UMD bundle and the package
10105// entry point for CommonJS and AMD users. In other words, this is (the source
10106// of) the module you are interfacing with when you do any of the following:
10107//
10108// ```js
10109// // CommonJS
10110// var _ = require('underscore');
10111//
10112// // AMD
10113// define(['underscore'], function(_) {...});
10114//
10115// // UMD in the browser
10116// // _ is available as a global variable
10117// ```
10118
10119
10120
10121// Add all of the Underscore functions to the wrapper object.
10122var _ = Object(__WEBPACK_IMPORTED_MODULE_0__index_js__["mixin"])(__WEBPACK_IMPORTED_MODULE_0__index_js__);
10123// Legacy Node.js API.
10124_._ = _;
10125// Export the Underscore API.
10126/* harmony default export */ __webpack_exports__["a"] = (_);
10127
10128
10129/***/ }),
10130/* 322 */
10131/***/ (function(module, __webpack_exports__, __webpack_require__) {
10132
10133"use strict";
10134/* harmony export (immutable) */ __webpack_exports__["a"] = isNull;
10135// Is a given value equal to null?
10136function isNull(obj) {
10137 return obj === null;
10138}
10139
10140
10141/***/ }),
10142/* 323 */
10143/***/ (function(module, __webpack_exports__, __webpack_require__) {
10144
10145"use strict";
10146/* harmony export (immutable) */ __webpack_exports__["a"] = isElement;
10147// Is a given value a DOM element?
10148function isElement(obj) {
10149 return !!(obj && obj.nodeType === 1);
10150}
10151
10152
10153/***/ }),
10154/* 324 */
10155/***/ (function(module, __webpack_exports__, __webpack_require__) {
10156
10157"use strict";
10158/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(18);
10159
10160
10161/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('Date'));
10162
10163
10164/***/ }),
10165/* 325 */
10166/***/ (function(module, __webpack_exports__, __webpack_require__) {
10167
10168"use strict";
10169/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(18);
10170
10171
10172/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('RegExp'));
10173
10174
10175/***/ }),
10176/* 326 */
10177/***/ (function(module, __webpack_exports__, __webpack_require__) {
10178
10179"use strict";
10180/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(18);
10181
10182
10183/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('Error'));
10184
10185
10186/***/ }),
10187/* 327 */
10188/***/ (function(module, __webpack_exports__, __webpack_require__) {
10189
10190"use strict";
10191/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(18);
10192
10193
10194/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('Object'));
10195
10196
10197/***/ }),
10198/* 328 */
10199/***/ (function(module, __webpack_exports__, __webpack_require__) {
10200
10201"use strict";
10202/* harmony export (immutable) */ __webpack_exports__["a"] = isFinite;
10203/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(6);
10204/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isSymbol_js__ = __webpack_require__(182);
10205
10206
10207
10208// Is a given object a finite number?
10209function isFinite(obj) {
10210 return !Object(__WEBPACK_IMPORTED_MODULE_1__isSymbol_js__["a" /* default */])(obj) && Object(__WEBPACK_IMPORTED_MODULE_0__setup_js__["f" /* _isFinite */])(obj) && !isNaN(parseFloat(obj));
10211}
10212
10213
10214/***/ }),
10215/* 329 */
10216/***/ (function(module, __webpack_exports__, __webpack_require__) {
10217
10218"use strict";
10219/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createSizePropertyCheck_js__ = __webpack_require__(187);
10220/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__getByteLength_js__ = __webpack_require__(138);
10221
10222
10223
10224// Internal helper to determine whether we should spend extensive checks against
10225// `ArrayBuffer` et al.
10226/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createSizePropertyCheck_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__getByteLength_js__["a" /* default */]));
10227
10228
10229/***/ }),
10230/* 330 */
10231/***/ (function(module, __webpack_exports__, __webpack_require__) {
10232
10233"use strict";
10234/* harmony export (immutable) */ __webpack_exports__["a"] = isEmpty;
10235/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__getLength_js__ = __webpack_require__(31);
10236/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isArray_js__ = __webpack_require__(59);
10237/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__isString_js__ = __webpack_require__(135);
10238/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__isArguments_js__ = __webpack_require__(137);
10239/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__keys_js__ = __webpack_require__(17);
10240
10241
10242
10243
10244
10245
10246// Is a given array, string, or object empty?
10247// An "empty" object has no enumerable own-properties.
10248function isEmpty(obj) {
10249 if (obj == null) return true;
10250 // Skip the more expensive `toString`-based type checks if `obj` has no
10251 // `.length`.
10252 var length = Object(__WEBPACK_IMPORTED_MODULE_0__getLength_js__["a" /* default */])(obj);
10253 if (typeof length == 'number' && (
10254 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)
10255 )) return length === 0;
10256 return Object(__WEBPACK_IMPORTED_MODULE_0__getLength_js__["a" /* default */])(Object(__WEBPACK_IMPORTED_MODULE_4__keys_js__["a" /* default */])(obj)) === 0;
10257}
10258
10259
10260/***/ }),
10261/* 331 */
10262/***/ (function(module, __webpack_exports__, __webpack_require__) {
10263
10264"use strict";
10265/* harmony export (immutable) */ __webpack_exports__["a"] = isEqual;
10266/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__underscore_js__ = __webpack_require__(25);
10267/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__setup_js__ = __webpack_require__(6);
10268/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__getByteLength_js__ = __webpack_require__(138);
10269/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__isTypedArray_js__ = __webpack_require__(185);
10270/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__isFunction_js__ = __webpack_require__(30);
10271/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__stringTagBug_js__ = __webpack_require__(86);
10272/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__isDataView_js__ = __webpack_require__(136);
10273/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__keys_js__ = __webpack_require__(17);
10274/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__has_js__ = __webpack_require__(47);
10275/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__toBufferView_js__ = __webpack_require__(332);
10276
10277
10278
10279
10280
10281
10282
10283
10284
10285
10286
10287// We use this string twice, so give it a name for minification.
10288var tagDataView = '[object DataView]';
10289
10290// Internal recursive comparison function for `_.isEqual`.
10291function eq(a, b, aStack, bStack) {
10292 // Identical objects are equal. `0 === -0`, but they aren't identical.
10293 // See the [Harmony `egal` proposal](https://wiki.ecmascript.org/doku.php?id=harmony:egal).
10294 if (a === b) return a !== 0 || 1 / a === 1 / b;
10295 // `null` or `undefined` only equal to itself (strict comparison).
10296 if (a == null || b == null) return false;
10297 // `NaN`s are equivalent, but non-reflexive.
10298 if (a !== a) return b !== b;
10299 // Exhaust primitive checks
10300 var type = typeof a;
10301 if (type !== 'function' && type !== 'object' && typeof b != 'object') return false;
10302 return deepEq(a, b, aStack, bStack);
10303}
10304
10305// Internal recursive comparison function for `_.isEqual`.
10306function deepEq(a, b, aStack, bStack) {
10307 // Unwrap any wrapped objects.
10308 if (a instanceof __WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */]) a = a._wrapped;
10309 if (b instanceof __WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */]) b = b._wrapped;
10310 // Compare `[[Class]]` names.
10311 var className = __WEBPACK_IMPORTED_MODULE_1__setup_js__["t" /* toString */].call(a);
10312 if (className !== __WEBPACK_IMPORTED_MODULE_1__setup_js__["t" /* toString */].call(b)) return false;
10313 // Work around a bug in IE 10 - Edge 13.
10314 if (__WEBPACK_IMPORTED_MODULE_5__stringTagBug_js__["a" /* hasStringTagBug */] && className == '[object Object]' && Object(__WEBPACK_IMPORTED_MODULE_6__isDataView_js__["a" /* default */])(a)) {
10315 if (!Object(__WEBPACK_IMPORTED_MODULE_6__isDataView_js__["a" /* default */])(b)) return false;
10316 className = tagDataView;
10317 }
10318 switch (className) {
10319 // These types are compared by value.
10320 case '[object RegExp]':
10321 // RegExps are coerced to strings for comparison (Note: '' + /a/i === '/a/i')
10322 case '[object String]':
10323 // Primitives and their corresponding object wrappers are equivalent; thus, `"5"` is
10324 // equivalent to `new String("5")`.
10325 return '' + a === '' + b;
10326 case '[object Number]':
10327 // `NaN`s are equivalent, but non-reflexive.
10328 // Object(NaN) is equivalent to NaN.
10329 if (+a !== +a) return +b !== +b;
10330 // An `egal` comparison is performed for other numeric values.
10331 return +a === 0 ? 1 / +a === 1 / b : +a === +b;
10332 case '[object Date]':
10333 case '[object Boolean]':
10334 // Coerce dates and booleans to numeric primitive values. Dates are compared by their
10335 // millisecond representations. Note that invalid dates with millisecond representations
10336 // of `NaN` are not equivalent.
10337 return +a === +b;
10338 case '[object Symbol]':
10339 return __WEBPACK_IMPORTED_MODULE_1__setup_js__["d" /* SymbolProto */].valueOf.call(a) === __WEBPACK_IMPORTED_MODULE_1__setup_js__["d" /* SymbolProto */].valueOf.call(b);
10340 case '[object ArrayBuffer]':
10341 case tagDataView:
10342 // Coerce to typed array so we can fall through.
10343 return deepEq(Object(__WEBPACK_IMPORTED_MODULE_9__toBufferView_js__["a" /* default */])(a), Object(__WEBPACK_IMPORTED_MODULE_9__toBufferView_js__["a" /* default */])(b), aStack, bStack);
10344 }
10345
10346 var areArrays = className === '[object Array]';
10347 if (!areArrays && Object(__WEBPACK_IMPORTED_MODULE_3__isTypedArray_js__["a" /* default */])(a)) {
10348 var byteLength = Object(__WEBPACK_IMPORTED_MODULE_2__getByteLength_js__["a" /* default */])(a);
10349 if (byteLength !== Object(__WEBPACK_IMPORTED_MODULE_2__getByteLength_js__["a" /* default */])(b)) return false;
10350 if (a.buffer === b.buffer && a.byteOffset === b.byteOffset) return true;
10351 areArrays = true;
10352 }
10353 if (!areArrays) {
10354 if (typeof a != 'object' || typeof b != 'object') return false;
10355
10356 // Objects with different constructors are not equivalent, but `Object`s or `Array`s
10357 // from different frames are.
10358 var aCtor = a.constructor, bCtor = b.constructor;
10359 if (aCtor !== bCtor && !(Object(__WEBPACK_IMPORTED_MODULE_4__isFunction_js__["a" /* default */])(aCtor) && aCtor instanceof aCtor &&
10360 Object(__WEBPACK_IMPORTED_MODULE_4__isFunction_js__["a" /* default */])(bCtor) && bCtor instanceof bCtor)
10361 && ('constructor' in a && 'constructor' in b)) {
10362 return false;
10363 }
10364 }
10365 // Assume equality for cyclic structures. The algorithm for detecting cyclic
10366 // structures is adapted from ES 5.1 section 15.12.3, abstract operation `JO`.
10367
10368 // Initializing stack of traversed objects.
10369 // It's done here since we only need them for objects and arrays comparison.
10370 aStack = aStack || [];
10371 bStack = bStack || [];
10372 var length = aStack.length;
10373 while (length--) {
10374 // Linear search. Performance is inversely proportional to the number of
10375 // unique nested structures.
10376 if (aStack[length] === a) return bStack[length] === b;
10377 }
10378
10379 // Add the first object to the stack of traversed objects.
10380 aStack.push(a);
10381 bStack.push(b);
10382
10383 // Recursively compare objects and arrays.
10384 if (areArrays) {
10385 // Compare array lengths to determine if a deep comparison is necessary.
10386 length = a.length;
10387 if (length !== b.length) return false;
10388 // Deep compare the contents, ignoring non-numeric properties.
10389 while (length--) {
10390 if (!eq(a[length], b[length], aStack, bStack)) return false;
10391 }
10392 } else {
10393 // Deep compare objects.
10394 var _keys = Object(__WEBPACK_IMPORTED_MODULE_7__keys_js__["a" /* default */])(a), key;
10395 length = _keys.length;
10396 // Ensure that both objects contain the same number of properties before comparing deep equality.
10397 if (Object(__WEBPACK_IMPORTED_MODULE_7__keys_js__["a" /* default */])(b).length !== length) return false;
10398 while (length--) {
10399 // Deep compare each member
10400 key = _keys[length];
10401 if (!(Object(__WEBPACK_IMPORTED_MODULE_8__has_js__["a" /* default */])(b, key) && eq(a[key], b[key], aStack, bStack))) return false;
10402 }
10403 }
10404 // Remove the first object from the stack of traversed objects.
10405 aStack.pop();
10406 bStack.pop();
10407 return true;
10408}
10409
10410// Perform a deep comparison to check if two objects are equal.
10411function isEqual(a, b) {
10412 return eq(a, b);
10413}
10414
10415
10416/***/ }),
10417/* 332 */
10418/***/ (function(module, __webpack_exports__, __webpack_require__) {
10419
10420"use strict";
10421/* harmony export (immutable) */ __webpack_exports__["a"] = toBufferView;
10422/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__getByteLength_js__ = __webpack_require__(138);
10423
10424
10425// Internal function to wrap or shallow-copy an ArrayBuffer,
10426// typed array or DataView to a new view, reusing the buffer.
10427function toBufferView(bufferSource) {
10428 return new Uint8Array(
10429 bufferSource.buffer || bufferSource,
10430 bufferSource.byteOffset || 0,
10431 Object(__WEBPACK_IMPORTED_MODULE_0__getByteLength_js__["a" /* default */])(bufferSource)
10432 );
10433}
10434
10435
10436/***/ }),
10437/* 333 */
10438/***/ (function(module, __webpack_exports__, __webpack_require__) {
10439
10440"use strict";
10441/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(18);
10442/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__stringTagBug_js__ = __webpack_require__(86);
10443/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__methodFingerprint_js__ = __webpack_require__(139);
10444
10445
10446
10447
10448/* 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'));
10449
10450
10451/***/ }),
10452/* 334 */
10453/***/ (function(module, __webpack_exports__, __webpack_require__) {
10454
10455"use strict";
10456/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(18);
10457/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__stringTagBug_js__ = __webpack_require__(86);
10458/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__methodFingerprint_js__ = __webpack_require__(139);
10459
10460
10461
10462
10463/* 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'));
10464
10465
10466/***/ }),
10467/* 335 */
10468/***/ (function(module, __webpack_exports__, __webpack_require__) {
10469
10470"use strict";
10471/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(18);
10472/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__stringTagBug_js__ = __webpack_require__(86);
10473/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__methodFingerprint_js__ = __webpack_require__(139);
10474
10475
10476
10477
10478/* 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'));
10479
10480
10481/***/ }),
10482/* 336 */
10483/***/ (function(module, __webpack_exports__, __webpack_require__) {
10484
10485"use strict";
10486/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(18);
10487
10488
10489/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('WeakSet'));
10490
10491
10492/***/ }),
10493/* 337 */
10494/***/ (function(module, __webpack_exports__, __webpack_require__) {
10495
10496"use strict";
10497/* harmony export (immutable) */ __webpack_exports__["a"] = pairs;
10498/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__keys_js__ = __webpack_require__(17);
10499
10500
10501// Convert an object into a list of `[key, value]` pairs.
10502// The opposite of `_.object` with one argument.
10503function pairs(obj) {
10504 var _keys = Object(__WEBPACK_IMPORTED_MODULE_0__keys_js__["a" /* default */])(obj);
10505 var length = _keys.length;
10506 var pairs = Array(length);
10507 for (var i = 0; i < length; i++) {
10508 pairs[i] = [_keys[i], obj[_keys[i]]];
10509 }
10510 return pairs;
10511}
10512
10513
10514/***/ }),
10515/* 338 */
10516/***/ (function(module, __webpack_exports__, __webpack_require__) {
10517
10518"use strict";
10519/* harmony export (immutable) */ __webpack_exports__["a"] = create;
10520/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__baseCreate_js__ = __webpack_require__(195);
10521/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__extendOwn_js__ = __webpack_require__(141);
10522
10523
10524
10525// Creates an object that inherits from the given prototype object.
10526// If additional properties are provided then they will be added to the
10527// created object.
10528function create(prototype, props) {
10529 var result = Object(__WEBPACK_IMPORTED_MODULE_0__baseCreate_js__["a" /* default */])(prototype);
10530 if (props) Object(__WEBPACK_IMPORTED_MODULE_1__extendOwn_js__["a" /* default */])(result, props);
10531 return result;
10532}
10533
10534
10535/***/ }),
10536/* 339 */
10537/***/ (function(module, __webpack_exports__, __webpack_require__) {
10538
10539"use strict";
10540/* harmony export (immutable) */ __webpack_exports__["a"] = tap;
10541// Invokes `interceptor` with the `obj` and then returns `obj`.
10542// The primary purpose of this method is to "tap into" a method chain, in
10543// order to perform operations on intermediate results within the chain.
10544function tap(obj, interceptor) {
10545 interceptor(obj);
10546 return obj;
10547}
10548
10549
10550/***/ }),
10551/* 340 */
10552/***/ (function(module, __webpack_exports__, __webpack_require__) {
10553
10554"use strict";
10555/* harmony export (immutable) */ __webpack_exports__["a"] = has;
10556/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__has_js__ = __webpack_require__(47);
10557/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__toPath_js__ = __webpack_require__(88);
10558
10559
10560
10561// Shortcut function for checking if an object has a given property directly on
10562// itself (in other words, not on a prototype). Unlike the internal `has`
10563// function, this public version can also traverse nested properties.
10564function has(obj, path) {
10565 path = Object(__WEBPACK_IMPORTED_MODULE_1__toPath_js__["a" /* default */])(path);
10566 var length = path.length;
10567 for (var i = 0; i < length; i++) {
10568 var key = path[i];
10569 if (!Object(__WEBPACK_IMPORTED_MODULE_0__has_js__["a" /* default */])(obj, key)) return false;
10570 obj = obj[key];
10571 }
10572 return !!length;
10573}
10574
10575
10576/***/ }),
10577/* 341 */
10578/***/ (function(module, __webpack_exports__, __webpack_require__) {
10579
10580"use strict";
10581/* harmony export (immutable) */ __webpack_exports__["a"] = mapObject;
10582/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(22);
10583/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__keys_js__ = __webpack_require__(17);
10584
10585
10586
10587// Returns the results of applying the `iteratee` to each element of `obj`.
10588// In contrast to `_.map` it returns an object.
10589function mapObject(obj, iteratee, context) {
10590 iteratee = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(iteratee, context);
10591 var _keys = Object(__WEBPACK_IMPORTED_MODULE_1__keys_js__["a" /* default */])(obj),
10592 length = _keys.length,
10593 results = {};
10594 for (var index = 0; index < length; index++) {
10595 var currentKey = _keys[index];
10596 results[currentKey] = iteratee(obj[currentKey], currentKey, obj);
10597 }
10598 return results;
10599}
10600
10601
10602/***/ }),
10603/* 342 */
10604/***/ (function(module, __webpack_exports__, __webpack_require__) {
10605
10606"use strict";
10607/* harmony export (immutable) */ __webpack_exports__["a"] = propertyOf;
10608/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__noop_js__ = __webpack_require__(201);
10609/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__get_js__ = __webpack_require__(197);
10610
10611
10612
10613// Generates a function for a given object that returns a given property.
10614function propertyOf(obj) {
10615 if (obj == null) return __WEBPACK_IMPORTED_MODULE_0__noop_js__["a" /* default */];
10616 return function(path) {
10617 return Object(__WEBPACK_IMPORTED_MODULE_1__get_js__["a" /* default */])(obj, path);
10618 };
10619}
10620
10621
10622/***/ }),
10623/* 343 */
10624/***/ (function(module, __webpack_exports__, __webpack_require__) {
10625
10626"use strict";
10627/* harmony export (immutable) */ __webpack_exports__["a"] = times;
10628/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__optimizeCb_js__ = __webpack_require__(89);
10629
10630
10631// Run a function **n** times.
10632function times(n, iteratee, context) {
10633 var accum = Array(Math.max(0, n));
10634 iteratee = Object(__WEBPACK_IMPORTED_MODULE_0__optimizeCb_js__["a" /* default */])(iteratee, context, 1);
10635 for (var i = 0; i < n; i++) accum[i] = iteratee(i);
10636 return accum;
10637}
10638
10639
10640/***/ }),
10641/* 344 */
10642/***/ (function(module, __webpack_exports__, __webpack_require__) {
10643
10644"use strict";
10645/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createEscaper_js__ = __webpack_require__(203);
10646/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__escapeMap_js__ = __webpack_require__(204);
10647
10648
10649
10650// Function for escaping strings to HTML interpolation.
10651/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createEscaper_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__escapeMap_js__["a" /* default */]));
10652
10653
10654/***/ }),
10655/* 345 */
10656/***/ (function(module, __webpack_exports__, __webpack_require__) {
10657
10658"use strict";
10659/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createEscaper_js__ = __webpack_require__(203);
10660/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__unescapeMap_js__ = __webpack_require__(346);
10661
10662
10663
10664// Function for unescaping strings from HTML interpolation.
10665/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createEscaper_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__unescapeMap_js__["a" /* default */]));
10666
10667
10668/***/ }),
10669/* 346 */
10670/***/ (function(module, __webpack_exports__, __webpack_require__) {
10671
10672"use strict";
10673/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__invert_js__ = __webpack_require__(191);
10674/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__escapeMap_js__ = __webpack_require__(204);
10675
10676
10677
10678// Internal list of HTML entities for unescaping.
10679/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__invert_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__escapeMap_js__["a" /* default */]));
10680
10681
10682/***/ }),
10683/* 347 */
10684/***/ (function(module, __webpack_exports__, __webpack_require__) {
10685
10686"use strict";
10687/* harmony export (immutable) */ __webpack_exports__["a"] = template;
10688/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__defaults_js__ = __webpack_require__(194);
10689/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__underscore_js__ = __webpack_require__(25);
10690/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__templateSettings_js__ = __webpack_require__(205);
10691
10692
10693
10694
10695// When customizing `_.templateSettings`, if you don't want to define an
10696// interpolation, evaluation or escaping regex, we need one that is
10697// guaranteed not to match.
10698var noMatch = /(.)^/;
10699
10700// Certain characters need to be escaped so that they can be put into a
10701// string literal.
10702var escapes = {
10703 "'": "'",
10704 '\\': '\\',
10705 '\r': 'r',
10706 '\n': 'n',
10707 '\u2028': 'u2028',
10708 '\u2029': 'u2029'
10709};
10710
10711var escapeRegExp = /\\|'|\r|\n|\u2028|\u2029/g;
10712
10713function escapeChar(match) {
10714 return '\\' + escapes[match];
10715}
10716
10717var bareIdentifier = /^\s*(\w|\$)+\s*$/;
10718
10719// JavaScript micro-templating, similar to John Resig's implementation.
10720// Underscore templating handles arbitrary delimiters, preserves whitespace,
10721// and correctly escapes quotes within interpolated code.
10722// NB: `oldSettings` only exists for backwards compatibility.
10723function template(text, settings, oldSettings) {
10724 if (!settings && oldSettings) settings = oldSettings;
10725 settings = Object(__WEBPACK_IMPORTED_MODULE_0__defaults_js__["a" /* default */])({}, settings, __WEBPACK_IMPORTED_MODULE_1__underscore_js__["a" /* default */].templateSettings);
10726
10727 // Combine delimiters into one regular expression via alternation.
10728 var matcher = RegExp([
10729 (settings.escape || noMatch).source,
10730 (settings.interpolate || noMatch).source,
10731 (settings.evaluate || noMatch).source
10732 ].join('|') + '|$', 'g');
10733
10734 // Compile the template source, escaping string literals appropriately.
10735 var index = 0;
10736 var source = "__p+='";
10737 text.replace(matcher, function(match, escape, interpolate, evaluate, offset) {
10738 source += text.slice(index, offset).replace(escapeRegExp, escapeChar);
10739 index = offset + match.length;
10740
10741 if (escape) {
10742 source += "'+\n((__t=(" + escape + "))==null?'':_.escape(__t))+\n'";
10743 } else if (interpolate) {
10744 source += "'+\n((__t=(" + interpolate + "))==null?'':__t)+\n'";
10745 } else if (evaluate) {
10746 source += "';\n" + evaluate + "\n__p+='";
10747 }
10748
10749 // Adobe VMs need the match returned to produce the correct offset.
10750 return match;
10751 });
10752 source += "';\n";
10753
10754 var argument = settings.variable;
10755 if (argument) {
10756 if (!bareIdentifier.test(argument)) throw new Error(argument);
10757 } else {
10758 // If a variable is not specified, place data values in local scope.
10759 source = 'with(obj||{}){\n' + source + '}\n';
10760 argument = 'obj';
10761 }
10762
10763 source = "var __t,__p='',__j=Array.prototype.join," +
10764 "print=function(){__p+=__j.call(arguments,'');};\n" +
10765 source + 'return __p;\n';
10766
10767 var render;
10768 try {
10769 render = new Function(argument, '_', source);
10770 } catch (e) {
10771 e.source = source;
10772 throw e;
10773 }
10774
10775 var template = function(data) {
10776 return render.call(this, data, __WEBPACK_IMPORTED_MODULE_1__underscore_js__["a" /* default */]);
10777 };
10778
10779 // Provide the compiled source as a convenience for precompilation.
10780 template.source = 'function(' + argument + '){\n' + source + '}';
10781
10782 return template;
10783}
10784
10785
10786/***/ }),
10787/* 348 */
10788/***/ (function(module, __webpack_exports__, __webpack_require__) {
10789
10790"use strict";
10791/* harmony export (immutable) */ __webpack_exports__["a"] = result;
10792/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isFunction_js__ = __webpack_require__(30);
10793/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__toPath_js__ = __webpack_require__(88);
10794
10795
10796
10797// Traverses the children of `obj` along `path`. If a child is a function, it
10798// is invoked with its parent as context. Returns the value of the final
10799// child, or `fallback` if any child is undefined.
10800function result(obj, path, fallback) {
10801 path = Object(__WEBPACK_IMPORTED_MODULE_1__toPath_js__["a" /* default */])(path);
10802 var length = path.length;
10803 if (!length) {
10804 return Object(__WEBPACK_IMPORTED_MODULE_0__isFunction_js__["a" /* default */])(fallback) ? fallback.call(obj) : fallback;
10805 }
10806 for (var i = 0; i < length; i++) {
10807 var prop = obj == null ? void 0 : obj[path[i]];
10808 if (prop === void 0) {
10809 prop = fallback;
10810 i = length; // Ensure we don't continue iterating.
10811 }
10812 obj = Object(__WEBPACK_IMPORTED_MODULE_0__isFunction_js__["a" /* default */])(prop) ? prop.call(obj) : prop;
10813 }
10814 return obj;
10815}
10816
10817
10818/***/ }),
10819/* 349 */
10820/***/ (function(module, __webpack_exports__, __webpack_require__) {
10821
10822"use strict";
10823/* harmony export (immutable) */ __webpack_exports__["a"] = uniqueId;
10824// Generate a unique integer id (unique within the entire client session).
10825// Useful for temporary DOM ids.
10826var idCounter = 0;
10827function uniqueId(prefix) {
10828 var id = ++idCounter + '';
10829 return prefix ? prefix + id : id;
10830}
10831
10832
10833/***/ }),
10834/* 350 */
10835/***/ (function(module, __webpack_exports__, __webpack_require__) {
10836
10837"use strict";
10838/* harmony export (immutable) */ __webpack_exports__["a"] = chain;
10839/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__underscore_js__ = __webpack_require__(25);
10840
10841
10842// Start chaining a wrapped Underscore object.
10843function chain(obj) {
10844 var instance = Object(__WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */])(obj);
10845 instance._chain = true;
10846 return instance;
10847}
10848
10849
10850/***/ }),
10851/* 351 */
10852/***/ (function(module, __webpack_exports__, __webpack_require__) {
10853
10854"use strict";
10855/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(24);
10856/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__flatten_js__ = __webpack_require__(72);
10857/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__bind_js__ = __webpack_require__(207);
10858
10859
10860
10861
10862// Bind a number of an object's methods to that object. Remaining arguments
10863// are the method names to be bound. Useful for ensuring that all callbacks
10864// defined on an object belong to it.
10865/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(obj, keys) {
10866 keys = Object(__WEBPACK_IMPORTED_MODULE_1__flatten_js__["a" /* default */])(keys, false, false);
10867 var index = keys.length;
10868 if (index < 1) throw new Error('bindAll must be passed function names');
10869 while (index--) {
10870 var key = keys[index];
10871 obj[key] = Object(__WEBPACK_IMPORTED_MODULE_2__bind_js__["a" /* default */])(obj[key], obj);
10872 }
10873 return obj;
10874}));
10875
10876
10877/***/ }),
10878/* 352 */
10879/***/ (function(module, __webpack_exports__, __webpack_require__) {
10880
10881"use strict";
10882/* harmony export (immutable) */ __webpack_exports__["a"] = memoize;
10883/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__has_js__ = __webpack_require__(47);
10884
10885
10886// Memoize an expensive function by storing its results.
10887function memoize(func, hasher) {
10888 var memoize = function(key) {
10889 var cache = memoize.cache;
10890 var address = '' + (hasher ? hasher.apply(this, arguments) : key);
10891 if (!Object(__WEBPACK_IMPORTED_MODULE_0__has_js__["a" /* default */])(cache, address)) cache[address] = func.apply(this, arguments);
10892 return cache[address];
10893 };
10894 memoize.cache = {};
10895 return memoize;
10896}
10897
10898
10899/***/ }),
10900/* 353 */
10901/***/ (function(module, __webpack_exports__, __webpack_require__) {
10902
10903"use strict";
10904/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__partial_js__ = __webpack_require__(114);
10905/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__delay_js__ = __webpack_require__(208);
10906/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__underscore_js__ = __webpack_require__(25);
10907
10908
10909
10910
10911// Defers a function, scheduling it to run after the current call stack has
10912// cleared.
10913/* 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));
10914
10915
10916/***/ }),
10917/* 354 */
10918/***/ (function(module, __webpack_exports__, __webpack_require__) {
10919
10920"use strict";
10921/* harmony export (immutable) */ __webpack_exports__["a"] = throttle;
10922/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__now_js__ = __webpack_require__(145);
10923
10924
10925// Returns a function, that, when invoked, will only be triggered at most once
10926// during a given window of time. Normally, the throttled function will run
10927// as much as it can, without ever going more than once per `wait` duration;
10928// but if you'd like to disable the execution on the leading edge, pass
10929// `{leading: false}`. To disable execution on the trailing edge, ditto.
10930function throttle(func, wait, options) {
10931 var timeout, context, args, result;
10932 var previous = 0;
10933 if (!options) options = {};
10934
10935 var later = function() {
10936 previous = options.leading === false ? 0 : Object(__WEBPACK_IMPORTED_MODULE_0__now_js__["a" /* default */])();
10937 timeout = null;
10938 result = func.apply(context, args);
10939 if (!timeout) context = args = null;
10940 };
10941
10942 var throttled = function() {
10943 var _now = Object(__WEBPACK_IMPORTED_MODULE_0__now_js__["a" /* default */])();
10944 if (!previous && options.leading === false) previous = _now;
10945 var remaining = wait - (_now - previous);
10946 context = this;
10947 args = arguments;
10948 if (remaining <= 0 || remaining > wait) {
10949 if (timeout) {
10950 clearTimeout(timeout);
10951 timeout = null;
10952 }
10953 previous = _now;
10954 result = func.apply(context, args);
10955 if (!timeout) context = args = null;
10956 } else if (!timeout && options.trailing !== false) {
10957 timeout = setTimeout(later, remaining);
10958 }
10959 return result;
10960 };
10961
10962 throttled.cancel = function() {
10963 clearTimeout(timeout);
10964 previous = 0;
10965 timeout = context = args = null;
10966 };
10967
10968 return throttled;
10969}
10970
10971
10972/***/ }),
10973/* 355 */
10974/***/ (function(module, __webpack_exports__, __webpack_require__) {
10975
10976"use strict";
10977/* harmony export (immutable) */ __webpack_exports__["a"] = debounce;
10978/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(24);
10979/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__now_js__ = __webpack_require__(145);
10980
10981
10982
10983// When a sequence of calls of the returned function ends, the argument
10984// function is triggered. The end of a sequence is defined by the `wait`
10985// parameter. If `immediate` is passed, the argument function will be
10986// triggered at the beginning of the sequence instead of at the end.
10987function debounce(func, wait, immediate) {
10988 var timeout, previous, args, result, context;
10989
10990 var later = function() {
10991 var passed = Object(__WEBPACK_IMPORTED_MODULE_1__now_js__["a" /* default */])() - previous;
10992 if (wait > passed) {
10993 timeout = setTimeout(later, wait - passed);
10994 } else {
10995 timeout = null;
10996 if (!immediate) result = func.apply(context, args);
10997 // This check is needed because `func` can recursively invoke `debounced`.
10998 if (!timeout) args = context = null;
10999 }
11000 };
11001
11002 var debounced = Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(_args) {
11003 context = this;
11004 args = _args;
11005 previous = Object(__WEBPACK_IMPORTED_MODULE_1__now_js__["a" /* default */])();
11006 if (!timeout) {
11007 timeout = setTimeout(later, wait);
11008 if (immediate) result = func.apply(context, args);
11009 }
11010 return result;
11011 });
11012
11013 debounced.cancel = function() {
11014 clearTimeout(timeout);
11015 timeout = args = context = null;
11016 };
11017
11018 return debounced;
11019}
11020
11021
11022/***/ }),
11023/* 356 */
11024/***/ (function(module, __webpack_exports__, __webpack_require__) {
11025
11026"use strict";
11027/* harmony export (immutable) */ __webpack_exports__["a"] = wrap;
11028/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__partial_js__ = __webpack_require__(114);
11029
11030
11031// Returns the first function passed as an argument to the second,
11032// allowing you to adjust arguments, run code before and after, and
11033// conditionally execute the original function.
11034function wrap(func, wrapper) {
11035 return Object(__WEBPACK_IMPORTED_MODULE_0__partial_js__["a" /* default */])(wrapper, func);
11036}
11037
11038
11039/***/ }),
11040/* 357 */
11041/***/ (function(module, __webpack_exports__, __webpack_require__) {
11042
11043"use strict";
11044/* harmony export (immutable) */ __webpack_exports__["a"] = compose;
11045// Returns a function that is the composition of a list of functions, each
11046// consuming the return value of the function that follows.
11047function compose() {
11048 var args = arguments;
11049 var start = args.length - 1;
11050 return function() {
11051 var i = start;
11052 var result = args[start].apply(this, arguments);
11053 while (i--) result = args[i].call(this, result);
11054 return result;
11055 };
11056}
11057
11058
11059/***/ }),
11060/* 358 */
11061/***/ (function(module, __webpack_exports__, __webpack_require__) {
11062
11063"use strict";
11064/* harmony export (immutable) */ __webpack_exports__["a"] = after;
11065// Returns a function that will only be executed on and after the Nth call.
11066function after(times, func) {
11067 return function() {
11068 if (--times < 1) {
11069 return func.apply(this, arguments);
11070 }
11071 };
11072}
11073
11074
11075/***/ }),
11076/* 359 */
11077/***/ (function(module, __webpack_exports__, __webpack_require__) {
11078
11079"use strict";
11080/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__partial_js__ = __webpack_require__(114);
11081/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__before_js__ = __webpack_require__(209);
11082
11083
11084
11085// Returns a function that will be executed at most one time, no matter how
11086// often you call it. Useful for lazy initialization.
11087/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__partial_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__before_js__["a" /* default */], 2));
11088
11089
11090/***/ }),
11091/* 360 */
11092/***/ (function(module, __webpack_exports__, __webpack_require__) {
11093
11094"use strict";
11095/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__findLastIndex_js__ = __webpack_require__(212);
11096/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__createIndexFinder_js__ = __webpack_require__(215);
11097
11098
11099
11100// Return the position of the last occurrence of an item in an array,
11101// or -1 if the item is not included in the array.
11102/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_1__createIndexFinder_js__["a" /* default */])(-1, __WEBPACK_IMPORTED_MODULE_0__findLastIndex_js__["a" /* default */]));
11103
11104
11105/***/ }),
11106/* 361 */
11107/***/ (function(module, __webpack_exports__, __webpack_require__) {
11108
11109"use strict";
11110/* harmony export (immutable) */ __webpack_exports__["a"] = findWhere;
11111/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__find_js__ = __webpack_require__(216);
11112/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__matcher_js__ = __webpack_require__(113);
11113
11114
11115
11116// Convenience version of a common use case of `_.find`: getting the first
11117// object containing specific `key:value` pairs.
11118function findWhere(obj, attrs) {
11119 return Object(__WEBPACK_IMPORTED_MODULE_0__find_js__["a" /* default */])(obj, Object(__WEBPACK_IMPORTED_MODULE_1__matcher_js__["a" /* default */])(attrs));
11120}
11121
11122
11123/***/ }),
11124/* 362 */
11125/***/ (function(module, __webpack_exports__, __webpack_require__) {
11126
11127"use strict";
11128/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createReduce_js__ = __webpack_require__(217);
11129
11130
11131// **Reduce** builds up a single result from a list of values, aka `inject`,
11132// or `foldl`.
11133/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createReduce_js__["a" /* default */])(1));
11134
11135
11136/***/ }),
11137/* 363 */
11138/***/ (function(module, __webpack_exports__, __webpack_require__) {
11139
11140"use strict";
11141/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createReduce_js__ = __webpack_require__(217);
11142
11143
11144// The right-associative version of reduce, also known as `foldr`.
11145/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createReduce_js__["a" /* default */])(-1));
11146
11147
11148/***/ }),
11149/* 364 */
11150/***/ (function(module, __webpack_exports__, __webpack_require__) {
11151
11152"use strict";
11153/* harmony export (immutable) */ __webpack_exports__["a"] = reject;
11154/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__filter_js__ = __webpack_require__(90);
11155/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__negate_js__ = __webpack_require__(146);
11156/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__cb_js__ = __webpack_require__(22);
11157
11158
11159
11160
11161// Return all the elements for which a truth test fails.
11162function reject(obj, predicate, context) {
11163 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);
11164}
11165
11166
11167/***/ }),
11168/* 365 */
11169/***/ (function(module, __webpack_exports__, __webpack_require__) {
11170
11171"use strict";
11172/* harmony export (immutable) */ __webpack_exports__["a"] = every;
11173/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(22);
11174/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isArrayLike_js__ = __webpack_require__(26);
11175/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__keys_js__ = __webpack_require__(17);
11176
11177
11178
11179
11180// Determine whether all of the elements pass a truth test.
11181function every(obj, predicate, context) {
11182 predicate = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(predicate, context);
11183 var _keys = !Object(__WEBPACK_IMPORTED_MODULE_1__isArrayLike_js__["a" /* default */])(obj) && Object(__WEBPACK_IMPORTED_MODULE_2__keys_js__["a" /* default */])(obj),
11184 length = (_keys || obj).length;
11185 for (var index = 0; index < length; index++) {
11186 var currentKey = _keys ? _keys[index] : index;
11187 if (!predicate(obj[currentKey], currentKey, obj)) return false;
11188 }
11189 return true;
11190}
11191
11192
11193/***/ }),
11194/* 366 */
11195/***/ (function(module, __webpack_exports__, __webpack_require__) {
11196
11197"use strict";
11198/* harmony export (immutable) */ __webpack_exports__["a"] = some;
11199/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(22);
11200/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isArrayLike_js__ = __webpack_require__(26);
11201/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__keys_js__ = __webpack_require__(17);
11202
11203
11204
11205
11206// Determine if at least one element in the object passes a truth test.
11207function some(obj, predicate, context) {
11208 predicate = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(predicate, context);
11209 var _keys = !Object(__WEBPACK_IMPORTED_MODULE_1__isArrayLike_js__["a" /* default */])(obj) && Object(__WEBPACK_IMPORTED_MODULE_2__keys_js__["a" /* default */])(obj),
11210 length = (_keys || obj).length;
11211 for (var index = 0; index < length; index++) {
11212 var currentKey = _keys ? _keys[index] : index;
11213 if (predicate(obj[currentKey], currentKey, obj)) return true;
11214 }
11215 return false;
11216}
11217
11218
11219/***/ }),
11220/* 367 */
11221/***/ (function(module, __webpack_exports__, __webpack_require__) {
11222
11223"use strict";
11224/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(24);
11225/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isFunction_js__ = __webpack_require__(30);
11226/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__map_js__ = __webpack_require__(73);
11227/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__deepGet_js__ = __webpack_require__(142);
11228/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__toPath_js__ = __webpack_require__(88);
11229
11230
11231
11232
11233
11234
11235// Invoke a method (with arguments) on every item in a collection.
11236/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(obj, path, args) {
11237 var contextPath, func;
11238 if (Object(__WEBPACK_IMPORTED_MODULE_1__isFunction_js__["a" /* default */])(path)) {
11239 func = path;
11240 } else {
11241 path = Object(__WEBPACK_IMPORTED_MODULE_4__toPath_js__["a" /* default */])(path);
11242 contextPath = path.slice(0, -1);
11243 path = path[path.length - 1];
11244 }
11245 return Object(__WEBPACK_IMPORTED_MODULE_2__map_js__["a" /* default */])(obj, function(context) {
11246 var method = func;
11247 if (!method) {
11248 if (contextPath && contextPath.length) {
11249 context = Object(__WEBPACK_IMPORTED_MODULE_3__deepGet_js__["a" /* default */])(context, contextPath);
11250 }
11251 if (context == null) return void 0;
11252 method = context[path];
11253 }
11254 return method == null ? method : method.apply(context, args);
11255 });
11256}));
11257
11258
11259/***/ }),
11260/* 368 */
11261/***/ (function(module, __webpack_exports__, __webpack_require__) {
11262
11263"use strict";
11264/* harmony export (immutable) */ __webpack_exports__["a"] = where;
11265/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__filter_js__ = __webpack_require__(90);
11266/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__matcher_js__ = __webpack_require__(113);
11267
11268
11269
11270// Convenience version of a common use case of `_.filter`: selecting only
11271// objects containing specific `key:value` pairs.
11272function where(obj, attrs) {
11273 return Object(__WEBPACK_IMPORTED_MODULE_0__filter_js__["a" /* default */])(obj, Object(__WEBPACK_IMPORTED_MODULE_1__matcher_js__["a" /* default */])(attrs));
11274}
11275
11276
11277/***/ }),
11278/* 369 */
11279/***/ (function(module, __webpack_exports__, __webpack_require__) {
11280
11281"use strict";
11282/* harmony export (immutable) */ __webpack_exports__["a"] = min;
11283/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__ = __webpack_require__(26);
11284/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__values_js__ = __webpack_require__(71);
11285/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__cb_js__ = __webpack_require__(22);
11286/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__each_js__ = __webpack_require__(60);
11287
11288
11289
11290
11291
11292// Return the minimum element (or element-based computation).
11293function min(obj, iteratee, context) {
11294 var result = Infinity, lastComputed = Infinity,
11295 value, computed;
11296 if (iteratee == null || typeof iteratee == 'number' && typeof obj[0] != 'object' && obj != null) {
11297 obj = Object(__WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__["a" /* default */])(obj) ? obj : Object(__WEBPACK_IMPORTED_MODULE_1__values_js__["a" /* default */])(obj);
11298 for (var i = 0, length = obj.length; i < length; i++) {
11299 value = obj[i];
11300 if (value != null && value < result) {
11301 result = value;
11302 }
11303 }
11304 } else {
11305 iteratee = Object(__WEBPACK_IMPORTED_MODULE_2__cb_js__["a" /* default */])(iteratee, context);
11306 Object(__WEBPACK_IMPORTED_MODULE_3__each_js__["a" /* default */])(obj, function(v, index, list) {
11307 computed = iteratee(v, index, list);
11308 if (computed < lastComputed || computed === Infinity && result === Infinity) {
11309 result = v;
11310 lastComputed = computed;
11311 }
11312 });
11313 }
11314 return result;
11315}
11316
11317
11318/***/ }),
11319/* 370 */
11320/***/ (function(module, __webpack_exports__, __webpack_require__) {
11321
11322"use strict";
11323/* harmony export (immutable) */ __webpack_exports__["a"] = shuffle;
11324/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__sample_js__ = __webpack_require__(219);
11325
11326
11327// Shuffle a collection.
11328function shuffle(obj) {
11329 return Object(__WEBPACK_IMPORTED_MODULE_0__sample_js__["a" /* default */])(obj, Infinity);
11330}
11331
11332
11333/***/ }),
11334/* 371 */
11335/***/ (function(module, __webpack_exports__, __webpack_require__) {
11336
11337"use strict";
11338/* harmony export (immutable) */ __webpack_exports__["a"] = sortBy;
11339/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(22);
11340/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__pluck_js__ = __webpack_require__(148);
11341/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__map_js__ = __webpack_require__(73);
11342
11343
11344
11345
11346// Sort the object's values by a criterion produced by an iteratee.
11347function sortBy(obj, iteratee, context) {
11348 var index = 0;
11349 iteratee = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(iteratee, context);
11350 return Object(__WEBPACK_IMPORTED_MODULE_1__pluck_js__["a" /* default */])(Object(__WEBPACK_IMPORTED_MODULE_2__map_js__["a" /* default */])(obj, function(value, key, list) {
11351 return {
11352 value: value,
11353 index: index++,
11354 criteria: iteratee(value, key, list)
11355 };
11356 }).sort(function(left, right) {
11357 var a = left.criteria;
11358 var b = right.criteria;
11359 if (a !== b) {
11360 if (a > b || a === void 0) return 1;
11361 if (a < b || b === void 0) return -1;
11362 }
11363 return left.index - right.index;
11364 }), 'value');
11365}
11366
11367
11368/***/ }),
11369/* 372 */
11370/***/ (function(module, __webpack_exports__, __webpack_require__) {
11371
11372"use strict";
11373/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__group_js__ = __webpack_require__(115);
11374/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__has_js__ = __webpack_require__(47);
11375
11376
11377
11378// Groups the object's values by a criterion. Pass either a string attribute
11379// to group by, or a function that returns the criterion.
11380/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__group_js__["a" /* default */])(function(result, value, key) {
11381 if (Object(__WEBPACK_IMPORTED_MODULE_1__has_js__["a" /* default */])(result, key)) result[key].push(value); else result[key] = [value];
11382}));
11383
11384
11385/***/ }),
11386/* 373 */
11387/***/ (function(module, __webpack_exports__, __webpack_require__) {
11388
11389"use strict";
11390/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__group_js__ = __webpack_require__(115);
11391
11392
11393// Indexes the object's values by a criterion, similar to `_.groupBy`, but for
11394// when you know that your index values will be unique.
11395/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__group_js__["a" /* default */])(function(result, value, key) {
11396 result[key] = value;
11397}));
11398
11399
11400/***/ }),
11401/* 374 */
11402/***/ (function(module, __webpack_exports__, __webpack_require__) {
11403
11404"use strict";
11405/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__group_js__ = __webpack_require__(115);
11406/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__has_js__ = __webpack_require__(47);
11407
11408
11409
11410// Counts instances of an object that group by a certain criterion. Pass
11411// either a string attribute to count by, or a function that returns the
11412// criterion.
11413/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__group_js__["a" /* default */])(function(result, value, key) {
11414 if (Object(__WEBPACK_IMPORTED_MODULE_1__has_js__["a" /* default */])(result, key)) result[key]++; else result[key] = 1;
11415}));
11416
11417
11418/***/ }),
11419/* 375 */
11420/***/ (function(module, __webpack_exports__, __webpack_require__) {
11421
11422"use strict";
11423/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__group_js__ = __webpack_require__(115);
11424
11425
11426// Split a collection into two arrays: one whose elements all pass the given
11427// truth test, and one whose elements all do not pass the truth test.
11428/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__group_js__["a" /* default */])(function(result, value, pass) {
11429 result[pass ? 0 : 1].push(value);
11430}, true));
11431
11432
11433/***/ }),
11434/* 376 */
11435/***/ (function(module, __webpack_exports__, __webpack_require__) {
11436
11437"use strict";
11438/* harmony export (immutable) */ __webpack_exports__["a"] = toArray;
11439/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isArray_js__ = __webpack_require__(59);
11440/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__setup_js__ = __webpack_require__(6);
11441/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__isString_js__ = __webpack_require__(135);
11442/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__isArrayLike_js__ = __webpack_require__(26);
11443/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__map_js__ = __webpack_require__(73);
11444/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__identity_js__ = __webpack_require__(143);
11445/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__values_js__ = __webpack_require__(71);
11446
11447
11448
11449
11450
11451
11452
11453
11454// Safely create a real, live array from anything iterable.
11455var reStrSymbol = /[^\ud800-\udfff]|[\ud800-\udbff][\udc00-\udfff]|[\ud800-\udfff]/g;
11456function toArray(obj) {
11457 if (!obj) return [];
11458 if (Object(__WEBPACK_IMPORTED_MODULE_0__isArray_js__["a" /* default */])(obj)) return __WEBPACK_IMPORTED_MODULE_1__setup_js__["q" /* slice */].call(obj);
11459 if (Object(__WEBPACK_IMPORTED_MODULE_2__isString_js__["a" /* default */])(obj)) {
11460 // Keep surrogate pair characters together.
11461 return obj.match(reStrSymbol);
11462 }
11463 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 */]);
11464 return Object(__WEBPACK_IMPORTED_MODULE_6__values_js__["a" /* default */])(obj);
11465}
11466
11467
11468/***/ }),
11469/* 377 */
11470/***/ (function(module, __webpack_exports__, __webpack_require__) {
11471
11472"use strict";
11473/* harmony export (immutable) */ __webpack_exports__["a"] = size;
11474/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__ = __webpack_require__(26);
11475/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__keys_js__ = __webpack_require__(17);
11476
11477
11478
11479// Return the number of elements in a collection.
11480function size(obj) {
11481 if (obj == null) return 0;
11482 return Object(__WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__["a" /* default */])(obj) ? obj.length : Object(__WEBPACK_IMPORTED_MODULE_1__keys_js__["a" /* default */])(obj).length;
11483}
11484
11485
11486/***/ }),
11487/* 378 */
11488/***/ (function(module, __webpack_exports__, __webpack_require__) {
11489
11490"use strict";
11491/* harmony export (immutable) */ __webpack_exports__["a"] = keyInObj;
11492// Internal `_.pick` helper function to determine whether `key` is an enumerable
11493// property name of `obj`.
11494function keyInObj(value, key, obj) {
11495 return key in obj;
11496}
11497
11498
11499/***/ }),
11500/* 379 */
11501/***/ (function(module, __webpack_exports__, __webpack_require__) {
11502
11503"use strict";
11504/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(24);
11505/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isFunction_js__ = __webpack_require__(30);
11506/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__negate_js__ = __webpack_require__(146);
11507/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__map_js__ = __webpack_require__(73);
11508/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__flatten_js__ = __webpack_require__(72);
11509/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__contains_js__ = __webpack_require__(91);
11510/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__pick_js__ = __webpack_require__(220);
11511
11512
11513
11514
11515
11516
11517
11518
11519// Return a copy of the object without the disallowed properties.
11520/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(obj, keys) {
11521 var iteratee = keys[0], context;
11522 if (Object(__WEBPACK_IMPORTED_MODULE_1__isFunction_js__["a" /* default */])(iteratee)) {
11523 iteratee = Object(__WEBPACK_IMPORTED_MODULE_2__negate_js__["a" /* default */])(iteratee);
11524 if (keys.length > 1) context = keys[1];
11525 } else {
11526 keys = Object(__WEBPACK_IMPORTED_MODULE_3__map_js__["a" /* default */])(Object(__WEBPACK_IMPORTED_MODULE_4__flatten_js__["a" /* default */])(keys, false, false), String);
11527 iteratee = function(value, key) {
11528 return !Object(__WEBPACK_IMPORTED_MODULE_5__contains_js__["a" /* default */])(keys, key);
11529 };
11530 }
11531 return Object(__WEBPACK_IMPORTED_MODULE_6__pick_js__["a" /* default */])(obj, iteratee, context);
11532}));
11533
11534
11535/***/ }),
11536/* 380 */
11537/***/ (function(module, __webpack_exports__, __webpack_require__) {
11538
11539"use strict";
11540/* harmony export (immutable) */ __webpack_exports__["a"] = first;
11541/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__initial_js__ = __webpack_require__(221);
11542
11543
11544// Get the first element of an array. Passing **n** will return the first N
11545// values in the array. The **guard** check allows it to work with `_.map`.
11546function first(array, n, guard) {
11547 if (array == null || array.length < 1) return n == null || guard ? void 0 : [];
11548 if (n == null || guard) return array[0];
11549 return Object(__WEBPACK_IMPORTED_MODULE_0__initial_js__["a" /* default */])(array, array.length - n);
11550}
11551
11552
11553/***/ }),
11554/* 381 */
11555/***/ (function(module, __webpack_exports__, __webpack_require__) {
11556
11557"use strict";
11558/* harmony export (immutable) */ __webpack_exports__["a"] = last;
11559/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__rest_js__ = __webpack_require__(222);
11560
11561
11562// Get the last element of an array. Passing **n** will return the last N
11563// values in the array.
11564function last(array, n, guard) {
11565 if (array == null || array.length < 1) return n == null || guard ? void 0 : [];
11566 if (n == null || guard) return array[array.length - 1];
11567 return Object(__WEBPACK_IMPORTED_MODULE_0__rest_js__["a" /* default */])(array, Math.max(0, array.length - n));
11568}
11569
11570
11571/***/ }),
11572/* 382 */
11573/***/ (function(module, __webpack_exports__, __webpack_require__) {
11574
11575"use strict";
11576/* harmony export (immutable) */ __webpack_exports__["a"] = compact;
11577/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__filter_js__ = __webpack_require__(90);
11578
11579
11580// Trim out all falsy values from an array.
11581function compact(array) {
11582 return Object(__WEBPACK_IMPORTED_MODULE_0__filter_js__["a" /* default */])(array, Boolean);
11583}
11584
11585
11586/***/ }),
11587/* 383 */
11588/***/ (function(module, __webpack_exports__, __webpack_require__) {
11589
11590"use strict";
11591/* harmony export (immutable) */ __webpack_exports__["a"] = flatten;
11592/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__flatten_js__ = __webpack_require__(72);
11593
11594
11595// Flatten out an array, either recursively (by default), or up to `depth`.
11596// Passing `true` or `false` as `depth` means `1` or `Infinity`, respectively.
11597function flatten(array, depth) {
11598 return Object(__WEBPACK_IMPORTED_MODULE_0__flatten_js__["a" /* default */])(array, depth, false);
11599}
11600
11601
11602/***/ }),
11603/* 384 */
11604/***/ (function(module, __webpack_exports__, __webpack_require__) {
11605
11606"use strict";
11607/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(24);
11608/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__difference_js__ = __webpack_require__(223);
11609
11610
11611
11612// Return a version of the array that does not contain the specified value(s).
11613/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(array, otherArrays) {
11614 return Object(__WEBPACK_IMPORTED_MODULE_1__difference_js__["a" /* default */])(array, otherArrays);
11615}));
11616
11617
11618/***/ }),
11619/* 385 */
11620/***/ (function(module, __webpack_exports__, __webpack_require__) {
11621
11622"use strict";
11623/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(24);
11624/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__uniq_js__ = __webpack_require__(224);
11625/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__flatten_js__ = __webpack_require__(72);
11626
11627
11628
11629
11630// Produce an array that contains the union: each distinct element from all of
11631// the passed-in arrays.
11632/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(arrays) {
11633 return Object(__WEBPACK_IMPORTED_MODULE_1__uniq_js__["a" /* default */])(Object(__WEBPACK_IMPORTED_MODULE_2__flatten_js__["a" /* default */])(arrays, true, true));
11634}));
11635
11636
11637/***/ }),
11638/* 386 */
11639/***/ (function(module, __webpack_exports__, __webpack_require__) {
11640
11641"use strict";
11642/* harmony export (immutable) */ __webpack_exports__["a"] = intersection;
11643/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__getLength_js__ = __webpack_require__(31);
11644/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__contains_js__ = __webpack_require__(91);
11645
11646
11647
11648// Produce an array that contains every item shared between all the
11649// passed-in arrays.
11650function intersection(array) {
11651 var result = [];
11652 var argsLength = arguments.length;
11653 for (var i = 0, length = Object(__WEBPACK_IMPORTED_MODULE_0__getLength_js__["a" /* default */])(array); i < length; i++) {
11654 var item = array[i];
11655 if (Object(__WEBPACK_IMPORTED_MODULE_1__contains_js__["a" /* default */])(result, item)) continue;
11656 var j;
11657 for (j = 1; j < argsLength; j++) {
11658 if (!Object(__WEBPACK_IMPORTED_MODULE_1__contains_js__["a" /* default */])(arguments[j], item)) break;
11659 }
11660 if (j === argsLength) result.push(item);
11661 }
11662 return result;
11663}
11664
11665
11666/***/ }),
11667/* 387 */
11668/***/ (function(module, __webpack_exports__, __webpack_require__) {
11669
11670"use strict";
11671/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(24);
11672/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__unzip_js__ = __webpack_require__(225);
11673
11674
11675
11676// Zip together multiple lists into a single array -- elements that share
11677// an index go together.
11678/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__unzip_js__["a" /* default */]));
11679
11680
11681/***/ }),
11682/* 388 */
11683/***/ (function(module, __webpack_exports__, __webpack_require__) {
11684
11685"use strict";
11686/* harmony export (immutable) */ __webpack_exports__["a"] = object;
11687/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__getLength_js__ = __webpack_require__(31);
11688
11689
11690// Converts lists into objects. Pass either a single array of `[key, value]`
11691// pairs, or two parallel arrays of the same length -- one of keys, and one of
11692// the corresponding values. Passing by pairs is the reverse of `_.pairs`.
11693function object(list, values) {
11694 var result = {};
11695 for (var i = 0, length = Object(__WEBPACK_IMPORTED_MODULE_0__getLength_js__["a" /* default */])(list); i < length; i++) {
11696 if (values) {
11697 result[list[i]] = values[i];
11698 } else {
11699 result[list[i][0]] = list[i][1];
11700 }
11701 }
11702 return result;
11703}
11704
11705
11706/***/ }),
11707/* 389 */
11708/***/ (function(module, __webpack_exports__, __webpack_require__) {
11709
11710"use strict";
11711/* harmony export (immutable) */ __webpack_exports__["a"] = range;
11712// Generate an integer Array containing an arithmetic progression. A port of
11713// the native Python `range()` function. See
11714// [the Python documentation](https://docs.python.org/library/functions.html#range).
11715function range(start, stop, step) {
11716 if (stop == null) {
11717 stop = start || 0;
11718 start = 0;
11719 }
11720 if (!step) {
11721 step = stop < start ? -1 : 1;
11722 }
11723
11724 var length = Math.max(Math.ceil((stop - start) / step), 0);
11725 var range = Array(length);
11726
11727 for (var idx = 0; idx < length; idx++, start += step) {
11728 range[idx] = start;
11729 }
11730
11731 return range;
11732}
11733
11734
11735/***/ }),
11736/* 390 */
11737/***/ (function(module, __webpack_exports__, __webpack_require__) {
11738
11739"use strict";
11740/* harmony export (immutable) */ __webpack_exports__["a"] = chunk;
11741/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(6);
11742
11743
11744// Chunk a single array into multiple arrays, each containing `count` or fewer
11745// items.
11746function chunk(array, count) {
11747 if (count == null || count < 1) return [];
11748 var result = [];
11749 var i = 0, length = array.length;
11750 while (i < length) {
11751 result.push(__WEBPACK_IMPORTED_MODULE_0__setup_js__["q" /* slice */].call(array, i, i += count));
11752 }
11753 return result;
11754}
11755
11756
11757/***/ }),
11758/* 391 */
11759/***/ (function(module, __webpack_exports__, __webpack_require__) {
11760
11761"use strict";
11762/* harmony export (immutable) */ __webpack_exports__["a"] = mixin;
11763/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__underscore_js__ = __webpack_require__(25);
11764/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__each_js__ = __webpack_require__(60);
11765/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__functions_js__ = __webpack_require__(192);
11766/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__setup_js__ = __webpack_require__(6);
11767/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__chainResult_js__ = __webpack_require__(226);
11768
11769
11770
11771
11772
11773
11774// Add your own custom functions to the Underscore object.
11775function mixin(obj) {
11776 Object(__WEBPACK_IMPORTED_MODULE_1__each_js__["a" /* default */])(Object(__WEBPACK_IMPORTED_MODULE_2__functions_js__["a" /* default */])(obj), function(name) {
11777 var func = __WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */][name] = obj[name];
11778 __WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */].prototype[name] = function() {
11779 var args = [this._wrapped];
11780 __WEBPACK_IMPORTED_MODULE_3__setup_js__["o" /* push */].apply(args, arguments);
11781 return Object(__WEBPACK_IMPORTED_MODULE_4__chainResult_js__["a" /* default */])(this, func.apply(__WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */], args));
11782 };
11783 });
11784 return __WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */];
11785}
11786
11787
11788/***/ }),
11789/* 392 */
11790/***/ (function(module, __webpack_exports__, __webpack_require__) {
11791
11792"use strict";
11793/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__underscore_js__ = __webpack_require__(25);
11794/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__each_js__ = __webpack_require__(60);
11795/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__setup_js__ = __webpack_require__(6);
11796/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__chainResult_js__ = __webpack_require__(226);
11797
11798
11799
11800
11801
11802// Add all mutator `Array` functions to the wrapper.
11803Object(__WEBPACK_IMPORTED_MODULE_1__each_js__["a" /* default */])(['pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift'], function(name) {
11804 var method = __WEBPACK_IMPORTED_MODULE_2__setup_js__["a" /* ArrayProto */][name];
11805 __WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */].prototype[name] = function() {
11806 var obj = this._wrapped;
11807 if (obj != null) {
11808 method.apply(obj, arguments);
11809 if ((name === 'shift' || name === 'splice') && obj.length === 0) {
11810 delete obj[0];
11811 }
11812 }
11813 return Object(__WEBPACK_IMPORTED_MODULE_3__chainResult_js__["a" /* default */])(this, obj);
11814 };
11815});
11816
11817// Add all accessor `Array` functions to the wrapper.
11818Object(__WEBPACK_IMPORTED_MODULE_1__each_js__["a" /* default */])(['concat', 'join', 'slice'], function(name) {
11819 var method = __WEBPACK_IMPORTED_MODULE_2__setup_js__["a" /* ArrayProto */][name];
11820 __WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */].prototype[name] = function() {
11821 var obj = this._wrapped;
11822 if (obj != null) obj = method.apply(obj, arguments);
11823 return Object(__WEBPACK_IMPORTED_MODULE_3__chainResult_js__["a" /* default */])(this, obj);
11824 };
11825});
11826
11827/* harmony default export */ __webpack_exports__["a"] = (__WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */]);
11828
11829
11830/***/ }),
11831/* 393 */
11832/***/ (function(module, exports, __webpack_require__) {
11833
11834var parent = __webpack_require__(394);
11835
11836module.exports = parent;
11837
11838
11839/***/ }),
11840/* 394 */
11841/***/ (function(module, exports, __webpack_require__) {
11842
11843var isPrototypeOf = __webpack_require__(16);
11844var method = __webpack_require__(395);
11845
11846var ArrayPrototype = Array.prototype;
11847
11848module.exports = function (it) {
11849 var own = it.concat;
11850 return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.concat) ? method : own;
11851};
11852
11853
11854/***/ }),
11855/* 395 */
11856/***/ (function(module, exports, __webpack_require__) {
11857
11858__webpack_require__(227);
11859var entryVirtual = __webpack_require__(27);
11860
11861module.exports = entryVirtual('Array').concat;
11862
11863
11864/***/ }),
11865/* 396 */
11866/***/ (function(module, exports) {
11867
11868var $TypeError = TypeError;
11869var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF; // 2 ** 53 - 1 == 9007199254740991
11870
11871module.exports = function (it) {
11872 if (it > MAX_SAFE_INTEGER) throw $TypeError('Maximum allowed index exceeded');
11873 return it;
11874};
11875
11876
11877/***/ }),
11878/* 397 */
11879/***/ (function(module, exports, __webpack_require__) {
11880
11881var isArray = __webpack_require__(92);
11882var isConstructor = __webpack_require__(111);
11883var isObject = __webpack_require__(11);
11884var wellKnownSymbol = __webpack_require__(5);
11885
11886var SPECIES = wellKnownSymbol('species');
11887var $Array = Array;
11888
11889// a part of `ArraySpeciesCreate` abstract operation
11890// https://tc39.es/ecma262/#sec-arrayspeciescreate
11891module.exports = function (originalArray) {
11892 var C;
11893 if (isArray(originalArray)) {
11894 C = originalArray.constructor;
11895 // cross-realm fallback
11896 if (isConstructor(C) && (C === $Array || isArray(C.prototype))) C = undefined;
11897 else if (isObject(C)) {
11898 C = C[SPECIES];
11899 if (C === null) C = undefined;
11900 }
11901 } return C === undefined ? $Array : C;
11902};
11903
11904
11905/***/ }),
11906/* 398 */
11907/***/ (function(module, exports, __webpack_require__) {
11908
11909var parent = __webpack_require__(399);
11910
11911module.exports = parent;
11912
11913
11914/***/ }),
11915/* 399 */
11916/***/ (function(module, exports, __webpack_require__) {
11917
11918var isPrototypeOf = __webpack_require__(16);
11919var method = __webpack_require__(400);
11920
11921var ArrayPrototype = Array.prototype;
11922
11923module.exports = function (it) {
11924 var own = it.map;
11925 return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.map) ? method : own;
11926};
11927
11928
11929/***/ }),
11930/* 400 */
11931/***/ (function(module, exports, __webpack_require__) {
11932
11933__webpack_require__(401);
11934var entryVirtual = __webpack_require__(27);
11935
11936module.exports = entryVirtual('Array').map;
11937
11938
11939/***/ }),
11940/* 401 */
11941/***/ (function(module, exports, __webpack_require__) {
11942
11943"use strict";
11944
11945var $ = __webpack_require__(0);
11946var $map = __webpack_require__(75).map;
11947var arrayMethodHasSpeciesSupport = __webpack_require__(116);
11948
11949var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('map');
11950
11951// `Array.prototype.map` method
11952// https://tc39.es/ecma262/#sec-array.prototype.map
11953// with adding support of @@species
11954$({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT }, {
11955 map: function map(callbackfn /* , thisArg */) {
11956 return $map(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
11957 }
11958});
11959
11960
11961/***/ }),
11962/* 402 */
11963/***/ (function(module, exports, __webpack_require__) {
11964
11965var parent = __webpack_require__(403);
11966
11967module.exports = parent;
11968
11969
11970/***/ }),
11971/* 403 */
11972/***/ (function(module, exports, __webpack_require__) {
11973
11974__webpack_require__(404);
11975var path = __webpack_require__(7);
11976
11977module.exports = path.Object.keys;
11978
11979
11980/***/ }),
11981/* 404 */
11982/***/ (function(module, exports, __webpack_require__) {
11983
11984var $ = __webpack_require__(0);
11985var toObject = __webpack_require__(33);
11986var nativeKeys = __webpack_require__(107);
11987var fails = __webpack_require__(2);
11988
11989var FAILS_ON_PRIMITIVES = fails(function () { nativeKeys(1); });
11990
11991// `Object.keys` method
11992// https://tc39.es/ecma262/#sec-object.keys
11993$({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES }, {
11994 keys: function keys(it) {
11995 return nativeKeys(toObject(it));
11996 }
11997});
11998
11999
12000/***/ }),
12001/* 405 */
12002/***/ (function(module, exports, __webpack_require__) {
12003
12004var parent = __webpack_require__(406);
12005
12006module.exports = parent;
12007
12008
12009/***/ }),
12010/* 406 */
12011/***/ (function(module, exports, __webpack_require__) {
12012
12013__webpack_require__(229);
12014var path = __webpack_require__(7);
12015var apply = __webpack_require__(79);
12016
12017// eslint-disable-next-line es-x/no-json -- safe
12018if (!path.JSON) path.JSON = { stringify: JSON.stringify };
12019
12020// eslint-disable-next-line no-unused-vars -- required for `.length`
12021module.exports = function stringify(it, replacer, space) {
12022 return apply(path.JSON.stringify, null, arguments);
12023};
12024
12025
12026/***/ }),
12027/* 407 */
12028/***/ (function(module, exports, __webpack_require__) {
12029
12030var parent = __webpack_require__(408);
12031
12032module.exports = parent;
12033
12034
12035/***/ }),
12036/* 408 */
12037/***/ (function(module, exports, __webpack_require__) {
12038
12039var isPrototypeOf = __webpack_require__(16);
12040var method = __webpack_require__(409);
12041
12042var ArrayPrototype = Array.prototype;
12043
12044module.exports = function (it) {
12045 var own = it.indexOf;
12046 return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.indexOf) ? method : own;
12047};
12048
12049
12050/***/ }),
12051/* 409 */
12052/***/ (function(module, exports, __webpack_require__) {
12053
12054__webpack_require__(410);
12055var entryVirtual = __webpack_require__(27);
12056
12057module.exports = entryVirtual('Array').indexOf;
12058
12059
12060/***/ }),
12061/* 410 */
12062/***/ (function(module, exports, __webpack_require__) {
12063
12064"use strict";
12065
12066/* eslint-disable es-x/no-array-prototype-indexof -- required for testing */
12067var $ = __webpack_require__(0);
12068var uncurryThis = __webpack_require__(4);
12069var $IndexOf = __webpack_require__(125).indexOf;
12070var arrayMethodIsStrict = __webpack_require__(150);
12071
12072var un$IndexOf = uncurryThis([].indexOf);
12073
12074var NEGATIVE_ZERO = !!un$IndexOf && 1 / un$IndexOf([1], 1, -0) < 0;
12075var STRICT_METHOD = arrayMethodIsStrict('indexOf');
12076
12077// `Array.prototype.indexOf` method
12078// https://tc39.es/ecma262/#sec-array.prototype.indexof
12079$({ target: 'Array', proto: true, forced: NEGATIVE_ZERO || !STRICT_METHOD }, {
12080 indexOf: function indexOf(searchElement /* , fromIndex = 0 */) {
12081 var fromIndex = arguments.length > 1 ? arguments[1] : undefined;
12082 return NEGATIVE_ZERO
12083 // convert -0 to +0
12084 ? un$IndexOf(this, searchElement, fromIndex) || 0
12085 : $IndexOf(this, searchElement, fromIndex);
12086 }
12087});
12088
12089
12090/***/ }),
12091/* 411 */
12092/***/ (function(module, exports, __webpack_require__) {
12093
12094__webpack_require__(46);
12095var classof = __webpack_require__(55);
12096var hasOwn = __webpack_require__(13);
12097var isPrototypeOf = __webpack_require__(16);
12098var method = __webpack_require__(412);
12099
12100var ArrayPrototype = Array.prototype;
12101
12102var DOMIterables = {
12103 DOMTokenList: true,
12104 NodeList: true
12105};
12106
12107module.exports = function (it) {
12108 var own = it.keys;
12109 return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.keys)
12110 || hasOwn(DOMIterables, classof(it)) ? method : own;
12111};
12112
12113
12114/***/ }),
12115/* 412 */
12116/***/ (function(module, exports, __webpack_require__) {
12117
12118var parent = __webpack_require__(413);
12119
12120module.exports = parent;
12121
12122
12123/***/ }),
12124/* 413 */
12125/***/ (function(module, exports, __webpack_require__) {
12126
12127__webpack_require__(43);
12128__webpack_require__(68);
12129var entryVirtual = __webpack_require__(27);
12130
12131module.exports = entryVirtual('Array').keys;
12132
12133
12134/***/ }),
12135/* 414 */
12136/***/ (function(module, exports) {
12137
12138// Unique ID creation requires a high quality random # generator. In the
12139// browser this is a little complicated due to unknown quality of Math.random()
12140// and inconsistent support for the `crypto` API. We do the best we can via
12141// feature-detection
12142
12143// getRandomValues needs to be invoked in a context where "this" is a Crypto
12144// implementation. Also, find the complete implementation of crypto on IE11.
12145var getRandomValues = (typeof(crypto) != 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto)) ||
12146 (typeof(msCrypto) != 'undefined' && typeof window.msCrypto.getRandomValues == 'function' && msCrypto.getRandomValues.bind(msCrypto));
12147
12148if (getRandomValues) {
12149 // WHATWG crypto RNG - http://wiki.whatwg.org/wiki/Crypto
12150 var rnds8 = new Uint8Array(16); // eslint-disable-line no-undef
12151
12152 module.exports = function whatwgRNG() {
12153 getRandomValues(rnds8);
12154 return rnds8;
12155 };
12156} else {
12157 // Math.random()-based (RNG)
12158 //
12159 // If all else fails, use Math.random(). It's fast, but is of unspecified
12160 // quality.
12161 var rnds = new Array(16);
12162
12163 module.exports = function mathRNG() {
12164 for (var i = 0, r; i < 16; i++) {
12165 if ((i & 0x03) === 0) r = Math.random() * 0x100000000;
12166 rnds[i] = r >>> ((i & 0x03) << 3) & 0xff;
12167 }
12168
12169 return rnds;
12170 };
12171}
12172
12173
12174/***/ }),
12175/* 415 */
12176/***/ (function(module, exports) {
12177
12178/**
12179 * Convert array of 16 byte values to UUID string format of the form:
12180 * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
12181 */
12182var byteToHex = [];
12183for (var i = 0; i < 256; ++i) {
12184 byteToHex[i] = (i + 0x100).toString(16).substr(1);
12185}
12186
12187function bytesToUuid(buf, offset) {
12188 var i = offset || 0;
12189 var bth = byteToHex;
12190 // join used to fix memory issue caused by concatenation: https://bugs.chromium.org/p/v8/issues/detail?id=3175#c4
12191 return ([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++]], '-',
12195 bth[buf[i++]], bth[buf[i++]], '-',
12196 bth[buf[i++]], bth[buf[i++]],
12197 bth[buf[i++]], bth[buf[i++]],
12198 bth[buf[i++]], bth[buf[i++]]]).join('');
12199}
12200
12201module.exports = bytesToUuid;
12202
12203
12204/***/ }),
12205/* 416 */
12206/***/ (function(module, exports, __webpack_require__) {
12207
12208"use strict";
12209
12210
12211/**
12212 * This is the common logic for both the Node.js and web browser
12213 * implementations of `debug()`.
12214 */
12215function setup(env) {
12216 createDebug.debug = createDebug;
12217 createDebug.default = createDebug;
12218 createDebug.coerce = coerce;
12219 createDebug.disable = disable;
12220 createDebug.enable = enable;
12221 createDebug.enabled = enabled;
12222 createDebug.humanize = __webpack_require__(417);
12223 Object.keys(env).forEach(function (key) {
12224 createDebug[key] = env[key];
12225 });
12226 /**
12227 * Active `debug` instances.
12228 */
12229
12230 createDebug.instances = [];
12231 /**
12232 * The currently active debug mode names, and names to skip.
12233 */
12234
12235 createDebug.names = [];
12236 createDebug.skips = [];
12237 /**
12238 * Map of special "%n" handling functions, for the debug "format" argument.
12239 *
12240 * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N".
12241 */
12242
12243 createDebug.formatters = {};
12244 /**
12245 * Selects a color for a debug namespace
12246 * @param {String} namespace The namespace string for the for the debug instance to be colored
12247 * @return {Number|String} An ANSI color code for the given namespace
12248 * @api private
12249 */
12250
12251 function selectColor(namespace) {
12252 var hash = 0;
12253
12254 for (var i = 0; i < namespace.length; i++) {
12255 hash = (hash << 5) - hash + namespace.charCodeAt(i);
12256 hash |= 0; // Convert to 32bit integer
12257 }
12258
12259 return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
12260 }
12261
12262 createDebug.selectColor = selectColor;
12263 /**
12264 * Create a debugger with the given `namespace`.
12265 *
12266 * @param {String} namespace
12267 * @return {Function}
12268 * @api public
12269 */
12270
12271 function createDebug(namespace) {
12272 var prevTime;
12273
12274 function debug() {
12275 // Disabled?
12276 if (!debug.enabled) {
12277 return;
12278 }
12279
12280 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
12281 args[_key] = arguments[_key];
12282 }
12283
12284 var self = debug; // Set `diff` timestamp
12285
12286 var curr = Number(new Date());
12287 var ms = curr - (prevTime || curr);
12288 self.diff = ms;
12289 self.prev = prevTime;
12290 self.curr = curr;
12291 prevTime = curr;
12292 args[0] = createDebug.coerce(args[0]);
12293
12294 if (typeof args[0] !== 'string') {
12295 // Anything else let's inspect with %O
12296 args.unshift('%O');
12297 } // Apply any `formatters` transformations
12298
12299
12300 var index = 0;
12301 args[0] = args[0].replace(/%([a-zA-Z%])/g, function (match, format) {
12302 // If we encounter an escaped % then don't increase the array index
12303 if (match === '%%') {
12304 return match;
12305 }
12306
12307 index++;
12308 var formatter = createDebug.formatters[format];
12309
12310 if (typeof formatter === 'function') {
12311 var val = args[index];
12312 match = formatter.call(self, val); // Now we need to remove `args[index]` since it's inlined in the `format`
12313
12314 args.splice(index, 1);
12315 index--;
12316 }
12317
12318 return match;
12319 }); // Apply env-specific formatting (colors, etc.)
12320
12321 createDebug.formatArgs.call(self, args);
12322 var logFn = self.log || createDebug.log;
12323 logFn.apply(self, args);
12324 }
12325
12326 debug.namespace = namespace;
12327 debug.enabled = createDebug.enabled(namespace);
12328 debug.useColors = createDebug.useColors();
12329 debug.color = selectColor(namespace);
12330 debug.destroy = destroy;
12331 debug.extend = extend; // Debug.formatArgs = formatArgs;
12332 // debug.rawLog = rawLog;
12333 // env-specific initialization logic for debug instances
12334
12335 if (typeof createDebug.init === 'function') {
12336 createDebug.init(debug);
12337 }
12338
12339 createDebug.instances.push(debug);
12340 return debug;
12341 }
12342
12343 function destroy() {
12344 var index = createDebug.instances.indexOf(this);
12345
12346 if (index !== -1) {
12347 createDebug.instances.splice(index, 1);
12348 return true;
12349 }
12350
12351 return false;
12352 }
12353
12354 function extend(namespace, delimiter) {
12355 return createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace);
12356 }
12357 /**
12358 * Enables a debug mode by namespaces. This can include modes
12359 * separated by a colon and wildcards.
12360 *
12361 * @param {String} namespaces
12362 * @api public
12363 */
12364
12365
12366 function enable(namespaces) {
12367 createDebug.save(namespaces);
12368 createDebug.names = [];
12369 createDebug.skips = [];
12370 var i;
12371 var split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/);
12372 var len = split.length;
12373
12374 for (i = 0; i < len; i++) {
12375 if (!split[i]) {
12376 // ignore empty strings
12377 continue;
12378 }
12379
12380 namespaces = split[i].replace(/\*/g, '.*?');
12381
12382 if (namespaces[0] === '-') {
12383 createDebug.skips.push(new RegExp('^' + namespaces.substr(1) + '$'));
12384 } else {
12385 createDebug.names.push(new RegExp('^' + namespaces + '$'));
12386 }
12387 }
12388
12389 for (i = 0; i < createDebug.instances.length; i++) {
12390 var instance = createDebug.instances[i];
12391 instance.enabled = createDebug.enabled(instance.namespace);
12392 }
12393 }
12394 /**
12395 * Disable debug output.
12396 *
12397 * @api public
12398 */
12399
12400
12401 function disable() {
12402 createDebug.enable('');
12403 }
12404 /**
12405 * Returns true if the given mode name is enabled, false otherwise.
12406 *
12407 * @param {String} name
12408 * @return {Boolean}
12409 * @api public
12410 */
12411
12412
12413 function enabled(name) {
12414 if (name[name.length - 1] === '*') {
12415 return true;
12416 }
12417
12418 var i;
12419 var len;
12420
12421 for (i = 0, len = createDebug.skips.length; i < len; i++) {
12422 if (createDebug.skips[i].test(name)) {
12423 return false;
12424 }
12425 }
12426
12427 for (i = 0, len = createDebug.names.length; i < len; i++) {
12428 if (createDebug.names[i].test(name)) {
12429 return true;
12430 }
12431 }
12432
12433 return false;
12434 }
12435 /**
12436 * Coerce `val`.
12437 *
12438 * @param {Mixed} val
12439 * @return {Mixed}
12440 * @api private
12441 */
12442
12443
12444 function coerce(val) {
12445 if (val instanceof Error) {
12446 return val.stack || val.message;
12447 }
12448
12449 return val;
12450 }
12451
12452 createDebug.enable(createDebug.load());
12453 return createDebug;
12454}
12455
12456module.exports = setup;
12457
12458
12459
12460/***/ }),
12461/* 417 */
12462/***/ (function(module, exports) {
12463
12464/**
12465 * Helpers.
12466 */
12467
12468var s = 1000;
12469var m = s * 60;
12470var h = m * 60;
12471var d = h * 24;
12472var w = d * 7;
12473var y = d * 365.25;
12474
12475/**
12476 * Parse or format the given `val`.
12477 *
12478 * Options:
12479 *
12480 * - `long` verbose formatting [false]
12481 *
12482 * @param {String|Number} val
12483 * @param {Object} [options]
12484 * @throws {Error} throw an error if val is not a non-empty string or a number
12485 * @return {String|Number}
12486 * @api public
12487 */
12488
12489module.exports = function(val, options) {
12490 options = options || {};
12491 var type = typeof val;
12492 if (type === 'string' && val.length > 0) {
12493 return parse(val);
12494 } else if (type === 'number' && isFinite(val)) {
12495 return options.long ? fmtLong(val) : fmtShort(val);
12496 }
12497 throw new Error(
12498 'val is not a non-empty string or a valid number. val=' +
12499 JSON.stringify(val)
12500 );
12501};
12502
12503/**
12504 * Parse the given `str` and return milliseconds.
12505 *
12506 * @param {String} str
12507 * @return {Number}
12508 * @api private
12509 */
12510
12511function parse(str) {
12512 str = String(str);
12513 if (str.length > 100) {
12514 return;
12515 }
12516 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(
12517 str
12518 );
12519 if (!match) {
12520 return;
12521 }
12522 var n = parseFloat(match[1]);
12523 var type = (match[2] || 'ms').toLowerCase();
12524 switch (type) {
12525 case 'years':
12526 case 'year':
12527 case 'yrs':
12528 case 'yr':
12529 case 'y':
12530 return n * y;
12531 case 'weeks':
12532 case 'week':
12533 case 'w':
12534 return n * w;
12535 case 'days':
12536 case 'day':
12537 case 'd':
12538 return n * d;
12539 case 'hours':
12540 case 'hour':
12541 case 'hrs':
12542 case 'hr':
12543 case 'h':
12544 return n * h;
12545 case 'minutes':
12546 case 'minute':
12547 case 'mins':
12548 case 'min':
12549 case 'm':
12550 return n * m;
12551 case 'seconds':
12552 case 'second':
12553 case 'secs':
12554 case 'sec':
12555 case 's':
12556 return n * s;
12557 case 'milliseconds':
12558 case 'millisecond':
12559 case 'msecs':
12560 case 'msec':
12561 case 'ms':
12562 return n;
12563 default:
12564 return undefined;
12565 }
12566}
12567
12568/**
12569 * Short format for `ms`.
12570 *
12571 * @param {Number} ms
12572 * @return {String}
12573 * @api private
12574 */
12575
12576function fmtShort(ms) {
12577 var msAbs = Math.abs(ms);
12578 if (msAbs >= d) {
12579 return Math.round(ms / d) + 'd';
12580 }
12581 if (msAbs >= h) {
12582 return Math.round(ms / h) + 'h';
12583 }
12584 if (msAbs >= m) {
12585 return Math.round(ms / m) + 'm';
12586 }
12587 if (msAbs >= s) {
12588 return Math.round(ms / s) + 's';
12589 }
12590 return ms + 'ms';
12591}
12592
12593/**
12594 * Long format for `ms`.
12595 *
12596 * @param {Number} ms
12597 * @return {String}
12598 * @api private
12599 */
12600
12601function fmtLong(ms) {
12602 var msAbs = Math.abs(ms);
12603 if (msAbs >= d) {
12604 return plural(ms, msAbs, d, 'day');
12605 }
12606 if (msAbs >= h) {
12607 return plural(ms, msAbs, h, 'hour');
12608 }
12609 if (msAbs >= m) {
12610 return plural(ms, msAbs, m, 'minute');
12611 }
12612 if (msAbs >= s) {
12613 return plural(ms, msAbs, s, 'second');
12614 }
12615 return ms + ' ms';
12616}
12617
12618/**
12619 * Pluralization helper.
12620 */
12621
12622function plural(ms, msAbs, n, name) {
12623 var isPlural = msAbs >= n * 1.5;
12624 return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');
12625}
12626
12627
12628/***/ }),
12629/* 418 */
12630/***/ (function(module, exports, __webpack_require__) {
12631
12632__webpack_require__(419);
12633var path = __webpack_require__(7);
12634
12635module.exports = path.Object.getPrototypeOf;
12636
12637
12638/***/ }),
12639/* 419 */
12640/***/ (function(module, exports, __webpack_require__) {
12641
12642var $ = __webpack_require__(0);
12643var fails = __webpack_require__(2);
12644var toObject = __webpack_require__(33);
12645var nativeGetPrototypeOf = __webpack_require__(102);
12646var CORRECT_PROTOTYPE_GETTER = __webpack_require__(161);
12647
12648var FAILS_ON_PRIMITIVES = fails(function () { nativeGetPrototypeOf(1); });
12649
12650// `Object.getPrototypeOf` method
12651// https://tc39.es/ecma262/#sec-object.getprototypeof
12652$({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES, sham: !CORRECT_PROTOTYPE_GETTER }, {
12653 getPrototypeOf: function getPrototypeOf(it) {
12654 return nativeGetPrototypeOf(toObject(it));
12655 }
12656});
12657
12658
12659
12660/***/ }),
12661/* 420 */
12662/***/ (function(module, exports, __webpack_require__) {
12663
12664module.exports = __webpack_require__(237);
12665
12666/***/ }),
12667/* 421 */
12668/***/ (function(module, exports, __webpack_require__) {
12669
12670__webpack_require__(422);
12671var path = __webpack_require__(7);
12672
12673module.exports = path.Object.setPrototypeOf;
12674
12675
12676/***/ }),
12677/* 422 */
12678/***/ (function(module, exports, __webpack_require__) {
12679
12680var $ = __webpack_require__(0);
12681var setPrototypeOf = __webpack_require__(104);
12682
12683// `Object.setPrototypeOf` method
12684// https://tc39.es/ecma262/#sec-object.setprototypeof
12685$({ target: 'Object', stat: true }, {
12686 setPrototypeOf: setPrototypeOf
12687});
12688
12689
12690/***/ }),
12691/* 423 */
12692/***/ (function(module, exports, __webpack_require__) {
12693
12694"use strict";
12695
12696
12697var _interopRequireDefault = __webpack_require__(1);
12698
12699var _slice = _interopRequireDefault(__webpack_require__(34));
12700
12701var _concat = _interopRequireDefault(__webpack_require__(19));
12702
12703var _defineProperty = _interopRequireDefault(__webpack_require__(94));
12704
12705var AV = __webpack_require__(74);
12706
12707var AppRouter = __webpack_require__(429);
12708
12709var _require = __webpack_require__(32),
12710 isNullOrUndefined = _require.isNullOrUndefined;
12711
12712var _require2 = __webpack_require__(3),
12713 extend = _require2.extend,
12714 isObject = _require2.isObject,
12715 isEmpty = _require2.isEmpty;
12716
12717var isCNApp = function isCNApp(appId) {
12718 return (0, _slice.default)(appId).call(appId, -9) !== '-MdYXbMMI';
12719};
12720
12721var fillServerURLs = function fillServerURLs(url) {
12722 return {
12723 push: url,
12724 stats: url,
12725 engine: url,
12726 api: url,
12727 rtm: url
12728 };
12729};
12730
12731function getDefaultServerURLs(appId) {
12732 var _context, _context2, _context3, _context4, _context5;
12733
12734 if (isCNApp(appId)) {
12735 return {};
12736 }
12737
12738 var id = (0, _slice.default)(appId).call(appId, 0, 8).toLowerCase();
12739 var domain = 'lncldglobal.com';
12740 return {
12741 push: (0, _concat.default)(_context = "https://".concat(id, ".push.")).call(_context, domain),
12742 stats: (0, _concat.default)(_context2 = "https://".concat(id, ".stats.")).call(_context2, domain),
12743 engine: (0, _concat.default)(_context3 = "https://".concat(id, ".engine.")).call(_context3, domain),
12744 api: (0, _concat.default)(_context4 = "https://".concat(id, ".api.")).call(_context4, domain),
12745 rtm: (0, _concat.default)(_context5 = "https://".concat(id, ".rtm.")).call(_context5, domain)
12746 };
12747}
12748
12749var _disableAppRouter = false;
12750var _initialized = false;
12751/**
12752 * URLs for services
12753 * @typedef {Object} ServerURLs
12754 * @property {String} [api] serverURL for API service
12755 * @property {String} [engine] serverURL for engine service
12756 * @property {String} [stats] serverURL for stats service
12757 * @property {String} [push] serverURL for push service
12758 * @property {String} [rtm] serverURL for LiveQuery service
12759 */
12760
12761/**
12762 * Call this method first to set up your authentication tokens for AV.
12763 * You can get your app keys from the LeanCloud dashboard on http://leancloud.cn .
12764 * @function AV.init
12765 * @param {Object} options
12766 * @param {String} options.appId application id
12767 * @param {String} options.appKey application key
12768 * @param {String} [options.masterKey] application master key
12769 * @param {Boolean} [options.production]
12770 * @param {String|ServerURLs} [options.serverURL] URLs for services. if a string was given, it will be applied for all services.
12771 * @param {Boolean} [options.disableCurrentUser]
12772 */
12773
12774AV.init = function init(options) {
12775 if (!isObject(options)) {
12776 return AV.init({
12777 appId: options,
12778 appKey: arguments.length <= 1 ? undefined : arguments[1],
12779 masterKey: arguments.length <= 2 ? undefined : arguments[2]
12780 });
12781 }
12782
12783 var appId = options.appId,
12784 appKey = options.appKey,
12785 masterKey = options.masterKey,
12786 hookKey = options.hookKey,
12787 serverURL = options.serverURL,
12788 _options$serverURLs = options.serverURLs,
12789 serverURLs = _options$serverURLs === void 0 ? serverURL : _options$serverURLs,
12790 disableCurrentUser = options.disableCurrentUser,
12791 production = options.production,
12792 realtime = options.realtime;
12793 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.');
12794 if (!appId) throw new TypeError('appId must be a string');
12795 if (!appKey) throw new TypeError('appKey must be a string');
12796 if ("Browser" !== 'NODE_JS' && masterKey) console.warn('MasterKey is not supposed to be used at client side.');
12797
12798 if (isCNApp(appId)) {
12799 if (!serverURLs && isEmpty(AV._config.serverURLs)) {
12800 throw new TypeError("serverURL option is required for apps from CN region");
12801 }
12802 }
12803
12804 if (appId !== AV._config.applicationId) {
12805 // overwrite all keys when reinitializing as a new app
12806 AV._config.masterKey = masterKey;
12807 AV._config.hookKey = hookKey;
12808 } else {
12809 if (masterKey) AV._config.masterKey = masterKey;
12810 if (hookKey) AV._config.hookKey = hookKey;
12811 }
12812
12813 AV._config.applicationId = appId;
12814 AV._config.applicationKey = appKey;
12815
12816 if (!isNullOrUndefined(production)) {
12817 AV.setProduction(production);
12818 }
12819
12820 if (typeof disableCurrentUser !== 'undefined') AV._config.disableCurrentUser = disableCurrentUser;
12821 var disableAppRouter = _disableAppRouter || typeof serverURLs !== 'undefined';
12822
12823 if (!disableAppRouter) {
12824 AV._appRouter = new AppRouter(AV);
12825 }
12826
12827 AV._setServerURLs(extend({}, getDefaultServerURLs(appId), AV._config.serverURLs, typeof serverURLs === 'string' ? fillServerURLs(serverURLs) : serverURLs), disableAppRouter);
12828
12829 if (realtime) {
12830 AV._config.realtime = realtime;
12831 } else if (AV._sharedConfig.liveQueryRealtime) {
12832 var _AV$_config$serverURL = AV._config.serverURLs,
12833 api = _AV$_config$serverURL.api,
12834 rtm = _AV$_config$serverURL.rtm;
12835 AV._config.realtime = new AV._sharedConfig.liveQueryRealtime({
12836 appId: appId,
12837 appKey: appKey,
12838 server: {
12839 api: api,
12840 RTMRouter: rtm
12841 }
12842 });
12843 }
12844
12845 _initialized = true;
12846}; // If we're running in node.js, allow using the master key.
12847
12848
12849if (false) {
12850 AV.Cloud = AV.Cloud || {};
12851 /**
12852 * Switches the LeanCloud SDK to using the Master key. The Master key grants
12853 * priveleged access to the data in LeanCloud and can be used to bypass ACLs and
12854 * other restrictions that are applied to the client SDKs.
12855 * <p><strong><em>Available in Cloud Code and Node.js only.</em></strong>
12856 * </p>
12857 */
12858
12859 AV.Cloud.useMasterKey = function () {
12860 AV._config.useMasterKey = true;
12861 };
12862}
12863/**
12864 * Call this method to set production environment variable.
12865 * @function AV.setProduction
12866 * @param {Boolean} production True is production environment,and
12867 * it's true by default.
12868 */
12869
12870
12871AV.setProduction = function (production) {
12872 if (!isNullOrUndefined(production)) {
12873 AV._config.production = production ? 1 : 0;
12874 } else {
12875 // change to default value
12876 AV._config.production = null;
12877 }
12878};
12879
12880AV._setServerURLs = function (urls) {
12881 var disableAppRouter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
12882
12883 if (typeof urls !== 'string') {
12884 extend(AV._config.serverURLs, urls);
12885 } else {
12886 AV._config.serverURLs = fillServerURLs(urls);
12887 }
12888
12889 if (disableAppRouter) {
12890 if (AV._appRouter) {
12891 AV._appRouter.disable();
12892 } else {
12893 _disableAppRouter = true;
12894 }
12895 }
12896};
12897/**
12898 * Set server URLs for services.
12899 * @function AV.setServerURL
12900 * @since 4.3.0
12901 * @param {String|ServerURLs} urls URLs for services. if a string was given, it will be applied for all services.
12902 * You can also set them when initializing SDK with `options.serverURL`
12903 */
12904
12905
12906AV.setServerURL = function (urls) {
12907 return AV._setServerURLs(urls);
12908};
12909
12910AV.setServerURLs = AV.setServerURL;
12911
12912AV.keepErrorRawMessage = function (value) {
12913 AV._sharedConfig.keepErrorRawMessage = value;
12914};
12915/**
12916 * Set a deadline for requests to complete.
12917 * Note that file upload requests are not affected.
12918 * @function AV.setRequestTimeout
12919 * @since 3.6.0
12920 * @param {number} ms
12921 */
12922
12923
12924AV.setRequestTimeout = function (ms) {
12925 AV._config.requestTimeout = ms;
12926}; // backword compatible
12927
12928
12929AV.initialize = AV.init;
12930
12931var defineConfig = function defineConfig(property) {
12932 return (0, _defineProperty.default)(AV, property, {
12933 get: function get() {
12934 return AV._config[property];
12935 },
12936 set: function set(value) {
12937 AV._config[property] = value;
12938 }
12939 });
12940};
12941
12942['applicationId', 'applicationKey', 'masterKey', 'hookKey'].forEach(defineConfig);
12943
12944/***/ }),
12945/* 424 */
12946/***/ (function(module, exports, __webpack_require__) {
12947
12948var isPrototypeOf = __webpack_require__(16);
12949var method = __webpack_require__(425);
12950
12951var ArrayPrototype = Array.prototype;
12952
12953module.exports = function (it) {
12954 var own = it.slice;
12955 return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.slice) ? method : own;
12956};
12957
12958
12959/***/ }),
12960/* 425 */
12961/***/ (function(module, exports, __webpack_require__) {
12962
12963__webpack_require__(426);
12964var entryVirtual = __webpack_require__(27);
12965
12966module.exports = entryVirtual('Array').slice;
12967
12968
12969/***/ }),
12970/* 426 */
12971/***/ (function(module, exports, __webpack_require__) {
12972
12973"use strict";
12974
12975var $ = __webpack_require__(0);
12976var isArray = __webpack_require__(92);
12977var isConstructor = __webpack_require__(111);
12978var isObject = __webpack_require__(11);
12979var toAbsoluteIndex = __webpack_require__(126);
12980var lengthOfArrayLike = __webpack_require__(40);
12981var toIndexedObject = __webpack_require__(35);
12982var createProperty = __webpack_require__(93);
12983var wellKnownSymbol = __webpack_require__(5);
12984var arrayMethodHasSpeciesSupport = __webpack_require__(116);
12985var un$Slice = __webpack_require__(112);
12986
12987var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('slice');
12988
12989var SPECIES = wellKnownSymbol('species');
12990var $Array = Array;
12991var max = Math.max;
12992
12993// `Array.prototype.slice` method
12994// https://tc39.es/ecma262/#sec-array.prototype.slice
12995// fallback for not array-like ES3 strings and DOM objects
12996$({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT }, {
12997 slice: function slice(start, end) {
12998 var O = toIndexedObject(this);
12999 var length = lengthOfArrayLike(O);
13000 var k = toAbsoluteIndex(start, length);
13001 var fin = toAbsoluteIndex(end === undefined ? length : end, length);
13002 // inline `ArraySpeciesCreate` for usage native `Array#slice` where it's possible
13003 var Constructor, result, n;
13004 if (isArray(O)) {
13005 Constructor = O.constructor;
13006 // cross-realm fallback
13007 if (isConstructor(Constructor) && (Constructor === $Array || isArray(Constructor.prototype))) {
13008 Constructor = undefined;
13009 } else if (isObject(Constructor)) {
13010 Constructor = Constructor[SPECIES];
13011 if (Constructor === null) Constructor = undefined;
13012 }
13013 if (Constructor === $Array || Constructor === undefined) {
13014 return un$Slice(O, k, fin);
13015 }
13016 }
13017 result = new (Constructor === undefined ? $Array : Constructor)(max(fin - k, 0));
13018 for (n = 0; k < fin; k++, n++) if (k in O) createProperty(result, n, O[k]);
13019 result.length = n;
13020 return result;
13021 }
13022});
13023
13024
13025/***/ }),
13026/* 427 */
13027/***/ (function(module, exports, __webpack_require__) {
13028
13029__webpack_require__(428);
13030var path = __webpack_require__(7);
13031
13032var Object = path.Object;
13033
13034var defineProperty = module.exports = function defineProperty(it, key, desc) {
13035 return Object.defineProperty(it, key, desc);
13036};
13037
13038if (Object.defineProperty.sham) defineProperty.sham = true;
13039
13040
13041/***/ }),
13042/* 428 */
13043/***/ (function(module, exports, __webpack_require__) {
13044
13045var $ = __webpack_require__(0);
13046var DESCRIPTORS = __webpack_require__(14);
13047var defineProperty = __webpack_require__(23).f;
13048
13049// `Object.defineProperty` method
13050// https://tc39.es/ecma262/#sec-object.defineproperty
13051// eslint-disable-next-line es-x/no-object-defineproperty -- safe
13052$({ target: 'Object', stat: true, forced: Object.defineProperty !== defineProperty, sham: !DESCRIPTORS }, {
13053 defineProperty: defineProperty
13054});
13055
13056
13057/***/ }),
13058/* 429 */
13059/***/ (function(module, exports, __webpack_require__) {
13060
13061"use strict";
13062
13063
13064var ajax = __webpack_require__(117);
13065
13066var Cache = __webpack_require__(236);
13067
13068function AppRouter(AV) {
13069 var _this = this;
13070
13071 this.AV = AV;
13072 this.lockedUntil = 0;
13073 Cache.getAsync('serverURLs').then(function (data) {
13074 if (_this.disabled) return;
13075 if (!data) return _this.lock(0);
13076 var serverURLs = data.serverURLs,
13077 lockedUntil = data.lockedUntil;
13078
13079 _this.AV._setServerURLs(serverURLs, false);
13080
13081 _this.lockedUntil = lockedUntil;
13082 }).catch(function () {
13083 return _this.lock(0);
13084 });
13085}
13086
13087AppRouter.prototype.disable = function disable() {
13088 this.disabled = true;
13089};
13090
13091AppRouter.prototype.lock = function lock(ttl) {
13092 this.lockedUntil = Date.now() + ttl;
13093};
13094
13095AppRouter.prototype.refresh = function refresh() {
13096 var _this2 = this;
13097
13098 if (this.disabled) return;
13099 if (Date.now() < this.lockedUntil) return;
13100 this.lock(10);
13101 var url = 'https://app-router.com/2/route';
13102 return ajax({
13103 method: 'get',
13104 url: url,
13105 query: {
13106 appId: this.AV.applicationId
13107 }
13108 }).then(function (servers) {
13109 if (_this2.disabled) return;
13110 var ttl = servers.ttl;
13111 if (!ttl) throw new Error('missing ttl');
13112 ttl = ttl * 1000;
13113 var protocal = 'https://';
13114 var serverURLs = {
13115 push: protocal + servers.push_server,
13116 stats: protocal + servers.stats_server,
13117 engine: protocal + servers.engine_server,
13118 api: protocal + servers.api_server
13119 };
13120
13121 _this2.AV._setServerURLs(serverURLs, false);
13122
13123 _this2.lock(ttl);
13124
13125 return Cache.setAsync('serverURLs', {
13126 serverURLs: serverURLs,
13127 lockedUntil: _this2.lockedUntil
13128 }, ttl);
13129 }).catch(function (error) {
13130 // bypass all errors
13131 console.warn("refresh server URLs failed: ".concat(error.message));
13132
13133 _this2.lock(600);
13134 });
13135};
13136
13137module.exports = AppRouter;
13138
13139/***/ }),
13140/* 430 */
13141/***/ (function(module, exports, __webpack_require__) {
13142
13143module.exports = __webpack_require__(431);
13144
13145
13146/***/ }),
13147/* 431 */
13148/***/ (function(module, exports, __webpack_require__) {
13149
13150var parent = __webpack_require__(432);
13151__webpack_require__(454);
13152__webpack_require__(455);
13153__webpack_require__(456);
13154__webpack_require__(457);
13155__webpack_require__(458);
13156// TODO: Remove from `core-js@4`
13157__webpack_require__(459);
13158__webpack_require__(460);
13159__webpack_require__(461);
13160
13161module.exports = parent;
13162
13163
13164/***/ }),
13165/* 432 */
13166/***/ (function(module, exports, __webpack_require__) {
13167
13168var parent = __webpack_require__(241);
13169
13170module.exports = parent;
13171
13172
13173/***/ }),
13174/* 433 */
13175/***/ (function(module, exports, __webpack_require__) {
13176
13177__webpack_require__(227);
13178__webpack_require__(68);
13179__webpack_require__(242);
13180__webpack_require__(438);
13181__webpack_require__(439);
13182__webpack_require__(440);
13183__webpack_require__(441);
13184__webpack_require__(247);
13185__webpack_require__(442);
13186__webpack_require__(443);
13187__webpack_require__(444);
13188__webpack_require__(445);
13189__webpack_require__(446);
13190__webpack_require__(447);
13191__webpack_require__(448);
13192__webpack_require__(449);
13193__webpack_require__(450);
13194__webpack_require__(451);
13195__webpack_require__(452);
13196__webpack_require__(453);
13197var path = __webpack_require__(7);
13198
13199module.exports = path.Symbol;
13200
13201
13202/***/ }),
13203/* 434 */
13204/***/ (function(module, exports, __webpack_require__) {
13205
13206"use strict";
13207
13208var $ = __webpack_require__(0);
13209var global = __webpack_require__(8);
13210var call = __webpack_require__(15);
13211var uncurryThis = __webpack_require__(4);
13212var IS_PURE = __webpack_require__(36);
13213var DESCRIPTORS = __webpack_require__(14);
13214var NATIVE_SYMBOL = __webpack_require__(65);
13215var fails = __webpack_require__(2);
13216var hasOwn = __webpack_require__(13);
13217var isPrototypeOf = __webpack_require__(16);
13218var anObject = __webpack_require__(21);
13219var toIndexedObject = __webpack_require__(35);
13220var toPropertyKey = __webpack_require__(99);
13221var $toString = __webpack_require__(42);
13222var createPropertyDescriptor = __webpack_require__(49);
13223var nativeObjectCreate = __webpack_require__(53);
13224var objectKeys = __webpack_require__(107);
13225var getOwnPropertyNamesModule = __webpack_require__(105);
13226var getOwnPropertyNamesExternal = __webpack_require__(243);
13227var getOwnPropertySymbolsModule = __webpack_require__(106);
13228var getOwnPropertyDescriptorModule = __webpack_require__(64);
13229var definePropertyModule = __webpack_require__(23);
13230var definePropertiesModule = __webpack_require__(129);
13231var propertyIsEnumerableModule = __webpack_require__(121);
13232var defineBuiltIn = __webpack_require__(45);
13233var shared = __webpack_require__(82);
13234var sharedKey = __webpack_require__(103);
13235var hiddenKeys = __webpack_require__(83);
13236var uid = __webpack_require__(101);
13237var wellKnownSymbol = __webpack_require__(5);
13238var wrappedWellKnownSymbolModule = __webpack_require__(151);
13239var defineWellKnownSymbol = __webpack_require__(10);
13240var defineSymbolToPrimitive = __webpack_require__(245);
13241var setToStringTag = __webpack_require__(56);
13242var InternalStateModule = __webpack_require__(44);
13243var $forEach = __webpack_require__(75).forEach;
13244
13245var HIDDEN = sharedKey('hidden');
13246var SYMBOL = 'Symbol';
13247var PROTOTYPE = 'prototype';
13248
13249var setInternalState = InternalStateModule.set;
13250var getInternalState = InternalStateModule.getterFor(SYMBOL);
13251
13252var ObjectPrototype = Object[PROTOTYPE];
13253var $Symbol = global.Symbol;
13254var SymbolPrototype = $Symbol && $Symbol[PROTOTYPE];
13255var TypeError = global.TypeError;
13256var QObject = global.QObject;
13257var nativeGetOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
13258var nativeDefineProperty = definePropertyModule.f;
13259var nativeGetOwnPropertyNames = getOwnPropertyNamesExternal.f;
13260var nativePropertyIsEnumerable = propertyIsEnumerableModule.f;
13261var push = uncurryThis([].push);
13262
13263var AllSymbols = shared('symbols');
13264var ObjectPrototypeSymbols = shared('op-symbols');
13265var WellKnownSymbolsStore = shared('wks');
13266
13267// Don't use setters in Qt Script, https://github.com/zloirock/core-js/issues/173
13268var USE_SETTER = !QObject || !QObject[PROTOTYPE] || !QObject[PROTOTYPE].findChild;
13269
13270// fallback for old Android, https://code.google.com/p/v8/issues/detail?id=687
13271var setSymbolDescriptor = DESCRIPTORS && fails(function () {
13272 return nativeObjectCreate(nativeDefineProperty({}, 'a', {
13273 get: function () { return nativeDefineProperty(this, 'a', { value: 7 }).a; }
13274 })).a != 7;
13275}) ? function (O, P, Attributes) {
13276 var ObjectPrototypeDescriptor = nativeGetOwnPropertyDescriptor(ObjectPrototype, P);
13277 if (ObjectPrototypeDescriptor) delete ObjectPrototype[P];
13278 nativeDefineProperty(O, P, Attributes);
13279 if (ObjectPrototypeDescriptor && O !== ObjectPrototype) {
13280 nativeDefineProperty(ObjectPrototype, P, ObjectPrototypeDescriptor);
13281 }
13282} : nativeDefineProperty;
13283
13284var wrap = function (tag, description) {
13285 var symbol = AllSymbols[tag] = nativeObjectCreate(SymbolPrototype);
13286 setInternalState(symbol, {
13287 type: SYMBOL,
13288 tag: tag,
13289 description: description
13290 });
13291 if (!DESCRIPTORS) symbol.description = description;
13292 return symbol;
13293};
13294
13295var $defineProperty = function defineProperty(O, P, Attributes) {
13296 if (O === ObjectPrototype) $defineProperty(ObjectPrototypeSymbols, P, Attributes);
13297 anObject(O);
13298 var key = toPropertyKey(P);
13299 anObject(Attributes);
13300 if (hasOwn(AllSymbols, key)) {
13301 if (!Attributes.enumerable) {
13302 if (!hasOwn(O, HIDDEN)) nativeDefineProperty(O, HIDDEN, createPropertyDescriptor(1, {}));
13303 O[HIDDEN][key] = true;
13304 } else {
13305 if (hasOwn(O, HIDDEN) && O[HIDDEN][key]) O[HIDDEN][key] = false;
13306 Attributes = nativeObjectCreate(Attributes, { enumerable: createPropertyDescriptor(0, false) });
13307 } return setSymbolDescriptor(O, key, Attributes);
13308 } return nativeDefineProperty(O, key, Attributes);
13309};
13310
13311var $defineProperties = function defineProperties(O, Properties) {
13312 anObject(O);
13313 var properties = toIndexedObject(Properties);
13314 var keys = objectKeys(properties).concat($getOwnPropertySymbols(properties));
13315 $forEach(keys, function (key) {
13316 if (!DESCRIPTORS || call($propertyIsEnumerable, properties, key)) $defineProperty(O, key, properties[key]);
13317 });
13318 return O;
13319};
13320
13321var $create = function create(O, Properties) {
13322 return Properties === undefined ? nativeObjectCreate(O) : $defineProperties(nativeObjectCreate(O), Properties);
13323};
13324
13325var $propertyIsEnumerable = function propertyIsEnumerable(V) {
13326 var P = toPropertyKey(V);
13327 var enumerable = call(nativePropertyIsEnumerable, this, P);
13328 if (this === ObjectPrototype && hasOwn(AllSymbols, P) && !hasOwn(ObjectPrototypeSymbols, P)) return false;
13329 return enumerable || !hasOwn(this, P) || !hasOwn(AllSymbols, P) || hasOwn(this, HIDDEN) && this[HIDDEN][P]
13330 ? enumerable : true;
13331};
13332
13333var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(O, P) {
13334 var it = toIndexedObject(O);
13335 var key = toPropertyKey(P);
13336 if (it === ObjectPrototype && hasOwn(AllSymbols, key) && !hasOwn(ObjectPrototypeSymbols, key)) return;
13337 var descriptor = nativeGetOwnPropertyDescriptor(it, key);
13338 if (descriptor && hasOwn(AllSymbols, key) && !(hasOwn(it, HIDDEN) && it[HIDDEN][key])) {
13339 descriptor.enumerable = true;
13340 }
13341 return descriptor;
13342};
13343
13344var $getOwnPropertyNames = function getOwnPropertyNames(O) {
13345 var names = nativeGetOwnPropertyNames(toIndexedObject(O));
13346 var result = [];
13347 $forEach(names, function (key) {
13348 if (!hasOwn(AllSymbols, key) && !hasOwn(hiddenKeys, key)) push(result, key);
13349 });
13350 return result;
13351};
13352
13353var $getOwnPropertySymbols = function (O) {
13354 var IS_OBJECT_PROTOTYPE = O === ObjectPrototype;
13355 var names = nativeGetOwnPropertyNames(IS_OBJECT_PROTOTYPE ? ObjectPrototypeSymbols : toIndexedObject(O));
13356 var result = [];
13357 $forEach(names, function (key) {
13358 if (hasOwn(AllSymbols, key) && (!IS_OBJECT_PROTOTYPE || hasOwn(ObjectPrototype, key))) {
13359 push(result, AllSymbols[key]);
13360 }
13361 });
13362 return result;
13363};
13364
13365// `Symbol` constructor
13366// https://tc39.es/ecma262/#sec-symbol-constructor
13367if (!NATIVE_SYMBOL) {
13368 $Symbol = function Symbol() {
13369 if (isPrototypeOf(SymbolPrototype, this)) throw TypeError('Symbol is not a constructor');
13370 var description = !arguments.length || arguments[0] === undefined ? undefined : $toString(arguments[0]);
13371 var tag = uid(description);
13372 var setter = function (value) {
13373 if (this === ObjectPrototype) call(setter, ObjectPrototypeSymbols, value);
13374 if (hasOwn(this, HIDDEN) && hasOwn(this[HIDDEN], tag)) this[HIDDEN][tag] = false;
13375 setSymbolDescriptor(this, tag, createPropertyDescriptor(1, value));
13376 };
13377 if (DESCRIPTORS && USE_SETTER) setSymbolDescriptor(ObjectPrototype, tag, { configurable: true, set: setter });
13378 return wrap(tag, description);
13379 };
13380
13381 SymbolPrototype = $Symbol[PROTOTYPE];
13382
13383 defineBuiltIn(SymbolPrototype, 'toString', function toString() {
13384 return getInternalState(this).tag;
13385 });
13386
13387 defineBuiltIn($Symbol, 'withoutSetter', function (description) {
13388 return wrap(uid(description), description);
13389 });
13390
13391 propertyIsEnumerableModule.f = $propertyIsEnumerable;
13392 definePropertyModule.f = $defineProperty;
13393 definePropertiesModule.f = $defineProperties;
13394 getOwnPropertyDescriptorModule.f = $getOwnPropertyDescriptor;
13395 getOwnPropertyNamesModule.f = getOwnPropertyNamesExternal.f = $getOwnPropertyNames;
13396 getOwnPropertySymbolsModule.f = $getOwnPropertySymbols;
13397
13398 wrappedWellKnownSymbolModule.f = function (name) {
13399 return wrap(wellKnownSymbol(name), name);
13400 };
13401
13402 if (DESCRIPTORS) {
13403 // https://github.com/tc39/proposal-Symbol-description
13404 nativeDefineProperty(SymbolPrototype, 'description', {
13405 configurable: true,
13406 get: function description() {
13407 return getInternalState(this).description;
13408 }
13409 });
13410 if (!IS_PURE) {
13411 defineBuiltIn(ObjectPrototype, 'propertyIsEnumerable', $propertyIsEnumerable, { unsafe: true });
13412 }
13413 }
13414}
13415
13416$({ global: true, constructor: true, wrap: true, forced: !NATIVE_SYMBOL, sham: !NATIVE_SYMBOL }, {
13417 Symbol: $Symbol
13418});
13419
13420$forEach(objectKeys(WellKnownSymbolsStore), function (name) {
13421 defineWellKnownSymbol(name);
13422});
13423
13424$({ target: SYMBOL, stat: true, forced: !NATIVE_SYMBOL }, {
13425 useSetter: function () { USE_SETTER = true; },
13426 useSimple: function () { USE_SETTER = false; }
13427});
13428
13429$({ target: 'Object', stat: true, forced: !NATIVE_SYMBOL, sham: !DESCRIPTORS }, {
13430 // `Object.create` method
13431 // https://tc39.es/ecma262/#sec-object.create
13432 create: $create,
13433 // `Object.defineProperty` method
13434 // https://tc39.es/ecma262/#sec-object.defineproperty
13435 defineProperty: $defineProperty,
13436 // `Object.defineProperties` method
13437 // https://tc39.es/ecma262/#sec-object.defineproperties
13438 defineProperties: $defineProperties,
13439 // `Object.getOwnPropertyDescriptor` method
13440 // https://tc39.es/ecma262/#sec-object.getownpropertydescriptors
13441 getOwnPropertyDescriptor: $getOwnPropertyDescriptor
13442});
13443
13444$({ target: 'Object', stat: true, forced: !NATIVE_SYMBOL }, {
13445 // `Object.getOwnPropertyNames` method
13446 // https://tc39.es/ecma262/#sec-object.getownpropertynames
13447 getOwnPropertyNames: $getOwnPropertyNames
13448});
13449
13450// `Symbol.prototype[@@toPrimitive]` method
13451// https://tc39.es/ecma262/#sec-symbol.prototype-@@toprimitive
13452defineSymbolToPrimitive();
13453
13454// `Symbol.prototype[@@toStringTag]` property
13455// https://tc39.es/ecma262/#sec-symbol.prototype-@@tostringtag
13456setToStringTag($Symbol, SYMBOL);
13457
13458hiddenKeys[HIDDEN] = true;
13459
13460
13461/***/ }),
13462/* 435 */
13463/***/ (function(module, exports, __webpack_require__) {
13464
13465var $ = __webpack_require__(0);
13466var getBuiltIn = __webpack_require__(20);
13467var hasOwn = __webpack_require__(13);
13468var toString = __webpack_require__(42);
13469var shared = __webpack_require__(82);
13470var NATIVE_SYMBOL_REGISTRY = __webpack_require__(246);
13471
13472var StringToSymbolRegistry = shared('string-to-symbol-registry');
13473var SymbolToStringRegistry = shared('symbol-to-string-registry');
13474
13475// `Symbol.for` method
13476// https://tc39.es/ecma262/#sec-symbol.for
13477$({ target: 'Symbol', stat: true, forced: !NATIVE_SYMBOL_REGISTRY }, {
13478 'for': function (key) {
13479 var string = toString(key);
13480 if (hasOwn(StringToSymbolRegistry, string)) return StringToSymbolRegistry[string];
13481 var symbol = getBuiltIn('Symbol')(string);
13482 StringToSymbolRegistry[string] = symbol;
13483 SymbolToStringRegistry[symbol] = string;
13484 return symbol;
13485 }
13486});
13487
13488
13489/***/ }),
13490/* 436 */
13491/***/ (function(module, exports, __webpack_require__) {
13492
13493var $ = __webpack_require__(0);
13494var hasOwn = __webpack_require__(13);
13495var isSymbol = __webpack_require__(100);
13496var tryToString = __webpack_require__(67);
13497var shared = __webpack_require__(82);
13498var NATIVE_SYMBOL_REGISTRY = __webpack_require__(246);
13499
13500var SymbolToStringRegistry = shared('symbol-to-string-registry');
13501
13502// `Symbol.keyFor` method
13503// https://tc39.es/ecma262/#sec-symbol.keyfor
13504$({ target: 'Symbol', stat: true, forced: !NATIVE_SYMBOL_REGISTRY }, {
13505 keyFor: function keyFor(sym) {
13506 if (!isSymbol(sym)) throw TypeError(tryToString(sym) + ' is not a symbol');
13507 if (hasOwn(SymbolToStringRegistry, sym)) return SymbolToStringRegistry[sym];
13508 }
13509});
13510
13511
13512/***/ }),
13513/* 437 */
13514/***/ (function(module, exports, __webpack_require__) {
13515
13516var $ = __webpack_require__(0);
13517var NATIVE_SYMBOL = __webpack_require__(65);
13518var fails = __webpack_require__(2);
13519var getOwnPropertySymbolsModule = __webpack_require__(106);
13520var toObject = __webpack_require__(33);
13521
13522// V8 ~ Chrome 38 and 39 `Object.getOwnPropertySymbols` fails on primitives
13523// https://bugs.chromium.org/p/v8/issues/detail?id=3443
13524var FORCED = !NATIVE_SYMBOL || fails(function () { getOwnPropertySymbolsModule.f(1); });
13525
13526// `Object.getOwnPropertySymbols` method
13527// https://tc39.es/ecma262/#sec-object.getownpropertysymbols
13528$({ target: 'Object', stat: true, forced: FORCED }, {
13529 getOwnPropertySymbols: function getOwnPropertySymbols(it) {
13530 var $getOwnPropertySymbols = getOwnPropertySymbolsModule.f;
13531 return $getOwnPropertySymbols ? $getOwnPropertySymbols(toObject(it)) : [];
13532 }
13533});
13534
13535
13536/***/ }),
13537/* 438 */
13538/***/ (function(module, exports, __webpack_require__) {
13539
13540var defineWellKnownSymbol = __webpack_require__(10);
13541
13542// `Symbol.asyncIterator` well-known symbol
13543// https://tc39.es/ecma262/#sec-symbol.asynciterator
13544defineWellKnownSymbol('asyncIterator');
13545
13546
13547/***/ }),
13548/* 439 */
13549/***/ (function(module, exports) {
13550
13551// empty
13552
13553
13554/***/ }),
13555/* 440 */
13556/***/ (function(module, exports, __webpack_require__) {
13557
13558var defineWellKnownSymbol = __webpack_require__(10);
13559
13560// `Symbol.hasInstance` well-known symbol
13561// https://tc39.es/ecma262/#sec-symbol.hasinstance
13562defineWellKnownSymbol('hasInstance');
13563
13564
13565/***/ }),
13566/* 441 */
13567/***/ (function(module, exports, __webpack_require__) {
13568
13569var defineWellKnownSymbol = __webpack_require__(10);
13570
13571// `Symbol.isConcatSpreadable` well-known symbol
13572// https://tc39.es/ecma262/#sec-symbol.isconcatspreadable
13573defineWellKnownSymbol('isConcatSpreadable');
13574
13575
13576/***/ }),
13577/* 442 */
13578/***/ (function(module, exports, __webpack_require__) {
13579
13580var defineWellKnownSymbol = __webpack_require__(10);
13581
13582// `Symbol.match` well-known symbol
13583// https://tc39.es/ecma262/#sec-symbol.match
13584defineWellKnownSymbol('match');
13585
13586
13587/***/ }),
13588/* 443 */
13589/***/ (function(module, exports, __webpack_require__) {
13590
13591var defineWellKnownSymbol = __webpack_require__(10);
13592
13593// `Symbol.matchAll` well-known symbol
13594// https://tc39.es/ecma262/#sec-symbol.matchall
13595defineWellKnownSymbol('matchAll');
13596
13597
13598/***/ }),
13599/* 444 */
13600/***/ (function(module, exports, __webpack_require__) {
13601
13602var defineWellKnownSymbol = __webpack_require__(10);
13603
13604// `Symbol.replace` well-known symbol
13605// https://tc39.es/ecma262/#sec-symbol.replace
13606defineWellKnownSymbol('replace');
13607
13608
13609/***/ }),
13610/* 445 */
13611/***/ (function(module, exports, __webpack_require__) {
13612
13613var defineWellKnownSymbol = __webpack_require__(10);
13614
13615// `Symbol.search` well-known symbol
13616// https://tc39.es/ecma262/#sec-symbol.search
13617defineWellKnownSymbol('search');
13618
13619
13620/***/ }),
13621/* 446 */
13622/***/ (function(module, exports, __webpack_require__) {
13623
13624var defineWellKnownSymbol = __webpack_require__(10);
13625
13626// `Symbol.species` well-known symbol
13627// https://tc39.es/ecma262/#sec-symbol.species
13628defineWellKnownSymbol('species');
13629
13630
13631/***/ }),
13632/* 447 */
13633/***/ (function(module, exports, __webpack_require__) {
13634
13635var defineWellKnownSymbol = __webpack_require__(10);
13636
13637// `Symbol.split` well-known symbol
13638// https://tc39.es/ecma262/#sec-symbol.split
13639defineWellKnownSymbol('split');
13640
13641
13642/***/ }),
13643/* 448 */
13644/***/ (function(module, exports, __webpack_require__) {
13645
13646var defineWellKnownSymbol = __webpack_require__(10);
13647var defineSymbolToPrimitive = __webpack_require__(245);
13648
13649// `Symbol.toPrimitive` well-known symbol
13650// https://tc39.es/ecma262/#sec-symbol.toprimitive
13651defineWellKnownSymbol('toPrimitive');
13652
13653// `Symbol.prototype[@@toPrimitive]` method
13654// https://tc39.es/ecma262/#sec-symbol.prototype-@@toprimitive
13655defineSymbolToPrimitive();
13656
13657
13658/***/ }),
13659/* 449 */
13660/***/ (function(module, exports, __webpack_require__) {
13661
13662var getBuiltIn = __webpack_require__(20);
13663var defineWellKnownSymbol = __webpack_require__(10);
13664var setToStringTag = __webpack_require__(56);
13665
13666// `Symbol.toStringTag` well-known symbol
13667// https://tc39.es/ecma262/#sec-symbol.tostringtag
13668defineWellKnownSymbol('toStringTag');
13669
13670// `Symbol.prototype[@@toStringTag]` property
13671// https://tc39.es/ecma262/#sec-symbol.prototype-@@tostringtag
13672setToStringTag(getBuiltIn('Symbol'), 'Symbol');
13673
13674
13675/***/ }),
13676/* 450 */
13677/***/ (function(module, exports, __webpack_require__) {
13678
13679var defineWellKnownSymbol = __webpack_require__(10);
13680
13681// `Symbol.unscopables` well-known symbol
13682// https://tc39.es/ecma262/#sec-symbol.unscopables
13683defineWellKnownSymbol('unscopables');
13684
13685
13686/***/ }),
13687/* 451 */
13688/***/ (function(module, exports, __webpack_require__) {
13689
13690var global = __webpack_require__(8);
13691var setToStringTag = __webpack_require__(56);
13692
13693// JSON[@@toStringTag] property
13694// https://tc39.es/ecma262/#sec-json-@@tostringtag
13695setToStringTag(global.JSON, 'JSON', true);
13696
13697
13698/***/ }),
13699/* 452 */
13700/***/ (function(module, exports) {
13701
13702// empty
13703
13704
13705/***/ }),
13706/* 453 */
13707/***/ (function(module, exports) {
13708
13709// empty
13710
13711
13712/***/ }),
13713/* 454 */
13714/***/ (function(module, exports, __webpack_require__) {
13715
13716var defineWellKnownSymbol = __webpack_require__(10);
13717
13718// `Symbol.asyncDispose` well-known symbol
13719// https://github.com/tc39/proposal-using-statement
13720defineWellKnownSymbol('asyncDispose');
13721
13722
13723/***/ }),
13724/* 455 */
13725/***/ (function(module, exports, __webpack_require__) {
13726
13727var defineWellKnownSymbol = __webpack_require__(10);
13728
13729// `Symbol.dispose` well-known symbol
13730// https://github.com/tc39/proposal-using-statement
13731defineWellKnownSymbol('dispose');
13732
13733
13734/***/ }),
13735/* 456 */
13736/***/ (function(module, exports, __webpack_require__) {
13737
13738var defineWellKnownSymbol = __webpack_require__(10);
13739
13740// `Symbol.matcher` well-known symbol
13741// https://github.com/tc39/proposal-pattern-matching
13742defineWellKnownSymbol('matcher');
13743
13744
13745/***/ }),
13746/* 457 */
13747/***/ (function(module, exports, __webpack_require__) {
13748
13749var defineWellKnownSymbol = __webpack_require__(10);
13750
13751// `Symbol.metadataKey` well-known symbol
13752// https://github.com/tc39/proposal-decorator-metadata
13753defineWellKnownSymbol('metadataKey');
13754
13755
13756/***/ }),
13757/* 458 */
13758/***/ (function(module, exports, __webpack_require__) {
13759
13760var defineWellKnownSymbol = __webpack_require__(10);
13761
13762// `Symbol.observable` well-known symbol
13763// https://github.com/tc39/proposal-observable
13764defineWellKnownSymbol('observable');
13765
13766
13767/***/ }),
13768/* 459 */
13769/***/ (function(module, exports, __webpack_require__) {
13770
13771// TODO: Remove from `core-js@4`
13772var defineWellKnownSymbol = __webpack_require__(10);
13773
13774// `Symbol.metadata` well-known symbol
13775// https://github.com/tc39/proposal-decorators
13776defineWellKnownSymbol('metadata');
13777
13778
13779/***/ }),
13780/* 460 */
13781/***/ (function(module, exports, __webpack_require__) {
13782
13783// TODO: remove from `core-js@4`
13784var defineWellKnownSymbol = __webpack_require__(10);
13785
13786// `Symbol.patternMatch` well-known symbol
13787// https://github.com/tc39/proposal-pattern-matching
13788defineWellKnownSymbol('patternMatch');
13789
13790
13791/***/ }),
13792/* 461 */
13793/***/ (function(module, exports, __webpack_require__) {
13794
13795// TODO: remove from `core-js@4`
13796var defineWellKnownSymbol = __webpack_require__(10);
13797
13798defineWellKnownSymbol('replaceAll');
13799
13800
13801/***/ }),
13802/* 462 */
13803/***/ (function(module, exports, __webpack_require__) {
13804
13805module.exports = __webpack_require__(463);
13806
13807/***/ }),
13808/* 463 */
13809/***/ (function(module, exports, __webpack_require__) {
13810
13811module.exports = __webpack_require__(464);
13812
13813
13814/***/ }),
13815/* 464 */
13816/***/ (function(module, exports, __webpack_require__) {
13817
13818var parent = __webpack_require__(465);
13819
13820module.exports = parent;
13821
13822
13823/***/ }),
13824/* 465 */
13825/***/ (function(module, exports, __webpack_require__) {
13826
13827var parent = __webpack_require__(248);
13828
13829module.exports = parent;
13830
13831
13832/***/ }),
13833/* 466 */
13834/***/ (function(module, exports, __webpack_require__) {
13835
13836__webpack_require__(43);
13837__webpack_require__(68);
13838__webpack_require__(70);
13839__webpack_require__(247);
13840var WrappedWellKnownSymbolModule = __webpack_require__(151);
13841
13842module.exports = WrappedWellKnownSymbolModule.f('iterator');
13843
13844
13845/***/ }),
13846/* 467 */
13847/***/ (function(module, exports, __webpack_require__) {
13848
13849var parent = __webpack_require__(468);
13850
13851module.exports = parent;
13852
13853
13854/***/ }),
13855/* 468 */
13856/***/ (function(module, exports, __webpack_require__) {
13857
13858var isPrototypeOf = __webpack_require__(16);
13859var method = __webpack_require__(469);
13860
13861var ArrayPrototype = Array.prototype;
13862
13863module.exports = function (it) {
13864 var own = it.filter;
13865 return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.filter) ? method : own;
13866};
13867
13868
13869/***/ }),
13870/* 469 */
13871/***/ (function(module, exports, __webpack_require__) {
13872
13873__webpack_require__(470);
13874var entryVirtual = __webpack_require__(27);
13875
13876module.exports = entryVirtual('Array').filter;
13877
13878
13879/***/ }),
13880/* 470 */
13881/***/ (function(module, exports, __webpack_require__) {
13882
13883"use strict";
13884
13885var $ = __webpack_require__(0);
13886var $filter = __webpack_require__(75).filter;
13887var arrayMethodHasSpeciesSupport = __webpack_require__(116);
13888
13889var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('filter');
13890
13891// `Array.prototype.filter` method
13892// https://tc39.es/ecma262/#sec-array.prototype.filter
13893// with adding support of @@species
13894$({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT }, {
13895 filter: function filter(callbackfn /* , thisArg */) {
13896 return $filter(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
13897 }
13898});
13899
13900
13901/***/ }),
13902/* 471 */
13903/***/ (function(module, exports, __webpack_require__) {
13904
13905"use strict";
13906
13907
13908var _interopRequireDefault = __webpack_require__(1);
13909
13910var _slice = _interopRequireDefault(__webpack_require__(34));
13911
13912var _keys = _interopRequireDefault(__webpack_require__(62));
13913
13914var _concat = _interopRequireDefault(__webpack_require__(19));
13915
13916var _ = __webpack_require__(3);
13917
13918module.exports = function (AV) {
13919 var eventSplitter = /\s+/;
13920 var slice = (0, _slice.default)(Array.prototype);
13921 /**
13922 * @class
13923 *
13924 * <p>AV.Events is a fork of Backbone's Events module, provided for your
13925 * convenience.</p>
13926 *
13927 * <p>A module that can be mixed in to any object in order to provide
13928 * it with custom events. You may bind callback functions to an event
13929 * with `on`, or remove these functions with `off`.
13930 * Triggering an event fires all callbacks in the order that `on` was
13931 * called.
13932 *
13933 * @private
13934 * @example
13935 * var object = {};
13936 * _.extend(object, AV.Events);
13937 * object.on('expand', function(){ alert('expanded'); });
13938 * object.trigger('expand');</pre></p>
13939 *
13940 */
13941
13942 AV.Events = {
13943 /**
13944 * Bind one or more space separated events, `events`, to a `callback`
13945 * function. Passing `"all"` will bind the callback to all events fired.
13946 */
13947 on: function on(events, callback, context) {
13948 var calls, event, node, tail, list;
13949
13950 if (!callback) {
13951 return this;
13952 }
13953
13954 events = events.split(eventSplitter);
13955 calls = this._callbacks || (this._callbacks = {}); // Create an immutable callback list, allowing traversal during
13956 // modification. The tail is an empty object that will always be used
13957 // as the next node.
13958
13959 event = events.shift();
13960
13961 while (event) {
13962 list = calls[event];
13963 node = list ? list.tail : {};
13964 node.next = tail = {};
13965 node.context = context;
13966 node.callback = callback;
13967 calls[event] = {
13968 tail: tail,
13969 next: list ? list.next : node
13970 };
13971 event = events.shift();
13972 }
13973
13974 return this;
13975 },
13976
13977 /**
13978 * Remove one or many callbacks. If `context` is null, removes all callbacks
13979 * with that function. If `callback` is null, removes all callbacks for the
13980 * event. If `events` is null, removes all bound callbacks for all events.
13981 */
13982 off: function off(events, callback, context) {
13983 var event, calls, node, tail, cb, ctx; // No events, or removing *all* events.
13984
13985 if (!(calls = this._callbacks)) {
13986 return;
13987 }
13988
13989 if (!(events || callback || context)) {
13990 delete this._callbacks;
13991 return this;
13992 } // Loop through the listed events and contexts, splicing them out of the
13993 // linked list of callbacks if appropriate.
13994
13995
13996 events = events ? events.split(eventSplitter) : (0, _keys.default)(_).call(_, calls);
13997 event = events.shift();
13998
13999 while (event) {
14000 node = calls[event];
14001 delete calls[event];
14002
14003 if (!node || !(callback || context)) {
14004 continue;
14005 } // Create a new list, omitting the indicated callbacks.
14006
14007
14008 tail = node.tail;
14009 node = node.next;
14010
14011 while (node !== tail) {
14012 cb = node.callback;
14013 ctx = node.context;
14014
14015 if (callback && cb !== callback || context && ctx !== context) {
14016 this.on(event, cb, ctx);
14017 }
14018
14019 node = node.next;
14020 }
14021
14022 event = events.shift();
14023 }
14024
14025 return this;
14026 },
14027
14028 /**
14029 * Trigger one or many events, firing all bound callbacks. Callbacks are
14030 * passed the same arguments as `trigger` is, apart from the event name
14031 * (unless you're listening on `"all"`, which will cause your callback to
14032 * receive the true name of the event as the first argument).
14033 */
14034 trigger: function trigger(events) {
14035 var event, node, calls, tail, args, all, rest;
14036
14037 if (!(calls = this._callbacks)) {
14038 return this;
14039 }
14040
14041 all = calls.all;
14042 events = events.split(eventSplitter);
14043 rest = slice.call(arguments, 1); // For each event, walk through the linked list of callbacks twice,
14044 // first to trigger the event, then to trigger any `"all"` callbacks.
14045
14046 event = events.shift();
14047
14048 while (event) {
14049 node = calls[event];
14050
14051 if (node) {
14052 tail = node.tail;
14053
14054 while ((node = node.next) !== tail) {
14055 node.callback.apply(node.context || this, rest);
14056 }
14057 }
14058
14059 node = all;
14060
14061 if (node) {
14062 var _context;
14063
14064 tail = node.tail;
14065 args = (0, _concat.default)(_context = [event]).call(_context, rest);
14066
14067 while ((node = node.next) !== tail) {
14068 node.callback.apply(node.context || this, args);
14069 }
14070 }
14071
14072 event = events.shift();
14073 }
14074
14075 return this;
14076 }
14077 };
14078 /**
14079 * @function
14080 */
14081
14082 AV.Events.bind = AV.Events.on;
14083 /**
14084 * @function
14085 */
14086
14087 AV.Events.unbind = AV.Events.off;
14088};
14089
14090/***/ }),
14091/* 472 */
14092/***/ (function(module, exports, __webpack_require__) {
14093
14094"use strict";
14095
14096
14097var _interopRequireDefault = __webpack_require__(1);
14098
14099var _promise = _interopRequireDefault(__webpack_require__(12));
14100
14101var _ = __webpack_require__(3);
14102/*global navigator: false */
14103
14104
14105module.exports = function (AV) {
14106 /**
14107 * Creates a new GeoPoint with any of the following forms:<br>
14108 * @example
14109 * new GeoPoint(otherGeoPoint)
14110 * new GeoPoint(30, 30)
14111 * new GeoPoint([30, 30])
14112 * new GeoPoint({latitude: 30, longitude: 30})
14113 * new GeoPoint() // defaults to (0, 0)
14114 * @class
14115 *
14116 * <p>Represents a latitude / longitude point that may be associated
14117 * with a key in a AVObject or used as a reference point for geo queries.
14118 * This allows proximity-based queries on the key.</p>
14119 *
14120 * <p>Only one key in a class may contain a GeoPoint.</p>
14121 *
14122 * <p>Example:<pre>
14123 * var point = new AV.GeoPoint(30.0, -20.0);
14124 * var object = new AV.Object("PlaceObject");
14125 * object.set("location", point);
14126 * object.save();</pre></p>
14127 */
14128 AV.GeoPoint = function (arg1, arg2) {
14129 if (_.isArray(arg1)) {
14130 AV.GeoPoint._validate(arg1[0], arg1[1]);
14131
14132 this.latitude = arg1[0];
14133 this.longitude = arg1[1];
14134 } else if (_.isObject(arg1)) {
14135 AV.GeoPoint._validate(arg1.latitude, arg1.longitude);
14136
14137 this.latitude = arg1.latitude;
14138 this.longitude = arg1.longitude;
14139 } else if (_.isNumber(arg1) && _.isNumber(arg2)) {
14140 AV.GeoPoint._validate(arg1, arg2);
14141
14142 this.latitude = arg1;
14143 this.longitude = arg2;
14144 } else {
14145 this.latitude = 0;
14146 this.longitude = 0;
14147 } // Add properties so that anyone using Webkit or Mozilla will get an error
14148 // if they try to set values that are out of bounds.
14149
14150
14151 var self = this;
14152
14153 if (this.__defineGetter__ && this.__defineSetter__) {
14154 // Use _latitude and _longitude to actually store the values, and add
14155 // getters and setters for latitude and longitude.
14156 this._latitude = this.latitude;
14157 this._longitude = this.longitude;
14158
14159 this.__defineGetter__('latitude', function () {
14160 return self._latitude;
14161 });
14162
14163 this.__defineGetter__('longitude', function () {
14164 return self._longitude;
14165 });
14166
14167 this.__defineSetter__('latitude', function (val) {
14168 AV.GeoPoint._validate(val, self.longitude);
14169
14170 self._latitude = val;
14171 });
14172
14173 this.__defineSetter__('longitude', function (val) {
14174 AV.GeoPoint._validate(self.latitude, val);
14175
14176 self._longitude = val;
14177 });
14178 }
14179 };
14180 /**
14181 * @lends AV.GeoPoint.prototype
14182 * @property {float} latitude North-south portion of the coordinate, in range
14183 * [-90, 90]. Throws an exception if set out of range in a modern browser.
14184 * @property {float} longitude East-west portion of the coordinate, in range
14185 * [-180, 180]. Throws if set out of range in a modern browser.
14186 */
14187
14188 /**
14189 * Throws an exception if the given lat-long is out of bounds.
14190 * @private
14191 */
14192
14193
14194 AV.GeoPoint._validate = function (latitude, longitude) {
14195 if (latitude < -90.0) {
14196 throw new Error('AV.GeoPoint latitude ' + latitude + ' < -90.0.');
14197 }
14198
14199 if (latitude > 90.0) {
14200 throw new Error('AV.GeoPoint latitude ' + latitude + ' > 90.0.');
14201 }
14202
14203 if (longitude < -180.0) {
14204 throw new Error('AV.GeoPoint longitude ' + longitude + ' < -180.0.');
14205 }
14206
14207 if (longitude > 180.0) {
14208 throw new Error('AV.GeoPoint longitude ' + longitude + ' > 180.0.');
14209 }
14210 };
14211 /**
14212 * Creates a GeoPoint with the user's current location, if available.
14213 * @return {Promise.<AV.GeoPoint>}
14214 */
14215
14216
14217 AV.GeoPoint.current = function () {
14218 return new _promise.default(function (resolve, reject) {
14219 navigator.geolocation.getCurrentPosition(function (location) {
14220 resolve(new AV.GeoPoint({
14221 latitude: location.coords.latitude,
14222 longitude: location.coords.longitude
14223 }));
14224 }, reject);
14225 });
14226 };
14227
14228 _.extend(AV.GeoPoint.prototype,
14229 /** @lends AV.GeoPoint.prototype */
14230 {
14231 /**
14232 * Returns a JSON representation of the GeoPoint, suitable for AV.
14233 * @return {Object}
14234 */
14235 toJSON: function toJSON() {
14236 AV.GeoPoint._validate(this.latitude, this.longitude);
14237
14238 return {
14239 __type: 'GeoPoint',
14240 latitude: this.latitude,
14241 longitude: this.longitude
14242 };
14243 },
14244
14245 /**
14246 * Returns the distance from this GeoPoint to another in radians.
14247 * @param {AV.GeoPoint} point the other AV.GeoPoint.
14248 * @return {Number}
14249 */
14250 radiansTo: function radiansTo(point) {
14251 var d2r = Math.PI / 180.0;
14252 var lat1rad = this.latitude * d2r;
14253 var long1rad = this.longitude * d2r;
14254 var lat2rad = point.latitude * d2r;
14255 var long2rad = point.longitude * d2r;
14256 var deltaLat = lat1rad - lat2rad;
14257 var deltaLong = long1rad - long2rad;
14258 var sinDeltaLatDiv2 = Math.sin(deltaLat / 2);
14259 var sinDeltaLongDiv2 = Math.sin(deltaLong / 2); // Square of half the straight line chord distance between both points.
14260
14261 var a = sinDeltaLatDiv2 * sinDeltaLatDiv2 + Math.cos(lat1rad) * Math.cos(lat2rad) * sinDeltaLongDiv2 * sinDeltaLongDiv2;
14262 a = Math.min(1.0, a);
14263 return 2 * Math.asin(Math.sqrt(a));
14264 },
14265
14266 /**
14267 * Returns the distance from this GeoPoint to another in kilometers.
14268 * @param {AV.GeoPoint} point the other AV.GeoPoint.
14269 * @return {Number}
14270 */
14271 kilometersTo: function kilometersTo(point) {
14272 return this.radiansTo(point) * 6371.0;
14273 },
14274
14275 /**
14276 * Returns the distance from this GeoPoint to another in miles.
14277 * @param {AV.GeoPoint} point the other AV.GeoPoint.
14278 * @return {Number}
14279 */
14280 milesTo: function milesTo(point) {
14281 return this.radiansTo(point) * 3958.8;
14282 }
14283 });
14284};
14285
14286/***/ }),
14287/* 473 */
14288/***/ (function(module, exports, __webpack_require__) {
14289
14290"use strict";
14291
14292
14293var _ = __webpack_require__(3);
14294
14295module.exports = function (AV) {
14296 var PUBLIC_KEY = '*';
14297 /**
14298 * Creates a new ACL.
14299 * If no argument is given, the ACL has no permissions for anyone.
14300 * If the argument is a AV.User, the ACL will have read and write
14301 * permission for only that user.
14302 * If the argument is any other JSON object, that object will be interpretted
14303 * as a serialized ACL created with toJSON().
14304 * @see AV.Object#setACL
14305 * @class
14306 *
14307 * <p>An ACL, or Access Control List can be added to any
14308 * <code>AV.Object</code> to restrict access to only a subset of users
14309 * of your application.</p>
14310 */
14311
14312 AV.ACL = function (arg1) {
14313 var self = this;
14314 self.permissionsById = {};
14315
14316 if (_.isObject(arg1)) {
14317 if (arg1 instanceof AV.User) {
14318 self.setReadAccess(arg1, true);
14319 self.setWriteAccess(arg1, true);
14320 } else {
14321 if (_.isFunction(arg1)) {
14322 throw new Error('AV.ACL() called with a function. Did you forget ()?');
14323 }
14324
14325 AV._objectEach(arg1, function (accessList, userId) {
14326 if (!_.isString(userId)) {
14327 throw new Error('Tried to create an ACL with an invalid userId.');
14328 }
14329
14330 self.permissionsById[userId] = {};
14331
14332 AV._objectEach(accessList, function (allowed, permission) {
14333 if (permission !== 'read' && permission !== 'write') {
14334 throw new Error('Tried to create an ACL with an invalid permission type.');
14335 }
14336
14337 if (!_.isBoolean(allowed)) {
14338 throw new Error('Tried to create an ACL with an invalid permission value.');
14339 }
14340
14341 self.permissionsById[userId][permission] = allowed;
14342 });
14343 });
14344 }
14345 }
14346 };
14347 /**
14348 * Returns a JSON-encoded version of the ACL.
14349 * @return {Object}
14350 */
14351
14352
14353 AV.ACL.prototype.toJSON = function () {
14354 return _.clone(this.permissionsById);
14355 };
14356
14357 AV.ACL.prototype._setAccess = function (accessType, userId, allowed) {
14358 if (userId instanceof AV.User) {
14359 userId = userId.id;
14360 } else if (userId instanceof AV.Role) {
14361 userId = 'role:' + userId.getName();
14362 }
14363
14364 if (!_.isString(userId)) {
14365 throw new Error('userId must be a string.');
14366 }
14367
14368 if (!_.isBoolean(allowed)) {
14369 throw new Error('allowed must be either true or false.');
14370 }
14371
14372 var permissions = this.permissionsById[userId];
14373
14374 if (!permissions) {
14375 if (!allowed) {
14376 // The user already doesn't have this permission, so no action needed.
14377 return;
14378 } else {
14379 permissions = {};
14380 this.permissionsById[userId] = permissions;
14381 }
14382 }
14383
14384 if (allowed) {
14385 this.permissionsById[userId][accessType] = true;
14386 } else {
14387 delete permissions[accessType];
14388
14389 if (_.isEmpty(permissions)) {
14390 delete this.permissionsById[userId];
14391 }
14392 }
14393 };
14394
14395 AV.ACL.prototype._getAccess = function (accessType, userId) {
14396 if (userId instanceof AV.User) {
14397 userId = userId.id;
14398 } else if (userId instanceof AV.Role) {
14399 userId = 'role:' + userId.getName();
14400 }
14401
14402 var permissions = this.permissionsById[userId];
14403
14404 if (!permissions) {
14405 return false;
14406 }
14407
14408 return permissions[accessType] ? true : false;
14409 };
14410 /**
14411 * Set whether the given user is allowed to read this object.
14412 * @param userId An instance of AV.User or its objectId.
14413 * @param {Boolean} allowed Whether that user should have read access.
14414 */
14415
14416
14417 AV.ACL.prototype.setReadAccess = function (userId, allowed) {
14418 this._setAccess('read', userId, allowed);
14419 };
14420 /**
14421 * Get whether the given user id is *explicitly* allowed to read this object.
14422 * Even if this returns false, the user may still be able to access it if
14423 * getPublicReadAccess returns true or a role that the user belongs to has
14424 * write access.
14425 * @param userId An instance of AV.User or its objectId, or a AV.Role.
14426 * @return {Boolean}
14427 */
14428
14429
14430 AV.ACL.prototype.getReadAccess = function (userId) {
14431 return this._getAccess('read', userId);
14432 };
14433 /**
14434 * Set whether the given user id is allowed to write this object.
14435 * @param userId An instance of AV.User or its objectId, or a AV.Role..
14436 * @param {Boolean} allowed Whether that user should have write access.
14437 */
14438
14439
14440 AV.ACL.prototype.setWriteAccess = function (userId, allowed) {
14441 this._setAccess('write', userId, allowed);
14442 };
14443 /**
14444 * Get whether the given user id is *explicitly* allowed to write this object.
14445 * Even if this returns false, the user may still be able to write it if
14446 * getPublicWriteAccess returns true or a role that the user belongs to has
14447 * write access.
14448 * @param userId An instance of AV.User or its objectId, or a AV.Role.
14449 * @return {Boolean}
14450 */
14451
14452
14453 AV.ACL.prototype.getWriteAccess = function (userId) {
14454 return this._getAccess('write', userId);
14455 };
14456 /**
14457 * Set whether the public is allowed to read this object.
14458 * @param {Boolean} allowed
14459 */
14460
14461
14462 AV.ACL.prototype.setPublicReadAccess = function (allowed) {
14463 this.setReadAccess(PUBLIC_KEY, allowed);
14464 };
14465 /**
14466 * Get whether the public is allowed to read this object.
14467 * @return {Boolean}
14468 */
14469
14470
14471 AV.ACL.prototype.getPublicReadAccess = function () {
14472 return this.getReadAccess(PUBLIC_KEY);
14473 };
14474 /**
14475 * Set whether the public is allowed to write this object.
14476 * @param {Boolean} allowed
14477 */
14478
14479
14480 AV.ACL.prototype.setPublicWriteAccess = function (allowed) {
14481 this.setWriteAccess(PUBLIC_KEY, allowed);
14482 };
14483 /**
14484 * Get whether the public is allowed to write this object.
14485 * @return {Boolean}
14486 */
14487
14488
14489 AV.ACL.prototype.getPublicWriteAccess = function () {
14490 return this.getWriteAccess(PUBLIC_KEY);
14491 };
14492 /**
14493 * Get whether users belonging to the given role are allowed
14494 * to read this object. Even if this returns false, the role may
14495 * still be able to write it if a parent role has read access.
14496 *
14497 * @param role The name of the role, or a AV.Role object.
14498 * @return {Boolean} true if the role has read access. false otherwise.
14499 * @throws {String} If role is neither a AV.Role nor a String.
14500 */
14501
14502
14503 AV.ACL.prototype.getRoleReadAccess = function (role) {
14504 if (role instanceof AV.Role) {
14505 // Normalize to the String name
14506 role = role.getName();
14507 }
14508
14509 if (_.isString(role)) {
14510 return this.getReadAccess('role:' + role);
14511 }
14512
14513 throw new Error('role must be a AV.Role or a String');
14514 };
14515 /**
14516 * Get whether users belonging to the given role are allowed
14517 * to write this object. Even if this returns false, the role may
14518 * still be able to write it if a parent role has write access.
14519 *
14520 * @param role The name of the role, or a AV.Role object.
14521 * @return {Boolean} true if the role has write access. false otherwise.
14522 * @throws {String} If role is neither a AV.Role nor a String.
14523 */
14524
14525
14526 AV.ACL.prototype.getRoleWriteAccess = function (role) {
14527 if (role instanceof AV.Role) {
14528 // Normalize to the String name
14529 role = role.getName();
14530 }
14531
14532 if (_.isString(role)) {
14533 return this.getWriteAccess('role:' + role);
14534 }
14535
14536 throw new Error('role must be a AV.Role or a String');
14537 };
14538 /**
14539 * Set whether users belonging to the given role are allowed
14540 * to read this object.
14541 *
14542 * @param role The name of the role, or a AV.Role object.
14543 * @param {Boolean} allowed Whether the given role can read this object.
14544 * @throws {String} If role is neither a AV.Role nor a String.
14545 */
14546
14547
14548 AV.ACL.prototype.setRoleReadAccess = function (role, allowed) {
14549 if (role instanceof AV.Role) {
14550 // Normalize to the String name
14551 role = role.getName();
14552 }
14553
14554 if (_.isString(role)) {
14555 this.setReadAccess('role:' + role, allowed);
14556 return;
14557 }
14558
14559 throw new Error('role must be a AV.Role or a String');
14560 };
14561 /**
14562 * Set whether users belonging to the given role are allowed
14563 * to write this object.
14564 *
14565 * @param role The name of the role, or a AV.Role object.
14566 * @param {Boolean} allowed Whether the given role can write this object.
14567 * @throws {String} If role is neither a AV.Role nor a String.
14568 */
14569
14570
14571 AV.ACL.prototype.setRoleWriteAccess = function (role, allowed) {
14572 if (role instanceof AV.Role) {
14573 // Normalize to the String name
14574 role = role.getName();
14575 }
14576
14577 if (_.isString(role)) {
14578 this.setWriteAccess('role:' + role, allowed);
14579 return;
14580 }
14581
14582 throw new Error('role must be a AV.Role or a String');
14583 };
14584};
14585
14586/***/ }),
14587/* 474 */
14588/***/ (function(module, exports, __webpack_require__) {
14589
14590"use strict";
14591
14592
14593var _interopRequireDefault = __webpack_require__(1);
14594
14595var _concat = _interopRequireDefault(__webpack_require__(19));
14596
14597var _find = _interopRequireDefault(__webpack_require__(96));
14598
14599var _indexOf = _interopRequireDefault(__webpack_require__(61));
14600
14601var _map = _interopRequireDefault(__webpack_require__(37));
14602
14603var _ = __webpack_require__(3);
14604
14605module.exports = function (AV) {
14606 /**
14607 * @private
14608 * @class
14609 * A AV.Op is an atomic operation that can be applied to a field in a
14610 * AV.Object. For example, calling <code>object.set("foo", "bar")</code>
14611 * is an example of a AV.Op.Set. Calling <code>object.unset("foo")</code>
14612 * is a AV.Op.Unset. These operations are stored in a AV.Object and
14613 * sent to the server as part of <code>object.save()</code> operations.
14614 * Instances of AV.Op should be immutable.
14615 *
14616 * You should not create subclasses of AV.Op or instantiate AV.Op
14617 * directly.
14618 */
14619 AV.Op = function () {
14620 this._initialize.apply(this, arguments);
14621 };
14622
14623 _.extend(AV.Op.prototype,
14624 /** @lends AV.Op.prototype */
14625 {
14626 _initialize: function _initialize() {}
14627 });
14628
14629 _.extend(AV.Op, {
14630 /**
14631 * To create a new Op, call AV.Op._extend();
14632 * @private
14633 */
14634 _extend: AV._extend,
14635 // A map of __op string to decoder function.
14636 _opDecoderMap: {},
14637
14638 /**
14639 * Registers a function to convert a json object with an __op field into an
14640 * instance of a subclass of AV.Op.
14641 * @private
14642 */
14643 _registerDecoder: function _registerDecoder(opName, decoder) {
14644 AV.Op._opDecoderMap[opName] = decoder;
14645 },
14646
14647 /**
14648 * Converts a json object into an instance of a subclass of AV.Op.
14649 * @private
14650 */
14651 _decode: function _decode(json) {
14652 var decoder = AV.Op._opDecoderMap[json.__op];
14653
14654 if (decoder) {
14655 return decoder(json);
14656 } else {
14657 return undefined;
14658 }
14659 }
14660 });
14661 /*
14662 * Add a handler for Batch ops.
14663 */
14664
14665
14666 AV.Op._registerDecoder('Batch', function (json) {
14667 var op = null;
14668
14669 AV._arrayEach(json.ops, function (nextOp) {
14670 nextOp = AV.Op._decode(nextOp);
14671 op = nextOp._mergeWithPrevious(op);
14672 });
14673
14674 return op;
14675 });
14676 /**
14677 * @private
14678 * @class
14679 * A Set operation indicates that either the field was changed using
14680 * AV.Object.set, or it is a mutable container that was detected as being
14681 * changed.
14682 */
14683
14684
14685 AV.Op.Set = AV.Op._extend(
14686 /** @lends AV.Op.Set.prototype */
14687 {
14688 _initialize: function _initialize(value) {
14689 this._value = value;
14690 },
14691
14692 /**
14693 * Returns the new value of this field after the set.
14694 */
14695 value: function value() {
14696 return this._value;
14697 },
14698
14699 /**
14700 * Returns a JSON version of the operation suitable for sending to AV.
14701 * @return {Object}
14702 */
14703 toJSON: function toJSON() {
14704 return AV._encode(this.value());
14705 },
14706 _mergeWithPrevious: function _mergeWithPrevious(previous) {
14707 return this;
14708 },
14709 _estimate: function _estimate(oldValue) {
14710 return this.value();
14711 }
14712 });
14713 /**
14714 * A sentinel value that is returned by AV.Op.Unset._estimate to
14715 * indicate the field should be deleted. Basically, if you find _UNSET as a
14716 * value in your object, you should remove that key.
14717 */
14718
14719 AV.Op._UNSET = {};
14720 /**
14721 * @private
14722 * @class
14723 * An Unset operation indicates that this field has been deleted from the
14724 * object.
14725 */
14726
14727 AV.Op.Unset = AV.Op._extend(
14728 /** @lends AV.Op.Unset.prototype */
14729 {
14730 /**
14731 * Returns a JSON version of the operation suitable for sending to AV.
14732 * @return {Object}
14733 */
14734 toJSON: function toJSON() {
14735 return {
14736 __op: 'Delete'
14737 };
14738 },
14739 _mergeWithPrevious: function _mergeWithPrevious(previous) {
14740 return this;
14741 },
14742 _estimate: function _estimate(oldValue) {
14743 return AV.Op._UNSET;
14744 }
14745 });
14746
14747 AV.Op._registerDecoder('Delete', function (json) {
14748 return new AV.Op.Unset();
14749 });
14750 /**
14751 * @private
14752 * @class
14753 * An Increment is an atomic operation where the numeric value for the field
14754 * will be increased by a given amount.
14755 */
14756
14757
14758 AV.Op.Increment = AV.Op._extend(
14759 /** @lends AV.Op.Increment.prototype */
14760 {
14761 _initialize: function _initialize(amount) {
14762 this._amount = amount;
14763 },
14764
14765 /**
14766 * Returns the amount to increment by.
14767 * @return {Number} the amount to increment by.
14768 */
14769 amount: function amount() {
14770 return this._amount;
14771 },
14772
14773 /**
14774 * Returns a JSON version of the operation suitable for sending to AV.
14775 * @return {Object}
14776 */
14777 toJSON: function toJSON() {
14778 return {
14779 __op: 'Increment',
14780 amount: this._amount
14781 };
14782 },
14783 _mergeWithPrevious: function _mergeWithPrevious(previous) {
14784 if (!previous) {
14785 return this;
14786 } else if (previous instanceof AV.Op.Unset) {
14787 return new AV.Op.Set(this.amount());
14788 } else if (previous instanceof AV.Op.Set) {
14789 return new AV.Op.Set(previous.value() + this.amount());
14790 } else if (previous instanceof AV.Op.Increment) {
14791 return new AV.Op.Increment(this.amount() + previous.amount());
14792 } else {
14793 throw new Error('Op is invalid after previous op.');
14794 }
14795 },
14796 _estimate: function _estimate(oldValue) {
14797 if (!oldValue) {
14798 return this.amount();
14799 }
14800
14801 return oldValue + this.amount();
14802 }
14803 });
14804
14805 AV.Op._registerDecoder('Increment', function (json) {
14806 return new AV.Op.Increment(json.amount);
14807 });
14808 /**
14809 * @private
14810 * @class
14811 * BitAnd is an atomic operation where the given value will be bit and to the
14812 * value than is stored in this field.
14813 */
14814
14815
14816 AV.Op.BitAnd = AV.Op._extend(
14817 /** @lends AV.Op.BitAnd.prototype */
14818 {
14819 _initialize: function _initialize(value) {
14820 this._value = value;
14821 },
14822 value: function value() {
14823 return this._value;
14824 },
14825
14826 /**
14827 * Returns a JSON version of the operation suitable for sending to AV.
14828 * @return {Object}
14829 */
14830 toJSON: function toJSON() {
14831 return {
14832 __op: 'BitAnd',
14833 value: this.value()
14834 };
14835 },
14836 _mergeWithPrevious: function _mergeWithPrevious(previous) {
14837 if (!previous) {
14838 return this;
14839 } else if (previous instanceof AV.Op.Unset) {
14840 return new AV.Op.Set(0);
14841 } else if (previous instanceof AV.Op.Set) {
14842 return new AV.Op.Set(previous.value() & this.value());
14843 } else {
14844 throw new Error('Op is invalid after previous op.');
14845 }
14846 },
14847 _estimate: function _estimate(oldValue) {
14848 return oldValue & this.value();
14849 }
14850 });
14851
14852 AV.Op._registerDecoder('BitAnd', function (json) {
14853 return new AV.Op.BitAnd(json.value);
14854 });
14855 /**
14856 * @private
14857 * @class
14858 * BitOr is an atomic operation where the given value will be bit and to the
14859 * value than is stored in this field.
14860 */
14861
14862
14863 AV.Op.BitOr = AV.Op._extend(
14864 /** @lends AV.Op.BitOr.prototype */
14865 {
14866 _initialize: function _initialize(value) {
14867 this._value = value;
14868 },
14869 value: function value() {
14870 return this._value;
14871 },
14872
14873 /**
14874 * Returns a JSON version of the operation suitable for sending to AV.
14875 * @return {Object}
14876 */
14877 toJSON: function toJSON() {
14878 return {
14879 __op: 'BitOr',
14880 value: this.value()
14881 };
14882 },
14883 _mergeWithPrevious: function _mergeWithPrevious(previous) {
14884 if (!previous) {
14885 return this;
14886 } else if (previous instanceof AV.Op.Unset) {
14887 return new AV.Op.Set(this.value());
14888 } else if (previous instanceof AV.Op.Set) {
14889 return new AV.Op.Set(previous.value() | this.value());
14890 } else {
14891 throw new Error('Op is invalid after previous op.');
14892 }
14893 },
14894 _estimate: function _estimate(oldValue) {
14895 return oldValue | this.value();
14896 }
14897 });
14898
14899 AV.Op._registerDecoder('BitOr', function (json) {
14900 return new AV.Op.BitOr(json.value);
14901 });
14902 /**
14903 * @private
14904 * @class
14905 * BitXor is an atomic operation where the given value will be bit and to the
14906 * value than is stored in this field.
14907 */
14908
14909
14910 AV.Op.BitXor = AV.Op._extend(
14911 /** @lends AV.Op.BitXor.prototype */
14912 {
14913 _initialize: function _initialize(value) {
14914 this._value = value;
14915 },
14916 value: function value() {
14917 return this._value;
14918 },
14919
14920 /**
14921 * Returns a JSON version of the operation suitable for sending to AV.
14922 * @return {Object}
14923 */
14924 toJSON: function toJSON() {
14925 return {
14926 __op: 'BitXor',
14927 value: this.value()
14928 };
14929 },
14930 _mergeWithPrevious: function _mergeWithPrevious(previous) {
14931 if (!previous) {
14932 return this;
14933 } else if (previous instanceof AV.Op.Unset) {
14934 return new AV.Op.Set(this.value());
14935 } else if (previous instanceof AV.Op.Set) {
14936 return new AV.Op.Set(previous.value() ^ this.value());
14937 } else {
14938 throw new Error('Op is invalid after previous op.');
14939 }
14940 },
14941 _estimate: function _estimate(oldValue) {
14942 return oldValue ^ this.value();
14943 }
14944 });
14945
14946 AV.Op._registerDecoder('BitXor', function (json) {
14947 return new AV.Op.BitXor(json.value);
14948 });
14949 /**
14950 * @private
14951 * @class
14952 * Add is an atomic operation where the given objects will be appended to the
14953 * array that is stored in this field.
14954 */
14955
14956
14957 AV.Op.Add = AV.Op._extend(
14958 /** @lends AV.Op.Add.prototype */
14959 {
14960 _initialize: function _initialize(objects) {
14961 this._objects = objects;
14962 },
14963
14964 /**
14965 * Returns the objects to be added to the array.
14966 * @return {Array} The objects to be added to the array.
14967 */
14968 objects: function objects() {
14969 return this._objects;
14970 },
14971
14972 /**
14973 * Returns a JSON version of the operation suitable for sending to AV.
14974 * @return {Object}
14975 */
14976 toJSON: function toJSON() {
14977 return {
14978 __op: 'Add',
14979 objects: AV._encode(this.objects())
14980 };
14981 },
14982 _mergeWithPrevious: function _mergeWithPrevious(previous) {
14983 if (!previous) {
14984 return this;
14985 } else if (previous instanceof AV.Op.Unset) {
14986 return new AV.Op.Set(this.objects());
14987 } else if (previous instanceof AV.Op.Set) {
14988 return new AV.Op.Set(this._estimate(previous.value()));
14989 } else if (previous instanceof AV.Op.Add) {
14990 var _context;
14991
14992 return new AV.Op.Add((0, _concat.default)(_context = previous.objects()).call(_context, this.objects()));
14993 } else {
14994 throw new Error('Op is invalid after previous op.');
14995 }
14996 },
14997 _estimate: function _estimate(oldValue) {
14998 if (!oldValue) {
14999 return _.clone(this.objects());
15000 } else {
15001 return (0, _concat.default)(oldValue).call(oldValue, this.objects());
15002 }
15003 }
15004 });
15005
15006 AV.Op._registerDecoder('Add', function (json) {
15007 return new AV.Op.Add(AV._decode(json.objects));
15008 });
15009 /**
15010 * @private
15011 * @class
15012 * AddUnique is an atomic operation where the given items will be appended to
15013 * the array that is stored in this field only if they were not already
15014 * present in the array.
15015 */
15016
15017
15018 AV.Op.AddUnique = AV.Op._extend(
15019 /** @lends AV.Op.AddUnique.prototype */
15020 {
15021 _initialize: function _initialize(objects) {
15022 this._objects = _.uniq(objects);
15023 },
15024
15025 /**
15026 * Returns the objects to be added to the array.
15027 * @return {Array} The objects to be added to the array.
15028 */
15029 objects: function objects() {
15030 return this._objects;
15031 },
15032
15033 /**
15034 * Returns a JSON version of the operation suitable for sending to AV.
15035 * @return {Object}
15036 */
15037 toJSON: function toJSON() {
15038 return {
15039 __op: 'AddUnique',
15040 objects: AV._encode(this.objects())
15041 };
15042 },
15043 _mergeWithPrevious: function _mergeWithPrevious(previous) {
15044 if (!previous) {
15045 return this;
15046 } else if (previous instanceof AV.Op.Unset) {
15047 return new AV.Op.Set(this.objects());
15048 } else if (previous instanceof AV.Op.Set) {
15049 return new AV.Op.Set(this._estimate(previous.value()));
15050 } else if (previous instanceof AV.Op.AddUnique) {
15051 return new AV.Op.AddUnique(this._estimate(previous.objects()));
15052 } else {
15053 throw new Error('Op is invalid after previous op.');
15054 }
15055 },
15056 _estimate: function _estimate(oldValue) {
15057 if (!oldValue) {
15058 return _.clone(this.objects());
15059 } else {
15060 // We can't just take the _.uniq(_.union(...)) of oldValue and
15061 // this.objects, because the uniqueness may not apply to oldValue
15062 // (especially if the oldValue was set via .set())
15063 var newValue = _.clone(oldValue);
15064
15065 AV._arrayEach(this.objects(), function (obj) {
15066 if (obj instanceof AV.Object && obj.id) {
15067 var matchingObj = (0, _find.default)(_).call(_, newValue, function (anObj) {
15068 return anObj instanceof AV.Object && anObj.id === obj.id;
15069 });
15070
15071 if (!matchingObj) {
15072 newValue.push(obj);
15073 } else {
15074 var index = (0, _indexOf.default)(_).call(_, newValue, matchingObj);
15075 newValue[index] = obj;
15076 }
15077 } else if (!_.contains(newValue, obj)) {
15078 newValue.push(obj);
15079 }
15080 });
15081
15082 return newValue;
15083 }
15084 }
15085 });
15086
15087 AV.Op._registerDecoder('AddUnique', function (json) {
15088 return new AV.Op.AddUnique(AV._decode(json.objects));
15089 });
15090 /**
15091 * @private
15092 * @class
15093 * Remove is an atomic operation where the given objects will be removed from
15094 * the array that is stored in this field.
15095 */
15096
15097
15098 AV.Op.Remove = AV.Op._extend(
15099 /** @lends AV.Op.Remove.prototype */
15100 {
15101 _initialize: function _initialize(objects) {
15102 this._objects = _.uniq(objects);
15103 },
15104
15105 /**
15106 * Returns the objects to be removed from the array.
15107 * @return {Array} The objects to be removed from the array.
15108 */
15109 objects: function objects() {
15110 return this._objects;
15111 },
15112
15113 /**
15114 * Returns a JSON version of the operation suitable for sending to AV.
15115 * @return {Object}
15116 */
15117 toJSON: function toJSON() {
15118 return {
15119 __op: 'Remove',
15120 objects: AV._encode(this.objects())
15121 };
15122 },
15123 _mergeWithPrevious: function _mergeWithPrevious(previous) {
15124 if (!previous) {
15125 return this;
15126 } else if (previous instanceof AV.Op.Unset) {
15127 return previous;
15128 } else if (previous instanceof AV.Op.Set) {
15129 return new AV.Op.Set(this._estimate(previous.value()));
15130 } else if (previous instanceof AV.Op.Remove) {
15131 return new AV.Op.Remove(_.union(previous.objects(), this.objects()));
15132 } else {
15133 throw new Error('Op is invalid after previous op.');
15134 }
15135 },
15136 _estimate: function _estimate(oldValue) {
15137 if (!oldValue) {
15138 return [];
15139 } else {
15140 var newValue = _.difference(oldValue, this.objects()); // If there are saved AV Objects being removed, also remove them.
15141
15142
15143 AV._arrayEach(this.objects(), function (obj) {
15144 if (obj instanceof AV.Object && obj.id) {
15145 newValue = _.reject(newValue, function (other) {
15146 return other instanceof AV.Object && other.id === obj.id;
15147 });
15148 }
15149 });
15150
15151 return newValue;
15152 }
15153 }
15154 });
15155
15156 AV.Op._registerDecoder('Remove', function (json) {
15157 return new AV.Op.Remove(AV._decode(json.objects));
15158 });
15159 /**
15160 * @private
15161 * @class
15162 * A Relation operation indicates that the field is an instance of
15163 * AV.Relation, and objects are being added to, or removed from, that
15164 * relation.
15165 */
15166
15167
15168 AV.Op.Relation = AV.Op._extend(
15169 /** @lends AV.Op.Relation.prototype */
15170 {
15171 _initialize: function _initialize(adds, removes) {
15172 this._targetClassName = null;
15173 var self = this;
15174
15175 var pointerToId = function pointerToId(object) {
15176 if (object instanceof AV.Object) {
15177 if (!object.id) {
15178 throw new Error("You can't add an unsaved AV.Object to a relation.");
15179 }
15180
15181 if (!self._targetClassName) {
15182 self._targetClassName = object.className;
15183 }
15184
15185 if (self._targetClassName !== object.className) {
15186 throw new Error('Tried to create a AV.Relation with 2 different types: ' + self._targetClassName + ' and ' + object.className + '.');
15187 }
15188
15189 return object.id;
15190 }
15191
15192 return object;
15193 };
15194
15195 this.relationsToAdd = _.uniq((0, _map.default)(_).call(_, adds, pointerToId));
15196 this.relationsToRemove = _.uniq((0, _map.default)(_).call(_, removes, pointerToId));
15197 },
15198
15199 /**
15200 * Returns an array of unfetched AV.Object that are being added to the
15201 * relation.
15202 * @return {Array}
15203 */
15204 added: function added() {
15205 var self = this;
15206 return (0, _map.default)(_).call(_, this.relationsToAdd, function (objectId) {
15207 var object = AV.Object._create(self._targetClassName);
15208
15209 object.id = objectId;
15210 return object;
15211 });
15212 },
15213
15214 /**
15215 * Returns an array of unfetched AV.Object that are being removed from
15216 * the relation.
15217 * @return {Array}
15218 */
15219 removed: function removed() {
15220 var self = this;
15221 return (0, _map.default)(_).call(_, this.relationsToRemove, function (objectId) {
15222 var object = AV.Object._create(self._targetClassName);
15223
15224 object.id = objectId;
15225 return object;
15226 });
15227 },
15228
15229 /**
15230 * Returns a JSON version of the operation suitable for sending to AV.
15231 * @return {Object}
15232 */
15233 toJSON: function toJSON() {
15234 var adds = null;
15235 var removes = null;
15236 var self = this;
15237
15238 var idToPointer = function idToPointer(id) {
15239 return {
15240 __type: 'Pointer',
15241 className: self._targetClassName,
15242 objectId: id
15243 };
15244 };
15245
15246 var pointers = null;
15247
15248 if (this.relationsToAdd.length > 0) {
15249 pointers = (0, _map.default)(_).call(_, this.relationsToAdd, idToPointer);
15250 adds = {
15251 __op: 'AddRelation',
15252 objects: pointers
15253 };
15254 }
15255
15256 if (this.relationsToRemove.length > 0) {
15257 pointers = (0, _map.default)(_).call(_, this.relationsToRemove, idToPointer);
15258 removes = {
15259 __op: 'RemoveRelation',
15260 objects: pointers
15261 };
15262 }
15263
15264 if (adds && removes) {
15265 return {
15266 __op: 'Batch',
15267 ops: [adds, removes]
15268 };
15269 }
15270
15271 return adds || removes || {};
15272 },
15273 _mergeWithPrevious: function _mergeWithPrevious(previous) {
15274 if (!previous) {
15275 return this;
15276 } else if (previous instanceof AV.Op.Unset) {
15277 throw new Error("You can't modify a relation after deleting it.");
15278 } else if (previous instanceof AV.Op.Relation) {
15279 if (previous._targetClassName && previous._targetClassName !== this._targetClassName) {
15280 throw new Error('Related object must be of class ' + previous._targetClassName + ', but ' + this._targetClassName + ' was passed in.');
15281 }
15282
15283 var newAdd = _.union(_.difference(previous.relationsToAdd, this.relationsToRemove), this.relationsToAdd);
15284
15285 var newRemove = _.union(_.difference(previous.relationsToRemove, this.relationsToAdd), this.relationsToRemove);
15286
15287 var newRelation = new AV.Op.Relation(newAdd, newRemove);
15288 newRelation._targetClassName = this._targetClassName;
15289 return newRelation;
15290 } else {
15291 throw new Error('Op is invalid after previous op.');
15292 }
15293 },
15294 _estimate: function _estimate(oldValue, object, key) {
15295 if (!oldValue) {
15296 var relation = new AV.Relation(object, key);
15297 relation.targetClassName = this._targetClassName;
15298 } else if (oldValue instanceof AV.Relation) {
15299 if (this._targetClassName) {
15300 if (oldValue.targetClassName) {
15301 if (oldValue.targetClassName !== this._targetClassName) {
15302 throw new Error('Related object must be a ' + oldValue.targetClassName + ', but a ' + this._targetClassName + ' was passed in.');
15303 }
15304 } else {
15305 oldValue.targetClassName = this._targetClassName;
15306 }
15307 }
15308
15309 return oldValue;
15310 } else {
15311 throw new Error('Op is invalid after previous op.');
15312 }
15313 }
15314 });
15315
15316 AV.Op._registerDecoder('AddRelation', function (json) {
15317 return new AV.Op.Relation(AV._decode(json.objects), []);
15318 });
15319
15320 AV.Op._registerDecoder('RemoveRelation', function (json) {
15321 return new AV.Op.Relation([], AV._decode(json.objects));
15322 });
15323};
15324
15325/***/ }),
15326/* 475 */
15327/***/ (function(module, exports, __webpack_require__) {
15328
15329var parent = __webpack_require__(476);
15330
15331module.exports = parent;
15332
15333
15334/***/ }),
15335/* 476 */
15336/***/ (function(module, exports, __webpack_require__) {
15337
15338var isPrototypeOf = __webpack_require__(16);
15339var method = __webpack_require__(477);
15340
15341var ArrayPrototype = Array.prototype;
15342
15343module.exports = function (it) {
15344 var own = it.find;
15345 return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.find) ? method : own;
15346};
15347
15348
15349/***/ }),
15350/* 477 */
15351/***/ (function(module, exports, __webpack_require__) {
15352
15353__webpack_require__(478);
15354var entryVirtual = __webpack_require__(27);
15355
15356module.exports = entryVirtual('Array').find;
15357
15358
15359/***/ }),
15360/* 478 */
15361/***/ (function(module, exports, __webpack_require__) {
15362
15363"use strict";
15364
15365var $ = __webpack_require__(0);
15366var $find = __webpack_require__(75).find;
15367var addToUnscopables = __webpack_require__(131);
15368
15369var FIND = 'find';
15370var SKIPS_HOLES = true;
15371
15372// Shouldn't skip holes
15373if (FIND in []) Array(1)[FIND](function () { SKIPS_HOLES = false; });
15374
15375// `Array.prototype.find` method
15376// https://tc39.es/ecma262/#sec-array.prototype.find
15377$({ target: 'Array', proto: true, forced: SKIPS_HOLES }, {
15378 find: function find(callbackfn /* , that = undefined */) {
15379 return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
15380 }
15381});
15382
15383// https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
15384addToUnscopables(FIND);
15385
15386
15387/***/ }),
15388/* 479 */
15389/***/ (function(module, exports, __webpack_require__) {
15390
15391"use strict";
15392
15393
15394var _ = __webpack_require__(3);
15395
15396module.exports = function (AV) {
15397 /**
15398 * Creates a new Relation for the given parent object and key. This
15399 * constructor should rarely be used directly, but rather created by
15400 * {@link AV.Object#relation}.
15401 * @param {AV.Object} parent The parent of this relation.
15402 * @param {String} key The key for this relation on the parent.
15403 * @see AV.Object#relation
15404 * @class
15405 *
15406 * <p>
15407 * A class that is used to access all of the children of a many-to-many
15408 * relationship. Each instance of AV.Relation is associated with a
15409 * particular parent object and key.
15410 * </p>
15411 */
15412 AV.Relation = function (parent, key) {
15413 if (!_.isString(key)) {
15414 throw new TypeError('key must be a string');
15415 }
15416
15417 this.parent = parent;
15418 this.key = key;
15419 this.targetClassName = null;
15420 };
15421 /**
15422 * Creates a query that can be used to query the parent objects in this relation.
15423 * @param {String} parentClass The parent class or name.
15424 * @param {String} relationKey The relation field key in parent.
15425 * @param {AV.Object} child The child object.
15426 * @return {AV.Query}
15427 */
15428
15429
15430 AV.Relation.reverseQuery = function (parentClass, relationKey, child) {
15431 var query = new AV.Query(parentClass);
15432 query.equalTo(relationKey, child._toPointer());
15433 return query;
15434 };
15435
15436 _.extend(AV.Relation.prototype,
15437 /** @lends AV.Relation.prototype */
15438 {
15439 /**
15440 * Makes sure that this relation has the right parent and key.
15441 * @private
15442 */
15443 _ensureParentAndKey: function _ensureParentAndKey(parent, key) {
15444 this.parent = this.parent || parent;
15445 this.key = this.key || key;
15446
15447 if (this.parent !== parent) {
15448 throw new Error('Internal Error. Relation retrieved from two different Objects.');
15449 }
15450
15451 if (this.key !== key) {
15452 throw new Error('Internal Error. Relation retrieved from two different keys.');
15453 }
15454 },
15455
15456 /**
15457 * Adds a AV.Object or an array of AV.Objects to the relation.
15458 * @param {AV.Object|AV.Object[]} objects The item or items to add.
15459 */
15460 add: function add(objects) {
15461 if (!_.isArray(objects)) {
15462 objects = [objects];
15463 }
15464
15465 var change = new AV.Op.Relation(objects, []);
15466 this.parent.set(this.key, change);
15467 this.targetClassName = change._targetClassName;
15468 },
15469
15470 /**
15471 * Removes a AV.Object or an array of AV.Objects from this relation.
15472 * @param {AV.Object|AV.Object[]} objects The item or items to remove.
15473 */
15474 remove: function remove(objects) {
15475 if (!_.isArray(objects)) {
15476 objects = [objects];
15477 }
15478
15479 var change = new AV.Op.Relation([], objects);
15480 this.parent.set(this.key, change);
15481 this.targetClassName = change._targetClassName;
15482 },
15483
15484 /**
15485 * Returns a JSON version of the object suitable for saving to disk.
15486 * @return {Object}
15487 */
15488 toJSON: function toJSON() {
15489 return {
15490 __type: 'Relation',
15491 className: this.targetClassName
15492 };
15493 },
15494
15495 /**
15496 * Returns a AV.Query that is limited to objects in this
15497 * relation.
15498 * @return {AV.Query}
15499 */
15500 query: function query() {
15501 var targetClass;
15502 var query;
15503
15504 if (!this.targetClassName) {
15505 targetClass = AV.Object._getSubclass(this.parent.className);
15506 query = new AV.Query(targetClass);
15507 query._defaultParams.redirectClassNameForKey = this.key;
15508 } else {
15509 targetClass = AV.Object._getSubclass(this.targetClassName);
15510 query = new AV.Query(targetClass);
15511 }
15512
15513 query._addCondition('$relatedTo', 'object', this.parent._toPointer());
15514
15515 query._addCondition('$relatedTo', 'key', this.key);
15516
15517 return query;
15518 }
15519 });
15520};
15521
15522/***/ }),
15523/* 480 */
15524/***/ (function(module, exports, __webpack_require__) {
15525
15526"use strict";
15527
15528
15529var _interopRequireDefault = __webpack_require__(1);
15530
15531var _promise = _interopRequireDefault(__webpack_require__(12));
15532
15533var _ = __webpack_require__(3);
15534
15535var cos = __webpack_require__(481);
15536
15537var qiniu = __webpack_require__(482);
15538
15539var s3 = __webpack_require__(528);
15540
15541var AVError = __webpack_require__(48);
15542
15543var _require = __webpack_require__(28),
15544 request = _require.request,
15545 AVRequest = _require._request;
15546
15547var _require2 = __webpack_require__(32),
15548 tap = _require2.tap,
15549 transformFetchOptions = _require2.transformFetchOptions;
15550
15551var debug = __webpack_require__(63)('leancloud:file');
15552
15553var parseBase64 = __webpack_require__(532);
15554
15555module.exports = function (AV) {
15556 // port from browserify path module
15557 // since react-native packager won't shim node modules.
15558 var extname = function extname(path) {
15559 if (!_.isString(path)) return '';
15560 return path.match(/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/)[4];
15561 };
15562
15563 var b64Digit = function b64Digit(number) {
15564 if (number < 26) {
15565 return String.fromCharCode(65 + number);
15566 }
15567
15568 if (number < 52) {
15569 return String.fromCharCode(97 + (number - 26));
15570 }
15571
15572 if (number < 62) {
15573 return String.fromCharCode(48 + (number - 52));
15574 }
15575
15576 if (number === 62) {
15577 return '+';
15578 }
15579
15580 if (number === 63) {
15581 return '/';
15582 }
15583
15584 throw new Error('Tried to encode large digit ' + number + ' in base64.');
15585 };
15586
15587 var encodeBase64 = function encodeBase64(array) {
15588 var chunks = [];
15589 chunks.length = Math.ceil(array.length / 3);
15590
15591 _.times(chunks.length, function (i) {
15592 var b1 = array[i * 3];
15593 var b2 = array[i * 3 + 1] || 0;
15594 var b3 = array[i * 3 + 2] || 0;
15595 var has2 = i * 3 + 1 < array.length;
15596 var has3 = i * 3 + 2 < array.length;
15597 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('');
15598 });
15599
15600 return chunks.join('');
15601 };
15602 /**
15603 * An AV.File is a local representation of a file that is saved to the AV
15604 * cloud.
15605 * @param name {String} The file's name. This will change to a unique value
15606 * once the file has finished saving.
15607 * @param data {Array} The data for the file, as either:
15608 * 1. an Array of byte value Numbers, or
15609 * 2. an Object like { base64: "..." } with a base64-encoded String.
15610 * 3. a Blob(File) selected with a file upload control in a browser.
15611 * 4. an Object like { blob: {uri: "..."} } that mimics Blob
15612 * in some non-browser environments such as React Native.
15613 * 5. a Buffer in Node.js runtime.
15614 * 6. a Stream in Node.js runtime.
15615 *
15616 * For example:<pre>
15617 * var fileUploadControl = $("#profilePhotoFileUpload")[0];
15618 * if (fileUploadControl.files.length > 0) {
15619 * var file = fileUploadControl.files[0];
15620 * var name = "photo.jpg";
15621 * var file = new AV.File(name, file);
15622 * file.save().then(function() {
15623 * // The file has been saved to AV.
15624 * }, function(error) {
15625 * // The file either could not be read, or could not be saved to AV.
15626 * });
15627 * }</pre>
15628 *
15629 * @class
15630 * @param [mimeType] {String} Content-Type header to use for the file. If
15631 * this is omitted, the content type will be inferred from the name's
15632 * extension.
15633 */
15634
15635
15636 AV.File = function (name, data, mimeType) {
15637 this.attributes = {
15638 name: name,
15639 url: '',
15640 metaData: {},
15641 // 用来存储转换后要上传的 base64 String
15642 base64: ''
15643 };
15644
15645 if (_.isString(data)) {
15646 throw new TypeError('Creating an AV.File from a String is not yet supported.');
15647 }
15648
15649 if (_.isArray(data)) {
15650 this.attributes.metaData.size = data.length;
15651 data = {
15652 base64: encodeBase64(data)
15653 };
15654 }
15655
15656 this._extName = '';
15657 this._data = data;
15658 this._uploadHeaders = {};
15659
15660 if (data && data.blob && typeof data.blob.uri === 'string') {
15661 this._extName = extname(data.blob.uri);
15662 }
15663
15664 if (typeof Blob !== 'undefined' && data instanceof Blob) {
15665 if (data.size) {
15666 this.attributes.metaData.size = data.size;
15667 }
15668
15669 if (data.name) {
15670 this._extName = extname(data.name);
15671 }
15672 }
15673
15674 var owner;
15675
15676 if (data && data.owner) {
15677 owner = data.owner;
15678 } else if (!AV._config.disableCurrentUser) {
15679 try {
15680 owner = AV.User.current();
15681 } catch (error) {
15682 if ('SYNC_API_NOT_AVAILABLE' !== error.code) {
15683 throw error;
15684 }
15685 }
15686 }
15687
15688 this.attributes.metaData.owner = owner ? owner.id : 'unknown';
15689 this.set('mime_type', mimeType);
15690 };
15691 /**
15692 * Creates a fresh AV.File object with exists url for saving to AVOS Cloud.
15693 * @param {String} name the file name
15694 * @param {String} url the file url.
15695 * @param {Object} [metaData] the file metadata object.
15696 * @param {String} [type] Content-Type header to use for the file. If
15697 * this is omitted, the content type will be inferred from the name's
15698 * extension.
15699 * @return {AV.File} the file object
15700 */
15701
15702
15703 AV.File.withURL = function (name, url, metaData, type) {
15704 if (!name || !url) {
15705 throw new Error('Please provide file name and url');
15706 }
15707
15708 var file = new AV.File(name, null, type); //copy metaData properties to file.
15709
15710 if (metaData) {
15711 for (var prop in metaData) {
15712 if (!file.attributes.metaData[prop]) file.attributes.metaData[prop] = metaData[prop];
15713 }
15714 }
15715
15716 file.attributes.url = url; //Mark the file is from external source.
15717
15718 file.attributes.metaData.__source = 'external';
15719 file.attributes.metaData.size = 0;
15720 return file;
15721 };
15722 /**
15723 * Creates a file object with exists objectId.
15724 * @param {String} objectId The objectId string
15725 * @return {AV.File} the file object
15726 */
15727
15728
15729 AV.File.createWithoutData = function (objectId) {
15730 if (!objectId) {
15731 throw new TypeError('The objectId must be provided');
15732 }
15733
15734 var file = new AV.File();
15735 file.id = objectId;
15736 return file;
15737 };
15738 /**
15739 * Request file censor.
15740 * @since 4.13.0
15741 * @param {String} objectId
15742 * @return {Promise.<string>}
15743 */
15744
15745
15746 AV.File.censor = function (objectId) {
15747 if (!AV._config.masterKey) {
15748 throw new Error('Cannot censor a file without masterKey');
15749 }
15750
15751 return request({
15752 method: 'POST',
15753 path: "/files/".concat(objectId, "/censor"),
15754 authOptions: {
15755 useMasterKey: true
15756 }
15757 }).then(function (res) {
15758 return res.censorResult;
15759 });
15760 };
15761
15762 _.extend(AV.File.prototype,
15763 /** @lends AV.File.prototype */
15764 {
15765 className: '_File',
15766 _toFullJSON: function _toFullJSON(seenObjects) {
15767 var _this = this;
15768
15769 var full = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
15770
15771 var json = _.clone(this.attributes);
15772
15773 AV._objectEach(json, function (val, key) {
15774 json[key] = AV._encode(val, seenObjects, undefined, full);
15775 });
15776
15777 AV._objectEach(this._operations, function (val, key) {
15778 json[key] = val;
15779 });
15780
15781 if (_.has(this, 'id')) {
15782 json.objectId = this.id;
15783 }
15784
15785 ['createdAt', 'updatedAt'].forEach(function (key) {
15786 if (_.has(_this, key)) {
15787 var val = _this[key];
15788 json[key] = _.isDate(val) ? val.toJSON() : val;
15789 }
15790 });
15791
15792 if (full) {
15793 json.__type = 'File';
15794 }
15795
15796 return json;
15797 },
15798
15799 /**
15800 * Returns a JSON version of the file with meta data.
15801 * Inverse to {@link AV.parseJSON}
15802 * @since 3.0.0
15803 * @return {Object}
15804 */
15805 toFullJSON: function toFullJSON() {
15806 var seenObjects = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
15807 return this._toFullJSON(seenObjects);
15808 },
15809
15810 /**
15811 * Returns a JSON version of the object.
15812 * @return {Object}
15813 */
15814 toJSON: function toJSON(key, holder) {
15815 var seenObjects = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [this];
15816 return this._toFullJSON(seenObjects, false);
15817 },
15818
15819 /**
15820 * Gets a Pointer referencing this file.
15821 * @private
15822 */
15823 _toPointer: function _toPointer() {
15824 return {
15825 __type: 'Pointer',
15826 className: this.className,
15827 objectId: this.id
15828 };
15829 },
15830
15831 /**
15832 * Returns the ACL for this file.
15833 * @returns {AV.ACL} An instance of AV.ACL.
15834 */
15835 getACL: function getACL() {
15836 return this._acl;
15837 },
15838
15839 /**
15840 * Sets the ACL to be used for this file.
15841 * @param {AV.ACL} acl An instance of AV.ACL.
15842 */
15843 setACL: function setACL(acl) {
15844 if (!(acl instanceof AV.ACL)) {
15845 return new AVError(AVError.OTHER_CAUSE, 'ACL must be a AV.ACL.');
15846 }
15847
15848 this._acl = acl;
15849 return this;
15850 },
15851
15852 /**
15853 * Gets the name of the file. Before save is called, this is the filename
15854 * given by the user. After save is called, that name gets prefixed with a
15855 * unique identifier.
15856 */
15857 name: function name() {
15858 return this.get('name');
15859 },
15860
15861 /**
15862 * Gets the url of the file. It is only available after you save the file or
15863 * after you get the file from a AV.Object.
15864 * @return {String}
15865 */
15866 url: function url() {
15867 return this.get('url');
15868 },
15869
15870 /**
15871 * Gets the attributs of the file object.
15872 * @param {String} The attribute name which want to get.
15873 * @returns {Any}
15874 */
15875 get: function get(attrName) {
15876 switch (attrName) {
15877 case 'objectId':
15878 return this.id;
15879
15880 case 'url':
15881 case 'name':
15882 case 'mime_type':
15883 case 'metaData':
15884 case 'createdAt':
15885 case 'updatedAt':
15886 return this.attributes[attrName];
15887
15888 default:
15889 return this.attributes.metaData[attrName];
15890 }
15891 },
15892
15893 /**
15894 * Set the metaData of the file object.
15895 * @param {Object} Object is an key value Object for setting metaData.
15896 * @param {String} attr is an optional metadata key.
15897 * @param {Object} value is an optional metadata value.
15898 * @returns {String|Number|Array|Object}
15899 */
15900 set: function set() {
15901 var _this2 = this;
15902
15903 var set = function set(attrName, value) {
15904 switch (attrName) {
15905 case 'name':
15906 case 'url':
15907 case 'mime_type':
15908 case 'base64':
15909 case 'metaData':
15910 _this2.attributes[attrName] = value;
15911 break;
15912
15913 default:
15914 // File 并非一个 AVObject,不能完全自定义其他属性,所以只能都放在 metaData 上面
15915 _this2.attributes.metaData[attrName] = value;
15916 break;
15917 }
15918 };
15919
15920 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
15921 args[_key] = arguments[_key];
15922 }
15923
15924 switch (args.length) {
15925 case 1:
15926 // 传入一个 Object
15927 for (var k in args[0]) {
15928 set(k, args[0][k]);
15929 }
15930
15931 break;
15932
15933 case 2:
15934 set(args[0], args[1]);
15935 break;
15936 }
15937
15938 return this;
15939 },
15940
15941 /**
15942 * Set a header for the upload request.
15943 * For more infomation, go to https://url.leanapp.cn/avfile-upload-headers
15944 *
15945 * @param {String} key header key
15946 * @param {String} value header value
15947 * @return {AV.File} this
15948 */
15949 setUploadHeader: function setUploadHeader(key, value) {
15950 this._uploadHeaders[key] = value;
15951 return this;
15952 },
15953
15954 /**
15955 * <p>Returns the file's metadata JSON object if no arguments is given.Returns the
15956 * metadata value if a key is given.Set metadata value if key and value are both given.</p>
15957 * <p><pre>
15958 * var metadata = file.metaData(); //Get metadata JSON object.
15959 * var size = file.metaData('size'); // Get the size metadata value.
15960 * file.metaData('format', 'jpeg'); //set metadata attribute and value.
15961 *</pre></p>
15962 * @return {Object} The file's metadata JSON object.
15963 * @param {String} attr an optional metadata key.
15964 * @param {Object} value an optional metadata value.
15965 **/
15966 metaData: function metaData(attr, value) {
15967 if (attr && value) {
15968 this.attributes.metaData[attr] = value;
15969 return this;
15970 } else if (attr && !value) {
15971 return this.attributes.metaData[attr];
15972 } else {
15973 return this.attributes.metaData;
15974 }
15975 },
15976
15977 /**
15978 * 如果文件是图片,获取图片的缩略图URL。可以传入宽度、高度、质量、格式等参数。
15979 * @return {String} 缩略图URL
15980 * @param {Number} width 宽度,单位:像素
15981 * @param {Number} heigth 高度,单位:像素
15982 * @param {Number} quality 质量,1-100的数字,默认100
15983 * @param {Number} scaleToFit 是否将图片自适应大小。默认为true。
15984 * @param {String} fmt 格式,默认为png,也可以为jpeg,gif等格式。
15985 */
15986 thumbnailURL: function thumbnailURL(width, height) {
15987 var quality = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 100;
15988 var scaleToFit = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
15989 var fmt = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 'png';
15990 var url = this.attributes.url;
15991
15992 if (!url) {
15993 throw new Error('Invalid url.');
15994 }
15995
15996 if (!width || !height || width <= 0 || height <= 0) {
15997 throw new Error('Invalid width or height value.');
15998 }
15999
16000 if (quality <= 0 || quality > 100) {
16001 throw new Error('Invalid quality value.');
16002 }
16003
16004 var mode = scaleToFit ? 2 : 1;
16005 return url + '?imageView/' + mode + '/w/' + width + '/h/' + height + '/q/' + quality + '/format/' + fmt;
16006 },
16007
16008 /**
16009 * Returns the file's size.
16010 * @return {Number} The file's size in bytes.
16011 **/
16012 size: function size() {
16013 return this.metaData().size;
16014 },
16015
16016 /**
16017 * Returns the file's owner.
16018 * @return {String} The file's owner id.
16019 */
16020 ownerId: function ownerId() {
16021 return this.metaData().owner;
16022 },
16023
16024 /**
16025 * Destroy the file.
16026 * @param {AuthOptions} options
16027 * @return {Promise} A promise that is fulfilled when the destroy
16028 * completes.
16029 */
16030 destroy: function destroy(options) {
16031 if (!this.id) {
16032 return _promise.default.reject(new Error('The file id does not eixst.'));
16033 }
16034
16035 var request = AVRequest('files', null, this.id, 'DELETE', null, options);
16036 return request;
16037 },
16038
16039 /**
16040 * Request Qiniu upload token
16041 * @param {string} type
16042 * @return {Promise} Resolved with the response
16043 * @private
16044 */
16045 _fileToken: function _fileToken(type, authOptions) {
16046 var name = this.attributes.name;
16047 var extName = extname(name);
16048
16049 if (!extName && this._extName) {
16050 name += this._extName;
16051 extName = this._extName;
16052 }
16053
16054 var data = {
16055 name: name,
16056 keep_file_name: authOptions.keepFileName,
16057 key: authOptions.key,
16058 ACL: this._acl,
16059 mime_type: type,
16060 metaData: this.attributes.metaData
16061 };
16062 return AVRequest('fileTokens', null, null, 'POST', data, authOptions);
16063 },
16064
16065 /**
16066 * @callback UploadProgressCallback
16067 * @param {XMLHttpRequestProgressEvent} event - The progress event with 'loaded' and 'total' attributes
16068 */
16069
16070 /**
16071 * Saves the file to the AV cloud.
16072 * @param {AuthOptions} [options] AuthOptions plus:
16073 * @param {UploadProgressCallback} [options.onprogress] 文件上传进度,在 Node.js 中无效,回调参数说明详见 {@link UploadProgressCallback}。
16074 * @param {boolean} [options.keepFileName = false] 保留下载文件的文件名。
16075 * @param {string} [options.key] 指定文件的 key。设置该选项需要使用 masterKey
16076 * @return {Promise} Promise that is resolved when the save finishes.
16077 */
16078 save: function save() {
16079 var _this3 = this;
16080
16081 var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
16082
16083 if (this.id) {
16084 throw new Error('File is already saved.');
16085 }
16086
16087 if (!this._previousSave) {
16088 if (this._data) {
16089 var mimeType = this.get('mime_type');
16090 this._previousSave = this._fileToken(mimeType, options).then(function (uploadInfo) {
16091 if (uploadInfo.mime_type) {
16092 mimeType = uploadInfo.mime_type;
16093
16094 _this3.set('mime_type', mimeType);
16095 }
16096
16097 _this3._token = uploadInfo.token;
16098 return _promise.default.resolve().then(function () {
16099 var data = _this3._data;
16100
16101 if (data && data.base64) {
16102 return parseBase64(data.base64, mimeType);
16103 }
16104
16105 if (data && data.blob) {
16106 if (!data.blob.type && mimeType) {
16107 data.blob.type = mimeType;
16108 }
16109
16110 if (!data.blob.name) {
16111 data.blob.name = _this3.get('name');
16112 }
16113
16114 return data.blob;
16115 }
16116
16117 if (typeof Blob !== 'undefined' && data instanceof Blob) {
16118 return data;
16119 }
16120
16121 throw new TypeError('malformed file data');
16122 }).then(function (data) {
16123 var _options = _.extend({}, options); // filter out download progress events
16124
16125
16126 if (options.onprogress) {
16127 _options.onprogress = function (event) {
16128 if (event.direction === 'download') return;
16129 return options.onprogress(event);
16130 };
16131 }
16132
16133 switch (uploadInfo.provider) {
16134 case 's3':
16135 return s3(uploadInfo, data, _this3, _options);
16136
16137 case 'qcloud':
16138 return cos(uploadInfo, data, _this3, _options);
16139
16140 case 'qiniu':
16141 default:
16142 return qiniu(uploadInfo, data, _this3, _options);
16143 }
16144 }).then(tap(function () {
16145 return _this3._callback(true);
16146 }), function (error) {
16147 _this3._callback(false);
16148
16149 throw error;
16150 });
16151 });
16152 } else if (this.attributes.url && this.attributes.metaData.__source === 'external') {
16153 // external link file.
16154 var data = {
16155 name: this.attributes.name,
16156 ACL: this._acl,
16157 metaData: this.attributes.metaData,
16158 mime_type: this.mimeType,
16159 url: this.attributes.url
16160 };
16161 this._previousSave = AVRequest('files', null, null, 'post', data, options).then(function (response) {
16162 _this3.id = response.objectId;
16163 return _this3;
16164 });
16165 }
16166 }
16167
16168 return this._previousSave;
16169 },
16170 _callback: function _callback(success) {
16171 AVRequest('fileCallback', null, null, 'post', {
16172 token: this._token,
16173 result: success
16174 }).catch(debug);
16175 delete this._token;
16176 delete this._data;
16177 },
16178
16179 /**
16180 * fetch the file from server. If the server's representation of the
16181 * model differs from its current attributes, they will be overriden,
16182 * @param {Object} fetchOptions Optional options to set 'keys',
16183 * 'include' and 'includeACL' option.
16184 * @param {AuthOptions} options
16185 * @return {Promise} A promise that is fulfilled when the fetch
16186 * completes.
16187 */
16188 fetch: function fetch(fetchOptions, options) {
16189 if (!this.id) {
16190 throw new Error('Cannot fetch unsaved file');
16191 }
16192
16193 var request = AVRequest('files', null, this.id, 'GET', transformFetchOptions(fetchOptions), options);
16194 return request.then(this._finishFetch.bind(this));
16195 },
16196 _finishFetch: function _finishFetch(response) {
16197 var value = AV.Object.prototype.parse(response);
16198 value.attributes = {
16199 name: value.name,
16200 url: value.url,
16201 mime_type: value.mime_type,
16202 bucket: value.bucket
16203 };
16204 value.attributes.metaData = value.metaData || {};
16205 value.id = value.objectId; // clean
16206
16207 delete value.objectId;
16208 delete value.metaData;
16209 delete value.url;
16210 delete value.name;
16211 delete value.mime_type;
16212 delete value.bucket;
16213
16214 _.extend(this, value);
16215
16216 return this;
16217 },
16218
16219 /**
16220 * Request file censor
16221 * @since 4.13.0
16222 * @return {Promise.<string>}
16223 */
16224 censor: function censor() {
16225 if (!this.id) {
16226 throw new Error('Cannot censor an unsaved file');
16227 }
16228
16229 return AV.File.censor(this.id);
16230 }
16231 });
16232};
16233
16234/***/ }),
16235/* 481 */
16236/***/ (function(module, exports, __webpack_require__) {
16237
16238"use strict";
16239
16240
16241var _require = __webpack_require__(76),
16242 getAdapter = _require.getAdapter;
16243
16244var debug = __webpack_require__(63)('cos');
16245
16246module.exports = function (uploadInfo, data, file) {
16247 var saveOptions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
16248 var url = uploadInfo.upload_url + '?sign=' + encodeURIComponent(uploadInfo.token);
16249 var fileFormData = {
16250 field: 'fileContent',
16251 data: data,
16252 name: file.attributes.name
16253 };
16254 var options = {
16255 headers: file._uploadHeaders,
16256 data: {
16257 op: 'upload'
16258 },
16259 onprogress: saveOptions.onprogress
16260 };
16261 debug('url: %s, file: %o, options: %o', url, fileFormData, options);
16262 var upload = getAdapter('upload');
16263 return upload(url, fileFormData, options).then(function (response) {
16264 debug(response.status, response.data);
16265
16266 if (response.ok === false) {
16267 var error = new Error(response.status);
16268 error.response = response;
16269 throw error;
16270 }
16271
16272 file.attributes.url = uploadInfo.url;
16273 file._bucket = uploadInfo.bucket;
16274 file.id = uploadInfo.objectId;
16275 return file;
16276 }, function (error) {
16277 var response = error.response;
16278
16279 if (response) {
16280 debug(response.status, response.data);
16281 error.statusCode = response.status;
16282 error.response = response.data;
16283 }
16284
16285 throw error;
16286 });
16287};
16288
16289/***/ }),
16290/* 482 */
16291/***/ (function(module, exports, __webpack_require__) {
16292
16293"use strict";
16294
16295
16296var _sliceInstanceProperty2 = __webpack_require__(34);
16297
16298var _Array$from = __webpack_require__(152);
16299
16300var _Symbol = __webpack_require__(77);
16301
16302var _getIteratorMethod = __webpack_require__(252);
16303
16304var _Reflect$construct = __webpack_require__(492);
16305
16306var _interopRequireDefault = __webpack_require__(1);
16307
16308var _inherits2 = _interopRequireDefault(__webpack_require__(496));
16309
16310var _possibleConstructorReturn2 = _interopRequireDefault(__webpack_require__(518));
16311
16312var _getPrototypeOf2 = _interopRequireDefault(__webpack_require__(520));
16313
16314var _classCallCheck2 = _interopRequireDefault(__webpack_require__(525));
16315
16316var _createClass2 = _interopRequireDefault(__webpack_require__(526));
16317
16318var _stringify = _interopRequireDefault(__webpack_require__(38));
16319
16320var _concat = _interopRequireDefault(__webpack_require__(19));
16321
16322var _promise = _interopRequireDefault(__webpack_require__(12));
16323
16324var _slice = _interopRequireDefault(__webpack_require__(34));
16325
16326function _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); }; }
16327
16328function _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; } }
16329
16330function _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; } } }; }
16331
16332function _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); }
16333
16334function _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; }
16335
16336var _require = __webpack_require__(76),
16337 getAdapter = _require.getAdapter;
16338
16339var debug = __webpack_require__(63)('leancloud:qiniu');
16340
16341var ajax = __webpack_require__(117);
16342
16343var btoa = __webpack_require__(527);
16344
16345var SHARD_THRESHOLD = 1024 * 1024 * 64;
16346var CHUNK_SIZE = 1024 * 1024 * 16;
16347
16348function upload(uploadInfo, data, file) {
16349 var saveOptions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
16350 // Get the uptoken to upload files to qiniu.
16351 var uptoken = uploadInfo.token;
16352 var url = uploadInfo.upload_url || 'https://upload.qiniup.com';
16353 var fileFormData = {
16354 field: 'file',
16355 data: data,
16356 name: file.attributes.name
16357 };
16358 var options = {
16359 headers: file._uploadHeaders,
16360 data: {
16361 name: file.attributes.name,
16362 key: uploadInfo.key,
16363 token: uptoken
16364 },
16365 onprogress: saveOptions.onprogress
16366 };
16367 debug('url: %s, file: %o, options: %o', url, fileFormData, options);
16368 var upload = getAdapter('upload');
16369 return upload(url, fileFormData, options).then(function (response) {
16370 debug(response.status, response.data);
16371
16372 if (response.ok === false) {
16373 var message = response.status;
16374
16375 if (response.data) {
16376 if (response.data.error) {
16377 message = response.data.error;
16378 } else {
16379 message = (0, _stringify.default)(response.data);
16380 }
16381 }
16382
16383 var error = new Error(message);
16384 error.response = response;
16385 throw error;
16386 }
16387
16388 file.attributes.url = uploadInfo.url;
16389 file._bucket = uploadInfo.bucket;
16390 file.id = uploadInfo.objectId;
16391 return file;
16392 }, function (error) {
16393 var response = error.response;
16394
16395 if (response) {
16396 debug(response.status, response.data);
16397 error.statusCode = response.status;
16398 error.response = response.data;
16399 }
16400
16401 throw error;
16402 });
16403}
16404
16405function urlSafeBase64(string) {
16406 var base64 = btoa(unescape(encodeURIComponent(string)));
16407 var result = '';
16408
16409 var _iterator = _createForOfIteratorHelper(base64),
16410 _step;
16411
16412 try {
16413 for (_iterator.s(); !(_step = _iterator.n()).done;) {
16414 var ch = _step.value;
16415
16416 switch (ch) {
16417 case '+':
16418 result += '-';
16419 break;
16420
16421 case '/':
16422 result += '_';
16423 break;
16424
16425 default:
16426 result += ch;
16427 }
16428 }
16429 } catch (err) {
16430 _iterator.e(err);
16431 } finally {
16432 _iterator.f();
16433 }
16434
16435 return result;
16436}
16437
16438var ShardUploader = /*#__PURE__*/function () {
16439 function ShardUploader(uploadInfo, data, file, saveOptions) {
16440 var _context,
16441 _context2,
16442 _this = this;
16443
16444 (0, _classCallCheck2.default)(this, ShardUploader);
16445 this.uploadInfo = uploadInfo;
16446 this.data = data;
16447 this.file = file;
16448 this.size = undefined;
16449 this.offset = 0;
16450 this.uploadedChunks = 0;
16451 var key = urlSafeBase64(uploadInfo.key);
16452 var uploadURL = uploadInfo.upload_url || 'https://upload.qiniup.com';
16453 this.baseURL = (0, _concat.default)(_context = (0, _concat.default)(_context2 = "".concat(uploadURL, "/buckets/")).call(_context2, uploadInfo.bucket, "/objects/")).call(_context, key, "/uploads");
16454 this.upToken = 'UpToken ' + uploadInfo.token;
16455 this.uploaded = 0;
16456
16457 if (saveOptions && saveOptions.onprogress) {
16458 this.onProgress = function (_ref) {
16459 var loaded = _ref.loaded;
16460 loaded += _this.uploadedChunks * CHUNK_SIZE;
16461
16462 if (loaded <= _this.uploaded) {
16463 return;
16464 }
16465
16466 if (_this.size) {
16467 saveOptions.onprogress({
16468 loaded: loaded,
16469 total: _this.size,
16470 percent: loaded / _this.size * 100
16471 });
16472 } else {
16473 saveOptions.onprogress({
16474 loaded: loaded
16475 });
16476 }
16477
16478 _this.uploaded = loaded;
16479 };
16480 }
16481 }
16482 /**
16483 * @returns {Promise<string>}
16484 */
16485
16486
16487 (0, _createClass2.default)(ShardUploader, [{
16488 key: "getUploadId",
16489 value: function getUploadId() {
16490 return ajax({
16491 method: 'POST',
16492 url: this.baseURL,
16493 headers: {
16494 Authorization: this.upToken
16495 }
16496 }).then(function (res) {
16497 return res.uploadId;
16498 });
16499 }
16500 }, {
16501 key: "getChunk",
16502 value: function getChunk() {
16503 throw new Error('Not implemented');
16504 }
16505 /**
16506 * @param {string} uploadId
16507 * @param {number} partNumber
16508 * @param {any} data
16509 * @returns {Promise<{ partNumber: number, etag: string }>}
16510 */
16511
16512 }, {
16513 key: "uploadPart",
16514 value: function uploadPart(uploadId, partNumber, data) {
16515 var _context3, _context4;
16516
16517 return ajax({
16518 method: 'PUT',
16519 url: (0, _concat.default)(_context3 = (0, _concat.default)(_context4 = "".concat(this.baseURL, "/")).call(_context4, uploadId, "/")).call(_context3, partNumber),
16520 headers: {
16521 Authorization: this.upToken
16522 },
16523 data: data,
16524 onprogress: this.onProgress
16525 }).then(function (_ref2) {
16526 var etag = _ref2.etag;
16527 return {
16528 partNumber: partNumber,
16529 etag: etag
16530 };
16531 });
16532 }
16533 }, {
16534 key: "stopUpload",
16535 value: function stopUpload(uploadId) {
16536 var _context5;
16537
16538 return ajax({
16539 method: 'DELETE',
16540 url: (0, _concat.default)(_context5 = "".concat(this.baseURL, "/")).call(_context5, uploadId),
16541 headers: {
16542 Authorization: this.upToken
16543 }
16544 });
16545 }
16546 }, {
16547 key: "upload",
16548 value: function upload() {
16549 var _this2 = this;
16550
16551 var parts = [];
16552 return this.getUploadId().then(function (uploadId) {
16553 var uploadPart = function uploadPart() {
16554 return _promise.default.resolve(_this2.getChunk()).then(function (chunk) {
16555 if (!chunk) {
16556 return;
16557 }
16558
16559 var partNumber = parts.length + 1;
16560 return _this2.uploadPart(uploadId, partNumber, chunk).then(function (part) {
16561 parts.push(part);
16562 _this2.uploadedChunks++;
16563 return uploadPart();
16564 });
16565 }).catch(function (error) {
16566 return _this2.stopUpload(uploadId).then(function () {
16567 return _promise.default.reject(error);
16568 });
16569 });
16570 };
16571
16572 return uploadPart().then(function () {
16573 var _context6;
16574
16575 return ajax({
16576 method: 'POST',
16577 url: (0, _concat.default)(_context6 = "".concat(_this2.baseURL, "/")).call(_context6, uploadId),
16578 headers: {
16579 Authorization: _this2.upToken
16580 },
16581 data: {
16582 parts: parts,
16583 fname: _this2.file.attributes.name,
16584 mimeType: _this2.file.attributes.mime_type
16585 }
16586 });
16587 });
16588 }).then(function () {
16589 _this2.file.attributes.url = _this2.uploadInfo.url;
16590 _this2.file._bucket = _this2.uploadInfo.bucket;
16591 _this2.file.id = _this2.uploadInfo.objectId;
16592 return _this2.file;
16593 });
16594 }
16595 }]);
16596 return ShardUploader;
16597}();
16598
16599var BlobUploader = /*#__PURE__*/function (_ShardUploader) {
16600 (0, _inherits2.default)(BlobUploader, _ShardUploader);
16601
16602 var _super = _createSuper(BlobUploader);
16603
16604 function BlobUploader(uploadInfo, data, file, saveOptions) {
16605 var _this3;
16606
16607 (0, _classCallCheck2.default)(this, BlobUploader);
16608 _this3 = _super.call(this, uploadInfo, data, file, saveOptions);
16609 _this3.size = data.size;
16610 return _this3;
16611 }
16612 /**
16613 * @returns {Blob | null}
16614 */
16615
16616
16617 (0, _createClass2.default)(BlobUploader, [{
16618 key: "getChunk",
16619 value: function getChunk() {
16620 var _context7;
16621
16622 if (this.offset >= this.size) {
16623 return null;
16624 }
16625
16626 var chunk = (0, _slice.default)(_context7 = this.data).call(_context7, this.offset, this.offset + CHUNK_SIZE);
16627 this.offset += chunk.size;
16628 return chunk;
16629 }
16630 }]);
16631 return BlobUploader;
16632}(ShardUploader);
16633
16634function isBlob(data) {
16635 return typeof Blob !== 'undefined' && data instanceof Blob;
16636}
16637
16638module.exports = function (uploadInfo, data, file) {
16639 var saveOptions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
16640
16641 if (isBlob(data) && data.size >= SHARD_THRESHOLD) {
16642 return new BlobUploader(uploadInfo, data, file, saveOptions).upload();
16643 }
16644
16645 return upload(uploadInfo, data, file, saveOptions);
16646};
16647
16648/***/ }),
16649/* 483 */
16650/***/ (function(module, exports, __webpack_require__) {
16651
16652__webpack_require__(70);
16653__webpack_require__(484);
16654var path = __webpack_require__(7);
16655
16656module.exports = path.Array.from;
16657
16658
16659/***/ }),
16660/* 484 */
16661/***/ (function(module, exports, __webpack_require__) {
16662
16663var $ = __webpack_require__(0);
16664var from = __webpack_require__(485);
16665var checkCorrectnessOfIteration = __webpack_require__(177);
16666
16667var INCORRECT_ITERATION = !checkCorrectnessOfIteration(function (iterable) {
16668 // eslint-disable-next-line es-x/no-array-from -- required for testing
16669 Array.from(iterable);
16670});
16671
16672// `Array.from` method
16673// https://tc39.es/ecma262/#sec-array.from
16674$({ target: 'Array', stat: true, forced: INCORRECT_ITERATION }, {
16675 from: from
16676});
16677
16678
16679/***/ }),
16680/* 485 */
16681/***/ (function(module, exports, __webpack_require__) {
16682
16683"use strict";
16684
16685var bind = __webpack_require__(52);
16686var call = __webpack_require__(15);
16687var toObject = __webpack_require__(33);
16688var callWithSafeIterationClosing = __webpack_require__(486);
16689var isArrayIteratorMethod = __webpack_require__(165);
16690var isConstructor = __webpack_require__(111);
16691var lengthOfArrayLike = __webpack_require__(40);
16692var createProperty = __webpack_require__(93);
16693var getIterator = __webpack_require__(166);
16694var getIteratorMethod = __webpack_require__(108);
16695
16696var $Array = Array;
16697
16698// `Array.from` method implementation
16699// https://tc39.es/ecma262/#sec-array.from
16700module.exports = function from(arrayLike /* , mapfn = undefined, thisArg = undefined */) {
16701 var O = toObject(arrayLike);
16702 var IS_CONSTRUCTOR = isConstructor(this);
16703 var argumentsLength = arguments.length;
16704 var mapfn = argumentsLength > 1 ? arguments[1] : undefined;
16705 var mapping = mapfn !== undefined;
16706 if (mapping) mapfn = bind(mapfn, argumentsLength > 2 ? arguments[2] : undefined);
16707 var iteratorMethod = getIteratorMethod(O);
16708 var index = 0;
16709 var length, result, step, iterator, next, value;
16710 // if the target is not iterable or it's an array with the default iterator - use a simple case
16711 if (iteratorMethod && !(this === $Array && isArrayIteratorMethod(iteratorMethod))) {
16712 iterator = getIterator(O, iteratorMethod);
16713 next = iterator.next;
16714 result = IS_CONSTRUCTOR ? new this() : [];
16715 for (;!(step = call(next, iterator)).done; index++) {
16716 value = mapping ? callWithSafeIterationClosing(iterator, mapfn, [step.value, index], true) : step.value;
16717 createProperty(result, index, value);
16718 }
16719 } else {
16720 length = lengthOfArrayLike(O);
16721 result = IS_CONSTRUCTOR ? new this(length) : $Array(length);
16722 for (;length > index; index++) {
16723 value = mapping ? mapfn(O[index], index) : O[index];
16724 createProperty(result, index, value);
16725 }
16726 }
16727 result.length = index;
16728 return result;
16729};
16730
16731
16732/***/ }),
16733/* 486 */
16734/***/ (function(module, exports, __webpack_require__) {
16735
16736var anObject = __webpack_require__(21);
16737var iteratorClose = __webpack_require__(167);
16738
16739// call something on iterator step with safe closing on error
16740module.exports = function (iterator, fn, value, ENTRIES) {
16741 try {
16742 return ENTRIES ? fn(anObject(value)[0], value[1]) : fn(value);
16743 } catch (error) {
16744 iteratorClose(iterator, 'throw', error);
16745 }
16746};
16747
16748
16749/***/ }),
16750/* 487 */
16751/***/ (function(module, exports, __webpack_require__) {
16752
16753module.exports = __webpack_require__(488);
16754
16755
16756/***/ }),
16757/* 488 */
16758/***/ (function(module, exports, __webpack_require__) {
16759
16760var parent = __webpack_require__(489);
16761
16762module.exports = parent;
16763
16764
16765/***/ }),
16766/* 489 */
16767/***/ (function(module, exports, __webpack_require__) {
16768
16769var parent = __webpack_require__(490);
16770
16771module.exports = parent;
16772
16773
16774/***/ }),
16775/* 490 */
16776/***/ (function(module, exports, __webpack_require__) {
16777
16778var parent = __webpack_require__(491);
16779__webpack_require__(46);
16780
16781module.exports = parent;
16782
16783
16784/***/ }),
16785/* 491 */
16786/***/ (function(module, exports, __webpack_require__) {
16787
16788__webpack_require__(43);
16789__webpack_require__(70);
16790var getIteratorMethod = __webpack_require__(108);
16791
16792module.exports = getIteratorMethod;
16793
16794
16795/***/ }),
16796/* 492 */
16797/***/ (function(module, exports, __webpack_require__) {
16798
16799module.exports = __webpack_require__(493);
16800
16801/***/ }),
16802/* 493 */
16803/***/ (function(module, exports, __webpack_require__) {
16804
16805var parent = __webpack_require__(494);
16806
16807module.exports = parent;
16808
16809
16810/***/ }),
16811/* 494 */
16812/***/ (function(module, exports, __webpack_require__) {
16813
16814__webpack_require__(495);
16815var path = __webpack_require__(7);
16816
16817module.exports = path.Reflect.construct;
16818
16819
16820/***/ }),
16821/* 495 */
16822/***/ (function(module, exports, __webpack_require__) {
16823
16824var $ = __webpack_require__(0);
16825var getBuiltIn = __webpack_require__(20);
16826var apply = __webpack_require__(79);
16827var bind = __webpack_require__(253);
16828var aConstructor = __webpack_require__(173);
16829var anObject = __webpack_require__(21);
16830var isObject = __webpack_require__(11);
16831var create = __webpack_require__(53);
16832var fails = __webpack_require__(2);
16833
16834var nativeConstruct = getBuiltIn('Reflect', 'construct');
16835var ObjectPrototype = Object.prototype;
16836var push = [].push;
16837
16838// `Reflect.construct` method
16839// https://tc39.es/ecma262/#sec-reflect.construct
16840// MS Edge supports only 2 arguments and argumentsList argument is optional
16841// FF Nightly sets third argument as `new.target`, but does not create `this` from it
16842var NEW_TARGET_BUG = fails(function () {
16843 function F() { /* empty */ }
16844 return !(nativeConstruct(function () { /* empty */ }, [], F) instanceof F);
16845});
16846
16847var ARGS_BUG = !fails(function () {
16848 nativeConstruct(function () { /* empty */ });
16849});
16850
16851var FORCED = NEW_TARGET_BUG || ARGS_BUG;
16852
16853$({ target: 'Reflect', stat: true, forced: FORCED, sham: FORCED }, {
16854 construct: function construct(Target, args /* , newTarget */) {
16855 aConstructor(Target);
16856 anObject(args);
16857 var newTarget = arguments.length < 3 ? Target : aConstructor(arguments[2]);
16858 if (ARGS_BUG && !NEW_TARGET_BUG) return nativeConstruct(Target, args, newTarget);
16859 if (Target == newTarget) {
16860 // w/o altered newTarget, optimization for 0-4 arguments
16861 switch (args.length) {
16862 case 0: return new Target();
16863 case 1: return new Target(args[0]);
16864 case 2: return new Target(args[0], args[1]);
16865 case 3: return new Target(args[0], args[1], args[2]);
16866 case 4: return new Target(args[0], args[1], args[2], args[3]);
16867 }
16868 // w/o altered newTarget, lot of arguments case
16869 var $args = [null];
16870 apply(push, $args, args);
16871 return new (apply(bind, Target, $args))();
16872 }
16873 // with altered newTarget, not support built-in constructors
16874 var proto = newTarget.prototype;
16875 var instance = create(isObject(proto) ? proto : ObjectPrototype);
16876 var result = apply(Target, instance, args);
16877 return isObject(result) ? result : instance;
16878 }
16879});
16880
16881
16882/***/ }),
16883/* 496 */
16884/***/ (function(module, exports, __webpack_require__) {
16885
16886var _Object$create = __webpack_require__(497);
16887
16888var _Object$defineProperty = __webpack_require__(153);
16889
16890var setPrototypeOf = __webpack_require__(507);
16891
16892function _inherits(subClass, superClass) {
16893 if (typeof superClass !== "function" && superClass !== null) {
16894 throw new TypeError("Super expression must either be null or a function");
16895 }
16896
16897 subClass.prototype = _Object$create(superClass && superClass.prototype, {
16898 constructor: {
16899 value: subClass,
16900 writable: true,
16901 configurable: true
16902 }
16903 });
16904
16905 _Object$defineProperty(subClass, "prototype", {
16906 writable: false
16907 });
16908
16909 if (superClass) setPrototypeOf(subClass, superClass);
16910}
16911
16912module.exports = _inherits, module.exports.__esModule = true, module.exports["default"] = module.exports;
16913
16914/***/ }),
16915/* 497 */
16916/***/ (function(module, exports, __webpack_require__) {
16917
16918module.exports = __webpack_require__(498);
16919
16920/***/ }),
16921/* 498 */
16922/***/ (function(module, exports, __webpack_require__) {
16923
16924module.exports = __webpack_require__(499);
16925
16926
16927/***/ }),
16928/* 499 */
16929/***/ (function(module, exports, __webpack_require__) {
16930
16931var parent = __webpack_require__(500);
16932
16933module.exports = parent;
16934
16935
16936/***/ }),
16937/* 500 */
16938/***/ (function(module, exports, __webpack_require__) {
16939
16940var parent = __webpack_require__(501);
16941
16942module.exports = parent;
16943
16944
16945/***/ }),
16946/* 501 */
16947/***/ (function(module, exports, __webpack_require__) {
16948
16949var parent = __webpack_require__(502);
16950
16951module.exports = parent;
16952
16953
16954/***/ }),
16955/* 502 */
16956/***/ (function(module, exports, __webpack_require__) {
16957
16958__webpack_require__(503);
16959var path = __webpack_require__(7);
16960
16961var Object = path.Object;
16962
16963module.exports = function create(P, D) {
16964 return Object.create(P, D);
16965};
16966
16967
16968/***/ }),
16969/* 503 */
16970/***/ (function(module, exports, __webpack_require__) {
16971
16972// TODO: Remove from `core-js@4`
16973var $ = __webpack_require__(0);
16974var DESCRIPTORS = __webpack_require__(14);
16975var create = __webpack_require__(53);
16976
16977// `Object.create` method
16978// https://tc39.es/ecma262/#sec-object.create
16979$({ target: 'Object', stat: true, sham: !DESCRIPTORS }, {
16980 create: create
16981});
16982
16983
16984/***/ }),
16985/* 504 */
16986/***/ (function(module, exports, __webpack_require__) {
16987
16988module.exports = __webpack_require__(505);
16989
16990
16991/***/ }),
16992/* 505 */
16993/***/ (function(module, exports, __webpack_require__) {
16994
16995var parent = __webpack_require__(506);
16996
16997module.exports = parent;
16998
16999
17000/***/ }),
17001/* 506 */
17002/***/ (function(module, exports, __webpack_require__) {
17003
17004var parent = __webpack_require__(239);
17005
17006module.exports = parent;
17007
17008
17009/***/ }),
17010/* 507 */
17011/***/ (function(module, exports, __webpack_require__) {
17012
17013var _Object$setPrototypeOf = __webpack_require__(254);
17014
17015var _bindInstanceProperty = __webpack_require__(255);
17016
17017function _setPrototypeOf(o, p) {
17018 var _context;
17019
17020 module.exports = _setPrototypeOf = _Object$setPrototypeOf ? _bindInstanceProperty(_context = _Object$setPrototypeOf).call(_context) : function _setPrototypeOf(o, p) {
17021 o.__proto__ = p;
17022 return o;
17023 }, module.exports.__esModule = true, module.exports["default"] = module.exports;
17024 return _setPrototypeOf(o, p);
17025}
17026
17027module.exports = _setPrototypeOf, module.exports.__esModule = true, module.exports["default"] = module.exports;
17028
17029/***/ }),
17030/* 508 */
17031/***/ (function(module, exports, __webpack_require__) {
17032
17033module.exports = __webpack_require__(509);
17034
17035
17036/***/ }),
17037/* 509 */
17038/***/ (function(module, exports, __webpack_require__) {
17039
17040var parent = __webpack_require__(510);
17041
17042module.exports = parent;
17043
17044
17045/***/ }),
17046/* 510 */
17047/***/ (function(module, exports, __webpack_require__) {
17048
17049var parent = __webpack_require__(237);
17050
17051module.exports = parent;
17052
17053
17054/***/ }),
17055/* 511 */
17056/***/ (function(module, exports, __webpack_require__) {
17057
17058module.exports = __webpack_require__(512);
17059
17060
17061/***/ }),
17062/* 512 */
17063/***/ (function(module, exports, __webpack_require__) {
17064
17065var parent = __webpack_require__(513);
17066
17067module.exports = parent;
17068
17069
17070/***/ }),
17071/* 513 */
17072/***/ (function(module, exports, __webpack_require__) {
17073
17074var parent = __webpack_require__(514);
17075
17076module.exports = parent;
17077
17078
17079/***/ }),
17080/* 514 */
17081/***/ (function(module, exports, __webpack_require__) {
17082
17083var parent = __webpack_require__(515);
17084
17085module.exports = parent;
17086
17087
17088/***/ }),
17089/* 515 */
17090/***/ (function(module, exports, __webpack_require__) {
17091
17092var isPrototypeOf = __webpack_require__(16);
17093var method = __webpack_require__(516);
17094
17095var FunctionPrototype = Function.prototype;
17096
17097module.exports = function (it) {
17098 var own = it.bind;
17099 return it === FunctionPrototype || (isPrototypeOf(FunctionPrototype, it) && own === FunctionPrototype.bind) ? method : own;
17100};
17101
17102
17103/***/ }),
17104/* 516 */
17105/***/ (function(module, exports, __webpack_require__) {
17106
17107__webpack_require__(517);
17108var entryVirtual = __webpack_require__(27);
17109
17110module.exports = entryVirtual('Function').bind;
17111
17112
17113/***/ }),
17114/* 517 */
17115/***/ (function(module, exports, __webpack_require__) {
17116
17117// TODO: Remove from `core-js@4`
17118var $ = __webpack_require__(0);
17119var bind = __webpack_require__(253);
17120
17121// `Function.prototype.bind` method
17122// https://tc39.es/ecma262/#sec-function.prototype.bind
17123$({ target: 'Function', proto: true, forced: Function.bind !== bind }, {
17124 bind: bind
17125});
17126
17127
17128/***/ }),
17129/* 518 */
17130/***/ (function(module, exports, __webpack_require__) {
17131
17132var _typeof = __webpack_require__(95)["default"];
17133
17134var assertThisInitialized = __webpack_require__(519);
17135
17136function _possibleConstructorReturn(self, call) {
17137 if (call && (_typeof(call) === "object" || typeof call === "function")) {
17138 return call;
17139 } else if (call !== void 0) {
17140 throw new TypeError("Derived constructors may only return object or undefined");
17141 }
17142
17143 return assertThisInitialized(self);
17144}
17145
17146module.exports = _possibleConstructorReturn, module.exports.__esModule = true, module.exports["default"] = module.exports;
17147
17148/***/ }),
17149/* 519 */
17150/***/ (function(module, exports) {
17151
17152function _assertThisInitialized(self) {
17153 if (self === void 0) {
17154 throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
17155 }
17156
17157 return self;
17158}
17159
17160module.exports = _assertThisInitialized, module.exports.__esModule = true, module.exports["default"] = module.exports;
17161
17162/***/ }),
17163/* 520 */
17164/***/ (function(module, exports, __webpack_require__) {
17165
17166var _Object$setPrototypeOf = __webpack_require__(254);
17167
17168var _bindInstanceProperty = __webpack_require__(255);
17169
17170var _Object$getPrototypeOf = __webpack_require__(521);
17171
17172function _getPrototypeOf(o) {
17173 var _context;
17174
17175 module.exports = _getPrototypeOf = _Object$setPrototypeOf ? _bindInstanceProperty(_context = _Object$getPrototypeOf).call(_context) : function _getPrototypeOf(o) {
17176 return o.__proto__ || _Object$getPrototypeOf(o);
17177 }, module.exports.__esModule = true, module.exports["default"] = module.exports;
17178 return _getPrototypeOf(o);
17179}
17180
17181module.exports = _getPrototypeOf, module.exports.__esModule = true, module.exports["default"] = module.exports;
17182
17183/***/ }),
17184/* 521 */
17185/***/ (function(module, exports, __webpack_require__) {
17186
17187module.exports = __webpack_require__(522);
17188
17189/***/ }),
17190/* 522 */
17191/***/ (function(module, exports, __webpack_require__) {
17192
17193module.exports = __webpack_require__(523);
17194
17195
17196/***/ }),
17197/* 523 */
17198/***/ (function(module, exports, __webpack_require__) {
17199
17200var parent = __webpack_require__(524);
17201
17202module.exports = parent;
17203
17204
17205/***/ }),
17206/* 524 */
17207/***/ (function(module, exports, __webpack_require__) {
17208
17209var parent = __webpack_require__(232);
17210
17211module.exports = parent;
17212
17213
17214/***/ }),
17215/* 525 */
17216/***/ (function(module, exports) {
17217
17218function _classCallCheck(instance, Constructor) {
17219 if (!(instance instanceof Constructor)) {
17220 throw new TypeError("Cannot call a class as a function");
17221 }
17222}
17223
17224module.exports = _classCallCheck, module.exports.__esModule = true, module.exports["default"] = module.exports;
17225
17226/***/ }),
17227/* 526 */
17228/***/ (function(module, exports, __webpack_require__) {
17229
17230var _Object$defineProperty = __webpack_require__(153);
17231
17232function _defineProperties(target, props) {
17233 for (var i = 0; i < props.length; i++) {
17234 var descriptor = props[i];
17235 descriptor.enumerable = descriptor.enumerable || false;
17236 descriptor.configurable = true;
17237 if ("value" in descriptor) descriptor.writable = true;
17238
17239 _Object$defineProperty(target, descriptor.key, descriptor);
17240 }
17241}
17242
17243function _createClass(Constructor, protoProps, staticProps) {
17244 if (protoProps) _defineProperties(Constructor.prototype, protoProps);
17245 if (staticProps) _defineProperties(Constructor, staticProps);
17246
17247 _Object$defineProperty(Constructor, "prototype", {
17248 writable: false
17249 });
17250
17251 return Constructor;
17252}
17253
17254module.exports = _createClass, module.exports.__esModule = true, module.exports["default"] = module.exports;
17255
17256/***/ }),
17257/* 527 */
17258/***/ (function(module, exports, __webpack_require__) {
17259
17260"use strict";
17261
17262
17263var _interopRequireDefault = __webpack_require__(1);
17264
17265var _slice = _interopRequireDefault(__webpack_require__(34));
17266
17267// base64 character set, plus padding character (=)
17268var b64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
17269
17270module.exports = function (string) {
17271 var result = '';
17272
17273 for (var i = 0; i < string.length;) {
17274 var a = string.charCodeAt(i++);
17275 var b = string.charCodeAt(i++);
17276 var c = string.charCodeAt(i++);
17277
17278 if (a > 255 || b > 255 || c > 255) {
17279 throw new TypeError('Failed to encode base64: The string to be encoded contains characters outside of the Latin1 range.');
17280 }
17281
17282 var bitmap = a << 16 | b << 8 | c;
17283 result += b64.charAt(bitmap >> 18 & 63) + b64.charAt(bitmap >> 12 & 63) + b64.charAt(bitmap >> 6 & 63) + b64.charAt(bitmap & 63);
17284 } // To determine the final padding
17285
17286
17287 var rest = string.length % 3; // If there's need of padding, replace the last 'A's with equal signs
17288
17289 return rest ? (0, _slice.default)(result).call(result, 0, rest - 3) + '==='.substring(rest) : result;
17290};
17291
17292/***/ }),
17293/* 528 */
17294/***/ (function(module, exports, __webpack_require__) {
17295
17296"use strict";
17297
17298
17299var _ = __webpack_require__(3);
17300
17301var ajax = __webpack_require__(117);
17302
17303module.exports = function upload(uploadInfo, data, file) {
17304 var saveOptions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
17305 return ajax({
17306 url: uploadInfo.upload_url,
17307 method: 'PUT',
17308 data: data,
17309 headers: _.extend({
17310 'Content-Type': file.get('mime_type'),
17311 'Cache-Control': 'public, max-age=31536000'
17312 }, file._uploadHeaders),
17313 onprogress: saveOptions.onprogress
17314 }).then(function () {
17315 file.attributes.url = uploadInfo.url;
17316 file._bucket = uploadInfo.bucket;
17317 file.id = uploadInfo.objectId;
17318 return file;
17319 });
17320};
17321
17322/***/ }),
17323/* 529 */
17324/***/ (function(module, exports, __webpack_require__) {
17325
17326(function(){
17327 var crypt = __webpack_require__(530),
17328 utf8 = __webpack_require__(256).utf8,
17329 isBuffer = __webpack_require__(531),
17330 bin = __webpack_require__(256).bin,
17331
17332 // The core
17333 md5 = function (message, options) {
17334 // Convert to byte array
17335 if (message.constructor == String)
17336 if (options && options.encoding === 'binary')
17337 message = bin.stringToBytes(message);
17338 else
17339 message = utf8.stringToBytes(message);
17340 else if (isBuffer(message))
17341 message = Array.prototype.slice.call(message, 0);
17342 else if (!Array.isArray(message))
17343 message = message.toString();
17344 // else, assume byte array already
17345
17346 var m = crypt.bytesToWords(message),
17347 l = message.length * 8,
17348 a = 1732584193,
17349 b = -271733879,
17350 c = -1732584194,
17351 d = 271733878;
17352
17353 // Swap endian
17354 for (var i = 0; i < m.length; i++) {
17355 m[i] = ((m[i] << 8) | (m[i] >>> 24)) & 0x00FF00FF |
17356 ((m[i] << 24) | (m[i] >>> 8)) & 0xFF00FF00;
17357 }
17358
17359 // Padding
17360 m[l >>> 5] |= 0x80 << (l % 32);
17361 m[(((l + 64) >>> 9) << 4) + 14] = l;
17362
17363 // Method shortcuts
17364 var FF = md5._ff,
17365 GG = md5._gg,
17366 HH = md5._hh,
17367 II = md5._ii;
17368
17369 for (var i = 0; i < m.length; i += 16) {
17370
17371 var aa = a,
17372 bb = b,
17373 cc = c,
17374 dd = d;
17375
17376 a = FF(a, b, c, d, m[i+ 0], 7, -680876936);
17377 d = FF(d, a, b, c, m[i+ 1], 12, -389564586);
17378 c = FF(c, d, a, b, m[i+ 2], 17, 606105819);
17379 b = FF(b, c, d, a, m[i+ 3], 22, -1044525330);
17380 a = FF(a, b, c, d, m[i+ 4], 7, -176418897);
17381 d = FF(d, a, b, c, m[i+ 5], 12, 1200080426);
17382 c = FF(c, d, a, b, m[i+ 6], 17, -1473231341);
17383 b = FF(b, c, d, a, m[i+ 7], 22, -45705983);
17384 a = FF(a, b, c, d, m[i+ 8], 7, 1770035416);
17385 d = FF(d, a, b, c, m[i+ 9], 12, -1958414417);
17386 c = FF(c, d, a, b, m[i+10], 17, -42063);
17387 b = FF(b, c, d, a, m[i+11], 22, -1990404162);
17388 a = FF(a, b, c, d, m[i+12], 7, 1804603682);
17389 d = FF(d, a, b, c, m[i+13], 12, -40341101);
17390 c = FF(c, d, a, b, m[i+14], 17, -1502002290);
17391 b = FF(b, c, d, a, m[i+15], 22, 1236535329);
17392
17393 a = GG(a, b, c, d, m[i+ 1], 5, -165796510);
17394 d = GG(d, a, b, c, m[i+ 6], 9, -1069501632);
17395 c = GG(c, d, a, b, m[i+11], 14, 643717713);
17396 b = GG(b, c, d, a, m[i+ 0], 20, -373897302);
17397 a = GG(a, b, c, d, m[i+ 5], 5, -701558691);
17398 d = GG(d, a, b, c, m[i+10], 9, 38016083);
17399 c = GG(c, d, a, b, m[i+15], 14, -660478335);
17400 b = GG(b, c, d, a, m[i+ 4], 20, -405537848);
17401 a = GG(a, b, c, d, m[i+ 9], 5, 568446438);
17402 d = GG(d, a, b, c, m[i+14], 9, -1019803690);
17403 c = GG(c, d, a, b, m[i+ 3], 14, -187363961);
17404 b = GG(b, c, d, a, m[i+ 8], 20, 1163531501);
17405 a = GG(a, b, c, d, m[i+13], 5, -1444681467);
17406 d = GG(d, a, b, c, m[i+ 2], 9, -51403784);
17407 c = GG(c, d, a, b, m[i+ 7], 14, 1735328473);
17408 b = GG(b, c, d, a, m[i+12], 20, -1926607734);
17409
17410 a = HH(a, b, c, d, m[i+ 5], 4, -378558);
17411 d = HH(d, a, b, c, m[i+ 8], 11, -2022574463);
17412 c = HH(c, d, a, b, m[i+11], 16, 1839030562);
17413 b = HH(b, c, d, a, m[i+14], 23, -35309556);
17414 a = HH(a, b, c, d, m[i+ 1], 4, -1530992060);
17415 d = HH(d, a, b, c, m[i+ 4], 11, 1272893353);
17416 c = HH(c, d, a, b, m[i+ 7], 16, -155497632);
17417 b = HH(b, c, d, a, m[i+10], 23, -1094730640);
17418 a = HH(a, b, c, d, m[i+13], 4, 681279174);
17419 d = HH(d, a, b, c, m[i+ 0], 11, -358537222);
17420 c = HH(c, d, a, b, m[i+ 3], 16, -722521979);
17421 b = HH(b, c, d, a, m[i+ 6], 23, 76029189);
17422 a = HH(a, b, c, d, m[i+ 9], 4, -640364487);
17423 d = HH(d, a, b, c, m[i+12], 11, -421815835);
17424 c = HH(c, d, a, b, m[i+15], 16, 530742520);
17425 b = HH(b, c, d, a, m[i+ 2], 23, -995338651);
17426
17427 a = II(a, b, c, d, m[i+ 0], 6, -198630844);
17428 d = II(d, a, b, c, m[i+ 7], 10, 1126891415);
17429 c = II(c, d, a, b, m[i+14], 15, -1416354905);
17430 b = II(b, c, d, a, m[i+ 5], 21, -57434055);
17431 a = II(a, b, c, d, m[i+12], 6, 1700485571);
17432 d = II(d, a, b, c, m[i+ 3], 10, -1894986606);
17433 c = II(c, d, a, b, m[i+10], 15, -1051523);
17434 b = II(b, c, d, a, m[i+ 1], 21, -2054922799);
17435 a = II(a, b, c, d, m[i+ 8], 6, 1873313359);
17436 d = II(d, a, b, c, m[i+15], 10, -30611744);
17437 c = II(c, d, a, b, m[i+ 6], 15, -1560198380);
17438 b = II(b, c, d, a, m[i+13], 21, 1309151649);
17439 a = II(a, b, c, d, m[i+ 4], 6, -145523070);
17440 d = II(d, a, b, c, m[i+11], 10, -1120210379);
17441 c = II(c, d, a, b, m[i+ 2], 15, 718787259);
17442 b = II(b, c, d, a, m[i+ 9], 21, -343485551);
17443
17444 a = (a + aa) >>> 0;
17445 b = (b + bb) >>> 0;
17446 c = (c + cc) >>> 0;
17447 d = (d + dd) >>> 0;
17448 }
17449
17450 return crypt.endian([a, b, c, d]);
17451 };
17452
17453 // Auxiliary functions
17454 md5._ff = function (a, b, c, d, x, s, t) {
17455 var n = a + (b & c | ~b & d) + (x >>> 0) + t;
17456 return ((n << s) | (n >>> (32 - s))) + b;
17457 };
17458 md5._gg = function (a, b, c, d, x, s, t) {
17459 var n = a + (b & d | c & ~d) + (x >>> 0) + t;
17460 return ((n << s) | (n >>> (32 - s))) + b;
17461 };
17462 md5._hh = function (a, b, c, d, x, s, t) {
17463 var n = a + (b ^ c ^ d) + (x >>> 0) + t;
17464 return ((n << s) | (n >>> (32 - s))) + b;
17465 };
17466 md5._ii = function (a, b, c, d, x, s, t) {
17467 var n = a + (c ^ (b | ~d)) + (x >>> 0) + t;
17468 return ((n << s) | (n >>> (32 - s))) + b;
17469 };
17470
17471 // Package private blocksize
17472 md5._blocksize = 16;
17473 md5._digestsize = 16;
17474
17475 module.exports = function (message, options) {
17476 if (message === undefined || message === null)
17477 throw new Error('Illegal argument ' + message);
17478
17479 var digestbytes = crypt.wordsToBytes(md5(message, options));
17480 return options && options.asBytes ? digestbytes :
17481 options && options.asString ? bin.bytesToString(digestbytes) :
17482 crypt.bytesToHex(digestbytes);
17483 };
17484
17485})();
17486
17487
17488/***/ }),
17489/* 530 */
17490/***/ (function(module, exports) {
17491
17492(function() {
17493 var base64map
17494 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/',
17495
17496 crypt = {
17497 // Bit-wise rotation left
17498 rotl: function(n, b) {
17499 return (n << b) | (n >>> (32 - b));
17500 },
17501
17502 // Bit-wise rotation right
17503 rotr: function(n, b) {
17504 return (n << (32 - b)) | (n >>> b);
17505 },
17506
17507 // Swap big-endian to little-endian and vice versa
17508 endian: function(n) {
17509 // If number given, swap endian
17510 if (n.constructor == Number) {
17511 return crypt.rotl(n, 8) & 0x00FF00FF | crypt.rotl(n, 24) & 0xFF00FF00;
17512 }
17513
17514 // Else, assume array and swap all items
17515 for (var i = 0; i < n.length; i++)
17516 n[i] = crypt.endian(n[i]);
17517 return n;
17518 },
17519
17520 // Generate an array of any length of random bytes
17521 randomBytes: function(n) {
17522 for (var bytes = []; n > 0; n--)
17523 bytes.push(Math.floor(Math.random() * 256));
17524 return bytes;
17525 },
17526
17527 // Convert a byte array to big-endian 32-bit words
17528 bytesToWords: function(bytes) {
17529 for (var words = [], i = 0, b = 0; i < bytes.length; i++, b += 8)
17530 words[b >>> 5] |= bytes[i] << (24 - b % 32);
17531 return words;
17532 },
17533
17534 // Convert big-endian 32-bit words to a byte array
17535 wordsToBytes: function(words) {
17536 for (var bytes = [], b = 0; b < words.length * 32; b += 8)
17537 bytes.push((words[b >>> 5] >>> (24 - b % 32)) & 0xFF);
17538 return bytes;
17539 },
17540
17541 // Convert a byte array to a hex string
17542 bytesToHex: function(bytes) {
17543 for (var hex = [], i = 0; i < bytes.length; i++) {
17544 hex.push((bytes[i] >>> 4).toString(16));
17545 hex.push((bytes[i] & 0xF).toString(16));
17546 }
17547 return hex.join('');
17548 },
17549
17550 // Convert a hex string to a byte array
17551 hexToBytes: function(hex) {
17552 for (var bytes = [], c = 0; c < hex.length; c += 2)
17553 bytes.push(parseInt(hex.substr(c, 2), 16));
17554 return bytes;
17555 },
17556
17557 // Convert a byte array to a base-64 string
17558 bytesToBase64: function(bytes) {
17559 for (var base64 = [], i = 0; i < bytes.length; i += 3) {
17560 var triplet = (bytes[i] << 16) | (bytes[i + 1] << 8) | bytes[i + 2];
17561 for (var j = 0; j < 4; j++)
17562 if (i * 8 + j * 6 <= bytes.length * 8)
17563 base64.push(base64map.charAt((triplet >>> 6 * (3 - j)) & 0x3F));
17564 else
17565 base64.push('=');
17566 }
17567 return base64.join('');
17568 },
17569
17570 // Convert a base-64 string to a byte array
17571 base64ToBytes: function(base64) {
17572 // Remove non-base-64 characters
17573 base64 = base64.replace(/[^A-Z0-9+\/]/ig, '');
17574
17575 for (var bytes = [], i = 0, imod4 = 0; i < base64.length;
17576 imod4 = ++i % 4) {
17577 if (imod4 == 0) continue;
17578 bytes.push(((base64map.indexOf(base64.charAt(i - 1))
17579 & (Math.pow(2, -2 * imod4 + 8) - 1)) << (imod4 * 2))
17580 | (base64map.indexOf(base64.charAt(i)) >>> (6 - imod4 * 2)));
17581 }
17582 return bytes;
17583 }
17584 };
17585
17586 module.exports = crypt;
17587})();
17588
17589
17590/***/ }),
17591/* 531 */
17592/***/ (function(module, exports) {
17593
17594/*!
17595 * Determine if an object is a Buffer
17596 *
17597 * @author Feross Aboukhadijeh <https://feross.org>
17598 * @license MIT
17599 */
17600
17601// The _isBuffer check is for Safari 5-7 support, because it's missing
17602// Object.prototype.constructor. Remove this eventually
17603module.exports = function (obj) {
17604 return obj != null && (isBuffer(obj) || isSlowBuffer(obj) || !!obj._isBuffer)
17605}
17606
17607function isBuffer (obj) {
17608 return !!obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj)
17609}
17610
17611// For Node v0.10 support. Remove this eventually.
17612function isSlowBuffer (obj) {
17613 return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isBuffer(obj.slice(0, 0))
17614}
17615
17616
17617/***/ }),
17618/* 532 */
17619/***/ (function(module, exports, __webpack_require__) {
17620
17621"use strict";
17622
17623
17624var _interopRequireDefault = __webpack_require__(1);
17625
17626var _indexOf = _interopRequireDefault(__webpack_require__(61));
17627
17628var dataURItoBlob = function dataURItoBlob(dataURI, type) {
17629 var _context;
17630
17631 var byteString; // 传入的 base64,不是 dataURL
17632
17633 if ((0, _indexOf.default)(dataURI).call(dataURI, 'base64') < 0) {
17634 byteString = atob(dataURI);
17635 } else if ((0, _indexOf.default)(_context = dataURI.split(',')[0]).call(_context, 'base64') >= 0) {
17636 type = type || dataURI.split(',')[0].split(':')[1].split(';')[0];
17637 byteString = atob(dataURI.split(',')[1]);
17638 } else {
17639 byteString = unescape(dataURI.split(',')[1]);
17640 }
17641
17642 var ia = new Uint8Array(byteString.length);
17643
17644 for (var i = 0; i < byteString.length; i++) {
17645 ia[i] = byteString.charCodeAt(i);
17646 }
17647
17648 return new Blob([ia], {
17649 type: type
17650 });
17651};
17652
17653module.exports = dataURItoBlob;
17654
17655/***/ }),
17656/* 533 */
17657/***/ (function(module, exports, __webpack_require__) {
17658
17659"use strict";
17660
17661
17662var _interopRequireDefault = __webpack_require__(1);
17663
17664var _slicedToArray2 = _interopRequireDefault(__webpack_require__(534));
17665
17666var _map = _interopRequireDefault(__webpack_require__(37));
17667
17668var _indexOf = _interopRequireDefault(__webpack_require__(61));
17669
17670var _find = _interopRequireDefault(__webpack_require__(96));
17671
17672var _promise = _interopRequireDefault(__webpack_require__(12));
17673
17674var _concat = _interopRequireDefault(__webpack_require__(19));
17675
17676var _keys2 = _interopRequireDefault(__webpack_require__(62));
17677
17678var _stringify = _interopRequireDefault(__webpack_require__(38));
17679
17680var _defineProperty = _interopRequireDefault(__webpack_require__(94));
17681
17682var _getOwnPropertyDescriptor = _interopRequireDefault(__webpack_require__(257));
17683
17684var _ = __webpack_require__(3);
17685
17686var AVError = __webpack_require__(48);
17687
17688var _require = __webpack_require__(28),
17689 _request = _require._request;
17690
17691var _require2 = __webpack_require__(32),
17692 isNullOrUndefined = _require2.isNullOrUndefined,
17693 ensureArray = _require2.ensureArray,
17694 transformFetchOptions = _require2.transformFetchOptions,
17695 setValue = _require2.setValue,
17696 findValue = _require2.findValue,
17697 isPlainObject = _require2.isPlainObject,
17698 continueWhile = _require2.continueWhile;
17699
17700var recursiveToPointer = function recursiveToPointer(value) {
17701 if (_.isArray(value)) return (0, _map.default)(value).call(value, recursiveToPointer);
17702 if (isPlainObject(value)) return _.mapObject(value, recursiveToPointer);
17703 if (_.isObject(value) && value._toPointer) return value._toPointer();
17704 return value;
17705};
17706
17707var RESERVED_KEYS = ['objectId', 'createdAt', 'updatedAt'];
17708
17709var checkReservedKey = function checkReservedKey(key) {
17710 if ((0, _indexOf.default)(RESERVED_KEYS).call(RESERVED_KEYS, key) !== -1) {
17711 throw new Error("key[".concat(key, "] is reserved"));
17712 }
17713};
17714
17715var handleBatchResults = function handleBatchResults(results) {
17716 var firstError = (0, _find.default)(_).call(_, results, function (result) {
17717 return result instanceof Error;
17718 });
17719
17720 if (!firstError) {
17721 return results;
17722 }
17723
17724 var error = new AVError(firstError.code, firstError.message);
17725 error.results = results;
17726 throw error;
17727}; // Helper function to get a value from a Backbone object as a property
17728// or as a function.
17729
17730
17731function getValue(object, prop) {
17732 if (!(object && object[prop])) {
17733 return null;
17734 }
17735
17736 return _.isFunction(object[prop]) ? object[prop]() : object[prop];
17737} // AV.Object is analogous to the Java AVObject.
17738// It also implements the same interface as a Backbone model.
17739
17740
17741module.exports = function (AV) {
17742 /**
17743 * Creates a new model with defined attributes. A client id (cid) is
17744 * automatically generated and assigned for you.
17745 *
17746 * <p>You won't normally call this method directly. It is recommended that
17747 * you use a subclass of <code>AV.Object</code> instead, created by calling
17748 * <code>extend</code>.</p>
17749 *
17750 * <p>However, if you don't want to use a subclass, or aren't sure which
17751 * subclass is appropriate, you can use this form:<pre>
17752 * var object = new AV.Object("ClassName");
17753 * </pre>
17754 * That is basically equivalent to:<pre>
17755 * var MyClass = AV.Object.extend("ClassName");
17756 * var object = new MyClass();
17757 * </pre></p>
17758 *
17759 * @param {Object} attributes The initial set of data to store in the object.
17760 * @param {Object} options A set of Backbone-like options for creating the
17761 * object. The only option currently supported is "collection".
17762 * @see AV.Object.extend
17763 *
17764 * @class
17765 *
17766 * <p>The fundamental unit of AV data, which implements the Backbone Model
17767 * interface.</p>
17768 */
17769 AV.Object = function (attributes, options) {
17770 // Allow new AV.Object("ClassName") as a shortcut to _create.
17771 if (_.isString(attributes)) {
17772 return AV.Object._create.apply(this, arguments);
17773 }
17774
17775 attributes = attributes || {};
17776
17777 if (options && options.parse) {
17778 attributes = this.parse(attributes);
17779 attributes = this._mergeMagicFields(attributes);
17780 }
17781
17782 var defaults = getValue(this, 'defaults');
17783
17784 if (defaults) {
17785 attributes = _.extend({}, defaults, attributes);
17786 }
17787
17788 if (options && options.collection) {
17789 this.collection = options.collection;
17790 }
17791
17792 this._serverData = {}; // The last known data for this object from cloud.
17793
17794 this._opSetQueue = [{}]; // List of sets of changes to the data.
17795
17796 this._flags = {};
17797 this.attributes = {}; // The best estimate of this's current data.
17798
17799 this._hashedJSON = {}; // Hash of values of containers at last save.
17800
17801 this._escapedAttributes = {};
17802 this.cid = _.uniqueId('c');
17803 this.changed = {};
17804 this._silent = {};
17805 this._pending = {};
17806 this.set(attributes, {
17807 silent: true
17808 });
17809 this.changed = {};
17810 this._silent = {};
17811 this._pending = {};
17812 this._hasData = true;
17813 this._previousAttributes = _.clone(this.attributes);
17814 this.initialize.apply(this, arguments);
17815 };
17816 /**
17817 * @lends AV.Object.prototype
17818 * @property {String} id The objectId of the AV Object.
17819 */
17820
17821 /**
17822 * Saves the given list of AV.Object.
17823 * If any error is encountered, stops and calls the error handler.
17824 *
17825 * @example
17826 * AV.Object.saveAll([object1, object2, ...]).then(function(list) {
17827 * // All the objects were saved.
17828 * }, function(error) {
17829 * // An error occurred while saving one of the objects.
17830 * });
17831 *
17832 * @param {Array} list A list of <code>AV.Object</code>.
17833 */
17834
17835
17836 AV.Object.saveAll = function (list, options) {
17837 return AV.Object._deepSaveAsync(list, null, options);
17838 };
17839 /**
17840 * Fetch the given list of AV.Object.
17841 *
17842 * @param {AV.Object[]} objects A list of <code>AV.Object</code>
17843 * @param {AuthOptions} options
17844 * @return {Promise.<AV.Object[]>} The given list of <code>AV.Object</code>, updated
17845 */
17846
17847
17848 AV.Object.fetchAll = function (objects, options) {
17849 return _promise.default.resolve().then(function () {
17850 return _request('batch', null, null, 'POST', {
17851 requests: (0, _map.default)(_).call(_, objects, function (object) {
17852 var _context;
17853
17854 if (!object.className) throw new Error('object must have className to fetch');
17855 if (!object.id) throw new Error('object must have id to fetch');
17856 if (object.dirty()) throw new Error('object is modified but not saved');
17857 return {
17858 method: 'GET',
17859 path: (0, _concat.default)(_context = "/1.1/classes/".concat(object.className, "/")).call(_context, object.id)
17860 };
17861 })
17862 }, options);
17863 }).then(function (response) {
17864 var results = (0, _map.default)(_).call(_, objects, function (object, i) {
17865 if (response[i].success) {
17866 var fetchedAttrs = object.parse(response[i].success);
17867
17868 object._cleanupUnsetKeys(fetchedAttrs);
17869
17870 object._finishFetch(fetchedAttrs);
17871
17872 return object;
17873 }
17874
17875 if (response[i].success === null) {
17876 return new AVError(AVError.OBJECT_NOT_FOUND, 'Object not found.');
17877 }
17878
17879 return new AVError(response[i].error.code, response[i].error.error);
17880 });
17881 return handleBatchResults(results);
17882 });
17883 }; // Attach all inheritable methods to the AV.Object prototype.
17884
17885
17886 _.extend(AV.Object.prototype, AV.Events,
17887 /** @lends AV.Object.prototype */
17888 {
17889 _fetchWhenSave: false,
17890
17891 /**
17892 * Initialize is an empty function by default. Override it with your own
17893 * initialization logic.
17894 */
17895 initialize: function initialize() {},
17896
17897 /**
17898 * Set whether to enable fetchWhenSave option when updating object.
17899 * When set true, SDK would fetch the latest object after saving.
17900 * Default is false.
17901 *
17902 * @deprecated use AV.Object#save with options.fetchWhenSave instead
17903 * @param {boolean} enable true to enable fetchWhenSave option.
17904 */
17905 fetchWhenSave: function fetchWhenSave(enable) {
17906 console.warn('AV.Object#fetchWhenSave is deprecated, use AV.Object#save with options.fetchWhenSave instead.');
17907
17908 if (!_.isBoolean(enable)) {
17909 throw new Error('Expect boolean value for fetchWhenSave');
17910 }
17911
17912 this._fetchWhenSave = enable;
17913 },
17914
17915 /**
17916 * Returns the object's objectId.
17917 * @return {String} the objectId.
17918 */
17919 getObjectId: function getObjectId() {
17920 return this.id;
17921 },
17922
17923 /**
17924 * Returns the object's createdAt attribute.
17925 * @return {Date}
17926 */
17927 getCreatedAt: function getCreatedAt() {
17928 return this.createdAt;
17929 },
17930
17931 /**
17932 * Returns the object's updatedAt attribute.
17933 * @return {Date}
17934 */
17935 getUpdatedAt: function getUpdatedAt() {
17936 return this.updatedAt;
17937 },
17938
17939 /**
17940 * Returns a JSON version of the object.
17941 * @return {Object}
17942 */
17943 toJSON: function toJSON(key, holder) {
17944 var seenObjects = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
17945 return this._toFullJSON(seenObjects, false);
17946 },
17947
17948 /**
17949 * Returns a JSON version of the object with meta data.
17950 * Inverse to {@link AV.parseJSON}
17951 * @since 3.0.0
17952 * @return {Object}
17953 */
17954 toFullJSON: function toFullJSON() {
17955 var seenObjects = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
17956 return this._toFullJSON(seenObjects);
17957 },
17958 _toFullJSON: function _toFullJSON(seenObjects) {
17959 var _this = this;
17960
17961 var full = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
17962
17963 var json = _.clone(this.attributes);
17964
17965 if (_.isArray(seenObjects)) {
17966 var newSeenObjects = (0, _concat.default)(seenObjects).call(seenObjects, this);
17967 }
17968
17969 AV._objectEach(json, function (val, key) {
17970 json[key] = AV._encode(val, newSeenObjects, undefined, full);
17971 });
17972
17973 AV._objectEach(this._operations, function (val, key) {
17974 json[key] = val;
17975 });
17976
17977 if (_.has(this, 'id')) {
17978 json.objectId = this.id;
17979 }
17980
17981 ['createdAt', 'updatedAt'].forEach(function (key) {
17982 if (_.has(_this, key)) {
17983 var val = _this[key];
17984 json[key] = _.isDate(val) ? val.toJSON() : val;
17985 }
17986 });
17987
17988 if (full) {
17989 json.__type = 'Object';
17990 if (_.isArray(seenObjects) && seenObjects.length) json.__type = 'Pointer';
17991 json.className = this.className;
17992 }
17993
17994 return json;
17995 },
17996
17997 /**
17998 * Updates _hashedJSON to reflect the current state of this object.
17999 * Adds any changed hash values to the set of pending changes.
18000 * @private
18001 */
18002 _refreshCache: function _refreshCache() {
18003 var self = this;
18004
18005 if (self._refreshingCache) {
18006 return;
18007 }
18008
18009 self._refreshingCache = true;
18010
18011 AV._objectEach(this.attributes, function (value, key) {
18012 if (value instanceof AV.Object) {
18013 value._refreshCache();
18014 } else if (_.isObject(value)) {
18015 if (self._resetCacheForKey(key)) {
18016 self.set(key, new AV.Op.Set(value), {
18017 silent: true
18018 });
18019 }
18020 }
18021 });
18022
18023 delete self._refreshingCache;
18024 },
18025
18026 /**
18027 * Returns true if this object has been modified since its last
18028 * save/refresh. If an attribute is specified, it returns true only if that
18029 * particular attribute has been modified since the last save/refresh.
18030 * @param {String} attr An attribute name (optional).
18031 * @return {Boolean}
18032 */
18033 dirty: function dirty(attr) {
18034 this._refreshCache();
18035
18036 var currentChanges = _.last(this._opSetQueue);
18037
18038 if (attr) {
18039 return currentChanges[attr] ? true : false;
18040 }
18041
18042 if (!this.id) {
18043 return true;
18044 }
18045
18046 if ((0, _keys2.default)(_).call(_, currentChanges).length > 0) {
18047 return true;
18048 }
18049
18050 return false;
18051 },
18052
18053 /**
18054 * Returns the keys of the modified attribute since its last save/refresh.
18055 * @return {String[]}
18056 */
18057 dirtyKeys: function dirtyKeys() {
18058 this._refreshCache();
18059
18060 var currentChanges = _.last(this._opSetQueue);
18061
18062 return (0, _keys2.default)(_).call(_, currentChanges);
18063 },
18064
18065 /**
18066 * Gets a Pointer referencing this Object.
18067 * @private
18068 */
18069 _toPointer: function _toPointer() {
18070 // if (!this.id) {
18071 // throw new Error("Can't serialize an unsaved AV.Object");
18072 // }
18073 return {
18074 __type: 'Pointer',
18075 className: this.className,
18076 objectId: this.id
18077 };
18078 },
18079
18080 /**
18081 * Gets the value of an attribute.
18082 * @param {String} attr The string name of an attribute.
18083 */
18084 get: function get(attr) {
18085 switch (attr) {
18086 case 'objectId':
18087 return this.id;
18088
18089 case 'createdAt':
18090 case 'updatedAt':
18091 return this[attr];
18092
18093 default:
18094 return this.attributes[attr];
18095 }
18096 },
18097
18098 /**
18099 * Gets a relation on the given class for the attribute.
18100 * @param {String} attr The attribute to get the relation for.
18101 * @return {AV.Relation}
18102 */
18103 relation: function relation(attr) {
18104 var value = this.get(attr);
18105
18106 if (value) {
18107 if (!(value instanceof AV.Relation)) {
18108 throw new Error('Called relation() on non-relation field ' + attr);
18109 }
18110
18111 value._ensureParentAndKey(this, attr);
18112
18113 return value;
18114 } else {
18115 return new AV.Relation(this, attr);
18116 }
18117 },
18118
18119 /**
18120 * Gets the HTML-escaped value of an attribute.
18121 */
18122 escape: function escape(attr) {
18123 var html = this._escapedAttributes[attr];
18124
18125 if (html) {
18126 return html;
18127 }
18128
18129 var val = this.attributes[attr];
18130 var escaped;
18131
18132 if (isNullOrUndefined(val)) {
18133 escaped = '';
18134 } else {
18135 escaped = _.escape(val.toString());
18136 }
18137
18138 this._escapedAttributes[attr] = escaped;
18139 return escaped;
18140 },
18141
18142 /**
18143 * Returns <code>true</code> if the attribute contains a value that is not
18144 * null or undefined.
18145 * @param {String} attr The string name of the attribute.
18146 * @return {Boolean}
18147 */
18148 has: function has(attr) {
18149 return !isNullOrUndefined(this.attributes[attr]);
18150 },
18151
18152 /**
18153 * Pulls "special" fields like objectId, createdAt, etc. out of attrs
18154 * and puts them on "this" directly. Removes them from attrs.
18155 * @param attrs - A dictionary with the data for this AV.Object.
18156 * @private
18157 */
18158 _mergeMagicFields: function _mergeMagicFields(attrs) {
18159 // Check for changes of magic fields.
18160 var model = this;
18161 var specialFields = ['objectId', 'createdAt', 'updatedAt'];
18162
18163 AV._arrayEach(specialFields, function (attr) {
18164 if (attrs[attr]) {
18165 if (attr === 'objectId') {
18166 model.id = attrs[attr];
18167 } else if ((attr === 'createdAt' || attr === 'updatedAt') && !_.isDate(attrs[attr])) {
18168 model[attr] = AV._parseDate(attrs[attr]);
18169 } else {
18170 model[attr] = attrs[attr];
18171 }
18172
18173 delete attrs[attr];
18174 }
18175 });
18176
18177 return attrs;
18178 },
18179
18180 /**
18181 * Returns the json to be sent to the server.
18182 * @private
18183 */
18184 _startSave: function _startSave() {
18185 this._opSetQueue.push({});
18186 },
18187
18188 /**
18189 * Called when a save fails because of an error. Any changes that were part
18190 * of the save need to be merged with changes made after the save. This
18191 * might throw an exception is you do conflicting operations. For example,
18192 * if you do:
18193 * object.set("foo", "bar");
18194 * object.set("invalid field name", "baz");
18195 * object.save();
18196 * object.increment("foo");
18197 * then this will throw when the save fails and the client tries to merge
18198 * "bar" with the +1.
18199 * @private
18200 */
18201 _cancelSave: function _cancelSave() {
18202 var failedChanges = _.first(this._opSetQueue);
18203
18204 this._opSetQueue = _.rest(this._opSetQueue);
18205
18206 var nextChanges = _.first(this._opSetQueue);
18207
18208 AV._objectEach(failedChanges, function (op, key) {
18209 var op1 = failedChanges[key];
18210 var op2 = nextChanges[key];
18211
18212 if (op1 && op2) {
18213 nextChanges[key] = op2._mergeWithPrevious(op1);
18214 } else if (op1) {
18215 nextChanges[key] = op1;
18216 }
18217 });
18218
18219 this._saving = this._saving - 1;
18220 },
18221
18222 /**
18223 * Called when a save completes successfully. This merges the changes that
18224 * were saved into the known server data, and overrides it with any data
18225 * sent directly from the server.
18226 * @private
18227 */
18228 _finishSave: function _finishSave(serverData) {
18229 var _context2;
18230
18231 // Grab a copy of any object referenced by this object. These instances
18232 // may have already been fetched, and we don't want to lose their data.
18233 // Note that doing it like this means we will unify separate copies of the
18234 // same object, but that's a risk we have to take.
18235 var fetchedObjects = {};
18236
18237 AV._traverse(this.attributes, function (object) {
18238 if (object instanceof AV.Object && object.id && object._hasData) {
18239 fetchedObjects[object.id] = object;
18240 }
18241 });
18242
18243 var savedChanges = _.first(this._opSetQueue);
18244
18245 this._opSetQueue = _.rest(this._opSetQueue);
18246
18247 this._applyOpSet(savedChanges, this._serverData);
18248
18249 this._mergeMagicFields(serverData);
18250
18251 var self = this;
18252
18253 AV._objectEach(serverData, function (value, key) {
18254 self._serverData[key] = AV._decode(value, key); // Look for any objects that might have become unfetched and fix them
18255 // by replacing their values with the previously observed values.
18256
18257 var fetched = AV._traverse(self._serverData[key], function (object) {
18258 if (object instanceof AV.Object && fetchedObjects[object.id]) {
18259 return fetchedObjects[object.id];
18260 }
18261 });
18262
18263 if (fetched) {
18264 self._serverData[key] = fetched;
18265 }
18266 });
18267
18268 this._rebuildAllEstimatedData();
18269
18270 var opSetQueue = (0, _map.default)(_context2 = this._opSetQueue).call(_context2, _.clone);
18271
18272 this._refreshCache();
18273
18274 this._opSetQueue = opSetQueue;
18275 this._saving = this._saving - 1;
18276 },
18277
18278 /**
18279 * Called when a fetch or login is complete to set the known server data to
18280 * the given object.
18281 * @private
18282 */
18283 _finishFetch: function _finishFetch(serverData, hasData) {
18284 // Clear out any changes the user might have made previously.
18285 this._opSetQueue = [{}]; // Bring in all the new server data.
18286
18287 this._mergeMagicFields(serverData);
18288
18289 var self = this;
18290
18291 AV._objectEach(serverData, function (value, key) {
18292 self._serverData[key] = AV._decode(value, key);
18293 }); // Refresh the attributes.
18294
18295
18296 this._rebuildAllEstimatedData(); // Clear out the cache of mutable containers.
18297
18298
18299 this._refreshCache();
18300
18301 this._opSetQueue = [{}];
18302 this._hasData = hasData;
18303 },
18304
18305 /**
18306 * Applies the set of AV.Op in opSet to the object target.
18307 * @private
18308 */
18309 _applyOpSet: function _applyOpSet(opSet, target) {
18310 var self = this;
18311
18312 AV._objectEach(opSet, function (change, key) {
18313 var _findValue = findValue(target, key),
18314 _findValue2 = (0, _slicedToArray2.default)(_findValue, 3),
18315 value = _findValue2[0],
18316 actualTarget = _findValue2[1],
18317 actualKey = _findValue2[2];
18318
18319 setValue(target, key, change._estimate(value, self, key));
18320
18321 if (actualTarget && actualTarget[actualKey] === AV.Op._UNSET) {
18322 delete actualTarget[actualKey];
18323 }
18324 });
18325 },
18326
18327 /**
18328 * Replaces the cached value for key with the current value.
18329 * Returns true if the new value is different than the old value.
18330 * @private
18331 */
18332 _resetCacheForKey: function _resetCacheForKey(key) {
18333 var value = this.attributes[key];
18334
18335 if (_.isObject(value) && !(value instanceof AV.Object) && !(value instanceof AV.File)) {
18336 var json = (0, _stringify.default)(recursiveToPointer(value));
18337
18338 if (this._hashedJSON[key] !== json) {
18339 var wasSet = !!this._hashedJSON[key];
18340 this._hashedJSON[key] = json;
18341 return wasSet;
18342 }
18343 }
18344
18345 return false;
18346 },
18347
18348 /**
18349 * Populates attributes[key] by starting with the last known data from the
18350 * server, and applying all of the local changes that have been made to that
18351 * key since then.
18352 * @private
18353 */
18354 _rebuildEstimatedDataForKey: function _rebuildEstimatedDataForKey(key) {
18355 var self = this;
18356 delete this.attributes[key];
18357
18358 if (this._serverData[key]) {
18359 this.attributes[key] = this._serverData[key];
18360 }
18361
18362 AV._arrayEach(this._opSetQueue, function (opSet) {
18363 var op = opSet[key];
18364
18365 if (op) {
18366 var _findValue3 = findValue(self.attributes, key),
18367 _findValue4 = (0, _slicedToArray2.default)(_findValue3, 4),
18368 value = _findValue4[0],
18369 actualTarget = _findValue4[1],
18370 actualKey = _findValue4[2],
18371 firstKey = _findValue4[3];
18372
18373 setValue(self.attributes, key, op._estimate(value, self, key));
18374
18375 if (actualTarget && actualTarget[actualKey] === AV.Op._UNSET) {
18376 delete actualTarget[actualKey];
18377 }
18378
18379 self._resetCacheForKey(firstKey);
18380 }
18381 });
18382 },
18383
18384 /**
18385 * Populates attributes by starting with the last known data from the
18386 * server, and applying all of the local changes that have been made since
18387 * then.
18388 * @private
18389 */
18390 _rebuildAllEstimatedData: function _rebuildAllEstimatedData() {
18391 var self = this;
18392
18393 var previousAttributes = _.clone(this.attributes);
18394
18395 this.attributes = _.clone(this._serverData);
18396
18397 AV._arrayEach(this._opSetQueue, function (opSet) {
18398 self._applyOpSet(opSet, self.attributes);
18399
18400 AV._objectEach(opSet, function (op, key) {
18401 self._resetCacheForKey(key);
18402 });
18403 }); // Trigger change events for anything that changed because of the fetch.
18404
18405
18406 AV._objectEach(previousAttributes, function (oldValue, key) {
18407 if (self.attributes[key] !== oldValue) {
18408 self.trigger('change:' + key, self, self.attributes[key], {});
18409 }
18410 });
18411
18412 AV._objectEach(this.attributes, function (newValue, key) {
18413 if (!_.has(previousAttributes, key)) {
18414 self.trigger('change:' + key, self, newValue, {});
18415 }
18416 });
18417 },
18418
18419 /**
18420 * Sets a hash of model attributes on the object, firing
18421 * <code>"change"</code> unless you choose to silence it.
18422 *
18423 * <p>You can call it with an object containing keys and values, or with one
18424 * key and value. For example:</p>
18425 *
18426 * @example
18427 * gameTurn.set({
18428 * player: player1,
18429 * diceRoll: 2
18430 * });
18431 *
18432 * game.set("currentPlayer", player2);
18433 *
18434 * game.set("finished", true);
18435 *
18436 * @param {String} key The key to set.
18437 * @param {Any} value The value to give it.
18438 * @param {Object} [options]
18439 * @param {Boolean} [options.silent]
18440 * @return {AV.Object} self if succeeded, throws if the value is not valid.
18441 * @see AV.Object#validate
18442 */
18443 set: function set(key, value, options) {
18444 var attrs;
18445
18446 if (_.isObject(key) || isNullOrUndefined(key)) {
18447 attrs = _.mapObject(key, function (v, k) {
18448 checkReservedKey(k);
18449 return AV._decode(v, k);
18450 });
18451 options = value;
18452 } else {
18453 attrs = {};
18454 checkReservedKey(key);
18455 attrs[key] = AV._decode(value, key);
18456 } // Extract attributes and options.
18457
18458
18459 options = options || {};
18460
18461 if (!attrs) {
18462 return this;
18463 }
18464
18465 if (attrs instanceof AV.Object) {
18466 attrs = attrs.attributes;
18467 } // If the unset option is used, every attribute should be a Unset.
18468
18469
18470 if (options.unset) {
18471 AV._objectEach(attrs, function (unused_value, key) {
18472 attrs[key] = new AV.Op.Unset();
18473 });
18474 } // Apply all the attributes to get the estimated values.
18475
18476
18477 var dataToValidate = _.clone(attrs);
18478
18479 var self = this;
18480
18481 AV._objectEach(dataToValidate, function (value, key) {
18482 if (value instanceof AV.Op) {
18483 dataToValidate[key] = value._estimate(self.attributes[key], self, key);
18484
18485 if (dataToValidate[key] === AV.Op._UNSET) {
18486 delete dataToValidate[key];
18487 }
18488 }
18489 }); // Run validation.
18490
18491
18492 this._validate(attrs, options);
18493
18494 options.changes = {};
18495 var escaped = this._escapedAttributes; // Update attributes.
18496
18497 AV._arrayEach((0, _keys2.default)(_).call(_, attrs), function (attr) {
18498 var val = attrs[attr]; // If this is a relation object we need to set the parent correctly,
18499 // since the location where it was parsed does not have access to
18500 // this object.
18501
18502 if (val instanceof AV.Relation) {
18503 val.parent = self;
18504 }
18505
18506 if (!(val instanceof AV.Op)) {
18507 val = new AV.Op.Set(val);
18508 } // See if this change will actually have any effect.
18509
18510
18511 var isRealChange = true;
18512
18513 if (val instanceof AV.Op.Set && _.isEqual(self.attributes[attr], val.value)) {
18514 isRealChange = false;
18515 }
18516
18517 if (isRealChange) {
18518 delete escaped[attr];
18519
18520 if (options.silent) {
18521 self._silent[attr] = true;
18522 } else {
18523 options.changes[attr] = true;
18524 }
18525 }
18526
18527 var currentChanges = _.last(self._opSetQueue);
18528
18529 currentChanges[attr] = val._mergeWithPrevious(currentChanges[attr]);
18530
18531 self._rebuildEstimatedDataForKey(attr);
18532
18533 if (isRealChange) {
18534 self.changed[attr] = self.attributes[attr];
18535
18536 if (!options.silent) {
18537 self._pending[attr] = true;
18538 }
18539 } else {
18540 delete self.changed[attr];
18541 delete self._pending[attr];
18542 }
18543 });
18544
18545 if (!options.silent) {
18546 this.change(options);
18547 }
18548
18549 return this;
18550 },
18551
18552 /**
18553 * Remove an attribute from the model, firing <code>"change"</code> unless
18554 * you choose to silence it. This is a noop if the attribute doesn't
18555 * exist.
18556 * @param key {String} The key.
18557 */
18558 unset: function unset(attr, options) {
18559 options = options || {};
18560 options.unset = true;
18561 return this.set(attr, null, options);
18562 },
18563
18564 /**
18565 * Atomically increments the value of the given attribute the next time the
18566 * object is saved. If no amount is specified, 1 is used by default.
18567 *
18568 * @param key {String} The key.
18569 * @param amount {Number} The amount to increment by.
18570 */
18571 increment: function increment(attr, amount) {
18572 if (_.isUndefined(amount) || _.isNull(amount)) {
18573 amount = 1;
18574 }
18575
18576 return this.set(attr, new AV.Op.Increment(amount));
18577 },
18578
18579 /**
18580 * Atomically add an object to the end of the array associated with a given
18581 * key.
18582 * @param key {String} The key.
18583 * @param item {} The item to add.
18584 */
18585 add: function add(attr, item) {
18586 return this.set(attr, new AV.Op.Add(ensureArray(item)));
18587 },
18588
18589 /**
18590 * Atomically add an object to the array associated with a given key, only
18591 * if it is not already present in the array. The position of the insert is
18592 * not guaranteed.
18593 *
18594 * @param key {String} The key.
18595 * @param item {} The object to add.
18596 */
18597 addUnique: function addUnique(attr, item) {
18598 return this.set(attr, new AV.Op.AddUnique(ensureArray(item)));
18599 },
18600
18601 /**
18602 * Atomically remove all instances of an object from the array associated
18603 * with a given key.
18604 *
18605 * @param key {String} The key.
18606 * @param item {} The object to remove.
18607 */
18608 remove: function remove(attr, item) {
18609 return this.set(attr, new AV.Op.Remove(ensureArray(item)));
18610 },
18611
18612 /**
18613 * Atomically apply a "bit and" operation on the value associated with a
18614 * given key.
18615 *
18616 * @param key {String} The key.
18617 * @param value {Number} The value to apply.
18618 */
18619 bitAnd: function bitAnd(attr, value) {
18620 return this.set(attr, new AV.Op.BitAnd(value));
18621 },
18622
18623 /**
18624 * Atomically apply a "bit or" operation on the value associated with a
18625 * given key.
18626 *
18627 * @param key {String} The key.
18628 * @param value {Number} The value to apply.
18629 */
18630 bitOr: function bitOr(attr, value) {
18631 return this.set(attr, new AV.Op.BitOr(value));
18632 },
18633
18634 /**
18635 * Atomically apply a "bit xor" operation on the value associated with a
18636 * given key.
18637 *
18638 * @param key {String} The key.
18639 * @param value {Number} The value to apply.
18640 */
18641 bitXor: function bitXor(attr, value) {
18642 return this.set(attr, new AV.Op.BitXor(value));
18643 },
18644
18645 /**
18646 * Returns an instance of a subclass of AV.Op describing what kind of
18647 * modification has been performed on this field since the last time it was
18648 * saved. For example, after calling object.increment("x"), calling
18649 * object.op("x") would return an instance of AV.Op.Increment.
18650 *
18651 * @param key {String} The key.
18652 * @returns {AV.Op} The operation, or undefined if none.
18653 */
18654 op: function op(attr) {
18655 return _.last(this._opSetQueue)[attr];
18656 },
18657
18658 /**
18659 * Clear all attributes on the model, firing <code>"change"</code> unless
18660 * you choose to silence it.
18661 */
18662 clear: function clear(options) {
18663 options = options || {};
18664 options.unset = true;
18665
18666 var keysToClear = _.extend(this.attributes, this._operations);
18667
18668 return this.set(keysToClear, options);
18669 },
18670
18671 /**
18672 * Clears any (or specific) changes to the model made since the last save.
18673 * @param {string|string[]} [keys] specify keys to revert.
18674 */
18675 revert: function revert(keys) {
18676 var lastOp = _.last(this._opSetQueue);
18677
18678 var _keys = ensureArray(keys || (0, _keys2.default)(_).call(_, lastOp));
18679
18680 _keys.forEach(function (key) {
18681 delete lastOp[key];
18682 });
18683
18684 this._rebuildAllEstimatedData();
18685
18686 return this;
18687 },
18688
18689 /**
18690 * Returns a JSON-encoded set of operations to be sent with the next save
18691 * request.
18692 * @private
18693 */
18694 _getSaveJSON: function _getSaveJSON() {
18695 var json = _.clone(_.first(this._opSetQueue));
18696
18697 AV._objectEach(json, function (op, key) {
18698 json[key] = op.toJSON();
18699 });
18700
18701 return json;
18702 },
18703
18704 /**
18705 * Returns true if this object can be serialized for saving.
18706 * @private
18707 */
18708 _canBeSerialized: function _canBeSerialized() {
18709 return AV.Object._canBeSerializedAsValue(this.attributes);
18710 },
18711
18712 /**
18713 * Fetch the model from the server. If the server's representation of the
18714 * model differs from its current attributes, they will be overriden,
18715 * triggering a <code>"change"</code> event.
18716 * @param {Object} fetchOptions Optional options to set 'keys',
18717 * 'include' and 'includeACL' option.
18718 * @param {AuthOptions} options
18719 * @return {Promise} A promise that is fulfilled when the fetch
18720 * completes.
18721 */
18722 fetch: function fetch() {
18723 var fetchOptions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
18724 var options = arguments.length > 1 ? arguments[1] : undefined;
18725
18726 if (!this.id) {
18727 throw new Error('Cannot fetch unsaved object');
18728 }
18729
18730 var self = this;
18731
18732 var request = _request('classes', this.className, this.id, 'GET', transformFetchOptions(fetchOptions), options);
18733
18734 return request.then(function (response) {
18735 var fetchedAttrs = self.parse(response);
18736
18737 self._cleanupUnsetKeys(fetchedAttrs, (0, _keys2.default)(fetchOptions) ? ensureArray((0, _keys2.default)(fetchOptions)).join(',').split(',') : undefined);
18738
18739 self._finishFetch(fetchedAttrs, true);
18740
18741 return self;
18742 });
18743 },
18744 _cleanupUnsetKeys: function _cleanupUnsetKeys(fetchedAttrs) {
18745 var _this2 = this;
18746
18747 var fetchedKeys = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : (0, _keys2.default)(_).call(_, this._serverData);
18748
18749 _.forEach(fetchedKeys, function (key) {
18750 if (fetchedAttrs[key] === undefined) delete _this2._serverData[key];
18751 });
18752 },
18753
18754 /**
18755 * Set a hash of model attributes, and save the model to the server.
18756 * updatedAt will be updated when the request returns.
18757 * You can either call it as:<pre>
18758 * object.save();</pre>
18759 * or<pre>
18760 * object.save(null, options);</pre>
18761 * or<pre>
18762 * object.save(attrs, options);</pre>
18763 * or<pre>
18764 * object.save(key, value, options);</pre>
18765 *
18766 * @example
18767 * gameTurn.save({
18768 * player: "Jake Cutter",
18769 * diceRoll: 2
18770 * }).then(function(gameTurnAgain) {
18771 * // The save was successful.
18772 * }, function(error) {
18773 * // The save failed. Error is an instance of AVError.
18774 * });
18775 *
18776 * @param {AuthOptions} options AuthOptions plus:
18777 * @param {Boolean} options.fetchWhenSave fetch and update object after save succeeded
18778 * @param {AV.Query} options.query Save object only when it matches the query
18779 * @return {Promise} A promise that is fulfilled when the save
18780 * completes.
18781 * @see AVError
18782 */
18783 save: function save(arg1, arg2, arg3) {
18784 var attrs, current, options;
18785
18786 if (_.isObject(arg1) || isNullOrUndefined(arg1)) {
18787 attrs = arg1;
18788 options = arg2;
18789 } else {
18790 attrs = {};
18791 attrs[arg1] = arg2;
18792 options = arg3;
18793 }
18794
18795 options = _.clone(options) || {};
18796
18797 if (options.wait) {
18798 current = _.clone(this.attributes);
18799 }
18800
18801 var setOptions = _.clone(options) || {};
18802
18803 if (setOptions.wait) {
18804 setOptions.silent = true;
18805 }
18806
18807 if (attrs) {
18808 this.set(attrs, setOptions);
18809 }
18810
18811 var model = this;
18812 var unsavedChildren = [];
18813 var unsavedFiles = [];
18814
18815 AV.Object._findUnsavedChildren(model, unsavedChildren, unsavedFiles);
18816
18817 if (unsavedChildren.length + unsavedFiles.length > 1) {
18818 return AV.Object._deepSaveAsync(this, model, options);
18819 }
18820
18821 this._startSave();
18822
18823 this._saving = (this._saving || 0) + 1;
18824 this._allPreviousSaves = this._allPreviousSaves || _promise.default.resolve();
18825 this._allPreviousSaves = this._allPreviousSaves.catch(function (e) {}).then(function () {
18826 var method = model.id ? 'PUT' : 'POST';
18827
18828 var json = model._getSaveJSON();
18829
18830 var query = {};
18831
18832 if (model._fetchWhenSave || options.fetchWhenSave) {
18833 query['new'] = 'true';
18834 } // user login option
18835
18836
18837 if (options._failOnNotExist) {
18838 query.failOnNotExist = 'true';
18839 }
18840
18841 if (options.query) {
18842 var queryParams;
18843
18844 if (typeof options.query._getParams === 'function') {
18845 queryParams = options.query._getParams();
18846
18847 if (queryParams) {
18848 query.where = queryParams.where;
18849 }
18850 }
18851
18852 if (!query.where) {
18853 var error = new Error('options.query is not an AV.Query');
18854 throw error;
18855 }
18856 }
18857
18858 _.extend(json, model._flags);
18859
18860 var route = 'classes';
18861 var className = model.className;
18862
18863 if (model.className === '_User' && !model.id) {
18864 // Special-case user sign-up.
18865 route = 'users';
18866 className = null;
18867 } //hook makeRequest in options.
18868
18869
18870 var makeRequest = options._makeRequest || _request;
18871 var requestPromise = makeRequest(route, className, model.id, method, json, options, query);
18872 requestPromise = requestPromise.then(function (resp) {
18873 var serverAttrs = model.parse(resp);
18874
18875 if (options.wait) {
18876 serverAttrs = _.extend(attrs || {}, serverAttrs);
18877 }
18878
18879 model._finishSave(serverAttrs);
18880
18881 if (options.wait) {
18882 model.set(current, setOptions);
18883 }
18884
18885 return model;
18886 }, function (error) {
18887 model._cancelSave();
18888
18889 throw error;
18890 });
18891 return requestPromise;
18892 });
18893 return this._allPreviousSaves;
18894 },
18895
18896 /**
18897 * Destroy this model on the server if it was already persisted.
18898 * Optimistically removes the model from its collection, if it has one.
18899 * @param {AuthOptions} options AuthOptions plus:
18900 * @param {Boolean} [options.wait] wait for the server to respond
18901 * before removal.
18902 *
18903 * @return {Promise} A promise that is fulfilled when the destroy
18904 * completes.
18905 */
18906 destroy: function destroy(options) {
18907 options = options || {};
18908 var model = this;
18909
18910 var triggerDestroy = function triggerDestroy() {
18911 model.trigger('destroy', model, model.collection, options);
18912 };
18913
18914 if (!this.id) {
18915 return triggerDestroy();
18916 }
18917
18918 if (!options.wait) {
18919 triggerDestroy();
18920 }
18921
18922 var request = _request('classes', this.className, this.id, 'DELETE', this._flags, options);
18923
18924 return request.then(function () {
18925 if (options.wait) {
18926 triggerDestroy();
18927 }
18928
18929 return model;
18930 });
18931 },
18932
18933 /**
18934 * Converts a response into the hash of attributes to be set on the model.
18935 * @ignore
18936 */
18937 parse: function parse(resp) {
18938 var output = _.clone(resp);
18939
18940 ['createdAt', 'updatedAt'].forEach(function (key) {
18941 if (output[key]) {
18942 output[key] = AV._parseDate(output[key]);
18943 }
18944 });
18945
18946 if (output.createdAt && !output.updatedAt) {
18947 output.updatedAt = output.createdAt;
18948 }
18949
18950 return output;
18951 },
18952
18953 /**
18954 * Creates a new model with identical attributes to this one.
18955 * @return {AV.Object}
18956 */
18957 clone: function clone() {
18958 return new this.constructor(this.attributes);
18959 },
18960
18961 /**
18962 * Returns true if this object has never been saved to AV.
18963 * @return {Boolean}
18964 */
18965 isNew: function isNew() {
18966 return !this.id;
18967 },
18968
18969 /**
18970 * Call this method to manually fire a `"change"` event for this model and
18971 * a `"change:attribute"` event for each changed attribute.
18972 * Calling this will cause all objects observing the model to update.
18973 */
18974 change: function change(options) {
18975 options = options || {};
18976 var changing = this._changing;
18977 this._changing = true; // Silent changes become pending changes.
18978
18979 var self = this;
18980
18981 AV._objectEach(this._silent, function (attr) {
18982 self._pending[attr] = true;
18983 }); // Silent changes are triggered.
18984
18985
18986 var changes = _.extend({}, options.changes, this._silent);
18987
18988 this._silent = {};
18989
18990 AV._objectEach(changes, function (unused_value, attr) {
18991 self.trigger('change:' + attr, self, self.get(attr), options);
18992 });
18993
18994 if (changing) {
18995 return this;
18996 } // This is to get around lint not letting us make a function in a loop.
18997
18998
18999 var deleteChanged = function deleteChanged(value, attr) {
19000 if (!self._pending[attr] && !self._silent[attr]) {
19001 delete self.changed[attr];
19002 }
19003 }; // Continue firing `"change"` events while there are pending changes.
19004
19005
19006 while (!_.isEmpty(this._pending)) {
19007 this._pending = {};
19008 this.trigger('change', this, options); // Pending and silent changes still remain.
19009
19010 AV._objectEach(this.changed, deleteChanged);
19011
19012 self._previousAttributes = _.clone(this.attributes);
19013 }
19014
19015 this._changing = false;
19016 return this;
19017 },
19018
19019 /**
19020 * Gets the previous value of an attribute, recorded at the time the last
19021 * <code>"change"</code> event was fired.
19022 * @param {String} attr Name of the attribute to get.
19023 */
19024 previous: function previous(attr) {
19025 if (!arguments.length || !this._previousAttributes) {
19026 return null;
19027 }
19028
19029 return this._previousAttributes[attr];
19030 },
19031
19032 /**
19033 * Gets all of the attributes of the model at the time of the previous
19034 * <code>"change"</code> event.
19035 * @return {Object}
19036 */
19037 previousAttributes: function previousAttributes() {
19038 return _.clone(this._previousAttributes);
19039 },
19040
19041 /**
19042 * Checks if the model is currently in a valid state. It's only possible to
19043 * get into an *invalid* state if you're using silent changes.
19044 * @return {Boolean}
19045 */
19046 isValid: function isValid() {
19047 try {
19048 this.validate(this.attributes);
19049 } catch (error) {
19050 return false;
19051 }
19052
19053 return true;
19054 },
19055
19056 /**
19057 * You should not call this function directly unless you subclass
19058 * <code>AV.Object</code>, in which case you can override this method
19059 * to provide additional validation on <code>set</code> and
19060 * <code>save</code>. Your implementation should throw an Error if
19061 * the attrs is invalid
19062 *
19063 * @param {Object} attrs The current data to validate.
19064 * @see AV.Object#set
19065 */
19066 validate: function validate(attrs) {
19067 if (_.has(attrs, 'ACL') && !(attrs.ACL instanceof AV.ACL)) {
19068 throw new AVError(AVError.OTHER_CAUSE, 'ACL must be a AV.ACL.');
19069 }
19070 },
19071
19072 /**
19073 * Run validation against a set of incoming attributes, returning `true`
19074 * if all is well. If a specific `error` callback has been passed,
19075 * call that instead of firing the general `"error"` event.
19076 * @private
19077 */
19078 _validate: function _validate(attrs, options) {
19079 if (options.silent || !this.validate) {
19080 return;
19081 }
19082
19083 attrs = _.extend({}, this.attributes, attrs);
19084 this.validate(attrs);
19085 },
19086
19087 /**
19088 * Returns the ACL for this object.
19089 * @returns {AV.ACL} An instance of AV.ACL.
19090 * @see AV.Object#get
19091 */
19092 getACL: function getACL() {
19093 return this.get('ACL');
19094 },
19095
19096 /**
19097 * Sets the ACL to be used for this object.
19098 * @param {AV.ACL} acl An instance of AV.ACL.
19099 * @param {Object} options Optional Backbone-like options object to be
19100 * passed in to set.
19101 * @return {AV.Object} self
19102 * @see AV.Object#set
19103 */
19104 setACL: function setACL(acl, options) {
19105 return this.set('ACL', acl, options);
19106 },
19107 disableBeforeHook: function disableBeforeHook() {
19108 this.ignoreHook('beforeSave');
19109 this.ignoreHook('beforeUpdate');
19110 this.ignoreHook('beforeDelete');
19111 },
19112 disableAfterHook: function disableAfterHook() {
19113 this.ignoreHook('afterSave');
19114 this.ignoreHook('afterUpdate');
19115 this.ignoreHook('afterDelete');
19116 },
19117 ignoreHook: function ignoreHook(hookName) {
19118 if (!_.contains(['beforeSave', 'afterSave', 'beforeUpdate', 'afterUpdate', 'beforeDelete', 'afterDelete'], hookName)) {
19119 throw new Error('Unsupported hookName: ' + hookName);
19120 }
19121
19122 if (!AV.hookKey) {
19123 throw new Error('ignoreHook required hookKey');
19124 }
19125
19126 if (!this._flags.__ignore_hooks) {
19127 this._flags.__ignore_hooks = [];
19128 }
19129
19130 this._flags.__ignore_hooks.push(hookName);
19131 }
19132 });
19133 /**
19134 * Creates an instance of a subclass of AV.Object for the give classname
19135 * and id.
19136 * @param {String|Function} class the className or a subclass of AV.Object.
19137 * @param {String} id The object id of this model.
19138 * @return {AV.Object} A new subclass instance of AV.Object.
19139 */
19140
19141
19142 AV.Object.createWithoutData = function (klass, id, hasData) {
19143 var _klass;
19144
19145 if (_.isString(klass)) {
19146 _klass = AV.Object._getSubclass(klass);
19147 } else if (klass.prototype && klass.prototype instanceof AV.Object) {
19148 _klass = klass;
19149 } else {
19150 throw new Error('class must be a string or a subclass of AV.Object.');
19151 }
19152
19153 if (!id) {
19154 throw new TypeError('The objectId must be provided');
19155 }
19156
19157 var object = new _klass();
19158 object.id = id;
19159 object._hasData = hasData;
19160 return object;
19161 };
19162 /**
19163 * Delete objects in batch.
19164 * @param {AV.Object[]} objects The <code>AV.Object</code> array to be deleted.
19165 * @param {AuthOptions} options
19166 * @return {Promise} A promise that is fulfilled when the save
19167 * completes.
19168 */
19169
19170
19171 AV.Object.destroyAll = function (objects) {
19172 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
19173
19174 if (!objects || objects.length === 0) {
19175 return _promise.default.resolve();
19176 }
19177
19178 var objectsByClassNameAndFlags = _.groupBy(objects, function (object) {
19179 return (0, _stringify.default)({
19180 className: object.className,
19181 flags: object._flags
19182 });
19183 });
19184
19185 var body = {
19186 requests: (0, _map.default)(_).call(_, objectsByClassNameAndFlags, function (objects) {
19187 var _context3;
19188
19189 var ids = (0, _map.default)(_).call(_, objects, 'id').join(',');
19190 return {
19191 method: 'DELETE',
19192 path: (0, _concat.default)(_context3 = "/1.1/classes/".concat(objects[0].className, "/")).call(_context3, ids),
19193 body: objects[0]._flags
19194 };
19195 })
19196 };
19197 return _request('batch', null, null, 'POST', body, options).then(function (response) {
19198 var firstError = (0, _find.default)(_).call(_, response, function (result) {
19199 return !result.success;
19200 });
19201 if (firstError) throw new AVError(firstError.error.code, firstError.error.error);
19202 return undefined;
19203 });
19204 };
19205 /**
19206 * Returns the appropriate subclass for making new instances of the given
19207 * className string.
19208 * @private
19209 */
19210
19211
19212 AV.Object._getSubclass = function (className) {
19213 if (!_.isString(className)) {
19214 throw new Error('AV.Object._getSubclass requires a string argument.');
19215 }
19216
19217 var ObjectClass = AV.Object._classMap[className];
19218
19219 if (!ObjectClass) {
19220 ObjectClass = AV.Object.extend(className);
19221 AV.Object._classMap[className] = ObjectClass;
19222 }
19223
19224 return ObjectClass;
19225 };
19226 /**
19227 * Creates an instance of a subclass of AV.Object for the given classname.
19228 * @private
19229 */
19230
19231
19232 AV.Object._create = function (className, attributes, options) {
19233 var ObjectClass = AV.Object._getSubclass(className);
19234
19235 return new ObjectClass(attributes, options);
19236 }; // Set up a map of className to class so that we can create new instances of
19237 // AV Objects from JSON automatically.
19238
19239
19240 AV.Object._classMap = {};
19241 AV.Object._extend = AV._extend;
19242 /**
19243 * Creates a new model with defined attributes,
19244 * It's the same with
19245 * <pre>
19246 * new AV.Object(attributes, options);
19247 * </pre>
19248 * @param {Object} attributes The initial set of data to store in the object.
19249 * @param {Object} options A set of Backbone-like options for creating the
19250 * object. The only option currently supported is "collection".
19251 * @return {AV.Object}
19252 * @since v0.4.4
19253 * @see AV.Object
19254 * @see AV.Object.extend
19255 */
19256
19257 AV.Object['new'] = function (attributes, options) {
19258 return new AV.Object(attributes, options);
19259 };
19260 /**
19261 * Creates a new subclass of AV.Object for the given AV class name.
19262 *
19263 * <p>Every extension of a AV class will inherit from the most recent
19264 * previous extension of that class. When a AV.Object is automatically
19265 * created by parsing JSON, it will use the most recent extension of that
19266 * class.</p>
19267 *
19268 * @example
19269 * var MyClass = AV.Object.extend("MyClass", {
19270 * // Instance properties
19271 * }, {
19272 * // Class properties
19273 * });
19274 *
19275 * @param {String} className The name of the AV class backing this model.
19276 * @param {Object} protoProps Instance properties to add to instances of the
19277 * class returned from this method.
19278 * @param {Object} classProps Class properties to add the class returned from
19279 * this method.
19280 * @return {Class} A new subclass of AV.Object.
19281 */
19282
19283
19284 AV.Object.extend = function (className, protoProps, classProps) {
19285 // Handle the case with only two args.
19286 if (!_.isString(className)) {
19287 if (className && _.has(className, 'className')) {
19288 return AV.Object.extend(className.className, className, protoProps);
19289 } else {
19290 throw new Error("AV.Object.extend's first argument should be the className.");
19291 }
19292 } // If someone tries to subclass "User", coerce it to the right type.
19293
19294
19295 if (className === 'User') {
19296 className = '_User';
19297 }
19298
19299 var NewClassObject = null;
19300
19301 if (_.has(AV.Object._classMap, className)) {
19302 var OldClassObject = AV.Object._classMap[className]; // This new subclass has been told to extend both from "this" and from
19303 // OldClassObject. This is multiple inheritance, which isn't supported.
19304 // For now, let's just pick one.
19305
19306 if (protoProps || classProps) {
19307 NewClassObject = OldClassObject._extend(protoProps, classProps);
19308 } else {
19309 return OldClassObject;
19310 }
19311 } else {
19312 protoProps = protoProps || {};
19313 protoProps._className = className;
19314 NewClassObject = this._extend(protoProps, classProps);
19315 } // Extending a subclass should reuse the classname automatically.
19316
19317
19318 NewClassObject.extend = function (arg0) {
19319 var _context4;
19320
19321 if (_.isString(arg0) || arg0 && _.has(arg0, 'className')) {
19322 return AV.Object.extend.apply(NewClassObject, arguments);
19323 }
19324
19325 var newArguments = (0, _concat.default)(_context4 = [className]).call(_context4, _.toArray(arguments));
19326 return AV.Object.extend.apply(NewClassObject, newArguments);
19327 }; // Add the query property descriptor.
19328
19329
19330 (0, _defineProperty.default)(NewClassObject, 'query', (0, _getOwnPropertyDescriptor.default)(AV.Object, 'query'));
19331
19332 NewClassObject['new'] = function (attributes, options) {
19333 return new NewClassObject(attributes, options);
19334 };
19335
19336 AV.Object._classMap[className] = NewClassObject;
19337 return NewClassObject;
19338 }; // ES6 class syntax support
19339
19340
19341 (0, _defineProperty.default)(AV.Object.prototype, 'className', {
19342 get: function get() {
19343 var className = this._className || this.constructor._LCClassName || this.constructor.name; // If someone tries to subclass "User", coerce it to the right type.
19344
19345 if (className === 'User') {
19346 return '_User';
19347 }
19348
19349 return className;
19350 }
19351 });
19352 /**
19353 * Register a class.
19354 * If a subclass of <code>AV.Object</code> is defined with your own implement
19355 * rather then <code>AV.Object.extend</code>, the subclass must be registered.
19356 * @param {Function} klass A subclass of <code>AV.Object</code>
19357 * @param {String} [name] Specify the name of the class. Useful when the class might be uglified.
19358 * @example
19359 * class Person extend AV.Object {}
19360 * AV.Object.register(Person);
19361 */
19362
19363 AV.Object.register = function (klass, name) {
19364 if (!(klass.prototype instanceof AV.Object)) {
19365 throw new Error('registered class is not a subclass of AV.Object');
19366 }
19367
19368 var className = name || klass.name;
19369
19370 if (!className.length) {
19371 throw new Error('registered class must be named');
19372 }
19373
19374 if (name) {
19375 klass._LCClassName = name;
19376 }
19377
19378 AV.Object._classMap[className] = klass;
19379 };
19380 /**
19381 * Get a new Query of the current class
19382 * @name query
19383 * @memberof AV.Object
19384 * @type AV.Query
19385 * @readonly
19386 * @since v3.1.0
19387 * @example
19388 * const Post = AV.Object.extend('Post');
19389 * Post.query.equalTo('author', 'leancloud').find().then();
19390 */
19391
19392
19393 (0, _defineProperty.default)(AV.Object, 'query', {
19394 get: function get() {
19395 return new AV.Query(this.prototype.className);
19396 }
19397 });
19398
19399 AV.Object._findUnsavedChildren = function (objects, children, files) {
19400 AV._traverse(objects, function (object) {
19401 if (object instanceof AV.Object) {
19402 if (object.dirty()) {
19403 children.push(object);
19404 }
19405
19406 return;
19407 }
19408
19409 if (object instanceof AV.File) {
19410 if (!object.id) {
19411 files.push(object);
19412 }
19413
19414 return;
19415 }
19416 });
19417 };
19418
19419 AV.Object._canBeSerializedAsValue = function (object) {
19420 var canBeSerializedAsValue = true;
19421
19422 if (object instanceof AV.Object || object instanceof AV.File) {
19423 canBeSerializedAsValue = !!object.id;
19424 } else if (_.isArray(object)) {
19425 AV._arrayEach(object, function (child) {
19426 if (!AV.Object._canBeSerializedAsValue(child)) {
19427 canBeSerializedAsValue = false;
19428 }
19429 });
19430 } else if (_.isObject(object)) {
19431 AV._objectEach(object, function (child) {
19432 if (!AV.Object._canBeSerializedAsValue(child)) {
19433 canBeSerializedAsValue = false;
19434 }
19435 });
19436 }
19437
19438 return canBeSerializedAsValue;
19439 };
19440
19441 AV.Object._deepSaveAsync = function (object, model, options) {
19442 var unsavedChildren = [];
19443 var unsavedFiles = [];
19444
19445 AV.Object._findUnsavedChildren(object, unsavedChildren, unsavedFiles);
19446
19447 unsavedFiles = _.uniq(unsavedFiles);
19448
19449 var promise = _promise.default.resolve();
19450
19451 _.each(unsavedFiles, function (file) {
19452 promise = promise.then(function () {
19453 return file.save();
19454 });
19455 });
19456
19457 var objects = _.uniq(unsavedChildren);
19458
19459 var remaining = _.uniq(objects);
19460
19461 return promise.then(function () {
19462 return continueWhile(function () {
19463 return remaining.length > 0;
19464 }, function () {
19465 // Gather up all the objects that can be saved in this batch.
19466 var batch = [];
19467 var newRemaining = [];
19468
19469 AV._arrayEach(remaining, function (object) {
19470 if (object._canBeSerialized()) {
19471 batch.push(object);
19472 } else {
19473 newRemaining.push(object);
19474 }
19475 });
19476
19477 remaining = newRemaining; // If we can't save any objects, there must be a circular reference.
19478
19479 if (batch.length === 0) {
19480 return _promise.default.reject(new AVError(AVError.OTHER_CAUSE, 'Tried to save a batch with a cycle.'));
19481 } // Reserve a spot in every object's save queue.
19482
19483
19484 var readyToStart = _promise.default.resolve((0, _map.default)(_).call(_, batch, function (object) {
19485 return object._allPreviousSaves || _promise.default.resolve();
19486 })); // Save a single batch, whether previous saves succeeded or failed.
19487
19488
19489 var bathSavePromise = readyToStart.then(function () {
19490 return _request('batch', null, null, 'POST', {
19491 requests: (0, _map.default)(_).call(_, batch, function (object) {
19492 var method = object.id ? 'PUT' : 'POST';
19493
19494 var json = object._getSaveJSON();
19495
19496 _.extend(json, object._flags);
19497
19498 var route = 'classes';
19499 var className = object.className;
19500 var path = "/".concat(route, "/").concat(className);
19501
19502 if (object.className === '_User' && !object.id) {
19503 // Special-case user sign-up.
19504 path = '/users';
19505 }
19506
19507 var path = "/1.1".concat(path);
19508
19509 if (object.id) {
19510 path = path + '/' + object.id;
19511 }
19512
19513 object._startSave();
19514
19515 return {
19516 method: method,
19517 path: path,
19518 body: json,
19519 params: options && options.fetchWhenSave ? {
19520 fetchWhenSave: true
19521 } : undefined
19522 };
19523 })
19524 }, options).then(function (response) {
19525 var results = (0, _map.default)(_).call(_, batch, function (object, i) {
19526 if (response[i].success) {
19527 object._finishSave(object.parse(response[i].success));
19528
19529 return object;
19530 }
19531
19532 object._cancelSave();
19533
19534 return new AVError(response[i].error.code, response[i].error.error);
19535 });
19536 return handleBatchResults(results);
19537 });
19538 });
19539
19540 AV._arrayEach(batch, function (object) {
19541 object._allPreviousSaves = bathSavePromise;
19542 });
19543
19544 return bathSavePromise;
19545 });
19546 }).then(function () {
19547 return object;
19548 });
19549 };
19550};
19551
19552/***/ }),
19553/* 534 */
19554/***/ (function(module, exports, __webpack_require__) {
19555
19556var arrayWithHoles = __webpack_require__(535);
19557
19558var iterableToArrayLimit = __webpack_require__(543);
19559
19560var unsupportedIterableToArray = __webpack_require__(544);
19561
19562var nonIterableRest = __webpack_require__(554);
19563
19564function _slicedToArray(arr, i) {
19565 return arrayWithHoles(arr) || iterableToArrayLimit(arr, i) || unsupportedIterableToArray(arr, i) || nonIterableRest();
19566}
19567
19568module.exports = _slicedToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
19569
19570/***/ }),
19571/* 535 */
19572/***/ (function(module, exports, __webpack_require__) {
19573
19574var _Array$isArray = __webpack_require__(536);
19575
19576function _arrayWithHoles(arr) {
19577 if (_Array$isArray(arr)) return arr;
19578}
19579
19580module.exports = _arrayWithHoles, module.exports.__esModule = true, module.exports["default"] = module.exports;
19581
19582/***/ }),
19583/* 536 */
19584/***/ (function(module, exports, __webpack_require__) {
19585
19586module.exports = __webpack_require__(537);
19587
19588/***/ }),
19589/* 537 */
19590/***/ (function(module, exports, __webpack_require__) {
19591
19592module.exports = __webpack_require__(538);
19593
19594
19595/***/ }),
19596/* 538 */
19597/***/ (function(module, exports, __webpack_require__) {
19598
19599var parent = __webpack_require__(539);
19600
19601module.exports = parent;
19602
19603
19604/***/ }),
19605/* 539 */
19606/***/ (function(module, exports, __webpack_require__) {
19607
19608var parent = __webpack_require__(540);
19609
19610module.exports = parent;
19611
19612
19613/***/ }),
19614/* 540 */
19615/***/ (function(module, exports, __webpack_require__) {
19616
19617var parent = __webpack_require__(541);
19618
19619module.exports = parent;
19620
19621
19622/***/ }),
19623/* 541 */
19624/***/ (function(module, exports, __webpack_require__) {
19625
19626__webpack_require__(542);
19627var path = __webpack_require__(7);
19628
19629module.exports = path.Array.isArray;
19630
19631
19632/***/ }),
19633/* 542 */
19634/***/ (function(module, exports, __webpack_require__) {
19635
19636var $ = __webpack_require__(0);
19637var isArray = __webpack_require__(92);
19638
19639// `Array.isArray` method
19640// https://tc39.es/ecma262/#sec-array.isarray
19641$({ target: 'Array', stat: true }, {
19642 isArray: isArray
19643});
19644
19645
19646/***/ }),
19647/* 543 */
19648/***/ (function(module, exports, __webpack_require__) {
19649
19650var _Symbol = __webpack_require__(240);
19651
19652var _getIteratorMethod = __webpack_require__(252);
19653
19654function _iterableToArrayLimit(arr, i) {
19655 var _i = arr == null ? null : typeof _Symbol !== "undefined" && _getIteratorMethod(arr) || arr["@@iterator"];
19656
19657 if (_i == null) return;
19658 var _arr = [];
19659 var _n = true;
19660 var _d = false;
19661
19662 var _s, _e;
19663
19664 try {
19665 for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
19666 _arr.push(_s.value);
19667
19668 if (i && _arr.length === i) break;
19669 }
19670 } catch (err) {
19671 _d = true;
19672 _e = err;
19673 } finally {
19674 try {
19675 if (!_n && _i["return"] != null) _i["return"]();
19676 } finally {
19677 if (_d) throw _e;
19678 }
19679 }
19680
19681 return _arr;
19682}
19683
19684module.exports = _iterableToArrayLimit, module.exports.__esModule = true, module.exports["default"] = module.exports;
19685
19686/***/ }),
19687/* 544 */
19688/***/ (function(module, exports, __webpack_require__) {
19689
19690var _sliceInstanceProperty = __webpack_require__(545);
19691
19692var _Array$from = __webpack_require__(549);
19693
19694var arrayLikeToArray = __webpack_require__(553);
19695
19696function _unsupportedIterableToArray(o, minLen) {
19697 var _context;
19698
19699 if (!o) return;
19700 if (typeof o === "string") return arrayLikeToArray(o, minLen);
19701
19702 var n = _sliceInstanceProperty(_context = Object.prototype.toString.call(o)).call(_context, 8, -1);
19703
19704 if (n === "Object" && o.constructor) n = o.constructor.name;
19705 if (n === "Map" || n === "Set") return _Array$from(o);
19706 if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return arrayLikeToArray(o, minLen);
19707}
19708
19709module.exports = _unsupportedIterableToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
19710
19711/***/ }),
19712/* 545 */
19713/***/ (function(module, exports, __webpack_require__) {
19714
19715module.exports = __webpack_require__(546);
19716
19717/***/ }),
19718/* 546 */
19719/***/ (function(module, exports, __webpack_require__) {
19720
19721module.exports = __webpack_require__(547);
19722
19723
19724/***/ }),
19725/* 547 */
19726/***/ (function(module, exports, __webpack_require__) {
19727
19728var parent = __webpack_require__(548);
19729
19730module.exports = parent;
19731
19732
19733/***/ }),
19734/* 548 */
19735/***/ (function(module, exports, __webpack_require__) {
19736
19737var parent = __webpack_require__(238);
19738
19739module.exports = parent;
19740
19741
19742/***/ }),
19743/* 549 */
19744/***/ (function(module, exports, __webpack_require__) {
19745
19746module.exports = __webpack_require__(550);
19747
19748/***/ }),
19749/* 550 */
19750/***/ (function(module, exports, __webpack_require__) {
19751
19752module.exports = __webpack_require__(551);
19753
19754
19755/***/ }),
19756/* 551 */
19757/***/ (function(module, exports, __webpack_require__) {
19758
19759var parent = __webpack_require__(552);
19760
19761module.exports = parent;
19762
19763
19764/***/ }),
19765/* 552 */
19766/***/ (function(module, exports, __webpack_require__) {
19767
19768var parent = __webpack_require__(251);
19769
19770module.exports = parent;
19771
19772
19773/***/ }),
19774/* 553 */
19775/***/ (function(module, exports) {
19776
19777function _arrayLikeToArray(arr, len) {
19778 if (len == null || len > arr.length) len = arr.length;
19779
19780 for (var i = 0, arr2 = new Array(len); i < len; i++) {
19781 arr2[i] = arr[i];
19782 }
19783
19784 return arr2;
19785}
19786
19787module.exports = _arrayLikeToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
19788
19789/***/ }),
19790/* 554 */
19791/***/ (function(module, exports) {
19792
19793function _nonIterableRest() {
19794 throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
19795}
19796
19797module.exports = _nonIterableRest, module.exports.__esModule = true, module.exports["default"] = module.exports;
19798
19799/***/ }),
19800/* 555 */
19801/***/ (function(module, exports, __webpack_require__) {
19802
19803var parent = __webpack_require__(556);
19804
19805module.exports = parent;
19806
19807
19808/***/ }),
19809/* 556 */
19810/***/ (function(module, exports, __webpack_require__) {
19811
19812__webpack_require__(557);
19813var path = __webpack_require__(7);
19814
19815var Object = path.Object;
19816
19817var getOwnPropertyDescriptor = module.exports = function getOwnPropertyDescriptor(it, key) {
19818 return Object.getOwnPropertyDescriptor(it, key);
19819};
19820
19821if (Object.getOwnPropertyDescriptor.sham) getOwnPropertyDescriptor.sham = true;
19822
19823
19824/***/ }),
19825/* 557 */
19826/***/ (function(module, exports, __webpack_require__) {
19827
19828var $ = __webpack_require__(0);
19829var fails = __webpack_require__(2);
19830var toIndexedObject = __webpack_require__(35);
19831var nativeGetOwnPropertyDescriptor = __webpack_require__(64).f;
19832var DESCRIPTORS = __webpack_require__(14);
19833
19834var FAILS_ON_PRIMITIVES = fails(function () { nativeGetOwnPropertyDescriptor(1); });
19835var FORCED = !DESCRIPTORS || FAILS_ON_PRIMITIVES;
19836
19837// `Object.getOwnPropertyDescriptor` method
19838// https://tc39.es/ecma262/#sec-object.getownpropertydescriptor
19839$({ target: 'Object', stat: true, forced: FORCED, sham: !DESCRIPTORS }, {
19840 getOwnPropertyDescriptor: function getOwnPropertyDescriptor(it, key) {
19841 return nativeGetOwnPropertyDescriptor(toIndexedObject(it), key);
19842 }
19843});
19844
19845
19846/***/ }),
19847/* 558 */
19848/***/ (function(module, exports, __webpack_require__) {
19849
19850"use strict";
19851
19852
19853var _ = __webpack_require__(3);
19854
19855var AVError = __webpack_require__(48);
19856
19857module.exports = function (AV) {
19858 AV.Role = AV.Object.extend('_Role',
19859 /** @lends AV.Role.prototype */
19860 {
19861 // Instance Methods
19862
19863 /**
19864 * Represents a Role on the AV server. Roles represent groupings of
19865 * Users for the purposes of granting permissions (e.g. specifying an ACL
19866 * for an Object). Roles are specified by their sets of child users and
19867 * child roles, all of which are granted any permissions that the parent
19868 * role has.
19869 *
19870 * <p>Roles must have a name (which cannot be changed after creation of the
19871 * role), and must specify an ACL.</p>
19872 * An AV.Role is a local representation of a role persisted to the AV
19873 * cloud.
19874 * @class AV.Role
19875 * @param {String} name The name of the Role to create.
19876 * @param {AV.ACL} acl The ACL for this role.
19877 */
19878 constructor: function constructor(name, acl) {
19879 if (_.isString(name)) {
19880 AV.Object.prototype.constructor.call(this, null, null);
19881 this.setName(name);
19882 } else {
19883 AV.Object.prototype.constructor.call(this, name, acl);
19884 }
19885
19886 if (acl) {
19887 if (!(acl instanceof AV.ACL)) {
19888 throw new TypeError('acl must be an instance of AV.ACL');
19889 } else {
19890 this.setACL(acl);
19891 }
19892 }
19893 },
19894
19895 /**
19896 * Gets the name of the role. You can alternatively call role.get("name")
19897 *
19898 * @return {String} the name of the role.
19899 */
19900 getName: function getName() {
19901 return this.get('name');
19902 },
19903
19904 /**
19905 * Sets the name for a role. This value must be set before the role has
19906 * been saved to the server, and cannot be set once the role has been
19907 * saved.
19908 *
19909 * <p>
19910 * A role's name can only contain alphanumeric characters, _, -, and
19911 * spaces.
19912 * </p>
19913 *
19914 * <p>This is equivalent to calling role.set("name", name)</p>
19915 *
19916 * @param {String} name The name of the role.
19917 */
19918 setName: function setName(name, options) {
19919 return this.set('name', name, options);
19920 },
19921
19922 /**
19923 * Gets the AV.Relation for the AV.Users that are direct
19924 * children of this role. These users are granted any privileges that this
19925 * role has been granted (e.g. read or write access through ACLs). You can
19926 * add or remove users from the role through this relation.
19927 *
19928 * <p>This is equivalent to calling role.relation("users")</p>
19929 *
19930 * @return {AV.Relation} the relation for the users belonging to this
19931 * role.
19932 */
19933 getUsers: function getUsers() {
19934 return this.relation('users');
19935 },
19936
19937 /**
19938 * Gets the AV.Relation for the AV.Roles that are direct
19939 * children of this role. These roles' users are granted any privileges that
19940 * this role has been granted (e.g. read or write access through ACLs). You
19941 * can add or remove child roles from this role through this relation.
19942 *
19943 * <p>This is equivalent to calling role.relation("roles")</p>
19944 *
19945 * @return {AV.Relation} the relation for the roles belonging to this
19946 * role.
19947 */
19948 getRoles: function getRoles() {
19949 return this.relation('roles');
19950 },
19951
19952 /**
19953 * @ignore
19954 */
19955 validate: function validate(attrs, options) {
19956 if ('name' in attrs && attrs.name !== this.getName()) {
19957 var newName = attrs.name;
19958
19959 if (this.id && this.id !== attrs.objectId) {
19960 // Check to see if the objectId being set matches this.id.
19961 // This happens during a fetch -- the id is set before calling fetch.
19962 // Let the name be set in this case.
19963 return new AVError(AVError.OTHER_CAUSE, "A role's name can only be set before it has been saved.");
19964 }
19965
19966 if (!_.isString(newName)) {
19967 return new AVError(AVError.OTHER_CAUSE, "A role's name must be a String.");
19968 }
19969
19970 if (!/^[0-9a-zA-Z\-_ ]+$/.test(newName)) {
19971 return new AVError(AVError.OTHER_CAUSE, "A role's name can only contain alphanumeric characters, _," + ' -, and spaces.');
19972 }
19973 }
19974
19975 if (AV.Object.prototype.validate) {
19976 return AV.Object.prototype.validate.call(this, attrs, options);
19977 }
19978
19979 return false;
19980 }
19981 });
19982};
19983
19984/***/ }),
19985/* 559 */
19986/***/ (function(module, exports, __webpack_require__) {
19987
19988"use strict";
19989
19990
19991var _interopRequireDefault = __webpack_require__(1);
19992
19993var _defineProperty2 = _interopRequireDefault(__webpack_require__(560));
19994
19995var _promise = _interopRequireDefault(__webpack_require__(12));
19996
19997var _map = _interopRequireDefault(__webpack_require__(37));
19998
19999var _find = _interopRequireDefault(__webpack_require__(96));
20000
20001var _stringify = _interopRequireDefault(__webpack_require__(38));
20002
20003var _ = __webpack_require__(3);
20004
20005var uuid = __webpack_require__(230);
20006
20007var AVError = __webpack_require__(48);
20008
20009var _require = __webpack_require__(28),
20010 AVRequest = _require._request,
20011 request = _require.request;
20012
20013var _require2 = __webpack_require__(76),
20014 getAdapter = _require2.getAdapter;
20015
20016var PLATFORM_ANONYMOUS = 'anonymous';
20017var PLATFORM_QQAPP = 'lc_qqapp';
20018
20019var mergeUnionDataIntoAuthData = function mergeUnionDataIntoAuthData() {
20020 var defaultUnionIdPlatform = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'weixin';
20021 return function (authData, unionId) {
20022 var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
20023 _ref$unionIdPlatform = _ref.unionIdPlatform,
20024 unionIdPlatform = _ref$unionIdPlatform === void 0 ? defaultUnionIdPlatform : _ref$unionIdPlatform,
20025 _ref$asMainAccount = _ref.asMainAccount,
20026 asMainAccount = _ref$asMainAccount === void 0 ? false : _ref$asMainAccount;
20027
20028 if (typeof unionId !== 'string') throw new AVError(AVError.OTHER_CAUSE, 'unionId is not a string');
20029 if (typeof unionIdPlatform !== 'string') throw new AVError(AVError.OTHER_CAUSE, 'unionIdPlatform is not a string');
20030 return _.extend({}, authData, {
20031 platform: unionIdPlatform,
20032 unionid: unionId,
20033 main_account: Boolean(asMainAccount)
20034 });
20035 };
20036};
20037
20038module.exports = function (AV) {
20039 /**
20040 * @class
20041 *
20042 * <p>An AV.User object is a local representation of a user persisted to the
20043 * LeanCloud server. This class is a subclass of an AV.Object, and retains the
20044 * same functionality of an AV.Object, but also extends it with various
20045 * user specific methods, like authentication, signing up, and validation of
20046 * uniqueness.</p>
20047 */
20048 AV.User = AV.Object.extend('_User',
20049 /** @lends AV.User.prototype */
20050 {
20051 // Instance Variables
20052 _isCurrentUser: false,
20053 // Instance Methods
20054
20055 /**
20056 * Internal method to handle special fields in a _User response.
20057 * @private
20058 */
20059 _mergeMagicFields: function _mergeMagicFields(attrs) {
20060 if (attrs.sessionToken) {
20061 this._sessionToken = attrs.sessionToken;
20062 delete attrs.sessionToken;
20063 }
20064
20065 return AV.User.__super__._mergeMagicFields.call(this, attrs);
20066 },
20067
20068 /**
20069 * Removes null values from authData (which exist temporarily for
20070 * unlinking)
20071 * @private
20072 */
20073 _cleanupAuthData: function _cleanupAuthData() {
20074 if (!this.isCurrent()) {
20075 return;
20076 }
20077
20078 var authData = this.get('authData');
20079
20080 if (!authData) {
20081 return;
20082 }
20083
20084 AV._objectEach(this.get('authData'), function (value, key) {
20085 if (!authData[key]) {
20086 delete authData[key];
20087 }
20088 });
20089 },
20090
20091 /**
20092 * Synchronizes authData for all providers.
20093 * @private
20094 */
20095 _synchronizeAllAuthData: function _synchronizeAllAuthData() {
20096 var authData = this.get('authData');
20097
20098 if (!authData) {
20099 return;
20100 }
20101
20102 var self = this;
20103
20104 AV._objectEach(this.get('authData'), function (value, key) {
20105 self._synchronizeAuthData(key);
20106 });
20107 },
20108
20109 /**
20110 * Synchronizes auth data for a provider (e.g. puts the access token in the
20111 * right place to be used by the Facebook SDK).
20112 * @private
20113 */
20114 _synchronizeAuthData: function _synchronizeAuthData(provider) {
20115 if (!this.isCurrent()) {
20116 return;
20117 }
20118
20119 var authType;
20120
20121 if (_.isString(provider)) {
20122 authType = provider;
20123 provider = AV.User._authProviders[authType];
20124 } else {
20125 authType = provider.getAuthType();
20126 }
20127
20128 var authData = this.get('authData');
20129
20130 if (!authData || !provider) {
20131 return;
20132 }
20133
20134 var success = provider.restoreAuthentication(authData[authType]);
20135
20136 if (!success) {
20137 this.dissociateAuthData(provider);
20138 }
20139 },
20140 _handleSaveResult: function _handleSaveResult(makeCurrent) {
20141 // Clean up and synchronize the authData object, removing any unset values
20142 if (makeCurrent && !AV._config.disableCurrentUser) {
20143 this._isCurrentUser = true;
20144 }
20145
20146 this._cleanupAuthData();
20147
20148 this._synchronizeAllAuthData(); // Don't keep the password around.
20149
20150
20151 delete this._serverData.password;
20152
20153 this._rebuildEstimatedDataForKey('password');
20154
20155 this._refreshCache();
20156
20157 if ((makeCurrent || this.isCurrent()) && !AV._config.disableCurrentUser) {
20158 // Some old version of leanengine-node-sdk will overwrite
20159 // AV.User._saveCurrentUser which returns no Promise.
20160 // So we need a Promise wrapper.
20161 return _promise.default.resolve(AV.User._saveCurrentUser(this));
20162 } else {
20163 return _promise.default.resolve();
20164 }
20165 },
20166
20167 /**
20168 * Unlike in the Android/iOS SDKs, logInWith is unnecessary, since you can
20169 * call linkWith on the user (even if it doesn't exist yet on the server).
20170 * @private
20171 */
20172 _linkWith: function _linkWith(provider, data) {
20173 var _this = this;
20174
20175 var _ref2 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
20176 _ref2$failOnNotExist = _ref2.failOnNotExist,
20177 failOnNotExist = _ref2$failOnNotExist === void 0 ? false : _ref2$failOnNotExist,
20178 useMasterKey = _ref2.useMasterKey,
20179 sessionToken = _ref2.sessionToken,
20180 user = _ref2.user;
20181
20182 var authType;
20183
20184 if (_.isString(provider)) {
20185 authType = provider;
20186 provider = AV.User._authProviders[provider];
20187 } else {
20188 authType = provider.getAuthType();
20189 }
20190
20191 if (data) {
20192 return this.save({
20193 authData: (0, _defineProperty2.default)({}, authType, data)
20194 }, {
20195 useMasterKey: useMasterKey,
20196 sessionToken: sessionToken,
20197 user: user,
20198 fetchWhenSave: !!this.get('authData'),
20199 _failOnNotExist: failOnNotExist
20200 }).then(function (model) {
20201 return model._handleSaveResult(true).then(function () {
20202 return model;
20203 });
20204 });
20205 } else {
20206 return provider.authenticate().then(function (result) {
20207 return _this._linkWith(provider, result);
20208 });
20209 }
20210 },
20211
20212 /**
20213 * Associate the user with a third party authData.
20214 * @since 3.3.0
20215 * @param {Object} authData The response json data returned from third party token, maybe like { openid: 'abc123', access_token: '123abc', expires_in: 1382686496 }
20216 * @param {string} platform Available platform for sign up.
20217 * @return {Promise<AV.User>} A promise that is fulfilled with the user when completed.
20218 * @example user.associateWithAuthData({
20219 * openid: 'abc123',
20220 * access_token: '123abc',
20221 * expires_in: 1382686496
20222 * }, 'weixin').then(function(user) {
20223 * //Access user here
20224 * }).catch(function(error) {
20225 * //console.error("error: ", error);
20226 * });
20227 */
20228 associateWithAuthData: function associateWithAuthData(authData, platform) {
20229 return this._linkWith(platform, authData);
20230 },
20231
20232 /**
20233 * Associate the user with a third party authData and unionId.
20234 * @since 3.5.0
20235 * @param {Object} authData The response json data returned from third party token, maybe like { openid: 'abc123', access_token: '123abc', expires_in: 1382686496 }
20236 * @param {string} platform Available platform for sign up.
20237 * @param {string} unionId
20238 * @param {Object} [unionLoginOptions]
20239 * @param {string} [unionLoginOptions.unionIdPlatform = 'weixin'] unionId platform
20240 * @param {boolean} [unionLoginOptions.asMainAccount = false] If true, the unionId will be associated with the user.
20241 * @return {Promise<AV.User>} A promise that is fulfilled with the user when completed.
20242 * @example user.associateWithAuthDataAndUnionId({
20243 * openid: 'abc123',
20244 * access_token: '123abc',
20245 * expires_in: 1382686496
20246 * }, 'weixin', 'union123', {
20247 * unionIdPlatform: 'weixin',
20248 * asMainAccount: true,
20249 * }).then(function(user) {
20250 * //Access user here
20251 * }).catch(function(error) {
20252 * //console.error("error: ", error);
20253 * });
20254 */
20255 associateWithAuthDataAndUnionId: function associateWithAuthDataAndUnionId(authData, platform, unionId, unionOptions) {
20256 return this._linkWith(platform, mergeUnionDataIntoAuthData()(authData, unionId, unionOptions));
20257 },
20258
20259 /**
20260 * Associate the user with the identity of the current mini-app.
20261 * @since 4.6.0
20262 * @param {Object} [authInfo]
20263 * @param {Object} [option]
20264 * @param {Boolean} [option.failOnNotExist] If true, the login request will fail when no user matches this authInfo.authData exists.
20265 * @return {Promise<AV.User>}
20266 */
20267 associateWithMiniApp: function associateWithMiniApp(authInfo, option) {
20268 var _this2 = this;
20269
20270 if (authInfo === undefined) {
20271 var getAuthInfo = getAdapter('getAuthInfo');
20272 return getAuthInfo().then(function (authInfo) {
20273 return _this2._linkWith(authInfo.provider, authInfo.authData, option);
20274 });
20275 }
20276
20277 return this._linkWith(authInfo.provider, authInfo.authData, option);
20278 },
20279
20280 /**
20281 * 将用户与 QQ 小程序用户进行关联。适用于为已经在用户系统中存在的用户关联当前使用 QQ 小程序的微信帐号。
20282 * 仅在 QQ 小程序中可用。
20283 *
20284 * @deprecated Please use {@link AV.User#associateWithMiniApp}
20285 * @since 4.2.0
20286 * @param {Object} [options]
20287 * @param {boolean} [options.preferUnionId = false] 如果服务端在登录时获取到了用户的 UnionId,是否将 UnionId 保存在用户账号中。
20288 * @param {string} [options.unionIdPlatform = 'qq'] (only take effect when preferUnionId) unionId platform
20289 * @param {boolean} [options.asMainAccount = true] (only take effect when preferUnionId) If true, the unionId will be associated with the user.
20290 * @return {Promise<AV.User>}
20291 */
20292 associateWithQQApp: function associateWithQQApp() {
20293 var _this3 = this;
20294
20295 var _ref3 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
20296 _ref3$preferUnionId = _ref3.preferUnionId,
20297 preferUnionId = _ref3$preferUnionId === void 0 ? false : _ref3$preferUnionId,
20298 _ref3$unionIdPlatform = _ref3.unionIdPlatform,
20299 unionIdPlatform = _ref3$unionIdPlatform === void 0 ? 'qq' : _ref3$unionIdPlatform,
20300 _ref3$asMainAccount = _ref3.asMainAccount,
20301 asMainAccount = _ref3$asMainAccount === void 0 ? true : _ref3$asMainAccount;
20302
20303 var getAuthInfo = getAdapter('getAuthInfo');
20304 return getAuthInfo({
20305 preferUnionId: preferUnionId,
20306 asMainAccount: asMainAccount,
20307 platform: unionIdPlatform
20308 }).then(function (authInfo) {
20309 authInfo.provider = PLATFORM_QQAPP;
20310 return _this3.associateWithMiniApp(authInfo);
20311 });
20312 },
20313
20314 /**
20315 * 将用户与微信小程序用户进行关联。适用于为已经在用户系统中存在的用户关联当前使用微信小程序的微信帐号。
20316 * 仅在微信小程序中可用。
20317 *
20318 * @deprecated Please use {@link AV.User#associateWithMiniApp}
20319 * @since 3.13.0
20320 * @param {Object} [options]
20321 * @param {boolean} [options.preferUnionId = false] 当用户满足 {@link https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/union-id.html 获取 UnionId 的条件} 时,是否将 UnionId 保存在用户账号中。
20322 * @param {string} [options.unionIdPlatform = 'weixin'] (only take effect when preferUnionId) unionId platform
20323 * @param {boolean} [options.asMainAccount = true] (only take effect when preferUnionId) If true, the unionId will be associated with the user.
20324 * @return {Promise<AV.User>}
20325 */
20326 associateWithWeapp: function associateWithWeapp() {
20327 var _this4 = this;
20328
20329 var _ref4 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
20330 _ref4$preferUnionId = _ref4.preferUnionId,
20331 preferUnionId = _ref4$preferUnionId === void 0 ? false : _ref4$preferUnionId,
20332 _ref4$unionIdPlatform = _ref4.unionIdPlatform,
20333 unionIdPlatform = _ref4$unionIdPlatform === void 0 ? 'weixin' : _ref4$unionIdPlatform,
20334 _ref4$asMainAccount = _ref4.asMainAccount,
20335 asMainAccount = _ref4$asMainAccount === void 0 ? true : _ref4$asMainAccount;
20336
20337 var getAuthInfo = getAdapter('getAuthInfo');
20338 return getAuthInfo({
20339 preferUnionId: preferUnionId,
20340 asMainAccount: asMainAccount,
20341 platform: unionIdPlatform
20342 }).then(function (authInfo) {
20343 return _this4.associateWithMiniApp(authInfo);
20344 });
20345 },
20346
20347 /**
20348 * @deprecated renamed to {@link AV.User#associateWithWeapp}
20349 * @return {Promise<AV.User>}
20350 */
20351 linkWithWeapp: function linkWithWeapp(options) {
20352 console.warn('DEPRECATED: User#linkWithWeapp 已废弃,请使用 User#associateWithWeapp 代替');
20353 return this.associateWithWeapp(options);
20354 },
20355
20356 /**
20357 * 将用户与 QQ 小程序用户进行关联。适用于为已经在用户系统中存在的用户关联当前使用 QQ 小程序的 QQ 帐号。
20358 * 仅在 QQ 小程序中可用。
20359 *
20360 * @deprecated Please use {@link AV.User#associateWithMiniApp}
20361 * @since 4.2.0
20362 * @param {string} unionId
20363 * @param {Object} [unionOptions]
20364 * @param {string} [unionOptions.unionIdPlatform = 'qq'] unionId platform
20365 * @param {boolean} [unionOptions.asMainAccount = false] If true, the unionId will be associated with the user.
20366 * @return {Promise<AV.User>}
20367 */
20368 associateWithQQAppWithUnionId: function associateWithQQAppWithUnionId(unionId) {
20369 var _this5 = this;
20370
20371 var _ref5 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
20372 _ref5$unionIdPlatform = _ref5.unionIdPlatform,
20373 unionIdPlatform = _ref5$unionIdPlatform === void 0 ? 'qq' : _ref5$unionIdPlatform,
20374 _ref5$asMainAccount = _ref5.asMainAccount,
20375 asMainAccount = _ref5$asMainAccount === void 0 ? false : _ref5$asMainAccount;
20376
20377 var getAuthInfo = getAdapter('getAuthInfo');
20378 return getAuthInfo({
20379 platform: unionIdPlatform
20380 }).then(function (authInfo) {
20381 authInfo = AV.User.mergeUnionId(authInfo, unionId, {
20382 asMainAccount: asMainAccount
20383 });
20384 authInfo.provider = PLATFORM_QQAPP;
20385 return _this5.associateWithMiniApp(authInfo);
20386 });
20387 },
20388
20389 /**
20390 * 将用户与微信小程序用户进行关联。适用于为已经在用户系统中存在的用户关联当前使用微信小程序的微信帐号。
20391 * 仅在微信小程序中可用。
20392 *
20393 * @deprecated Please use {@link AV.User#associateWithMiniApp}
20394 * @since 3.13.0
20395 * @param {string} unionId
20396 * @param {Object} [unionOptions]
20397 * @param {string} [unionOptions.unionIdPlatform = 'weixin'] unionId platform
20398 * @param {boolean} [unionOptions.asMainAccount = false] If true, the unionId will be associated with the user.
20399 * @return {Promise<AV.User>}
20400 */
20401 associateWithWeappWithUnionId: function associateWithWeappWithUnionId(unionId) {
20402 var _this6 = this;
20403
20404 var _ref6 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
20405 _ref6$unionIdPlatform = _ref6.unionIdPlatform,
20406 unionIdPlatform = _ref6$unionIdPlatform === void 0 ? 'weixin' : _ref6$unionIdPlatform,
20407 _ref6$asMainAccount = _ref6.asMainAccount,
20408 asMainAccount = _ref6$asMainAccount === void 0 ? false : _ref6$asMainAccount;
20409
20410 var getAuthInfo = getAdapter('getAuthInfo');
20411 return getAuthInfo({
20412 platform: unionIdPlatform
20413 }).then(function (authInfo) {
20414 authInfo = AV.User.mergeUnionId(authInfo, unionId, {
20415 asMainAccount: asMainAccount
20416 });
20417 return _this6.associateWithMiniApp(authInfo);
20418 });
20419 },
20420
20421 /**
20422 * Unlinks a user from a service.
20423 * @param {string} platform
20424 * @return {Promise<AV.User>}
20425 * @since 3.3.0
20426 */
20427 dissociateAuthData: function dissociateAuthData(provider) {
20428 this.unset("authData.".concat(provider));
20429 return this.save().then(function (model) {
20430 return model._handleSaveResult(true).then(function () {
20431 return model;
20432 });
20433 });
20434 },
20435
20436 /**
20437 * @private
20438 * @deprecated
20439 */
20440 _unlinkFrom: function _unlinkFrom(provider) {
20441 console.warn('DEPRECATED: User#_unlinkFrom 已废弃,请使用 User#dissociateAuthData 代替');
20442 return this.dissociateAuthData(provider);
20443 },
20444
20445 /**
20446 * Checks whether a user is linked to a service.
20447 * @private
20448 */
20449 _isLinked: function _isLinked(provider) {
20450 var authType;
20451
20452 if (_.isString(provider)) {
20453 authType = provider;
20454 } else {
20455 authType = provider.getAuthType();
20456 }
20457
20458 var authData = this.get('authData') || {};
20459 return !!authData[authType];
20460 },
20461
20462 /**
20463 * Checks whether a user is anonymous.
20464 * @since 3.9.0
20465 * @return {boolean}
20466 */
20467 isAnonymous: function isAnonymous() {
20468 return this._isLinked(PLATFORM_ANONYMOUS);
20469 },
20470 logOut: function logOut() {
20471 this._logOutWithAll();
20472
20473 this._isCurrentUser = false;
20474 },
20475
20476 /**
20477 * Deauthenticates all providers.
20478 * @private
20479 */
20480 _logOutWithAll: function _logOutWithAll() {
20481 var authData = this.get('authData');
20482
20483 if (!authData) {
20484 return;
20485 }
20486
20487 var self = this;
20488
20489 AV._objectEach(this.get('authData'), function (value, key) {
20490 self._logOutWith(key);
20491 });
20492 },
20493
20494 /**
20495 * Deauthenticates a single provider (e.g. removing access tokens from the
20496 * Facebook SDK).
20497 * @private
20498 */
20499 _logOutWith: function _logOutWith(provider) {
20500 if (!this.isCurrent()) {
20501 return;
20502 }
20503
20504 if (_.isString(provider)) {
20505 provider = AV.User._authProviders[provider];
20506 }
20507
20508 if (provider && provider.deauthenticate) {
20509 provider.deauthenticate();
20510 }
20511 },
20512
20513 /**
20514 * Signs up a new user. You should call this instead of save for
20515 * new AV.Users. This will create a new AV.User on the server, and
20516 * also persist the session on disk so that you can access the user using
20517 * <code>current</code>.
20518 *
20519 * <p>A username and password must be set before calling signUp.</p>
20520 *
20521 * @param {Object} attrs Extra fields to set on the new user, or null.
20522 * @param {AuthOptions} options
20523 * @return {Promise} A promise that is fulfilled when the signup
20524 * finishes.
20525 * @see AV.User.signUp
20526 */
20527 signUp: function signUp(attrs, options) {
20528 var error;
20529 var username = attrs && attrs.username || this.get('username');
20530
20531 if (!username || username === '') {
20532 error = new AVError(AVError.OTHER_CAUSE, 'Cannot sign up user with an empty name.');
20533 throw error;
20534 }
20535
20536 var password = attrs && attrs.password || this.get('password');
20537
20538 if (!password || password === '') {
20539 error = new AVError(AVError.OTHER_CAUSE, 'Cannot sign up user with an empty password.');
20540 throw error;
20541 }
20542
20543 return this.save(attrs, options).then(function (model) {
20544 if (model.isAnonymous()) {
20545 model.unset("authData.".concat(PLATFORM_ANONYMOUS));
20546 model._opSetQueue = [{}];
20547 }
20548
20549 return model._handleSaveResult(true).then(function () {
20550 return model;
20551 });
20552 });
20553 },
20554
20555 /**
20556 * Signs up a new user with mobile phone and sms code.
20557 * You should call this instead of save for
20558 * new AV.Users. This will create a new AV.User on the server, and
20559 * also persist the session on disk so that you can access the user using
20560 * <code>current</code>.
20561 *
20562 * <p>A username and password must be set before calling signUp.</p>
20563 *
20564 * @param {Object} attrs Extra fields to set on the new user, or null.
20565 * @param {AuthOptions} options
20566 * @return {Promise} A promise that is fulfilled when the signup
20567 * finishes.
20568 * @see AV.User.signUpOrlogInWithMobilePhone
20569 * @see AV.Cloud.requestSmsCode
20570 */
20571 signUpOrlogInWithMobilePhone: function signUpOrlogInWithMobilePhone(attrs) {
20572 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
20573 var error;
20574 var mobilePhoneNumber = attrs && attrs.mobilePhoneNumber || this.get('mobilePhoneNumber');
20575
20576 if (!mobilePhoneNumber || mobilePhoneNumber === '') {
20577 error = new AVError(AVError.OTHER_CAUSE, 'Cannot sign up or login user by mobilePhoneNumber ' + 'with an empty mobilePhoneNumber.');
20578 throw error;
20579 }
20580
20581 var smsCode = attrs && attrs.smsCode || this.get('smsCode');
20582
20583 if (!smsCode || smsCode === '') {
20584 error = new AVError(AVError.OTHER_CAUSE, 'Cannot sign up or login user by mobilePhoneNumber ' + 'with an empty smsCode.');
20585 throw error;
20586 }
20587
20588 options._makeRequest = function (route, className, id, method, json) {
20589 return AVRequest('usersByMobilePhone', null, null, 'POST', json);
20590 };
20591
20592 return this.save(attrs, options).then(function (model) {
20593 delete model.attributes.smsCode;
20594 delete model._serverData.smsCode;
20595 return model._handleSaveResult(true).then(function () {
20596 return model;
20597 });
20598 });
20599 },
20600
20601 /**
20602 * The same with {@link AV.User.loginWithAuthData}, except that you can set attributes before login.
20603 * @since 3.7.0
20604 */
20605 loginWithAuthData: function loginWithAuthData(authData, platform, options) {
20606 return this._linkWith(platform, authData, options);
20607 },
20608
20609 /**
20610 * The same with {@link AV.User.loginWithAuthDataAndUnionId}, except that you can set attributes before login.
20611 * @since 3.7.0
20612 */
20613 loginWithAuthDataAndUnionId: function loginWithAuthDataAndUnionId(authData, platform, unionId, unionLoginOptions) {
20614 return this.loginWithAuthData(mergeUnionDataIntoAuthData()(authData, unionId, unionLoginOptions), platform, unionLoginOptions);
20615 },
20616
20617 /**
20618 * The same with {@link AV.User.loginWithWeapp}, except that you can set attributes before login.
20619 * @deprecated please use {@link AV.User#loginWithMiniApp}
20620 * @since 3.7.0
20621 * @param {Object} [options]
20622 * @param {boolean} [options.failOnNotExist] If true, the login request will fail when no user matches this authData exists.
20623 * @param {boolean} [options.preferUnionId] 当用户满足 {@link https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/union-id.html 获取 UnionId 的条件} 时,是否使用 UnionId 登录。(since 3.13.0)
20624 * @param {string} [options.unionIdPlatform = 'weixin'] (only take effect when preferUnionId) unionId platform
20625 * @param {boolean} [options.asMainAccount = true] (only take effect when preferUnionId) If true, the unionId will be associated with the user.
20626 * @return {Promise<AV.User>}
20627 */
20628 loginWithWeapp: function loginWithWeapp() {
20629 var _this7 = this;
20630
20631 var _ref7 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
20632 _ref7$preferUnionId = _ref7.preferUnionId,
20633 preferUnionId = _ref7$preferUnionId === void 0 ? false : _ref7$preferUnionId,
20634 _ref7$unionIdPlatform = _ref7.unionIdPlatform,
20635 unionIdPlatform = _ref7$unionIdPlatform === void 0 ? 'weixin' : _ref7$unionIdPlatform,
20636 _ref7$asMainAccount = _ref7.asMainAccount,
20637 asMainAccount = _ref7$asMainAccount === void 0 ? true : _ref7$asMainAccount,
20638 _ref7$failOnNotExist = _ref7.failOnNotExist,
20639 failOnNotExist = _ref7$failOnNotExist === void 0 ? false : _ref7$failOnNotExist,
20640 useMasterKey = _ref7.useMasterKey,
20641 sessionToken = _ref7.sessionToken,
20642 user = _ref7.user;
20643
20644 var getAuthInfo = getAdapter('getAuthInfo');
20645 return getAuthInfo({
20646 preferUnionId: preferUnionId,
20647 asMainAccount: asMainAccount,
20648 platform: unionIdPlatform
20649 }).then(function (authInfo) {
20650 return _this7.loginWithMiniApp(authInfo, {
20651 failOnNotExist: failOnNotExist,
20652 useMasterKey: useMasterKey,
20653 sessionToken: sessionToken,
20654 user: user
20655 });
20656 });
20657 },
20658
20659 /**
20660 * The same with {@link AV.User.loginWithWeappWithUnionId}, except that you can set attributes before login.
20661 * @deprecated please use {@link AV.User#loginWithMiniApp}
20662 * @since 3.13.0
20663 */
20664 loginWithWeappWithUnionId: function loginWithWeappWithUnionId(unionId) {
20665 var _this8 = this;
20666
20667 var _ref8 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
20668 _ref8$unionIdPlatform = _ref8.unionIdPlatform,
20669 unionIdPlatform = _ref8$unionIdPlatform === void 0 ? 'weixin' : _ref8$unionIdPlatform,
20670 _ref8$asMainAccount = _ref8.asMainAccount,
20671 asMainAccount = _ref8$asMainAccount === void 0 ? false : _ref8$asMainAccount,
20672 _ref8$failOnNotExist = _ref8.failOnNotExist,
20673 failOnNotExist = _ref8$failOnNotExist === void 0 ? false : _ref8$failOnNotExist,
20674 useMasterKey = _ref8.useMasterKey,
20675 sessionToken = _ref8.sessionToken,
20676 user = _ref8.user;
20677
20678 var getAuthInfo = getAdapter('getAuthInfo');
20679 return getAuthInfo({
20680 platform: unionIdPlatform
20681 }).then(function (authInfo) {
20682 authInfo = AV.User.mergeUnionId(authInfo, unionId, {
20683 asMainAccount: asMainAccount
20684 });
20685 return _this8.loginWithMiniApp(authInfo, {
20686 failOnNotExist: failOnNotExist,
20687 useMasterKey: useMasterKey,
20688 sessionToken: sessionToken,
20689 user: user
20690 });
20691 });
20692 },
20693
20694 /**
20695 * The same with {@link AV.User.loginWithQQApp}, except that you can set attributes before login.
20696 * @deprecated please use {@link AV.User#loginWithMiniApp}
20697 * @since 4.2.0
20698 * @param {Object} [options]
20699 * @param {boolean} [options.failOnNotExist] If true, the login request will fail when no user matches this authData exists.
20700 * @param {boolean} [options.preferUnionId] 如果服务端在登录时获取到了用户的 UnionId,是否将 UnionId 保存在用户账号中。
20701 * @param {string} [options.unionIdPlatform = 'qq'] (only take effect when preferUnionId) unionId platform
20702 * @param {boolean} [options.asMainAccount = true] (only take effect when preferUnionId) If true, the unionId will be associated with the user.
20703 */
20704 loginWithQQApp: function loginWithQQApp() {
20705 var _this9 = this;
20706
20707 var _ref9 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
20708 _ref9$preferUnionId = _ref9.preferUnionId,
20709 preferUnionId = _ref9$preferUnionId === void 0 ? false : _ref9$preferUnionId,
20710 _ref9$unionIdPlatform = _ref9.unionIdPlatform,
20711 unionIdPlatform = _ref9$unionIdPlatform === void 0 ? 'qq' : _ref9$unionIdPlatform,
20712 _ref9$asMainAccount = _ref9.asMainAccount,
20713 asMainAccount = _ref9$asMainAccount === void 0 ? true : _ref9$asMainAccount,
20714 _ref9$failOnNotExist = _ref9.failOnNotExist,
20715 failOnNotExist = _ref9$failOnNotExist === void 0 ? false : _ref9$failOnNotExist,
20716 useMasterKey = _ref9.useMasterKey,
20717 sessionToken = _ref9.sessionToken,
20718 user = _ref9.user;
20719
20720 var getAuthInfo = getAdapter('getAuthInfo');
20721 return getAuthInfo({
20722 preferUnionId: preferUnionId,
20723 asMainAccount: asMainAccount,
20724 platform: unionIdPlatform
20725 }).then(function (authInfo) {
20726 authInfo.provider = PLATFORM_QQAPP;
20727 return _this9.loginWithMiniApp(authInfo, {
20728 failOnNotExist: failOnNotExist,
20729 useMasterKey: useMasterKey,
20730 sessionToken: sessionToken,
20731 user: user
20732 });
20733 });
20734 },
20735
20736 /**
20737 * The same with {@link AV.User.loginWithQQAppWithUnionId}, except that you can set attributes before login.
20738 * @deprecated please use {@link AV.User#loginWithMiniApp}
20739 * @since 4.2.0
20740 */
20741 loginWithQQAppWithUnionId: function loginWithQQAppWithUnionId(unionId) {
20742 var _this10 = this;
20743
20744 var _ref10 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
20745 _ref10$unionIdPlatfor = _ref10.unionIdPlatform,
20746 unionIdPlatform = _ref10$unionIdPlatfor === void 0 ? 'qq' : _ref10$unionIdPlatfor,
20747 _ref10$asMainAccount = _ref10.asMainAccount,
20748 asMainAccount = _ref10$asMainAccount === void 0 ? false : _ref10$asMainAccount,
20749 _ref10$failOnNotExist = _ref10.failOnNotExist,
20750 failOnNotExist = _ref10$failOnNotExist === void 0 ? false : _ref10$failOnNotExist,
20751 useMasterKey = _ref10.useMasterKey,
20752 sessionToken = _ref10.sessionToken,
20753 user = _ref10.user;
20754
20755 var getAuthInfo = getAdapter('getAuthInfo');
20756 return getAuthInfo({
20757 platform: unionIdPlatform
20758 }).then(function (authInfo) {
20759 authInfo = AV.User.mergeUnionId(authInfo, unionId, {
20760 asMainAccount: asMainAccount
20761 });
20762 authInfo.provider = PLATFORM_QQAPP;
20763 return _this10.loginWithMiniApp(authInfo, {
20764 failOnNotExist: failOnNotExist,
20765 useMasterKey: useMasterKey,
20766 sessionToken: sessionToken,
20767 user: user
20768 });
20769 });
20770 },
20771
20772 /**
20773 * The same with {@link AV.User.loginWithMiniApp}, except that you can set attributes before login.
20774 * @since 4.6.0
20775 */
20776 loginWithMiniApp: function loginWithMiniApp(authInfo, option) {
20777 var _this11 = this;
20778
20779 if (authInfo === undefined) {
20780 var getAuthInfo = getAdapter('getAuthInfo');
20781 return getAuthInfo().then(function (authInfo) {
20782 return _this11.loginWithAuthData(authInfo.authData, authInfo.provider, option);
20783 });
20784 }
20785
20786 return this.loginWithAuthData(authInfo.authData, authInfo.provider, option);
20787 },
20788
20789 /**
20790 * Logs in a AV.User. On success, this saves the session to localStorage,
20791 * so you can retrieve the currently logged in user using
20792 * <code>current</code>.
20793 *
20794 * <p>A username and password must be set before calling logIn.</p>
20795 *
20796 * @see AV.User.logIn
20797 * @return {Promise} A promise that is fulfilled with the user when
20798 * the login is complete.
20799 */
20800 logIn: function logIn() {
20801 var model = this;
20802 var request = AVRequest('login', null, null, 'POST', this.toJSON());
20803 return request.then(function (resp) {
20804 var serverAttrs = model.parse(resp);
20805
20806 model._finishFetch(serverAttrs);
20807
20808 return model._handleSaveResult(true).then(function () {
20809 if (!serverAttrs.smsCode) delete model.attributes['smsCode'];
20810 return model;
20811 });
20812 });
20813 },
20814
20815 /**
20816 * @see AV.Object#save
20817 */
20818 save: function save(arg1, arg2, arg3) {
20819 var attrs, options;
20820
20821 if (_.isObject(arg1) || _.isNull(arg1) || _.isUndefined(arg1)) {
20822 attrs = arg1;
20823 options = arg2;
20824 } else {
20825 attrs = {};
20826 attrs[arg1] = arg2;
20827 options = arg3;
20828 }
20829
20830 options = options || {};
20831 return AV.Object.prototype.save.call(this, attrs, options).then(function (model) {
20832 return model._handleSaveResult(false).then(function () {
20833 return model;
20834 });
20835 });
20836 },
20837
20838 /**
20839 * Follow a user
20840 * @since 0.3.0
20841 * @param {Object | AV.User | String} options if an AV.User or string is given, it will be used as the target user.
20842 * @param {AV.User | String} options.user The target user or user's objectId to follow.
20843 * @param {Object} [options.attributes] key-value attributes dictionary to be used as
20844 * conditions of followerQuery/followeeQuery.
20845 * @param {AuthOptions} [authOptions]
20846 */
20847 follow: function follow(options, authOptions) {
20848 if (!this.id) {
20849 throw new Error('Please signin.');
20850 }
20851
20852 var user;
20853 var attributes;
20854
20855 if (options.user) {
20856 user = options.user;
20857 attributes = options.attributes;
20858 } else {
20859 user = options;
20860 }
20861
20862 var userObjectId = _.isString(user) ? user : user.id;
20863
20864 if (!userObjectId) {
20865 throw new Error('Invalid target user.');
20866 }
20867
20868 var route = 'users/' + this.id + '/friendship/' + userObjectId;
20869 var request = AVRequest(route, null, null, 'POST', AV._encode(attributes), authOptions);
20870 return request;
20871 },
20872
20873 /**
20874 * Unfollow a user.
20875 * @since 0.3.0
20876 * @param {Object | AV.User | String} options if an AV.User or string is given, it will be used as the target user.
20877 * @param {AV.User | String} options.user The target user or user's objectId to unfollow.
20878 * @param {AuthOptions} [authOptions]
20879 */
20880 unfollow: function unfollow(options, authOptions) {
20881 if (!this.id) {
20882 throw new Error('Please signin.');
20883 }
20884
20885 var user;
20886
20887 if (options.user) {
20888 user = options.user;
20889 } else {
20890 user = options;
20891 }
20892
20893 var userObjectId = _.isString(user) ? user : user.id;
20894
20895 if (!userObjectId) {
20896 throw new Error('Invalid target user.');
20897 }
20898
20899 var route = 'users/' + this.id + '/friendship/' + userObjectId;
20900 var request = AVRequest(route, null, null, 'DELETE', null, authOptions);
20901 return request;
20902 },
20903
20904 /**
20905 * Get the user's followers and followees.
20906 * @since 4.8.0
20907 * @param {Object} [options]
20908 * @param {Number} [options.skip]
20909 * @param {Number} [options.limit]
20910 * @param {AuthOptions} [authOptions]
20911 */
20912 getFollowersAndFollowees: function getFollowersAndFollowees(options, authOptions) {
20913 if (!this.id) {
20914 throw new Error('Please signin.');
20915 }
20916
20917 return request({
20918 method: 'GET',
20919 path: "/users/".concat(this.id, "/followersAndFollowees"),
20920 query: {
20921 skip: options && options.skip,
20922 limit: options && options.limit,
20923 include: 'follower,followee',
20924 keys: 'follower,followee'
20925 },
20926 authOptions: authOptions
20927 }).then(function (_ref11) {
20928 var followers = _ref11.followers,
20929 followees = _ref11.followees;
20930 return {
20931 followers: (0, _map.default)(followers).call(followers, function (_ref12) {
20932 var follower = _ref12.follower;
20933 return AV._decode(follower);
20934 }),
20935 followees: (0, _map.default)(followees).call(followees, function (_ref13) {
20936 var followee = _ref13.followee;
20937 return AV._decode(followee);
20938 })
20939 };
20940 });
20941 },
20942
20943 /**
20944 *Create a follower query to query the user's followers.
20945 * @since 0.3.0
20946 * @see AV.User#followerQuery
20947 */
20948 followerQuery: function followerQuery() {
20949 return AV.User.followerQuery(this.id);
20950 },
20951
20952 /**
20953 *Create a followee query to query the user's followees.
20954 * @since 0.3.0
20955 * @see AV.User#followeeQuery
20956 */
20957 followeeQuery: function followeeQuery() {
20958 return AV.User.followeeQuery(this.id);
20959 },
20960
20961 /**
20962 * @see AV.Object#fetch
20963 */
20964 fetch: function fetch(fetchOptions, options) {
20965 return AV.Object.prototype.fetch.call(this, fetchOptions, options).then(function (model) {
20966 return model._handleSaveResult(false).then(function () {
20967 return model;
20968 });
20969 });
20970 },
20971
20972 /**
20973 * Update user's new password safely based on old password.
20974 * @param {String} oldPassword the old password.
20975 * @param {String} newPassword the new password.
20976 * @param {AuthOptions} options
20977 */
20978 updatePassword: function updatePassword(oldPassword, newPassword, options) {
20979 var _this12 = this;
20980
20981 var route = 'users/' + this.id + '/updatePassword';
20982 var params = {
20983 old_password: oldPassword,
20984 new_password: newPassword
20985 };
20986 var request = AVRequest(route, null, null, 'PUT', params, options);
20987 return request.then(function (resp) {
20988 _this12._finishFetch(_this12.parse(resp));
20989
20990 return _this12._handleSaveResult(true).then(function () {
20991 return resp;
20992 });
20993 });
20994 },
20995
20996 /**
20997 * Returns true if <code>current</code> would return this user.
20998 * @see AV.User#current
20999 */
21000 isCurrent: function isCurrent() {
21001 return this._isCurrentUser;
21002 },
21003
21004 /**
21005 * Returns get("username").
21006 * @return {String}
21007 * @see AV.Object#get
21008 */
21009 getUsername: function getUsername() {
21010 return this.get('username');
21011 },
21012
21013 /**
21014 * Returns get("mobilePhoneNumber").
21015 * @return {String}
21016 * @see AV.Object#get
21017 */
21018 getMobilePhoneNumber: function getMobilePhoneNumber() {
21019 return this.get('mobilePhoneNumber');
21020 },
21021
21022 /**
21023 * Calls set("mobilePhoneNumber", phoneNumber, options) and returns the result.
21024 * @param {String} mobilePhoneNumber
21025 * @return {Boolean}
21026 * @see AV.Object#set
21027 */
21028 setMobilePhoneNumber: function setMobilePhoneNumber(phone, options) {
21029 return this.set('mobilePhoneNumber', phone, options);
21030 },
21031
21032 /**
21033 * Calls set("username", username, options) and returns the result.
21034 * @param {String} username
21035 * @return {Boolean}
21036 * @see AV.Object#set
21037 */
21038 setUsername: function setUsername(username, options) {
21039 return this.set('username', username, options);
21040 },
21041
21042 /**
21043 * Calls set("password", password, options) and returns the result.
21044 * @param {String} password
21045 * @return {Boolean}
21046 * @see AV.Object#set
21047 */
21048 setPassword: function setPassword(password, options) {
21049 return this.set('password', password, options);
21050 },
21051
21052 /**
21053 * Returns get("email").
21054 * @return {String}
21055 * @see AV.Object#get
21056 */
21057 getEmail: function getEmail() {
21058 return this.get('email');
21059 },
21060
21061 /**
21062 * Calls set("email", email, options) and returns the result.
21063 * @param {String} email
21064 * @param {AuthOptions} options
21065 * @return {Boolean}
21066 * @see AV.Object#set
21067 */
21068 setEmail: function setEmail(email, options) {
21069 return this.set('email', email, options);
21070 },
21071
21072 /**
21073 * Checks whether this user is the current user and has been authenticated.
21074 * @deprecated 如果要判断当前用户的登录状态是否有效,请使用 currentUser.isAuthenticated().then(),
21075 * 如果要判断该用户是否是当前登录用户,请使用 user.id === currentUser.id
21076 * @return (Boolean) whether this user is the current user and is logged in.
21077 */
21078 authenticated: function authenticated() {
21079 console.warn('DEPRECATED: 如果要判断当前用户的登录状态是否有效,请使用 currentUser.isAuthenticated().then(),如果要判断该用户是否是当前登录用户,请使用 user.id === currentUser.id。');
21080 return !!this._sessionToken && !AV._config.disableCurrentUser && AV.User.current() && AV.User.current().id === this.id;
21081 },
21082
21083 /**
21084 * Detects if current sessionToken is valid.
21085 *
21086 * @since 2.0.0
21087 * @return Promise.<Boolean>
21088 */
21089 isAuthenticated: function isAuthenticated() {
21090 var _this13 = this;
21091
21092 return _promise.default.resolve().then(function () {
21093 return !!_this13._sessionToken && AV.User._fetchUserBySessionToken(_this13._sessionToken).then(function () {
21094 return true;
21095 }, function (error) {
21096 if (error.code === 211) {
21097 return false;
21098 }
21099
21100 throw error;
21101 });
21102 });
21103 },
21104
21105 /**
21106 * Get sessionToken of current user.
21107 * @return {String} sessionToken
21108 */
21109 getSessionToken: function getSessionToken() {
21110 return this._sessionToken;
21111 },
21112
21113 /**
21114 * Refresh sessionToken of current user.
21115 * @since 2.1.0
21116 * @param {AuthOptions} [options]
21117 * @return {Promise.<AV.User>} user with refreshed sessionToken
21118 */
21119 refreshSessionToken: function refreshSessionToken(options) {
21120 var _this14 = this;
21121
21122 return AVRequest("users/".concat(this.id, "/refreshSessionToken"), null, null, 'PUT', null, options).then(function (response) {
21123 _this14._finishFetch(response);
21124
21125 return _this14._handleSaveResult(true).then(function () {
21126 return _this14;
21127 });
21128 });
21129 },
21130
21131 /**
21132 * Get this user's Roles.
21133 * @param {AuthOptions} [options]
21134 * @return {Promise.<AV.Role[]>} A promise that is fulfilled with the roles when
21135 * the query is complete.
21136 */
21137 getRoles: function getRoles(options) {
21138 var _context;
21139
21140 return (0, _find.default)(_context = AV.Relation.reverseQuery('_Role', 'users', this)).call(_context, options);
21141 }
21142 },
21143 /** @lends AV.User */
21144 {
21145 // Class Variables
21146 // The currently logged-in user.
21147 _currentUser: null,
21148 // Whether currentUser is known to match the serialized version on disk.
21149 // This is useful for saving a localstorage check if you try to load
21150 // _currentUser frequently while there is none stored.
21151 _currentUserMatchesDisk: false,
21152 // The localStorage key suffix that the current user is stored under.
21153 _CURRENT_USER_KEY: 'currentUser',
21154 // The mapping of auth provider names to actual providers
21155 _authProviders: {},
21156 // Class Methods
21157
21158 /**
21159 * Signs up a new user with a username (or email) and password.
21160 * This will create a new AV.User on the server, and also persist the
21161 * session in localStorage so that you can access the user using
21162 * {@link #current}.
21163 *
21164 * @param {String} username The username (or email) to sign up with.
21165 * @param {String} password The password to sign up with.
21166 * @param {Object} [attrs] Extra fields to set on the new user.
21167 * @param {AuthOptions} [options]
21168 * @return {Promise} A promise that is fulfilled with the user when
21169 * the signup completes.
21170 * @see AV.User#signUp
21171 */
21172 signUp: function signUp(username, password, attrs, options) {
21173 attrs = attrs || {};
21174 attrs.username = username;
21175 attrs.password = password;
21176
21177 var user = AV.Object._create('_User');
21178
21179 return user.signUp(attrs, options);
21180 },
21181
21182 /**
21183 * Logs in a user with a username (or email) and password. On success, this
21184 * saves the session to disk, so you can retrieve the currently logged in
21185 * user using <code>current</code>.
21186 *
21187 * @param {String} username The username (or email) to log in with.
21188 * @param {String} password The password to log in with.
21189 * @return {Promise} A promise that is fulfilled with the user when
21190 * the login completes.
21191 * @see AV.User#logIn
21192 */
21193 logIn: function logIn(username, password) {
21194 var user = AV.Object._create('_User');
21195
21196 user._finishFetch({
21197 username: username,
21198 password: password
21199 });
21200
21201 return user.logIn();
21202 },
21203
21204 /**
21205 * Logs in a user with a session token. On success, this saves the session
21206 * to disk, so you can retrieve the currently logged in user using
21207 * <code>current</code>.
21208 *
21209 * @param {String} sessionToken The sessionToken to log in with.
21210 * @return {Promise} A promise that is fulfilled with the user when
21211 * the login completes.
21212 */
21213 become: function become(sessionToken) {
21214 return this._fetchUserBySessionToken(sessionToken).then(function (user) {
21215 return user._handleSaveResult(true).then(function () {
21216 return user;
21217 });
21218 });
21219 },
21220 _fetchUserBySessionToken: function _fetchUserBySessionToken(sessionToken) {
21221 if (sessionToken === undefined) {
21222 return _promise.default.reject(new Error('The sessionToken cannot be undefined'));
21223 }
21224
21225 var user = AV.Object._create('_User');
21226
21227 return request({
21228 method: 'GET',
21229 path: '/users/me',
21230 authOptions: {
21231 sessionToken: sessionToken
21232 }
21233 }).then(function (resp) {
21234 var serverAttrs = user.parse(resp);
21235
21236 user._finishFetch(serverAttrs);
21237
21238 return user;
21239 });
21240 },
21241
21242 /**
21243 * Logs in a user with a mobile phone number and sms code sent by
21244 * AV.User.requestLoginSmsCode.On success, this
21245 * saves the session to disk, so you can retrieve the currently logged in
21246 * user using <code>current</code>.
21247 *
21248 * @param {String} mobilePhone The user's mobilePhoneNumber
21249 * @param {String} smsCode The sms code sent by AV.User.requestLoginSmsCode
21250 * @return {Promise} A promise that is fulfilled with the user when
21251 * the login completes.
21252 * @see AV.User#logIn
21253 */
21254 logInWithMobilePhoneSmsCode: function logInWithMobilePhoneSmsCode(mobilePhone, smsCode) {
21255 var user = AV.Object._create('_User');
21256
21257 user._finishFetch({
21258 mobilePhoneNumber: mobilePhone,
21259 smsCode: smsCode
21260 });
21261
21262 return user.logIn();
21263 },
21264
21265 /**
21266 * Signs up or logs in a user with a mobilePhoneNumber and smsCode.
21267 * On success, this saves the session to disk, so you can retrieve the currently
21268 * logged in user using <code>current</code>.
21269 *
21270 * @param {String} mobilePhoneNumber The user's mobilePhoneNumber.
21271 * @param {String} smsCode The sms code sent by AV.Cloud.requestSmsCode
21272 * @param {Object} attributes The user's other attributes such as username etc.
21273 * @param {AuthOptions} options
21274 * @return {Promise} A promise that is fulfilled with the user when
21275 * the login completes.
21276 * @see AV.User#signUpOrlogInWithMobilePhone
21277 * @see AV.Cloud.requestSmsCode
21278 */
21279 signUpOrlogInWithMobilePhone: function signUpOrlogInWithMobilePhone(mobilePhoneNumber, smsCode, attrs, options) {
21280 attrs = attrs || {};
21281 attrs.mobilePhoneNumber = mobilePhoneNumber;
21282 attrs.smsCode = smsCode;
21283
21284 var user = AV.Object._create('_User');
21285
21286 return user.signUpOrlogInWithMobilePhone(attrs, options);
21287 },
21288
21289 /**
21290 * Logs in a user with a mobile phone number and password. On success, this
21291 * saves the session to disk, so you can retrieve the currently logged in
21292 * user using <code>current</code>.
21293 *
21294 * @param {String} mobilePhone The user's mobilePhoneNumber
21295 * @param {String} password The password to log in with.
21296 * @return {Promise} A promise that is fulfilled with the user when
21297 * the login completes.
21298 * @see AV.User#logIn
21299 */
21300 logInWithMobilePhone: function logInWithMobilePhone(mobilePhone, password) {
21301 var user = AV.Object._create('_User');
21302
21303 user._finishFetch({
21304 mobilePhoneNumber: mobilePhone,
21305 password: password
21306 });
21307
21308 return user.logIn();
21309 },
21310
21311 /**
21312 * Logs in a user with email and password.
21313 *
21314 * @since 3.13.0
21315 * @param {String} email The user's email.
21316 * @param {String} password The password to log in with.
21317 * @return {Promise} A promise that is fulfilled with the user when
21318 * the login completes.
21319 */
21320 loginWithEmail: function loginWithEmail(email, password) {
21321 var user = AV.Object._create('_User');
21322
21323 user._finishFetch({
21324 email: email,
21325 password: password
21326 });
21327
21328 return user.logIn();
21329 },
21330
21331 /**
21332 * Signs up or logs in a user with a third party auth data(AccessToken).
21333 * On success, this saves the session to disk, so you can retrieve the currently
21334 * logged in user using <code>current</code>.
21335 *
21336 * @since 3.7.0
21337 * @param {Object} authData The response json data returned from third party token, maybe like { openid: 'abc123', access_token: '123abc', expires_in: 1382686496 }
21338 * @param {string} platform Available platform for sign up.
21339 * @param {Object} [options]
21340 * @param {boolean} [options.failOnNotExist] If true, the login request will fail when no user matches this authData exists.
21341 * @return {Promise} A promise that is fulfilled with the user when
21342 * the login completes.
21343 * @example AV.User.loginWithAuthData({
21344 * openid: 'abc123',
21345 * access_token: '123abc',
21346 * expires_in: 1382686496
21347 * }, 'weixin').then(function(user) {
21348 * //Access user here
21349 * }).catch(function(error) {
21350 * //console.error("error: ", error);
21351 * });
21352 * @see {@link https://leancloud.cn/docs/js_guide.html#绑定第三方平台账户}
21353 */
21354 loginWithAuthData: function loginWithAuthData(authData, platform, options) {
21355 return AV.User._logInWith(platform, authData, options);
21356 },
21357
21358 /**
21359 * @deprecated renamed to {@link AV.User.loginWithAuthData}
21360 */
21361 signUpOrlogInWithAuthData: function signUpOrlogInWithAuthData() {
21362 console.warn('DEPRECATED: User.signUpOrlogInWithAuthData 已废弃,请使用 User#loginWithAuthData 代替');
21363 return this.loginWithAuthData.apply(this, arguments);
21364 },
21365
21366 /**
21367 * Signs up or logs in a user with a third party authData and unionId.
21368 * @since 3.7.0
21369 * @param {Object} authData The response json data returned from third party token, maybe like { openid: 'abc123', access_token: '123abc', expires_in: 1382686496 }
21370 * @param {string} platform Available platform for sign up.
21371 * @param {string} unionId
21372 * @param {Object} [unionLoginOptions]
21373 * @param {string} [unionLoginOptions.unionIdPlatform = 'weixin'] unionId platform
21374 * @param {boolean} [unionLoginOptions.asMainAccount = false] If true, the unionId will be associated with the user.
21375 * @param {boolean} [unionLoginOptions.failOnNotExist] If true, the login request will fail when no user matches this authData exists.
21376 * @return {Promise<AV.User>} A promise that is fulfilled with the user when completed.
21377 * @example AV.User.loginWithAuthDataAndUnionId({
21378 * openid: 'abc123',
21379 * access_token: '123abc',
21380 * expires_in: 1382686496
21381 * }, 'weixin', 'union123', {
21382 * unionIdPlatform: 'weixin',
21383 * asMainAccount: true,
21384 * }).then(function(user) {
21385 * //Access user here
21386 * }).catch(function(error) {
21387 * //console.error("error: ", error);
21388 * });
21389 */
21390 loginWithAuthDataAndUnionId: function loginWithAuthDataAndUnionId(authData, platform, unionId, unionLoginOptions) {
21391 return this.loginWithAuthData(mergeUnionDataIntoAuthData()(authData, unionId, unionLoginOptions), platform, unionLoginOptions);
21392 },
21393
21394 /**
21395 * @deprecated renamed to {@link AV.User.loginWithAuthDataAndUnionId}
21396 * @since 3.5.0
21397 */
21398 signUpOrlogInWithAuthDataAndUnionId: function signUpOrlogInWithAuthDataAndUnionId() {
21399 console.warn('DEPRECATED: User.signUpOrlogInWithAuthDataAndUnionId 已废弃,请使用 User#loginWithAuthDataAndUnionId 代替');
21400 return this.loginWithAuthDataAndUnionId.apply(this, arguments);
21401 },
21402
21403 /**
21404 * Merge unionId into authInfo.
21405 * @since 4.6.0
21406 * @param {Object} authInfo
21407 * @param {String} unionId
21408 * @param {Object} [unionIdOption]
21409 * @param {Boolean} [unionIdOption.asMainAccount] If true, the unionId will be associated with the user.
21410 */
21411 mergeUnionId: function mergeUnionId(authInfo, unionId) {
21412 var _ref14 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
21413 _ref14$asMainAccount = _ref14.asMainAccount,
21414 asMainAccount = _ref14$asMainAccount === void 0 ? false : _ref14$asMainAccount;
21415
21416 authInfo = JSON.parse((0, _stringify.default)(authInfo));
21417 var _authInfo = authInfo,
21418 authData = _authInfo.authData,
21419 platform = _authInfo.platform;
21420 authData.platform = platform;
21421 authData.main_account = asMainAccount;
21422 authData.unionid = unionId;
21423 return authInfo;
21424 },
21425
21426 /**
21427 * 使用当前使用微信小程序的微信用户身份注册或登录,成功后用户的 session 会在设备上持久化保存,之后可以使用 AV.User.current() 获取当前登录用户。
21428 * 仅在微信小程序中可用。
21429 *
21430 * @deprecated please use {@link AV.User.loginWithMiniApp}
21431 * @since 2.0.0
21432 * @param {Object} [options]
21433 * @param {boolean} [options.preferUnionId] 当用户满足 {@link https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/union-id.html 获取 UnionId 的条件} 时,是否使用 UnionId 登录。(since 3.13.0)
21434 * @param {string} [options.unionIdPlatform = 'weixin'] (only take effect when preferUnionId) unionId platform
21435 * @param {boolean} [options.asMainAccount = true] (only take effect when preferUnionId) If true, the unionId will be associated with the user.
21436 * @param {boolean} [options.failOnNotExist] If true, the login request will fail when no user matches this authData exists. (since v3.7.0)
21437 * @return {Promise.<AV.User>}
21438 */
21439 loginWithWeapp: function loginWithWeapp() {
21440 var _this15 = this;
21441
21442 var _ref15 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
21443 _ref15$preferUnionId = _ref15.preferUnionId,
21444 preferUnionId = _ref15$preferUnionId === void 0 ? false : _ref15$preferUnionId,
21445 _ref15$unionIdPlatfor = _ref15.unionIdPlatform,
21446 unionIdPlatform = _ref15$unionIdPlatfor === void 0 ? 'weixin' : _ref15$unionIdPlatfor,
21447 _ref15$asMainAccount = _ref15.asMainAccount,
21448 asMainAccount = _ref15$asMainAccount === void 0 ? true : _ref15$asMainAccount,
21449 _ref15$failOnNotExist = _ref15.failOnNotExist,
21450 failOnNotExist = _ref15$failOnNotExist === void 0 ? false : _ref15$failOnNotExist,
21451 useMasterKey = _ref15.useMasterKey,
21452 sessionToken = _ref15.sessionToken,
21453 user = _ref15.user;
21454
21455 var getAuthInfo = getAdapter('getAuthInfo');
21456 return getAuthInfo({
21457 preferUnionId: preferUnionId,
21458 asMainAccount: asMainAccount,
21459 platform: unionIdPlatform
21460 }).then(function (authInfo) {
21461 return _this15.loginWithMiniApp(authInfo, {
21462 failOnNotExist: failOnNotExist,
21463 useMasterKey: useMasterKey,
21464 sessionToken: sessionToken,
21465 user: user
21466 });
21467 });
21468 },
21469
21470 /**
21471 * 使用当前使用微信小程序的微信用户身份注册或登录,
21472 * 仅在微信小程序中可用。
21473 *
21474 * @deprecated please use {@link AV.User.loginWithMiniApp}
21475 * @since 3.13.0
21476 * @param {Object} [unionLoginOptions]
21477 * @param {string} [unionLoginOptions.unionIdPlatform = 'weixin'] unionId platform
21478 * @param {boolean} [unionLoginOptions.asMainAccount = false] If true, the unionId will be associated with the user.
21479 * @param {boolean} [unionLoginOptions.failOnNotExist] If true, the login request will fail when no user matches this authData exists. * @return {Promise.<AV.User>}
21480 */
21481 loginWithWeappWithUnionId: function loginWithWeappWithUnionId(unionId) {
21482 var _this16 = this;
21483
21484 var _ref16 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
21485 _ref16$unionIdPlatfor = _ref16.unionIdPlatform,
21486 unionIdPlatform = _ref16$unionIdPlatfor === void 0 ? 'weixin' : _ref16$unionIdPlatfor,
21487 _ref16$asMainAccount = _ref16.asMainAccount,
21488 asMainAccount = _ref16$asMainAccount === void 0 ? false : _ref16$asMainAccount,
21489 _ref16$failOnNotExist = _ref16.failOnNotExist,
21490 failOnNotExist = _ref16$failOnNotExist === void 0 ? false : _ref16$failOnNotExist,
21491 useMasterKey = _ref16.useMasterKey,
21492 sessionToken = _ref16.sessionToken,
21493 user = _ref16.user;
21494
21495 var getAuthInfo = getAdapter('getAuthInfo');
21496 return getAuthInfo({
21497 platform: unionIdPlatform
21498 }).then(function (authInfo) {
21499 authInfo = AV.User.mergeUnionId(authInfo, unionId, {
21500 asMainAccount: asMainAccount
21501 });
21502 return _this16.loginWithMiniApp(authInfo, {
21503 failOnNotExist: failOnNotExist,
21504 useMasterKey: useMasterKey,
21505 sessionToken: sessionToken,
21506 user: user
21507 });
21508 });
21509 },
21510
21511 /**
21512 * 使用当前使用 QQ 小程序的 QQ 用户身份注册或登录,成功后用户的 session 会在设备上持久化保存,之后可以使用 AV.User.current() 获取当前登录用户。
21513 * 仅在 QQ 小程序中可用。
21514 *
21515 * @deprecated please use {@link AV.User.loginWithMiniApp}
21516 * @since 4.2.0
21517 * @param {Object} [options]
21518 * @param {boolean} [options.preferUnionId] 如果服务端在登录时获取到了用户的 UnionId,是否将 UnionId 保存在用户账号中。
21519 * @param {string} [options.unionIdPlatform = 'qq'] (only take effect when preferUnionId) unionId platform
21520 * @param {boolean} [options.asMainAccount = true] (only take effect when preferUnionId) If true, the unionId will be associated with the user.
21521 * @param {boolean} [options.failOnNotExist] If true, the login request will fail when no user matches this authData exists. (since v3.7.0)
21522 * @return {Promise.<AV.User>}
21523 */
21524 loginWithQQApp: function loginWithQQApp() {
21525 var _this17 = this;
21526
21527 var _ref17 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
21528 _ref17$preferUnionId = _ref17.preferUnionId,
21529 preferUnionId = _ref17$preferUnionId === void 0 ? false : _ref17$preferUnionId,
21530 _ref17$unionIdPlatfor = _ref17.unionIdPlatform,
21531 unionIdPlatform = _ref17$unionIdPlatfor === void 0 ? 'qq' : _ref17$unionIdPlatfor,
21532 _ref17$asMainAccount = _ref17.asMainAccount,
21533 asMainAccount = _ref17$asMainAccount === void 0 ? true : _ref17$asMainAccount,
21534 _ref17$failOnNotExist = _ref17.failOnNotExist,
21535 failOnNotExist = _ref17$failOnNotExist === void 0 ? false : _ref17$failOnNotExist,
21536 useMasterKey = _ref17.useMasterKey,
21537 sessionToken = _ref17.sessionToken,
21538 user = _ref17.user;
21539
21540 var getAuthInfo = getAdapter('getAuthInfo');
21541 return getAuthInfo({
21542 preferUnionId: preferUnionId,
21543 asMainAccount: asMainAccount,
21544 platform: unionIdPlatform
21545 }).then(function (authInfo) {
21546 authInfo.provider = PLATFORM_QQAPP;
21547 return _this17.loginWithMiniApp(authInfo, {
21548 failOnNotExist: failOnNotExist,
21549 useMasterKey: useMasterKey,
21550 sessionToken: sessionToken,
21551 user: user
21552 });
21553 });
21554 },
21555
21556 /**
21557 * 使用当前使用 QQ 小程序的 QQ 用户身份注册或登录,
21558 * 仅在 QQ 小程序中可用。
21559 *
21560 * @deprecated please use {@link AV.User.loginWithMiniApp}
21561 * @since 4.2.0
21562 * @param {Object} [unionLoginOptions]
21563 * @param {string} [unionLoginOptions.unionIdPlatform = 'qq'] unionId platform
21564 * @param {boolean} [unionLoginOptions.asMainAccount = false] If true, the unionId will be associated with the user.
21565 * @param {boolean} [unionLoginOptions.failOnNotExist] If true, the login request will fail when no user matches this authData exists.
21566 * @return {Promise.<AV.User>}
21567 */
21568 loginWithQQAppWithUnionId: function loginWithQQAppWithUnionId(unionId) {
21569 var _this18 = this;
21570
21571 var _ref18 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
21572 _ref18$unionIdPlatfor = _ref18.unionIdPlatform,
21573 unionIdPlatform = _ref18$unionIdPlatfor === void 0 ? 'qq' : _ref18$unionIdPlatfor,
21574 _ref18$asMainAccount = _ref18.asMainAccount,
21575 asMainAccount = _ref18$asMainAccount === void 0 ? false : _ref18$asMainAccount,
21576 _ref18$failOnNotExist = _ref18.failOnNotExist,
21577 failOnNotExist = _ref18$failOnNotExist === void 0 ? false : _ref18$failOnNotExist,
21578 useMasterKey = _ref18.useMasterKey,
21579 sessionToken = _ref18.sessionToken,
21580 user = _ref18.user;
21581
21582 var getAuthInfo = getAdapter('getAuthInfo');
21583 return getAuthInfo({
21584 platform: unionIdPlatform
21585 }).then(function (authInfo) {
21586 authInfo = AV.User.mergeUnionId(authInfo, unionId, {
21587 asMainAccount: asMainAccount
21588 });
21589 authInfo.provider = PLATFORM_QQAPP;
21590 return _this18.loginWithMiniApp(authInfo, {
21591 failOnNotExist: failOnNotExist,
21592 useMasterKey: useMasterKey,
21593 sessionToken: sessionToken,
21594 user: user
21595 });
21596 });
21597 },
21598
21599 /**
21600 * Register or login using the identity of the current mini-app.
21601 * @param {Object} authInfo
21602 * @param {Object} [option]
21603 * @param {Boolean} [option.failOnNotExist] If true, the login request will fail when no user matches this authInfo.authData exists.
21604 */
21605 loginWithMiniApp: function loginWithMiniApp(authInfo, option) {
21606 var _this19 = this;
21607
21608 if (authInfo === undefined) {
21609 var getAuthInfo = getAdapter('getAuthInfo');
21610 return getAuthInfo().then(function (authInfo) {
21611 return _this19.loginWithAuthData(authInfo.authData, authInfo.provider, option);
21612 });
21613 }
21614
21615 return this.loginWithAuthData(authInfo.authData, authInfo.provider, option);
21616 },
21617
21618 /**
21619 * Only use for DI in tests to produce deterministic IDs.
21620 */
21621 _genId: function _genId() {
21622 return uuid();
21623 },
21624
21625 /**
21626 * Creates an anonymous user.
21627 *
21628 * @since 3.9.0
21629 * @return {Promise.<AV.User>}
21630 */
21631 loginAnonymously: function loginAnonymously() {
21632 return this.loginWithAuthData({
21633 id: AV.User._genId()
21634 }, 'anonymous');
21635 },
21636 associateWithAuthData: function associateWithAuthData(userObj, platform, authData) {
21637 console.warn('DEPRECATED: User.associateWithAuthData 已废弃,请使用 User#associateWithAuthData 代替');
21638 return userObj._linkWith(platform, authData);
21639 },
21640
21641 /**
21642 * Logs out the currently logged in user session. This will remove the
21643 * session from disk, log out of linked services, and future calls to
21644 * <code>current</code> will return <code>null</code>.
21645 * @return {Promise}
21646 */
21647 logOut: function logOut() {
21648 if (AV._config.disableCurrentUser) {
21649 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');
21650 return _promise.default.resolve(null);
21651 }
21652
21653 if (AV.User._currentUser !== null) {
21654 AV.User._currentUser._logOutWithAll();
21655
21656 AV.User._currentUser._isCurrentUser = false;
21657 }
21658
21659 AV.User._currentUserMatchesDisk = true;
21660 AV.User._currentUser = null;
21661 return AV.localStorage.removeItemAsync(AV._getAVPath(AV.User._CURRENT_USER_KEY)).then(function () {
21662 return AV._refreshSubscriptionId();
21663 });
21664 },
21665
21666 /**
21667 *Create a follower query for special user to query the user's followers.
21668 * @param {String} userObjectId The user object id.
21669 * @return {AV.FriendShipQuery}
21670 * @since 0.3.0
21671 */
21672 followerQuery: function followerQuery(userObjectId) {
21673 if (!userObjectId || !_.isString(userObjectId)) {
21674 throw new Error('Invalid user object id.');
21675 }
21676
21677 var query = new AV.FriendShipQuery('_Follower');
21678 query._friendshipTag = 'follower';
21679 query.equalTo('user', AV.Object.createWithoutData('_User', userObjectId));
21680 return query;
21681 },
21682
21683 /**
21684 *Create a followee query for special user to query the user's followees.
21685 * @param {String} userObjectId The user object id.
21686 * @return {AV.FriendShipQuery}
21687 * @since 0.3.0
21688 */
21689 followeeQuery: function followeeQuery(userObjectId) {
21690 if (!userObjectId || !_.isString(userObjectId)) {
21691 throw new Error('Invalid user object id.');
21692 }
21693
21694 var query = new AV.FriendShipQuery('_Followee');
21695 query._friendshipTag = 'followee';
21696 query.equalTo('user', AV.Object.createWithoutData('_User', userObjectId));
21697 return query;
21698 },
21699
21700 /**
21701 * Requests a password reset email to be sent to the specified email address
21702 * associated with the user account. This email allows the user to securely
21703 * reset their password on the AV site.
21704 *
21705 * @param {String} email The email address associated with the user that
21706 * forgot their password.
21707 * @return {Promise}
21708 */
21709 requestPasswordReset: function requestPasswordReset(email) {
21710 var json = {
21711 email: email
21712 };
21713 var request = AVRequest('requestPasswordReset', null, null, 'POST', json);
21714 return request;
21715 },
21716
21717 /**
21718 * Requests a verify email to be sent to the specified email address
21719 * associated with the user account. This email allows the user to securely
21720 * verify their email address on the AV site.
21721 *
21722 * @param {String} email The email address associated with the user that
21723 * doesn't verify their email address.
21724 * @return {Promise}
21725 */
21726 requestEmailVerify: function requestEmailVerify(email) {
21727 var json = {
21728 email: email
21729 };
21730 var request = AVRequest('requestEmailVerify', null, null, 'POST', json);
21731 return request;
21732 },
21733
21734 /**
21735 * Requests a verify sms code to be sent to the specified mobile phone
21736 * number associated with the user account. This sms code allows the user to
21737 * verify their mobile phone number by calling AV.User.verifyMobilePhone
21738 *
21739 * @param {String} mobilePhoneNumber The mobile phone number associated with the
21740 * user that doesn't verify their mobile phone number.
21741 * @param {SMSAuthOptions} [options]
21742 * @return {Promise}
21743 */
21744 requestMobilePhoneVerify: function requestMobilePhoneVerify(mobilePhoneNumber) {
21745 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
21746 var data = {
21747 mobilePhoneNumber: mobilePhoneNumber
21748 };
21749
21750 if (options.validateToken) {
21751 data.validate_token = options.validateToken;
21752 }
21753
21754 var request = AVRequest('requestMobilePhoneVerify', null, null, 'POST', data, options);
21755 return request;
21756 },
21757
21758 /**
21759 * Requests a reset password sms code to be sent to the specified mobile phone
21760 * number associated with the user account. This sms code allows the user to
21761 * reset their account's password by calling AV.User.resetPasswordBySmsCode
21762 *
21763 * @param {String} mobilePhoneNumber The mobile phone number associated with the
21764 * user that doesn't verify their mobile phone number.
21765 * @param {SMSAuthOptions} [options]
21766 * @return {Promise}
21767 */
21768 requestPasswordResetBySmsCode: function requestPasswordResetBySmsCode(mobilePhoneNumber) {
21769 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
21770 var data = {
21771 mobilePhoneNumber: mobilePhoneNumber
21772 };
21773
21774 if (options.validateToken) {
21775 data.validate_token = options.validateToken;
21776 }
21777
21778 var request = AVRequest('requestPasswordResetBySmsCode', null, null, 'POST', data, options);
21779 return request;
21780 },
21781
21782 /**
21783 * Requests a change mobile phone number sms code to be sent to the mobilePhoneNumber.
21784 * This sms code allows current user to reset it's mobilePhoneNumber by
21785 * calling {@link AV.User.changePhoneNumber}
21786 * @since 4.7.0
21787 * @param {String} mobilePhoneNumber
21788 * @param {Number} [ttl] ttl of sms code (default is 6 minutes)
21789 * @param {SMSAuthOptions} [options]
21790 * @return {Promise}
21791 */
21792 requestChangePhoneNumber: function requestChangePhoneNumber(mobilePhoneNumber, ttl, options) {
21793 var data = {
21794 mobilePhoneNumber: mobilePhoneNumber
21795 };
21796
21797 if (ttl) {
21798 data.ttl = options.ttl;
21799 }
21800
21801 if (options && options.validateToken) {
21802 data.validate_token = options.validateToken;
21803 }
21804
21805 return AVRequest('requestChangePhoneNumber', null, null, 'POST', data, options);
21806 },
21807
21808 /**
21809 * Makes a call to reset user's account mobilePhoneNumber by sms code.
21810 * The sms code is sent by {@link AV.User.requestChangePhoneNumber}
21811 * @since 4.7.0
21812 * @param {String} mobilePhoneNumber
21813 * @param {String} code The sms code.
21814 * @return {Promise}
21815 */
21816 changePhoneNumber: function changePhoneNumber(mobilePhoneNumber, code) {
21817 var data = {
21818 mobilePhoneNumber: mobilePhoneNumber,
21819 code: code
21820 };
21821 return AVRequest('changePhoneNumber', null, null, 'POST', data);
21822 },
21823
21824 /**
21825 * Makes a call to reset user's account password by sms code and new password.
21826 * The sms code is sent by AV.User.requestPasswordResetBySmsCode.
21827 * @param {String} code The sms code sent by AV.User.Cloud.requestSmsCode
21828 * @param {String} password The new password.
21829 * @return {Promise} A promise that will be resolved with the result
21830 * of the function.
21831 */
21832 resetPasswordBySmsCode: function resetPasswordBySmsCode(code, password) {
21833 var json = {
21834 password: password
21835 };
21836 var request = AVRequest('resetPasswordBySmsCode', null, code, 'PUT', json);
21837 return request;
21838 },
21839
21840 /**
21841 * Makes a call to verify sms code that sent by AV.User.Cloud.requestSmsCode
21842 * If verify successfully,the user mobilePhoneVerified attribute will be true.
21843 * @param {String} code The sms code sent by AV.User.Cloud.requestSmsCode
21844 * @return {Promise} A promise that will be resolved with the result
21845 * of the function.
21846 */
21847 verifyMobilePhone: function verifyMobilePhone(code) {
21848 var request = AVRequest('verifyMobilePhone', null, code, 'POST', null);
21849 return request;
21850 },
21851
21852 /**
21853 * Requests a logIn sms code to be sent to the specified mobile phone
21854 * number associated with the user account. This sms code allows the user to
21855 * login by AV.User.logInWithMobilePhoneSmsCode function.
21856 *
21857 * @param {String} mobilePhoneNumber The mobile phone number associated with the
21858 * user that want to login by AV.User.logInWithMobilePhoneSmsCode
21859 * @param {SMSAuthOptions} [options]
21860 * @return {Promise}
21861 */
21862 requestLoginSmsCode: function requestLoginSmsCode(mobilePhoneNumber) {
21863 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
21864 var data = {
21865 mobilePhoneNumber: mobilePhoneNumber
21866 };
21867
21868 if (options.validateToken) {
21869 data.validate_token = options.validateToken;
21870 }
21871
21872 var request = AVRequest('requestLoginSmsCode', null, null, 'POST', data, options);
21873 return request;
21874 },
21875
21876 /**
21877 * Retrieves the currently logged in AVUser with a valid session,
21878 * either from memory or localStorage, if necessary.
21879 * @return {Promise.<AV.User>} resolved with the currently logged in AV.User.
21880 */
21881 currentAsync: function currentAsync() {
21882 if (AV._config.disableCurrentUser) {
21883 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');
21884 return _promise.default.resolve(null);
21885 }
21886
21887 if (AV.User._currentUser) {
21888 return _promise.default.resolve(AV.User._currentUser);
21889 }
21890
21891 if (AV.User._currentUserMatchesDisk) {
21892 return _promise.default.resolve(AV.User._currentUser);
21893 }
21894
21895 return AV.localStorage.getItemAsync(AV._getAVPath(AV.User._CURRENT_USER_KEY)).then(function (userData) {
21896 if (!userData) {
21897 return null;
21898 } // Load the user from local storage.
21899
21900
21901 AV.User._currentUserMatchesDisk = true;
21902 AV.User._currentUser = AV.Object._create('_User');
21903 AV.User._currentUser._isCurrentUser = true;
21904 var json = JSON.parse(userData);
21905 AV.User._currentUser.id = json._id;
21906 delete json._id;
21907 AV.User._currentUser._sessionToken = json._sessionToken;
21908 delete json._sessionToken;
21909
21910 AV.User._currentUser._finishFetch(json); //AV.User._currentUser.set(json);
21911
21912
21913 AV.User._currentUser._synchronizeAllAuthData();
21914
21915 AV.User._currentUser._refreshCache();
21916
21917 AV.User._currentUser._opSetQueue = [{}];
21918 return AV.User._currentUser;
21919 });
21920 },
21921
21922 /**
21923 * Retrieves the currently logged in AVUser with a valid session,
21924 * either from memory or localStorage, if necessary.
21925 * @return {AV.User} The currently logged in AV.User.
21926 */
21927 current: function current() {
21928 if (AV._config.disableCurrentUser) {
21929 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');
21930 return null;
21931 }
21932
21933 if (AV.localStorage.async) {
21934 var error = new Error('Synchronous API User.current() is not available in this runtime. Use User.currentAsync() instead.');
21935 error.code = 'SYNC_API_NOT_AVAILABLE';
21936 throw error;
21937 }
21938
21939 if (AV.User._currentUser) {
21940 return AV.User._currentUser;
21941 }
21942
21943 if (AV.User._currentUserMatchesDisk) {
21944 return AV.User._currentUser;
21945 } // Load the user from local storage.
21946
21947
21948 AV.User._currentUserMatchesDisk = true;
21949 var userData = AV.localStorage.getItem(AV._getAVPath(AV.User._CURRENT_USER_KEY));
21950
21951 if (!userData) {
21952 return null;
21953 }
21954
21955 AV.User._currentUser = AV.Object._create('_User');
21956 AV.User._currentUser._isCurrentUser = true;
21957 var json = JSON.parse(userData);
21958 AV.User._currentUser.id = json._id;
21959 delete json._id;
21960 AV.User._currentUser._sessionToken = json._sessionToken;
21961 delete json._sessionToken;
21962
21963 AV.User._currentUser._finishFetch(json); //AV.User._currentUser.set(json);
21964
21965
21966 AV.User._currentUser._synchronizeAllAuthData();
21967
21968 AV.User._currentUser._refreshCache();
21969
21970 AV.User._currentUser._opSetQueue = [{}];
21971 return AV.User._currentUser;
21972 },
21973
21974 /**
21975 * Persists a user as currentUser to localStorage, and into the singleton.
21976 * @private
21977 */
21978 _saveCurrentUser: function _saveCurrentUser(user) {
21979 var promise;
21980
21981 if (AV.User._currentUser !== user) {
21982 promise = AV.User.logOut();
21983 } else {
21984 promise = _promise.default.resolve();
21985 }
21986
21987 return promise.then(function () {
21988 user._isCurrentUser = true;
21989 AV.User._currentUser = user;
21990
21991 var json = user._toFullJSON();
21992
21993 json._id = user.id;
21994 json._sessionToken = user._sessionToken;
21995 return AV.localStorage.setItemAsync(AV._getAVPath(AV.User._CURRENT_USER_KEY), (0, _stringify.default)(json)).then(function () {
21996 AV.User._currentUserMatchesDisk = true;
21997 return AV._refreshSubscriptionId();
21998 });
21999 });
22000 },
22001 _registerAuthenticationProvider: function _registerAuthenticationProvider(provider) {
22002 AV.User._authProviders[provider.getAuthType()] = provider; // Synchronize the current user with the auth provider.
22003
22004 if (!AV._config.disableCurrentUser && AV.User.current()) {
22005 AV.User.current()._synchronizeAuthData(provider.getAuthType());
22006 }
22007 },
22008 _logInWith: function _logInWith(provider, authData, options) {
22009 var user = AV.Object._create('_User');
22010
22011 return user._linkWith(provider, authData, options);
22012 }
22013 });
22014};
22015
22016/***/ }),
22017/* 560 */
22018/***/ (function(module, exports, __webpack_require__) {
22019
22020var _Object$defineProperty = __webpack_require__(153);
22021
22022function _defineProperty(obj, key, value) {
22023 if (key in obj) {
22024 _Object$defineProperty(obj, key, {
22025 value: value,
22026 enumerable: true,
22027 configurable: true,
22028 writable: true
22029 });
22030 } else {
22031 obj[key] = value;
22032 }
22033
22034 return obj;
22035}
22036
22037module.exports = _defineProperty, module.exports.__esModule = true, module.exports["default"] = module.exports;
22038
22039/***/ }),
22040/* 561 */
22041/***/ (function(module, exports, __webpack_require__) {
22042
22043"use strict";
22044
22045
22046var _interopRequireDefault = __webpack_require__(1);
22047
22048var _map = _interopRequireDefault(__webpack_require__(37));
22049
22050var _promise = _interopRequireDefault(__webpack_require__(12));
22051
22052var _keys = _interopRequireDefault(__webpack_require__(62));
22053
22054var _stringify = _interopRequireDefault(__webpack_require__(38));
22055
22056var _find = _interopRequireDefault(__webpack_require__(96));
22057
22058var _concat = _interopRequireDefault(__webpack_require__(19));
22059
22060var _ = __webpack_require__(3);
22061
22062var debug = __webpack_require__(63)('leancloud:query');
22063
22064var AVError = __webpack_require__(48);
22065
22066var _require = __webpack_require__(28),
22067 _request = _require._request,
22068 request = _require.request;
22069
22070var _require2 = __webpack_require__(32),
22071 ensureArray = _require2.ensureArray,
22072 transformFetchOptions = _require2.transformFetchOptions,
22073 continueWhile = _require2.continueWhile;
22074
22075var requires = function requires(value, message) {
22076 if (value === undefined) {
22077 throw new Error(message);
22078 }
22079}; // AV.Query is a way to create a list of AV.Objects.
22080
22081
22082module.exports = function (AV) {
22083 /**
22084 * Creates a new AV.Query for the given AV.Object subclass.
22085 * @param {Class|String} objectClass An instance of a subclass of AV.Object, or a AV className string.
22086 * @class
22087 *
22088 * <p>AV.Query defines a query that is used to fetch AV.Objects. The
22089 * most common use case is finding all objects that match a query through the
22090 * <code>find</code> method. For example, this sample code fetches all objects
22091 * of class <code>MyClass</code>. It calls a different function depending on
22092 * whether the fetch succeeded or not.
22093 *
22094 * <pre>
22095 * var query = new AV.Query(MyClass);
22096 * query.find().then(function(results) {
22097 * // results is an array of AV.Object.
22098 * }, function(error) {
22099 * // error is an instance of AVError.
22100 * });</pre></p>
22101 *
22102 * <p>An AV.Query can also be used to retrieve a single object whose id is
22103 * known, through the get method. For example, this sample code fetches an
22104 * object of class <code>MyClass</code> and id <code>myId</code>. It calls a
22105 * different function depending on whether the fetch succeeded or not.
22106 *
22107 * <pre>
22108 * var query = new AV.Query(MyClass);
22109 * query.get(myId).then(function(object) {
22110 * // object is an instance of AV.Object.
22111 * }, function(error) {
22112 * // error is an instance of AVError.
22113 * });</pre></p>
22114 *
22115 * <p>An AV.Query can also be used to count the number of objects that match
22116 * the query without retrieving all of those objects. For example, this
22117 * sample code counts the number of objects of the class <code>MyClass</code>
22118 * <pre>
22119 * var query = new AV.Query(MyClass);
22120 * query.count().then(function(number) {
22121 * // There are number instances of MyClass.
22122 * }, function(error) {
22123 * // error is an instance of AVError.
22124 * });</pre></p>
22125 */
22126 AV.Query = function (objectClass) {
22127 if (_.isString(objectClass)) {
22128 objectClass = AV.Object._getSubclass(objectClass);
22129 }
22130
22131 this.objectClass = objectClass;
22132 this.className = objectClass.prototype.className;
22133 this._where = {};
22134 this._include = [];
22135 this._select = [];
22136 this._limit = -1; // negative limit means, do not send a limit
22137
22138 this._skip = 0;
22139 this._defaultParams = {};
22140 };
22141 /**
22142 * Constructs a AV.Query that is the OR of the passed in queries. For
22143 * example:
22144 * <pre>var compoundQuery = AV.Query.or(query1, query2, query3);</pre>
22145 *
22146 * will create a compoundQuery that is an or of the query1, query2, and
22147 * query3.
22148 * @param {...AV.Query} var_args The list of queries to OR.
22149 * @return {AV.Query} The query that is the OR of the passed in queries.
22150 */
22151
22152
22153 AV.Query.or = function () {
22154 var queries = _.toArray(arguments);
22155
22156 var className = null;
22157
22158 AV._arrayEach(queries, function (q) {
22159 if (_.isNull(className)) {
22160 className = q.className;
22161 }
22162
22163 if (className !== q.className) {
22164 throw new Error('All queries must be for the same class');
22165 }
22166 });
22167
22168 var query = new AV.Query(className);
22169
22170 query._orQuery(queries);
22171
22172 return query;
22173 };
22174 /**
22175 * Constructs a AV.Query that is the AND of the passed in queries. For
22176 * example:
22177 * <pre>var compoundQuery = AV.Query.and(query1, query2, query3);</pre>
22178 *
22179 * will create a compoundQuery that is an 'and' of the query1, query2, and
22180 * query3.
22181 * @param {...AV.Query} var_args The list of queries to AND.
22182 * @return {AV.Query} The query that is the AND of the passed in queries.
22183 */
22184
22185
22186 AV.Query.and = function () {
22187 var queries = _.toArray(arguments);
22188
22189 var className = null;
22190
22191 AV._arrayEach(queries, function (q) {
22192 if (_.isNull(className)) {
22193 className = q.className;
22194 }
22195
22196 if (className !== q.className) {
22197 throw new Error('All queries must be for the same class');
22198 }
22199 });
22200
22201 var query = new AV.Query(className);
22202
22203 query._andQuery(queries);
22204
22205 return query;
22206 };
22207 /**
22208 * Retrieves a list of AVObjects that satisfy the CQL.
22209 * CQL syntax please see {@link https://leancloud.cn/docs/cql_guide.html CQL Guide}.
22210 *
22211 * @param {String} cql A CQL string, see {@link https://leancloud.cn/docs/cql_guide.html CQL Guide}.
22212 * @param {Array} pvalues An array contains placeholder values.
22213 * @param {AuthOptions} options
22214 * @return {Promise} A promise that is resolved with the results when
22215 * the query completes.
22216 */
22217
22218
22219 AV.Query.doCloudQuery = function (cql, pvalues, options) {
22220 var params = {
22221 cql: cql
22222 };
22223
22224 if (_.isArray(pvalues)) {
22225 params.pvalues = pvalues;
22226 } else {
22227 options = pvalues;
22228 }
22229
22230 var request = _request('cloudQuery', null, null, 'GET', params, options);
22231
22232 return request.then(function (response) {
22233 //query to process results.
22234 var query = new AV.Query(response.className);
22235 var results = (0, _map.default)(_).call(_, response.results, function (json) {
22236 var obj = query._newObject(response);
22237
22238 if (obj._finishFetch) {
22239 obj._finishFetch(query._processResult(json), true);
22240 }
22241
22242 return obj;
22243 });
22244 return {
22245 results: results,
22246 count: response.count,
22247 className: response.className
22248 };
22249 });
22250 };
22251 /**
22252 * Return a query with conditions from json.
22253 * This can be useful to send a query from server side to client side.
22254 * @since 4.0.0
22255 * @param {Object} json from {@link AV.Query#toJSON}
22256 * @return {AV.Query}
22257 */
22258
22259
22260 AV.Query.fromJSON = function (_ref) {
22261 var className = _ref.className,
22262 where = _ref.where,
22263 include = _ref.include,
22264 select = _ref.select,
22265 includeACL = _ref.includeACL,
22266 limit = _ref.limit,
22267 skip = _ref.skip,
22268 order = _ref.order;
22269
22270 if (typeof className !== 'string') {
22271 throw new TypeError('Invalid Query JSON, className must be a String.');
22272 }
22273
22274 var query = new AV.Query(className);
22275
22276 _.extend(query, {
22277 _where: where,
22278 _include: include,
22279 _select: select,
22280 _includeACL: includeACL,
22281 _limit: limit,
22282 _skip: skip,
22283 _order: order
22284 });
22285
22286 return query;
22287 };
22288
22289 AV.Query._extend = AV._extend;
22290
22291 _.extend(AV.Query.prototype,
22292 /** @lends AV.Query.prototype */
22293 {
22294 //hook to iterate result. Added by dennis<xzhuang@avoscloud.com>.
22295 _processResult: function _processResult(obj) {
22296 return obj;
22297 },
22298
22299 /**
22300 * Constructs an AV.Object whose id is already known by fetching data from
22301 * the server.
22302 *
22303 * @param {String} objectId The id of the object to be fetched.
22304 * @param {AuthOptions} options
22305 * @return {Promise.<AV.Object>}
22306 */
22307 get: function get(objectId, options) {
22308 if (!_.isString(objectId)) {
22309 throw new Error('objectId must be a string');
22310 }
22311
22312 if (objectId === '') {
22313 return _promise.default.reject(new AVError(AVError.OBJECT_NOT_FOUND, 'Object not found.'));
22314 }
22315
22316 var obj = this._newObject();
22317
22318 obj.id = objectId;
22319
22320 var queryJSON = this._getParams();
22321
22322 var fetchOptions = {};
22323 if ((0, _keys.default)(queryJSON)) fetchOptions.keys = (0, _keys.default)(queryJSON);
22324 if (queryJSON.include) fetchOptions.include = queryJSON.include;
22325 if (queryJSON.includeACL) fetchOptions.includeACL = queryJSON.includeACL;
22326 return _request('classes', this.className, objectId, 'GET', transformFetchOptions(fetchOptions), options).then(function (response) {
22327 if (_.isEmpty(response)) throw new AVError(AVError.OBJECT_NOT_FOUND, 'Object not found.');
22328
22329 obj._finishFetch(obj.parse(response), true);
22330
22331 return obj;
22332 });
22333 },
22334
22335 /**
22336 * Returns a JSON representation of this query.
22337 * @return {Object}
22338 */
22339 toJSON: function toJSON() {
22340 var className = this.className,
22341 where = this._where,
22342 include = this._include,
22343 select = this._select,
22344 includeACL = this._includeACL,
22345 limit = this._limit,
22346 skip = this._skip,
22347 order = this._order;
22348 return {
22349 className: className,
22350 where: where,
22351 include: include,
22352 select: select,
22353 includeACL: includeACL,
22354 limit: limit,
22355 skip: skip,
22356 order: order
22357 };
22358 },
22359 _getParams: function _getParams() {
22360 var params = _.extend({}, this._defaultParams, {
22361 where: this._where
22362 });
22363
22364 if (this._include.length > 0) {
22365 params.include = this._include.join(',');
22366 }
22367
22368 if (this._select.length > 0) {
22369 params.keys = this._select.join(',');
22370 }
22371
22372 if (this._includeACL !== undefined) {
22373 params.returnACL = this._includeACL;
22374 }
22375
22376 if (this._limit >= 0) {
22377 params.limit = this._limit;
22378 }
22379
22380 if (this._skip > 0) {
22381 params.skip = this._skip;
22382 }
22383
22384 if (this._order !== undefined) {
22385 params.order = this._order;
22386 }
22387
22388 return params;
22389 },
22390 _newObject: function _newObject(response) {
22391 var obj;
22392
22393 if (response && response.className) {
22394 obj = new AV.Object(response.className);
22395 } else {
22396 obj = new this.objectClass();
22397 }
22398
22399 return obj;
22400 },
22401 _createRequest: function _createRequest() {
22402 var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this._getParams();
22403 var options = arguments.length > 1 ? arguments[1] : undefined;
22404 var path = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "/classes/".concat(this.className);
22405
22406 if (encodeURIComponent((0, _stringify.default)(params)).length > 2000) {
22407 var body = {
22408 requests: [{
22409 method: 'GET',
22410 path: "/1.1".concat(path),
22411 params: params
22412 }]
22413 };
22414 return request({
22415 path: '/batch',
22416 method: 'POST',
22417 data: body,
22418 authOptions: options
22419 }).then(function (response) {
22420 var result = response[0];
22421
22422 if (result.success) {
22423 return result.success;
22424 }
22425
22426 var error = new AVError(result.error.code, result.error.error || 'Unknown batch error');
22427 throw error;
22428 });
22429 }
22430
22431 return request({
22432 method: 'GET',
22433 path: path,
22434 query: params,
22435 authOptions: options
22436 });
22437 },
22438 _parseResponse: function _parseResponse(response) {
22439 var _this = this;
22440
22441 return (0, _map.default)(_).call(_, response.results, function (json) {
22442 var obj = _this._newObject(response);
22443
22444 if (obj._finishFetch) {
22445 obj._finishFetch(_this._processResult(json), true);
22446 }
22447
22448 return obj;
22449 });
22450 },
22451
22452 /**
22453 * Retrieves a list of AVObjects that satisfy this query.
22454 *
22455 * @param {AuthOptions} options
22456 * @return {Promise} A promise that is resolved with the results when
22457 * the query completes.
22458 */
22459 find: function find(options) {
22460 var request = this._createRequest(undefined, options);
22461
22462 return request.then(this._parseResponse.bind(this));
22463 },
22464
22465 /**
22466 * Retrieves both AVObjects and total count.
22467 *
22468 * @since 4.12.0
22469 * @param {AuthOptions} options
22470 * @return {Promise} A tuple contains results and count.
22471 */
22472 findAndCount: function findAndCount(options) {
22473 var _this2 = this;
22474
22475 var params = this._getParams();
22476
22477 params.count = 1;
22478
22479 var request = this._createRequest(params, options);
22480
22481 return request.then(function (response) {
22482 return [_this2._parseResponse(response), response.count];
22483 });
22484 },
22485
22486 /**
22487 * scan a Query. masterKey required.
22488 *
22489 * @since 2.1.0
22490 * @param {object} [options]
22491 * @param {string} [options.orderedBy] specify the key to sort
22492 * @param {number} [options.batchSize] specify the batch size for each request
22493 * @param {AuthOptions} [authOptions]
22494 * @return {AsyncIterator.<AV.Object>}
22495 * @example const testIterator = {
22496 * [Symbol.asyncIterator]() {
22497 * return new Query('Test').scan(undefined, { useMasterKey: true });
22498 * },
22499 * };
22500 * for await (const test of testIterator) {
22501 * console.log(test.id);
22502 * }
22503 */
22504 scan: function scan() {
22505 var _this3 = this;
22506
22507 var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
22508 orderedBy = _ref2.orderedBy,
22509 batchSize = _ref2.batchSize;
22510
22511 var authOptions = arguments.length > 1 ? arguments[1] : undefined;
22512
22513 var condition = this._getParams();
22514
22515 debug('scan %O', condition);
22516
22517 if (condition.order) {
22518 console.warn('The order of the query is ignored for Query#scan. Checkout the orderedBy option of Query#scan.');
22519 delete condition.order;
22520 }
22521
22522 if (condition.skip) {
22523 console.warn('The skip option of the query is ignored for Query#scan.');
22524 delete condition.skip;
22525 }
22526
22527 if (condition.limit) {
22528 console.warn('The limit option of the query is ignored for Query#scan.');
22529 delete condition.limit;
22530 }
22531
22532 if (orderedBy) condition.scan_key = orderedBy;
22533 if (batchSize) condition.limit = batchSize;
22534 var cursor;
22535 var remainResults = [];
22536 return {
22537 next: function next() {
22538 if (remainResults.length) {
22539 return _promise.default.resolve({
22540 done: false,
22541 value: remainResults.shift()
22542 });
22543 }
22544
22545 if (cursor === null) {
22546 return _promise.default.resolve({
22547 done: true
22548 });
22549 }
22550
22551 return _request('scan/classes', _this3.className, null, 'GET', cursor ? _.extend({}, condition, {
22552 cursor: cursor
22553 }) : condition, authOptions).then(function (response) {
22554 cursor = response.cursor;
22555
22556 if (response.results.length) {
22557 var results = _this3._parseResponse(response);
22558
22559 results.forEach(function (result) {
22560 return remainResults.push(result);
22561 });
22562 }
22563
22564 if (cursor === null && remainResults.length === 0) {
22565 return {
22566 done: true
22567 };
22568 }
22569
22570 return {
22571 done: false,
22572 value: remainResults.shift()
22573 };
22574 });
22575 }
22576 };
22577 },
22578
22579 /**
22580 * Delete objects retrieved by this query.
22581 * @param {AuthOptions} options
22582 * @return {Promise} A promise that is fulfilled when the save
22583 * completes.
22584 */
22585 destroyAll: function destroyAll(options) {
22586 var self = this;
22587 return (0, _find.default)(self).call(self, options).then(function (objects) {
22588 return AV.Object.destroyAll(objects, options);
22589 });
22590 },
22591
22592 /**
22593 * Counts the number of objects that match this query.
22594 *
22595 * @param {AuthOptions} options
22596 * @return {Promise} A promise that is resolved with the count when
22597 * the query completes.
22598 */
22599 count: function count(options) {
22600 var params = this._getParams();
22601
22602 params.limit = 0;
22603 params.count = 1;
22604
22605 var request = this._createRequest(params, options);
22606
22607 return request.then(function (response) {
22608 return response.count;
22609 });
22610 },
22611
22612 /**
22613 * Retrieves at most one AV.Object that satisfies this query.
22614 *
22615 * @param {AuthOptions} options
22616 * @return {Promise} A promise that is resolved with the object when
22617 * the query completes.
22618 */
22619 first: function first(options) {
22620 var self = this;
22621
22622 var params = this._getParams();
22623
22624 params.limit = 1;
22625
22626 var request = this._createRequest(params, options);
22627
22628 return request.then(function (response) {
22629 return (0, _map.default)(_).call(_, response.results, function (json) {
22630 var obj = self._newObject();
22631
22632 if (obj._finishFetch) {
22633 obj._finishFetch(self._processResult(json), true);
22634 }
22635
22636 return obj;
22637 })[0];
22638 });
22639 },
22640
22641 /**
22642 * Sets the number of results to skip before returning any results.
22643 * This is useful for pagination.
22644 * Default is to skip zero results.
22645 * @param {Number} n the number of results to skip.
22646 * @return {AV.Query} Returns the query, so you can chain this call.
22647 */
22648 skip: function skip(n) {
22649 requires(n, 'undefined is not a valid skip value');
22650 this._skip = n;
22651 return this;
22652 },
22653
22654 /**
22655 * Sets the limit of the number of results to return. The default limit is
22656 * 100, with a maximum of 1000 results being returned at a time.
22657 * @param {Number} n the number of results to limit to.
22658 * @return {AV.Query} Returns the query, so you can chain this call.
22659 */
22660 limit: function limit(n) {
22661 requires(n, 'undefined is not a valid limit value');
22662 this._limit = n;
22663 return this;
22664 },
22665
22666 /**
22667 * Add a constraint to the query that requires a particular key's value to
22668 * be equal to the provided value.
22669 * @param {String} key The key to check.
22670 * @param value The value that the AV.Object must contain.
22671 * @return {AV.Query} Returns the query, so you can chain this call.
22672 */
22673 equalTo: function equalTo(key, value) {
22674 requires(key, 'undefined is not a valid key');
22675 requires(value, 'undefined is not a valid value');
22676 this._where[key] = AV._encode(value);
22677 return this;
22678 },
22679
22680 /**
22681 * Helper for condition queries
22682 * @private
22683 */
22684 _addCondition: function _addCondition(key, condition, value) {
22685 requires(key, 'undefined is not a valid condition key');
22686 requires(condition, 'undefined is not a valid condition');
22687 requires(value, 'undefined is not a valid condition value'); // Check if we already have a condition
22688
22689 if (!this._where[key]) {
22690 this._where[key] = {};
22691 }
22692
22693 this._where[key][condition] = AV._encode(value);
22694 return this;
22695 },
22696
22697 /**
22698 * Add a constraint to the query that requires a particular
22699 * <strong>array</strong> key's length to be equal to the provided value.
22700 * @param {String} key The array key to check.
22701 * @param {number} value The length value.
22702 * @return {AV.Query} Returns the query, so you can chain this call.
22703 */
22704 sizeEqualTo: function sizeEqualTo(key, value) {
22705 this._addCondition(key, '$size', value);
22706
22707 return this;
22708 },
22709
22710 /**
22711 * Add a constraint to the query that requires a particular key's value to
22712 * be not equal to the provided value.
22713 * @param {String} key The key to check.
22714 * @param value The value that must not be equalled.
22715 * @return {AV.Query} Returns the query, so you can chain this call.
22716 */
22717 notEqualTo: function notEqualTo(key, value) {
22718 this._addCondition(key, '$ne', value);
22719
22720 return this;
22721 },
22722
22723 /**
22724 * Add a constraint to the query that requires a particular key's value to
22725 * be less than the provided value.
22726 * @param {String} key The key to check.
22727 * @param value The value that provides an upper bound.
22728 * @return {AV.Query} Returns the query, so you can chain this call.
22729 */
22730 lessThan: function lessThan(key, value) {
22731 this._addCondition(key, '$lt', value);
22732
22733 return this;
22734 },
22735
22736 /**
22737 * Add a constraint to the query that requires a particular key's value to
22738 * be greater than the provided value.
22739 * @param {String} key The key to check.
22740 * @param value The value that provides an lower bound.
22741 * @return {AV.Query} Returns the query, so you can chain this call.
22742 */
22743 greaterThan: function greaterThan(key, value) {
22744 this._addCondition(key, '$gt', value);
22745
22746 return this;
22747 },
22748
22749 /**
22750 * Add a constraint to the query that requires a particular key's value to
22751 * be less than or equal to the provided value.
22752 * @param {String} key The key to check.
22753 * @param value The value that provides an upper bound.
22754 * @return {AV.Query} Returns the query, so you can chain this call.
22755 */
22756 lessThanOrEqualTo: function lessThanOrEqualTo(key, value) {
22757 this._addCondition(key, '$lte', value);
22758
22759 return this;
22760 },
22761
22762 /**
22763 * Add a constraint to the query that requires a particular key's value to
22764 * be greater than or equal to the provided value.
22765 * @param {String} key The key to check.
22766 * @param value The value that provides an lower bound.
22767 * @return {AV.Query} Returns the query, so you can chain this call.
22768 */
22769 greaterThanOrEqualTo: function greaterThanOrEqualTo(key, value) {
22770 this._addCondition(key, '$gte', value);
22771
22772 return this;
22773 },
22774
22775 /**
22776 * Add a constraint to the query that requires a particular key's value to
22777 * be contained in the provided list of values.
22778 * @param {String} key The key to check.
22779 * @param {Array} values The values that will match.
22780 * @return {AV.Query} Returns the query, so you can chain this call.
22781 */
22782 containedIn: function containedIn(key, values) {
22783 this._addCondition(key, '$in', values);
22784
22785 return this;
22786 },
22787
22788 /**
22789 * Add a constraint to the query that requires a particular key's value to
22790 * not be contained in the provided list of values.
22791 * @param {String} key The key to check.
22792 * @param {Array} values The values that will not match.
22793 * @return {AV.Query} Returns the query, so you can chain this call.
22794 */
22795 notContainedIn: function notContainedIn(key, values) {
22796 this._addCondition(key, '$nin', values);
22797
22798 return this;
22799 },
22800
22801 /**
22802 * Add a constraint to the query that requires a particular key's value to
22803 * contain each one of the provided list of values.
22804 * @param {String} key The key to check. This key's value must be an array.
22805 * @param {Array} values The values that will match.
22806 * @return {AV.Query} Returns the query, so you can chain this call.
22807 */
22808 containsAll: function containsAll(key, values) {
22809 this._addCondition(key, '$all', values);
22810
22811 return this;
22812 },
22813
22814 /**
22815 * Add a constraint for finding objects that contain the given key.
22816 * @param {String} key The key that should exist.
22817 * @return {AV.Query} Returns the query, so you can chain this call.
22818 */
22819 exists: function exists(key) {
22820 this._addCondition(key, '$exists', true);
22821
22822 return this;
22823 },
22824
22825 /**
22826 * Add a constraint for finding objects that do not contain a given key.
22827 * @param {String} key The key that should not exist
22828 * @return {AV.Query} Returns the query, so you can chain this call.
22829 */
22830 doesNotExist: function doesNotExist(key) {
22831 this._addCondition(key, '$exists', false);
22832
22833 return this;
22834 },
22835
22836 /**
22837 * Add a regular expression constraint for finding string values that match
22838 * the provided regular expression.
22839 * This may be slow for large datasets.
22840 * @param {String} key The key that the string to match is stored in.
22841 * @param {RegExp} regex The regular expression pattern to match.
22842 * @return {AV.Query} Returns the query, so you can chain this call.
22843 */
22844 matches: function matches(key, regex, modifiers) {
22845 this._addCondition(key, '$regex', regex);
22846
22847 if (!modifiers) {
22848 modifiers = '';
22849 } // Javascript regex options support mig as inline options but store them
22850 // as properties of the object. We support mi & should migrate them to
22851 // modifiers
22852
22853
22854 if (regex.ignoreCase) {
22855 modifiers += 'i';
22856 }
22857
22858 if (regex.multiline) {
22859 modifiers += 'm';
22860 }
22861
22862 if (modifiers && modifiers.length) {
22863 this._addCondition(key, '$options', modifiers);
22864 }
22865
22866 return this;
22867 },
22868
22869 /**
22870 * Add a constraint that requires that a key's value matches a AV.Query
22871 * constraint.
22872 * @param {String} key The key that the contains the object to match the
22873 * query.
22874 * @param {AV.Query} query The query that should match.
22875 * @return {AV.Query} Returns the query, so you can chain this call.
22876 */
22877 matchesQuery: function matchesQuery(key, query) {
22878 var queryJSON = query._getParams();
22879
22880 queryJSON.className = query.className;
22881
22882 this._addCondition(key, '$inQuery', queryJSON);
22883
22884 return this;
22885 },
22886
22887 /**
22888 * Add a constraint that requires that a key's value not matches a
22889 * AV.Query constraint.
22890 * @param {String} key The key that the contains the object to match the
22891 * query.
22892 * @param {AV.Query} query The query that should not match.
22893 * @return {AV.Query} Returns the query, so you can chain this call.
22894 */
22895 doesNotMatchQuery: function doesNotMatchQuery(key, query) {
22896 var queryJSON = query._getParams();
22897
22898 queryJSON.className = query.className;
22899
22900 this._addCondition(key, '$notInQuery', queryJSON);
22901
22902 return this;
22903 },
22904
22905 /**
22906 * Add a constraint that requires that a key's value matches a value in
22907 * an object returned by a different AV.Query.
22908 * @param {String} key The key that contains the value that is being
22909 * matched.
22910 * @param {String} queryKey The key in the objects returned by the query to
22911 * match against.
22912 * @param {AV.Query} query The query to run.
22913 * @return {AV.Query} Returns the query, so you can chain this call.
22914 */
22915 matchesKeyInQuery: function matchesKeyInQuery(key, queryKey, query) {
22916 var queryJSON = query._getParams();
22917
22918 queryJSON.className = query.className;
22919
22920 this._addCondition(key, '$select', {
22921 key: queryKey,
22922 query: queryJSON
22923 });
22924
22925 return this;
22926 },
22927
22928 /**
22929 * Add a constraint that requires that a key's value not match a value in
22930 * an object returned by a different AV.Query.
22931 * @param {String} key The key that contains the value that is being
22932 * excluded.
22933 * @param {String} queryKey The key in the objects returned by the query to
22934 * match against.
22935 * @param {AV.Query} query The query to run.
22936 * @return {AV.Query} Returns the query, so you can chain this call.
22937 */
22938 doesNotMatchKeyInQuery: function doesNotMatchKeyInQuery(key, queryKey, query) {
22939 var queryJSON = query._getParams();
22940
22941 queryJSON.className = query.className;
22942
22943 this._addCondition(key, '$dontSelect', {
22944 key: queryKey,
22945 query: queryJSON
22946 });
22947
22948 return this;
22949 },
22950
22951 /**
22952 * Add constraint that at least one of the passed in queries matches.
22953 * @param {Array} queries
22954 * @return {AV.Query} Returns the query, so you can chain this call.
22955 * @private
22956 */
22957 _orQuery: function _orQuery(queries) {
22958 var queryJSON = (0, _map.default)(_).call(_, queries, function (q) {
22959 return q._getParams().where;
22960 });
22961 this._where.$or = queryJSON;
22962 return this;
22963 },
22964
22965 /**
22966 * Add constraint that both of the passed in queries matches.
22967 * @param {Array} queries
22968 * @return {AV.Query} Returns the query, so you can chain this call.
22969 * @private
22970 */
22971 _andQuery: function _andQuery(queries) {
22972 var queryJSON = (0, _map.default)(_).call(_, queries, function (q) {
22973 return q._getParams().where;
22974 });
22975 this._where.$and = queryJSON;
22976 return this;
22977 },
22978
22979 /**
22980 * Converts a string into a regex that matches it.
22981 * Surrounding with \Q .. \E does this, we just need to escape \E's in
22982 * the text separately.
22983 * @private
22984 */
22985 _quote: function _quote(s) {
22986 return '\\Q' + s.replace('\\E', '\\E\\\\E\\Q') + '\\E';
22987 },
22988
22989 /**
22990 * Add a constraint for finding string values that contain a provided
22991 * string. This may be slow for large datasets.
22992 * @param {String} key The key that the string to match is stored in.
22993 * @param {String} substring The substring that the value must contain.
22994 * @return {AV.Query} Returns the query, so you can chain this call.
22995 */
22996 contains: function contains(key, value) {
22997 this._addCondition(key, '$regex', this._quote(value));
22998
22999 return this;
23000 },
23001
23002 /**
23003 * Add a constraint for finding string values that start with a provided
23004 * string. This query will use the backend index, so it will be fast even
23005 * for large datasets.
23006 * @param {String} key The key that the string to match is stored in.
23007 * @param {String} prefix The substring that the value must start with.
23008 * @return {AV.Query} Returns the query, so you can chain this call.
23009 */
23010 startsWith: function startsWith(key, value) {
23011 this._addCondition(key, '$regex', '^' + this._quote(value));
23012
23013 return this;
23014 },
23015
23016 /**
23017 * Add a constraint for finding string values that end with a provided
23018 * string. This will be slow for large datasets.
23019 * @param {String} key The key that the string to match is stored in.
23020 * @param {String} suffix The substring that the value must end with.
23021 * @return {AV.Query} Returns the query, so you can chain this call.
23022 */
23023 endsWith: function endsWith(key, value) {
23024 this._addCondition(key, '$regex', this._quote(value) + '$');
23025
23026 return this;
23027 },
23028
23029 /**
23030 * Sorts the results in ascending order by the given key.
23031 *
23032 * @param {String} key The key to order by.
23033 * @return {AV.Query} Returns the query, so you can chain this call.
23034 */
23035 ascending: function ascending(key) {
23036 requires(key, 'undefined is not a valid key');
23037 this._order = key;
23038 return this;
23039 },
23040
23041 /**
23042 * Also sorts the results in ascending order by the given key. The previous sort keys have
23043 * precedence over this key.
23044 *
23045 * @param {String} key The key to order by
23046 * @return {AV.Query} Returns the query so you can chain this call.
23047 */
23048 addAscending: function addAscending(key) {
23049 requires(key, 'undefined is not a valid key');
23050 if (this._order) this._order += ',' + key;else this._order = key;
23051 return this;
23052 },
23053
23054 /**
23055 * Sorts the results in descending order by the given key.
23056 *
23057 * @param {String} key The key to order by.
23058 * @return {AV.Query} Returns the query, so you can chain this call.
23059 */
23060 descending: function descending(key) {
23061 requires(key, 'undefined is not a valid key');
23062 this._order = '-' + key;
23063 return this;
23064 },
23065
23066 /**
23067 * Also sorts the results in descending order by the given key. The previous sort keys have
23068 * precedence over this key.
23069 *
23070 * @param {String} key The key to order by
23071 * @return {AV.Query} Returns the query so you can chain this call.
23072 */
23073 addDescending: function addDescending(key) {
23074 requires(key, 'undefined is not a valid key');
23075 if (this._order) this._order += ',-' + key;else this._order = '-' + key;
23076 return this;
23077 },
23078
23079 /**
23080 * Add a proximity based constraint for finding objects with key point
23081 * values near the point given.
23082 * @param {String} key The key that the AV.GeoPoint is stored in.
23083 * @param {AV.GeoPoint} point The reference AV.GeoPoint that is used.
23084 * @return {AV.Query} Returns the query, so you can chain this call.
23085 */
23086 near: function near(key, point) {
23087 if (!(point instanceof AV.GeoPoint)) {
23088 // Try to cast it to a GeoPoint, so that near("loc", [20,30]) works.
23089 point = new AV.GeoPoint(point);
23090 }
23091
23092 this._addCondition(key, '$nearSphere', point);
23093
23094 return this;
23095 },
23096
23097 /**
23098 * Add a proximity based constraint for finding objects with key point
23099 * values near the point given and within the maximum distance given.
23100 * @param {String} key The key that the AV.GeoPoint is stored in.
23101 * @param {AV.GeoPoint} point The reference AV.GeoPoint that is used.
23102 * @param maxDistance Maximum distance (in radians) of results to return.
23103 * @return {AV.Query} Returns the query, so you can chain this call.
23104 */
23105 withinRadians: function withinRadians(key, point, distance) {
23106 this.near(key, point);
23107
23108 this._addCondition(key, '$maxDistance', distance);
23109
23110 return this;
23111 },
23112
23113 /**
23114 * Add a proximity based constraint for finding objects with key point
23115 * values near the point given and within the maximum distance given.
23116 * Radius of earth used is 3958.8 miles.
23117 * @param {String} key The key that the AV.GeoPoint is stored in.
23118 * @param {AV.GeoPoint} point The reference AV.GeoPoint that is used.
23119 * @param {Number} maxDistance Maximum distance (in miles) of results to
23120 * return.
23121 * @return {AV.Query} Returns the query, so you can chain this call.
23122 */
23123 withinMiles: function withinMiles(key, point, distance) {
23124 return this.withinRadians(key, point, distance / 3958.8);
23125 },
23126
23127 /**
23128 * Add a proximity based constraint for finding objects with key point
23129 * values near the point given and within the maximum distance given.
23130 * Radius of earth used is 6371.0 kilometers.
23131 * @param {String} key The key that the AV.GeoPoint is stored in.
23132 * @param {AV.GeoPoint} point The reference AV.GeoPoint that is used.
23133 * @param {Number} maxDistance Maximum distance (in kilometers) of results
23134 * to return.
23135 * @return {AV.Query} Returns the query, so you can chain this call.
23136 */
23137 withinKilometers: function withinKilometers(key, point, distance) {
23138 return this.withinRadians(key, point, distance / 6371.0);
23139 },
23140
23141 /**
23142 * Add a constraint to the query that requires a particular key's
23143 * coordinates be contained within a given rectangular geographic bounding
23144 * box.
23145 * @param {String} key The key to be constrained.
23146 * @param {AV.GeoPoint} southwest
23147 * The lower-left inclusive corner of the box.
23148 * @param {AV.GeoPoint} northeast
23149 * The upper-right inclusive corner of the box.
23150 * @return {AV.Query} Returns the query, so you can chain this call.
23151 */
23152 withinGeoBox: function withinGeoBox(key, southwest, northeast) {
23153 if (!(southwest instanceof AV.GeoPoint)) {
23154 southwest = new AV.GeoPoint(southwest);
23155 }
23156
23157 if (!(northeast instanceof AV.GeoPoint)) {
23158 northeast = new AV.GeoPoint(northeast);
23159 }
23160
23161 this._addCondition(key, '$within', {
23162 $box: [southwest, northeast]
23163 });
23164
23165 return this;
23166 },
23167
23168 /**
23169 * Include nested AV.Objects for the provided key. You can use dot
23170 * notation to specify which fields in the included object are also fetch.
23171 * @param {String[]} keys The name of the key to include.
23172 * @return {AV.Query} Returns the query, so you can chain this call.
23173 */
23174 include: function include(keys) {
23175 var _this4 = this;
23176
23177 requires(keys, 'undefined is not a valid key');
23178
23179 _.forEach(arguments, function (keys) {
23180 var _context;
23181
23182 _this4._include = (0, _concat.default)(_context = _this4._include).call(_context, ensureArray(keys));
23183 });
23184
23185 return this;
23186 },
23187
23188 /**
23189 * Include the ACL.
23190 * @param {Boolean} [value=true] Whether to include the ACL
23191 * @return {AV.Query} Returns the query, so you can chain this call.
23192 */
23193 includeACL: function includeACL() {
23194 var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
23195 this._includeACL = value;
23196 return this;
23197 },
23198
23199 /**
23200 * Restrict the fields of the returned AV.Objects to include only the
23201 * provided keys. If this is called multiple times, then all of the keys
23202 * specified in each of the calls will be included.
23203 * @param {String[]} keys The names of the keys to include.
23204 * @return {AV.Query} Returns the query, so you can chain this call.
23205 */
23206 select: function select(keys) {
23207 var _this5 = this;
23208
23209 requires(keys, 'undefined is not a valid key');
23210
23211 _.forEach(arguments, function (keys) {
23212 var _context2;
23213
23214 _this5._select = (0, _concat.default)(_context2 = _this5._select).call(_context2, ensureArray(keys));
23215 });
23216
23217 return this;
23218 },
23219
23220 /**
23221 * Iterates over each result of a query, calling a callback for each one. If
23222 * the callback returns a promise, the iteration will not continue until
23223 * that promise has been fulfilled. If the callback returns a rejected
23224 * promise, then iteration will stop with that error. The items are
23225 * processed in an unspecified order. The query may not have any sort order,
23226 * and may not use limit or skip.
23227 * @param callback {Function} Callback that will be called with each result
23228 * of the query.
23229 * @return {Promise} A promise that will be fulfilled once the
23230 * iteration has completed.
23231 */
23232 each: function each(callback) {
23233 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
23234
23235 if (this._order || this._skip || this._limit >= 0) {
23236 var error = new Error('Cannot iterate on a query with sort, skip, or limit.');
23237 return _promise.default.reject(error);
23238 }
23239
23240 var query = new AV.Query(this.objectClass); // We can override the batch size from the options.
23241 // This is undocumented, but useful for testing.
23242
23243 query._limit = options.batchSize || 100;
23244 query._where = _.clone(this._where);
23245 query._include = _.clone(this._include);
23246 query.ascending('objectId');
23247 var finished = false;
23248 return continueWhile(function () {
23249 return !finished;
23250 }, function () {
23251 return (0, _find.default)(query).call(query, options).then(function (results) {
23252 var callbacksDone = _promise.default.resolve();
23253
23254 _.each(results, function (result) {
23255 callbacksDone = callbacksDone.then(function () {
23256 return callback(result);
23257 });
23258 });
23259
23260 return callbacksDone.then(function () {
23261 if (results.length >= query._limit) {
23262 query.greaterThan('objectId', results[results.length - 1].id);
23263 } else {
23264 finished = true;
23265 }
23266 });
23267 });
23268 });
23269 },
23270
23271 /**
23272 * Subscribe the changes of this query.
23273 *
23274 * LiveQuery is not included in the default bundle: {@link https://url.leanapp.cn/enable-live-query}.
23275 *
23276 * @since 3.0.0
23277 * @return {AV.LiveQuery} An eventemitter which can be used to get LiveQuery updates;
23278 */
23279 subscribe: function subscribe(options) {
23280 return AV.LiveQuery.init(this, options);
23281 }
23282 });
23283
23284 AV.FriendShipQuery = AV.Query._extend({
23285 _newObject: function _newObject() {
23286 var UserClass = AV.Object._getSubclass('_User');
23287
23288 return new UserClass();
23289 },
23290 _processResult: function _processResult(json) {
23291 if (json && json[this._friendshipTag]) {
23292 var user = json[this._friendshipTag];
23293
23294 if (user.__type === 'Pointer' && user.className === '_User') {
23295 delete user.__type;
23296 delete user.className;
23297 }
23298
23299 return user;
23300 } else {
23301 return null;
23302 }
23303 }
23304 });
23305};
23306
23307/***/ }),
23308/* 562 */
23309/***/ (function(module, exports, __webpack_require__) {
23310
23311"use strict";
23312
23313
23314var _interopRequireDefault = __webpack_require__(1);
23315
23316var _promise = _interopRequireDefault(__webpack_require__(12));
23317
23318var _keys = _interopRequireDefault(__webpack_require__(62));
23319
23320var _ = __webpack_require__(3);
23321
23322var EventEmitter = __webpack_require__(234);
23323
23324var _require = __webpack_require__(32),
23325 inherits = _require.inherits;
23326
23327var _require2 = __webpack_require__(28),
23328 request = _require2.request;
23329
23330var subscribe = function subscribe(queryJSON, subscriptionId) {
23331 return request({
23332 method: 'POST',
23333 path: '/LiveQuery/subscribe',
23334 data: {
23335 query: queryJSON,
23336 id: subscriptionId
23337 }
23338 });
23339};
23340
23341module.exports = function (AV) {
23342 var requireRealtime = function requireRealtime() {
23343 if (!AV._config.realtime) {
23344 throw new Error('LiveQuery not supported. Please use the LiveQuery bundle. https://url.leanapp.cn/enable-live-query');
23345 }
23346 };
23347 /**
23348 * @class
23349 * A LiveQuery, created by {@link AV.Query#subscribe} is an EventEmitter notifies changes of the Query.
23350 * @since 3.0.0
23351 */
23352
23353
23354 AV.LiveQuery = inherits(EventEmitter,
23355 /** @lends AV.LiveQuery.prototype */
23356 {
23357 constructor: function constructor(id, client, queryJSON, subscriptionId) {
23358 var _this = this;
23359
23360 EventEmitter.apply(this);
23361 this.id = id;
23362 this._client = client;
23363
23364 this._client.register(this);
23365
23366 this._queryJSON = queryJSON;
23367 this._subscriptionId = subscriptionId;
23368 this._onMessage = this._dispatch.bind(this);
23369
23370 this._onReconnect = function () {
23371 subscribe(_this._queryJSON, _this._subscriptionId).catch(function (error) {
23372 return console.error("LiveQuery resubscribe error: ".concat(error.message));
23373 });
23374 };
23375
23376 client.on('message', this._onMessage);
23377 client.on('reconnect', this._onReconnect);
23378 },
23379 _dispatch: function _dispatch(message) {
23380 var _this2 = this;
23381
23382 message.forEach(function (_ref) {
23383 var op = _ref.op,
23384 object = _ref.object,
23385 queryId = _ref.query_id,
23386 updatedKeys = _ref.updatedKeys;
23387 if (queryId !== _this2.id) return;
23388 var target = AV.parseJSON(_.extend({
23389 __type: object.className === '_File' ? 'File' : 'Object'
23390 }, object));
23391
23392 if (updatedKeys) {
23393 /**
23394 * An existing AV.Object which fulfills the Query you subscribe is updated.
23395 * @event AV.LiveQuery#update
23396 * @param {AV.Object|AV.File} target updated object
23397 * @param {String[]} updatedKeys updated keys
23398 */
23399
23400 /**
23401 * An existing AV.Object which doesn't fulfill the Query is updated and now it fulfills the Query.
23402 * @event AV.LiveQuery#enter
23403 * @param {AV.Object|AV.File} target updated object
23404 * @param {String[]} updatedKeys updated keys
23405 */
23406
23407 /**
23408 * An existing AV.Object which fulfills the Query is updated and now it doesn't fulfill the Query.
23409 * @event AV.LiveQuery#leave
23410 * @param {AV.Object|AV.File} target updated object
23411 * @param {String[]} updatedKeys updated keys
23412 */
23413 _this2.emit(op, target, updatedKeys);
23414 } else {
23415 /**
23416 * A new AV.Object which fulfills the Query you subscribe is created.
23417 * @event AV.LiveQuery#create
23418 * @param {AV.Object|AV.File} target updated object
23419 */
23420
23421 /**
23422 * An existing AV.Object which fulfills the Query you subscribe is deleted.
23423 * @event AV.LiveQuery#delete
23424 * @param {AV.Object|AV.File} target updated object
23425 */
23426 _this2.emit(op, target);
23427 }
23428 });
23429 },
23430
23431 /**
23432 * unsubscribe the query
23433 *
23434 * @return {Promise}
23435 */
23436 unsubscribe: function unsubscribe() {
23437 var client = this._client;
23438 client.off('message', this._onMessage);
23439 client.off('reconnect', this._onReconnect);
23440 client.deregister(this);
23441 return request({
23442 method: 'POST',
23443 path: '/LiveQuery/unsubscribe',
23444 data: {
23445 id: client.id,
23446 query_id: this.id
23447 }
23448 });
23449 }
23450 },
23451 /** @lends AV.LiveQuery */
23452 {
23453 init: function init(query) {
23454 var _ref2 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
23455 _ref2$subscriptionId = _ref2.subscriptionId,
23456 userDefinedSubscriptionId = _ref2$subscriptionId === void 0 ? AV._getSubscriptionId() : _ref2$subscriptionId;
23457
23458 requireRealtime();
23459 if (!(query instanceof AV.Query)) throw new TypeError('LiveQuery must be inited with a Query');
23460 return _promise.default.resolve(userDefinedSubscriptionId).then(function (subscriptionId) {
23461 return AV._config.realtime.createLiveQueryClient(subscriptionId).then(function (liveQueryClient) {
23462 var _query$_getParams = query._getParams(),
23463 where = _query$_getParams.where,
23464 keys = (0, _keys.default)(_query$_getParams),
23465 returnACL = _query$_getParams.returnACL;
23466
23467 var queryJSON = {
23468 where: where,
23469 keys: keys,
23470 returnACL: returnACL,
23471 className: query.className
23472 };
23473 var promise = subscribe(queryJSON, subscriptionId).then(function (_ref3) {
23474 var queryId = _ref3.query_id;
23475 return new AV.LiveQuery(queryId, liveQueryClient, queryJSON, subscriptionId);
23476 }).finally(function () {
23477 liveQueryClient.deregister(promise);
23478 });
23479 liveQueryClient.register(promise);
23480 return promise;
23481 });
23482 });
23483 },
23484
23485 /**
23486 * Pause the LiveQuery connection. This is useful to deactivate the SDK when the app is swtiched to background.
23487 * @static
23488 * @return void
23489 */
23490 pause: function pause() {
23491 requireRealtime();
23492 return AV._config.realtime.pause();
23493 },
23494
23495 /**
23496 * Resume the LiveQuery connection. All subscriptions will be restored after reconnection.
23497 * @static
23498 * @return void
23499 */
23500 resume: function resume() {
23501 requireRealtime();
23502 return AV._config.realtime.resume();
23503 }
23504 });
23505};
23506
23507/***/ }),
23508/* 563 */
23509/***/ (function(module, exports, __webpack_require__) {
23510
23511"use strict";
23512
23513
23514var _ = __webpack_require__(3);
23515
23516var _require = __webpack_require__(32),
23517 tap = _require.tap;
23518
23519module.exports = function (AV) {
23520 /**
23521 * @class
23522 * @example
23523 * AV.Captcha.request().then(captcha => {
23524 * captcha.bind({
23525 * textInput: 'code', // the id for textInput
23526 * image: 'captcha',
23527 * verifyButton: 'verify',
23528 * }, {
23529 * success: (validateCode) => {}, // next step
23530 * error: (error) => {}, // present error.message to user
23531 * });
23532 * });
23533 */
23534 AV.Captcha = function Captcha(options, authOptions) {
23535 this._options = options;
23536 this._authOptions = authOptions;
23537 /**
23538 * The image url of the captcha
23539 * @type string
23540 */
23541
23542 this.url = undefined;
23543 /**
23544 * The captchaToken of the captcha.
23545 * @type string
23546 */
23547
23548 this.captchaToken = undefined;
23549 /**
23550 * The validateToken of the captcha.
23551 * @type string
23552 */
23553
23554 this.validateToken = undefined;
23555 };
23556 /**
23557 * Refresh the captcha
23558 * @return {Promise.<string>} a new capcha url
23559 */
23560
23561
23562 AV.Captcha.prototype.refresh = function refresh() {
23563 var _this = this;
23564
23565 return AV.Cloud._requestCaptcha(this._options, this._authOptions).then(function (_ref) {
23566 var captchaToken = _ref.captchaToken,
23567 url = _ref.url;
23568
23569 _.extend(_this, {
23570 captchaToken: captchaToken,
23571 url: url
23572 });
23573
23574 return url;
23575 });
23576 };
23577 /**
23578 * Verify the captcha
23579 * @param {String} code The code from user input
23580 * @return {Promise.<string>} validateToken if the code is valid
23581 */
23582
23583
23584 AV.Captcha.prototype.verify = function verify(code) {
23585 var _this2 = this;
23586
23587 return AV.Cloud.verifyCaptcha(code, this.captchaToken).then(tap(function (validateToken) {
23588 return _this2.validateToken = validateToken;
23589 }));
23590 };
23591
23592 if (true) {
23593 /**
23594 * Bind the captcha to HTMLElements. <b>ONLY AVAILABLE in browsers</b>.
23595 * @param [elements]
23596 * @param {String|HTMLInputElement} [elements.textInput] An input element typed text, or the id for the element.
23597 * @param {String|HTMLImageElement} [elements.image] An image element, or the id for the element.
23598 * @param {String|HTMLElement} [elements.verifyButton] A button element, or the id for the element.
23599 * @param [callbacks]
23600 * @param {Function} [callbacks.success] Success callback will be called if the code is verified. The param `validateCode` can be used for further SMS request.
23601 * @param {Function} [callbacks.error] Error callback will be called if something goes wrong, detailed in param `error.message`.
23602 */
23603 AV.Captcha.prototype.bind = function bind(_ref2, _ref3) {
23604 var _this3 = this;
23605
23606 var textInput = _ref2.textInput,
23607 image = _ref2.image,
23608 verifyButton = _ref2.verifyButton;
23609 var success = _ref3.success,
23610 error = _ref3.error;
23611
23612 if (typeof textInput === 'string') {
23613 textInput = document.getElementById(textInput);
23614 if (!textInput) throw new Error("textInput with id ".concat(textInput, " not found"));
23615 }
23616
23617 if (typeof image === 'string') {
23618 image = document.getElementById(image);
23619 if (!image) throw new Error("image with id ".concat(image, " not found"));
23620 }
23621
23622 if (typeof verifyButton === 'string') {
23623 verifyButton = document.getElementById(verifyButton);
23624 if (!verifyButton) throw new Error("verifyButton with id ".concat(verifyButton, " not found"));
23625 }
23626
23627 this.__refresh = function () {
23628 return _this3.refresh().then(function (url) {
23629 image.src = url;
23630
23631 if (textInput) {
23632 textInput.value = '';
23633 textInput.focus();
23634 }
23635 }).catch(function (err) {
23636 return console.warn("refresh captcha fail: ".concat(err.message));
23637 });
23638 };
23639
23640 if (image) {
23641 this.__image = image;
23642 image.src = this.url;
23643 image.addEventListener('click', this.__refresh);
23644 }
23645
23646 this.__verify = function () {
23647 var code = textInput.value;
23648
23649 _this3.verify(code).catch(function (err) {
23650 _this3.__refresh();
23651
23652 throw err;
23653 }).then(success, error).catch(function (err) {
23654 return console.warn("verify captcha fail: ".concat(err.message));
23655 });
23656 };
23657
23658 if (textInput && verifyButton) {
23659 this.__verifyButton = verifyButton;
23660 verifyButton.addEventListener('click', this.__verify);
23661 }
23662 };
23663 /**
23664 * unbind the captcha from HTMLElements. <b>ONLY AVAILABLE in browsers</b>.
23665 */
23666
23667
23668 AV.Captcha.prototype.unbind = function unbind() {
23669 if (this.__image) this.__image.removeEventListener('click', this.__refresh);
23670 if (this.__verifyButton) this.__verifyButton.removeEventListener('click', this.__verify);
23671 };
23672 }
23673 /**
23674 * Request a captcha
23675 * @param [options]
23676 * @param {Number} [options.width] width(px) of the captcha, ranged 60-200
23677 * @param {Number} [options.height] height(px) of the captcha, ranged 30-100
23678 * @param {Number} [options.size=4] length of the captcha, ranged 3-6. MasterKey required.
23679 * @param {Number} [options.ttl=60] time to live(s), ranged 10-180. MasterKey required.
23680 * @return {Promise.<AV.Captcha>}
23681 */
23682
23683
23684 AV.Captcha.request = function (options, authOptions) {
23685 var captcha = new AV.Captcha(options, authOptions);
23686 return captcha.refresh().then(function () {
23687 return captcha;
23688 });
23689 };
23690};
23691
23692/***/ }),
23693/* 564 */
23694/***/ (function(module, exports, __webpack_require__) {
23695
23696"use strict";
23697
23698
23699var _interopRequireDefault = __webpack_require__(1);
23700
23701var _promise = _interopRequireDefault(__webpack_require__(12));
23702
23703var _ = __webpack_require__(3);
23704
23705var _require = __webpack_require__(28),
23706 _request = _require._request,
23707 request = _require.request;
23708
23709module.exports = function (AV) {
23710 /**
23711 * Contains functions for calling and declaring
23712 * <p><strong><em>
23713 * Some functions are only available from Cloud Code.
23714 * </em></strong></p>
23715 *
23716 * @namespace
23717 * @borrows AV.Captcha.request as requestCaptcha
23718 */
23719 AV.Cloud = AV.Cloud || {};
23720
23721 _.extend(AV.Cloud,
23722 /** @lends AV.Cloud */
23723 {
23724 /**
23725 * Makes a call to a cloud function.
23726 * @param {String} name The function name.
23727 * @param {Object} [data] The parameters to send to the cloud function.
23728 * @param {AuthOptions} [options]
23729 * @return {Promise} A promise that will be resolved with the result
23730 * of the function.
23731 */
23732 run: function run(name, data, options) {
23733 return request({
23734 service: 'engine',
23735 method: 'POST',
23736 path: "/functions/".concat(name),
23737 data: AV._encode(data, null, true),
23738 authOptions: options
23739 }).then(function (resp) {
23740 return AV._decode(resp).result;
23741 });
23742 },
23743
23744 /**
23745 * Makes a call to a cloud function, you can send {AV.Object} as param or a field of param; the response
23746 * from server will also be parsed as an {AV.Object}, array of {AV.Object}, or object includes {AV.Object}
23747 * @param {String} name The function name.
23748 * @param {Object} [data] The parameters to send to the cloud function.
23749 * @param {AuthOptions} [options]
23750 * @return {Promise} A promise that will be resolved with the result of the function.
23751 */
23752 rpc: function rpc(name, data, options) {
23753 if (_.isArray(data)) {
23754 return _promise.default.reject(new Error("Can't pass Array as the param of rpc function in JavaScript SDK."));
23755 }
23756
23757 return request({
23758 service: 'engine',
23759 method: 'POST',
23760 path: "/call/".concat(name),
23761 data: AV._encodeObjectOrArray(data),
23762 authOptions: options
23763 }).then(function (resp) {
23764 return AV._decode(resp).result;
23765 });
23766 },
23767
23768 /**
23769 * Make a call to request server date time.
23770 * @return {Promise.<Date>} A promise that will be resolved with the result
23771 * of the function.
23772 * @since 0.5.9
23773 */
23774 getServerDate: function getServerDate() {
23775 return _request('date', null, null, 'GET').then(function (resp) {
23776 return AV._decode(resp);
23777 });
23778 },
23779
23780 /**
23781 * Makes a call to request an sms code for operation verification.
23782 * @param {String|Object} data The mobile phone number string or a JSON
23783 * object that contains mobilePhoneNumber,template,sign,op,ttl,name etc.
23784 * @param {String} data.mobilePhoneNumber
23785 * @param {String} [data.template] sms template name
23786 * @param {String} [data.sign] sms signature name
23787 * @param {String} [data.smsType] sending code by `sms` (default) or `voice` call
23788 * @param {SMSAuthOptions} [options]
23789 * @return {Promise} A promise that will be resolved if the request succeed
23790 */
23791 requestSmsCode: function requestSmsCode(data) {
23792 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
23793
23794 if (_.isString(data)) {
23795 data = {
23796 mobilePhoneNumber: data
23797 };
23798 }
23799
23800 if (!data.mobilePhoneNumber) {
23801 throw new Error('Missing mobilePhoneNumber.');
23802 }
23803
23804 if (options.validateToken) {
23805 data = _.extend({}, data, {
23806 validate_token: options.validateToken
23807 });
23808 }
23809
23810 return _request('requestSmsCode', null, null, 'POST', data, options);
23811 },
23812
23813 /**
23814 * Makes a call to verify sms code that sent by AV.Cloud.requestSmsCode
23815 * @param {String} code The sms code sent by AV.Cloud.requestSmsCode
23816 * @param {phone} phone The mobile phoner number.
23817 * @return {Promise} A promise that will be resolved with the result
23818 * of the function.
23819 */
23820 verifySmsCode: function verifySmsCode(code, phone) {
23821 if (!code) throw new Error('Missing sms code.');
23822 var params = {};
23823
23824 if (_.isString(phone)) {
23825 params['mobilePhoneNumber'] = phone;
23826 }
23827
23828 return _request('verifySmsCode', code, null, 'POST', params);
23829 },
23830 _requestCaptcha: function _requestCaptcha(options, authOptions) {
23831 return _request('requestCaptcha', null, null, 'GET', options, authOptions).then(function (_ref) {
23832 var url = _ref.captcha_url,
23833 captchaToken = _ref.captcha_token;
23834 return {
23835 captchaToken: captchaToken,
23836 url: url
23837 };
23838 });
23839 },
23840
23841 /**
23842 * Request a captcha.
23843 */
23844 requestCaptcha: AV.Captcha.request,
23845
23846 /**
23847 * Verify captcha code. This is the low-level API for captcha.
23848 * Checkout {@link AV.Captcha} for high abstract APIs.
23849 * @param {String} code the code from user input
23850 * @param {String} captchaToken captchaToken returned by {@link AV.Cloud.requestCaptcha}
23851 * @return {Promise.<String>} validateToken if the code is valid
23852 */
23853 verifyCaptcha: function verifyCaptcha(code, captchaToken) {
23854 return _request('verifyCaptcha', null, null, 'POST', {
23855 captcha_code: code,
23856 captcha_token: captchaToken
23857 }).then(function (_ref2) {
23858 var validateToken = _ref2.validate_token;
23859 return validateToken;
23860 });
23861 }
23862 });
23863};
23864
23865/***/ }),
23866/* 565 */
23867/***/ (function(module, exports, __webpack_require__) {
23868
23869"use strict";
23870
23871
23872var request = __webpack_require__(28).request;
23873
23874module.exports = function (AV) {
23875 AV.Installation = AV.Object.extend('_Installation');
23876 /**
23877 * @namespace
23878 */
23879
23880 AV.Push = AV.Push || {};
23881 /**
23882 * Sends a push notification.
23883 * @param {Object} data The data of the push notification.
23884 * @param {String[]} [data.channels] An Array of channels to push to.
23885 * @param {Date} [data.push_time] A Date object for when to send the push.
23886 * @param {Date} [data.expiration_time] A Date object for when to expire
23887 * the push.
23888 * @param {Number} [data.expiration_interval] The seconds from now to expire the push.
23889 * @param {Number} [data.flow_control] The clients to notify per second
23890 * @param {AV.Query} [data.where] An AV.Query over AV.Installation that is used to match
23891 * a set of installations to push to.
23892 * @param {String} [data.cql] A CQL statement over AV.Installation that is used to match
23893 * a set of installations to push to.
23894 * @param {Object} data.data The data to send as part of the push.
23895 More details: https://url.leanapp.cn/pushData
23896 * @param {AuthOptions} [options]
23897 * @return {Promise}
23898 */
23899
23900 AV.Push.send = function (data, options) {
23901 if (data.where) {
23902 data.where = data.where._getParams().where;
23903 }
23904
23905 if (data.where && data.cql) {
23906 throw new Error("Both where and cql can't be set");
23907 }
23908
23909 if (data.push_time) {
23910 data.push_time = data.push_time.toJSON();
23911 }
23912
23913 if (data.expiration_time) {
23914 data.expiration_time = data.expiration_time.toJSON();
23915 }
23916
23917 if (data.expiration_time && data.expiration_interval) {
23918 throw new Error("Both expiration_time and expiration_interval can't be set");
23919 }
23920
23921 return request({
23922 service: 'push',
23923 method: 'POST',
23924 path: '/push',
23925 data: data,
23926 authOptions: options
23927 });
23928 };
23929};
23930
23931/***/ }),
23932/* 566 */
23933/***/ (function(module, exports, __webpack_require__) {
23934
23935"use strict";
23936
23937
23938var _interopRequireDefault = __webpack_require__(1);
23939
23940var _promise = _interopRequireDefault(__webpack_require__(12));
23941
23942var _typeof2 = _interopRequireDefault(__webpack_require__(95));
23943
23944var _ = __webpack_require__(3);
23945
23946var AVRequest = __webpack_require__(28)._request;
23947
23948var _require = __webpack_require__(32),
23949 getSessionToken = _require.getSessionToken;
23950
23951module.exports = function (AV) {
23952 var getUser = function getUser() {
23953 var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
23954 var sessionToken = getSessionToken(options);
23955
23956 if (sessionToken) {
23957 return AV.User._fetchUserBySessionToken(getSessionToken(options));
23958 }
23959
23960 return AV.User.currentAsync();
23961 };
23962
23963 var getUserPointer = function getUserPointer(options) {
23964 return getUser(options).then(function (currUser) {
23965 return AV.Object.createWithoutData('_User', currUser.id)._toPointer();
23966 });
23967 };
23968 /**
23969 * Contains functions to deal with Status in LeanCloud.
23970 * @class
23971 */
23972
23973
23974 AV.Status = function (imageUrl, message) {
23975 this.data = {};
23976 this.inboxType = 'default';
23977 this.query = null;
23978
23979 if (imageUrl && (0, _typeof2.default)(imageUrl) === 'object') {
23980 this.data = imageUrl;
23981 } else {
23982 if (imageUrl) {
23983 this.data.image = imageUrl;
23984 }
23985
23986 if (message) {
23987 this.data.message = message;
23988 }
23989 }
23990
23991 return this;
23992 };
23993
23994 _.extend(AV.Status.prototype,
23995 /** @lends AV.Status.prototype */
23996 {
23997 /**
23998 * Gets the value of an attribute in status data.
23999 * @param {String} attr The string name of an attribute.
24000 */
24001 get: function get(attr) {
24002 return this.data[attr];
24003 },
24004
24005 /**
24006 * Sets a hash of model attributes on the status data.
24007 * @param {String} key The key to set.
24008 * @param {any} value The value to give it.
24009 */
24010 set: function set(key, value) {
24011 this.data[key] = value;
24012 return this;
24013 },
24014
24015 /**
24016 * Destroy this status,then it will not be avaiable in other user's inboxes.
24017 * @param {AuthOptions} options
24018 * @return {Promise} A promise that is fulfilled when the destroy
24019 * completes.
24020 */
24021 destroy: function destroy(options) {
24022 if (!this.id) return _promise.default.reject(new Error('The status id is not exists.'));
24023 var request = AVRequest('statuses', null, this.id, 'DELETE', options);
24024 return request;
24025 },
24026
24027 /**
24028 * Cast the AV.Status object to an AV.Object pointer.
24029 * @return {AV.Object} A AV.Object pointer.
24030 */
24031 toObject: function toObject() {
24032 if (!this.id) return null;
24033 return AV.Object.createWithoutData('_Status', this.id);
24034 },
24035 _getDataJSON: function _getDataJSON() {
24036 var json = _.clone(this.data);
24037
24038 return AV._encode(json);
24039 },
24040
24041 /**
24042 * Send a status by a AV.Query object.
24043 * @since 0.3.0
24044 * @param {AuthOptions} options
24045 * @return {Promise} A promise that is fulfilled when the send
24046 * completes.
24047 * @example
24048 * // send a status to male users
24049 * var status = new AVStatus('image url', 'a message');
24050 * status.query = new AV.Query('_User');
24051 * status.query.equalTo('gender', 'male');
24052 * status.send().then(function(){
24053 * //send status successfully.
24054 * }, function(err){
24055 * //an error threw.
24056 * console.dir(err);
24057 * });
24058 */
24059 send: function send() {
24060 var _this = this;
24061
24062 var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
24063
24064 if (!getSessionToken(options) && !AV.User.current()) {
24065 throw new Error('Please signin an user.');
24066 }
24067
24068 if (!this.query) {
24069 return AV.Status.sendStatusToFollowers(this, options);
24070 }
24071
24072 return getUserPointer(options).then(function (currUser) {
24073 var query = _this.query._getParams();
24074
24075 query.className = _this.query.className;
24076 var data = {};
24077 data.query = query;
24078 _this.data = _this.data || {};
24079 _this.data.source = _this.data.source || currUser;
24080 data.data = _this._getDataJSON();
24081 data.inboxType = _this.inboxType || 'default';
24082 return AVRequest('statuses', null, null, 'POST', data, options);
24083 }).then(function (response) {
24084 _this.id = response.objectId;
24085 _this.createdAt = AV._parseDate(response.createdAt);
24086 return _this;
24087 });
24088 },
24089 _finishFetch: function _finishFetch(serverData) {
24090 this.id = serverData.objectId;
24091 this.createdAt = AV._parseDate(serverData.createdAt);
24092 this.updatedAt = AV._parseDate(serverData.updatedAt);
24093 this.messageId = serverData.messageId;
24094 delete serverData.messageId;
24095 delete serverData.objectId;
24096 delete serverData.createdAt;
24097 delete serverData.updatedAt;
24098 this.data = AV._decode(serverData);
24099 }
24100 });
24101 /**
24102 * Send a status to current signined user's followers.
24103 * @since 0.3.0
24104 * @param {AV.Status} status A status object to be send to followers.
24105 * @param {AuthOptions} options
24106 * @return {Promise} A promise that is fulfilled when the send
24107 * completes.
24108 * @example
24109 * var status = new AVStatus('image url', 'a message');
24110 * AV.Status.sendStatusToFollowers(status).then(function(){
24111 * //send status successfully.
24112 * }, function(err){
24113 * //an error threw.
24114 * console.dir(err);
24115 * });
24116 */
24117
24118
24119 AV.Status.sendStatusToFollowers = function (status) {
24120 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
24121
24122 if (!getSessionToken(options) && !AV.User.current()) {
24123 throw new Error('Please signin an user.');
24124 }
24125
24126 return getUserPointer(options).then(function (currUser) {
24127 var query = {};
24128 query.className = '_Follower';
24129 query.keys = 'follower';
24130 query.where = {
24131 user: currUser
24132 };
24133 var data = {};
24134 data.query = query;
24135 status.data = status.data || {};
24136 status.data.source = status.data.source || currUser;
24137 data.data = status._getDataJSON();
24138 data.inboxType = status.inboxType || 'default';
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 * <p>Send a status from current signined user to other user's private status inbox.</p>
24149 * @since 0.3.0
24150 * @param {AV.Status} status A status object to be send to followers.
24151 * @param {String} target The target user or user's objectId.
24152 * @param {AuthOptions} options
24153 * @return {Promise} A promise that is fulfilled when the send
24154 * completes.
24155 * @example
24156 * // send a private status to user '52e84e47e4b0f8de283b079b'
24157 * var status = new AVStatus('image url', 'a message');
24158 * AV.Status.sendPrivateStatus(status, '52e84e47e4b0f8de283b079b').then(function(){
24159 * //send status successfully.
24160 * }, function(err){
24161 * //an error threw.
24162 * console.dir(err);
24163 * });
24164 */
24165
24166
24167 AV.Status.sendPrivateStatus = function (status, target) {
24168 var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
24169
24170 if (!getSessionToken(options) && !AV.User.current()) {
24171 throw new Error('Please signin an user.');
24172 }
24173
24174 if (!target) {
24175 throw new Error('Invalid target user.');
24176 }
24177
24178 var userObjectId = _.isString(target) ? target : target.id;
24179
24180 if (!userObjectId) {
24181 throw new Error('Invalid target user.');
24182 }
24183
24184 return getUserPointer(options).then(function (currUser) {
24185 var query = {};
24186 query.className = '_User';
24187 query.where = {
24188 objectId: userObjectId
24189 };
24190 var data = {};
24191 data.query = query;
24192 status.data = status.data || {};
24193 status.data.source = status.data.source || currUser;
24194 data.data = status._getDataJSON();
24195 data.inboxType = 'private';
24196 status.inboxType = 'private';
24197 var request = AVRequest('statuses', null, null, 'POST', data, options);
24198 return request.then(function (response) {
24199 status.id = response.objectId;
24200 status.createdAt = AV._parseDate(response.createdAt);
24201 return status;
24202 });
24203 });
24204 };
24205 /**
24206 * Count unread statuses in someone's inbox.
24207 * @since 0.3.0
24208 * @param {AV.User} owner The status owner.
24209 * @param {String} inboxType The inbox type, 'default' by default.
24210 * @param {AuthOptions} options
24211 * @return {Promise} A promise that is fulfilled when the count
24212 * completes.
24213 * @example
24214 * AV.Status.countUnreadStatuses(AV.User.current()).then(function(response){
24215 * console.log(response.unread); //unread statuses number.
24216 * console.log(response.total); //total statuses number.
24217 * });
24218 */
24219
24220
24221 AV.Status.countUnreadStatuses = function (owner) {
24222 var inboxType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'default';
24223 var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
24224 if (!_.isString(inboxType)) options = inboxType;
24225
24226 if (!getSessionToken(options) && owner == null && !AV.User.current()) {
24227 throw new Error('Please signin an user or pass the owner objectId.');
24228 }
24229
24230 return _promise.default.resolve(owner || getUser(options)).then(function (owner) {
24231 var params = {};
24232 params.inboxType = AV._encode(inboxType);
24233 params.owner = AV._encode(owner);
24234 return AVRequest('subscribe/statuses/count', null, null, 'GET', params, options);
24235 });
24236 };
24237 /**
24238 * reset unread statuses count in someone's inbox.
24239 * @since 2.1.0
24240 * @param {AV.User} owner The status owner.
24241 * @param {String} inboxType The inbox type, 'default' by default.
24242 * @param {AuthOptions} options
24243 * @return {Promise} A promise that is fulfilled when the reset
24244 * completes.
24245 * @example
24246 * AV.Status.resetUnreadCount(AV.User.current()).then(function(response){
24247 * console.log(response.unread); //unread statuses number.
24248 * console.log(response.total); //total statuses number.
24249 * });
24250 */
24251
24252
24253 AV.Status.resetUnreadCount = function (owner) {
24254 var inboxType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'default';
24255 var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
24256 if (!_.isString(inboxType)) options = inboxType;
24257
24258 if (!getSessionToken(options) && owner == null && !AV.User.current()) {
24259 throw new Error('Please signin an user or pass the owner objectId.');
24260 }
24261
24262 return _promise.default.resolve(owner || getUser(options)).then(function (owner) {
24263 var params = {};
24264 params.inboxType = AV._encode(inboxType);
24265 params.owner = AV._encode(owner);
24266 return AVRequest('subscribe/statuses/resetUnreadCount', null, null, 'POST', params, options);
24267 });
24268 };
24269 /**
24270 * Create a status query to find someone's published statuses.
24271 * @since 0.3.0
24272 * @param {AV.User} source The status source, typically the publisher.
24273 * @return {AV.Query} The query object for status.
24274 * @example
24275 * //Find current user's published statuses.
24276 * var query = AV.Status.statusQuery(AV.User.current());
24277 * query.find().then(function(statuses){
24278 * //process statuses
24279 * });
24280 */
24281
24282
24283 AV.Status.statusQuery = function (source) {
24284 var query = new AV.Query('_Status');
24285
24286 if (source) {
24287 query.equalTo('source', source);
24288 }
24289
24290 return query;
24291 };
24292 /**
24293 * <p>AV.InboxQuery defines a query that is used to fetch somebody's inbox statuses.</p>
24294 * @class
24295 */
24296
24297
24298 AV.InboxQuery = AV.Query._extend(
24299 /** @lends AV.InboxQuery.prototype */
24300 {
24301 _objectClass: AV.Status,
24302 _sinceId: 0,
24303 _maxId: 0,
24304 _inboxType: 'default',
24305 _owner: null,
24306 _newObject: function _newObject() {
24307 return new AV.Status();
24308 },
24309 _createRequest: function _createRequest(params, options) {
24310 return AV.InboxQuery.__super__._createRequest.call(this, params, options, '/subscribe/statuses');
24311 },
24312
24313 /**
24314 * Sets the messageId of results to skip before returning any results.
24315 * This is useful for pagination.
24316 * Default is zero.
24317 * @param {Number} n the mesage id.
24318 * @return {AV.InboxQuery} Returns the query, so you can chain this call.
24319 */
24320 sinceId: function sinceId(id) {
24321 this._sinceId = id;
24322 return this;
24323 },
24324
24325 /**
24326 * Sets the maximal messageId of results。
24327 * This is useful for pagination.
24328 * Default is zero that is no limition.
24329 * @param {Number} n the mesage id.
24330 * @return {AV.InboxQuery} Returns the query, so you can chain this call.
24331 */
24332 maxId: function maxId(id) {
24333 this._maxId = id;
24334 return this;
24335 },
24336
24337 /**
24338 * Sets the owner of the querying inbox.
24339 * @param {AV.User} owner The inbox owner.
24340 * @return {AV.InboxQuery} Returns the query, so you can chain this call.
24341 */
24342 owner: function owner(_owner) {
24343 this._owner = _owner;
24344 return this;
24345 },
24346
24347 /**
24348 * Sets the querying inbox type.default is 'default'.
24349 * @param {String} type The inbox type.
24350 * @return {AV.InboxQuery} Returns the query, so you can chain this call.
24351 */
24352 inboxType: function inboxType(type) {
24353 this._inboxType = type;
24354 return this;
24355 },
24356 _getParams: function _getParams() {
24357 var params = AV.InboxQuery.__super__._getParams.call(this);
24358
24359 params.owner = AV._encode(this._owner);
24360 params.inboxType = AV._encode(this._inboxType);
24361 params.sinceId = AV._encode(this._sinceId);
24362 params.maxId = AV._encode(this._maxId);
24363 return params;
24364 }
24365 });
24366 /**
24367 * Create a inbox status query to find someone's inbox statuses.
24368 * @since 0.3.0
24369 * @param {AV.User} owner The inbox's owner
24370 * @param {String} inboxType The inbox type,'default' by default.
24371 * @return {AV.InboxQuery} The inbox query object.
24372 * @see AV.InboxQuery
24373 * @example
24374 * //Find current user's default inbox statuses.
24375 * var query = AV.Status.inboxQuery(AV.User.current());
24376 * //find the statuses after the last message id
24377 * query.sinceId(lastMessageId);
24378 * query.find().then(function(statuses){
24379 * //process statuses
24380 * });
24381 */
24382
24383 AV.Status.inboxQuery = function (owner, inboxType) {
24384 var query = new AV.InboxQuery(AV.Status);
24385
24386 if (owner) {
24387 query._owner = owner;
24388 }
24389
24390 if (inboxType) {
24391 query._inboxType = inboxType;
24392 }
24393
24394 return query;
24395 };
24396};
24397
24398/***/ }),
24399/* 567 */
24400/***/ (function(module, exports, __webpack_require__) {
24401
24402"use strict";
24403
24404
24405var _interopRequireDefault = __webpack_require__(1);
24406
24407var _stringify = _interopRequireDefault(__webpack_require__(38));
24408
24409var _map = _interopRequireDefault(__webpack_require__(37));
24410
24411var _ = __webpack_require__(3);
24412
24413var AVRequest = __webpack_require__(28)._request;
24414
24415module.exports = function (AV) {
24416 /**
24417 * A builder to generate sort string for app searching.For example:
24418 * @class
24419 * @since 0.5.1
24420 * @example
24421 * var builder = new AV.SearchSortBuilder();
24422 * builder.ascending('key1').descending('key2','max');
24423 * var query = new AV.SearchQuery('Player');
24424 * query.sortBy(builder);
24425 * query.find().then();
24426 */
24427 AV.SearchSortBuilder = function () {
24428 this._sortFields = [];
24429 };
24430
24431 _.extend(AV.SearchSortBuilder.prototype,
24432 /** @lends AV.SearchSortBuilder.prototype */
24433 {
24434 _addField: function _addField(key, order, mode, missing) {
24435 var field = {};
24436 field[key] = {
24437 order: order || 'asc',
24438 mode: mode || 'avg',
24439 missing: '_' + (missing || 'last')
24440 };
24441
24442 this._sortFields.push(field);
24443
24444 return this;
24445 },
24446
24447 /**
24448 * Sorts the results in ascending order by the given key and options.
24449 *
24450 * @param {String} key The key to order by.
24451 * @param {String} mode The sort mode, default is 'avg', you can choose
24452 * 'max' or 'min' too.
24453 * @param {String} missing The missing key behaviour, default is 'last',
24454 * you can choose 'first' too.
24455 * @return {AV.SearchSortBuilder} Returns the builder, so you can chain this call.
24456 */
24457 ascending: function ascending(key, mode, missing) {
24458 return this._addField(key, 'asc', mode, missing);
24459 },
24460
24461 /**
24462 * Sorts the results in descending order by the given key and options.
24463 *
24464 * @param {String} key The key to order by.
24465 * @param {String} mode The sort mode, default is 'avg', you can choose
24466 * 'max' or 'min' too.
24467 * @param {String} missing The missing key behaviour, default is 'last',
24468 * you can choose 'first' too.
24469 * @return {AV.SearchSortBuilder} Returns the builder, so you can chain this call.
24470 */
24471 descending: function descending(key, mode, missing) {
24472 return this._addField(key, 'desc', mode, missing);
24473 },
24474
24475 /**
24476 * Add a proximity based constraint for finding objects with key point
24477 * values near the point given.
24478 * @param {String} key The key that the AV.GeoPoint is stored in.
24479 * @param {AV.GeoPoint} point The reference AV.GeoPoint that is used.
24480 * @param {Object} options The other options such as mode,order, unit etc.
24481 * @return {AV.SearchSortBuilder} Returns the builder, so you can chain this call.
24482 */
24483 whereNear: function whereNear(key, point, options) {
24484 options = options || {};
24485 var field = {};
24486 var geo = {
24487 lat: point.latitude,
24488 lon: point.longitude
24489 };
24490 var m = {
24491 order: options.order || 'asc',
24492 mode: options.mode || 'avg',
24493 unit: options.unit || 'km'
24494 };
24495 m[key] = geo;
24496 field['_geo_distance'] = m;
24497
24498 this._sortFields.push(field);
24499
24500 return this;
24501 },
24502
24503 /**
24504 * Build a sort string by configuration.
24505 * @return {String} the sort string.
24506 */
24507 build: function build() {
24508 return (0, _stringify.default)(AV._encode(this._sortFields));
24509 }
24510 });
24511 /**
24512 * App searching query.Use just like AV.Query:
24513 *
24514 * Visit <a href='https://leancloud.cn/docs/app_search_guide.html'>App Searching Guide</a>
24515 * for more details.
24516 * @class
24517 * @since 0.5.1
24518 * @example
24519 * var query = new AV.SearchQuery('Player');
24520 * query.queryString('*');
24521 * query.find().then(function(results) {
24522 * console.log('Found %d objects', query.hits());
24523 * //Process results
24524 * });
24525 */
24526
24527
24528 AV.SearchQuery = AV.Query._extend(
24529 /** @lends AV.SearchQuery.prototype */
24530 {
24531 _sid: null,
24532 _hits: 0,
24533 _queryString: null,
24534 _highlights: null,
24535 _sortBuilder: null,
24536 _clazz: null,
24537 constructor: function constructor(className) {
24538 if (className) {
24539 this._clazz = className;
24540 } else {
24541 className = '__INVALID_CLASS';
24542 }
24543
24544 AV.Query.call(this, className);
24545 },
24546 _createRequest: function _createRequest(params, options) {
24547 return AVRequest('search/select', null, null, 'GET', params || this._getParams(), options);
24548 },
24549
24550 /**
24551 * Sets the sid of app searching query.Default is null.
24552 * @param {String} sid Scroll id for searching.
24553 * @return {AV.SearchQuery} Returns the query, so you can chain this call.
24554 */
24555 sid: function sid(_sid) {
24556 this._sid = _sid;
24557 return this;
24558 },
24559
24560 /**
24561 * Sets the query string of app searching.
24562 * @param {String} q The query string.
24563 * @return {AV.SearchQuery} Returns the query, so you can chain this call.
24564 */
24565 queryString: function queryString(q) {
24566 this._queryString = q;
24567 return this;
24568 },
24569
24570 /**
24571 * Sets the highlight fields. Such as
24572 * <pre><code>
24573 * query.highlights('title');
24574 * //or pass an array.
24575 * query.highlights(['title', 'content'])
24576 * </code></pre>
24577 * @param {String|String[]} highlights a list of fields.
24578 * @return {AV.SearchQuery} Returns the query, so you can chain this call.
24579 */
24580 highlights: function highlights(_highlights) {
24581 var objects;
24582
24583 if (_highlights && _.isString(_highlights)) {
24584 objects = _.toArray(arguments);
24585 } else {
24586 objects = _highlights;
24587 }
24588
24589 this._highlights = objects;
24590 return this;
24591 },
24592
24593 /**
24594 * Sets the sort builder for this query.
24595 * @see AV.SearchSortBuilder
24596 * @param { AV.SearchSortBuilder} builder The sort builder.
24597 * @return {AV.SearchQuery} Returns the query, so you can chain this call.
24598 *
24599 */
24600 sortBy: function sortBy(builder) {
24601 this._sortBuilder = builder;
24602 return this;
24603 },
24604
24605 /**
24606 * Returns the number of objects that match this query.
24607 * @return {Number}
24608 */
24609 hits: function hits() {
24610 if (!this._hits) {
24611 this._hits = 0;
24612 }
24613
24614 return this._hits;
24615 },
24616 _processResult: function _processResult(json) {
24617 delete json['className'];
24618 delete json['_app_url'];
24619 delete json['_deeplink'];
24620 return json;
24621 },
24622
24623 /**
24624 * Returns true when there are more documents can be retrieved by this
24625 * query instance, you can call find function to get more results.
24626 * @see AV.SearchQuery#find
24627 * @return {Boolean}
24628 */
24629 hasMore: function hasMore() {
24630 return !this._hitEnd;
24631 },
24632
24633 /**
24634 * Reset current query instance state(such as sid, hits etc) except params
24635 * for a new searching. After resetting, hasMore() will return true.
24636 */
24637 reset: function reset() {
24638 this._hitEnd = false;
24639 this._sid = null;
24640 this._hits = 0;
24641 },
24642
24643 /**
24644 * Retrieves a list of AVObjects that satisfy this query.
24645 * Either options.success or options.error is called when the find
24646 * completes.
24647 *
24648 * @see AV.Query#find
24649 * @param {AuthOptions} options
24650 * @return {Promise} A promise that is resolved with the results when
24651 * the query completes.
24652 */
24653 find: function find(options) {
24654 var self = this;
24655
24656 var request = this._createRequest(undefined, options);
24657
24658 return request.then(function (response) {
24659 //update sid for next querying.
24660 if (response.sid) {
24661 self._oldSid = self._sid;
24662 self._sid = response.sid;
24663 } else {
24664 self._sid = null;
24665 self._hitEnd = true;
24666 }
24667
24668 self._hits = response.hits || 0;
24669 return (0, _map.default)(_).call(_, response.results, function (json) {
24670 if (json.className) {
24671 response.className = json.className;
24672 }
24673
24674 var obj = self._newObject(response);
24675
24676 obj.appURL = json['_app_url'];
24677
24678 obj._finishFetch(self._processResult(json), true);
24679
24680 return obj;
24681 });
24682 });
24683 },
24684 _getParams: function _getParams() {
24685 var params = AV.SearchQuery.__super__._getParams.call(this);
24686
24687 delete params.where;
24688
24689 if (this._clazz) {
24690 params.clazz = this.className;
24691 }
24692
24693 if (this._sid) {
24694 params.sid = this._sid;
24695 }
24696
24697 if (!this._queryString) {
24698 throw new Error('Please set query string.');
24699 } else {
24700 params.q = this._queryString;
24701 }
24702
24703 if (this._highlights) {
24704 params.highlights = this._highlights.join(',');
24705 }
24706
24707 if (this._sortBuilder && params.order) {
24708 throw new Error('sort and order can not be set at same time.');
24709 }
24710
24711 if (this._sortBuilder) {
24712 params.sort = this._sortBuilder.build();
24713 }
24714
24715 return params;
24716 }
24717 });
24718};
24719/**
24720 * Sorts the results in ascending order by the given key.
24721 *
24722 * @method AV.SearchQuery#ascending
24723 * @param {String} key The key to order by.
24724 * @return {AV.SearchQuery} Returns the query, so you can chain this call.
24725 */
24726
24727/**
24728 * Also sorts the results in ascending order by the given key. The previous sort keys have
24729 * precedence over this key.
24730 *
24731 * @method AV.SearchQuery#addAscending
24732 * @param {String} key The key to order by
24733 * @return {AV.SearchQuery} Returns the query so you can chain this call.
24734 */
24735
24736/**
24737 * Sorts the results in descending order by the given key.
24738 *
24739 * @method AV.SearchQuery#descending
24740 * @param {String} key The key to order by.
24741 * @return {AV.SearchQuery} Returns the query, so you can chain this call.
24742 */
24743
24744/**
24745 * Also sorts the results in descending order by the given key. The previous sort keys have
24746 * precedence over this key.
24747 *
24748 * @method AV.SearchQuery#addDescending
24749 * @param {String} key The key to order by
24750 * @return {AV.SearchQuery} Returns the query so you can chain this call.
24751 */
24752
24753/**
24754 * Include nested AV.Objects for the provided key. You can use dot
24755 * notation to specify which fields in the included object are also fetch.
24756 * @method AV.SearchQuery#include
24757 * @param {String[]} keys The name of the key to include.
24758 * @return {AV.SearchQuery} Returns the query, so you can chain this call.
24759 */
24760
24761/**
24762 * Sets the number of results to skip before returning any results.
24763 * This is useful for pagination.
24764 * Default is to skip zero results.
24765 * @method AV.SearchQuery#skip
24766 * @param {Number} n the number of results to skip.
24767 * @return {AV.SearchQuery} Returns the query, so you can chain this call.
24768 */
24769
24770/**
24771 * Sets the limit of the number of results to return. The default limit is
24772 * 100, with a maximum of 1000 results being returned at a time.
24773 * @method AV.SearchQuery#limit
24774 * @param {Number} n the number of results to limit to.
24775 * @return {AV.SearchQuery} Returns the query, so you can chain this call.
24776 */
24777
24778/***/ }),
24779/* 568 */
24780/***/ (function(module, exports, __webpack_require__) {
24781
24782"use strict";
24783
24784
24785var _interopRequireDefault = __webpack_require__(1);
24786
24787var _promise = _interopRequireDefault(__webpack_require__(12));
24788
24789var _ = __webpack_require__(3);
24790
24791var AVError = __webpack_require__(48);
24792
24793var _require = __webpack_require__(28),
24794 request = _require.request;
24795
24796module.exports = function (AV) {
24797 /**
24798 * 包含了使用了 LeanCloud
24799 * <a href='/docs/leaninsight_guide.html'>离线数据分析功能</a>的函数。
24800 * <p><strong><em>
24801 * 仅在云引擎运行环境下有效。
24802 * </em></strong></p>
24803 * @namespace
24804 */
24805 AV.Insight = AV.Insight || {};
24806
24807 _.extend(AV.Insight,
24808 /** @lends AV.Insight */
24809 {
24810 /**
24811 * 开始一个 Insight 任务。结果里将返回 Job id,你可以拿得到的 id 使用
24812 * AV.Insight.JobQuery 查询任务状态和结果。
24813 * @param {Object} jobConfig 任务配置的 JSON 对象,例如:<code><pre>
24814 * { "sql" : "select count(*) as c,gender from _User group by gender",
24815 * "saveAs": {
24816 * "className" : "UserGender",
24817 * "limit": 1
24818 * }
24819 * }
24820 * </pre></code>
24821 * sql 指定任务执行的 SQL 语句, saveAs(可选) 指定将结果保存在哪张表里,limit 最大 1000。
24822 * @param {AuthOptions} [options]
24823 * @return {Promise} A promise that will be resolved with the result
24824 * of the function.
24825 */
24826 startJob: function startJob(jobConfig, options) {
24827 if (!jobConfig || !jobConfig.sql) {
24828 throw new Error('Please provide the sql to run the job.');
24829 }
24830
24831 var data = {
24832 jobConfig: jobConfig,
24833 appId: AV.applicationId
24834 };
24835 return request({
24836 path: '/bigquery/jobs',
24837 method: 'POST',
24838 data: AV._encode(data, null, true),
24839 authOptions: options,
24840 signKey: false
24841 }).then(function (resp) {
24842 return AV._decode(resp).id;
24843 });
24844 },
24845
24846 /**
24847 * 监听 Insight 任务事件(未来推出独立部署的离线分析服务后开放)
24848 * <p><strong><em>
24849 * 仅在云引擎运行环境下有效。
24850 * </em></strong></p>
24851 * @param {String} event 监听的事件,目前尚不支持。
24852 * @param {Function} 监听回调函数,接收 (err, id) 两个参数,err 表示错误信息,
24853 * id 表示任务 id。接下来你可以拿这个 id 使用AV.Insight.JobQuery 查询任务状态和结果。
24854 *
24855 */
24856 on: function on(event, cb) {}
24857 });
24858 /**
24859 * 创建一个对象,用于查询 Insight 任务状态和结果。
24860 * @class
24861 * @param {String} id 任务 id
24862 * @since 0.5.5
24863 */
24864
24865
24866 AV.Insight.JobQuery = function (id, className) {
24867 if (!id) {
24868 throw new Error('Please provide the job id.');
24869 }
24870
24871 this.id = id;
24872 this.className = className;
24873 this._skip = 0;
24874 this._limit = 100;
24875 };
24876
24877 _.extend(AV.Insight.JobQuery.prototype,
24878 /** @lends AV.Insight.JobQuery.prototype */
24879 {
24880 /**
24881 * Sets the number of results to skip before returning any results.
24882 * This is useful for pagination.
24883 * Default is to skip zero results.
24884 * @param {Number} n the number of results to skip.
24885 * @return {AV.Query} Returns the query, so you can chain this call.
24886 */
24887 skip: function skip(n) {
24888 this._skip = n;
24889 return this;
24890 },
24891
24892 /**
24893 * Sets the limit of the number of results to return. The default limit is
24894 * 100, with a maximum of 1000 results being returned at a time.
24895 * @param {Number} n the number of results to limit to.
24896 * @return {AV.Query} Returns the query, so you can chain this call.
24897 */
24898 limit: function limit(n) {
24899 this._limit = n;
24900 return this;
24901 },
24902
24903 /**
24904 * 查询任务状态和结果,任务结果为一个 JSON 对象,包括 status 表示任务状态, totalCount 表示总数,
24905 * results 数组表示任务结果数组,previewCount 表示可以返回的结果总数,任务的开始和截止时间
24906 * startTime、endTime 等信息。
24907 *
24908 * @param {AuthOptions} [options]
24909 * @return {Promise} A promise that will be resolved with the result
24910 * of the function.
24911 *
24912 */
24913 find: function find(options) {
24914 var params = {
24915 skip: this._skip,
24916 limit: this._limit
24917 };
24918 return request({
24919 path: "/bigquery/jobs/".concat(this.id),
24920 method: 'GET',
24921 query: params,
24922 authOptions: options,
24923 signKey: false
24924 }).then(function (response) {
24925 if (response.error) {
24926 return _promise.default.reject(new AVError(response.code, response.error));
24927 }
24928
24929 return _promise.default.resolve(response);
24930 });
24931 }
24932 });
24933};
24934
24935/***/ }),
24936/* 569 */
24937/***/ (function(module, exports, __webpack_require__) {
24938
24939"use strict";
24940
24941
24942var _interopRequireDefault = __webpack_require__(1);
24943
24944var _promise = _interopRequireDefault(__webpack_require__(12));
24945
24946var _ = __webpack_require__(3);
24947
24948var _require = __webpack_require__(28),
24949 LCRequest = _require.request;
24950
24951var _require2 = __webpack_require__(32),
24952 getSessionToken = _require2.getSessionToken;
24953
24954module.exports = function (AV) {
24955 var getUserWithSessionToken = function getUserWithSessionToken(authOptions) {
24956 if (authOptions.user) {
24957 if (!authOptions.user._sessionToken) {
24958 throw new Error('authOptions.user is not signed in.');
24959 }
24960
24961 return _promise.default.resolve(authOptions.user);
24962 }
24963
24964 if (authOptions.sessionToken) {
24965 return AV.User._fetchUserBySessionToken(authOptions.sessionToken);
24966 }
24967
24968 return AV.User.currentAsync();
24969 };
24970
24971 var getSessionTokenAsync = function getSessionTokenAsync(authOptions) {
24972 var sessionToken = getSessionToken(authOptions);
24973
24974 if (sessionToken) {
24975 return _promise.default.resolve(sessionToken);
24976 }
24977
24978 return AV.User.currentAsync().then(function (user) {
24979 if (user) {
24980 return user.getSessionToken();
24981 }
24982 });
24983 };
24984 /**
24985 * Contains functions to deal with Friendship in LeanCloud.
24986 * @class
24987 */
24988
24989
24990 AV.Friendship = {
24991 /**
24992 * Request friendship.
24993 * @since 4.8.0
24994 * @param {String | AV.User | Object} options if an AV.User or string is given, it will be used as the friend.
24995 * @param {AV.User | string} options.friend The friend (or friend's objectId) to follow.
24996 * @param {Object} [options.attributes] key-value attributes dictionary to be used as conditions of followeeQuery.
24997 * @param {AuthOptions} [authOptions]
24998 * @return {Promise<void>}
24999 */
25000 request: function request(options) {
25001 var authOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
25002 var friend;
25003 var attributes;
25004
25005 if (options.friend) {
25006 friend = options.friend;
25007 attributes = options.attributes;
25008 } else {
25009 friend = options;
25010 }
25011
25012 var friendObj = _.isString(friend) ? AV.Object.createWithoutData('_User', friend) : friend;
25013 return getUserWithSessionToken(authOptions).then(function (userObj) {
25014 if (!userObj) {
25015 throw new Error('Please signin an user.');
25016 }
25017
25018 return LCRequest({
25019 method: 'POST',
25020 path: '/users/friendshipRequests',
25021 data: {
25022 user: userObj._toPointer(),
25023 friend: friendObj._toPointer(),
25024 friendship: attributes
25025 },
25026 authOptions: authOptions
25027 });
25028 });
25029 },
25030
25031 /**
25032 * Accept a friendship request.
25033 * @since 4.8.0
25034 * @param {AV.Object | string | Object} options if an AV.Object or string is given, it will be used as the request in _FriendshipRequest.
25035 * @param {AV.Object} options.request The request (or it's objectId) to be accepted.
25036 * @param {Object} [options.attributes] key-value attributes dictionary to be used as conditions of {@link AV#followeeQuery}.
25037 * @param {AuthOptions} [authOptions]
25038 * @return {Promise<void>}
25039 */
25040 acceptRequest: function acceptRequest(options) {
25041 var authOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
25042 var request;
25043 var attributes;
25044
25045 if (options.request) {
25046 request = options.request;
25047 attributes = options.attributes;
25048 } else {
25049 request = options;
25050 }
25051
25052 var requestId = _.isString(request) ? request : request.id;
25053 return getSessionTokenAsync(authOptions).then(function (sessionToken) {
25054 if (!sessionToken) {
25055 throw new Error('Please signin an user.');
25056 }
25057
25058 return LCRequest({
25059 method: 'PUT',
25060 path: '/users/friendshipRequests/' + requestId + '/accept',
25061 data: {
25062 friendship: AV._encode(attributes)
25063 },
25064 authOptions: authOptions
25065 });
25066 });
25067 },
25068
25069 /**
25070 * Decline a friendship request.
25071 * @param {AV.Object | string} request The request (or it's objectId) to be declined.
25072 * @param {AuthOptions} [authOptions]
25073 * @return {Promise<void>}
25074 */
25075 declineRequest: function declineRequest(request) {
25076 var authOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
25077 var requestId = _.isString(request) ? request : request.id;
25078 return getSessionTokenAsync(authOptions).then(function (sessionToken) {
25079 if (!sessionToken) {
25080 throw new Error('Please signin an user.');
25081 }
25082
25083 return LCRequest({
25084 method: 'PUT',
25085 path: '/users/friendshipRequests/' + requestId + '/decline',
25086 authOptions: authOptions
25087 });
25088 });
25089 }
25090 };
25091};
25092
25093/***/ }),
25094/* 570 */
25095/***/ (function(module, exports, __webpack_require__) {
25096
25097"use strict";
25098
25099
25100var _interopRequireDefault = __webpack_require__(1);
25101
25102var _stringify = _interopRequireDefault(__webpack_require__(38));
25103
25104var _ = __webpack_require__(3);
25105
25106var _require = __webpack_require__(28),
25107 _request = _require._request;
25108
25109var AV = __webpack_require__(74);
25110
25111var serializeMessage = function serializeMessage(message) {
25112 if (typeof message === 'string') {
25113 return message;
25114 }
25115
25116 if (typeof message.getPayload === 'function') {
25117 return (0, _stringify.default)(message.getPayload());
25118 }
25119
25120 return (0, _stringify.default)(message);
25121};
25122/**
25123 * <p>An AV.Conversation is a local representation of a LeanCloud realtime's
25124 * conversation. This class is a subclass of AV.Object, and retains the
25125 * same functionality of an AV.Object, but also extends it with various
25126 * conversation specific methods, like get members, creators of this conversation.
25127 * </p>
25128 *
25129 * @class AV.Conversation
25130 * @param {String} name The name of the Role to create.
25131 * @param {Object} [options]
25132 * @param {Boolean} [options.isSystem] Set this conversation as system conversation.
25133 * @param {Boolean} [options.isTransient] Set this conversation as transient conversation.
25134 */
25135
25136
25137module.exports = AV.Object.extend('_Conversation',
25138/** @lends AV.Conversation.prototype */
25139{
25140 constructor: function constructor(name) {
25141 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
25142 AV.Object.prototype.constructor.call(this, null, null);
25143 this.set('name', name);
25144
25145 if (options.isSystem !== undefined) {
25146 this.set('sys', options.isSystem ? true : false);
25147 }
25148
25149 if (options.isTransient !== undefined) {
25150 this.set('tr', options.isTransient ? true : false);
25151 }
25152 },
25153
25154 /**
25155 * Get current conversation's creator.
25156 *
25157 * @return {String}
25158 */
25159 getCreator: function getCreator() {
25160 return this.get('c');
25161 },
25162
25163 /**
25164 * Get the last message's time.
25165 *
25166 * @return {Date}
25167 */
25168 getLastMessageAt: function getLastMessageAt() {
25169 return this.get('lm');
25170 },
25171
25172 /**
25173 * Get this conversation's members
25174 *
25175 * @return {String[]}
25176 */
25177 getMembers: function getMembers() {
25178 return this.get('m');
25179 },
25180
25181 /**
25182 * Add a member to this conversation
25183 *
25184 * @param {String} member
25185 */
25186 addMember: function addMember(member) {
25187 return this.add('m', member);
25188 },
25189
25190 /**
25191 * Get this conversation's members who set this conversation as muted.
25192 *
25193 * @return {String[]}
25194 */
25195 getMutedMembers: function getMutedMembers() {
25196 return this.get('mu');
25197 },
25198
25199 /**
25200 * Get this conversation's name field.
25201 *
25202 * @return String
25203 */
25204 getName: function getName() {
25205 return this.get('name');
25206 },
25207
25208 /**
25209 * Returns true if this conversation is transient conversation.
25210 *
25211 * @return {Boolean}
25212 */
25213 isTransient: function isTransient() {
25214 return this.get('tr');
25215 },
25216
25217 /**
25218 * Returns true if this conversation is system conversation.
25219 *
25220 * @return {Boolean}
25221 */
25222 isSystem: function isSystem() {
25223 return this.get('sys');
25224 },
25225
25226 /**
25227 * Send realtime message to this conversation, using HTTP request.
25228 *
25229 * @param {String} fromClient Sender's client id.
25230 * @param {String|Object} message The message which will send to conversation.
25231 * It could be a raw string, or an object with a `toJSON` method, like a
25232 * realtime SDK's Message object. See more: {@link https://leancloud.cn/docs/realtime_guide-js.html#消息}
25233 * @param {Object} [options]
25234 * @param {Boolean} [options.transient] Whether send this message as transient message or not.
25235 * @param {String[]} [options.toClients] Ids of clients to send to. This option can be used only in system conversation.
25236 * @param {Object} [options.pushData] Push data to this message. See more: {@link https://url.leanapp.cn/pushData 推送消息内容}
25237 * @param {AuthOptions} [authOptions]
25238 * @return {Promise}
25239 */
25240 send: function send(fromClient, message) {
25241 var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
25242 var authOptions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
25243 var data = {
25244 from_peer: fromClient,
25245 conv_id: this.id,
25246 transient: false,
25247 message: serializeMessage(message)
25248 };
25249
25250 if (options.toClients !== undefined) {
25251 data.to_peers = options.toClients;
25252 }
25253
25254 if (options.transient !== undefined) {
25255 data.transient = options.transient ? true : false;
25256 }
25257
25258 if (options.pushData !== undefined) {
25259 data.push_data = options.pushData;
25260 }
25261
25262 return _request('rtm', 'messages', null, 'POST', data, authOptions);
25263 },
25264
25265 /**
25266 * Send realtime broadcast message to all clients, via this conversation, using HTTP request.
25267 *
25268 * @param {String} fromClient Sender's client id.
25269 * @param {String|Object} message The message which will send to conversation.
25270 * It could be a raw string, or an object with a `toJSON` method, like a
25271 * realtime SDK's Message object. See more: {@link https://leancloud.cn/docs/realtime_guide-js.html#消息}.
25272 * @param {Object} [options]
25273 * @param {Object} [options.pushData] Push data to this message. See more: {@link https://url.leanapp.cn/pushData 推送消息内容}.
25274 * @param {Object} [options.validTill] The message will valid till this time.
25275 * @param {AuthOptions} [authOptions]
25276 * @return {Promise}
25277 */
25278 broadcast: function broadcast(fromClient, message) {
25279 var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
25280 var authOptions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
25281 var data = {
25282 from_peer: fromClient,
25283 conv_id: this.id,
25284 message: serializeMessage(message)
25285 };
25286
25287 if (options.pushData !== undefined) {
25288 data.push = options.pushData;
25289 }
25290
25291 if (options.validTill !== undefined) {
25292 var ts = options.validTill;
25293
25294 if (_.isDate(ts)) {
25295 ts = ts.getTime();
25296 }
25297
25298 options.valid_till = ts;
25299 }
25300
25301 return _request('rtm', 'broadcast', null, 'POST', data, authOptions);
25302 }
25303});
25304
25305/***/ }),
25306/* 571 */
25307/***/ (function(module, exports, __webpack_require__) {
25308
25309"use strict";
25310
25311
25312var _interopRequireDefault = __webpack_require__(1);
25313
25314var _promise = _interopRequireDefault(__webpack_require__(12));
25315
25316var _map = _interopRequireDefault(__webpack_require__(37));
25317
25318var _concat = _interopRequireDefault(__webpack_require__(19));
25319
25320var _ = __webpack_require__(3);
25321
25322var _require = __webpack_require__(28),
25323 request = _require.request;
25324
25325var _require2 = __webpack_require__(32),
25326 ensureArray = _require2.ensureArray,
25327 parseDate = _require2.parseDate;
25328
25329var AV = __webpack_require__(74);
25330/**
25331 * The version change interval for Leaderboard
25332 * @enum
25333 */
25334
25335
25336AV.LeaderboardVersionChangeInterval = {
25337 NEVER: 'never',
25338 DAY: 'day',
25339 WEEK: 'week',
25340 MONTH: 'month'
25341};
25342/**
25343 * The order of the leaderboard results
25344 * @enum
25345 */
25346
25347AV.LeaderboardOrder = {
25348 ASCENDING: 'ascending',
25349 DESCENDING: 'descending'
25350};
25351/**
25352 * The update strategy for Leaderboard
25353 * @enum
25354 */
25355
25356AV.LeaderboardUpdateStrategy = {
25357 /** Only keep the best statistic. If the leaderboard is in descending order, the best statistic is the highest one. */
25358 BETTER: 'better',
25359
25360 /** Keep the last updated statistic */
25361 LAST: 'last',
25362
25363 /** Keep the sum of all updated statistics */
25364 SUM: 'sum'
25365};
25366/**
25367 * @typedef {Object} Ranking
25368 * @property {number} rank Starts at 0
25369 * @property {number} value the statistic value of this ranking
25370 * @property {AV.User} user The user of this ranking
25371 * @property {Statistic[]} [includedStatistics] Other statistics of the user, specified by the `includeStatistic` option of `AV.Leaderboard.getResults()`
25372 */
25373
25374/**
25375 * @typedef {Object} LeaderboardArchive
25376 * @property {string} statisticName
25377 * @property {number} version version of the leaderboard
25378 * @property {string} status
25379 * @property {string} url URL for the downloadable archive
25380 * @property {Date} activatedAt time when this version became active
25381 * @property {Date} deactivatedAt time when this version was deactivated by a version incrementing
25382 */
25383
25384/**
25385 * @class
25386 */
25387
25388function Statistic(_ref) {
25389 var name = _ref.name,
25390 value = _ref.value,
25391 version = _ref.version;
25392
25393 /**
25394 * @type {string}
25395 */
25396 this.name = name;
25397 /**
25398 * @type {number}
25399 */
25400
25401 this.value = value;
25402 /**
25403 * @type {number?}
25404 */
25405
25406 this.version = version;
25407}
25408
25409var parseStatisticData = function parseStatisticData(statisticData) {
25410 var _AV$_decode = AV._decode(statisticData),
25411 name = _AV$_decode.statisticName,
25412 value = _AV$_decode.statisticValue,
25413 version = _AV$_decode.version;
25414
25415 return new Statistic({
25416 name: name,
25417 value: value,
25418 version: version
25419 });
25420};
25421/**
25422 * @class
25423 */
25424
25425
25426AV.Leaderboard = function Leaderboard(statisticName) {
25427 /**
25428 * @type {string}
25429 */
25430 this.statisticName = statisticName;
25431 /**
25432 * @type {AV.LeaderboardOrder}
25433 */
25434
25435 this.order = undefined;
25436 /**
25437 * @type {AV.LeaderboardUpdateStrategy}
25438 */
25439
25440 this.updateStrategy = undefined;
25441 /**
25442 * @type {AV.LeaderboardVersionChangeInterval}
25443 */
25444
25445 this.versionChangeInterval = undefined;
25446 /**
25447 * @type {number}
25448 */
25449
25450 this.version = undefined;
25451 /**
25452 * @type {Date?}
25453 */
25454
25455 this.nextResetAt = undefined;
25456 /**
25457 * @type {Date?}
25458 */
25459
25460 this.createdAt = undefined;
25461};
25462
25463var Leaderboard = AV.Leaderboard;
25464/**
25465 * Create an instance of Leaderboard for the give statistic name.
25466 * @param {string} statisticName
25467 * @return {AV.Leaderboard}
25468 */
25469
25470AV.Leaderboard.createWithoutData = function (statisticName) {
25471 return new Leaderboard(statisticName);
25472};
25473/**
25474 * (masterKey required) Create a new Leaderboard.
25475 * @param {Object} options
25476 * @param {string} options.statisticName
25477 * @param {AV.LeaderboardOrder} options.order
25478 * @param {AV.LeaderboardVersionChangeInterval} [options.versionChangeInterval] default to WEEK
25479 * @param {AV.LeaderboardUpdateStrategy} [options.updateStrategy] default to BETTER
25480 * @param {AuthOptions} [authOptions]
25481 * @return {Promise<AV.Leaderboard>}
25482 */
25483
25484
25485AV.Leaderboard.createLeaderboard = function (_ref2, authOptions) {
25486 var statisticName = _ref2.statisticName,
25487 order = _ref2.order,
25488 versionChangeInterval = _ref2.versionChangeInterval,
25489 updateStrategy = _ref2.updateStrategy;
25490 return request({
25491 method: 'POST',
25492 path: '/leaderboard/leaderboards',
25493 data: {
25494 statisticName: statisticName,
25495 order: order,
25496 versionChangeInterval: versionChangeInterval,
25497 updateStrategy: updateStrategy
25498 },
25499 authOptions: authOptions
25500 }).then(function (data) {
25501 var leaderboard = new Leaderboard(statisticName);
25502 return leaderboard._finishFetch(data);
25503 });
25504};
25505/**
25506 * Get the Leaderboard with the specified statistic name.
25507 * @param {string} statisticName
25508 * @param {AuthOptions} [authOptions]
25509 * @return {Promise<AV.Leaderboard>}
25510 */
25511
25512
25513AV.Leaderboard.getLeaderboard = function (statisticName, authOptions) {
25514 return Leaderboard.createWithoutData(statisticName).fetch(authOptions);
25515};
25516/**
25517 * Get Statistics for the specified user.
25518 * @param {AV.User} user The specified AV.User pointer.
25519 * @param {Object} [options]
25520 * @param {string[]} [options.statisticNames] Specify the statisticNames. If not set, all statistics of the user will be fetched.
25521 * @param {AuthOptions} [authOptions]
25522 * @return {Promise<Statistic[]>}
25523 */
25524
25525
25526AV.Leaderboard.getStatistics = function (user) {
25527 var _ref3 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
25528 statisticNames = _ref3.statisticNames;
25529
25530 var authOptions = arguments.length > 2 ? arguments[2] : undefined;
25531 return _promise.default.resolve().then(function () {
25532 if (!(user && user.id)) throw new Error('user must be an AV.User');
25533 return request({
25534 method: 'GET',
25535 path: "/leaderboard/users/".concat(user.id, "/statistics"),
25536 query: {
25537 statistics: statisticNames ? ensureArray(statisticNames).join(',') : undefined
25538 },
25539 authOptions: authOptions
25540 }).then(function (_ref4) {
25541 var results = _ref4.results;
25542 return (0, _map.default)(results).call(results, parseStatisticData);
25543 });
25544 });
25545};
25546/**
25547 * Update Statistics for the specified user.
25548 * @param {AV.User} user The specified AV.User pointer.
25549 * @param {Object} statistics A name-value pair representing the statistics to update.
25550 * @param {AuthOptions} [options] AuthOptions plus:
25551 * @param {boolean} [options.overwrite] Wethere to overwrite these statistics disregarding the updateStrategy of there leaderboards
25552 * @return {Promise<Statistic[]>}
25553 */
25554
25555
25556AV.Leaderboard.updateStatistics = function (user, statistics) {
25557 var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
25558 return _promise.default.resolve().then(function () {
25559 if (!(user && user.id)) throw new Error('user must be an AV.User');
25560 var data = (0, _map.default)(_).call(_, statistics, function (value, key) {
25561 return {
25562 statisticName: key,
25563 statisticValue: value
25564 };
25565 });
25566 var overwrite = options.overwrite;
25567 return request({
25568 method: 'POST',
25569 path: "/leaderboard/users/".concat(user.id, "/statistics"),
25570 query: {
25571 overwrite: overwrite ? 1 : undefined
25572 },
25573 data: data,
25574 authOptions: options
25575 }).then(function (_ref5) {
25576 var results = _ref5.results;
25577 return (0, _map.default)(results).call(results, parseStatisticData);
25578 });
25579 });
25580};
25581/**
25582 * Delete Statistics for the specified user.
25583 * @param {AV.User} user The specified AV.User pointer.
25584 * @param {Object} statistics A name-value pair representing the statistics to delete.
25585 * @param {AuthOptions} [options]
25586 * @return {Promise<void>}
25587 */
25588
25589
25590AV.Leaderboard.deleteStatistics = function (user, statisticNames, authOptions) {
25591 return _promise.default.resolve().then(function () {
25592 if (!(user && user.id)) throw new Error('user must be an AV.User');
25593 return request({
25594 method: 'DELETE',
25595 path: "/leaderboard/users/".concat(user.id, "/statistics"),
25596 query: {
25597 statistics: ensureArray(statisticNames).join(',')
25598 },
25599 authOptions: authOptions
25600 }).then(function () {
25601 return undefined;
25602 });
25603 });
25604};
25605
25606_.extend(Leaderboard.prototype,
25607/** @lends AV.Leaderboard.prototype */
25608{
25609 _finishFetch: function _finishFetch(data) {
25610 var _this = this;
25611
25612 _.forEach(data, function (value, key) {
25613 if (key === 'updatedAt' || key === 'objectId') return;
25614
25615 if (key === 'expiredAt') {
25616 key = 'nextResetAt';
25617 }
25618
25619 if (key === 'createdAt') {
25620 value = parseDate(value);
25621 }
25622
25623 if (value && value.__type === 'Date') {
25624 value = parseDate(value.iso);
25625 }
25626
25627 _this[key] = value;
25628 });
25629
25630 return this;
25631 },
25632
25633 /**
25634 * Fetch data from the srever.
25635 * @param {AuthOptions} [authOptions]
25636 * @return {Promise<AV.Leaderboard>}
25637 */
25638 fetch: function fetch(authOptions) {
25639 var _this2 = this;
25640
25641 return request({
25642 method: 'GET',
25643 path: "/leaderboard/leaderboards/".concat(this.statisticName),
25644 authOptions: authOptions
25645 }).then(function (data) {
25646 return _this2._finishFetch(data);
25647 });
25648 },
25649
25650 /**
25651 * Counts the number of users participated in this leaderboard
25652 * @param {Object} [options]
25653 * @param {number} [options.version] Specify the version of the leaderboard
25654 * @param {AuthOptions} [authOptions]
25655 * @return {Promise<number>}
25656 */
25657 count: function count() {
25658 var _ref6 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
25659 version = _ref6.version;
25660
25661 var authOptions = arguments.length > 1 ? arguments[1] : undefined;
25662 return request({
25663 method: 'GET',
25664 path: "/leaderboard/leaderboards/".concat(this.statisticName, "/ranks"),
25665 query: {
25666 count: 1,
25667 limit: 0,
25668 version: version
25669 },
25670 authOptions: authOptions
25671 }).then(function (_ref7) {
25672 var count = _ref7.count;
25673 return count;
25674 });
25675 },
25676 _getResults: function _getResults(_ref8, authOptions, userId) {
25677 var _context;
25678
25679 var skip = _ref8.skip,
25680 limit = _ref8.limit,
25681 selectUserKeys = _ref8.selectUserKeys,
25682 includeUserKeys = _ref8.includeUserKeys,
25683 includeStatistics = _ref8.includeStatistics,
25684 version = _ref8.version;
25685 return request({
25686 method: 'GET',
25687 path: (0, _concat.default)(_context = "/leaderboard/leaderboards/".concat(this.statisticName, "/ranks")).call(_context, userId ? "/".concat(userId) : ''),
25688 query: {
25689 skip: skip,
25690 limit: limit,
25691 selectUserKeys: _.union(ensureArray(selectUserKeys), ensureArray(includeUserKeys)).join(',') || undefined,
25692 includeUser: includeUserKeys ? ensureArray(includeUserKeys).join(',') : undefined,
25693 includeStatistics: includeStatistics ? ensureArray(includeStatistics).join(',') : undefined,
25694 version: version
25695 },
25696 authOptions: authOptions
25697 }).then(function (_ref9) {
25698 var rankings = _ref9.results;
25699 return (0, _map.default)(rankings).call(rankings, function (rankingData) {
25700 var _AV$_decode2 = AV._decode(rankingData),
25701 user = _AV$_decode2.user,
25702 value = _AV$_decode2.statisticValue,
25703 rank = _AV$_decode2.rank,
25704 _AV$_decode2$statisti = _AV$_decode2.statistics,
25705 statistics = _AV$_decode2$statisti === void 0 ? [] : _AV$_decode2$statisti;
25706
25707 return {
25708 user: user,
25709 value: value,
25710 rank: rank,
25711 includedStatistics: (0, _map.default)(statistics).call(statistics, parseStatisticData)
25712 };
25713 });
25714 });
25715 },
25716
25717 /**
25718 * Retrieve a list of ranked users for this Leaderboard.
25719 * @param {Object} [options]
25720 * @param {number} [options.skip] The number of results to skip. This is useful for pagination.
25721 * @param {number} [options.limit] The limit of the number of results.
25722 * @param {string[]} [options.selectUserKeys] Specify keys of the users to include in the Rankings
25723 * @param {string[]} [options.includeUserKeys] If the value of a selected user keys is a Pointer, use this options to include its value.
25724 * @param {string[]} [options.includeStatistics] Specify other statistics to include in the Rankings
25725 * @param {number} [options.version] Specify the version of the leaderboard
25726 * @param {AuthOptions} [authOptions]
25727 * @return {Promise<Ranking[]>}
25728 */
25729 getResults: function getResults() {
25730 var _ref10 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
25731 skip = _ref10.skip,
25732 limit = _ref10.limit,
25733 selectUserKeys = _ref10.selectUserKeys,
25734 includeUserKeys = _ref10.includeUserKeys,
25735 includeStatistics = _ref10.includeStatistics,
25736 version = _ref10.version;
25737
25738 var authOptions = arguments.length > 1 ? arguments[1] : undefined;
25739 return this._getResults({
25740 skip: skip,
25741 limit: limit,
25742 selectUserKeys: selectUserKeys,
25743 includeUserKeys: includeUserKeys,
25744 includeStatistics: includeStatistics,
25745 version: version
25746 }, authOptions);
25747 },
25748
25749 /**
25750 * Retrieve a list of ranked users for this Leaderboard, centered on the specified user.
25751 * @param {AV.User} user The specified AV.User pointer.
25752 * @param {Object} [options]
25753 * @param {number} [options.limit] The limit of the number of results.
25754 * @param {string[]} [options.selectUserKeys] Specify keys of the users to include in the Rankings
25755 * @param {string[]} [options.includeUserKeys] If the value of a selected user keys is a Pointer, use this options to include its value.
25756 * @param {string[]} [options.includeStatistics] Specify other statistics to include in the Rankings
25757 * @param {number} [options.version] Specify the version of the leaderboard
25758 * @param {AuthOptions} [authOptions]
25759 * @return {Promise<Ranking[]>}
25760 */
25761 getResultsAroundUser: function getResultsAroundUser(user) {
25762 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
25763 var authOptions = arguments.length > 2 ? arguments[2] : undefined;
25764
25765 // getResultsAroundUser(options, authOptions)
25766 if (user && typeof user.id !== 'string') {
25767 return this.getResultsAroundUser(undefined, user, options);
25768 }
25769
25770 var limit = options.limit,
25771 selectUserKeys = options.selectUserKeys,
25772 includeUserKeys = options.includeUserKeys,
25773 includeStatistics = options.includeStatistics,
25774 version = options.version;
25775 return this._getResults({
25776 limit: limit,
25777 selectUserKeys: selectUserKeys,
25778 includeUserKeys: includeUserKeys,
25779 includeStatistics: includeStatistics,
25780 version: version
25781 }, authOptions, user ? user.id : 'self');
25782 },
25783 _update: function _update(data, authOptions) {
25784 var _this3 = this;
25785
25786 return request({
25787 method: 'PUT',
25788 path: "/leaderboard/leaderboards/".concat(this.statisticName),
25789 data: data,
25790 authOptions: authOptions
25791 }).then(function (result) {
25792 return _this3._finishFetch(result);
25793 });
25794 },
25795
25796 /**
25797 * (masterKey required) Update the version change interval of the Leaderboard.
25798 * @param {AV.LeaderboardVersionChangeInterval} versionChangeInterval
25799 * @param {AuthOptions} [authOptions]
25800 * @return {Promise<AV.Leaderboard>}
25801 */
25802 updateVersionChangeInterval: function updateVersionChangeInterval(versionChangeInterval, authOptions) {
25803 return this._update({
25804 versionChangeInterval: versionChangeInterval
25805 }, authOptions);
25806 },
25807
25808 /**
25809 * (masterKey required) Update the version change interval of the Leaderboard.
25810 * @param {AV.LeaderboardUpdateStrategy} updateStrategy
25811 * @param {AuthOptions} [authOptions]
25812 * @return {Promise<AV.Leaderboard>}
25813 */
25814 updateUpdateStrategy: function updateUpdateStrategy(updateStrategy, authOptions) {
25815 return this._update({
25816 updateStrategy: updateStrategy
25817 }, authOptions);
25818 },
25819
25820 /**
25821 * (masterKey required) Reset the Leaderboard. The version of the Leaderboard will be incremented by 1.
25822 * @param {AuthOptions} [authOptions]
25823 * @return {Promise<AV.Leaderboard>}
25824 */
25825 reset: function reset(authOptions) {
25826 var _this4 = this;
25827
25828 return request({
25829 method: 'PUT',
25830 path: "/leaderboard/leaderboards/".concat(this.statisticName, "/incrementVersion"),
25831 authOptions: authOptions
25832 }).then(function (data) {
25833 return _this4._finishFetch(data);
25834 });
25835 },
25836
25837 /**
25838 * (masterKey required) Delete the Leaderboard and its all archived versions.
25839 * @param {AuthOptions} [authOptions]
25840 * @return {void}
25841 */
25842 destroy: function destroy(authOptions) {
25843 return AV.request({
25844 method: 'DELETE',
25845 path: "/leaderboard/leaderboards/".concat(this.statisticName),
25846 authOptions: authOptions
25847 }).then(function () {
25848 return undefined;
25849 });
25850 },
25851
25852 /**
25853 * (masterKey required) Get archived versions.
25854 * @param {Object} [options]
25855 * @param {number} [options.skip] The number of results to skip. This is useful for pagination.
25856 * @param {number} [options.limit] The limit of the number of results.
25857 * @param {AuthOptions} [authOptions]
25858 * @return {Promise<LeaderboardArchive[]>}
25859 */
25860 getArchives: function getArchives() {
25861 var _this5 = this;
25862
25863 var _ref11 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
25864 skip = _ref11.skip,
25865 limit = _ref11.limit;
25866
25867 var authOptions = arguments.length > 1 ? arguments[1] : undefined;
25868 return request({
25869 method: 'GET',
25870 path: "/leaderboard/leaderboards/".concat(this.statisticName, "/archives"),
25871 query: {
25872 skip: skip,
25873 limit: limit
25874 },
25875 authOptions: authOptions
25876 }).then(function (_ref12) {
25877 var results = _ref12.results;
25878 return (0, _map.default)(results).call(results, function (_ref13) {
25879 var version = _ref13.version,
25880 status = _ref13.status,
25881 url = _ref13.url,
25882 activatedAt = _ref13.activatedAt,
25883 deactivatedAt = _ref13.deactivatedAt;
25884 return {
25885 statisticName: _this5.statisticName,
25886 version: version,
25887 status: status,
25888 url: url,
25889 activatedAt: parseDate(activatedAt.iso),
25890 deactivatedAt: parseDate(deactivatedAt.iso)
25891 };
25892 });
25893 });
25894 }
25895});
25896
25897/***/ }),
25898/* 572 */
25899/***/ (function(module, exports, __webpack_require__) {
25900
25901"use strict";
25902
25903
25904var _Object$defineProperty = __webpack_require__(94);
25905
25906_Object$defineProperty(exports, "__esModule", {
25907 value: true
25908});
25909
25910exports.platformInfo = exports.WebSocket = void 0;
25911
25912_Object$defineProperty(exports, "request", {
25913 enumerable: true,
25914 get: function get() {
25915 return _adaptersSuperagent.request;
25916 }
25917});
25918
25919exports.storage = void 0;
25920
25921_Object$defineProperty(exports, "upload", {
25922 enumerable: true,
25923 get: function get() {
25924 return _adaptersSuperagent.upload;
25925 }
25926});
25927
25928var _adaptersSuperagent = __webpack_require__(573);
25929
25930var storage = window.localStorage;
25931exports.storage = storage;
25932var WebSocket = window.WebSocket;
25933exports.WebSocket = WebSocket;
25934var platformInfo = {
25935 name: "Browser"
25936};
25937exports.platformInfo = platformInfo;
25938
25939/***/ }),
25940/* 573 */
25941/***/ (function(module, exports, __webpack_require__) {
25942
25943"use strict";
25944
25945var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
25946 function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
25947 return new (P || (P = Promise))(function (resolve, reject) {
25948 function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
25949 function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
25950 function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
25951 step((generator = generator.apply(thisArg, _arguments || [])).next());
25952 });
25953};
25954var __generator = (this && this.__generator) || function (thisArg, body) {
25955 var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
25956 return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
25957 function verb(n) { return function (v) { return step([n, v]); }; }
25958 function step(op) {
25959 if (f) throw new TypeError("Generator is already executing.");
25960 while (_) try {
25961 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;
25962 if (y = 0, t) op = [op[0] & 2, t.value];
25963 switch (op[0]) {
25964 case 0: case 1: t = op; break;
25965 case 4: _.label++; return { value: op[1], done: false };
25966 case 5: _.label++; y = op[1]; op = [0]; continue;
25967 case 7: op = _.ops.pop(); _.trys.pop(); continue;
25968 default:
25969 if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
25970 if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
25971 if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
25972 if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
25973 if (t[2]) _.ops.pop();
25974 _.trys.pop(); continue;
25975 }
25976 op = body.call(thisArg, _);
25977 } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
25978 if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
25979 }
25980};
25981Object.defineProperty(exports, "__esModule", { value: true });
25982exports.upload = exports.request = void 0;
25983var adapter_utils_1 = __webpack_require__(574);
25984var superagent = __webpack_require__(575);
25985function convertResponse(res) {
25986 return {
25987 ok: res.ok,
25988 status: res.status,
25989 headers: res.header,
25990 data: res.body,
25991 };
25992}
25993var request = function (url, options) {
25994 if (options === void 0) { options = {}; }
25995 return __awaiter(void 0, void 0, void 0, function () {
25996 var _a, method, data, headers, onprogress, signal, req, aborted, onAbort, res, error_1;
25997 return __generator(this, function (_b) {
25998 switch (_b.label) {
25999 case 0:
26000 _a = options.method, method = _a === void 0 ? "GET" : _a, data = options.data, headers = options.headers, onprogress = options.onprogress, signal = options.signal;
26001 if (signal === null || signal === void 0 ? void 0 : signal.aborted) {
26002 throw new adapter_utils_1.AbortError("Request aborted");
26003 }
26004 req = superagent(method, url).ok(function () { return true; });
26005 if (headers) {
26006 req.set(headers);
26007 }
26008 if (onprogress) {
26009 req.on("progress", onprogress);
26010 }
26011 aborted = false;
26012 onAbort = function () {
26013 aborted = true;
26014 req.abort();
26015 };
26016 signal === null || signal === void 0 ? void 0 : signal.addEventListener("abort", onAbort);
26017 _b.label = 1;
26018 case 1:
26019 _b.trys.push([1, 3, 4, 5]);
26020 return [4 /*yield*/, req.send(data)];
26021 case 2:
26022 res = _b.sent();
26023 return [2 /*return*/, convertResponse(res)];
26024 case 3:
26025 error_1 = _b.sent();
26026 if (aborted) {
26027 throw new adapter_utils_1.AbortError("Request aborted");
26028 }
26029 throw error_1;
26030 case 4:
26031 signal === null || signal === void 0 ? void 0 : signal.removeEventListener("abort", onAbort);
26032 return [7 /*endfinally*/];
26033 case 5: return [2 /*return*/];
26034 }
26035 });
26036 });
26037};
26038exports.request = request;
26039var upload = function (url, file, options) {
26040 if (options === void 0) { options = {}; }
26041 return __awaiter(void 0, void 0, void 0, function () {
26042 var _a, method, data, headers, onprogress, signal, req, aborted, onAbort, res, error_2;
26043 return __generator(this, function (_b) {
26044 switch (_b.label) {
26045 case 0:
26046 _a = options.method, method = _a === void 0 ? "POST" : _a, data = options.data, headers = options.headers, onprogress = options.onprogress, signal = options.signal;
26047 if (signal === null || signal === void 0 ? void 0 : signal.aborted) {
26048 throw new adapter_utils_1.AbortError("Request aborted");
26049 }
26050 req = superagent(method, url)
26051 .ok(function () { return true; })
26052 .attach(file.field, file.data, file.name);
26053 if (data) {
26054 req.field(data);
26055 }
26056 if (headers) {
26057 req.set(headers);
26058 }
26059 if (onprogress) {
26060 req.on("progress", onprogress);
26061 }
26062 aborted = false;
26063 onAbort = function () {
26064 aborted = true;
26065 req.abort();
26066 };
26067 signal === null || signal === void 0 ? void 0 : signal.addEventListener("abort", onAbort);
26068 _b.label = 1;
26069 case 1:
26070 _b.trys.push([1, 3, 4, 5]);
26071 return [4 /*yield*/, req];
26072 case 2:
26073 res = _b.sent();
26074 return [2 /*return*/, convertResponse(res)];
26075 case 3:
26076 error_2 = _b.sent();
26077 if (aborted) {
26078 throw new adapter_utils_1.AbortError("Request aborted");
26079 }
26080 throw error_2;
26081 case 4:
26082 signal === null || signal === void 0 ? void 0 : signal.removeEventListener("abort", onAbort);
26083 return [7 /*endfinally*/];
26084 case 5: return [2 /*return*/];
26085 }
26086 });
26087 });
26088};
26089exports.upload = upload;
26090//# sourceMappingURL=index.js.map
26091
26092/***/ }),
26093/* 574 */
26094/***/ (function(module, __webpack_exports__, __webpack_require__) {
26095
26096"use strict";
26097Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
26098/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AbortError", function() { return AbortError; });
26099/*! *****************************************************************************
26100Copyright (c) Microsoft Corporation.
26101
26102Permission to use, copy, modify, and/or distribute this software for any
26103purpose with or without fee is hereby granted.
26104
26105THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
26106REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
26107AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
26108INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
26109LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
26110OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
26111PERFORMANCE OF THIS SOFTWARE.
26112***************************************************************************** */
26113/* global Reflect, Promise */
26114
26115var extendStatics = function(d, b) {
26116 extendStatics = Object.setPrototypeOf ||
26117 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
26118 function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
26119 return extendStatics(d, b);
26120};
26121
26122function __extends(d, b) {
26123 extendStatics(d, b);
26124 function __() { this.constructor = d; }
26125 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
26126}
26127
26128var AbortError = /** @class */ (function (_super) {
26129 __extends(AbortError, _super);
26130 function AbortError() {
26131 var _this = _super !== null && _super.apply(this, arguments) || this;
26132 _this.name = "AbortError";
26133 return _this;
26134 }
26135 return AbortError;
26136}(Error));
26137
26138
26139//# sourceMappingURL=index.es.js.map
26140
26141
26142/***/ }),
26143/* 575 */
26144/***/ (function(module, exports, __webpack_require__) {
26145
26146"use strict";
26147
26148
26149var _interopRequireDefault = __webpack_require__(1);
26150
26151var _symbol = _interopRequireDefault(__webpack_require__(77));
26152
26153var _iterator = _interopRequireDefault(__webpack_require__(154));
26154
26155var _trim = _interopRequireDefault(__webpack_require__(576));
26156
26157var _concat = _interopRequireDefault(__webpack_require__(19));
26158
26159var _indexOf = _interopRequireDefault(__webpack_require__(61));
26160
26161var _slice = _interopRequireDefault(__webpack_require__(34));
26162
26163function _typeof(obj) {
26164 "@babel/helpers - typeof";
26165
26166 if (typeof _symbol.default === "function" && typeof _iterator.default === "symbol") {
26167 _typeof = function _typeof(obj) {
26168 return typeof obj;
26169 };
26170 } else {
26171 _typeof = function _typeof(obj) {
26172 return obj && typeof _symbol.default === "function" && obj.constructor === _symbol.default && obj !== _symbol.default.prototype ? "symbol" : typeof obj;
26173 };
26174 }
26175
26176 return _typeof(obj);
26177}
26178/**
26179 * Root reference for iframes.
26180 */
26181
26182
26183var root;
26184
26185if (typeof window !== 'undefined') {
26186 // Browser window
26187 root = window;
26188} else if (typeof self === 'undefined') {
26189 // Other environments
26190 console.warn('Using browser-only version of superagent in non-browser environment');
26191 root = void 0;
26192} else {
26193 // Web Worker
26194 root = self;
26195}
26196
26197var Emitter = __webpack_require__(583);
26198
26199var safeStringify = __webpack_require__(584);
26200
26201var RequestBase = __webpack_require__(585);
26202
26203var isObject = __webpack_require__(260);
26204
26205var ResponseBase = __webpack_require__(606);
26206
26207var Agent = __webpack_require__(613);
26208/**
26209 * Noop.
26210 */
26211
26212
26213function noop() {}
26214/**
26215 * Expose `request`.
26216 */
26217
26218
26219module.exports = function (method, url) {
26220 // callback
26221 if (typeof url === 'function') {
26222 return new exports.Request('GET', method).end(url);
26223 } // url first
26224
26225
26226 if (arguments.length === 1) {
26227 return new exports.Request('GET', method);
26228 }
26229
26230 return new exports.Request(method, url);
26231};
26232
26233exports = module.exports;
26234var request = exports;
26235exports.Request = Request;
26236/**
26237 * Determine XHR.
26238 */
26239
26240request.getXHR = function () {
26241 if (root.XMLHttpRequest && (!root.location || root.location.protocol !== 'file:' || !root.ActiveXObject)) {
26242 return new XMLHttpRequest();
26243 }
26244
26245 try {
26246 return new ActiveXObject('Microsoft.XMLHTTP');
26247 } catch (_unused) {}
26248
26249 try {
26250 return new ActiveXObject('Msxml2.XMLHTTP.6.0');
26251 } catch (_unused2) {}
26252
26253 try {
26254 return new ActiveXObject('Msxml2.XMLHTTP.3.0');
26255 } catch (_unused3) {}
26256
26257 try {
26258 return new ActiveXObject('Msxml2.XMLHTTP');
26259 } catch (_unused4) {}
26260
26261 throw new Error('Browser-only version of superagent could not find XHR');
26262};
26263/**
26264 * Removes leading and trailing whitespace, added to support IE.
26265 *
26266 * @param {String} s
26267 * @return {String}
26268 * @api private
26269 */
26270
26271
26272var trim = (0, _trim.default)('') ? function (s) {
26273 return (0, _trim.default)(s).call(s);
26274} : function (s) {
26275 return s.replace(/(^\s*|\s*$)/g, '');
26276};
26277/**
26278 * Serialize the given `obj`.
26279 *
26280 * @param {Object} obj
26281 * @return {String}
26282 * @api private
26283 */
26284
26285function serialize(obj) {
26286 if (!isObject(obj)) return obj;
26287 var pairs = [];
26288
26289 for (var key in obj) {
26290 if (Object.prototype.hasOwnProperty.call(obj, key)) pushEncodedKeyValuePair(pairs, key, obj[key]);
26291 }
26292
26293 return pairs.join('&');
26294}
26295/**
26296 * Helps 'serialize' with serializing arrays.
26297 * Mutates the pairs array.
26298 *
26299 * @param {Array} pairs
26300 * @param {String} key
26301 * @param {Mixed} val
26302 */
26303
26304
26305function pushEncodedKeyValuePair(pairs, key, val) {
26306 if (val === undefined) return;
26307
26308 if (val === null) {
26309 pairs.push(encodeURI(key));
26310 return;
26311 }
26312
26313 if (Array.isArray(val)) {
26314 val.forEach(function (v) {
26315 pushEncodedKeyValuePair(pairs, key, v);
26316 });
26317 } else if (isObject(val)) {
26318 for (var subkey in val) {
26319 var _context;
26320
26321 if (Object.prototype.hasOwnProperty.call(val, subkey)) pushEncodedKeyValuePair(pairs, (0, _concat.default)(_context = "".concat(key, "[")).call(_context, subkey, "]"), val[subkey]);
26322 }
26323 } else {
26324 pairs.push(encodeURI(key) + '=' + encodeURIComponent(val));
26325 }
26326}
26327/**
26328 * Expose serialization method.
26329 */
26330
26331
26332request.serializeObject = serialize;
26333/**
26334 * Parse the given x-www-form-urlencoded `str`.
26335 *
26336 * @param {String} str
26337 * @return {Object}
26338 * @api private
26339 */
26340
26341function parseString(str) {
26342 var obj = {};
26343 var pairs = str.split('&');
26344 var pair;
26345 var pos;
26346
26347 for (var i = 0, len = pairs.length; i < len; ++i) {
26348 pair = pairs[i];
26349 pos = (0, _indexOf.default)(pair).call(pair, '=');
26350
26351 if (pos === -1) {
26352 obj[decodeURIComponent(pair)] = '';
26353 } else {
26354 obj[decodeURIComponent((0, _slice.default)(pair).call(pair, 0, pos))] = decodeURIComponent((0, _slice.default)(pair).call(pair, pos + 1));
26355 }
26356 }
26357
26358 return obj;
26359}
26360/**
26361 * Expose parser.
26362 */
26363
26364
26365request.parseString = parseString;
26366/**
26367 * Default MIME type map.
26368 *
26369 * superagent.types.xml = 'application/xml';
26370 *
26371 */
26372
26373request.types = {
26374 html: 'text/html',
26375 json: 'application/json',
26376 xml: 'text/xml',
26377 urlencoded: 'application/x-www-form-urlencoded',
26378 form: 'application/x-www-form-urlencoded',
26379 'form-data': 'application/x-www-form-urlencoded'
26380};
26381/**
26382 * Default serialization map.
26383 *
26384 * superagent.serialize['application/xml'] = function(obj){
26385 * return 'generated xml here';
26386 * };
26387 *
26388 */
26389
26390request.serialize = {
26391 'application/x-www-form-urlencoded': serialize,
26392 'application/json': safeStringify
26393};
26394/**
26395 * Default parsers.
26396 *
26397 * superagent.parse['application/xml'] = function(str){
26398 * return { object parsed from str };
26399 * };
26400 *
26401 */
26402
26403request.parse = {
26404 'application/x-www-form-urlencoded': parseString,
26405 'application/json': JSON.parse
26406};
26407/**
26408 * Parse the given header `str` into
26409 * an object containing the mapped fields.
26410 *
26411 * @param {String} str
26412 * @return {Object}
26413 * @api private
26414 */
26415
26416function parseHeader(str) {
26417 var lines = str.split(/\r?\n/);
26418 var fields = {};
26419 var index;
26420 var line;
26421 var field;
26422 var val;
26423
26424 for (var i = 0, len = lines.length; i < len; ++i) {
26425 line = lines[i];
26426 index = (0, _indexOf.default)(line).call(line, ':');
26427
26428 if (index === -1) {
26429 // could be empty line, just skip it
26430 continue;
26431 }
26432
26433 field = (0, _slice.default)(line).call(line, 0, index).toLowerCase();
26434 val = trim((0, _slice.default)(line).call(line, index + 1));
26435 fields[field] = val;
26436 }
26437
26438 return fields;
26439}
26440/**
26441 * Check if `mime` is json or has +json structured syntax suffix.
26442 *
26443 * @param {String} mime
26444 * @return {Boolean}
26445 * @api private
26446 */
26447
26448
26449function isJSON(mime) {
26450 // should match /json or +json
26451 // but not /json-seq
26452 return /[/+]json($|[^-\w])/.test(mime);
26453}
26454/**
26455 * Initialize a new `Response` with the given `xhr`.
26456 *
26457 * - set flags (.ok, .error, etc)
26458 * - parse header
26459 *
26460 * Examples:
26461 *
26462 * Aliasing `superagent` as `request` is nice:
26463 *
26464 * request = superagent;
26465 *
26466 * We can use the promise-like API, or pass callbacks:
26467 *
26468 * request.get('/').end(function(res){});
26469 * request.get('/', function(res){});
26470 *
26471 * Sending data can be chained:
26472 *
26473 * request
26474 * .post('/user')
26475 * .send({ name: 'tj' })
26476 * .end(function(res){});
26477 *
26478 * Or passed to `.send()`:
26479 *
26480 * request
26481 * .post('/user')
26482 * .send({ name: 'tj' }, function(res){});
26483 *
26484 * Or passed to `.post()`:
26485 *
26486 * request
26487 * .post('/user', { name: 'tj' })
26488 * .end(function(res){});
26489 *
26490 * Or further reduced to a single call for simple cases:
26491 *
26492 * request
26493 * .post('/user', { name: 'tj' }, function(res){});
26494 *
26495 * @param {XMLHTTPRequest} xhr
26496 * @param {Object} options
26497 * @api private
26498 */
26499
26500
26501function Response(req) {
26502 this.req = req;
26503 this.xhr = this.req.xhr; // responseText is accessible only if responseType is '' or 'text' and on older browsers
26504
26505 this.text = this.req.method !== 'HEAD' && (this.xhr.responseType === '' || this.xhr.responseType === 'text') || typeof this.xhr.responseType === 'undefined' ? this.xhr.responseText : null;
26506 this.statusText = this.req.xhr.statusText;
26507 var status = this.xhr.status; // handle IE9 bug: http://stackoverflow.com/questions/10046972/msie-returns-status-code-of-1223-for-ajax-request
26508
26509 if (status === 1223) {
26510 status = 204;
26511 }
26512
26513 this._setStatusProperties(status);
26514
26515 this.headers = parseHeader(this.xhr.getAllResponseHeaders());
26516 this.header = this.headers; // getAllResponseHeaders sometimes falsely returns "" for CORS requests, but
26517 // getResponseHeader still works. so we get content-type even if getting
26518 // other headers fails.
26519
26520 this.header['content-type'] = this.xhr.getResponseHeader('content-type');
26521
26522 this._setHeaderProperties(this.header);
26523
26524 if (this.text === null && req._responseType) {
26525 this.body = this.xhr.response;
26526 } else {
26527 this.body = this.req.method === 'HEAD' ? null : this._parseBody(this.text ? this.text : this.xhr.response);
26528 }
26529} // eslint-disable-next-line new-cap
26530
26531
26532ResponseBase(Response.prototype);
26533/**
26534 * Parse the given body `str`.
26535 *
26536 * Used for auto-parsing of bodies. Parsers
26537 * are defined on the `superagent.parse` object.
26538 *
26539 * @param {String} str
26540 * @return {Mixed}
26541 * @api private
26542 */
26543
26544Response.prototype._parseBody = function (str) {
26545 var parse = request.parse[this.type];
26546
26547 if (this.req._parser) {
26548 return this.req._parser(this, str);
26549 }
26550
26551 if (!parse && isJSON(this.type)) {
26552 parse = request.parse['application/json'];
26553 }
26554
26555 return parse && str && (str.length > 0 || str instanceof Object) ? parse(str) : null;
26556};
26557/**
26558 * Return an `Error` representative of this response.
26559 *
26560 * @return {Error}
26561 * @api public
26562 */
26563
26564
26565Response.prototype.toError = function () {
26566 var _context2, _context3;
26567
26568 var req = this.req;
26569 var method = req.method;
26570 var url = req.url;
26571 var msg = (0, _concat.default)(_context2 = (0, _concat.default)(_context3 = "cannot ".concat(method, " ")).call(_context3, url, " (")).call(_context2, this.status, ")");
26572 var err = new Error(msg);
26573 err.status = this.status;
26574 err.method = method;
26575 err.url = url;
26576 return err;
26577};
26578/**
26579 * Expose `Response`.
26580 */
26581
26582
26583request.Response = Response;
26584/**
26585 * Initialize a new `Request` with the given `method` and `url`.
26586 *
26587 * @param {String} method
26588 * @param {String} url
26589 * @api public
26590 */
26591
26592function Request(method, url) {
26593 var self = this;
26594 this._query = this._query || [];
26595 this.method = method;
26596 this.url = url;
26597 this.header = {}; // preserves header name case
26598
26599 this._header = {}; // coerces header names to lowercase
26600
26601 this.on('end', function () {
26602 var err = null;
26603 var res = null;
26604
26605 try {
26606 res = new Response(self);
26607 } catch (err_) {
26608 err = new Error('Parser is unable to parse the response');
26609 err.parse = true;
26610 err.original = err_; // issue #675: return the raw response if the response parsing fails
26611
26612 if (self.xhr) {
26613 // ie9 doesn't have 'response' property
26614 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
26615
26616 err.status = self.xhr.status ? self.xhr.status : null;
26617 err.statusCode = err.status; // backwards-compat only
26618 } else {
26619 err.rawResponse = null;
26620 err.status = null;
26621 }
26622
26623 return self.callback(err);
26624 }
26625
26626 self.emit('response', res);
26627 var new_err;
26628
26629 try {
26630 if (!self._isResponseOK(res)) {
26631 new_err = new Error(res.statusText || res.text || 'Unsuccessful HTTP response');
26632 }
26633 } catch (err_) {
26634 new_err = err_; // ok() callback can throw
26635 } // #1000 don't catch errors from the callback to avoid double calling it
26636
26637
26638 if (new_err) {
26639 new_err.original = err;
26640 new_err.response = res;
26641 new_err.status = res.status;
26642 self.callback(new_err, res);
26643 } else {
26644 self.callback(null, res);
26645 }
26646 });
26647}
26648/**
26649 * Mixin `Emitter` and `RequestBase`.
26650 */
26651// eslint-disable-next-line new-cap
26652
26653
26654Emitter(Request.prototype); // eslint-disable-next-line new-cap
26655
26656RequestBase(Request.prototype);
26657/**
26658 * Set Content-Type to `type`, mapping values from `request.types`.
26659 *
26660 * Examples:
26661 *
26662 * superagent.types.xml = 'application/xml';
26663 *
26664 * request.post('/')
26665 * .type('xml')
26666 * .send(xmlstring)
26667 * .end(callback);
26668 *
26669 * request.post('/')
26670 * .type('application/xml')
26671 * .send(xmlstring)
26672 * .end(callback);
26673 *
26674 * @param {String} type
26675 * @return {Request} for chaining
26676 * @api public
26677 */
26678
26679Request.prototype.type = function (type) {
26680 this.set('Content-Type', request.types[type] || type);
26681 return this;
26682};
26683/**
26684 * Set Accept to `type`, mapping values from `request.types`.
26685 *
26686 * Examples:
26687 *
26688 * superagent.types.json = 'application/json';
26689 *
26690 * request.get('/agent')
26691 * .accept('json')
26692 * .end(callback);
26693 *
26694 * request.get('/agent')
26695 * .accept('application/json')
26696 * .end(callback);
26697 *
26698 * @param {String} accept
26699 * @return {Request} for chaining
26700 * @api public
26701 */
26702
26703
26704Request.prototype.accept = function (type) {
26705 this.set('Accept', request.types[type] || type);
26706 return this;
26707};
26708/**
26709 * Set Authorization field value with `user` and `pass`.
26710 *
26711 * @param {String} user
26712 * @param {String} [pass] optional in case of using 'bearer' as type
26713 * @param {Object} options with 'type' property 'auto', 'basic' or 'bearer' (default 'basic')
26714 * @return {Request} for chaining
26715 * @api public
26716 */
26717
26718
26719Request.prototype.auth = function (user, pass, options) {
26720 if (arguments.length === 1) pass = '';
26721
26722 if (_typeof(pass) === 'object' && pass !== null) {
26723 // pass is optional and can be replaced with options
26724 options = pass;
26725 pass = '';
26726 }
26727
26728 if (!options) {
26729 options = {
26730 type: typeof btoa === 'function' ? 'basic' : 'auto'
26731 };
26732 }
26733
26734 var encoder = function encoder(string) {
26735 if (typeof btoa === 'function') {
26736 return btoa(string);
26737 }
26738
26739 throw new Error('Cannot use basic auth, btoa is not a function');
26740 };
26741
26742 return this._auth(user, pass, options, encoder);
26743};
26744/**
26745 * Add query-string `val`.
26746 *
26747 * Examples:
26748 *
26749 * request.get('/shoes')
26750 * .query('size=10')
26751 * .query({ color: 'blue' })
26752 *
26753 * @param {Object|String} val
26754 * @return {Request} for chaining
26755 * @api public
26756 */
26757
26758
26759Request.prototype.query = function (val) {
26760 if (typeof val !== 'string') val = serialize(val);
26761 if (val) this._query.push(val);
26762 return this;
26763};
26764/**
26765 * Queue the given `file` as an attachment to the specified `field`,
26766 * with optional `options` (or filename).
26767 *
26768 * ``` js
26769 * request.post('/upload')
26770 * .attach('content', new Blob(['<a id="a"><b id="b">hey!</b></a>'], { type: "text/html"}))
26771 * .end(callback);
26772 * ```
26773 *
26774 * @param {String} field
26775 * @param {Blob|File} file
26776 * @param {String|Object} options
26777 * @return {Request} for chaining
26778 * @api public
26779 */
26780
26781
26782Request.prototype.attach = function (field, file, options) {
26783 if (file) {
26784 if (this._data) {
26785 throw new Error("superagent can't mix .send() and .attach()");
26786 }
26787
26788 this._getFormData().append(field, file, options || file.name);
26789 }
26790
26791 return this;
26792};
26793
26794Request.prototype._getFormData = function () {
26795 if (!this._formData) {
26796 this._formData = new root.FormData();
26797 }
26798
26799 return this._formData;
26800};
26801/**
26802 * Invoke the callback with `err` and `res`
26803 * and handle arity check.
26804 *
26805 * @param {Error} err
26806 * @param {Response} res
26807 * @api private
26808 */
26809
26810
26811Request.prototype.callback = function (err, res) {
26812 if (this._shouldRetry(err, res)) {
26813 return this._retry();
26814 }
26815
26816 var fn = this._callback;
26817 this.clearTimeout();
26818
26819 if (err) {
26820 if (this._maxRetries) err.retries = this._retries - 1;
26821 this.emit('error', err);
26822 }
26823
26824 fn(err, res);
26825};
26826/**
26827 * Invoke callback with x-domain error.
26828 *
26829 * @api private
26830 */
26831
26832
26833Request.prototype.crossDomainError = function () {
26834 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.');
26835 err.crossDomain = true;
26836 err.status = this.status;
26837 err.method = this.method;
26838 err.url = this.url;
26839 this.callback(err);
26840}; // This only warns, because the request is still likely to work
26841
26842
26843Request.prototype.agent = function () {
26844 console.warn('This is not supported in browser version of superagent');
26845 return this;
26846};
26847
26848Request.prototype.ca = Request.prototype.agent;
26849Request.prototype.buffer = Request.prototype.ca; // This throws, because it can't send/receive data as expected
26850
26851Request.prototype.write = function () {
26852 throw new Error('Streaming is not supported in browser version of superagent');
26853};
26854
26855Request.prototype.pipe = Request.prototype.write;
26856/**
26857 * Check if `obj` is a host object,
26858 * we don't want to serialize these :)
26859 *
26860 * @param {Object} obj host object
26861 * @return {Boolean} is a host object
26862 * @api private
26863 */
26864
26865Request.prototype._isHost = function (obj) {
26866 // Native objects stringify to [object File], [object Blob], [object FormData], etc.
26867 return obj && _typeof(obj) === 'object' && !Array.isArray(obj) && Object.prototype.toString.call(obj) !== '[object Object]';
26868};
26869/**
26870 * Initiate request, invoking callback `fn(res)`
26871 * with an instanceof `Response`.
26872 *
26873 * @param {Function} fn
26874 * @return {Request} for chaining
26875 * @api public
26876 */
26877
26878
26879Request.prototype.end = function (fn) {
26880 if (this._endCalled) {
26881 console.warn('Warning: .end() was called twice. This is not supported in superagent');
26882 }
26883
26884 this._endCalled = true; // store callback
26885
26886 this._callback = fn || noop; // querystring
26887
26888 this._finalizeQueryString();
26889
26890 this._end();
26891};
26892
26893Request.prototype._setUploadTimeout = function () {
26894 var self = this; // upload timeout it's wokrs only if deadline timeout is off
26895
26896 if (this._uploadTimeout && !this._uploadTimeoutTimer) {
26897 this._uploadTimeoutTimer = setTimeout(function () {
26898 self._timeoutError('Upload timeout of ', self._uploadTimeout, 'ETIMEDOUT');
26899 }, this._uploadTimeout);
26900 }
26901}; // eslint-disable-next-line complexity
26902
26903
26904Request.prototype._end = function () {
26905 if (this._aborted) return this.callback(new Error('The request has been aborted even before .end() was called'));
26906 var self = this;
26907 this.xhr = request.getXHR();
26908 var xhr = this.xhr;
26909 var data = this._formData || this._data;
26910
26911 this._setTimeouts(); // state change
26912
26913
26914 xhr.onreadystatechange = function () {
26915 var readyState = xhr.readyState;
26916
26917 if (readyState >= 2 && self._responseTimeoutTimer) {
26918 clearTimeout(self._responseTimeoutTimer);
26919 }
26920
26921 if (readyState !== 4) {
26922 return;
26923 } // In IE9, reads to any property (e.g. status) off of an aborted XHR will
26924 // result in the error "Could not complete the operation due to error c00c023f"
26925
26926
26927 var status;
26928
26929 try {
26930 status = xhr.status;
26931 } catch (_unused5) {
26932 status = 0;
26933 }
26934
26935 if (!status) {
26936 if (self.timedout || self._aborted) return;
26937 return self.crossDomainError();
26938 }
26939
26940 self.emit('end');
26941 }; // progress
26942
26943
26944 var handleProgress = function handleProgress(direction, e) {
26945 if (e.total > 0) {
26946 e.percent = e.loaded / e.total * 100;
26947
26948 if (e.percent === 100) {
26949 clearTimeout(self._uploadTimeoutTimer);
26950 }
26951 }
26952
26953 e.direction = direction;
26954 self.emit('progress', e);
26955 };
26956
26957 if (this.hasListeners('progress')) {
26958 try {
26959 xhr.addEventListener('progress', handleProgress.bind(null, 'download'));
26960
26961 if (xhr.upload) {
26962 xhr.upload.addEventListener('progress', handleProgress.bind(null, 'upload'));
26963 }
26964 } catch (_unused6) {// Accessing xhr.upload fails in IE from a web worker, so just pretend it doesn't exist.
26965 // Reported here:
26966 // https://connect.microsoft.com/IE/feedback/details/837245/xmlhttprequest-upload-throws-invalid-argument-when-used-from-web-worker-context
26967 }
26968 }
26969
26970 if (xhr.upload) {
26971 this._setUploadTimeout();
26972 } // initiate request
26973
26974
26975 try {
26976 if (this.username && this.password) {
26977 xhr.open(this.method, this.url, true, this.username, this.password);
26978 } else {
26979 xhr.open(this.method, this.url, true);
26980 }
26981 } catch (err) {
26982 // see #1149
26983 return this.callback(err);
26984 } // CORS
26985
26986
26987 if (this._withCredentials) xhr.withCredentials = true; // body
26988
26989 if (!this._formData && this.method !== 'GET' && this.method !== 'HEAD' && typeof data !== 'string' && !this._isHost(data)) {
26990 // serialize stuff
26991 var contentType = this._header['content-type'];
26992
26993 var _serialize = this._serializer || request.serialize[contentType ? contentType.split(';')[0] : ''];
26994
26995 if (!_serialize && isJSON(contentType)) {
26996 _serialize = request.serialize['application/json'];
26997 }
26998
26999 if (_serialize) data = _serialize(data);
27000 } // set header fields
27001
27002
27003 for (var field in this.header) {
27004 if (this.header[field] === null) continue;
27005 if (Object.prototype.hasOwnProperty.call(this.header, field)) xhr.setRequestHeader(field, this.header[field]);
27006 }
27007
27008 if (this._responseType) {
27009 xhr.responseType = this._responseType;
27010 } // send stuff
27011
27012
27013 this.emit('request', this); // IE11 xhr.send(undefined) sends 'undefined' string as POST payload (instead of nothing)
27014 // We need null here if data is undefined
27015
27016 xhr.send(typeof data === 'undefined' ? null : data);
27017};
27018
27019request.agent = function () {
27020 return new Agent();
27021};
27022
27023['GET', 'POST', 'OPTIONS', 'PATCH', 'PUT', 'DELETE'].forEach(function (method) {
27024 Agent.prototype[method.toLowerCase()] = function (url, fn) {
27025 var req = new request.Request(method, url);
27026
27027 this._setDefaults(req);
27028
27029 if (fn) {
27030 req.end(fn);
27031 }
27032
27033 return req;
27034 };
27035});
27036Agent.prototype.del = Agent.prototype.delete;
27037/**
27038 * GET `url` with optional callback `fn(res)`.
27039 *
27040 * @param {String} url
27041 * @param {Mixed|Function} [data] or fn
27042 * @param {Function} [fn]
27043 * @return {Request}
27044 * @api public
27045 */
27046
27047request.get = function (url, data, fn) {
27048 var req = request('GET', url);
27049
27050 if (typeof data === 'function') {
27051 fn = data;
27052 data = null;
27053 }
27054
27055 if (data) req.query(data);
27056 if (fn) req.end(fn);
27057 return req;
27058};
27059/**
27060 * HEAD `url` with optional callback `fn(res)`.
27061 *
27062 * @param {String} url
27063 * @param {Mixed|Function} [data] or fn
27064 * @param {Function} [fn]
27065 * @return {Request}
27066 * @api public
27067 */
27068
27069
27070request.head = function (url, data, fn) {
27071 var req = request('HEAD', url);
27072
27073 if (typeof data === 'function') {
27074 fn = data;
27075 data = null;
27076 }
27077
27078 if (data) req.query(data);
27079 if (fn) req.end(fn);
27080 return req;
27081};
27082/**
27083 * OPTIONS query to `url` with optional callback `fn(res)`.
27084 *
27085 * @param {String} url
27086 * @param {Mixed|Function} [data] or fn
27087 * @param {Function} [fn]
27088 * @return {Request}
27089 * @api public
27090 */
27091
27092
27093request.options = function (url, data, fn) {
27094 var req = request('OPTIONS', url);
27095
27096 if (typeof data === 'function') {
27097 fn = data;
27098 data = null;
27099 }
27100
27101 if (data) req.send(data);
27102 if (fn) req.end(fn);
27103 return req;
27104};
27105/**
27106 * DELETE `url` with optional `data` and callback `fn(res)`.
27107 *
27108 * @param {String} url
27109 * @param {Mixed} [data]
27110 * @param {Function} [fn]
27111 * @return {Request}
27112 * @api public
27113 */
27114
27115
27116function del(url, data, fn) {
27117 var req = request('DELETE', url);
27118
27119 if (typeof data === 'function') {
27120 fn = data;
27121 data = null;
27122 }
27123
27124 if (data) req.send(data);
27125 if (fn) req.end(fn);
27126 return req;
27127}
27128
27129request.del = del;
27130request.delete = del;
27131/**
27132 * PATCH `url` with optional `data` and callback `fn(res)`.
27133 *
27134 * @param {String} url
27135 * @param {Mixed} [data]
27136 * @param {Function} [fn]
27137 * @return {Request}
27138 * @api public
27139 */
27140
27141request.patch = function (url, data, fn) {
27142 var req = request('PATCH', url);
27143
27144 if (typeof data === 'function') {
27145 fn = data;
27146 data = null;
27147 }
27148
27149 if (data) req.send(data);
27150 if (fn) req.end(fn);
27151 return req;
27152};
27153/**
27154 * POST `url` with optional `data` and callback `fn(res)`.
27155 *
27156 * @param {String} url
27157 * @param {Mixed} [data]
27158 * @param {Function} [fn]
27159 * @return {Request}
27160 * @api public
27161 */
27162
27163
27164request.post = function (url, data, fn) {
27165 var req = request('POST', url);
27166
27167 if (typeof data === 'function') {
27168 fn = data;
27169 data = null;
27170 }
27171
27172 if (data) req.send(data);
27173 if (fn) req.end(fn);
27174 return req;
27175};
27176/**
27177 * PUT `url` with optional `data` and callback `fn(res)`.
27178 *
27179 * @param {String} url
27180 * @param {Mixed|Function} [data] or fn
27181 * @param {Function} [fn]
27182 * @return {Request}
27183 * @api public
27184 */
27185
27186
27187request.put = function (url, data, fn) {
27188 var req = request('PUT', url);
27189
27190 if (typeof data === 'function') {
27191 fn = data;
27192 data = null;
27193 }
27194
27195 if (data) req.send(data);
27196 if (fn) req.end(fn);
27197 return req;
27198};
27199
27200/***/ }),
27201/* 576 */
27202/***/ (function(module, exports, __webpack_require__) {
27203
27204module.exports = __webpack_require__(577);
27205
27206/***/ }),
27207/* 577 */
27208/***/ (function(module, exports, __webpack_require__) {
27209
27210var parent = __webpack_require__(578);
27211
27212module.exports = parent;
27213
27214
27215/***/ }),
27216/* 578 */
27217/***/ (function(module, exports, __webpack_require__) {
27218
27219var isPrototypeOf = __webpack_require__(16);
27220var method = __webpack_require__(579);
27221
27222var StringPrototype = String.prototype;
27223
27224module.exports = function (it) {
27225 var own = it.trim;
27226 return typeof it == 'string' || it === StringPrototype
27227 || (isPrototypeOf(StringPrototype, it) && own === StringPrototype.trim) ? method : own;
27228};
27229
27230
27231/***/ }),
27232/* 579 */
27233/***/ (function(module, exports, __webpack_require__) {
27234
27235__webpack_require__(580);
27236var entryVirtual = __webpack_require__(27);
27237
27238module.exports = entryVirtual('String').trim;
27239
27240
27241/***/ }),
27242/* 580 */
27243/***/ (function(module, exports, __webpack_require__) {
27244
27245"use strict";
27246
27247var $ = __webpack_require__(0);
27248var $trim = __webpack_require__(581).trim;
27249var forcedStringTrimMethod = __webpack_require__(582);
27250
27251// `String.prototype.trim` method
27252// https://tc39.es/ecma262/#sec-string.prototype.trim
27253$({ target: 'String', proto: true, forced: forcedStringTrimMethod('trim') }, {
27254 trim: function trim() {
27255 return $trim(this);
27256 }
27257});
27258
27259
27260/***/ }),
27261/* 581 */
27262/***/ (function(module, exports, __webpack_require__) {
27263
27264var uncurryThis = __webpack_require__(4);
27265var requireObjectCoercible = __webpack_require__(81);
27266var toString = __webpack_require__(42);
27267var whitespaces = __webpack_require__(259);
27268
27269var replace = uncurryThis(''.replace);
27270var whitespace = '[' + whitespaces + ']';
27271var ltrim = RegExp('^' + whitespace + whitespace + '*');
27272var rtrim = RegExp(whitespace + whitespace + '*$');
27273
27274// `String.prototype.{ trim, trimStart, trimEnd, trimLeft, trimRight }` methods implementation
27275var createMethod = function (TYPE) {
27276 return function ($this) {
27277 var string = toString(requireObjectCoercible($this));
27278 if (TYPE & 1) string = replace(string, ltrim, '');
27279 if (TYPE & 2) string = replace(string, rtrim, '');
27280 return string;
27281 };
27282};
27283
27284module.exports = {
27285 // `String.prototype.{ trimLeft, trimStart }` methods
27286 // https://tc39.es/ecma262/#sec-string.prototype.trimstart
27287 start: createMethod(1),
27288 // `String.prototype.{ trimRight, trimEnd }` methods
27289 // https://tc39.es/ecma262/#sec-string.prototype.trimend
27290 end: createMethod(2),
27291 // `String.prototype.trim` method
27292 // https://tc39.es/ecma262/#sec-string.prototype.trim
27293 trim: createMethod(3)
27294};
27295
27296
27297/***/ }),
27298/* 582 */
27299/***/ (function(module, exports, __webpack_require__) {
27300
27301var PROPER_FUNCTION_NAME = __webpack_require__(169).PROPER;
27302var fails = __webpack_require__(2);
27303var whitespaces = __webpack_require__(259);
27304
27305var non = '\u200B\u0085\u180E';
27306
27307// check that a method works with the correct list
27308// of whitespaces and has a correct name
27309module.exports = function (METHOD_NAME) {
27310 return fails(function () {
27311 return !!whitespaces[METHOD_NAME]()
27312 || non[METHOD_NAME]() !== non
27313 || (PROPER_FUNCTION_NAME && whitespaces[METHOD_NAME].name !== METHOD_NAME);
27314 });
27315};
27316
27317
27318/***/ }),
27319/* 583 */
27320/***/ (function(module, exports, __webpack_require__) {
27321
27322
27323/**
27324 * Expose `Emitter`.
27325 */
27326
27327if (true) {
27328 module.exports = Emitter;
27329}
27330
27331/**
27332 * Initialize a new `Emitter`.
27333 *
27334 * @api public
27335 */
27336
27337function Emitter(obj) {
27338 if (obj) return mixin(obj);
27339};
27340
27341/**
27342 * Mixin the emitter properties.
27343 *
27344 * @param {Object} obj
27345 * @return {Object}
27346 * @api private
27347 */
27348
27349function mixin(obj) {
27350 for (var key in Emitter.prototype) {
27351 obj[key] = Emitter.prototype[key];
27352 }
27353 return obj;
27354}
27355
27356/**
27357 * Listen on the given `event` with `fn`.
27358 *
27359 * @param {String} event
27360 * @param {Function} fn
27361 * @return {Emitter}
27362 * @api public
27363 */
27364
27365Emitter.prototype.on =
27366Emitter.prototype.addEventListener = function(event, fn){
27367 this._callbacks = this._callbacks || {};
27368 (this._callbacks['$' + event] = this._callbacks['$' + event] || [])
27369 .push(fn);
27370 return this;
27371};
27372
27373/**
27374 * Adds an `event` listener that will be invoked a single
27375 * time then automatically removed.
27376 *
27377 * @param {String} event
27378 * @param {Function} fn
27379 * @return {Emitter}
27380 * @api public
27381 */
27382
27383Emitter.prototype.once = function(event, fn){
27384 function on() {
27385 this.off(event, on);
27386 fn.apply(this, arguments);
27387 }
27388
27389 on.fn = fn;
27390 this.on(event, on);
27391 return this;
27392};
27393
27394/**
27395 * Remove the given callback for `event` or all
27396 * registered callbacks.
27397 *
27398 * @param {String} event
27399 * @param {Function} fn
27400 * @return {Emitter}
27401 * @api public
27402 */
27403
27404Emitter.prototype.off =
27405Emitter.prototype.removeListener =
27406Emitter.prototype.removeAllListeners =
27407Emitter.prototype.removeEventListener = function(event, fn){
27408 this._callbacks = this._callbacks || {};
27409
27410 // all
27411 if (0 == arguments.length) {
27412 this._callbacks = {};
27413 return this;
27414 }
27415
27416 // specific event
27417 var callbacks = this._callbacks['$' + event];
27418 if (!callbacks) return this;
27419
27420 // remove all handlers
27421 if (1 == arguments.length) {
27422 delete this._callbacks['$' + event];
27423 return this;
27424 }
27425
27426 // remove specific handler
27427 var cb;
27428 for (var i = 0; i < callbacks.length; i++) {
27429 cb = callbacks[i];
27430 if (cb === fn || cb.fn === fn) {
27431 callbacks.splice(i, 1);
27432 break;
27433 }
27434 }
27435
27436 // Remove event specific arrays for event types that no
27437 // one is subscribed for to avoid memory leak.
27438 if (callbacks.length === 0) {
27439 delete this._callbacks['$' + event];
27440 }
27441
27442 return this;
27443};
27444
27445/**
27446 * Emit `event` with the given args.
27447 *
27448 * @param {String} event
27449 * @param {Mixed} ...
27450 * @return {Emitter}
27451 */
27452
27453Emitter.prototype.emit = function(event){
27454 this._callbacks = this._callbacks || {};
27455
27456 var args = new Array(arguments.length - 1)
27457 , callbacks = this._callbacks['$' + event];
27458
27459 for (var i = 1; i < arguments.length; i++) {
27460 args[i - 1] = arguments[i];
27461 }
27462
27463 if (callbacks) {
27464 callbacks = callbacks.slice(0);
27465 for (var i = 0, len = callbacks.length; i < len; ++i) {
27466 callbacks[i].apply(this, args);
27467 }
27468 }
27469
27470 return this;
27471};
27472
27473/**
27474 * Return array of callbacks for `event`.
27475 *
27476 * @param {String} event
27477 * @return {Array}
27478 * @api public
27479 */
27480
27481Emitter.prototype.listeners = function(event){
27482 this._callbacks = this._callbacks || {};
27483 return this._callbacks['$' + event] || [];
27484};
27485
27486/**
27487 * Check if this emitter has `event` handlers.
27488 *
27489 * @param {String} event
27490 * @return {Boolean}
27491 * @api public
27492 */
27493
27494Emitter.prototype.hasListeners = function(event){
27495 return !! this.listeners(event).length;
27496};
27497
27498
27499/***/ }),
27500/* 584 */
27501/***/ (function(module, exports) {
27502
27503module.exports = stringify
27504stringify.default = stringify
27505stringify.stable = deterministicStringify
27506stringify.stableStringify = deterministicStringify
27507
27508var LIMIT_REPLACE_NODE = '[...]'
27509var CIRCULAR_REPLACE_NODE = '[Circular]'
27510
27511var arr = []
27512var replacerStack = []
27513
27514function defaultOptions () {
27515 return {
27516 depthLimit: Number.MAX_SAFE_INTEGER,
27517 edgesLimit: Number.MAX_SAFE_INTEGER
27518 }
27519}
27520
27521// Regular stringify
27522function stringify (obj, replacer, spacer, options) {
27523 if (typeof options === 'undefined') {
27524 options = defaultOptions()
27525 }
27526
27527 decirc(obj, '', 0, [], undefined, 0, options)
27528 var res
27529 try {
27530 if (replacerStack.length === 0) {
27531 res = JSON.stringify(obj, replacer, spacer)
27532 } else {
27533 res = JSON.stringify(obj, replaceGetterValues(replacer), spacer)
27534 }
27535 } catch (_) {
27536 return JSON.stringify('[unable to serialize, circular reference is too complex to analyze]')
27537 } finally {
27538 while (arr.length !== 0) {
27539 var part = arr.pop()
27540 if (part.length === 4) {
27541 Object.defineProperty(part[0], part[1], part[3])
27542 } else {
27543 part[0][part[1]] = part[2]
27544 }
27545 }
27546 }
27547 return res
27548}
27549
27550function setReplace (replace, val, k, parent) {
27551 var propertyDescriptor = Object.getOwnPropertyDescriptor(parent, k)
27552 if (propertyDescriptor.get !== undefined) {
27553 if (propertyDescriptor.configurable) {
27554 Object.defineProperty(parent, k, { value: replace })
27555 arr.push([parent, k, val, propertyDescriptor])
27556 } else {
27557 replacerStack.push([val, k, replace])
27558 }
27559 } else {
27560 parent[k] = replace
27561 arr.push([parent, k, val])
27562 }
27563}
27564
27565function decirc (val, k, edgeIndex, stack, parent, depth, options) {
27566 depth += 1
27567 var i
27568 if (typeof val === 'object' && val !== null) {
27569 for (i = 0; i < stack.length; i++) {
27570 if (stack[i] === val) {
27571 setReplace(CIRCULAR_REPLACE_NODE, val, k, parent)
27572 return
27573 }
27574 }
27575
27576 if (
27577 typeof options.depthLimit !== 'undefined' &&
27578 depth > options.depthLimit
27579 ) {
27580 setReplace(LIMIT_REPLACE_NODE, val, k, parent)
27581 return
27582 }
27583
27584 if (
27585 typeof options.edgesLimit !== 'undefined' &&
27586 edgeIndex + 1 > options.edgesLimit
27587 ) {
27588 setReplace(LIMIT_REPLACE_NODE, val, k, parent)
27589 return
27590 }
27591
27592 stack.push(val)
27593 // Optimize for Arrays. Big arrays could kill the performance otherwise!
27594 if (Array.isArray(val)) {
27595 for (i = 0; i < val.length; i++) {
27596 decirc(val[i], i, i, stack, val, depth, options)
27597 }
27598 } else {
27599 var keys = Object.keys(val)
27600 for (i = 0; i < keys.length; i++) {
27601 var key = keys[i]
27602 decirc(val[key], key, i, stack, val, depth, options)
27603 }
27604 }
27605 stack.pop()
27606 }
27607}
27608
27609// Stable-stringify
27610function compareFunction (a, b) {
27611 if (a < b) {
27612 return -1
27613 }
27614 if (a > b) {
27615 return 1
27616 }
27617 return 0
27618}
27619
27620function deterministicStringify (obj, replacer, spacer, options) {
27621 if (typeof options === 'undefined') {
27622 options = defaultOptions()
27623 }
27624
27625 var tmp = deterministicDecirc(obj, '', 0, [], undefined, 0, options) || obj
27626 var res
27627 try {
27628 if (replacerStack.length === 0) {
27629 res = JSON.stringify(tmp, replacer, spacer)
27630 } else {
27631 res = JSON.stringify(tmp, replaceGetterValues(replacer), spacer)
27632 }
27633 } catch (_) {
27634 return JSON.stringify('[unable to serialize, circular reference is too complex to analyze]')
27635 } finally {
27636 // Ensure that we restore the object as it was.
27637 while (arr.length !== 0) {
27638 var part = arr.pop()
27639 if (part.length === 4) {
27640 Object.defineProperty(part[0], part[1], part[3])
27641 } else {
27642 part[0][part[1]] = part[2]
27643 }
27644 }
27645 }
27646 return res
27647}
27648
27649function deterministicDecirc (val, k, edgeIndex, stack, parent, depth, options) {
27650 depth += 1
27651 var i
27652 if (typeof val === 'object' && val !== null) {
27653 for (i = 0; i < stack.length; i++) {
27654 if (stack[i] === val) {
27655 setReplace(CIRCULAR_REPLACE_NODE, val, k, parent)
27656 return
27657 }
27658 }
27659 try {
27660 if (typeof val.toJSON === 'function') {
27661 return
27662 }
27663 } catch (_) {
27664 return
27665 }
27666
27667 if (
27668 typeof options.depthLimit !== 'undefined' &&
27669 depth > options.depthLimit
27670 ) {
27671 setReplace(LIMIT_REPLACE_NODE, val, k, parent)
27672 return
27673 }
27674
27675 if (
27676 typeof options.edgesLimit !== 'undefined' &&
27677 edgeIndex + 1 > options.edgesLimit
27678 ) {
27679 setReplace(LIMIT_REPLACE_NODE, val, k, parent)
27680 return
27681 }
27682
27683 stack.push(val)
27684 // Optimize for Arrays. Big arrays could kill the performance otherwise!
27685 if (Array.isArray(val)) {
27686 for (i = 0; i < val.length; i++) {
27687 deterministicDecirc(val[i], i, i, stack, val, depth, options)
27688 }
27689 } else {
27690 // Create a temporary object in the required way
27691 var tmp = {}
27692 var keys = Object.keys(val).sort(compareFunction)
27693 for (i = 0; i < keys.length; i++) {
27694 var key = keys[i]
27695 deterministicDecirc(val[key], key, i, stack, val, depth, options)
27696 tmp[key] = val[key]
27697 }
27698 if (typeof parent !== 'undefined') {
27699 arr.push([parent, k, val])
27700 parent[k] = tmp
27701 } else {
27702 return tmp
27703 }
27704 }
27705 stack.pop()
27706 }
27707}
27708
27709// wraps replacer function to handle values we couldn't replace
27710// and mark them as replaced value
27711function replaceGetterValues (replacer) {
27712 replacer =
27713 typeof replacer !== 'undefined'
27714 ? replacer
27715 : function (k, v) {
27716 return v
27717 }
27718 return function (key, val) {
27719 if (replacerStack.length > 0) {
27720 for (var i = 0; i < replacerStack.length; i++) {
27721 var part = replacerStack[i]
27722 if (part[1] === key && part[0] === val) {
27723 val = part[2]
27724 replacerStack.splice(i, 1)
27725 break
27726 }
27727 }
27728 }
27729 return replacer.call(this, key, val)
27730 }
27731}
27732
27733
27734/***/ }),
27735/* 585 */
27736/***/ (function(module, exports, __webpack_require__) {
27737
27738"use strict";
27739
27740
27741var _interopRequireDefault = __webpack_require__(1);
27742
27743var _symbol = _interopRequireDefault(__webpack_require__(77));
27744
27745var _iterator = _interopRequireDefault(__webpack_require__(154));
27746
27747var _includes = _interopRequireDefault(__webpack_require__(586));
27748
27749var _promise = _interopRequireDefault(__webpack_require__(12));
27750
27751var _concat = _interopRequireDefault(__webpack_require__(19));
27752
27753var _indexOf = _interopRequireDefault(__webpack_require__(61));
27754
27755var _slice = _interopRequireDefault(__webpack_require__(34));
27756
27757var _sort = _interopRequireDefault(__webpack_require__(596));
27758
27759function _typeof(obj) {
27760 "@babel/helpers - typeof";
27761
27762 if (typeof _symbol.default === "function" && typeof _iterator.default === "symbol") {
27763 _typeof = function _typeof(obj) {
27764 return typeof obj;
27765 };
27766 } else {
27767 _typeof = function _typeof(obj) {
27768 return obj && typeof _symbol.default === "function" && obj.constructor === _symbol.default && obj !== _symbol.default.prototype ? "symbol" : typeof obj;
27769 };
27770 }
27771
27772 return _typeof(obj);
27773}
27774/**
27775 * Module of mixed-in functions shared between node and client code
27776 */
27777
27778
27779var isObject = __webpack_require__(260);
27780/**
27781 * Expose `RequestBase`.
27782 */
27783
27784
27785module.exports = RequestBase;
27786/**
27787 * Initialize a new `RequestBase`.
27788 *
27789 * @api public
27790 */
27791
27792function RequestBase(obj) {
27793 if (obj) return mixin(obj);
27794}
27795/**
27796 * Mixin the prototype properties.
27797 *
27798 * @param {Object} obj
27799 * @return {Object}
27800 * @api private
27801 */
27802
27803
27804function mixin(obj) {
27805 for (var key in RequestBase.prototype) {
27806 if (Object.prototype.hasOwnProperty.call(RequestBase.prototype, key)) obj[key] = RequestBase.prototype[key];
27807 }
27808
27809 return obj;
27810}
27811/**
27812 * Clear previous timeout.
27813 *
27814 * @return {Request} for chaining
27815 * @api public
27816 */
27817
27818
27819RequestBase.prototype.clearTimeout = function () {
27820 clearTimeout(this._timer);
27821 clearTimeout(this._responseTimeoutTimer);
27822 clearTimeout(this._uploadTimeoutTimer);
27823 delete this._timer;
27824 delete this._responseTimeoutTimer;
27825 delete this._uploadTimeoutTimer;
27826 return this;
27827};
27828/**
27829 * Override default response body parser
27830 *
27831 * This function will be called to convert incoming data into request.body
27832 *
27833 * @param {Function}
27834 * @api public
27835 */
27836
27837
27838RequestBase.prototype.parse = function (fn) {
27839 this._parser = fn;
27840 return this;
27841};
27842/**
27843 * Set format of binary response body.
27844 * In browser valid formats are 'blob' and 'arraybuffer',
27845 * which return Blob and ArrayBuffer, respectively.
27846 *
27847 * In Node all values result in Buffer.
27848 *
27849 * Examples:
27850 *
27851 * req.get('/')
27852 * .responseType('blob')
27853 * .end(callback);
27854 *
27855 * @param {String} val
27856 * @return {Request} for chaining
27857 * @api public
27858 */
27859
27860
27861RequestBase.prototype.responseType = function (val) {
27862 this._responseType = val;
27863 return this;
27864};
27865/**
27866 * Override default request body serializer
27867 *
27868 * This function will be called to convert data set via .send or .attach into payload to send
27869 *
27870 * @param {Function}
27871 * @api public
27872 */
27873
27874
27875RequestBase.prototype.serialize = function (fn) {
27876 this._serializer = fn;
27877 return this;
27878};
27879/**
27880 * Set timeouts.
27881 *
27882 * - response timeout is time between sending request and receiving the first byte of the response. Includes DNS and connection time.
27883 * - 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.
27884 * - upload is the time since last bit of data was sent or received. This timeout works only if deadline timeout is off
27885 *
27886 * Value of 0 or false means no timeout.
27887 *
27888 * @param {Number|Object} ms or {response, deadline}
27889 * @return {Request} for chaining
27890 * @api public
27891 */
27892
27893
27894RequestBase.prototype.timeout = function (options) {
27895 if (!options || _typeof(options) !== 'object') {
27896 this._timeout = options;
27897 this._responseTimeout = 0;
27898 this._uploadTimeout = 0;
27899 return this;
27900 }
27901
27902 for (var option in options) {
27903 if (Object.prototype.hasOwnProperty.call(options, option)) {
27904 switch (option) {
27905 case 'deadline':
27906 this._timeout = options.deadline;
27907 break;
27908
27909 case 'response':
27910 this._responseTimeout = options.response;
27911 break;
27912
27913 case 'upload':
27914 this._uploadTimeout = options.upload;
27915 break;
27916
27917 default:
27918 console.warn('Unknown timeout option', option);
27919 }
27920 }
27921 }
27922
27923 return this;
27924};
27925/**
27926 * Set number of retry attempts on error.
27927 *
27928 * Failed requests will be retried 'count' times if timeout or err.code >= 500.
27929 *
27930 * @param {Number} count
27931 * @param {Function} [fn]
27932 * @return {Request} for chaining
27933 * @api public
27934 */
27935
27936
27937RequestBase.prototype.retry = function (count, fn) {
27938 // Default to 1 if no count passed or true
27939 if (arguments.length === 0 || count === true) count = 1;
27940 if (count <= 0) count = 0;
27941 this._maxRetries = count;
27942 this._retries = 0;
27943 this._retryCallback = fn;
27944 return this;
27945};
27946
27947var ERROR_CODES = ['ECONNRESET', 'ETIMEDOUT', 'EADDRINFO', 'ESOCKETTIMEDOUT'];
27948/**
27949 * Determine if a request should be retried.
27950 * (Borrowed from segmentio/superagent-retry)
27951 *
27952 * @param {Error} err an error
27953 * @param {Response} [res] response
27954 * @returns {Boolean} if segment should be retried
27955 */
27956
27957RequestBase.prototype._shouldRetry = function (err, res) {
27958 if (!this._maxRetries || this._retries++ >= this._maxRetries) {
27959 return false;
27960 }
27961
27962 if (this._retryCallback) {
27963 try {
27964 var override = this._retryCallback(err, res);
27965
27966 if (override === true) return true;
27967 if (override === false) return false; // undefined falls back to defaults
27968 } catch (err_) {
27969 console.error(err_);
27970 }
27971 }
27972
27973 if (res && res.status && res.status >= 500 && res.status !== 501) return true;
27974
27975 if (err) {
27976 if (err.code && (0, _includes.default)(ERROR_CODES).call(ERROR_CODES, err.code)) return true; // Superagent timeout
27977
27978 if (err.timeout && err.code === 'ECONNABORTED') return true;
27979 if (err.crossDomain) return true;
27980 }
27981
27982 return false;
27983};
27984/**
27985 * Retry request
27986 *
27987 * @return {Request} for chaining
27988 * @api private
27989 */
27990
27991
27992RequestBase.prototype._retry = function () {
27993 this.clearTimeout(); // node
27994
27995 if (this.req) {
27996 this.req = null;
27997 this.req = this.request();
27998 }
27999
28000 this._aborted = false;
28001 this.timedout = false;
28002 this.timedoutError = null;
28003 return this._end();
28004};
28005/**
28006 * Promise support
28007 *
28008 * @param {Function} resolve
28009 * @param {Function} [reject]
28010 * @return {Request}
28011 */
28012
28013
28014RequestBase.prototype.then = function (resolve, reject) {
28015 var _this = this;
28016
28017 if (!this._fullfilledPromise) {
28018 var self = this;
28019
28020 if (this._endCalled) {
28021 console.warn('Warning: superagent request was sent twice, because both .end() and .then() were called. Never call .end() if you use promises');
28022 }
28023
28024 this._fullfilledPromise = new _promise.default(function (resolve, reject) {
28025 self.on('abort', function () {
28026 if (_this._maxRetries && _this._maxRetries > _this._retries) {
28027 return;
28028 }
28029
28030 if (_this.timedout && _this.timedoutError) {
28031 reject(_this.timedoutError);
28032 return;
28033 }
28034
28035 var err = new Error('Aborted');
28036 err.code = 'ABORTED';
28037 err.status = _this.status;
28038 err.method = _this.method;
28039 err.url = _this.url;
28040 reject(err);
28041 });
28042 self.end(function (err, res) {
28043 if (err) reject(err);else resolve(res);
28044 });
28045 });
28046 }
28047
28048 return this._fullfilledPromise.then(resolve, reject);
28049};
28050
28051RequestBase.prototype.catch = function (cb) {
28052 return this.then(undefined, cb);
28053};
28054/**
28055 * Allow for extension
28056 */
28057
28058
28059RequestBase.prototype.use = function (fn) {
28060 fn(this);
28061 return this;
28062};
28063
28064RequestBase.prototype.ok = function (cb) {
28065 if (typeof cb !== 'function') throw new Error('Callback required');
28066 this._okCallback = cb;
28067 return this;
28068};
28069
28070RequestBase.prototype._isResponseOK = function (res) {
28071 if (!res) {
28072 return false;
28073 }
28074
28075 if (this._okCallback) {
28076 return this._okCallback(res);
28077 }
28078
28079 return res.status >= 200 && res.status < 300;
28080};
28081/**
28082 * Get request header `field`.
28083 * Case-insensitive.
28084 *
28085 * @param {String} field
28086 * @return {String}
28087 * @api public
28088 */
28089
28090
28091RequestBase.prototype.get = function (field) {
28092 return this._header[field.toLowerCase()];
28093};
28094/**
28095 * Get case-insensitive header `field` value.
28096 * This is a deprecated internal API. Use `.get(field)` instead.
28097 *
28098 * (getHeader is no longer used internally by the superagent code base)
28099 *
28100 * @param {String} field
28101 * @return {String}
28102 * @api private
28103 * @deprecated
28104 */
28105
28106
28107RequestBase.prototype.getHeader = RequestBase.prototype.get;
28108/**
28109 * Set header `field` to `val`, or multiple fields with one object.
28110 * Case-insensitive.
28111 *
28112 * Examples:
28113 *
28114 * req.get('/')
28115 * .set('Accept', 'application/json')
28116 * .set('X-API-Key', 'foobar')
28117 * .end(callback);
28118 *
28119 * req.get('/')
28120 * .set({ Accept: 'application/json', 'X-API-Key': 'foobar' })
28121 * .end(callback);
28122 *
28123 * @param {String|Object} field
28124 * @param {String} val
28125 * @return {Request} for chaining
28126 * @api public
28127 */
28128
28129RequestBase.prototype.set = function (field, val) {
28130 if (isObject(field)) {
28131 for (var key in field) {
28132 if (Object.prototype.hasOwnProperty.call(field, key)) this.set(key, field[key]);
28133 }
28134
28135 return this;
28136 }
28137
28138 this._header[field.toLowerCase()] = val;
28139 this.header[field] = val;
28140 return this;
28141};
28142/**
28143 * Remove header `field`.
28144 * Case-insensitive.
28145 *
28146 * Example:
28147 *
28148 * req.get('/')
28149 * .unset('User-Agent')
28150 * .end(callback);
28151 *
28152 * @param {String} field field name
28153 */
28154
28155
28156RequestBase.prototype.unset = function (field) {
28157 delete this._header[field.toLowerCase()];
28158 delete this.header[field];
28159 return this;
28160};
28161/**
28162 * Write the field `name` and `val`, or multiple fields with one object
28163 * for "multipart/form-data" request bodies.
28164 *
28165 * ``` js
28166 * request.post('/upload')
28167 * .field('foo', 'bar')
28168 * .end(callback);
28169 *
28170 * request.post('/upload')
28171 * .field({ foo: 'bar', baz: 'qux' })
28172 * .end(callback);
28173 * ```
28174 *
28175 * @param {String|Object} name name of field
28176 * @param {String|Blob|File|Buffer|fs.ReadStream} val value of field
28177 * @return {Request} for chaining
28178 * @api public
28179 */
28180
28181
28182RequestBase.prototype.field = function (name, val) {
28183 // name should be either a string or an object.
28184 if (name === null || undefined === name) {
28185 throw new Error('.field(name, val) name can not be empty');
28186 }
28187
28188 if (this._data) {
28189 throw new Error(".field() can't be used if .send() is used. Please use only .send() or only .field() & .attach()");
28190 }
28191
28192 if (isObject(name)) {
28193 for (var key in name) {
28194 if (Object.prototype.hasOwnProperty.call(name, key)) this.field(key, name[key]);
28195 }
28196
28197 return this;
28198 }
28199
28200 if (Array.isArray(val)) {
28201 for (var i in val) {
28202 if (Object.prototype.hasOwnProperty.call(val, i)) this.field(name, val[i]);
28203 }
28204
28205 return this;
28206 } // val should be defined now
28207
28208
28209 if (val === null || undefined === val) {
28210 throw new Error('.field(name, val) val can not be empty');
28211 }
28212
28213 if (typeof val === 'boolean') {
28214 val = String(val);
28215 }
28216
28217 this._getFormData().append(name, val);
28218
28219 return this;
28220};
28221/**
28222 * Abort the request, and clear potential timeout.
28223 *
28224 * @return {Request} request
28225 * @api public
28226 */
28227
28228
28229RequestBase.prototype.abort = function () {
28230 if (this._aborted) {
28231 return this;
28232 }
28233
28234 this._aborted = true;
28235 if (this.xhr) this.xhr.abort(); // browser
28236
28237 if (this.req) this.req.abort(); // node
28238
28239 this.clearTimeout();
28240 this.emit('abort');
28241 return this;
28242};
28243
28244RequestBase.prototype._auth = function (user, pass, options, base64Encoder) {
28245 var _context;
28246
28247 switch (options.type) {
28248 case 'basic':
28249 this.set('Authorization', "Basic ".concat(base64Encoder((0, _concat.default)(_context = "".concat(user, ":")).call(_context, pass))));
28250 break;
28251
28252 case 'auto':
28253 this.username = user;
28254 this.password = pass;
28255 break;
28256
28257 case 'bearer':
28258 // usage would be .auth(accessToken, { type: 'bearer' })
28259 this.set('Authorization', "Bearer ".concat(user));
28260 break;
28261
28262 default:
28263 break;
28264 }
28265
28266 return this;
28267};
28268/**
28269 * Enable transmission of cookies with x-domain requests.
28270 *
28271 * Note that for this to work the origin must not be
28272 * using "Access-Control-Allow-Origin" with a wildcard,
28273 * and also must set "Access-Control-Allow-Credentials"
28274 * to "true".
28275 *
28276 * @api public
28277 */
28278
28279
28280RequestBase.prototype.withCredentials = function (on) {
28281 // This is browser-only functionality. Node side is no-op.
28282 if (on === undefined) on = true;
28283 this._withCredentials = on;
28284 return this;
28285};
28286/**
28287 * Set the max redirects to `n`. Does nothing in browser XHR implementation.
28288 *
28289 * @param {Number} n
28290 * @return {Request} for chaining
28291 * @api public
28292 */
28293
28294
28295RequestBase.prototype.redirects = function (n) {
28296 this._maxRedirects = n;
28297 return this;
28298};
28299/**
28300 * Maximum size of buffered response body, in bytes. Counts uncompressed size.
28301 * Default 200MB.
28302 *
28303 * @param {Number} n number of bytes
28304 * @return {Request} for chaining
28305 */
28306
28307
28308RequestBase.prototype.maxResponseSize = function (n) {
28309 if (typeof n !== 'number') {
28310 throw new TypeError('Invalid argument');
28311 }
28312
28313 this._maxResponseSize = n;
28314 return this;
28315};
28316/**
28317 * Convert to a plain javascript object (not JSON string) of scalar properties.
28318 * Note as this method is designed to return a useful non-this value,
28319 * it cannot be chained.
28320 *
28321 * @return {Object} describing method, url, and data of this request
28322 * @api public
28323 */
28324
28325
28326RequestBase.prototype.toJSON = function () {
28327 return {
28328 method: this.method,
28329 url: this.url,
28330 data: this._data,
28331 headers: this._header
28332 };
28333};
28334/**
28335 * Send `data` as the request body, defaulting the `.type()` to "json" when
28336 * an object is given.
28337 *
28338 * Examples:
28339 *
28340 * // manual json
28341 * request.post('/user')
28342 * .type('json')
28343 * .send('{"name":"tj"}')
28344 * .end(callback)
28345 *
28346 * // auto json
28347 * request.post('/user')
28348 * .send({ name: 'tj' })
28349 * .end(callback)
28350 *
28351 * // manual x-www-form-urlencoded
28352 * request.post('/user')
28353 * .type('form')
28354 * .send('name=tj')
28355 * .end(callback)
28356 *
28357 * // auto x-www-form-urlencoded
28358 * request.post('/user')
28359 * .type('form')
28360 * .send({ name: 'tj' })
28361 * .end(callback)
28362 *
28363 * // defaults to x-www-form-urlencoded
28364 * request.post('/user')
28365 * .send('name=tobi')
28366 * .send('species=ferret')
28367 * .end(callback)
28368 *
28369 * @param {String|Object} data
28370 * @return {Request} for chaining
28371 * @api public
28372 */
28373// eslint-disable-next-line complexity
28374
28375
28376RequestBase.prototype.send = function (data) {
28377 var isObj = isObject(data);
28378 var type = this._header['content-type'];
28379
28380 if (this._formData) {
28381 throw new Error(".send() can't be used if .attach() or .field() is used. Please use only .send() or only .field() & .attach()");
28382 }
28383
28384 if (isObj && !this._data) {
28385 if (Array.isArray(data)) {
28386 this._data = [];
28387 } else if (!this._isHost(data)) {
28388 this._data = {};
28389 }
28390 } else if (data && this._data && this._isHost(this._data)) {
28391 throw new Error("Can't merge these send calls");
28392 } // merge
28393
28394
28395 if (isObj && isObject(this._data)) {
28396 for (var key in data) {
28397 if (Object.prototype.hasOwnProperty.call(data, key)) this._data[key] = data[key];
28398 }
28399 } else if (typeof data === 'string') {
28400 // default to x-www-form-urlencoded
28401 if (!type) this.type('form');
28402 type = this._header['content-type'];
28403
28404 if (type === 'application/x-www-form-urlencoded') {
28405 var _context2;
28406
28407 this._data = this._data ? (0, _concat.default)(_context2 = "".concat(this._data, "&")).call(_context2, data) : data;
28408 } else {
28409 this._data = (this._data || '') + data;
28410 }
28411 } else {
28412 this._data = data;
28413 }
28414
28415 if (!isObj || this._isHost(data)) {
28416 return this;
28417 } // default to json
28418
28419
28420 if (!type) this.type('json');
28421 return this;
28422};
28423/**
28424 * Sort `querystring` by the sort function
28425 *
28426 *
28427 * Examples:
28428 *
28429 * // default order
28430 * request.get('/user')
28431 * .query('name=Nick')
28432 * .query('search=Manny')
28433 * .sortQuery()
28434 * .end(callback)
28435 *
28436 * // customized sort function
28437 * request.get('/user')
28438 * .query('name=Nick')
28439 * .query('search=Manny')
28440 * .sortQuery(function(a, b){
28441 * return a.length - b.length;
28442 * })
28443 * .end(callback)
28444 *
28445 *
28446 * @param {Function} sort
28447 * @return {Request} for chaining
28448 * @api public
28449 */
28450
28451
28452RequestBase.prototype.sortQuery = function (sort) {
28453 // _sort default to true but otherwise can be a function or boolean
28454 this._sort = typeof sort === 'undefined' ? true : sort;
28455 return this;
28456};
28457/**
28458 * Compose querystring to append to req.url
28459 *
28460 * @api private
28461 */
28462
28463
28464RequestBase.prototype._finalizeQueryString = function () {
28465 var query = this._query.join('&');
28466
28467 if (query) {
28468 var _context3;
28469
28470 this.url += ((0, _includes.default)(_context3 = this.url).call(_context3, '?') ? '&' : '?') + query;
28471 }
28472
28473 this._query.length = 0; // Makes the call idempotent
28474
28475 if (this._sort) {
28476 var _context4;
28477
28478 var index = (0, _indexOf.default)(_context4 = this.url).call(_context4, '?');
28479
28480 if (index >= 0) {
28481 var _context5, _context6;
28482
28483 var queryArr = (0, _slice.default)(_context5 = this.url).call(_context5, index + 1).split('&');
28484
28485 if (typeof this._sort === 'function') {
28486 (0, _sort.default)(queryArr).call(queryArr, this._sort);
28487 } else {
28488 (0, _sort.default)(queryArr).call(queryArr);
28489 }
28490
28491 this.url = (0, _slice.default)(_context6 = this.url).call(_context6, 0, index) + '?' + queryArr.join('&');
28492 }
28493 }
28494}; // For backwards compat only
28495
28496
28497RequestBase.prototype._appendQueryString = function () {
28498 console.warn('Unsupported');
28499};
28500/**
28501 * Invoke callback with timeout error.
28502 *
28503 * @api private
28504 */
28505
28506
28507RequestBase.prototype._timeoutError = function (reason, timeout, errno) {
28508 if (this._aborted) {
28509 return;
28510 }
28511
28512 var err = new Error("".concat(reason + timeout, "ms exceeded"));
28513 err.timeout = timeout;
28514 err.code = 'ECONNABORTED';
28515 err.errno = errno;
28516 this.timedout = true;
28517 this.timedoutError = err;
28518 this.abort();
28519 this.callback(err);
28520};
28521
28522RequestBase.prototype._setTimeouts = function () {
28523 var self = this; // deadline
28524
28525 if (this._timeout && !this._timer) {
28526 this._timer = setTimeout(function () {
28527 self._timeoutError('Timeout of ', self._timeout, 'ETIME');
28528 }, this._timeout);
28529 } // response timeout
28530
28531
28532 if (this._responseTimeout && !this._responseTimeoutTimer) {
28533 this._responseTimeoutTimer = setTimeout(function () {
28534 self._timeoutError('Response timeout of ', self._responseTimeout, 'ETIMEDOUT');
28535 }, this._responseTimeout);
28536 }
28537};
28538
28539/***/ }),
28540/* 586 */
28541/***/ (function(module, exports, __webpack_require__) {
28542
28543module.exports = __webpack_require__(587);
28544
28545/***/ }),
28546/* 587 */
28547/***/ (function(module, exports, __webpack_require__) {
28548
28549var parent = __webpack_require__(588);
28550
28551module.exports = parent;
28552
28553
28554/***/ }),
28555/* 588 */
28556/***/ (function(module, exports, __webpack_require__) {
28557
28558var isPrototypeOf = __webpack_require__(16);
28559var arrayMethod = __webpack_require__(589);
28560var stringMethod = __webpack_require__(591);
28561
28562var ArrayPrototype = Array.prototype;
28563var StringPrototype = String.prototype;
28564
28565module.exports = function (it) {
28566 var own = it.includes;
28567 if (it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.includes)) return arrayMethod;
28568 if (typeof it == 'string' || it === StringPrototype || (isPrototypeOf(StringPrototype, it) && own === StringPrototype.includes)) {
28569 return stringMethod;
28570 } return own;
28571};
28572
28573
28574/***/ }),
28575/* 589 */
28576/***/ (function(module, exports, __webpack_require__) {
28577
28578__webpack_require__(590);
28579var entryVirtual = __webpack_require__(27);
28580
28581module.exports = entryVirtual('Array').includes;
28582
28583
28584/***/ }),
28585/* 590 */
28586/***/ (function(module, exports, __webpack_require__) {
28587
28588"use strict";
28589
28590var $ = __webpack_require__(0);
28591var $includes = __webpack_require__(125).includes;
28592var fails = __webpack_require__(2);
28593var addToUnscopables = __webpack_require__(131);
28594
28595// FF99+ bug
28596var BROKEN_ON_SPARSE = fails(function () {
28597 return !Array(1).includes();
28598});
28599
28600// `Array.prototype.includes` method
28601// https://tc39.es/ecma262/#sec-array.prototype.includes
28602$({ target: 'Array', proto: true, forced: BROKEN_ON_SPARSE }, {
28603 includes: function includes(el /* , fromIndex = 0 */) {
28604 return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined);
28605 }
28606});
28607
28608// https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
28609addToUnscopables('includes');
28610
28611
28612/***/ }),
28613/* 591 */
28614/***/ (function(module, exports, __webpack_require__) {
28615
28616__webpack_require__(592);
28617var entryVirtual = __webpack_require__(27);
28618
28619module.exports = entryVirtual('String').includes;
28620
28621
28622/***/ }),
28623/* 592 */
28624/***/ (function(module, exports, __webpack_require__) {
28625
28626"use strict";
28627
28628var $ = __webpack_require__(0);
28629var uncurryThis = __webpack_require__(4);
28630var notARegExp = __webpack_require__(593);
28631var requireObjectCoercible = __webpack_require__(81);
28632var toString = __webpack_require__(42);
28633var correctIsRegExpLogic = __webpack_require__(595);
28634
28635var stringIndexOf = uncurryThis(''.indexOf);
28636
28637// `String.prototype.includes` method
28638// https://tc39.es/ecma262/#sec-string.prototype.includes
28639$({ target: 'String', proto: true, forced: !correctIsRegExpLogic('includes') }, {
28640 includes: function includes(searchString /* , position = 0 */) {
28641 return !!~stringIndexOf(
28642 toString(requireObjectCoercible(this)),
28643 toString(notARegExp(searchString)),
28644 arguments.length > 1 ? arguments[1] : undefined
28645 );
28646 }
28647});
28648
28649
28650/***/ }),
28651/* 593 */
28652/***/ (function(module, exports, __webpack_require__) {
28653
28654var isRegExp = __webpack_require__(594);
28655
28656var $TypeError = TypeError;
28657
28658module.exports = function (it) {
28659 if (isRegExp(it)) {
28660 throw $TypeError("The method doesn't accept regular expressions");
28661 } return it;
28662};
28663
28664
28665/***/ }),
28666/* 594 */
28667/***/ (function(module, exports, __webpack_require__) {
28668
28669var isObject = __webpack_require__(11);
28670var classof = __webpack_require__(50);
28671var wellKnownSymbol = __webpack_require__(5);
28672
28673var MATCH = wellKnownSymbol('match');
28674
28675// `IsRegExp` abstract operation
28676// https://tc39.es/ecma262/#sec-isregexp
28677module.exports = function (it) {
28678 var isRegExp;
28679 return isObject(it) && ((isRegExp = it[MATCH]) !== undefined ? !!isRegExp : classof(it) == 'RegExp');
28680};
28681
28682
28683/***/ }),
28684/* 595 */
28685/***/ (function(module, exports, __webpack_require__) {
28686
28687var wellKnownSymbol = __webpack_require__(5);
28688
28689var MATCH = wellKnownSymbol('match');
28690
28691module.exports = function (METHOD_NAME) {
28692 var regexp = /./;
28693 try {
28694 '/./'[METHOD_NAME](regexp);
28695 } catch (error1) {
28696 try {
28697 regexp[MATCH] = false;
28698 return '/./'[METHOD_NAME](regexp);
28699 } catch (error2) { /* empty */ }
28700 } return false;
28701};
28702
28703
28704/***/ }),
28705/* 596 */
28706/***/ (function(module, exports, __webpack_require__) {
28707
28708module.exports = __webpack_require__(597);
28709
28710/***/ }),
28711/* 597 */
28712/***/ (function(module, exports, __webpack_require__) {
28713
28714var parent = __webpack_require__(598);
28715
28716module.exports = parent;
28717
28718
28719/***/ }),
28720/* 598 */
28721/***/ (function(module, exports, __webpack_require__) {
28722
28723var isPrototypeOf = __webpack_require__(16);
28724var method = __webpack_require__(599);
28725
28726var ArrayPrototype = Array.prototype;
28727
28728module.exports = function (it) {
28729 var own = it.sort;
28730 return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.sort) ? method : own;
28731};
28732
28733
28734/***/ }),
28735/* 599 */
28736/***/ (function(module, exports, __webpack_require__) {
28737
28738__webpack_require__(600);
28739var entryVirtual = __webpack_require__(27);
28740
28741module.exports = entryVirtual('Array').sort;
28742
28743
28744/***/ }),
28745/* 600 */
28746/***/ (function(module, exports, __webpack_require__) {
28747
28748"use strict";
28749
28750var $ = __webpack_require__(0);
28751var uncurryThis = __webpack_require__(4);
28752var aCallable = __webpack_require__(29);
28753var toObject = __webpack_require__(33);
28754var lengthOfArrayLike = __webpack_require__(40);
28755var deletePropertyOrThrow = __webpack_require__(601);
28756var toString = __webpack_require__(42);
28757var fails = __webpack_require__(2);
28758var internalSort = __webpack_require__(602);
28759var arrayMethodIsStrict = __webpack_require__(150);
28760var FF = __webpack_require__(603);
28761var IE_OR_EDGE = __webpack_require__(604);
28762var V8 = __webpack_require__(66);
28763var WEBKIT = __webpack_require__(605);
28764
28765var test = [];
28766var un$Sort = uncurryThis(test.sort);
28767var push = uncurryThis(test.push);
28768
28769// IE8-
28770var FAILS_ON_UNDEFINED = fails(function () {
28771 test.sort(undefined);
28772});
28773// V8 bug
28774var FAILS_ON_NULL = fails(function () {
28775 test.sort(null);
28776});
28777// Old WebKit
28778var STRICT_METHOD = arrayMethodIsStrict('sort');
28779
28780var STABLE_SORT = !fails(function () {
28781 // feature detection can be too slow, so check engines versions
28782 if (V8) return V8 < 70;
28783 if (FF && FF > 3) return;
28784 if (IE_OR_EDGE) return true;
28785 if (WEBKIT) return WEBKIT < 603;
28786
28787 var result = '';
28788 var code, chr, value, index;
28789
28790 // generate an array with more 512 elements (Chakra and old V8 fails only in this case)
28791 for (code = 65; code < 76; code++) {
28792 chr = String.fromCharCode(code);
28793
28794 switch (code) {
28795 case 66: case 69: case 70: case 72: value = 3; break;
28796 case 68: case 71: value = 4; break;
28797 default: value = 2;
28798 }
28799
28800 for (index = 0; index < 47; index++) {
28801 test.push({ k: chr + index, v: value });
28802 }
28803 }
28804
28805 test.sort(function (a, b) { return b.v - a.v; });
28806
28807 for (index = 0; index < test.length; index++) {
28808 chr = test[index].k.charAt(0);
28809 if (result.charAt(result.length - 1) !== chr) result += chr;
28810 }
28811
28812 return result !== 'DGBEFHACIJK';
28813});
28814
28815var FORCED = FAILS_ON_UNDEFINED || !FAILS_ON_NULL || !STRICT_METHOD || !STABLE_SORT;
28816
28817var getSortCompare = function (comparefn) {
28818 return function (x, y) {
28819 if (y === undefined) return -1;
28820 if (x === undefined) return 1;
28821 if (comparefn !== undefined) return +comparefn(x, y) || 0;
28822 return toString(x) > toString(y) ? 1 : -1;
28823 };
28824};
28825
28826// `Array.prototype.sort` method
28827// https://tc39.es/ecma262/#sec-array.prototype.sort
28828$({ target: 'Array', proto: true, forced: FORCED }, {
28829 sort: function sort(comparefn) {
28830 if (comparefn !== undefined) aCallable(comparefn);
28831
28832 var array = toObject(this);
28833
28834 if (STABLE_SORT) return comparefn === undefined ? un$Sort(array) : un$Sort(array, comparefn);
28835
28836 var items = [];
28837 var arrayLength = lengthOfArrayLike(array);
28838 var itemsLength, index;
28839
28840 for (index = 0; index < arrayLength; index++) {
28841 if (index in array) push(items, array[index]);
28842 }
28843
28844 internalSort(items, getSortCompare(comparefn));
28845
28846 itemsLength = items.length;
28847 index = 0;
28848
28849 while (index < itemsLength) array[index] = items[index++];
28850 while (index < arrayLength) deletePropertyOrThrow(array, index++);
28851
28852 return array;
28853 }
28854});
28855
28856
28857/***/ }),
28858/* 601 */
28859/***/ (function(module, exports, __webpack_require__) {
28860
28861"use strict";
28862
28863var tryToString = __webpack_require__(67);
28864
28865var $TypeError = TypeError;
28866
28867module.exports = function (O, P) {
28868 if (!delete O[P]) throw $TypeError('Cannot delete property ' + tryToString(P) + ' of ' + tryToString(O));
28869};
28870
28871
28872/***/ }),
28873/* 602 */
28874/***/ (function(module, exports, __webpack_require__) {
28875
28876var arraySlice = __webpack_require__(244);
28877
28878var floor = Math.floor;
28879
28880var mergeSort = function (array, comparefn) {
28881 var length = array.length;
28882 var middle = floor(length / 2);
28883 return length < 8 ? insertionSort(array, comparefn) : merge(
28884 array,
28885 mergeSort(arraySlice(array, 0, middle), comparefn),
28886 mergeSort(arraySlice(array, middle), comparefn),
28887 comparefn
28888 );
28889};
28890
28891var insertionSort = function (array, comparefn) {
28892 var length = array.length;
28893 var i = 1;
28894 var element, j;
28895
28896 while (i < length) {
28897 j = i;
28898 element = array[i];
28899 while (j && comparefn(array[j - 1], element) > 0) {
28900 array[j] = array[--j];
28901 }
28902 if (j !== i++) array[j] = element;
28903 } return array;
28904};
28905
28906var merge = function (array, left, right, comparefn) {
28907 var llength = left.length;
28908 var rlength = right.length;
28909 var lindex = 0;
28910 var rindex = 0;
28911
28912 while (lindex < llength || rindex < rlength) {
28913 array[lindex + rindex] = (lindex < llength && rindex < rlength)
28914 ? comparefn(left[lindex], right[rindex]) <= 0 ? left[lindex++] : right[rindex++]
28915 : lindex < llength ? left[lindex++] : right[rindex++];
28916 } return array;
28917};
28918
28919module.exports = mergeSort;
28920
28921
28922/***/ }),
28923/* 603 */
28924/***/ (function(module, exports, __webpack_require__) {
28925
28926var userAgent = __webpack_require__(51);
28927
28928var firefox = userAgent.match(/firefox\/(\d+)/i);
28929
28930module.exports = !!firefox && +firefox[1];
28931
28932
28933/***/ }),
28934/* 604 */
28935/***/ (function(module, exports, __webpack_require__) {
28936
28937var UA = __webpack_require__(51);
28938
28939module.exports = /MSIE|Trident/.test(UA);
28940
28941
28942/***/ }),
28943/* 605 */
28944/***/ (function(module, exports, __webpack_require__) {
28945
28946var userAgent = __webpack_require__(51);
28947
28948var webkit = userAgent.match(/AppleWebKit\/(\d+)\./);
28949
28950module.exports = !!webkit && +webkit[1];
28951
28952
28953/***/ }),
28954/* 606 */
28955/***/ (function(module, exports, __webpack_require__) {
28956
28957"use strict";
28958
28959/**
28960 * Module dependencies.
28961 */
28962
28963var utils = __webpack_require__(607);
28964/**
28965 * Expose `ResponseBase`.
28966 */
28967
28968
28969module.exports = ResponseBase;
28970/**
28971 * Initialize a new `ResponseBase`.
28972 *
28973 * @api public
28974 */
28975
28976function ResponseBase(obj) {
28977 if (obj) return mixin(obj);
28978}
28979/**
28980 * Mixin the prototype properties.
28981 *
28982 * @param {Object} obj
28983 * @return {Object}
28984 * @api private
28985 */
28986
28987
28988function mixin(obj) {
28989 for (var key in ResponseBase.prototype) {
28990 if (Object.prototype.hasOwnProperty.call(ResponseBase.prototype, key)) obj[key] = ResponseBase.prototype[key];
28991 }
28992
28993 return obj;
28994}
28995/**
28996 * Get case-insensitive `field` value.
28997 *
28998 * @param {String} field
28999 * @return {String}
29000 * @api public
29001 */
29002
29003
29004ResponseBase.prototype.get = function (field) {
29005 return this.header[field.toLowerCase()];
29006};
29007/**
29008 * Set header related properties:
29009 *
29010 * - `.type` the content type without params
29011 *
29012 * A response of "Content-Type: text/plain; charset=utf-8"
29013 * will provide you with a `.type` of "text/plain".
29014 *
29015 * @param {Object} header
29016 * @api private
29017 */
29018
29019
29020ResponseBase.prototype._setHeaderProperties = function (header) {
29021 // TODO: moar!
29022 // TODO: make this a util
29023 // content-type
29024 var ct = header['content-type'] || '';
29025 this.type = utils.type(ct); // params
29026
29027 var params = utils.params(ct);
29028
29029 for (var key in params) {
29030 if (Object.prototype.hasOwnProperty.call(params, key)) this[key] = params[key];
29031 }
29032
29033 this.links = {}; // links
29034
29035 try {
29036 if (header.link) {
29037 this.links = utils.parseLinks(header.link);
29038 }
29039 } catch (_unused) {// ignore
29040 }
29041};
29042/**
29043 * Set flags such as `.ok` based on `status`.
29044 *
29045 * For example a 2xx response will give you a `.ok` of __true__
29046 * whereas 5xx will be __false__ and `.error` will be __true__. The
29047 * `.clientError` and `.serverError` are also available to be more
29048 * specific, and `.statusType` is the class of error ranging from 1..5
29049 * sometimes useful for mapping respond colors etc.
29050 *
29051 * "sugar" properties are also defined for common cases. Currently providing:
29052 *
29053 * - .noContent
29054 * - .badRequest
29055 * - .unauthorized
29056 * - .notAcceptable
29057 * - .notFound
29058 *
29059 * @param {Number} status
29060 * @api private
29061 */
29062
29063
29064ResponseBase.prototype._setStatusProperties = function (status) {
29065 var type = status / 100 | 0; // status / class
29066
29067 this.statusCode = status;
29068 this.status = this.statusCode;
29069 this.statusType = type; // basics
29070
29071 this.info = type === 1;
29072 this.ok = type === 2;
29073 this.redirect = type === 3;
29074 this.clientError = type === 4;
29075 this.serverError = type === 5;
29076 this.error = type === 4 || type === 5 ? this.toError() : false; // sugar
29077
29078 this.created = status === 201;
29079 this.accepted = status === 202;
29080 this.noContent = status === 204;
29081 this.badRequest = status === 400;
29082 this.unauthorized = status === 401;
29083 this.notAcceptable = status === 406;
29084 this.forbidden = status === 403;
29085 this.notFound = status === 404;
29086 this.unprocessableEntity = status === 422;
29087};
29088
29089/***/ }),
29090/* 607 */
29091/***/ (function(module, exports, __webpack_require__) {
29092
29093"use strict";
29094
29095/**
29096 * Return the mime type for the given `str`.
29097 *
29098 * @param {String} str
29099 * @return {String}
29100 * @api private
29101 */
29102
29103var _interopRequireDefault = __webpack_require__(1);
29104
29105var _reduce = _interopRequireDefault(__webpack_require__(261));
29106
29107var _slice = _interopRequireDefault(__webpack_require__(34));
29108
29109exports.type = function (str) {
29110 return str.split(/ *; */).shift();
29111};
29112/**
29113 * Return header field parameters.
29114 *
29115 * @param {String} str
29116 * @return {Object}
29117 * @api private
29118 */
29119
29120
29121exports.params = function (str) {
29122 var _context;
29123
29124 return (0, _reduce.default)(_context = str.split(/ *; */)).call(_context, function (obj, str) {
29125 var parts = str.split(/ *= */);
29126 var key = parts.shift();
29127 var val = parts.shift();
29128 if (key && val) obj[key] = val;
29129 return obj;
29130 }, {});
29131};
29132/**
29133 * Parse Link header fields.
29134 *
29135 * @param {String} str
29136 * @return {Object}
29137 * @api private
29138 */
29139
29140
29141exports.parseLinks = function (str) {
29142 var _context2;
29143
29144 return (0, _reduce.default)(_context2 = str.split(/ *, */)).call(_context2, function (obj, str) {
29145 var _context3, _context4;
29146
29147 var parts = str.split(/ *; */);
29148 var url = (0, _slice.default)(_context3 = parts[0]).call(_context3, 1, -1);
29149 var rel = (0, _slice.default)(_context4 = parts[1].split(/ *= */)[1]).call(_context4, 1, -1);
29150 obj[rel] = url;
29151 return obj;
29152 }, {});
29153};
29154/**
29155 * Strip content related fields from `header`.
29156 *
29157 * @param {Object} header
29158 * @return {Object} header
29159 * @api private
29160 */
29161
29162
29163exports.cleanHeader = function (header, changesOrigin) {
29164 delete header['content-type'];
29165 delete header['content-length'];
29166 delete header['transfer-encoding'];
29167 delete header.host; // secuirty
29168
29169 if (changesOrigin) {
29170 delete header.authorization;
29171 delete header.cookie;
29172 }
29173
29174 return header;
29175};
29176
29177/***/ }),
29178/* 608 */
29179/***/ (function(module, exports, __webpack_require__) {
29180
29181var parent = __webpack_require__(609);
29182
29183module.exports = parent;
29184
29185
29186/***/ }),
29187/* 609 */
29188/***/ (function(module, exports, __webpack_require__) {
29189
29190var isPrototypeOf = __webpack_require__(16);
29191var method = __webpack_require__(610);
29192
29193var ArrayPrototype = Array.prototype;
29194
29195module.exports = function (it) {
29196 var own = it.reduce;
29197 return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.reduce) ? method : own;
29198};
29199
29200
29201/***/ }),
29202/* 610 */
29203/***/ (function(module, exports, __webpack_require__) {
29204
29205__webpack_require__(611);
29206var entryVirtual = __webpack_require__(27);
29207
29208module.exports = entryVirtual('Array').reduce;
29209
29210
29211/***/ }),
29212/* 611 */
29213/***/ (function(module, exports, __webpack_require__) {
29214
29215"use strict";
29216
29217var $ = __webpack_require__(0);
29218var $reduce = __webpack_require__(612).left;
29219var arrayMethodIsStrict = __webpack_require__(150);
29220var CHROME_VERSION = __webpack_require__(66);
29221var IS_NODE = __webpack_require__(109);
29222
29223var STRICT_METHOD = arrayMethodIsStrict('reduce');
29224// Chrome 80-82 has a critical bug
29225// https://bugs.chromium.org/p/chromium/issues/detail?id=1049982
29226var CHROME_BUG = !IS_NODE && CHROME_VERSION > 79 && CHROME_VERSION < 83;
29227
29228// `Array.prototype.reduce` method
29229// https://tc39.es/ecma262/#sec-array.prototype.reduce
29230$({ target: 'Array', proto: true, forced: !STRICT_METHOD || CHROME_BUG }, {
29231 reduce: function reduce(callbackfn /* , initialValue */) {
29232 var length = arguments.length;
29233 return $reduce(this, callbackfn, length, length > 1 ? arguments[1] : undefined);
29234 }
29235});
29236
29237
29238/***/ }),
29239/* 612 */
29240/***/ (function(module, exports, __webpack_require__) {
29241
29242var aCallable = __webpack_require__(29);
29243var toObject = __webpack_require__(33);
29244var IndexedObject = __webpack_require__(98);
29245var lengthOfArrayLike = __webpack_require__(40);
29246
29247var $TypeError = TypeError;
29248
29249// `Array.prototype.{ reduce, reduceRight }` methods implementation
29250var createMethod = function (IS_RIGHT) {
29251 return function (that, callbackfn, argumentsLength, memo) {
29252 aCallable(callbackfn);
29253 var O = toObject(that);
29254 var self = IndexedObject(O);
29255 var length = lengthOfArrayLike(O);
29256 var index = IS_RIGHT ? length - 1 : 0;
29257 var i = IS_RIGHT ? -1 : 1;
29258 if (argumentsLength < 2) while (true) {
29259 if (index in self) {
29260 memo = self[index];
29261 index += i;
29262 break;
29263 }
29264 index += i;
29265 if (IS_RIGHT ? index < 0 : length <= index) {
29266 throw $TypeError('Reduce of empty array with no initial value');
29267 }
29268 }
29269 for (;IS_RIGHT ? index >= 0 : length > index; index += i) if (index in self) {
29270 memo = callbackfn(memo, self[index], index, O);
29271 }
29272 return memo;
29273 };
29274};
29275
29276module.exports = {
29277 // `Array.prototype.reduce` method
29278 // https://tc39.es/ecma262/#sec-array.prototype.reduce
29279 left: createMethod(false),
29280 // `Array.prototype.reduceRight` method
29281 // https://tc39.es/ecma262/#sec-array.prototype.reduceright
29282 right: createMethod(true)
29283};
29284
29285
29286/***/ }),
29287/* 613 */
29288/***/ (function(module, exports, __webpack_require__) {
29289
29290"use strict";
29291
29292
29293var _interopRequireDefault = __webpack_require__(1);
29294
29295var _slice = _interopRequireDefault(__webpack_require__(34));
29296
29297var _from = _interopRequireDefault(__webpack_require__(152));
29298
29299var _symbol = _interopRequireDefault(__webpack_require__(77));
29300
29301var _isIterable2 = _interopRequireDefault(__webpack_require__(262));
29302
29303function _toConsumableArray(arr) {
29304 return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
29305}
29306
29307function _nonIterableSpread() {
29308 throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
29309}
29310
29311function _unsupportedIterableToArray(o, minLen) {
29312 var _context;
29313
29314 if (!o) return;
29315 if (typeof o === "string") return _arrayLikeToArray(o, minLen);
29316 var n = (0, _slice.default)(_context = Object.prototype.toString.call(o)).call(_context, 8, -1);
29317 if (n === "Object" && o.constructor) n = o.constructor.name;
29318 if (n === "Map" || n === "Set") return (0, _from.default)(o);
29319 if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
29320}
29321
29322function _iterableToArray(iter) {
29323 if (typeof _symbol.default !== "undefined" && (0, _isIterable2.default)(Object(iter))) return (0, _from.default)(iter);
29324}
29325
29326function _arrayWithoutHoles(arr) {
29327 if (Array.isArray(arr)) return _arrayLikeToArray(arr);
29328}
29329
29330function _arrayLikeToArray(arr, len) {
29331 if (len == null || len > arr.length) len = arr.length;
29332
29333 for (var i = 0, arr2 = new Array(len); i < len; i++) {
29334 arr2[i] = arr[i];
29335 }
29336
29337 return arr2;
29338}
29339
29340function Agent() {
29341 this._defaults = [];
29342}
29343
29344['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) {
29345 // Default setting for all requests from this agent
29346 Agent.prototype[fn] = function () {
29347 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
29348 args[_key] = arguments[_key];
29349 }
29350
29351 this._defaults.push({
29352 fn: fn,
29353 args: args
29354 });
29355
29356 return this;
29357 };
29358});
29359
29360Agent.prototype._setDefaults = function (req) {
29361 this._defaults.forEach(function (def) {
29362 req[def.fn].apply(req, _toConsumableArray(def.args));
29363 });
29364};
29365
29366module.exports = Agent;
29367
29368/***/ }),
29369/* 614 */
29370/***/ (function(module, exports, __webpack_require__) {
29371
29372module.exports = __webpack_require__(615);
29373
29374
29375/***/ }),
29376/* 615 */
29377/***/ (function(module, exports, __webpack_require__) {
29378
29379var parent = __webpack_require__(616);
29380
29381module.exports = parent;
29382
29383
29384/***/ }),
29385/* 616 */
29386/***/ (function(module, exports, __webpack_require__) {
29387
29388var parent = __webpack_require__(617);
29389
29390module.exports = parent;
29391
29392
29393/***/ }),
29394/* 617 */
29395/***/ (function(module, exports, __webpack_require__) {
29396
29397var parent = __webpack_require__(618);
29398__webpack_require__(46);
29399
29400module.exports = parent;
29401
29402
29403/***/ }),
29404/* 618 */
29405/***/ (function(module, exports, __webpack_require__) {
29406
29407__webpack_require__(43);
29408__webpack_require__(70);
29409var isIterable = __webpack_require__(619);
29410
29411module.exports = isIterable;
29412
29413
29414/***/ }),
29415/* 619 */
29416/***/ (function(module, exports, __webpack_require__) {
29417
29418var classof = __webpack_require__(55);
29419var hasOwn = __webpack_require__(13);
29420var wellKnownSymbol = __webpack_require__(5);
29421var Iterators = __webpack_require__(54);
29422
29423var ITERATOR = wellKnownSymbol('iterator');
29424var $Object = Object;
29425
29426module.exports = function (it) {
29427 var O = $Object(it);
29428 return O[ITERATOR] !== undefined
29429 || '@@iterator' in O
29430 || hasOwn(Iterators, classof(O));
29431};
29432
29433
29434/***/ }),
29435/* 620 */
29436/***/ (function(module, exports, __webpack_require__) {
29437
29438"use strict";
29439
29440
29441var _require = __webpack_require__(155),
29442 Realtime = _require.Realtime,
29443 setRTMAdapters = _require.setAdapters;
29444
29445var _require2 = __webpack_require__(704),
29446 LiveQueryPlugin = _require2.LiveQueryPlugin;
29447
29448Realtime.__preRegisteredPlugins = [LiveQueryPlugin];
29449
29450module.exports = function (AV) {
29451 AV._sharedConfig.liveQueryRealtime = Realtime;
29452 var setAdapters = AV.setAdapters;
29453
29454 AV.setAdapters = function (adapters) {
29455 setAdapters(adapters);
29456 setRTMAdapters(adapters);
29457 };
29458
29459 return AV;
29460};
29461
29462/***/ }),
29463/* 621 */
29464/***/ (function(module, exports, __webpack_require__) {
29465
29466"use strict";
29467/* WEBPACK VAR INJECTION */(function(global) {
29468
29469var _interopRequireDefault = __webpack_require__(1);
29470
29471var _typeof3 = _interopRequireDefault(__webpack_require__(95));
29472
29473var _defineProperty2 = _interopRequireDefault(__webpack_require__(94));
29474
29475var _freeze = _interopRequireDefault(__webpack_require__(622));
29476
29477var _assign = _interopRequireDefault(__webpack_require__(265));
29478
29479var _symbol = _interopRequireDefault(__webpack_require__(77));
29480
29481var _concat = _interopRequireDefault(__webpack_require__(19));
29482
29483var _keys = _interopRequireDefault(__webpack_require__(149));
29484
29485var _getOwnPropertySymbols = _interopRequireDefault(__webpack_require__(266));
29486
29487var _filter = _interopRequireDefault(__webpack_require__(249));
29488
29489var _getOwnPropertyDescriptor = _interopRequireDefault(__webpack_require__(257));
29490
29491var _getOwnPropertyDescriptors = _interopRequireDefault(__webpack_require__(633));
29492
29493var _defineProperties = _interopRequireDefault(__webpack_require__(637));
29494
29495var _promise = _interopRequireDefault(__webpack_require__(12));
29496
29497var _slice = _interopRequireDefault(__webpack_require__(34));
29498
29499var _indexOf = _interopRequireDefault(__webpack_require__(61));
29500
29501var _weakMap = _interopRequireDefault(__webpack_require__(641));
29502
29503var _stringify = _interopRequireDefault(__webpack_require__(38));
29504
29505var _map = _interopRequireDefault(__webpack_require__(37));
29506
29507var _reduce = _interopRequireDefault(__webpack_require__(261));
29508
29509var _find = _interopRequireDefault(__webpack_require__(96));
29510
29511var _set = _interopRequireDefault(__webpack_require__(268));
29512
29513var _context6, _context15;
29514
29515(0, _defineProperty2.default)(exports, '__esModule', {
29516 value: true
29517});
29518
29519function _interopDefault(ex) {
29520 return ex && (0, _typeof3.default)(ex) === 'object' && 'default' in ex ? ex['default'] : ex;
29521}
29522
29523var protobufLight = _interopDefault(__webpack_require__(652));
29524
29525var EventEmitter = _interopDefault(__webpack_require__(656));
29526
29527var _regeneratorRuntime = _interopDefault(__webpack_require__(657));
29528
29529var _asyncToGenerator = _interopDefault(__webpack_require__(659));
29530
29531var _toConsumableArray = _interopDefault(__webpack_require__(660));
29532
29533var _defineProperty = _interopDefault(__webpack_require__(663));
29534
29535var _objectWithoutProperties = _interopDefault(__webpack_require__(664));
29536
29537var _assertThisInitialized = _interopDefault(__webpack_require__(666));
29538
29539var _inheritsLoose = _interopDefault(__webpack_require__(667));
29540
29541var d = _interopDefault(__webpack_require__(63));
29542
29543var shuffle = _interopDefault(__webpack_require__(668));
29544
29545var values = _interopDefault(__webpack_require__(273));
29546
29547var _toArray = _interopDefault(__webpack_require__(695));
29548
29549var _createClass = _interopDefault(__webpack_require__(698));
29550
29551var _applyDecoratedDescriptor = _interopDefault(__webpack_require__(699));
29552
29553var StateMachine = _interopDefault(__webpack_require__(700));
29554
29555var _typeof = _interopDefault(__webpack_require__(701));
29556
29557var isPlainObject = _interopDefault(__webpack_require__(702));
29558
29559var promiseTimeout = __webpack_require__(250);
29560
29561var messageCompiled = protobufLight.newBuilder({})['import']({
29562 "package": 'push_server.messages2',
29563 syntax: 'proto2',
29564 options: {
29565 objc_class_prefix: 'AVIM'
29566 },
29567 messages: [{
29568 name: 'JsonObjectMessage',
29569 syntax: 'proto2',
29570 fields: [{
29571 rule: 'required',
29572 type: 'string',
29573 name: 'data',
29574 id: 1
29575 }]
29576 }, {
29577 name: 'UnreadTuple',
29578 syntax: 'proto2',
29579 fields: [{
29580 rule: 'required',
29581 type: 'string',
29582 name: 'cid',
29583 id: 1
29584 }, {
29585 rule: 'required',
29586 type: 'int32',
29587 name: 'unread',
29588 id: 2
29589 }, {
29590 rule: 'optional',
29591 type: 'string',
29592 name: 'mid',
29593 id: 3
29594 }, {
29595 rule: 'optional',
29596 type: 'int64',
29597 name: 'timestamp',
29598 id: 4
29599 }, {
29600 rule: 'optional',
29601 type: 'string',
29602 name: 'from',
29603 id: 5
29604 }, {
29605 rule: 'optional',
29606 type: 'string',
29607 name: 'data',
29608 id: 6
29609 }, {
29610 rule: 'optional',
29611 type: 'int64',
29612 name: 'patchTimestamp',
29613 id: 7
29614 }, {
29615 rule: 'optional',
29616 type: 'bool',
29617 name: 'mentioned',
29618 id: 8
29619 }, {
29620 rule: 'optional',
29621 type: 'bytes',
29622 name: 'binaryMsg',
29623 id: 9
29624 }, {
29625 rule: 'optional',
29626 type: 'int32',
29627 name: 'convType',
29628 id: 10
29629 }]
29630 }, {
29631 name: 'LogItem',
29632 syntax: 'proto2',
29633 fields: [{
29634 rule: 'optional',
29635 type: 'string',
29636 name: 'from',
29637 id: 1
29638 }, {
29639 rule: 'optional',
29640 type: 'string',
29641 name: 'data',
29642 id: 2
29643 }, {
29644 rule: 'optional',
29645 type: 'int64',
29646 name: 'timestamp',
29647 id: 3
29648 }, {
29649 rule: 'optional',
29650 type: 'string',
29651 name: 'msgId',
29652 id: 4
29653 }, {
29654 rule: 'optional',
29655 type: 'int64',
29656 name: 'ackAt',
29657 id: 5
29658 }, {
29659 rule: 'optional',
29660 type: 'int64',
29661 name: 'readAt',
29662 id: 6
29663 }, {
29664 rule: 'optional',
29665 type: 'int64',
29666 name: 'patchTimestamp',
29667 id: 7
29668 }, {
29669 rule: 'optional',
29670 type: 'bool',
29671 name: 'mentionAll',
29672 id: 8
29673 }, {
29674 rule: 'repeated',
29675 type: 'string',
29676 name: 'mentionPids',
29677 id: 9
29678 }, {
29679 rule: 'optional',
29680 type: 'bool',
29681 name: 'bin',
29682 id: 10
29683 }, {
29684 rule: 'optional',
29685 type: 'int32',
29686 name: 'convType',
29687 id: 11
29688 }]
29689 }, {
29690 name: 'ConvMemberInfo',
29691 syntax: 'proto2',
29692 fields: [{
29693 rule: 'optional',
29694 type: 'string',
29695 name: 'pid',
29696 id: 1
29697 }, {
29698 rule: 'optional',
29699 type: 'string',
29700 name: 'role',
29701 id: 2
29702 }, {
29703 rule: 'optional',
29704 type: 'string',
29705 name: 'infoId',
29706 id: 3
29707 }]
29708 }, {
29709 name: 'DataCommand',
29710 syntax: 'proto2',
29711 fields: [{
29712 rule: 'repeated',
29713 type: 'string',
29714 name: 'ids',
29715 id: 1
29716 }, {
29717 rule: 'repeated',
29718 type: 'JsonObjectMessage',
29719 name: 'msg',
29720 id: 2
29721 }, {
29722 rule: 'optional',
29723 type: 'bool',
29724 name: 'offline',
29725 id: 3
29726 }]
29727 }, {
29728 name: 'SessionCommand',
29729 syntax: 'proto2',
29730 fields: [{
29731 rule: 'optional',
29732 type: 'int64',
29733 name: 't',
29734 id: 1
29735 }, {
29736 rule: 'optional',
29737 type: 'string',
29738 name: 'n',
29739 id: 2
29740 }, {
29741 rule: 'optional',
29742 type: 'string',
29743 name: 's',
29744 id: 3
29745 }, {
29746 rule: 'optional',
29747 type: 'string',
29748 name: 'ua',
29749 id: 4
29750 }, {
29751 rule: 'optional',
29752 type: 'bool',
29753 name: 'r',
29754 id: 5
29755 }, {
29756 rule: 'optional',
29757 type: 'string',
29758 name: 'tag',
29759 id: 6
29760 }, {
29761 rule: 'optional',
29762 type: 'string',
29763 name: 'deviceId',
29764 id: 7
29765 }, {
29766 rule: 'repeated',
29767 type: 'string',
29768 name: 'sessionPeerIds',
29769 id: 8
29770 }, {
29771 rule: 'repeated',
29772 type: 'string',
29773 name: 'onlineSessionPeerIds',
29774 id: 9
29775 }, {
29776 rule: 'optional',
29777 type: 'string',
29778 name: 'st',
29779 id: 10
29780 }, {
29781 rule: 'optional',
29782 type: 'int32',
29783 name: 'stTtl',
29784 id: 11
29785 }, {
29786 rule: 'optional',
29787 type: 'int32',
29788 name: 'code',
29789 id: 12
29790 }, {
29791 rule: 'optional',
29792 type: 'string',
29793 name: 'reason',
29794 id: 13
29795 }, {
29796 rule: 'optional',
29797 type: 'string',
29798 name: 'deviceToken',
29799 id: 14
29800 }, {
29801 rule: 'optional',
29802 type: 'bool',
29803 name: 'sp',
29804 id: 15
29805 }, {
29806 rule: 'optional',
29807 type: 'string',
29808 name: 'detail',
29809 id: 16
29810 }, {
29811 rule: 'optional',
29812 type: 'int64',
29813 name: 'lastUnreadNotifTime',
29814 id: 17
29815 }, {
29816 rule: 'optional',
29817 type: 'int64',
29818 name: 'lastPatchTime',
29819 id: 18
29820 }, {
29821 rule: 'optional',
29822 type: 'int64',
29823 name: 'configBitmap',
29824 id: 19
29825 }]
29826 }, {
29827 name: 'ErrorCommand',
29828 syntax: 'proto2',
29829 fields: [{
29830 rule: 'required',
29831 type: 'int32',
29832 name: 'code',
29833 id: 1
29834 }, {
29835 rule: 'required',
29836 type: 'string',
29837 name: 'reason',
29838 id: 2
29839 }, {
29840 rule: 'optional',
29841 type: 'int32',
29842 name: 'appCode',
29843 id: 3
29844 }, {
29845 rule: 'optional',
29846 type: 'string',
29847 name: 'detail',
29848 id: 4
29849 }, {
29850 rule: 'repeated',
29851 type: 'string',
29852 name: 'pids',
29853 id: 5
29854 }, {
29855 rule: 'optional',
29856 type: 'string',
29857 name: 'appMsg',
29858 id: 6
29859 }]
29860 }, {
29861 name: 'DirectCommand',
29862 syntax: 'proto2',
29863 fields: [{
29864 rule: 'optional',
29865 type: 'string',
29866 name: 'msg',
29867 id: 1
29868 }, {
29869 rule: 'optional',
29870 type: 'string',
29871 name: 'uid',
29872 id: 2
29873 }, {
29874 rule: 'optional',
29875 type: 'string',
29876 name: 'fromPeerId',
29877 id: 3
29878 }, {
29879 rule: 'optional',
29880 type: 'int64',
29881 name: 'timestamp',
29882 id: 4
29883 }, {
29884 rule: 'optional',
29885 type: 'bool',
29886 name: 'offline',
29887 id: 5
29888 }, {
29889 rule: 'optional',
29890 type: 'bool',
29891 name: 'hasMore',
29892 id: 6
29893 }, {
29894 rule: 'repeated',
29895 type: 'string',
29896 name: 'toPeerIds',
29897 id: 7
29898 }, {
29899 rule: 'optional',
29900 type: 'bool',
29901 name: 'r',
29902 id: 10
29903 }, {
29904 rule: 'optional',
29905 type: 'string',
29906 name: 'cid',
29907 id: 11
29908 }, {
29909 rule: 'optional',
29910 type: 'string',
29911 name: 'id',
29912 id: 12
29913 }, {
29914 rule: 'optional',
29915 type: 'bool',
29916 name: 'transient',
29917 id: 13
29918 }, {
29919 rule: 'optional',
29920 type: 'string',
29921 name: 'dt',
29922 id: 14
29923 }, {
29924 rule: 'optional',
29925 type: 'string',
29926 name: 'roomId',
29927 id: 15
29928 }, {
29929 rule: 'optional',
29930 type: 'string',
29931 name: 'pushData',
29932 id: 16
29933 }, {
29934 rule: 'optional',
29935 type: 'bool',
29936 name: 'will',
29937 id: 17
29938 }, {
29939 rule: 'optional',
29940 type: 'int64',
29941 name: 'patchTimestamp',
29942 id: 18
29943 }, {
29944 rule: 'optional',
29945 type: 'bytes',
29946 name: 'binaryMsg',
29947 id: 19
29948 }, {
29949 rule: 'repeated',
29950 type: 'string',
29951 name: 'mentionPids',
29952 id: 20
29953 }, {
29954 rule: 'optional',
29955 type: 'bool',
29956 name: 'mentionAll',
29957 id: 21
29958 }, {
29959 rule: 'optional',
29960 type: 'int32',
29961 name: 'convType',
29962 id: 22
29963 }]
29964 }, {
29965 name: 'AckCommand',
29966 syntax: 'proto2',
29967 fields: [{
29968 rule: 'optional',
29969 type: 'int32',
29970 name: 'code',
29971 id: 1
29972 }, {
29973 rule: 'optional',
29974 type: 'string',
29975 name: 'reason',
29976 id: 2
29977 }, {
29978 rule: 'optional',
29979 type: 'string',
29980 name: 'mid',
29981 id: 3
29982 }, {
29983 rule: 'optional',
29984 type: 'string',
29985 name: 'cid',
29986 id: 4
29987 }, {
29988 rule: 'optional',
29989 type: 'int64',
29990 name: 't',
29991 id: 5
29992 }, {
29993 rule: 'optional',
29994 type: 'string',
29995 name: 'uid',
29996 id: 6
29997 }, {
29998 rule: 'optional',
29999 type: 'int64',
30000 name: 'fromts',
30001 id: 7
30002 }, {
30003 rule: 'optional',
30004 type: 'int64',
30005 name: 'tots',
30006 id: 8
30007 }, {
30008 rule: 'optional',
30009 type: 'string',
30010 name: 'type',
30011 id: 9
30012 }, {
30013 rule: 'repeated',
30014 type: 'string',
30015 name: 'ids',
30016 id: 10
30017 }, {
30018 rule: 'optional',
30019 type: 'int32',
30020 name: 'appCode',
30021 id: 11
30022 }, {
30023 rule: 'optional',
30024 type: 'string',
30025 name: 'appMsg',
30026 id: 12
30027 }]
30028 }, {
30029 name: 'UnreadCommand',
30030 syntax: 'proto2',
30031 fields: [{
30032 rule: 'repeated',
30033 type: 'UnreadTuple',
30034 name: 'convs',
30035 id: 1
30036 }, {
30037 rule: 'optional',
30038 type: 'int64',
30039 name: 'notifTime',
30040 id: 2
30041 }]
30042 }, {
30043 name: 'ConvCommand',
30044 syntax: 'proto2',
30045 fields: [{
30046 rule: 'repeated',
30047 type: 'string',
30048 name: 'm',
30049 id: 1
30050 }, {
30051 rule: 'optional',
30052 type: 'bool',
30053 name: 'transient',
30054 id: 2
30055 }, {
30056 rule: 'optional',
30057 type: 'bool',
30058 name: 'unique',
30059 id: 3
30060 }, {
30061 rule: 'optional',
30062 type: 'string',
30063 name: 'cid',
30064 id: 4
30065 }, {
30066 rule: 'optional',
30067 type: 'string',
30068 name: 'cdate',
30069 id: 5
30070 }, {
30071 rule: 'optional',
30072 type: 'string',
30073 name: 'initBy',
30074 id: 6
30075 }, {
30076 rule: 'optional',
30077 type: 'string',
30078 name: 'sort',
30079 id: 7
30080 }, {
30081 rule: 'optional',
30082 type: 'int32',
30083 name: 'limit',
30084 id: 8
30085 }, {
30086 rule: 'optional',
30087 type: 'int32',
30088 name: 'skip',
30089 id: 9
30090 }, {
30091 rule: 'optional',
30092 type: 'int32',
30093 name: 'flag',
30094 id: 10
30095 }, {
30096 rule: 'optional',
30097 type: 'int32',
30098 name: 'count',
30099 id: 11
30100 }, {
30101 rule: 'optional',
30102 type: 'string',
30103 name: 'udate',
30104 id: 12
30105 }, {
30106 rule: 'optional',
30107 type: 'int64',
30108 name: 't',
30109 id: 13
30110 }, {
30111 rule: 'optional',
30112 type: 'string',
30113 name: 'n',
30114 id: 14
30115 }, {
30116 rule: 'optional',
30117 type: 'string',
30118 name: 's',
30119 id: 15
30120 }, {
30121 rule: 'optional',
30122 type: 'bool',
30123 name: 'statusSub',
30124 id: 16
30125 }, {
30126 rule: 'optional',
30127 type: 'bool',
30128 name: 'statusPub',
30129 id: 17
30130 }, {
30131 rule: 'optional',
30132 type: 'int32',
30133 name: 'statusTTL',
30134 id: 18
30135 }, {
30136 rule: 'optional',
30137 type: 'string',
30138 name: 'uniqueId',
30139 id: 19
30140 }, {
30141 rule: 'optional',
30142 type: 'string',
30143 name: 'targetClientId',
30144 id: 20
30145 }, {
30146 rule: 'optional',
30147 type: 'int64',
30148 name: 'maxReadTimestamp',
30149 id: 21
30150 }, {
30151 rule: 'optional',
30152 type: 'int64',
30153 name: 'maxAckTimestamp',
30154 id: 22
30155 }, {
30156 rule: 'optional',
30157 type: 'bool',
30158 name: 'queryAllMembers',
30159 id: 23
30160 }, {
30161 rule: 'repeated',
30162 type: 'MaxReadTuple',
30163 name: 'maxReadTuples',
30164 id: 24
30165 }, {
30166 rule: 'repeated',
30167 type: 'string',
30168 name: 'cids',
30169 id: 25
30170 }, {
30171 rule: 'optional',
30172 type: 'ConvMemberInfo',
30173 name: 'info',
30174 id: 26
30175 }, {
30176 rule: 'optional',
30177 type: 'bool',
30178 name: 'tempConv',
30179 id: 27
30180 }, {
30181 rule: 'optional',
30182 type: 'int32',
30183 name: 'tempConvTTL',
30184 id: 28
30185 }, {
30186 rule: 'repeated',
30187 type: 'string',
30188 name: 'tempConvIds',
30189 id: 29
30190 }, {
30191 rule: 'repeated',
30192 type: 'string',
30193 name: 'allowedPids',
30194 id: 30
30195 }, {
30196 rule: 'repeated',
30197 type: 'ErrorCommand',
30198 name: 'failedPids',
30199 id: 31
30200 }, {
30201 rule: 'optional',
30202 type: 'string',
30203 name: 'next',
30204 id: 40
30205 }, {
30206 rule: 'optional',
30207 type: 'JsonObjectMessage',
30208 name: 'results',
30209 id: 100
30210 }, {
30211 rule: 'optional',
30212 type: 'JsonObjectMessage',
30213 name: 'where',
30214 id: 101
30215 }, {
30216 rule: 'optional',
30217 type: 'JsonObjectMessage',
30218 name: 'attr',
30219 id: 103
30220 }, {
30221 rule: 'optional',
30222 type: 'JsonObjectMessage',
30223 name: 'attrModified',
30224 id: 104
30225 }]
30226 }, {
30227 name: 'RoomCommand',
30228 syntax: 'proto2',
30229 fields: [{
30230 rule: 'optional',
30231 type: 'string',
30232 name: 'roomId',
30233 id: 1
30234 }, {
30235 rule: 'optional',
30236 type: 'string',
30237 name: 's',
30238 id: 2
30239 }, {
30240 rule: 'optional',
30241 type: 'int64',
30242 name: 't',
30243 id: 3
30244 }, {
30245 rule: 'optional',
30246 type: 'string',
30247 name: 'n',
30248 id: 4
30249 }, {
30250 rule: 'optional',
30251 type: 'bool',
30252 name: 'transient',
30253 id: 5
30254 }, {
30255 rule: 'repeated',
30256 type: 'string',
30257 name: 'roomPeerIds',
30258 id: 6
30259 }, {
30260 rule: 'optional',
30261 type: 'string',
30262 name: 'byPeerId',
30263 id: 7
30264 }]
30265 }, {
30266 name: 'LogsCommand',
30267 syntax: 'proto2',
30268 fields: [{
30269 rule: 'optional',
30270 type: 'string',
30271 name: 'cid',
30272 id: 1
30273 }, {
30274 rule: 'optional',
30275 type: 'int32',
30276 name: 'l',
30277 id: 2
30278 }, {
30279 rule: 'optional',
30280 type: 'int32',
30281 name: 'limit',
30282 id: 3
30283 }, {
30284 rule: 'optional',
30285 type: 'int64',
30286 name: 't',
30287 id: 4
30288 }, {
30289 rule: 'optional',
30290 type: 'int64',
30291 name: 'tt',
30292 id: 5
30293 }, {
30294 rule: 'optional',
30295 type: 'string',
30296 name: 'tmid',
30297 id: 6
30298 }, {
30299 rule: 'optional',
30300 type: 'string',
30301 name: 'mid',
30302 id: 7
30303 }, {
30304 rule: 'optional',
30305 type: 'string',
30306 name: 'checksum',
30307 id: 8
30308 }, {
30309 rule: 'optional',
30310 type: 'bool',
30311 name: 'stored',
30312 id: 9
30313 }, {
30314 rule: 'optional',
30315 type: 'QueryDirection',
30316 name: 'direction',
30317 id: 10,
30318 options: {
30319 "default": 'OLD'
30320 }
30321 }, {
30322 rule: 'optional',
30323 type: 'bool',
30324 name: 'tIncluded',
30325 id: 11
30326 }, {
30327 rule: 'optional',
30328 type: 'bool',
30329 name: 'ttIncluded',
30330 id: 12
30331 }, {
30332 rule: 'optional',
30333 type: 'int32',
30334 name: 'lctype',
30335 id: 13
30336 }, {
30337 rule: 'repeated',
30338 type: 'LogItem',
30339 name: 'logs',
30340 id: 105
30341 }],
30342 enums: [{
30343 name: 'QueryDirection',
30344 syntax: 'proto2',
30345 values: [{
30346 name: 'OLD',
30347 id: 1
30348 }, {
30349 name: 'NEW',
30350 id: 2
30351 }]
30352 }]
30353 }, {
30354 name: 'RcpCommand',
30355 syntax: 'proto2',
30356 fields: [{
30357 rule: 'optional',
30358 type: 'string',
30359 name: 'id',
30360 id: 1
30361 }, {
30362 rule: 'optional',
30363 type: 'string',
30364 name: 'cid',
30365 id: 2
30366 }, {
30367 rule: 'optional',
30368 type: 'int64',
30369 name: 't',
30370 id: 3
30371 }, {
30372 rule: 'optional',
30373 type: 'bool',
30374 name: 'read',
30375 id: 4
30376 }, {
30377 rule: 'optional',
30378 type: 'string',
30379 name: 'from',
30380 id: 5
30381 }]
30382 }, {
30383 name: 'ReadTuple',
30384 syntax: 'proto2',
30385 fields: [{
30386 rule: 'required',
30387 type: 'string',
30388 name: 'cid',
30389 id: 1
30390 }, {
30391 rule: 'optional',
30392 type: 'int64',
30393 name: 'timestamp',
30394 id: 2
30395 }, {
30396 rule: 'optional',
30397 type: 'string',
30398 name: 'mid',
30399 id: 3
30400 }]
30401 }, {
30402 name: 'MaxReadTuple',
30403 syntax: 'proto2',
30404 fields: [{
30405 rule: 'optional',
30406 type: 'string',
30407 name: 'pid',
30408 id: 1
30409 }, {
30410 rule: 'optional',
30411 type: 'int64',
30412 name: 'maxAckTimestamp',
30413 id: 2
30414 }, {
30415 rule: 'optional',
30416 type: 'int64',
30417 name: 'maxReadTimestamp',
30418 id: 3
30419 }]
30420 }, {
30421 name: 'ReadCommand',
30422 syntax: 'proto2',
30423 fields: [{
30424 rule: 'optional',
30425 type: 'string',
30426 name: 'cid',
30427 id: 1
30428 }, {
30429 rule: 'repeated',
30430 type: 'string',
30431 name: 'cids',
30432 id: 2
30433 }, {
30434 rule: 'repeated',
30435 type: 'ReadTuple',
30436 name: 'convs',
30437 id: 3
30438 }]
30439 }, {
30440 name: 'PresenceCommand',
30441 syntax: 'proto2',
30442 fields: [{
30443 rule: 'optional',
30444 type: 'StatusType',
30445 name: 'status',
30446 id: 1
30447 }, {
30448 rule: 'repeated',
30449 type: 'string',
30450 name: 'sessionPeerIds',
30451 id: 2
30452 }, {
30453 rule: 'optional',
30454 type: 'string',
30455 name: 'cid',
30456 id: 3
30457 }]
30458 }, {
30459 name: 'ReportCommand',
30460 syntax: 'proto2',
30461 fields: [{
30462 rule: 'optional',
30463 type: 'bool',
30464 name: 'initiative',
30465 id: 1
30466 }, {
30467 rule: 'optional',
30468 type: 'string',
30469 name: 'type',
30470 id: 2
30471 }, {
30472 rule: 'optional',
30473 type: 'string',
30474 name: 'data',
30475 id: 3
30476 }]
30477 }, {
30478 name: 'PatchItem',
30479 syntax: 'proto2',
30480 fields: [{
30481 rule: 'optional',
30482 type: 'string',
30483 name: 'cid',
30484 id: 1
30485 }, {
30486 rule: 'optional',
30487 type: 'string',
30488 name: 'mid',
30489 id: 2
30490 }, {
30491 rule: 'optional',
30492 type: 'int64',
30493 name: 'timestamp',
30494 id: 3
30495 }, {
30496 rule: 'optional',
30497 type: 'bool',
30498 name: 'recall',
30499 id: 4
30500 }, {
30501 rule: 'optional',
30502 type: 'string',
30503 name: 'data',
30504 id: 5
30505 }, {
30506 rule: 'optional',
30507 type: 'int64',
30508 name: 'patchTimestamp',
30509 id: 6
30510 }, {
30511 rule: 'optional',
30512 type: 'string',
30513 name: 'from',
30514 id: 7
30515 }, {
30516 rule: 'optional',
30517 type: 'bytes',
30518 name: 'binaryMsg',
30519 id: 8
30520 }, {
30521 rule: 'optional',
30522 type: 'bool',
30523 name: 'mentionAll',
30524 id: 9
30525 }, {
30526 rule: 'repeated',
30527 type: 'string',
30528 name: 'mentionPids',
30529 id: 10
30530 }, {
30531 rule: 'optional',
30532 type: 'int64',
30533 name: 'patchCode',
30534 id: 11
30535 }, {
30536 rule: 'optional',
30537 type: 'string',
30538 name: 'patchReason',
30539 id: 12
30540 }]
30541 }, {
30542 name: 'PatchCommand',
30543 syntax: 'proto2',
30544 fields: [{
30545 rule: 'repeated',
30546 type: 'PatchItem',
30547 name: 'patches',
30548 id: 1
30549 }, {
30550 rule: 'optional',
30551 type: 'int64',
30552 name: 'lastPatchTime',
30553 id: 2
30554 }]
30555 }, {
30556 name: 'PubsubCommand',
30557 syntax: 'proto2',
30558 fields: [{
30559 rule: 'optional',
30560 type: 'string',
30561 name: 'cid',
30562 id: 1
30563 }, {
30564 rule: 'repeated',
30565 type: 'string',
30566 name: 'cids',
30567 id: 2
30568 }, {
30569 rule: 'optional',
30570 type: 'string',
30571 name: 'topic',
30572 id: 3
30573 }, {
30574 rule: 'optional',
30575 type: 'string',
30576 name: 'subtopic',
30577 id: 4
30578 }, {
30579 rule: 'repeated',
30580 type: 'string',
30581 name: 'topics',
30582 id: 5
30583 }, {
30584 rule: 'repeated',
30585 type: 'string',
30586 name: 'subtopics',
30587 id: 6
30588 }, {
30589 rule: 'optional',
30590 type: 'JsonObjectMessage',
30591 name: 'results',
30592 id: 7
30593 }]
30594 }, {
30595 name: 'BlacklistCommand',
30596 syntax: 'proto2',
30597 fields: [{
30598 rule: 'optional',
30599 type: 'string',
30600 name: 'srcCid',
30601 id: 1
30602 }, {
30603 rule: 'repeated',
30604 type: 'string',
30605 name: 'toPids',
30606 id: 2
30607 }, {
30608 rule: 'optional',
30609 type: 'string',
30610 name: 'srcPid',
30611 id: 3
30612 }, {
30613 rule: 'repeated',
30614 type: 'string',
30615 name: 'toCids',
30616 id: 4
30617 }, {
30618 rule: 'optional',
30619 type: 'int32',
30620 name: 'limit',
30621 id: 5
30622 }, {
30623 rule: 'optional',
30624 type: 'string',
30625 name: 'next',
30626 id: 6
30627 }, {
30628 rule: 'repeated',
30629 type: 'string',
30630 name: 'blockedPids',
30631 id: 8
30632 }, {
30633 rule: 'repeated',
30634 type: 'string',
30635 name: 'blockedCids',
30636 id: 9
30637 }, {
30638 rule: 'repeated',
30639 type: 'string',
30640 name: 'allowedPids',
30641 id: 10
30642 }, {
30643 rule: 'repeated',
30644 type: 'ErrorCommand',
30645 name: 'failedPids',
30646 id: 11
30647 }, {
30648 rule: 'optional',
30649 type: 'int64',
30650 name: 't',
30651 id: 12
30652 }, {
30653 rule: 'optional',
30654 type: 'string',
30655 name: 'n',
30656 id: 13
30657 }, {
30658 rule: 'optional',
30659 type: 'string',
30660 name: 's',
30661 id: 14
30662 }]
30663 }, {
30664 name: 'GenericCommand',
30665 syntax: 'proto2',
30666 fields: [{
30667 rule: 'optional',
30668 type: 'CommandType',
30669 name: 'cmd',
30670 id: 1
30671 }, {
30672 rule: 'optional',
30673 type: 'OpType',
30674 name: 'op',
30675 id: 2
30676 }, {
30677 rule: 'optional',
30678 type: 'string',
30679 name: 'appId',
30680 id: 3
30681 }, {
30682 rule: 'optional',
30683 type: 'string',
30684 name: 'peerId',
30685 id: 4
30686 }, {
30687 rule: 'optional',
30688 type: 'int32',
30689 name: 'i',
30690 id: 5
30691 }, {
30692 rule: 'optional',
30693 type: 'string',
30694 name: 'installationId',
30695 id: 6
30696 }, {
30697 rule: 'optional',
30698 type: 'int32',
30699 name: 'priority',
30700 id: 7
30701 }, {
30702 rule: 'optional',
30703 type: 'int32',
30704 name: 'service',
30705 id: 8
30706 }, {
30707 rule: 'optional',
30708 type: 'int64',
30709 name: 'serverTs',
30710 id: 9
30711 }, {
30712 rule: 'optional',
30713 type: 'int64',
30714 name: 'clientTs',
30715 id: 10
30716 }, {
30717 rule: 'optional',
30718 type: 'int32',
30719 name: 'notificationType',
30720 id: 11
30721 }, {
30722 rule: 'optional',
30723 type: 'DataCommand',
30724 name: 'dataMessage',
30725 id: 101
30726 }, {
30727 rule: 'optional',
30728 type: 'SessionCommand',
30729 name: 'sessionMessage',
30730 id: 102
30731 }, {
30732 rule: 'optional',
30733 type: 'ErrorCommand',
30734 name: 'errorMessage',
30735 id: 103
30736 }, {
30737 rule: 'optional',
30738 type: 'DirectCommand',
30739 name: 'directMessage',
30740 id: 104
30741 }, {
30742 rule: 'optional',
30743 type: 'AckCommand',
30744 name: 'ackMessage',
30745 id: 105
30746 }, {
30747 rule: 'optional',
30748 type: 'UnreadCommand',
30749 name: 'unreadMessage',
30750 id: 106
30751 }, {
30752 rule: 'optional',
30753 type: 'ReadCommand',
30754 name: 'readMessage',
30755 id: 107
30756 }, {
30757 rule: 'optional',
30758 type: 'RcpCommand',
30759 name: 'rcpMessage',
30760 id: 108
30761 }, {
30762 rule: 'optional',
30763 type: 'LogsCommand',
30764 name: 'logsMessage',
30765 id: 109
30766 }, {
30767 rule: 'optional',
30768 type: 'ConvCommand',
30769 name: 'convMessage',
30770 id: 110
30771 }, {
30772 rule: 'optional',
30773 type: 'RoomCommand',
30774 name: 'roomMessage',
30775 id: 111
30776 }, {
30777 rule: 'optional',
30778 type: 'PresenceCommand',
30779 name: 'presenceMessage',
30780 id: 112
30781 }, {
30782 rule: 'optional',
30783 type: 'ReportCommand',
30784 name: 'reportMessage',
30785 id: 113
30786 }, {
30787 rule: 'optional',
30788 type: 'PatchCommand',
30789 name: 'patchMessage',
30790 id: 114
30791 }, {
30792 rule: 'optional',
30793 type: 'PubsubCommand',
30794 name: 'pubsubMessage',
30795 id: 115
30796 }, {
30797 rule: 'optional',
30798 type: 'BlacklistCommand',
30799 name: 'blacklistMessage',
30800 id: 116
30801 }]
30802 }],
30803 enums: [{
30804 name: 'CommandType',
30805 syntax: 'proto2',
30806 values: [{
30807 name: 'session',
30808 id: 0
30809 }, {
30810 name: 'conv',
30811 id: 1
30812 }, {
30813 name: 'direct',
30814 id: 2
30815 }, {
30816 name: 'ack',
30817 id: 3
30818 }, {
30819 name: 'rcp',
30820 id: 4
30821 }, {
30822 name: 'unread',
30823 id: 5
30824 }, {
30825 name: 'logs',
30826 id: 6
30827 }, {
30828 name: 'error',
30829 id: 7
30830 }, {
30831 name: 'login',
30832 id: 8
30833 }, {
30834 name: 'data',
30835 id: 9
30836 }, {
30837 name: 'room',
30838 id: 10
30839 }, {
30840 name: 'read',
30841 id: 11
30842 }, {
30843 name: 'presence',
30844 id: 12
30845 }, {
30846 name: 'report',
30847 id: 13
30848 }, {
30849 name: 'echo',
30850 id: 14
30851 }, {
30852 name: 'loggedin',
30853 id: 15
30854 }, {
30855 name: 'logout',
30856 id: 16
30857 }, {
30858 name: 'loggedout',
30859 id: 17
30860 }, {
30861 name: 'patch',
30862 id: 18
30863 }, {
30864 name: 'pubsub',
30865 id: 19
30866 }, {
30867 name: 'blacklist',
30868 id: 20
30869 }, {
30870 name: 'goaway',
30871 id: 21
30872 }]
30873 }, {
30874 name: 'OpType',
30875 syntax: 'proto2',
30876 values: [{
30877 name: 'open',
30878 id: 1
30879 }, {
30880 name: 'add',
30881 id: 2
30882 }, {
30883 name: 'remove',
30884 id: 3
30885 }, {
30886 name: 'close',
30887 id: 4
30888 }, {
30889 name: 'opened',
30890 id: 5
30891 }, {
30892 name: 'closed',
30893 id: 6
30894 }, {
30895 name: 'query',
30896 id: 7
30897 }, {
30898 name: 'query_result',
30899 id: 8
30900 }, {
30901 name: 'conflict',
30902 id: 9
30903 }, {
30904 name: 'added',
30905 id: 10
30906 }, {
30907 name: 'removed',
30908 id: 11
30909 }, {
30910 name: 'refresh',
30911 id: 12
30912 }, {
30913 name: 'refreshed',
30914 id: 13
30915 }, {
30916 name: 'start',
30917 id: 30
30918 }, {
30919 name: 'started',
30920 id: 31
30921 }, {
30922 name: 'joined',
30923 id: 32
30924 }, {
30925 name: 'members_joined',
30926 id: 33
30927 }, {
30928 name: 'left',
30929 id: 39
30930 }, {
30931 name: 'members_left',
30932 id: 40
30933 }, {
30934 name: 'results',
30935 id: 42
30936 }, {
30937 name: 'count',
30938 id: 43
30939 }, {
30940 name: 'result',
30941 id: 44
30942 }, {
30943 name: 'update',
30944 id: 45
30945 }, {
30946 name: 'updated',
30947 id: 46
30948 }, {
30949 name: 'mute',
30950 id: 47
30951 }, {
30952 name: 'unmute',
30953 id: 48
30954 }, {
30955 name: 'status',
30956 id: 49
30957 }, {
30958 name: 'members',
30959 id: 50
30960 }, {
30961 name: 'max_read',
30962 id: 51
30963 }, {
30964 name: 'is_member',
30965 id: 52
30966 }, {
30967 name: 'member_info_update',
30968 id: 53
30969 }, {
30970 name: 'member_info_updated',
30971 id: 54
30972 }, {
30973 name: 'member_info_changed',
30974 id: 55
30975 }, {
30976 name: 'join',
30977 id: 80
30978 }, {
30979 name: 'invite',
30980 id: 81
30981 }, {
30982 name: 'leave',
30983 id: 82
30984 }, {
30985 name: 'kick',
30986 id: 83
30987 }, {
30988 name: 'reject',
30989 id: 84
30990 }, {
30991 name: 'invited',
30992 id: 85
30993 }, {
30994 name: 'kicked',
30995 id: 86
30996 }, {
30997 name: 'upload',
30998 id: 100
30999 }, {
31000 name: 'uploaded',
31001 id: 101
31002 }, {
31003 name: 'subscribe',
31004 id: 120
31005 }, {
31006 name: 'subscribed',
31007 id: 121
31008 }, {
31009 name: 'unsubscribe',
31010 id: 122
31011 }, {
31012 name: 'unsubscribed',
31013 id: 123
31014 }, {
31015 name: 'is_subscribed',
31016 id: 124
31017 }, {
31018 name: 'modify',
31019 id: 150
31020 }, {
31021 name: 'modified',
31022 id: 151
31023 }, {
31024 name: 'block',
31025 id: 170
31026 }, {
31027 name: 'unblock',
31028 id: 171
31029 }, {
31030 name: 'blocked',
31031 id: 172
31032 }, {
31033 name: 'unblocked',
31034 id: 173
31035 }, {
31036 name: 'members_blocked',
31037 id: 174
31038 }, {
31039 name: 'members_unblocked',
31040 id: 175
31041 }, {
31042 name: 'check_block',
31043 id: 176
31044 }, {
31045 name: 'check_result',
31046 id: 177
31047 }, {
31048 name: 'add_shutup',
31049 id: 180
31050 }, {
31051 name: 'remove_shutup',
31052 id: 181
31053 }, {
31054 name: 'query_shutup',
31055 id: 182
31056 }, {
31057 name: 'shutup_added',
31058 id: 183
31059 }, {
31060 name: 'shutup_removed',
31061 id: 184
31062 }, {
31063 name: 'shutup_result',
31064 id: 185
31065 }, {
31066 name: 'shutuped',
31067 id: 186
31068 }, {
31069 name: 'unshutuped',
31070 id: 187
31071 }, {
31072 name: 'members_shutuped',
31073 id: 188
31074 }, {
31075 name: 'members_unshutuped',
31076 id: 189
31077 }, {
31078 name: 'check_shutup',
31079 id: 190
31080 }]
31081 }, {
31082 name: 'StatusType',
31083 syntax: 'proto2',
31084 values: [{
31085 name: 'on',
31086 id: 1
31087 }, {
31088 name: 'off',
31089 id: 2
31090 }]
31091 }],
31092 isNamespace: true
31093}).build();
31094var _messages$push_server = messageCompiled.push_server.messages2,
31095 JsonObjectMessage = _messages$push_server.JsonObjectMessage,
31096 UnreadTuple = _messages$push_server.UnreadTuple,
31097 LogItem = _messages$push_server.LogItem,
31098 DataCommand = _messages$push_server.DataCommand,
31099 SessionCommand = _messages$push_server.SessionCommand,
31100 ErrorCommand = _messages$push_server.ErrorCommand,
31101 DirectCommand = _messages$push_server.DirectCommand,
31102 AckCommand = _messages$push_server.AckCommand,
31103 UnreadCommand = _messages$push_server.UnreadCommand,
31104 ConvCommand = _messages$push_server.ConvCommand,
31105 RoomCommand = _messages$push_server.RoomCommand,
31106 LogsCommand = _messages$push_server.LogsCommand,
31107 RcpCommand = _messages$push_server.RcpCommand,
31108 ReadTuple = _messages$push_server.ReadTuple,
31109 MaxReadTuple = _messages$push_server.MaxReadTuple,
31110 ReadCommand = _messages$push_server.ReadCommand,
31111 PresenceCommand = _messages$push_server.PresenceCommand,
31112 ReportCommand = _messages$push_server.ReportCommand,
31113 GenericCommand = _messages$push_server.GenericCommand,
31114 BlacklistCommand = _messages$push_server.BlacklistCommand,
31115 PatchCommand = _messages$push_server.PatchCommand,
31116 PatchItem = _messages$push_server.PatchItem,
31117 ConvMemberInfo = _messages$push_server.ConvMemberInfo,
31118 CommandType = _messages$push_server.CommandType,
31119 OpType = _messages$push_server.OpType,
31120 StatusType = _messages$push_server.StatusType;
31121var message = /*#__PURE__*/(0, _freeze.default)({
31122 __proto__: null,
31123 JsonObjectMessage: JsonObjectMessage,
31124 UnreadTuple: UnreadTuple,
31125 LogItem: LogItem,
31126 DataCommand: DataCommand,
31127 SessionCommand: SessionCommand,
31128 ErrorCommand: ErrorCommand,
31129 DirectCommand: DirectCommand,
31130 AckCommand: AckCommand,
31131 UnreadCommand: UnreadCommand,
31132 ConvCommand: ConvCommand,
31133 RoomCommand: RoomCommand,
31134 LogsCommand: LogsCommand,
31135 RcpCommand: RcpCommand,
31136 ReadTuple: ReadTuple,
31137 MaxReadTuple: MaxReadTuple,
31138 ReadCommand: ReadCommand,
31139 PresenceCommand: PresenceCommand,
31140 ReportCommand: ReportCommand,
31141 GenericCommand: GenericCommand,
31142 BlacklistCommand: BlacklistCommand,
31143 PatchCommand: PatchCommand,
31144 PatchItem: PatchItem,
31145 ConvMemberInfo: ConvMemberInfo,
31146 CommandType: CommandType,
31147 OpType: OpType,
31148 StatusType: StatusType
31149});
31150var adapters = {};
31151
31152var getAdapter = function getAdapter(name) {
31153 var adapter = adapters[name];
31154
31155 if (adapter === undefined) {
31156 throw new Error("".concat(name, " adapter is not configured"));
31157 }
31158
31159 return adapter;
31160};
31161/**
31162 * 指定 Adapters
31163 * @function
31164 * @memberof module:leancloud-realtime
31165 * @param {Adapters} newAdapters Adapters 的类型请参考 {@link https://url.leanapp.cn/adapter-type-definitions @leancloud/adapter-types} 中的定义
31166 */
31167
31168
31169var setAdapters = function setAdapters(newAdapters) {
31170 (0, _assign.default)(adapters, newAdapters);
31171};
31172/* eslint-disable */
31173
31174
31175var global$1 = typeof global !== 'undefined' ? global : typeof window !== 'undefined' ? window : {};
31176var EXPIRED = (0, _symbol.default)('expired');
31177var debug = d('LC:Expirable');
31178
31179var Expirable = /*#__PURE__*/function () {
31180 function Expirable(value, ttl) {
31181 this.originalValue = value;
31182
31183 if (typeof ttl === 'number') {
31184 this.expiredAt = Date.now() + ttl;
31185 }
31186 }
31187
31188 _createClass(Expirable, [{
31189 key: "value",
31190 get: function get() {
31191 var expired = this.expiredAt && this.expiredAt <= Date.now();
31192 if (expired) debug("expired: ".concat(this.originalValue));
31193 return expired ? EXPIRED : this.originalValue;
31194 }
31195 }]);
31196
31197 return Expirable;
31198}();
31199
31200Expirable.EXPIRED = EXPIRED;
31201var debug$1 = d('LC:Cache');
31202
31203var Cache = /*#__PURE__*/function () {
31204 function Cache() {
31205 var name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'anonymous';
31206 this.name = name;
31207 this._map = {};
31208 }
31209
31210 var _proto = Cache.prototype;
31211
31212 _proto.get = function get(key) {
31213 var _context5;
31214
31215 var cache = this._map[key];
31216
31217 if (cache) {
31218 var value = cache.value;
31219
31220 if (value !== Expirable.EXPIRED) {
31221 debug$1('[%s] hit: %s', this.name, key);
31222 return value;
31223 }
31224
31225 delete this._map[key];
31226 }
31227
31228 debug$1((0, _concat.default)(_context5 = "[".concat(this.name, "] missed: ")).call(_context5, key));
31229 return null;
31230 };
31231
31232 _proto.set = function set(key, value, ttl) {
31233 debug$1('[%s] set: %s %d', this.name, key, ttl);
31234 this._map[key] = new Expirable(value, ttl);
31235 };
31236
31237 return Cache;
31238}();
31239
31240function ownKeys(object, enumerableOnly) {
31241 var keys = (0, _keys.default)(object);
31242
31243 if (_getOwnPropertySymbols.default) {
31244 var symbols = (0, _getOwnPropertySymbols.default)(object);
31245 if (enumerableOnly) symbols = (0, _filter.default)(symbols).call(symbols, function (sym) {
31246 return (0, _getOwnPropertyDescriptor.default)(object, sym).enumerable;
31247 });
31248 keys.push.apply(keys, symbols);
31249 }
31250
31251 return keys;
31252}
31253
31254function _objectSpread(target) {
31255 for (var i = 1; i < arguments.length; i++) {
31256 var source = arguments[i] != null ? arguments[i] : {};
31257
31258 if (i % 2) {
31259 ownKeys(Object(source), true).forEach(function (key) {
31260 _defineProperty(target, key, source[key]);
31261 });
31262 } else if (_getOwnPropertyDescriptors.default) {
31263 (0, _defineProperties.default)(target, (0, _getOwnPropertyDescriptors.default)(source));
31264 } else {
31265 ownKeys(Object(source)).forEach(function (key) {
31266 (0, _defineProperty2.default)(target, key, (0, _getOwnPropertyDescriptor.default)(source, key));
31267 });
31268 }
31269 }
31270
31271 return target;
31272}
31273/**
31274 * 调试日志控制器
31275 * @const
31276 * @memberof module:leancloud-realtime
31277 * @example
31278 * debug.enable(); // 启用调试日志
31279 * debug.disable(); // 关闭调试日志
31280 */
31281
31282
31283var debug$2 = {
31284 enable: function enable() {
31285 var namespaces = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'LC*';
31286 return d.enable(namespaces);
31287 },
31288 disable: d.disable
31289};
31290
31291var tryAll = function tryAll(promiseConstructors) {
31292 var promise = new _promise.default(promiseConstructors[0]);
31293
31294 if (promiseConstructors.length === 1) {
31295 return promise;
31296 }
31297
31298 return promise["catch"](function () {
31299 return tryAll((0, _slice.default)(promiseConstructors).call(promiseConstructors, 1));
31300 });
31301}; // eslint-disable-next-line no-sequences
31302
31303
31304var tap = function tap(interceptor) {
31305 return function (value) {
31306 return interceptor(value), value;
31307 };
31308};
31309
31310var isIE10 = global$1.navigator && global$1.navigator.userAgent && (0, _indexOf.default)(_context6 = global$1.navigator.userAgent).call(_context6, 'MSIE 10.') !== -1;
31311var map = new _weakMap.default(); // protected property helper
31312
31313var internal = function internal(object) {
31314 if (!map.has(object)) {
31315 map.set(object, {});
31316 }
31317
31318 return map.get(object);
31319};
31320
31321var compact = function compact(obj, filter) {
31322 if (!isPlainObject(obj)) return obj;
31323
31324 var object = _objectSpread({}, obj);
31325
31326 (0, _keys.default)(object).forEach(function (prop) {
31327 var value = object[prop];
31328
31329 if (value === filter) {
31330 delete object[prop];
31331 } else {
31332 object[prop] = compact(value, filter);
31333 }
31334 });
31335 return object;
31336}; // debug utility
31337
31338
31339var removeNull = function removeNull(obj) {
31340 return compact(obj, null);
31341};
31342
31343var trim = function trim(message) {
31344 return removeNull(JSON.parse((0, _stringify.default)(message)));
31345};
31346
31347var ensureArray = function ensureArray(target) {
31348 if (Array.isArray(target)) {
31349 return target;
31350 }
31351
31352 if (target === undefined || target === null) {
31353 return [];
31354 }
31355
31356 return [target];
31357};
31358
31359var isWeapp = // eslint-disable-next-line no-undef
31360(typeof wx === "undefined" ? "undefined" : _typeof(wx)) === 'object' && typeof wx.connectSocket === 'function'; // throttle decorator
31361
31362var isCNApp = function isCNApp(appId) {
31363 return (0, _slice.default)(appId).call(appId, -9) !== '-MdYXbMMI';
31364};
31365
31366var equalBuffer = function equalBuffer(buffer1, buffer2) {
31367 if (!buffer1 || !buffer2) return false;
31368 if (buffer1.byteLength !== buffer2.byteLength) return false;
31369 var a = new Uint8Array(buffer1);
31370 var b = new Uint8Array(buffer2);
31371 return !a.some(function (value, index) {
31372 return value !== b[index];
31373 });
31374};
31375
31376var _class;
31377
31378function ownKeys$1(object, enumerableOnly) {
31379 var keys = (0, _keys.default)(object);
31380
31381 if (_getOwnPropertySymbols.default) {
31382 var symbols = (0, _getOwnPropertySymbols.default)(object);
31383 if (enumerableOnly) symbols = (0, _filter.default)(symbols).call(symbols, function (sym) {
31384 return (0, _getOwnPropertyDescriptor.default)(object, sym).enumerable;
31385 });
31386 keys.push.apply(keys, symbols);
31387 }
31388
31389 return keys;
31390}
31391
31392function _objectSpread$1(target) {
31393 for (var i = 1; i < arguments.length; i++) {
31394 var source = arguments[i] != null ? arguments[i] : {};
31395
31396 if (i % 2) {
31397 ownKeys$1(Object(source), true).forEach(function (key) {
31398 _defineProperty(target, key, source[key]);
31399 });
31400 } else if (_getOwnPropertyDescriptors.default) {
31401 (0, _defineProperties.default)(target, (0, _getOwnPropertyDescriptors.default)(source));
31402 } else {
31403 ownKeys$1(Object(source)).forEach(function (key) {
31404 (0, _defineProperty2.default)(target, key, (0, _getOwnPropertyDescriptor.default)(source, key));
31405 });
31406 }
31407 }
31408
31409 return target;
31410}
31411
31412var debug$3 = d('LC:WebSocketPlus');
31413var OPEN = 'open';
31414var DISCONNECT = 'disconnect';
31415var RECONNECT = 'reconnect';
31416var RETRY = 'retry';
31417var SCHEDULE = 'schedule';
31418var OFFLINE = 'offline';
31419var ONLINE = 'online';
31420var ERROR = 'error';
31421var MESSAGE = 'message';
31422var HEARTBEAT_TIME = 180000;
31423var TIMEOUT_TIME = 380000;
31424
31425var DEFAULT_RETRY_STRATEGY = function DEFAULT_RETRY_STRATEGY(attempt) {
31426 return Math.min(1000 * Math.pow(2, attempt), 300000);
31427};
31428
31429var requireConnected = function requireConnected(target, name, descriptor) {
31430 return _objectSpread$1(_objectSpread$1({}, descriptor), {}, {
31431 value: function requireConnectedWrapper() {
31432 var _context7;
31433
31434 var _descriptor$value;
31435
31436 this.checkConnectionAvailability(name);
31437
31438 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
31439 args[_key] = arguments[_key];
31440 }
31441
31442 return (_descriptor$value = descriptor.value).call.apply(_descriptor$value, (0, _concat.default)(_context7 = [this]).call(_context7, args));
31443 }
31444 });
31445};
31446
31447var WebSocketPlus = (_class = /*#__PURE__*/function (_EventEmitter) {
31448 _inheritsLoose(WebSocketPlus, _EventEmitter);
31449
31450 _createClass(WebSocketPlus, [{
31451 key: "urls",
31452 get: function get() {
31453 return this._urls;
31454 },
31455 set: function set(urls) {
31456 this._urls = ensureArray(urls);
31457 }
31458 }]);
31459
31460 function WebSocketPlus(getUrls, protocol) {
31461 var _this;
31462
31463 _this = _EventEmitter.call(this) || this;
31464
31465 _this.init();
31466
31467 _this._protocol = protocol;
31468
31469 _promise.default.resolve(typeof getUrls === 'function' ? getUrls() : getUrls).then(ensureArray).then(function (urls) {
31470 _this._urls = urls;
31471 return _this._open();
31472 }).then(function () {
31473 _this.__postponeTimeoutTimer = _this._postponeTimeoutTimer.bind(_assertThisInitialized(_this));
31474
31475 if (global$1.addEventListener) {
31476 _this.__pause = function () {
31477 if (_this.can('pause')) _this.pause();
31478 };
31479
31480 _this.__resume = function () {
31481 if (_this.can('resume')) _this.resume();
31482 };
31483
31484 global$1.addEventListener('offline', _this.__pause);
31485 global$1.addEventListener('online', _this.__resume);
31486 }
31487
31488 _this.open();
31489 })["catch"](_this["throw"].bind(_assertThisInitialized(_this)));
31490
31491 return _this;
31492 }
31493
31494 var _proto = WebSocketPlus.prototype;
31495
31496 _proto._open = function _open() {
31497 var _this2 = this;
31498
31499 return this._createWs(this._urls, this._protocol).then(function (ws) {
31500 var _context8;
31501
31502 var _this2$_urls = _toArray(_this2._urls),
31503 first = _this2$_urls[0],
31504 reset = (0, _slice.default)(_this2$_urls).call(_this2$_urls, 1);
31505
31506 _this2._urls = (0, _concat.default)(_context8 = []).call(_context8, _toConsumableArray(reset), [first]);
31507 return ws;
31508 });
31509 };
31510
31511 _proto._createWs = function _createWs(urls, protocol) {
31512 var _this3 = this;
31513
31514 return tryAll((0, _map.default)(urls).call(urls, function (url) {
31515 return function (resolve, reject) {
31516 var _context9;
31517
31518 debug$3((0, _concat.default)(_context9 = "connect [".concat(url, "] ")).call(_context9, protocol));
31519 var WebSocket = getAdapter('WebSocket');
31520 var ws = protocol ? new WebSocket(url, protocol) : new WebSocket(url);
31521 ws.binaryType = _this3.binaryType || 'arraybuffer';
31522
31523 ws.onopen = function () {
31524 return resolve(ws);
31525 };
31526
31527 ws.onclose = function (error) {
31528 if (error instanceof Error) {
31529 return reject(error);
31530 } // in browser, error event is useless
31531
31532
31533 return reject(new Error("Failed to connect [".concat(url, "]")));
31534 };
31535
31536 ws.onerror = ws.onclose;
31537 };
31538 })).then(function (ws) {
31539 _this3._ws = ws;
31540 _this3._ws.onclose = _this3._handleClose.bind(_this3);
31541 _this3._ws.onmessage = _this3._handleMessage.bind(_this3);
31542 return ws;
31543 });
31544 };
31545
31546 _proto._destroyWs = function _destroyWs() {
31547 var ws = this._ws;
31548 if (!ws) return;
31549 ws.onopen = null;
31550 ws.onclose = null;
31551 ws.onerror = null;
31552 ws.onmessage = null;
31553 this._ws = null;
31554 ws.close();
31555 } // eslint-disable-next-line class-methods-use-this
31556 ;
31557
31558 _proto.onbeforeevent = function onbeforeevent(event, from, to) {
31559 var _context10, _context11;
31560
31561 for (var _len2 = arguments.length, payload = new Array(_len2 > 3 ? _len2 - 3 : 0), _key2 = 3; _key2 < _len2; _key2++) {
31562 payload[_key2 - 3] = arguments[_key2];
31563 }
31564
31565 debug$3((0, _concat.default)(_context10 = (0, _concat.default)(_context11 = "".concat(event, ": ")).call(_context11, from, " -> ")).call(_context10, to, " %o"), payload);
31566 };
31567
31568 _proto.onopen = function onopen() {
31569 this.emit(OPEN);
31570 };
31571
31572 _proto.onconnected = function onconnected() {
31573 this._startConnectionKeeper();
31574 };
31575
31576 _proto.onleaveconnected = function onleaveconnected(event, from, to) {
31577 this._stopConnectionKeeper();
31578
31579 this._destroyWs();
31580
31581 if (to === 'offline' || to === 'disconnected') {
31582 this.emit(DISCONNECT);
31583 }
31584 };
31585
31586 _proto.onpause = function onpause() {
31587 this.emit(OFFLINE);
31588 };
31589
31590 _proto.onbeforeresume = function onbeforeresume() {
31591 this.emit(ONLINE);
31592 };
31593
31594 _proto.onreconnect = function onreconnect() {
31595 this.emit(RECONNECT);
31596 };
31597
31598 _proto.ondisconnected = function ondisconnected(event, from, to) {
31599 var _context12;
31600
31601 var _this4 = this;
31602
31603 var attempt = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
31604 var delay = from === OFFLINE ? 0 : DEFAULT_RETRY_STRATEGY.call(null, attempt);
31605 debug$3((0, _concat.default)(_context12 = "schedule attempt=".concat(attempt, " delay=")).call(_context12, delay));
31606 this.emit(SCHEDULE, attempt, delay);
31607
31608 if (this.__scheduledRetry) {
31609 clearTimeout(this.__scheduledRetry);
31610 }
31611
31612 this.__scheduledRetry = setTimeout(function () {
31613 if (_this4.is('disconnected')) {
31614 _this4.retry(attempt);
31615 }
31616 }, delay);
31617 };
31618
31619 _proto.onretry = function onretry(event, from, to) {
31620 var _this5 = this;
31621
31622 var attempt = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
31623 this.emit(RETRY, attempt);
31624
31625 this._open().then(function () {
31626 return _this5.can('reconnect') && _this5.reconnect();
31627 }, function () {
31628 return _this5.can('fail') && _this5.fail(attempt + 1);
31629 });
31630 };
31631
31632 _proto.onerror = function onerror(event, from, to, error) {
31633 this.emit(ERROR, error);
31634 };
31635
31636 _proto.onclose = function onclose() {
31637 if (global$1.removeEventListener) {
31638 if (this.__pause) global$1.removeEventListener('offline', this.__pause);
31639 if (this.__resume) global$1.removeEventListener('online', this.__resume);
31640 }
31641 };
31642
31643 _proto.checkConnectionAvailability = function checkConnectionAvailability() {
31644 var name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'API';
31645
31646 if (!this.is('connected')) {
31647 var _context13;
31648
31649 var currentState = this.current;
31650 console.warn((0, _concat.default)(_context13 = "".concat(name, " should not be called when the connection is ")).call(_context13, currentState));
31651
31652 if (this.is('disconnected') || this.is('reconnecting')) {
31653 console.warn('disconnect and reconnect event should be handled to avoid such calls.');
31654 }
31655
31656 throw new Error('Connection unavailable');
31657 }
31658 } // jsdoc-ignore-start
31659 ;
31660
31661 _proto. // jsdoc-ignore-end
31662 _ping = function _ping() {
31663 debug$3('ping');
31664
31665 try {
31666 this.ping();
31667 } catch (error) {
31668 console.warn("websocket ping error: ".concat(error.message));
31669 }
31670 };
31671
31672 _proto.ping = function ping() {
31673 if (this._ws.ping) {
31674 this._ws.ping();
31675 } else {
31676 console.warn("The WebSocket implement does not support sending ping frame.\n Override ping method to use application defined ping/pong mechanism.");
31677 }
31678 };
31679
31680 _proto._postponeTimeoutTimer = function _postponeTimeoutTimer() {
31681 var _this6 = this;
31682
31683 debug$3('_postponeTimeoutTimer');
31684
31685 this._clearTimeoutTimers();
31686
31687 this._timeoutTimer = setTimeout(function () {
31688 debug$3('timeout');
31689
31690 _this6.disconnect();
31691 }, TIMEOUT_TIME);
31692 };
31693
31694 _proto._clearTimeoutTimers = function _clearTimeoutTimers() {
31695 if (this._timeoutTimer) {
31696 clearTimeout(this._timeoutTimer);
31697 }
31698 };
31699
31700 _proto._startConnectionKeeper = function _startConnectionKeeper() {
31701 debug$3('start connection keeper');
31702 this._heartbeatTimer = setInterval(this._ping.bind(this), HEARTBEAT_TIME);
31703 var addListener = this._ws.addListener || this._ws.addEventListener;
31704
31705 if (!addListener) {
31706 debug$3('connection keeper disabled due to the lack of #addEventListener.');
31707 return;
31708 }
31709
31710 addListener.call(this._ws, 'message', this.__postponeTimeoutTimer);
31711 addListener.call(this._ws, 'pong', this.__postponeTimeoutTimer);
31712
31713 this._postponeTimeoutTimer();
31714 };
31715
31716 _proto._stopConnectionKeeper = function _stopConnectionKeeper() {
31717 debug$3('stop connection keeper'); // websockets/ws#489
31718
31719 var removeListener = this._ws.removeListener || this._ws.removeEventListener;
31720
31721 if (removeListener) {
31722 removeListener.call(this._ws, 'message', this.__postponeTimeoutTimer);
31723 removeListener.call(this._ws, 'pong', this.__postponeTimeoutTimer);
31724
31725 this._clearTimeoutTimers();
31726 }
31727
31728 if (this._heartbeatTimer) {
31729 clearInterval(this._heartbeatTimer);
31730 }
31731 };
31732
31733 _proto._handleClose = function _handleClose(event) {
31734 var _context14;
31735
31736 debug$3((0, _concat.default)(_context14 = "ws closed [".concat(event.code, "] ")).call(_context14, event.reason)); // socket closed manually, ignore close event.
31737
31738 if (this.isFinished()) return;
31739 this.handleClose(event);
31740 };
31741
31742 _proto.handleClose = function handleClose() {
31743 // reconnect
31744 this.disconnect();
31745 } // jsdoc-ignore-start
31746 ;
31747
31748 _proto. // jsdoc-ignore-end
31749 send = function send(data) {
31750 debug$3('send', data);
31751
31752 this._ws.send(data);
31753 };
31754
31755 _proto._handleMessage = function _handleMessage(event) {
31756 debug$3('message', event.data);
31757 this.handleMessage(event.data);
31758 };
31759
31760 _proto.handleMessage = function handleMessage(message) {
31761 this.emit(MESSAGE, message);
31762 };
31763
31764 return WebSocketPlus;
31765}(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);
31766StateMachine.create({
31767 target: WebSocketPlus.prototype,
31768 initial: {
31769 state: 'initialized',
31770 event: 'init',
31771 defer: true
31772 },
31773 terminal: 'closed',
31774 events: [{
31775 name: 'open',
31776 from: 'initialized',
31777 to: 'connected'
31778 }, {
31779 name: 'disconnect',
31780 from: 'connected',
31781 to: 'disconnected'
31782 }, {
31783 name: 'retry',
31784 from: 'disconnected',
31785 to: 'reconnecting'
31786 }, {
31787 name: 'fail',
31788 from: 'reconnecting',
31789 to: 'disconnected'
31790 }, {
31791 name: 'reconnect',
31792 from: 'reconnecting',
31793 to: 'connected'
31794 }, {
31795 name: 'pause',
31796 from: ['connected', 'disconnected', 'reconnecting'],
31797 to: 'offline'
31798 }, {}, {
31799 name: 'resume',
31800 from: 'offline',
31801 to: 'disconnected'
31802 }, {
31803 name: 'close',
31804 from: ['connected', 'disconnected', 'reconnecting', 'offline'],
31805 to: 'closed'
31806 }, {
31807 name: 'throw',
31808 from: '*',
31809 to: 'error'
31810 }]
31811});
31812var error = (0, _freeze.default)({
31813 1000: {
31814 name: 'CLOSE_NORMAL'
31815 },
31816 1006: {
31817 name: 'CLOSE_ABNORMAL'
31818 },
31819 4100: {
31820 name: 'APP_NOT_AVAILABLE',
31821 message: 'App not exists or realtime message service is disabled.'
31822 },
31823 4102: {
31824 name: 'SIGNATURE_FAILED',
31825 message: 'Login signature mismatch.'
31826 },
31827 4103: {
31828 name: 'INVALID_LOGIN',
31829 message: 'Malformed clientId.'
31830 },
31831 4105: {
31832 name: 'SESSION_REQUIRED',
31833 message: 'Message sent before session opened.'
31834 },
31835 4107: {
31836 name: 'READ_TIMEOUT'
31837 },
31838 4108: {
31839 name: 'LOGIN_TIMEOUT'
31840 },
31841 4109: {
31842 name: 'FRAME_TOO_LONG'
31843 },
31844 4110: {
31845 name: 'INVALID_ORIGIN',
31846 message: 'Access denied by domain whitelist.'
31847 },
31848 4111: {
31849 name: 'SESSION_CONFLICT'
31850 },
31851 4112: {
31852 name: 'SESSION_TOKEN_EXPIRED'
31853 },
31854 4113: {
31855 name: 'APP_QUOTA_EXCEEDED',
31856 message: 'The daily active users limit exceeded.'
31857 },
31858 4116: {
31859 name: 'MESSAGE_SENT_QUOTA_EXCEEDED',
31860 message: 'Command sent too fast.'
31861 },
31862 4200: {
31863 name: 'INTERNAL_ERROR',
31864 message: 'Internal error, please contact LeanCloud for support.'
31865 },
31866 4301: {
31867 name: 'CONVERSATION_API_FAILED',
31868 message: 'Upstream Conversatoin API failed, see error.detail for details.'
31869 },
31870 4302: {
31871 name: 'CONVERSATION_SIGNATURE_FAILED',
31872 message: 'Conversation action signature mismatch.'
31873 },
31874 4303: {
31875 name: 'CONVERSATION_NOT_FOUND'
31876 },
31877 4304: {
31878 name: 'CONVERSATION_FULL'
31879 },
31880 4305: {
31881 name: 'CONVERSATION_REJECTED_BY_APP',
31882 message: 'Conversation action rejected by hook.'
31883 },
31884 4306: {
31885 name: 'CONVERSATION_UPDATE_FAILED'
31886 },
31887 4307: {
31888 name: 'CONVERSATION_READ_ONLY'
31889 },
31890 4308: {
31891 name: 'CONVERSATION_NOT_ALLOWED'
31892 },
31893 4309: {
31894 name: 'CONVERSATION_UPDATE_REJECTED',
31895 message: 'Conversation update rejected because the client is not a member.'
31896 },
31897 4310: {
31898 name: 'CONVERSATION_QUERY_FAILED',
31899 message: 'Conversation query failed because it is too expansive.'
31900 },
31901 4311: {
31902 name: 'CONVERSATION_LOG_FAILED'
31903 },
31904 4312: {
31905 name: 'CONVERSATION_LOG_REJECTED',
31906 message: 'Message query rejected because the client is not a member of the conversation.'
31907 },
31908 4313: {
31909 name: 'SYSTEM_CONVERSATION_REQUIRED'
31910 },
31911 4314: {
31912 name: 'NORMAL_CONVERSATION_REQUIRED'
31913 },
31914 4315: {
31915 name: 'CONVERSATION_BLACKLISTED',
31916 message: 'Blacklisted in the conversation.'
31917 },
31918 4316: {
31919 name: 'TRANSIENT_CONVERSATION_REQUIRED'
31920 },
31921 4317: {
31922 name: 'CONVERSATION_MEMBERSHIP_REQUIRED'
31923 },
31924 4318: {
31925 name: 'CONVERSATION_API_QUOTA_EXCEEDED',
31926 message: 'LeanCloud API quota exceeded. You may upgrade your plan.'
31927 },
31928 4323: {
31929 name: 'TEMPORARY_CONVERSATION_EXPIRED',
31930 message: 'Temporary conversation expired or does not exist.'
31931 },
31932 4401: {
31933 name: 'INVALID_MESSAGING_TARGET',
31934 message: 'Conversation does not exist or client is not a member.'
31935 },
31936 4402: {
31937 name: 'MESSAGE_REJECTED_BY_APP',
31938 message: 'Message rejected by hook.'
31939 },
31940 4403: {
31941 name: 'MESSAGE_OWNERSHIP_REQUIRED'
31942 },
31943 4404: {
31944 name: 'MESSAGE_NOT_FOUND'
31945 },
31946 4405: {
31947 name: 'MESSAGE_UPDATE_REJECTED_BY_APP',
31948 message: 'Message update rejected by hook.'
31949 },
31950 4406: {
31951 name: 'MESSAGE_EDIT_DISABLED'
31952 },
31953 4407: {
31954 name: 'MESSAGE_RECALL_DISABLED'
31955 },
31956 5130: {
31957 name: 'OWNER_PROMOTION_NOT_ALLOWED',
31958 message: "Updating a member's role to owner is not allowed."
31959 }
31960});
31961var ErrorCode = (0, _freeze.default)((0, _reduce.default)(_context15 = (0, _keys.default)(error)).call(_context15, function (result, code) {
31962 return (0, _assign.default)(result, _defineProperty({}, error[code].name, Number(code)));
31963}, {}));
31964
31965var createError = function createError(_ref) {
31966 var code = _ref.code,
31967 reason = _ref.reason,
31968 appCode = _ref.appCode,
31969 detail = _ref.detail,
31970 errorMessage = _ref.error;
31971 var message = reason || detail || errorMessage;
31972 var name = reason;
31973
31974 if (!message && error[code]) {
31975 name = error[code].name;
31976 message = error[code].message || name;
31977 }
31978
31979 if (!message) {
31980 message = "Unknow Error: ".concat(code);
31981 }
31982
31983 var err = new Error(message);
31984 return (0, _assign.default)(err, {
31985 code: code,
31986 appCode: appCode,
31987 detail: detail,
31988 name: name
31989 });
31990};
31991
31992var debug$4 = d('LC:Connection');
31993var COMMAND_TIMEOUT = 20000;
31994var EXPIRE = (0, _symbol.default)('expire');
31995
31996var isIdempotentCommand = function isIdempotentCommand(command) {
31997 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));
31998};
31999
32000var Connection = /*#__PURE__*/function (_WebSocketPlus) {
32001 _inheritsLoose(Connection, _WebSocketPlus);
32002
32003 function Connection(getUrl, _ref) {
32004 var _context16;
32005
32006 var _this;
32007
32008 var format = _ref.format,
32009 version = _ref.version;
32010 debug$4('initializing Connection');
32011 var protocolString = (0, _concat.default)(_context16 = "lc.".concat(format, ".")).call(_context16, version);
32012 _this = _WebSocketPlus.call(this, getUrl, protocolString) || this;
32013 _this._protocolFormat = format;
32014 _this._commands = {};
32015 _this._serialId = 0;
32016 return _this;
32017 }
32018
32019 var _proto = Connection.prototype;
32020
32021 _proto.send = /*#__PURE__*/function () {
32022 var _send = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(command) {
32023 var _this2 = this;
32024
32025 var waitingForRespond,
32026 buffer,
32027 serialId,
32028 duplicatedCommand,
32029 message,
32030 promise,
32031 _args = arguments;
32032 return _regeneratorRuntime.wrap(function _callee$(_context) {
32033 var _context17, _context18;
32034
32035 while (1) {
32036 switch (_context.prev = _context.next) {
32037 case 0:
32038 waitingForRespond = _args.length > 1 && _args[1] !== undefined ? _args[1] : true;
32039
32040 if (!waitingForRespond) {
32041 _context.next = 11;
32042 break;
32043 }
32044
32045 if (!isIdempotentCommand(command)) {
32046 _context.next = 8;
32047 break;
32048 }
32049
32050 buffer = command.toArrayBuffer();
32051 duplicatedCommand = (0, _find.default)(_context17 = values(this._commands)).call(_context17, function (_ref2) {
32052 var targetBuffer = _ref2.buffer,
32053 targetCommand = _ref2.command;
32054 return targetCommand.cmd === command.cmd && targetCommand.op === command.op && equalBuffer(targetBuffer, buffer);
32055 });
32056
32057 if (!duplicatedCommand) {
32058 _context.next = 8;
32059 break;
32060 }
32061
32062 console.warn((0, _concat.default)(_context18 = "Duplicated command [cmd:".concat(command.cmd, " op:")).call(_context18, command.op, "] is throttled."));
32063 return _context.abrupt("return", duplicatedCommand.promise);
32064
32065 case 8:
32066 this._serialId += 1;
32067 serialId = this._serialId;
32068 command.i = serialId;
32069 // eslint-disable-line no-param-reassign
32070
32071 case 11:
32072 if (debug$4.enabled) debug$4('↑ %O sent', trim(command));
32073
32074 if (this._protocolFormat === 'proto2base64') {
32075 message = command.toBase64();
32076 } else if (command.toArrayBuffer) {
32077 message = command.toArrayBuffer();
32078 }
32079
32080 if (message) {
32081 _context.next = 15;
32082 break;
32083 }
32084
32085 throw new TypeError("".concat(command, " is not a GenericCommand"));
32086
32087 case 15:
32088 _WebSocketPlus.prototype.send.call(this, message);
32089
32090 if (waitingForRespond) {
32091 _context.next = 18;
32092 break;
32093 }
32094
32095 return _context.abrupt("return", undefined);
32096
32097 case 18:
32098 promise = new _promise.default(function (resolve, reject) {
32099 _this2._commands[serialId] = {
32100 command: command,
32101 buffer: buffer,
32102 resolve: resolve,
32103 reject: reject,
32104 timeout: setTimeout(function () {
32105 if (_this2._commands[serialId]) {
32106 var _context19;
32107
32108 if (debug$4.enabled) debug$4('✗ %O timeout', trim(command));
32109 reject(createError({
32110 error: (0, _concat.default)(_context19 = "Command Timeout [cmd:".concat(command.cmd, " op:")).call(_context19, command.op, "]"),
32111 name: 'COMMAND_TIMEOUT'
32112 }));
32113 delete _this2._commands[serialId];
32114 }
32115 }, COMMAND_TIMEOUT)
32116 };
32117 });
32118 this._commands[serialId].promise = promise;
32119 return _context.abrupt("return", promise);
32120
32121 case 21:
32122 case "end":
32123 return _context.stop();
32124 }
32125 }
32126 }, _callee, this);
32127 }));
32128
32129 function send(_x) {
32130 return _send.apply(this, arguments);
32131 }
32132
32133 return send;
32134 }();
32135
32136 _proto.handleMessage = function handleMessage(msg) {
32137 var message;
32138
32139 try {
32140 message = GenericCommand.decode(msg);
32141 if (debug$4.enabled) debug$4('↓ %O received', trim(message));
32142 } catch (e) {
32143 console.warn('Decode message failed:', e.message, msg);
32144 return;
32145 }
32146
32147 var serialId = message.i;
32148
32149 if (serialId) {
32150 if (this._commands[serialId]) {
32151 clearTimeout(this._commands[serialId].timeout);
32152
32153 if (message.cmd === CommandType.error) {
32154 this._commands[serialId].reject(createError(message.errorMessage));
32155 } else {
32156 this._commands[serialId].resolve(message);
32157 }
32158
32159 delete this._commands[serialId];
32160 } else {
32161 console.warn("Unexpected command received with serialId [".concat(serialId, "],\n which have timed out or never been requested."));
32162 }
32163 } else {
32164 switch (message.cmd) {
32165 case CommandType.error:
32166 {
32167 this.emit(ERROR, createError(message.errorMessage));
32168 return;
32169 }
32170
32171 case CommandType.goaway:
32172 {
32173 this.emit(EXPIRE);
32174 return;
32175 }
32176
32177 default:
32178 {
32179 this.emit(MESSAGE, message);
32180 }
32181 }
32182 }
32183 };
32184
32185 _proto.ping = function ping() {
32186 return this.send(new GenericCommand({
32187 cmd: CommandType.echo
32188 }))["catch"](function (error) {
32189 return debug$4('ping failed:', error);
32190 });
32191 };
32192
32193 return Connection;
32194}(WebSocketPlus);
32195
32196var debug$5 = d('LC:request');
32197
32198var request = function request(_ref) {
32199 var _ref$method = _ref.method,
32200 method = _ref$method === void 0 ? 'GET' : _ref$method,
32201 _url = _ref.url,
32202 query = _ref.query,
32203 headers = _ref.headers,
32204 data = _ref.data,
32205 time = _ref.timeout;
32206 var url = _url;
32207
32208 if (query) {
32209 var _context20, _context21, _context23;
32210
32211 var queryString = (0, _filter.default)(_context20 = (0, _map.default)(_context21 = (0, _keys.default)(query)).call(_context21, function (key) {
32212 var _context22;
32213
32214 var value = query[key];
32215 if (value === undefined) return undefined;
32216 var v = isPlainObject(value) ? (0, _stringify.default)(value) : value;
32217 return (0, _concat.default)(_context22 = "".concat(encodeURIComponent(key), "=")).call(_context22, encodeURIComponent(v));
32218 })).call(_context20, function (qs) {
32219 return qs;
32220 }).join('&');
32221 url = (0, _concat.default)(_context23 = "".concat(url, "?")).call(_context23, queryString);
32222 }
32223
32224 debug$5('Req: %O %O %O', method, url, {
32225 headers: headers,
32226 data: data
32227 });
32228 var request = getAdapter('request');
32229 var promise = request(url, {
32230 method: method,
32231 headers: headers,
32232 data: data
32233 }).then(function (response) {
32234 if (response.ok === false) {
32235 var error = createError(response.data);
32236 error.response = response;
32237 throw error;
32238 }
32239
32240 debug$5('Res: %O %O %O', url, response.status, response.data);
32241 return response.data;
32242 })["catch"](function (error) {
32243 if (error.response) {
32244 debug$5('Error: %O %O %O', url, error.response.status, error.response.data);
32245 }
32246
32247 throw error;
32248 });
32249 return time ? promiseTimeout.timeout(promise, time) : promise;
32250};
32251
32252var applyDecorators = function applyDecorators(decorators, target) {
32253 if (decorators) {
32254 decorators.forEach(function (decorator) {
32255 try {
32256 decorator(target);
32257 } catch (error) {
32258 if (decorator._pluginName) {
32259 error.message += "[".concat(decorator._pluginName, "]");
32260 }
32261
32262 throw error;
32263 }
32264 });
32265 }
32266};
32267
32268var applyDispatcher = function applyDispatcher(dispatchers, payload) {
32269 var _context24;
32270
32271 return (0, _reduce.default)(_context24 = ensureArray(dispatchers)).call(_context24, function (resultPromise, dispatcher) {
32272 return resultPromise.then(function (shouldDispatch) {
32273 return shouldDispatch === false ? false : dispatcher.apply(void 0, _toConsumableArray(payload));
32274 })["catch"](function (error) {
32275 if (dispatcher._pluginName) {
32276 // eslint-disable-next-line no-param-reassign
32277 error.message += "[".concat(dispatcher._pluginName, "]");
32278 }
32279
32280 throw error;
32281 });
32282 }, _promise.default.resolve(true));
32283};
32284
32285var version = "5.0.0-rc.7";
32286
32287function ownKeys$2(object, enumerableOnly) {
32288 var keys = (0, _keys.default)(object);
32289
32290 if (_getOwnPropertySymbols.default) {
32291 var symbols = (0, _getOwnPropertySymbols.default)(object);
32292 if (enumerableOnly) symbols = (0, _filter.default)(symbols).call(symbols, function (sym) {
32293 return (0, _getOwnPropertyDescriptor.default)(object, sym).enumerable;
32294 });
32295 keys.push.apply(keys, symbols);
32296 }
32297
32298 return keys;
32299}
32300
32301function _objectSpread$2(target) {
32302 for (var i = 1; i < arguments.length; i++) {
32303 var source = arguments[i] != null ? arguments[i] : {};
32304
32305 if (i % 2) {
32306 ownKeys$2(Object(source), true).forEach(function (key) {
32307 _defineProperty(target, key, source[key]);
32308 });
32309 } else if (_getOwnPropertyDescriptors.default) {
32310 (0, _defineProperties.default)(target, (0, _getOwnPropertyDescriptors.default)(source));
32311 } else {
32312 ownKeys$2(Object(source)).forEach(function (key) {
32313 (0, _defineProperty2.default)(target, key, (0, _getOwnPropertyDescriptor.default)(source, key));
32314 });
32315 }
32316 }
32317
32318 return target;
32319}
32320
32321var debug$6 = d('LC:Realtime');
32322var routerCache = new Cache('push-router');
32323var initializedApp = {};
32324
32325var Realtime = /*#__PURE__*/function (_EventEmitter) {
32326 _inheritsLoose(Realtime, _EventEmitter);
32327 /**
32328 * @extends EventEmitter
32329 * @param {Object} options
32330 * @param {String} options.appId
32331 * @param {String} options.appKey (since 4.0.0)
32332 * @param {String|Object} [options.server] 指定服务器域名,中国节点应用此参数必填(since 4.0.0)
32333 * @param {Boolean} [options.noBinary=false] 设置 WebSocket 使用字符串格式收发消息(默认为二进制格式)。
32334 * 适用于 WebSocket 实现不支持二进制数据格式的情况
32335 * @param {Boolean} [options.ssl=true] 使用 wss 进行连接
32336 * @param {String|String[]} [options.RTMServers] 指定私有部署的 RTM 服务器地址(since 4.0.0)
32337 * @param {Plugin[]} [options.plugins] 加载插件(since 3.1.0)
32338 */
32339
32340
32341 function Realtime(_ref) {
32342 var _context25;
32343
32344 var _this2;
32345
32346 var plugins = _ref.plugins,
32347 options = _objectWithoutProperties(_ref, ["plugins"]);
32348
32349 debug$6('initializing Realtime %s %O', version, options);
32350 _this2 = _EventEmitter.call(this) || this;
32351 var appId = options.appId;
32352
32353 if (typeof appId !== 'string') {
32354 throw new TypeError("appId [".concat(appId, "] is not a string"));
32355 }
32356
32357 if (initializedApp[appId]) {
32358 throw new Error("App [".concat(appId, "] is already initialized."));
32359 }
32360
32361 initializedApp[appId] = true;
32362
32363 if (typeof options.appKey !== 'string') {
32364 throw new TypeError("appKey [".concat(options.appKey, "] is not a string"));
32365 }
32366
32367 if (isCNApp(appId)) {
32368 if (!options.server) {
32369 throw new TypeError("server option is required for apps from CN region");
32370 }
32371 }
32372
32373 _this2._options = _objectSpread$2({
32374 appId: undefined,
32375 appKey: undefined,
32376 noBinary: false,
32377 ssl: true,
32378 RTMServerName: typeof process !== 'undefined' ? process.env.RTM_SERVER_NAME : undefined
32379 }, options);
32380 _this2._cache = new Cache('endpoints');
32381
32382 var _this = internal(_assertThisInitialized(_this2));
32383
32384 _this.clients = new _set.default();
32385 _this.pendingClients = new _set.default();
32386 var mergedPlugins = (0, _concat.default)(_context25 = []).call(_context25, _toConsumableArray(ensureArray(Realtime.__preRegisteredPlugins)), _toConsumableArray(ensureArray(plugins)));
32387 debug$6('Using plugins %o', (0, _map.default)(mergedPlugins).call(mergedPlugins, function (plugin) {
32388 return plugin.name;
32389 }));
32390 _this2._plugins = (0, _reduce.default)(mergedPlugins).call(mergedPlugins, function (result, plugin) {
32391 (0, _keys.default)(plugin).forEach(function (hook) {
32392 if ({}.hasOwnProperty.call(plugin, hook) && hook !== 'name') {
32393 var _context26;
32394
32395 if (plugin.name) {
32396 ensureArray(plugin[hook]).forEach(function (value) {
32397 // eslint-disable-next-line no-param-reassign
32398 value._pluginName = plugin.name;
32399 });
32400 } // eslint-disable-next-line no-param-reassign
32401
32402
32403 result[hook] = (0, _concat.default)(_context26 = ensureArray(result[hook])).call(_context26, plugin[hook]);
32404 }
32405 });
32406 return result;
32407 }, {}); // onRealtimeCreate hook
32408
32409 applyDecorators(_this2._plugins.onRealtimeCreate, _assertThisInitialized(_this2));
32410 return _this2;
32411 }
32412
32413 var _proto = Realtime.prototype;
32414
32415 _proto._request = /*#__PURE__*/function () {
32416 var _request2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(_ref2) {
32417 var method, _url, _ref2$version, version, path, query, headers, data, url, _this$_options, appId, server, _yield$this$construct, api;
32418
32419 return _regeneratorRuntime.wrap(function _callee$(_context) {
32420 var _context27, _context28;
32421
32422 while (1) {
32423 switch (_context.prev = _context.next) {
32424 case 0:
32425 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;
32426 url = _url;
32427
32428 if (url) {
32429 _context.next = 9;
32430 break;
32431 }
32432
32433 _this$_options = this._options, appId = _this$_options.appId, server = _this$_options.server;
32434 _context.next = 6;
32435 return this.constructor._getServerUrls({
32436 appId: appId,
32437 server: server
32438 });
32439
32440 case 6:
32441 _yield$this$construct = _context.sent;
32442 api = _yield$this$construct.api;
32443 url = (0, _concat.default)(_context27 = (0, _concat.default)(_context28 = "".concat(api, "/")).call(_context28, version)).call(_context27, path);
32444
32445 case 9:
32446 return _context.abrupt("return", request({
32447 url: url,
32448 method: method,
32449 query: query,
32450 headers: _objectSpread$2({
32451 'X-LC-Id': this._options.appId,
32452 'X-LC-Key': this._options.appKey
32453 }, headers),
32454 data: data
32455 }));
32456
32457 case 10:
32458 case "end":
32459 return _context.stop();
32460 }
32461 }
32462 }, _callee, this);
32463 }));
32464
32465 function _request(_x) {
32466 return _request2.apply(this, arguments);
32467 }
32468
32469 return _request;
32470 }();
32471
32472 _proto._open = function _open() {
32473 var _this3 = this;
32474
32475 if (this._openPromise) return this._openPromise;
32476 var format = 'protobuf2';
32477
32478 if (this._options.noBinary) {
32479 // 不发送 binary data,fallback to base64 string
32480 format = 'proto2base64';
32481 }
32482
32483 var version = 3;
32484 var protocol = {
32485 format: format,
32486 version: version
32487 };
32488 this._openPromise = new _promise.default(function (resolve, reject) {
32489 debug$6('No connection established, create a new one.');
32490 var connection = new Connection(function () {
32491 return _this3._getRTMServers(_this3._options);
32492 }, protocol);
32493 connection.on(OPEN, function () {
32494 return resolve(connection);
32495 }).on(ERROR, function (error) {
32496 delete _this3._openPromise;
32497 reject(error);
32498 }).on(EXPIRE, /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
32499 return _regeneratorRuntime.wrap(function _callee2$(_context2) {
32500 while (1) {
32501 switch (_context2.prev = _context2.next) {
32502 case 0:
32503 debug$6('Connection expired. Refresh endpoints.');
32504
32505 _this3._cache.set('endpoints', null, 0);
32506
32507 _context2.next = 4;
32508 return _this3._getRTMServers(_this3._options);
32509
32510 case 4:
32511 connection.urls = _context2.sent;
32512 connection.disconnect();
32513
32514 case 6:
32515 case "end":
32516 return _context2.stop();
32517 }
32518 }
32519 }, _callee2);
32520 }))).on(MESSAGE, _this3._dispatchCommand.bind(_this3));
32521 /**
32522 * 连接断开。
32523 * 连接断开可能是因为 SDK 进入了离线状态(see {@link Realtime#event:OFFLINE}),或长时间没有收到服务器心跳。
32524 * 连接断开后所有的网络操作都会失败,请在连接断开后禁用相关的 UI 元素。
32525 * @event Realtime#DISCONNECT
32526 */
32527
32528 /**
32529 * 计划在一段时间后尝试重新连接
32530 * @event Realtime#SCHEDULE
32531 * @param {Number} attempt 尝试重连的次数
32532 * @param {Number} delay 延迟的毫秒数
32533 */
32534
32535 /**
32536 * 正在尝试重新连接
32537 * @event Realtime#RETRY
32538 * @param {Number} attempt 尝试重连的次数
32539 */
32540
32541 /**
32542 * 连接恢复正常。
32543 * 请重新启用在 {@link Realtime#event:DISCONNECT} 事件中禁用的相关 UI 元素
32544 * @event Realtime#RECONNECT
32545 */
32546
32547 /**
32548 * 客户端连接断开
32549 * @event IMClient#DISCONNECT
32550 * @see Realtime#event:DISCONNECT
32551 * @since 3.2.0
32552 */
32553
32554 /**
32555 * 计划在一段时间后尝试重新连接
32556 * @event IMClient#SCHEDULE
32557 * @param {Number} attempt 尝试重连的次数
32558 * @param {Number} delay 延迟的毫秒数
32559 * @since 3.2.0
32560 */
32561
32562 /**
32563 * 正在尝试重新连接
32564 * @event IMClient#RETRY
32565 * @param {Number} attempt 尝试重连的次数
32566 * @since 3.2.0
32567 */
32568
32569 /**
32570 * 客户端进入离线状态。
32571 * 这通常意味着网络已断开,或者 {@link Realtime#pause} 被调用
32572 * @event Realtime#OFFLINE
32573 * @since 3.4.0
32574 */
32575
32576 /**
32577 * 客户端恢复在线状态
32578 * 这通常意味着网络已恢复,或者 {@link Realtime#resume} 被调用
32579 * @event Realtime#ONLINE
32580 * @since 3.4.0
32581 */
32582
32583 /**
32584 * 进入离线状态。
32585 * 这通常意味着网络已断开,或者 {@link Realtime#pause} 被调用
32586 * @event IMClient#OFFLINE
32587 * @since 3.4.0
32588 */
32589
32590 /**
32591 * 恢复在线状态
32592 * 这通常意味着网络已恢复,或者 {@link Realtime#resume} 被调用
32593 * @event IMClient#ONLINE
32594 * @since 3.4.0
32595 */
32596 // event proxy
32597
32598 [DISCONNECT, RECONNECT, RETRY, SCHEDULE, OFFLINE, ONLINE].forEach(function (event) {
32599 return connection.on(event, function () {
32600 var _context29;
32601
32602 for (var _len = arguments.length, payload = new Array(_len), _key = 0; _key < _len; _key++) {
32603 payload[_key] = arguments[_key];
32604 }
32605
32606 debug$6("".concat(event, " event emitted. %o"), payload);
32607
32608 _this3.emit.apply(_this3, (0, _concat.default)(_context29 = [event]).call(_context29, payload));
32609
32610 if (event !== RECONNECT) {
32611 internal(_this3).clients.forEach(function (client) {
32612 var _context30;
32613
32614 client.emit.apply(client, (0, _concat.default)(_context30 = [event]).call(_context30, payload));
32615 });
32616 }
32617 });
32618 }); // override handleClose
32619
32620 connection.handleClose = function handleClose(event) {
32621 var isFatal = [ErrorCode.APP_NOT_AVAILABLE, ErrorCode.INVALID_LOGIN, ErrorCode.INVALID_ORIGIN].some(function (errorCode) {
32622 return errorCode === event.code;
32623 });
32624
32625 if (isFatal) {
32626 // in these cases, SDK should throw.
32627 this["throw"](createError(event));
32628 } else {
32629 // reconnect
32630 this.disconnect();
32631 }
32632 };
32633
32634 internal(_this3).connection = connection;
32635 });
32636 return this._openPromise;
32637 };
32638
32639 _proto._getRTMServers = /*#__PURE__*/function () {
32640 var _getRTMServers2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(options) {
32641 var info, cachedEndPoints, _info, server, secondary, ttl;
32642
32643 return _regeneratorRuntime.wrap(function _callee3$(_context3) {
32644 while (1) {
32645 switch (_context3.prev = _context3.next) {
32646 case 0:
32647 if (!options.RTMServers) {
32648 _context3.next = 2;
32649 break;
32650 }
32651
32652 return _context3.abrupt("return", shuffle(ensureArray(options.RTMServers)));
32653
32654 case 2:
32655 cachedEndPoints = this._cache.get('endpoints');
32656
32657 if (!cachedEndPoints) {
32658 _context3.next = 7;
32659 break;
32660 }
32661
32662 info = cachedEndPoints;
32663 _context3.next = 14;
32664 break;
32665
32666 case 7:
32667 _context3.next = 9;
32668 return this.constructor._fetchRTMServers(options);
32669
32670 case 9:
32671 info = _context3.sent;
32672 _info = info, server = _info.server, secondary = _info.secondary, ttl = _info.ttl;
32673
32674 if (!(typeof server !== 'string' && typeof secondary !== 'string' && typeof ttl !== 'number')) {
32675 _context3.next = 13;
32676 break;
32677 }
32678
32679 throw new Error("malformed RTM route response: ".concat((0, _stringify.default)(info)));
32680
32681 case 13:
32682 this._cache.set('endpoints', info, info.ttl * 1000);
32683
32684 case 14:
32685 debug$6('endpoint info: %O', info);
32686 return _context3.abrupt("return", [info.server, info.secondary]);
32687
32688 case 16:
32689 case "end":
32690 return _context3.stop();
32691 }
32692 }
32693 }, _callee3, this);
32694 }));
32695
32696 function _getRTMServers(_x2) {
32697 return _getRTMServers2.apply(this, arguments);
32698 }
32699
32700 return _getRTMServers;
32701 }();
32702
32703 Realtime._getServerUrls = /*#__PURE__*/function () {
32704 var _getServerUrls2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(_ref4) {
32705 var appId, server, cachedRouter, defaultProtocol;
32706 return _regeneratorRuntime.wrap(function _callee4$(_context4) {
32707 while (1) {
32708 switch (_context4.prev = _context4.next) {
32709 case 0:
32710 appId = _ref4.appId, server = _ref4.server;
32711 debug$6('fetch server urls');
32712
32713 if (!server) {
32714 _context4.next = 6;
32715 break;
32716 }
32717
32718 if (!(typeof server !== 'string')) {
32719 _context4.next = 5;
32720 break;
32721 }
32722
32723 return _context4.abrupt("return", server);
32724
32725 case 5:
32726 return _context4.abrupt("return", {
32727 RTMRouter: server,
32728 api: server
32729 });
32730
32731 case 6:
32732 cachedRouter = routerCache.get(appId);
32733
32734 if (!cachedRouter) {
32735 _context4.next = 9;
32736 break;
32737 }
32738
32739 return _context4.abrupt("return", cachedRouter);
32740
32741 case 9:
32742 defaultProtocol = 'https://';
32743 return _context4.abrupt("return", request({
32744 url: 'https://app-router.com/2/route',
32745 query: {
32746 appId: appId
32747 },
32748 timeout: 20000
32749 }).then(tap(debug$6)).then(function (_ref5) {
32750 var _context31, _context32;
32751
32752 var RTMRouterServer = _ref5.rtm_router_server,
32753 APIServer = _ref5.api_server,
32754 _ref5$ttl = _ref5.ttl,
32755 ttl = _ref5$ttl === void 0 ? 3600 : _ref5$ttl;
32756
32757 if (!RTMRouterServer) {
32758 throw new Error('rtm router not exists');
32759 }
32760
32761 var serverUrls = {
32762 RTMRouter: (0, _concat.default)(_context31 = "".concat(defaultProtocol)).call(_context31, RTMRouterServer),
32763 api: (0, _concat.default)(_context32 = "".concat(defaultProtocol)).call(_context32, APIServer)
32764 };
32765 routerCache.set(appId, serverUrls, ttl * 1000);
32766 return serverUrls;
32767 })["catch"](function () {
32768 var _context33, _context34, _context35, _context36;
32769
32770 var id = (0, _slice.default)(appId).call(appId, 0, 8).toLowerCase();
32771 var domain = 'lncldglobal.com';
32772 return {
32773 RTMRouter: (0, _concat.default)(_context33 = (0, _concat.default)(_context34 = "".concat(defaultProtocol)).call(_context34, id, ".rtm.")).call(_context33, domain),
32774 api: (0, _concat.default)(_context35 = (0, _concat.default)(_context36 = "".concat(defaultProtocol)).call(_context36, id, ".api.")).call(_context35, domain)
32775 };
32776 }));
32777
32778 case 11:
32779 case "end":
32780 return _context4.stop();
32781 }
32782 }
32783 }, _callee4);
32784 }));
32785
32786 function _getServerUrls(_x3) {
32787 return _getServerUrls2.apply(this, arguments);
32788 }
32789
32790 return _getServerUrls;
32791 }();
32792
32793 Realtime._fetchRTMServers = function _fetchRTMServers(_ref6) {
32794 var appId = _ref6.appId,
32795 ssl = _ref6.ssl,
32796 server = _ref6.server,
32797 RTMServerName = _ref6.RTMServerName;
32798 debug$6('fetch endpoint info');
32799 return this._getServerUrls({
32800 appId: appId,
32801 server: server
32802 }).then(tap(debug$6)).then(function (_ref7) {
32803 var RTMRouter = _ref7.RTMRouter;
32804 return request({
32805 url: "".concat(RTMRouter, "/v1/route"),
32806 query: {
32807 appId: appId,
32808 secure: ssl,
32809 features: isWeapp ? 'wechat' : undefined,
32810 server: RTMServerName,
32811 _t: Date.now()
32812 },
32813 timeout: 20000
32814 }).then(tap(debug$6));
32815 });
32816 };
32817
32818 _proto._close = function _close() {
32819 if (this._openPromise) {
32820 this._openPromise.then(function (connection) {
32821 return connection.close();
32822 });
32823 }
32824
32825 delete this._openPromise;
32826 }
32827 /**
32828 * 手动进行重连。
32829 * SDK 在网络出现异常时会自动按照一定的时间间隔尝试重连,调用该方法会立即尝试重连并重置重连尝试计数器。
32830 * 只能在 `SCHEDULE` 事件之后,`RETRY` 事件之前调用,如果当前网络正常或者正在进行重连,调用该方法会抛异常。
32831 */
32832 ;
32833
32834 _proto.retry = function retry() {
32835 var _internal = internal(this),
32836 connection = _internal.connection;
32837
32838 if (!connection) {
32839 throw new Error('no connection established');
32840 }
32841
32842 if (connection.cannot('retry')) {
32843 throw new Error("retrying not allowed when not disconnected. the connection is now ".concat(connection.current));
32844 }
32845
32846 return connection.retry();
32847 }
32848 /**
32849 * 暂停,使 SDK 进入离线状态。
32850 * 你可以在网络断开、应用进入后台等时刻调用该方法让 SDK 进入离线状态,离线状态下不会尝试重连。
32851 * 在浏览器中 SDK 会自动监听网络变化,因此无需手动调用该方法。
32852 *
32853 * @since 3.4.0
32854 * @see Realtime#event:OFFLINE
32855 */
32856 ;
32857
32858 _proto.pause = function pause() {
32859 // 这个方法常常在网络断开、进入后台时被调用,此时 connection 可能没有建立或者已经 close。
32860 // 因此不像 retry,这个方法应该尽可能 loose
32861 var _internal2 = internal(this),
32862 connection = _internal2.connection;
32863
32864 if (!connection) return;
32865 if (connection.can('pause')) connection.pause();
32866 }
32867 /**
32868 * 恢复在线状态。
32869 * 你可以在网络恢复、应用回到前台等时刻调用该方法让 SDK 恢复在线状态,恢复在线状态后 SDK 会开始尝试重连。
32870 *
32871 * @since 3.4.0
32872 * @see Realtime#event:ONLINE
32873 */
32874 ;
32875
32876 _proto.resume = function resume() {
32877 // 与 pause 一样,这个方法应该尽可能 loose
32878 var _internal3 = internal(this),
32879 connection = _internal3.connection;
32880
32881 if (!connection) return;
32882 if (connection.can('resume')) connection.resume();
32883 };
32884
32885 _proto._registerPending = function _registerPending(value) {
32886 internal(this).pendingClients.add(value);
32887 };
32888
32889 _proto._deregisterPending = function _deregisterPending(client) {
32890 internal(this).pendingClients["delete"](client);
32891 };
32892
32893 _proto._register = function _register(client) {
32894 internal(this).clients.add(client);
32895 };
32896
32897 _proto._deregister = function _deregister(client) {
32898 var _this = internal(this);
32899
32900 _this.clients["delete"](client);
32901
32902 if (_this.clients.size + _this.pendingClients.size === 0) {
32903 this._close();
32904 }
32905 };
32906
32907 _proto._dispatchCommand = function _dispatchCommand(command) {
32908 return applyDispatcher(this._plugins.beforeCommandDispatch, [command, this]).then(function (shouldDispatch) {
32909 // no plugin handled this command
32910 if (shouldDispatch) return debug$6('[WARN] Unexpected message received: %O', trim(command));
32911 return false;
32912 });
32913 };
32914
32915 return Realtime;
32916}(EventEmitter); // For test purpose only
32917
32918
32919var polyfilledPromise = _promise.default;
32920exports.EventEmitter = EventEmitter;
32921exports.Promise = polyfilledPromise;
32922exports.Protocals = message;
32923exports.Protocols = message;
32924exports.Realtime = Realtime;
32925exports.debug = debug$2;
32926exports.getAdapter = getAdapter;
32927exports.setAdapters = setAdapters;
32928/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(78)))
32929
32930/***/ }),
32931/* 622 */
32932/***/ (function(module, exports, __webpack_require__) {
32933
32934module.exports = __webpack_require__(623);
32935
32936/***/ }),
32937/* 623 */
32938/***/ (function(module, exports, __webpack_require__) {
32939
32940var parent = __webpack_require__(624);
32941
32942module.exports = parent;
32943
32944
32945/***/ }),
32946/* 624 */
32947/***/ (function(module, exports, __webpack_require__) {
32948
32949__webpack_require__(625);
32950var path = __webpack_require__(7);
32951
32952module.exports = path.Object.freeze;
32953
32954
32955/***/ }),
32956/* 625 */
32957/***/ (function(module, exports, __webpack_require__) {
32958
32959var $ = __webpack_require__(0);
32960var FREEZING = __webpack_require__(263);
32961var fails = __webpack_require__(2);
32962var isObject = __webpack_require__(11);
32963var onFreeze = __webpack_require__(97).onFreeze;
32964
32965// eslint-disable-next-line es-x/no-object-freeze -- safe
32966var $freeze = Object.freeze;
32967var FAILS_ON_PRIMITIVES = fails(function () { $freeze(1); });
32968
32969// `Object.freeze` method
32970// https://tc39.es/ecma262/#sec-object.freeze
32971$({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES, sham: !FREEZING }, {
32972 freeze: function freeze(it) {
32973 return $freeze && isObject(it) ? $freeze(onFreeze(it)) : it;
32974 }
32975});
32976
32977
32978/***/ }),
32979/* 626 */
32980/***/ (function(module, exports, __webpack_require__) {
32981
32982// FF26- bug: ArrayBuffers are non-extensible, but Object.isExtensible does not report it
32983var fails = __webpack_require__(2);
32984
32985module.exports = fails(function () {
32986 if (typeof ArrayBuffer == 'function') {
32987 var buffer = new ArrayBuffer(8);
32988 // eslint-disable-next-line es-x/no-object-isextensible, es-x/no-object-defineproperty -- safe
32989 if (Object.isExtensible(buffer)) Object.defineProperty(buffer, 'a', { value: 8 });
32990 }
32991});
32992
32993
32994/***/ }),
32995/* 627 */
32996/***/ (function(module, exports, __webpack_require__) {
32997
32998var parent = __webpack_require__(628);
32999
33000module.exports = parent;
33001
33002
33003/***/ }),
33004/* 628 */
33005/***/ (function(module, exports, __webpack_require__) {
33006
33007__webpack_require__(629);
33008var path = __webpack_require__(7);
33009
33010module.exports = path.Object.assign;
33011
33012
33013/***/ }),
33014/* 629 */
33015/***/ (function(module, exports, __webpack_require__) {
33016
33017var $ = __webpack_require__(0);
33018var assign = __webpack_require__(630);
33019
33020// `Object.assign` method
33021// https://tc39.es/ecma262/#sec-object.assign
33022// eslint-disable-next-line es-x/no-object-assign -- required for testing
33023$({ target: 'Object', stat: true, arity: 2, forced: Object.assign !== assign }, {
33024 assign: assign
33025});
33026
33027
33028/***/ }),
33029/* 630 */
33030/***/ (function(module, exports, __webpack_require__) {
33031
33032"use strict";
33033
33034var DESCRIPTORS = __webpack_require__(14);
33035var uncurryThis = __webpack_require__(4);
33036var call = __webpack_require__(15);
33037var fails = __webpack_require__(2);
33038var objectKeys = __webpack_require__(107);
33039var getOwnPropertySymbolsModule = __webpack_require__(106);
33040var propertyIsEnumerableModule = __webpack_require__(121);
33041var toObject = __webpack_require__(33);
33042var IndexedObject = __webpack_require__(98);
33043
33044// eslint-disable-next-line es-x/no-object-assign -- safe
33045var $assign = Object.assign;
33046// eslint-disable-next-line es-x/no-object-defineproperty -- required for testing
33047var defineProperty = Object.defineProperty;
33048var concat = uncurryThis([].concat);
33049
33050// `Object.assign` method
33051// https://tc39.es/ecma262/#sec-object.assign
33052module.exports = !$assign || fails(function () {
33053 // should have correct order of operations (Edge bug)
33054 if (DESCRIPTORS && $assign({ b: 1 }, $assign(defineProperty({}, 'a', {
33055 enumerable: true,
33056 get: function () {
33057 defineProperty(this, 'b', {
33058 value: 3,
33059 enumerable: false
33060 });
33061 }
33062 }), { b: 2 })).b !== 1) return true;
33063 // should work with symbols and should have deterministic property order (V8 bug)
33064 var A = {};
33065 var B = {};
33066 // eslint-disable-next-line es-x/no-symbol -- safe
33067 var symbol = Symbol();
33068 var alphabet = 'abcdefghijklmnopqrst';
33069 A[symbol] = 7;
33070 alphabet.split('').forEach(function (chr) { B[chr] = chr; });
33071 return $assign({}, A)[symbol] != 7 || objectKeys($assign({}, B)).join('') != alphabet;
33072}) ? function assign(target, source) { // eslint-disable-line no-unused-vars -- required for `.length`
33073 var T = toObject(target);
33074 var argumentsLength = arguments.length;
33075 var index = 1;
33076 var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;
33077 var propertyIsEnumerable = propertyIsEnumerableModule.f;
33078 while (argumentsLength > index) {
33079 var S = IndexedObject(arguments[index++]);
33080 var keys = getOwnPropertySymbols ? concat(objectKeys(S), getOwnPropertySymbols(S)) : objectKeys(S);
33081 var length = keys.length;
33082 var j = 0;
33083 var key;
33084 while (length > j) {
33085 key = keys[j++];
33086 if (!DESCRIPTORS || call(propertyIsEnumerable, S, key)) T[key] = S[key];
33087 }
33088 } return T;
33089} : $assign;
33090
33091
33092/***/ }),
33093/* 631 */
33094/***/ (function(module, exports, __webpack_require__) {
33095
33096var parent = __webpack_require__(632);
33097
33098module.exports = parent;
33099
33100
33101/***/ }),
33102/* 632 */
33103/***/ (function(module, exports, __webpack_require__) {
33104
33105__webpack_require__(242);
33106var path = __webpack_require__(7);
33107
33108module.exports = path.Object.getOwnPropertySymbols;
33109
33110
33111/***/ }),
33112/* 633 */
33113/***/ (function(module, exports, __webpack_require__) {
33114
33115module.exports = __webpack_require__(634);
33116
33117/***/ }),
33118/* 634 */
33119/***/ (function(module, exports, __webpack_require__) {
33120
33121var parent = __webpack_require__(635);
33122
33123module.exports = parent;
33124
33125
33126/***/ }),
33127/* 635 */
33128/***/ (function(module, exports, __webpack_require__) {
33129
33130__webpack_require__(636);
33131var path = __webpack_require__(7);
33132
33133module.exports = path.Object.getOwnPropertyDescriptors;
33134
33135
33136/***/ }),
33137/* 636 */
33138/***/ (function(module, exports, __webpack_require__) {
33139
33140var $ = __webpack_require__(0);
33141var DESCRIPTORS = __webpack_require__(14);
33142var ownKeys = __webpack_require__(162);
33143var toIndexedObject = __webpack_require__(35);
33144var getOwnPropertyDescriptorModule = __webpack_require__(64);
33145var createProperty = __webpack_require__(93);
33146
33147// `Object.getOwnPropertyDescriptors` method
33148// https://tc39.es/ecma262/#sec-object.getownpropertydescriptors
33149$({ target: 'Object', stat: true, sham: !DESCRIPTORS }, {
33150 getOwnPropertyDescriptors: function getOwnPropertyDescriptors(object) {
33151 var O = toIndexedObject(object);
33152 var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
33153 var keys = ownKeys(O);
33154 var result = {};
33155 var index = 0;
33156 var key, descriptor;
33157 while (keys.length > index) {
33158 descriptor = getOwnPropertyDescriptor(O, key = keys[index++]);
33159 if (descriptor !== undefined) createProperty(result, key, descriptor);
33160 }
33161 return result;
33162 }
33163});
33164
33165
33166/***/ }),
33167/* 637 */
33168/***/ (function(module, exports, __webpack_require__) {
33169
33170module.exports = __webpack_require__(638);
33171
33172/***/ }),
33173/* 638 */
33174/***/ (function(module, exports, __webpack_require__) {
33175
33176var parent = __webpack_require__(639);
33177
33178module.exports = parent;
33179
33180
33181/***/ }),
33182/* 639 */
33183/***/ (function(module, exports, __webpack_require__) {
33184
33185__webpack_require__(640);
33186var path = __webpack_require__(7);
33187
33188var Object = path.Object;
33189
33190var defineProperties = module.exports = function defineProperties(T, D) {
33191 return Object.defineProperties(T, D);
33192};
33193
33194if (Object.defineProperties.sham) defineProperties.sham = true;
33195
33196
33197/***/ }),
33198/* 640 */
33199/***/ (function(module, exports, __webpack_require__) {
33200
33201var $ = __webpack_require__(0);
33202var DESCRIPTORS = __webpack_require__(14);
33203var defineProperties = __webpack_require__(129).f;
33204
33205// `Object.defineProperties` method
33206// https://tc39.es/ecma262/#sec-object.defineproperties
33207// eslint-disable-next-line es-x/no-object-defineproperties -- safe
33208$({ target: 'Object', stat: true, forced: Object.defineProperties !== defineProperties, sham: !DESCRIPTORS }, {
33209 defineProperties: defineProperties
33210});
33211
33212
33213/***/ }),
33214/* 641 */
33215/***/ (function(module, exports, __webpack_require__) {
33216
33217module.exports = __webpack_require__(642);
33218
33219/***/ }),
33220/* 642 */
33221/***/ (function(module, exports, __webpack_require__) {
33222
33223var parent = __webpack_require__(643);
33224__webpack_require__(46);
33225
33226module.exports = parent;
33227
33228
33229/***/ }),
33230/* 643 */
33231/***/ (function(module, exports, __webpack_require__) {
33232
33233__webpack_require__(43);
33234__webpack_require__(68);
33235__webpack_require__(644);
33236var path = __webpack_require__(7);
33237
33238module.exports = path.WeakMap;
33239
33240
33241/***/ }),
33242/* 644 */
33243/***/ (function(module, exports, __webpack_require__) {
33244
33245// TODO: Remove this module from `core-js@4` since it's replaced to module below
33246__webpack_require__(645);
33247
33248
33249/***/ }),
33250/* 645 */
33251/***/ (function(module, exports, __webpack_require__) {
33252
33253"use strict";
33254
33255var global = __webpack_require__(8);
33256var uncurryThis = __webpack_require__(4);
33257var defineBuiltIns = __webpack_require__(156);
33258var InternalMetadataModule = __webpack_require__(97);
33259var collection = __webpack_require__(267);
33260var collectionWeak = __webpack_require__(646);
33261var isObject = __webpack_require__(11);
33262var isExtensible = __webpack_require__(264);
33263var enforceInternalState = __webpack_require__(44).enforce;
33264var NATIVE_WEAK_MAP = __webpack_require__(168);
33265
33266var IS_IE11 = !global.ActiveXObject && 'ActiveXObject' in global;
33267var InternalWeakMap;
33268
33269var wrapper = function (init) {
33270 return function WeakMap() {
33271 return init(this, arguments.length ? arguments[0] : undefined);
33272 };
33273};
33274
33275// `WeakMap` constructor
33276// https://tc39.es/ecma262/#sec-weakmap-constructor
33277var $WeakMap = collection('WeakMap', wrapper, collectionWeak);
33278
33279// IE11 WeakMap frozen keys fix
33280// We can't use feature detection because it crash some old IE builds
33281// https://github.com/zloirock/core-js/issues/485
33282if (NATIVE_WEAK_MAP && IS_IE11) {
33283 InternalWeakMap = collectionWeak.getConstructor(wrapper, 'WeakMap', true);
33284 InternalMetadataModule.enable();
33285 var WeakMapPrototype = $WeakMap.prototype;
33286 var nativeDelete = uncurryThis(WeakMapPrototype['delete']);
33287 var nativeHas = uncurryThis(WeakMapPrototype.has);
33288 var nativeGet = uncurryThis(WeakMapPrototype.get);
33289 var nativeSet = uncurryThis(WeakMapPrototype.set);
33290 defineBuiltIns(WeakMapPrototype, {
33291 'delete': function (key) {
33292 if (isObject(key) && !isExtensible(key)) {
33293 var state = enforceInternalState(this);
33294 if (!state.frozen) state.frozen = new InternalWeakMap();
33295 return nativeDelete(this, key) || state.frozen['delete'](key);
33296 } return nativeDelete(this, key);
33297 },
33298 has: function has(key) {
33299 if (isObject(key) && !isExtensible(key)) {
33300 var state = enforceInternalState(this);
33301 if (!state.frozen) state.frozen = new InternalWeakMap();
33302 return nativeHas(this, key) || state.frozen.has(key);
33303 } return nativeHas(this, key);
33304 },
33305 get: function get(key) {
33306 if (isObject(key) && !isExtensible(key)) {
33307 var state = enforceInternalState(this);
33308 if (!state.frozen) state.frozen = new InternalWeakMap();
33309 return nativeHas(this, key) ? nativeGet(this, key) : state.frozen.get(key);
33310 } return nativeGet(this, key);
33311 },
33312 set: function set(key, value) {
33313 if (isObject(key) && !isExtensible(key)) {
33314 var state = enforceInternalState(this);
33315 if (!state.frozen) state.frozen = new InternalWeakMap();
33316 nativeHas(this, key) ? nativeSet(this, key, value) : state.frozen.set(key, value);
33317 } else nativeSet(this, key, value);
33318 return this;
33319 }
33320 });
33321}
33322
33323
33324/***/ }),
33325/* 646 */
33326/***/ (function(module, exports, __webpack_require__) {
33327
33328"use strict";
33329
33330var uncurryThis = __webpack_require__(4);
33331var defineBuiltIns = __webpack_require__(156);
33332var getWeakData = __webpack_require__(97).getWeakData;
33333var anObject = __webpack_require__(21);
33334var isObject = __webpack_require__(11);
33335var anInstance = __webpack_require__(110);
33336var iterate = __webpack_require__(41);
33337var ArrayIterationModule = __webpack_require__(75);
33338var hasOwn = __webpack_require__(13);
33339var InternalStateModule = __webpack_require__(44);
33340
33341var setInternalState = InternalStateModule.set;
33342var internalStateGetterFor = InternalStateModule.getterFor;
33343var find = ArrayIterationModule.find;
33344var findIndex = ArrayIterationModule.findIndex;
33345var splice = uncurryThis([].splice);
33346var id = 0;
33347
33348// fallback for uncaught frozen keys
33349var uncaughtFrozenStore = function (store) {
33350 return store.frozen || (store.frozen = new UncaughtFrozenStore());
33351};
33352
33353var UncaughtFrozenStore = function () {
33354 this.entries = [];
33355};
33356
33357var findUncaughtFrozen = function (store, key) {
33358 return find(store.entries, function (it) {
33359 return it[0] === key;
33360 });
33361};
33362
33363UncaughtFrozenStore.prototype = {
33364 get: function (key) {
33365 var entry = findUncaughtFrozen(this, key);
33366 if (entry) return entry[1];
33367 },
33368 has: function (key) {
33369 return !!findUncaughtFrozen(this, key);
33370 },
33371 set: function (key, value) {
33372 var entry = findUncaughtFrozen(this, key);
33373 if (entry) entry[1] = value;
33374 else this.entries.push([key, value]);
33375 },
33376 'delete': function (key) {
33377 var index = findIndex(this.entries, function (it) {
33378 return it[0] === key;
33379 });
33380 if (~index) splice(this.entries, index, 1);
33381 return !!~index;
33382 }
33383};
33384
33385module.exports = {
33386 getConstructor: function (wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER) {
33387 var Constructor = wrapper(function (that, iterable) {
33388 anInstance(that, Prototype);
33389 setInternalState(that, {
33390 type: CONSTRUCTOR_NAME,
33391 id: id++,
33392 frozen: undefined
33393 });
33394 if (iterable != undefined) iterate(iterable, that[ADDER], { that: that, AS_ENTRIES: IS_MAP });
33395 });
33396
33397 var Prototype = Constructor.prototype;
33398
33399 var getInternalState = internalStateGetterFor(CONSTRUCTOR_NAME);
33400
33401 var define = function (that, key, value) {
33402 var state = getInternalState(that);
33403 var data = getWeakData(anObject(key), true);
33404 if (data === true) uncaughtFrozenStore(state).set(key, value);
33405 else data[state.id] = value;
33406 return that;
33407 };
33408
33409 defineBuiltIns(Prototype, {
33410 // `{ WeakMap, WeakSet }.prototype.delete(key)` methods
33411 // https://tc39.es/ecma262/#sec-weakmap.prototype.delete
33412 // https://tc39.es/ecma262/#sec-weakset.prototype.delete
33413 'delete': function (key) {
33414 var state = getInternalState(this);
33415 if (!isObject(key)) return false;
33416 var data = getWeakData(key);
33417 if (data === true) return uncaughtFrozenStore(state)['delete'](key);
33418 return data && hasOwn(data, state.id) && delete data[state.id];
33419 },
33420 // `{ WeakMap, WeakSet }.prototype.has(key)` methods
33421 // https://tc39.es/ecma262/#sec-weakmap.prototype.has
33422 // https://tc39.es/ecma262/#sec-weakset.prototype.has
33423 has: function has(key) {
33424 var state = getInternalState(this);
33425 if (!isObject(key)) return false;
33426 var data = getWeakData(key);
33427 if (data === true) return uncaughtFrozenStore(state).has(key);
33428 return data && hasOwn(data, state.id);
33429 }
33430 });
33431
33432 defineBuiltIns(Prototype, IS_MAP ? {
33433 // `WeakMap.prototype.get(key)` method
33434 // https://tc39.es/ecma262/#sec-weakmap.prototype.get
33435 get: function get(key) {
33436 var state = getInternalState(this);
33437 if (isObject(key)) {
33438 var data = getWeakData(key);
33439 if (data === true) return uncaughtFrozenStore(state).get(key);
33440 return data ? data[state.id] : undefined;
33441 }
33442 },
33443 // `WeakMap.prototype.set(key, value)` method
33444 // https://tc39.es/ecma262/#sec-weakmap.prototype.set
33445 set: function set(key, value) {
33446 return define(this, key, value);
33447 }
33448 } : {
33449 // `WeakSet.prototype.add(value)` method
33450 // https://tc39.es/ecma262/#sec-weakset.prototype.add
33451 add: function add(value) {
33452 return define(this, value, true);
33453 }
33454 });
33455
33456 return Constructor;
33457 }
33458};
33459
33460
33461/***/ }),
33462/* 647 */
33463/***/ (function(module, exports, __webpack_require__) {
33464
33465var parent = __webpack_require__(648);
33466__webpack_require__(46);
33467
33468module.exports = parent;
33469
33470
33471/***/ }),
33472/* 648 */
33473/***/ (function(module, exports, __webpack_require__) {
33474
33475__webpack_require__(43);
33476__webpack_require__(68);
33477__webpack_require__(649);
33478__webpack_require__(70);
33479var path = __webpack_require__(7);
33480
33481module.exports = path.Set;
33482
33483
33484/***/ }),
33485/* 649 */
33486/***/ (function(module, exports, __webpack_require__) {
33487
33488// TODO: Remove this module from `core-js@4` since it's replaced to module below
33489__webpack_require__(650);
33490
33491
33492/***/ }),
33493/* 650 */
33494/***/ (function(module, exports, __webpack_require__) {
33495
33496"use strict";
33497
33498var collection = __webpack_require__(267);
33499var collectionStrong = __webpack_require__(651);
33500
33501// `Set` constructor
33502// https://tc39.es/ecma262/#sec-set-objects
33503collection('Set', function (init) {
33504 return function Set() { return init(this, arguments.length ? arguments[0] : undefined); };
33505}, collectionStrong);
33506
33507
33508/***/ }),
33509/* 651 */
33510/***/ (function(module, exports, __webpack_require__) {
33511
33512"use strict";
33513
33514var defineProperty = __webpack_require__(23).f;
33515var create = __webpack_require__(53);
33516var defineBuiltIns = __webpack_require__(156);
33517var bind = __webpack_require__(52);
33518var anInstance = __webpack_require__(110);
33519var iterate = __webpack_require__(41);
33520var defineIterator = __webpack_require__(133);
33521var setSpecies = __webpack_require__(171);
33522var DESCRIPTORS = __webpack_require__(14);
33523var fastKey = __webpack_require__(97).fastKey;
33524var InternalStateModule = __webpack_require__(44);
33525
33526var setInternalState = InternalStateModule.set;
33527var internalStateGetterFor = InternalStateModule.getterFor;
33528
33529module.exports = {
33530 getConstructor: function (wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER) {
33531 var Constructor = wrapper(function (that, iterable) {
33532 anInstance(that, Prototype);
33533 setInternalState(that, {
33534 type: CONSTRUCTOR_NAME,
33535 index: create(null),
33536 first: undefined,
33537 last: undefined,
33538 size: 0
33539 });
33540 if (!DESCRIPTORS) that.size = 0;
33541 if (iterable != undefined) iterate(iterable, that[ADDER], { that: that, AS_ENTRIES: IS_MAP });
33542 });
33543
33544 var Prototype = Constructor.prototype;
33545
33546 var getInternalState = internalStateGetterFor(CONSTRUCTOR_NAME);
33547
33548 var define = function (that, key, value) {
33549 var state = getInternalState(that);
33550 var entry = getEntry(that, key);
33551 var previous, index;
33552 // change existing entry
33553 if (entry) {
33554 entry.value = value;
33555 // create new entry
33556 } else {
33557 state.last = entry = {
33558 index: index = fastKey(key, true),
33559 key: key,
33560 value: value,
33561 previous: previous = state.last,
33562 next: undefined,
33563 removed: false
33564 };
33565 if (!state.first) state.first = entry;
33566 if (previous) previous.next = entry;
33567 if (DESCRIPTORS) state.size++;
33568 else that.size++;
33569 // add to index
33570 if (index !== 'F') state.index[index] = entry;
33571 } return that;
33572 };
33573
33574 var getEntry = function (that, key) {
33575 var state = getInternalState(that);
33576 // fast case
33577 var index = fastKey(key);
33578 var entry;
33579 if (index !== 'F') return state.index[index];
33580 // frozen object case
33581 for (entry = state.first; entry; entry = entry.next) {
33582 if (entry.key == key) return entry;
33583 }
33584 };
33585
33586 defineBuiltIns(Prototype, {
33587 // `{ Map, Set }.prototype.clear()` methods
33588 // https://tc39.es/ecma262/#sec-map.prototype.clear
33589 // https://tc39.es/ecma262/#sec-set.prototype.clear
33590 clear: function clear() {
33591 var that = this;
33592 var state = getInternalState(that);
33593 var data = state.index;
33594 var entry = state.first;
33595 while (entry) {
33596 entry.removed = true;
33597 if (entry.previous) entry.previous = entry.previous.next = undefined;
33598 delete data[entry.index];
33599 entry = entry.next;
33600 }
33601 state.first = state.last = undefined;
33602 if (DESCRIPTORS) state.size = 0;
33603 else that.size = 0;
33604 },
33605 // `{ Map, Set }.prototype.delete(key)` methods
33606 // https://tc39.es/ecma262/#sec-map.prototype.delete
33607 // https://tc39.es/ecma262/#sec-set.prototype.delete
33608 'delete': function (key) {
33609 var that = this;
33610 var state = getInternalState(that);
33611 var entry = getEntry(that, key);
33612 if (entry) {
33613 var next = entry.next;
33614 var prev = entry.previous;
33615 delete state.index[entry.index];
33616 entry.removed = true;
33617 if (prev) prev.next = next;
33618 if (next) next.previous = prev;
33619 if (state.first == entry) state.first = next;
33620 if (state.last == entry) state.last = prev;
33621 if (DESCRIPTORS) state.size--;
33622 else that.size--;
33623 } return !!entry;
33624 },
33625 // `{ Map, Set }.prototype.forEach(callbackfn, thisArg = undefined)` methods
33626 // https://tc39.es/ecma262/#sec-map.prototype.foreach
33627 // https://tc39.es/ecma262/#sec-set.prototype.foreach
33628 forEach: function forEach(callbackfn /* , that = undefined */) {
33629 var state = getInternalState(this);
33630 var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined);
33631 var entry;
33632 while (entry = entry ? entry.next : state.first) {
33633 boundFunction(entry.value, entry.key, this);
33634 // revert to the last existing entry
33635 while (entry && entry.removed) entry = entry.previous;
33636 }
33637 },
33638 // `{ Map, Set}.prototype.has(key)` methods
33639 // https://tc39.es/ecma262/#sec-map.prototype.has
33640 // https://tc39.es/ecma262/#sec-set.prototype.has
33641 has: function has(key) {
33642 return !!getEntry(this, key);
33643 }
33644 });
33645
33646 defineBuiltIns(Prototype, IS_MAP ? {
33647 // `Map.prototype.get(key)` method
33648 // https://tc39.es/ecma262/#sec-map.prototype.get
33649 get: function get(key) {
33650 var entry = getEntry(this, key);
33651 return entry && entry.value;
33652 },
33653 // `Map.prototype.set(key, value)` method
33654 // https://tc39.es/ecma262/#sec-map.prototype.set
33655 set: function set(key, value) {
33656 return define(this, key === 0 ? 0 : key, value);
33657 }
33658 } : {
33659 // `Set.prototype.add(value)` method
33660 // https://tc39.es/ecma262/#sec-set.prototype.add
33661 add: function add(value) {
33662 return define(this, value = value === 0 ? 0 : value, value);
33663 }
33664 });
33665 if (DESCRIPTORS) defineProperty(Prototype, 'size', {
33666 get: function () {
33667 return getInternalState(this).size;
33668 }
33669 });
33670 return Constructor;
33671 },
33672 setStrong: function (Constructor, CONSTRUCTOR_NAME, IS_MAP) {
33673 var ITERATOR_NAME = CONSTRUCTOR_NAME + ' Iterator';
33674 var getInternalCollectionState = internalStateGetterFor(CONSTRUCTOR_NAME);
33675 var getInternalIteratorState = internalStateGetterFor(ITERATOR_NAME);
33676 // `{ Map, Set }.prototype.{ keys, values, entries, @@iterator }()` methods
33677 // https://tc39.es/ecma262/#sec-map.prototype.entries
33678 // https://tc39.es/ecma262/#sec-map.prototype.keys
33679 // https://tc39.es/ecma262/#sec-map.prototype.values
33680 // https://tc39.es/ecma262/#sec-map.prototype-@@iterator
33681 // https://tc39.es/ecma262/#sec-set.prototype.entries
33682 // https://tc39.es/ecma262/#sec-set.prototype.keys
33683 // https://tc39.es/ecma262/#sec-set.prototype.values
33684 // https://tc39.es/ecma262/#sec-set.prototype-@@iterator
33685 defineIterator(Constructor, CONSTRUCTOR_NAME, function (iterated, kind) {
33686 setInternalState(this, {
33687 type: ITERATOR_NAME,
33688 target: iterated,
33689 state: getInternalCollectionState(iterated),
33690 kind: kind,
33691 last: undefined
33692 });
33693 }, function () {
33694 var state = getInternalIteratorState(this);
33695 var kind = state.kind;
33696 var entry = state.last;
33697 // revert to the last existing entry
33698 while (entry && entry.removed) entry = entry.previous;
33699 // get next entry
33700 if (!state.target || !(state.last = entry = entry ? entry.next : state.state.first)) {
33701 // or finish the iteration
33702 state.target = undefined;
33703 return { value: undefined, done: true };
33704 }
33705 // return step by kind
33706 if (kind == 'keys') return { value: entry.key, done: false };
33707 if (kind == 'values') return { value: entry.value, done: false };
33708 return { value: [entry.key, entry.value], done: false };
33709 }, IS_MAP ? 'entries' : 'values', !IS_MAP, true);
33710
33711 // `{ Map, Set }.prototype[@@species]` accessors
33712 // https://tc39.es/ecma262/#sec-get-map-@@species
33713 // https://tc39.es/ecma262/#sec-get-set-@@species
33714 setSpecies(CONSTRUCTOR_NAME);
33715 }
33716};
33717
33718
33719/***/ }),
33720/* 652 */
33721/***/ (function(module, exports, __webpack_require__) {
33722
33723var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*
33724 Copyright 2013 Daniel Wirtz <dcode@dcode.io>
33725
33726 Licensed under the Apache License, Version 2.0 (the "License");
33727 you may not use this file except in compliance with the License.
33728 You may obtain a copy of the License at
33729
33730 http://www.apache.org/licenses/LICENSE-2.0
33731
33732 Unless required by applicable law or agreed to in writing, software
33733 distributed under the License is distributed on an "AS IS" BASIS,
33734 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
33735 See the License for the specific language governing permissions and
33736 limitations under the License.
33737 */
33738
33739/**
33740 * @license protobuf.js (c) 2013 Daniel Wirtz <dcode@dcode.io>
33741 * Released under the Apache License, Version 2.0
33742 * see: https://github.com/dcodeIO/protobuf.js for details
33743 */
33744(function(global, factory) {
33745
33746 /* AMD */ if (true)
33747 !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(653)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
33748 __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
33749 (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
33750 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
33751 /* CommonJS */ else if (typeof require === "function" && typeof module === "object" && module && module["exports"])
33752 module["exports"] = factory(require("bytebuffer"), true);
33753 /* Global */ else
33754 (global["dcodeIO"] = global["dcodeIO"] || {})["ProtoBuf"] = factory(global["dcodeIO"]["ByteBuffer"]);
33755
33756})(this, function(ByteBuffer, isCommonJS) {
33757 "use strict";
33758
33759 /**
33760 * The ProtoBuf namespace.
33761 * @exports ProtoBuf
33762 * @namespace
33763 * @expose
33764 */
33765 var ProtoBuf = {};
33766
33767 /**
33768 * @type {!function(new: ByteBuffer, ...[*])}
33769 * @expose
33770 */
33771 ProtoBuf.ByteBuffer = ByteBuffer;
33772
33773 /**
33774 * @type {?function(new: Long, ...[*])}
33775 * @expose
33776 */
33777 ProtoBuf.Long = ByteBuffer.Long || null;
33778
33779 /**
33780 * ProtoBuf.js version.
33781 * @type {string}
33782 * @const
33783 * @expose
33784 */
33785 ProtoBuf.VERSION = "5.0.3";
33786
33787 /**
33788 * Wire types.
33789 * @type {Object.<string,number>}
33790 * @const
33791 * @expose
33792 */
33793 ProtoBuf.WIRE_TYPES = {};
33794
33795 /**
33796 * Varint wire type.
33797 * @type {number}
33798 * @expose
33799 */
33800 ProtoBuf.WIRE_TYPES.VARINT = 0;
33801
33802 /**
33803 * Fixed 64 bits wire type.
33804 * @type {number}
33805 * @const
33806 * @expose
33807 */
33808 ProtoBuf.WIRE_TYPES.BITS64 = 1;
33809
33810 /**
33811 * Length delimited wire type.
33812 * @type {number}
33813 * @const
33814 * @expose
33815 */
33816 ProtoBuf.WIRE_TYPES.LDELIM = 2;
33817
33818 /**
33819 * Start group wire type.
33820 * @type {number}
33821 * @const
33822 * @expose
33823 */
33824 ProtoBuf.WIRE_TYPES.STARTGROUP = 3;
33825
33826 /**
33827 * End group wire type.
33828 * @type {number}
33829 * @const
33830 * @expose
33831 */
33832 ProtoBuf.WIRE_TYPES.ENDGROUP = 4;
33833
33834 /**
33835 * Fixed 32 bits wire type.
33836 * @type {number}
33837 * @const
33838 * @expose
33839 */
33840 ProtoBuf.WIRE_TYPES.BITS32 = 5;
33841
33842 /**
33843 * Packable wire types.
33844 * @type {!Array.<number>}
33845 * @const
33846 * @expose
33847 */
33848 ProtoBuf.PACKABLE_WIRE_TYPES = [
33849 ProtoBuf.WIRE_TYPES.VARINT,
33850 ProtoBuf.WIRE_TYPES.BITS64,
33851 ProtoBuf.WIRE_TYPES.BITS32
33852 ];
33853
33854 /**
33855 * Types.
33856 * @dict
33857 * @type {!Object.<string,{name: string, wireType: number, defaultValue: *}>}
33858 * @const
33859 * @expose
33860 */
33861 ProtoBuf.TYPES = {
33862 // According to the protobuf spec.
33863 "int32": {
33864 name: "int32",
33865 wireType: ProtoBuf.WIRE_TYPES.VARINT,
33866 defaultValue: 0
33867 },
33868 "uint32": {
33869 name: "uint32",
33870 wireType: ProtoBuf.WIRE_TYPES.VARINT,
33871 defaultValue: 0
33872 },
33873 "sint32": {
33874 name: "sint32",
33875 wireType: ProtoBuf.WIRE_TYPES.VARINT,
33876 defaultValue: 0
33877 },
33878 "int64": {
33879 name: "int64",
33880 wireType: ProtoBuf.WIRE_TYPES.VARINT,
33881 defaultValue: ProtoBuf.Long ? ProtoBuf.Long.ZERO : undefined
33882 },
33883 "uint64": {
33884 name: "uint64",
33885 wireType: ProtoBuf.WIRE_TYPES.VARINT,
33886 defaultValue: ProtoBuf.Long ? ProtoBuf.Long.UZERO : undefined
33887 },
33888 "sint64": {
33889 name: "sint64",
33890 wireType: ProtoBuf.WIRE_TYPES.VARINT,
33891 defaultValue: ProtoBuf.Long ? ProtoBuf.Long.ZERO : undefined
33892 },
33893 "bool": {
33894 name: "bool",
33895 wireType: ProtoBuf.WIRE_TYPES.VARINT,
33896 defaultValue: false
33897 },
33898 "double": {
33899 name: "double",
33900 wireType: ProtoBuf.WIRE_TYPES.BITS64,
33901 defaultValue: 0
33902 },
33903 "string": {
33904 name: "string",
33905 wireType: ProtoBuf.WIRE_TYPES.LDELIM,
33906 defaultValue: ""
33907 },
33908 "bytes": {
33909 name: "bytes",
33910 wireType: ProtoBuf.WIRE_TYPES.LDELIM,
33911 defaultValue: null // overridden in the code, must be a unique instance
33912 },
33913 "fixed32": {
33914 name: "fixed32",
33915 wireType: ProtoBuf.WIRE_TYPES.BITS32,
33916 defaultValue: 0
33917 },
33918 "sfixed32": {
33919 name: "sfixed32",
33920 wireType: ProtoBuf.WIRE_TYPES.BITS32,
33921 defaultValue: 0
33922 },
33923 "fixed64": {
33924 name: "fixed64",
33925 wireType: ProtoBuf.WIRE_TYPES.BITS64,
33926 defaultValue: ProtoBuf.Long ? ProtoBuf.Long.UZERO : undefined
33927 },
33928 "sfixed64": {
33929 name: "sfixed64",
33930 wireType: ProtoBuf.WIRE_TYPES.BITS64,
33931 defaultValue: ProtoBuf.Long ? ProtoBuf.Long.ZERO : undefined
33932 },
33933 "float": {
33934 name: "float",
33935 wireType: ProtoBuf.WIRE_TYPES.BITS32,
33936 defaultValue: 0
33937 },
33938 "enum": {
33939 name: "enum",
33940 wireType: ProtoBuf.WIRE_TYPES.VARINT,
33941 defaultValue: 0
33942 },
33943 "message": {
33944 name: "message",
33945 wireType: ProtoBuf.WIRE_TYPES.LDELIM,
33946 defaultValue: null
33947 },
33948 "group": {
33949 name: "group",
33950 wireType: ProtoBuf.WIRE_TYPES.STARTGROUP,
33951 defaultValue: null
33952 }
33953 };
33954
33955 /**
33956 * Valid map key types.
33957 * @type {!Array.<!Object.<string,{name: string, wireType: number, defaultValue: *}>>}
33958 * @const
33959 * @expose
33960 */
33961 ProtoBuf.MAP_KEY_TYPES = [
33962 ProtoBuf.TYPES["int32"],
33963 ProtoBuf.TYPES["sint32"],
33964 ProtoBuf.TYPES["sfixed32"],
33965 ProtoBuf.TYPES["uint32"],
33966 ProtoBuf.TYPES["fixed32"],
33967 ProtoBuf.TYPES["int64"],
33968 ProtoBuf.TYPES["sint64"],
33969 ProtoBuf.TYPES["sfixed64"],
33970 ProtoBuf.TYPES["uint64"],
33971 ProtoBuf.TYPES["fixed64"],
33972 ProtoBuf.TYPES["bool"],
33973 ProtoBuf.TYPES["string"],
33974 ProtoBuf.TYPES["bytes"]
33975 ];
33976
33977 /**
33978 * Minimum field id.
33979 * @type {number}
33980 * @const
33981 * @expose
33982 */
33983 ProtoBuf.ID_MIN = 1;
33984
33985 /**
33986 * Maximum field id.
33987 * @type {number}
33988 * @const
33989 * @expose
33990 */
33991 ProtoBuf.ID_MAX = 0x1FFFFFFF;
33992
33993 /**
33994 * If set to `true`, field names will be converted from underscore notation to camel case. Defaults to `false`.
33995 * Must be set prior to parsing.
33996 * @type {boolean}
33997 * @expose
33998 */
33999 ProtoBuf.convertFieldsToCamelCase = false;
34000
34001 /**
34002 * By default, messages are populated with (setX, set_x) accessors for each field. This can be disabled by
34003 * setting this to `false` prior to building messages.
34004 * @type {boolean}
34005 * @expose
34006 */
34007 ProtoBuf.populateAccessors = true;
34008
34009 /**
34010 * By default, messages are populated with default values if a field is not present on the wire. To disable
34011 * this behavior, set this setting to `false`.
34012 * @type {boolean}
34013 * @expose
34014 */
34015 ProtoBuf.populateDefaults = true;
34016
34017 /**
34018 * @alias ProtoBuf.Util
34019 * @expose
34020 */
34021 ProtoBuf.Util = (function() {
34022 "use strict";
34023
34024 /**
34025 * ProtoBuf utilities.
34026 * @exports ProtoBuf.Util
34027 * @namespace
34028 */
34029 var Util = {};
34030
34031 /**
34032 * Flag if running in node or not.
34033 * @type {boolean}
34034 * @const
34035 * @expose
34036 */
34037 Util.IS_NODE = !!(
34038 typeof process === 'object' && process+'' === '[object process]' && !process['browser']
34039 );
34040
34041 /**
34042 * Constructs a XMLHttpRequest object.
34043 * @return {XMLHttpRequest}
34044 * @throws {Error} If XMLHttpRequest is not supported
34045 * @expose
34046 */
34047 Util.XHR = function() {
34048 // No dependencies please, ref: http://www.quirksmode.org/js/xmlhttp.html
34049 var XMLHttpFactories = [
34050 function () {return new XMLHttpRequest()},
34051 function () {return new ActiveXObject("Msxml2.XMLHTTP")},
34052 function () {return new ActiveXObject("Msxml3.XMLHTTP")},
34053 function () {return new ActiveXObject("Microsoft.XMLHTTP")}
34054 ];
34055 /** @type {?XMLHttpRequest} */
34056 var xhr = null;
34057 for (var i=0;i<XMLHttpFactories.length;i++) {
34058 try { xhr = XMLHttpFactories[i](); }
34059 catch (e) { continue; }
34060 break;
34061 }
34062 if (!xhr)
34063 throw Error("XMLHttpRequest is not supported");
34064 return xhr;
34065 };
34066
34067 /**
34068 * Fetches a resource.
34069 * @param {string} path Resource path
34070 * @param {function(?string)=} callback Callback receiving the resource's contents. If omitted the resource will
34071 * be fetched synchronously. If the request failed, contents will be null.
34072 * @return {?string|undefined} Resource contents if callback is omitted (null if the request failed), else undefined.
34073 * @expose
34074 */
34075 Util.fetch = function(path, callback) {
34076 if (callback && typeof callback != 'function')
34077 callback = null;
34078 if (Util.IS_NODE) {
34079 var fs = __webpack_require__(655);
34080 if (callback) {
34081 fs.readFile(path, function(err, data) {
34082 if (err)
34083 callback(null);
34084 else
34085 callback(""+data);
34086 });
34087 } else
34088 try {
34089 return fs.readFileSync(path);
34090 } catch (e) {
34091 return null;
34092 }
34093 } else {
34094 var xhr = Util.XHR();
34095 xhr.open('GET', path, callback ? true : false);
34096 // xhr.setRequestHeader('User-Agent', 'XMLHTTP/1.0');
34097 xhr.setRequestHeader('Accept', 'text/plain');
34098 if (typeof xhr.overrideMimeType === 'function') xhr.overrideMimeType('text/plain');
34099 if (callback) {
34100 xhr.onreadystatechange = function() {
34101 if (xhr.readyState != 4) return;
34102 if (/* remote */ xhr.status == 200 || /* local */ (xhr.status == 0 && typeof xhr.responseText === 'string'))
34103 callback(xhr.responseText);
34104 else
34105 callback(null);
34106 };
34107 if (xhr.readyState == 4)
34108 return;
34109 xhr.send(null);
34110 } else {
34111 xhr.send(null);
34112 if (/* remote */ xhr.status == 200 || /* local */ (xhr.status == 0 && typeof xhr.responseText === 'string'))
34113 return xhr.responseText;
34114 return null;
34115 }
34116 }
34117 };
34118
34119 /**
34120 * Converts a string to camel case.
34121 * @param {string} str
34122 * @returns {string}
34123 * @expose
34124 */
34125 Util.toCamelCase = function(str) {
34126 return str.replace(/_([a-zA-Z])/g, function ($0, $1) {
34127 return $1.toUpperCase();
34128 });
34129 };
34130
34131 return Util;
34132 })();
34133
34134 /**
34135 * Language expressions.
34136 * @type {!Object.<string,!RegExp>}
34137 * @expose
34138 */
34139 ProtoBuf.Lang = {
34140
34141 // Characters always ending a statement
34142 DELIM: /[\s\{\}=;:\[\],'"\(\)<>]/g,
34143
34144 // Field rules
34145 RULE: /^(?:required|optional|repeated|map)$/,
34146
34147 // Field types
34148 TYPE: /^(?:double|float|int32|uint32|sint32|int64|uint64|sint64|fixed32|sfixed32|fixed64|sfixed64|bool|string|bytes)$/,
34149
34150 // Names
34151 NAME: /^[a-zA-Z_][a-zA-Z_0-9]*$/,
34152
34153 // Type definitions
34154 TYPEDEF: /^[a-zA-Z][a-zA-Z_0-9]*$/,
34155
34156 // Type references
34157 TYPEREF: /^(?:\.?[a-zA-Z_][a-zA-Z_0-9]*)(?:\.[a-zA-Z_][a-zA-Z_0-9]*)*$/,
34158
34159 // Fully qualified type references
34160 FQTYPEREF: /^(?:\.[a-zA-Z_][a-zA-Z_0-9]*)+$/,
34161
34162 // All numbers
34163 NUMBER: /^-?(?:[1-9][0-9]*|0|0[xX][0-9a-fA-F]+|0[0-7]+|([0-9]*(\.[0-9]*)?([Ee][+-]?[0-9]+)?)|inf|nan)$/,
34164
34165 // Decimal numbers
34166 NUMBER_DEC: /^(?:[1-9][0-9]*|0)$/,
34167
34168 // Hexadecimal numbers
34169 NUMBER_HEX: /^0[xX][0-9a-fA-F]+$/,
34170
34171 // Octal numbers
34172 NUMBER_OCT: /^0[0-7]+$/,
34173
34174 // Floating point numbers
34175 NUMBER_FLT: /^([0-9]*(\.[0-9]*)?([Ee][+-]?[0-9]+)?|inf|nan)$/,
34176
34177 // Booleans
34178 BOOL: /^(?:true|false)$/i,
34179
34180 // Id numbers
34181 ID: /^(?:[1-9][0-9]*|0|0[xX][0-9a-fA-F]+|0[0-7]+)$/,
34182
34183 // Negative id numbers (enum values)
34184 NEGID: /^\-?(?:[1-9][0-9]*|0|0[xX][0-9a-fA-F]+|0[0-7]+)$/,
34185
34186 // Whitespaces
34187 WHITESPACE: /\s/,
34188
34189 // All strings
34190 STRING: /(?:"([^"\\]*(?:\\.[^"\\]*)*)")|(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g,
34191
34192 // Double quoted strings
34193 STRING_DQ: /(?:"([^"\\]*(?:\\.[^"\\]*)*)")/g,
34194
34195 // Single quoted strings
34196 STRING_SQ: /(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g
34197 };
34198
34199
34200 /**
34201 * @alias ProtoBuf.Reflect
34202 * @expose
34203 */
34204 ProtoBuf.Reflect = (function(ProtoBuf) {
34205 "use strict";
34206
34207 /**
34208 * Reflection types.
34209 * @exports ProtoBuf.Reflect
34210 * @namespace
34211 */
34212 var Reflect = {};
34213
34214 /**
34215 * Constructs a Reflect base class.
34216 * @exports ProtoBuf.Reflect.T
34217 * @constructor
34218 * @abstract
34219 * @param {!ProtoBuf.Builder} builder Builder reference
34220 * @param {?ProtoBuf.Reflect.T} parent Parent object
34221 * @param {string} name Object name
34222 */
34223 var T = function(builder, parent, name) {
34224
34225 /**
34226 * Builder reference.
34227 * @type {!ProtoBuf.Builder}
34228 * @expose
34229 */
34230 this.builder = builder;
34231
34232 /**
34233 * Parent object.
34234 * @type {?ProtoBuf.Reflect.T}
34235 * @expose
34236 */
34237 this.parent = parent;
34238
34239 /**
34240 * Object name in namespace.
34241 * @type {string}
34242 * @expose
34243 */
34244 this.name = name;
34245
34246 /**
34247 * Fully qualified class name
34248 * @type {string}
34249 * @expose
34250 */
34251 this.className;
34252 };
34253
34254 /**
34255 * @alias ProtoBuf.Reflect.T.prototype
34256 * @inner
34257 */
34258 var TPrototype = T.prototype;
34259
34260 /**
34261 * Returns the fully qualified name of this object.
34262 * @returns {string} Fully qualified name as of ".PATH.TO.THIS"
34263 * @expose
34264 */
34265 TPrototype.fqn = function() {
34266 var name = this.name,
34267 ptr = this;
34268 do {
34269 ptr = ptr.parent;
34270 if (ptr == null)
34271 break;
34272 name = ptr.name+"."+name;
34273 } while (true);
34274 return name;
34275 };
34276
34277 /**
34278 * Returns a string representation of this Reflect object (its fully qualified name).
34279 * @param {boolean=} includeClass Set to true to include the class name. Defaults to false.
34280 * @return String representation
34281 * @expose
34282 */
34283 TPrototype.toString = function(includeClass) {
34284 return (includeClass ? this.className + " " : "") + this.fqn();
34285 };
34286
34287 /**
34288 * Builds this type.
34289 * @throws {Error} If this type cannot be built directly
34290 * @expose
34291 */
34292 TPrototype.build = function() {
34293 throw Error(this.toString(true)+" cannot be built directly");
34294 };
34295
34296 /**
34297 * @alias ProtoBuf.Reflect.T
34298 * @expose
34299 */
34300 Reflect.T = T;
34301
34302 /**
34303 * Constructs a new Namespace.
34304 * @exports ProtoBuf.Reflect.Namespace
34305 * @param {!ProtoBuf.Builder} builder Builder reference
34306 * @param {?ProtoBuf.Reflect.Namespace} parent Namespace parent
34307 * @param {string} name Namespace name
34308 * @param {Object.<string,*>=} options Namespace options
34309 * @param {string?} syntax The syntax level of this definition (e.g., proto3)
34310 * @constructor
34311 * @extends ProtoBuf.Reflect.T
34312 */
34313 var Namespace = function(builder, parent, name, options, syntax) {
34314 T.call(this, builder, parent, name);
34315
34316 /**
34317 * @override
34318 */
34319 this.className = "Namespace";
34320
34321 /**
34322 * Children inside the namespace.
34323 * @type {!Array.<ProtoBuf.Reflect.T>}
34324 */
34325 this.children = [];
34326
34327 /**
34328 * Options.
34329 * @type {!Object.<string, *>}
34330 */
34331 this.options = options || {};
34332
34333 /**
34334 * Syntax level (e.g., proto2 or proto3).
34335 * @type {!string}
34336 */
34337 this.syntax = syntax || "proto2";
34338 };
34339
34340 /**
34341 * @alias ProtoBuf.Reflect.Namespace.prototype
34342 * @inner
34343 */
34344 var NamespacePrototype = Namespace.prototype = Object.create(T.prototype);
34345
34346 /**
34347 * Returns an array of the namespace's children.
34348 * @param {ProtoBuf.Reflect.T=} type Filter type (returns instances of this type only). Defaults to null (all children).
34349 * @return {Array.<ProtoBuf.Reflect.T>}
34350 * @expose
34351 */
34352 NamespacePrototype.getChildren = function(type) {
34353 type = type || null;
34354 if (type == null)
34355 return this.children.slice();
34356 var children = [];
34357 for (var i=0, k=this.children.length; i<k; ++i)
34358 if (this.children[i] instanceof type)
34359 children.push(this.children[i]);
34360 return children;
34361 };
34362
34363 /**
34364 * Adds a child to the namespace.
34365 * @param {ProtoBuf.Reflect.T} child Child
34366 * @throws {Error} If the child cannot be added (duplicate)
34367 * @expose
34368 */
34369 NamespacePrototype.addChild = function(child) {
34370 var other;
34371 if (other = this.getChild(child.name)) {
34372 // Try to revert camelcase transformation on collision
34373 if (other instanceof Message.Field && other.name !== other.originalName && this.getChild(other.originalName) === null)
34374 other.name = other.originalName; // Revert previous first (effectively keeps both originals)
34375 else if (child instanceof Message.Field && child.name !== child.originalName && this.getChild(child.originalName) === null)
34376 child.name = child.originalName;
34377 else
34378 throw Error("Duplicate name in namespace "+this.toString(true)+": "+child.name);
34379 }
34380 this.children.push(child);
34381 };
34382
34383 /**
34384 * Gets a child by its name or id.
34385 * @param {string|number} nameOrId Child name or id
34386 * @return {?ProtoBuf.Reflect.T} The child or null if not found
34387 * @expose
34388 */
34389 NamespacePrototype.getChild = function(nameOrId) {
34390 var key = typeof nameOrId === 'number' ? 'id' : 'name';
34391 for (var i=0, k=this.children.length; i<k; ++i)
34392 if (this.children[i][key] === nameOrId)
34393 return this.children[i];
34394 return null;
34395 };
34396
34397 /**
34398 * Resolves a reflect object inside of this namespace.
34399 * @param {string|!Array.<string>} qn Qualified name to resolve
34400 * @param {boolean=} excludeNonNamespace Excludes non-namespace types, defaults to `false`
34401 * @return {?ProtoBuf.Reflect.Namespace} The resolved type or null if not found
34402 * @expose
34403 */
34404 NamespacePrototype.resolve = function(qn, excludeNonNamespace) {
34405 var part = typeof qn === 'string' ? qn.split(".") : qn,
34406 ptr = this,
34407 i = 0;
34408 if (part[i] === "") { // Fully qualified name, e.g. ".My.Message'
34409 while (ptr.parent !== null)
34410 ptr = ptr.parent;
34411 i++;
34412 }
34413 var child;
34414 do {
34415 do {
34416 if (!(ptr instanceof Reflect.Namespace)) {
34417 ptr = null;
34418 break;
34419 }
34420 child = ptr.getChild(part[i]);
34421 if (!child || !(child instanceof Reflect.T) || (excludeNonNamespace && !(child instanceof Reflect.Namespace))) {
34422 ptr = null;
34423 break;
34424 }
34425 ptr = child; i++;
34426 } while (i < part.length);
34427 if (ptr != null)
34428 break; // Found
34429 // Else search the parent
34430 if (this.parent !== null)
34431 return this.parent.resolve(qn, excludeNonNamespace);
34432 } while (ptr != null);
34433 return ptr;
34434 };
34435
34436 /**
34437 * Determines the shortest qualified name of the specified type, if any, relative to this namespace.
34438 * @param {!ProtoBuf.Reflect.T} t Reflection type
34439 * @returns {string} The shortest qualified name or, if there is none, the fqn
34440 * @expose
34441 */
34442 NamespacePrototype.qn = function(t) {
34443 var part = [], ptr = t;
34444 do {
34445 part.unshift(ptr.name);
34446 ptr = ptr.parent;
34447 } while (ptr !== null);
34448 for (var len=1; len <= part.length; len++) {
34449 var qn = part.slice(part.length-len);
34450 if (t === this.resolve(qn, t instanceof Reflect.Namespace))
34451 return qn.join(".");
34452 }
34453 return t.fqn();
34454 };
34455
34456 /**
34457 * Builds the namespace and returns the runtime counterpart.
34458 * @return {Object.<string,Function|Object>} Runtime namespace
34459 * @expose
34460 */
34461 NamespacePrototype.build = function() {
34462 /** @dict */
34463 var ns = {};
34464 var children = this.children;
34465 for (var i=0, k=children.length, child; i<k; ++i) {
34466 child = children[i];
34467 if (child instanceof Namespace)
34468 ns[child.name] = child.build();
34469 }
34470 if (Object.defineProperty)
34471 Object.defineProperty(ns, "$options", { "value": this.buildOpt() });
34472 return ns;
34473 };
34474
34475 /**
34476 * Builds the namespace's '$options' property.
34477 * @return {Object.<string,*>}
34478 */
34479 NamespacePrototype.buildOpt = function() {
34480 var opt = {},
34481 keys = Object.keys(this.options);
34482 for (var i=0, k=keys.length; i<k; ++i) {
34483 var key = keys[i],
34484 val = this.options[keys[i]];
34485 // TODO: Options are not resolved, yet.
34486 // if (val instanceof Namespace) {
34487 // opt[key] = val.build();
34488 // } else {
34489 opt[key] = val;
34490 // }
34491 }
34492 return opt;
34493 };
34494
34495 /**
34496 * Gets the value assigned to the option with the specified name.
34497 * @param {string=} name Returns the option value if specified, otherwise all options are returned.
34498 * @return {*|Object.<string,*>}null} Option value or NULL if there is no such option
34499 */
34500 NamespacePrototype.getOption = function(name) {
34501 if (typeof name === 'undefined')
34502 return this.options;
34503 return typeof this.options[name] !== 'undefined' ? this.options[name] : null;
34504 };
34505
34506 /**
34507 * @alias ProtoBuf.Reflect.Namespace
34508 * @expose
34509 */
34510 Reflect.Namespace = Namespace;
34511
34512 /**
34513 * Constructs a new Element implementation that checks and converts values for a
34514 * particular field type, as appropriate.
34515 *
34516 * An Element represents a single value: either the value of a singular field,
34517 * or a value contained in one entry of a repeated field or map field. This
34518 * class does not implement these higher-level concepts; it only encapsulates
34519 * the low-level typechecking and conversion.
34520 *
34521 * @exports ProtoBuf.Reflect.Element
34522 * @param {{name: string, wireType: number}} type Resolved data type
34523 * @param {ProtoBuf.Reflect.T|null} resolvedType Resolved type, if relevant
34524 * (e.g. submessage field).
34525 * @param {boolean} isMapKey Is this element a Map key? The value will be
34526 * converted to string form if so.
34527 * @param {string} syntax Syntax level of defining message type, e.g.,
34528 * proto2 or proto3.
34529 * @param {string} name Name of the field containing this element (for error
34530 * messages)
34531 * @constructor
34532 */
34533 var Element = function(type, resolvedType, isMapKey, syntax, name) {
34534
34535 /**
34536 * Element type, as a string (e.g., int32).
34537 * @type {{name: string, wireType: number}}
34538 */
34539 this.type = type;
34540
34541 /**
34542 * Element type reference to submessage or enum definition, if needed.
34543 * @type {ProtoBuf.Reflect.T|null}
34544 */
34545 this.resolvedType = resolvedType;
34546
34547 /**
34548 * Element is a map key.
34549 * @type {boolean}
34550 */
34551 this.isMapKey = isMapKey;
34552
34553 /**
34554 * Syntax level of defining message type, e.g., proto2 or proto3.
34555 * @type {string}
34556 */
34557 this.syntax = syntax;
34558
34559 /**
34560 * Name of the field containing this element (for error messages)
34561 * @type {string}
34562 */
34563 this.name = name;
34564
34565 if (isMapKey && ProtoBuf.MAP_KEY_TYPES.indexOf(type) < 0)
34566 throw Error("Invalid map key type: " + type.name);
34567 };
34568
34569 var ElementPrototype = Element.prototype;
34570
34571 /**
34572 * Obtains a (new) default value for the specified type.
34573 * @param type {string|{name: string, wireType: number}} Field type
34574 * @returns {*} Default value
34575 * @inner
34576 */
34577 function mkDefault(type) {
34578 if (typeof type === 'string')
34579 type = ProtoBuf.TYPES[type];
34580 if (typeof type.defaultValue === 'undefined')
34581 throw Error("default value for type "+type.name+" is not supported");
34582 if (type == ProtoBuf.TYPES["bytes"])
34583 return new ByteBuffer(0);
34584 return type.defaultValue;
34585 }
34586
34587 /**
34588 * Returns the default value for this field in proto3.
34589 * @function
34590 * @param type {string|{name: string, wireType: number}} the field type
34591 * @returns {*} Default value
34592 */
34593 Element.defaultFieldValue = mkDefault;
34594
34595 /**
34596 * Makes a Long from a value.
34597 * @param {{low: number, high: number, unsigned: boolean}|string|number} value Value
34598 * @param {boolean=} unsigned Whether unsigned or not, defaults to reuse it from Long-like objects or to signed for
34599 * strings and numbers
34600 * @returns {!Long}
34601 * @throws {Error} If the value cannot be converted to a Long
34602 * @inner
34603 */
34604 function mkLong(value, unsigned) {
34605 if (value && typeof value.low === 'number' && typeof value.high === 'number' && typeof value.unsigned === 'boolean'
34606 && value.low === value.low && value.high === value.high)
34607 return new ProtoBuf.Long(value.low, value.high, typeof unsigned === 'undefined' ? value.unsigned : unsigned);
34608 if (typeof value === 'string')
34609 return ProtoBuf.Long.fromString(value, unsigned || false, 10);
34610 if (typeof value === 'number')
34611 return ProtoBuf.Long.fromNumber(value, unsigned || false);
34612 throw Error("not convertible to Long");
34613 }
34614
34615 ElementPrototype.toString = function() {
34616 return (this.name || '') + (this.isMapKey ? 'map' : 'value') + ' element';
34617 }
34618
34619 /**
34620 * Checks if the given value can be set for an element of this type (singular
34621 * field or one element of a repeated field or map).
34622 * @param {*} value Value to check
34623 * @return {*} Verified, maybe adjusted, value
34624 * @throws {Error} If the value cannot be verified for this element slot
34625 * @expose
34626 */
34627 ElementPrototype.verifyValue = function(value) {
34628 var self = this;
34629 function fail(val, msg) {
34630 throw Error("Illegal value for "+self.toString(true)+" of type "+self.type.name+": "+val+" ("+msg+")");
34631 }
34632 switch (this.type) {
34633 // Signed 32bit
34634 case ProtoBuf.TYPES["int32"]:
34635 case ProtoBuf.TYPES["sint32"]:
34636 case ProtoBuf.TYPES["sfixed32"]:
34637 // Account for !NaN: value === value
34638 if (typeof value !== 'number' || (value === value && value % 1 !== 0))
34639 fail(typeof value, "not an integer");
34640 return value > 4294967295 ? value | 0 : value;
34641
34642 // Unsigned 32bit
34643 case ProtoBuf.TYPES["uint32"]:
34644 case ProtoBuf.TYPES["fixed32"]:
34645 if (typeof value !== 'number' || (value === value && value % 1 !== 0))
34646 fail(typeof value, "not an integer");
34647 return value < 0 ? value >>> 0 : value;
34648
34649 // Signed 64bit
34650 case ProtoBuf.TYPES["int64"]:
34651 case ProtoBuf.TYPES["sint64"]:
34652 case ProtoBuf.TYPES["sfixed64"]: {
34653 if (ProtoBuf.Long)
34654 try {
34655 return mkLong(value, false);
34656 } catch (e) {
34657 fail(typeof value, e.message);
34658 }
34659 else
34660 fail(typeof value, "requires Long.js");
34661 }
34662
34663 // Unsigned 64bit
34664 case ProtoBuf.TYPES["uint64"]:
34665 case ProtoBuf.TYPES["fixed64"]: {
34666 if (ProtoBuf.Long)
34667 try {
34668 return mkLong(value, true);
34669 } catch (e) {
34670 fail(typeof value, e.message);
34671 }
34672 else
34673 fail(typeof value, "requires Long.js");
34674 }
34675
34676 // Bool
34677 case ProtoBuf.TYPES["bool"]:
34678 if (typeof value !== 'boolean')
34679 fail(typeof value, "not a boolean");
34680 return value;
34681
34682 // Float
34683 case ProtoBuf.TYPES["float"]:
34684 case ProtoBuf.TYPES["double"]:
34685 if (typeof value !== 'number')
34686 fail(typeof value, "not a number");
34687 return value;
34688
34689 // Length-delimited string
34690 case ProtoBuf.TYPES["string"]:
34691 if (typeof value !== 'string' && !(value && value instanceof String))
34692 fail(typeof value, "not a string");
34693 return ""+value; // Convert String object to string
34694
34695 // Length-delimited bytes
34696 case ProtoBuf.TYPES["bytes"]:
34697 if (ByteBuffer.isByteBuffer(value))
34698 return value;
34699 return ByteBuffer.wrap(value, "base64");
34700
34701 // Constant enum value
34702 case ProtoBuf.TYPES["enum"]: {
34703 var values = this.resolvedType.getChildren(ProtoBuf.Reflect.Enum.Value);
34704 for (i=0; i<values.length; i++)
34705 if (values[i].name == value)
34706 return values[i].id;
34707 else if (values[i].id == value)
34708 return values[i].id;
34709
34710 if (this.syntax === 'proto3') {
34711 // proto3: just make sure it's an integer.
34712 if (typeof value !== 'number' || (value === value && value % 1 !== 0))
34713 fail(typeof value, "not an integer");
34714 if (value > 4294967295 || value < 0)
34715 fail(typeof value, "not in range for uint32")
34716 return value;
34717 } else {
34718 // proto2 requires enum values to be valid.
34719 fail(value, "not a valid enum value");
34720 }
34721 }
34722 // Embedded message
34723 case ProtoBuf.TYPES["group"]:
34724 case ProtoBuf.TYPES["message"]: {
34725 if (!value || typeof value !== 'object')
34726 fail(typeof value, "object expected");
34727 if (value instanceof this.resolvedType.clazz)
34728 return value;
34729 if (value instanceof ProtoBuf.Builder.Message) {
34730 // Mismatched type: Convert to object (see: https://github.com/dcodeIO/ProtoBuf.js/issues/180)
34731 var obj = {};
34732 for (var i in value)
34733 if (value.hasOwnProperty(i))
34734 obj[i] = value[i];
34735 value = obj;
34736 }
34737 // Else let's try to construct one from a key-value object
34738 return new (this.resolvedType.clazz)(value); // May throw for a hundred of reasons
34739 }
34740 }
34741
34742 // We should never end here
34743 throw Error("[INTERNAL] Illegal value for "+this.toString(true)+": "+value+" (undefined type "+this.type+")");
34744 };
34745
34746 /**
34747 * Calculates the byte length of an element on the wire.
34748 * @param {number} id Field number
34749 * @param {*} value Field value
34750 * @returns {number} Byte length
34751 * @throws {Error} If the value cannot be calculated
34752 * @expose
34753 */
34754 ElementPrototype.calculateLength = function(id, value) {
34755 if (value === null) return 0; // Nothing to encode
34756 // Tag has already been written
34757 var n;
34758 switch (this.type) {
34759 case ProtoBuf.TYPES["int32"]:
34760 return value < 0 ? ByteBuffer.calculateVarint64(value) : ByteBuffer.calculateVarint32(value);
34761 case ProtoBuf.TYPES["uint32"]:
34762 return ByteBuffer.calculateVarint32(value);
34763 case ProtoBuf.TYPES["sint32"]:
34764 return ByteBuffer.calculateVarint32(ByteBuffer.zigZagEncode32(value));
34765 case ProtoBuf.TYPES["fixed32"]:
34766 case ProtoBuf.TYPES["sfixed32"]:
34767 case ProtoBuf.TYPES["float"]:
34768 return 4;
34769 case ProtoBuf.TYPES["int64"]:
34770 case ProtoBuf.TYPES["uint64"]:
34771 return ByteBuffer.calculateVarint64(value);
34772 case ProtoBuf.TYPES["sint64"]:
34773 return ByteBuffer.calculateVarint64(ByteBuffer.zigZagEncode64(value));
34774 case ProtoBuf.TYPES["fixed64"]:
34775 case ProtoBuf.TYPES["sfixed64"]:
34776 return 8;
34777 case ProtoBuf.TYPES["bool"]:
34778 return 1;
34779 case ProtoBuf.TYPES["enum"]:
34780 return ByteBuffer.calculateVarint32(value);
34781 case ProtoBuf.TYPES["double"]:
34782 return 8;
34783 case ProtoBuf.TYPES["string"]:
34784 n = ByteBuffer.calculateUTF8Bytes(value);
34785 return ByteBuffer.calculateVarint32(n) + n;
34786 case ProtoBuf.TYPES["bytes"]:
34787 if (value.remaining() < 0)
34788 throw Error("Illegal value for "+this.toString(true)+": "+value.remaining()+" bytes remaining");
34789 return ByteBuffer.calculateVarint32(value.remaining()) + value.remaining();
34790 case ProtoBuf.TYPES["message"]:
34791 n = this.resolvedType.calculate(value);
34792 return ByteBuffer.calculateVarint32(n) + n;
34793 case ProtoBuf.TYPES["group"]:
34794 n = this.resolvedType.calculate(value);
34795 return n + ByteBuffer.calculateVarint32((id << 3) | ProtoBuf.WIRE_TYPES.ENDGROUP);
34796 }
34797 // We should never end here
34798 throw Error("[INTERNAL] Illegal value to encode in "+this.toString(true)+": "+value+" (unknown type)");
34799 };
34800
34801 /**
34802 * Encodes a value to the specified buffer. Does not encode the key.
34803 * @param {number} id Field number
34804 * @param {*} value Field value
34805 * @param {ByteBuffer} buffer ByteBuffer to encode to
34806 * @return {ByteBuffer} The ByteBuffer for chaining
34807 * @throws {Error} If the value cannot be encoded
34808 * @expose
34809 */
34810 ElementPrototype.encodeValue = function(id, value, buffer) {
34811 if (value === null) return buffer; // Nothing to encode
34812 // Tag has already been written
34813
34814 switch (this.type) {
34815 // 32bit signed varint
34816 case ProtoBuf.TYPES["int32"]:
34817 // "If you use int32 or int64 as the type for a negative number, the resulting varint is always ten bytes
34818 // long – it is, effectively, treated like a very large unsigned integer." (see #122)
34819 if (value < 0)
34820 buffer.writeVarint64(value);
34821 else
34822 buffer.writeVarint32(value);
34823 break;
34824
34825 // 32bit unsigned varint
34826 case ProtoBuf.TYPES["uint32"]:
34827 buffer.writeVarint32(value);
34828 break;
34829
34830 // 32bit varint zig-zag
34831 case ProtoBuf.TYPES["sint32"]:
34832 buffer.writeVarint32ZigZag(value);
34833 break;
34834
34835 // Fixed unsigned 32bit
34836 case ProtoBuf.TYPES["fixed32"]:
34837 buffer.writeUint32(value);
34838 break;
34839
34840 // Fixed signed 32bit
34841 case ProtoBuf.TYPES["sfixed32"]:
34842 buffer.writeInt32(value);
34843 break;
34844
34845 // 64bit varint as-is
34846 case ProtoBuf.TYPES["int64"]:
34847 case ProtoBuf.TYPES["uint64"]:
34848 buffer.writeVarint64(value); // throws
34849 break;
34850
34851 // 64bit varint zig-zag
34852 case ProtoBuf.TYPES["sint64"]:
34853 buffer.writeVarint64ZigZag(value); // throws
34854 break;
34855
34856 // Fixed unsigned 64bit
34857 case ProtoBuf.TYPES["fixed64"]:
34858 buffer.writeUint64(value); // throws
34859 break;
34860
34861 // Fixed signed 64bit
34862 case ProtoBuf.TYPES["sfixed64"]:
34863 buffer.writeInt64(value); // throws
34864 break;
34865
34866 // Bool
34867 case ProtoBuf.TYPES["bool"]:
34868 if (typeof value === 'string')
34869 buffer.writeVarint32(value.toLowerCase() === 'false' ? 0 : !!value);
34870 else
34871 buffer.writeVarint32(value ? 1 : 0);
34872 break;
34873
34874 // Constant enum value
34875 case ProtoBuf.TYPES["enum"]:
34876 buffer.writeVarint32(value);
34877 break;
34878
34879 // 32bit float
34880 case ProtoBuf.TYPES["float"]:
34881 buffer.writeFloat32(value);
34882 break;
34883
34884 // 64bit float
34885 case ProtoBuf.TYPES["double"]:
34886 buffer.writeFloat64(value);
34887 break;
34888
34889 // Length-delimited string
34890 case ProtoBuf.TYPES["string"]:
34891 buffer.writeVString(value);
34892 break;
34893
34894 // Length-delimited bytes
34895 case ProtoBuf.TYPES["bytes"]:
34896 if (value.remaining() < 0)
34897 throw Error("Illegal value for "+this.toString(true)+": "+value.remaining()+" bytes remaining");
34898 var prevOffset = value.offset;
34899 buffer.writeVarint32(value.remaining());
34900 buffer.append(value);
34901 value.offset = prevOffset;
34902 break;
34903
34904 // Embedded message
34905 case ProtoBuf.TYPES["message"]:
34906 var bb = new ByteBuffer().LE();
34907 this.resolvedType.encode(value, bb);
34908 buffer.writeVarint32(bb.offset);
34909 buffer.append(bb.flip());
34910 break;
34911
34912 // Legacy group
34913 case ProtoBuf.TYPES["group"]:
34914 this.resolvedType.encode(value, buffer);
34915 buffer.writeVarint32((id << 3) | ProtoBuf.WIRE_TYPES.ENDGROUP);
34916 break;
34917
34918 default:
34919 // We should never end here
34920 throw Error("[INTERNAL] Illegal value to encode in "+this.toString(true)+": "+value+" (unknown type)");
34921 }
34922 return buffer;
34923 };
34924
34925 /**
34926 * Decode one element value from the specified buffer.
34927 * @param {ByteBuffer} buffer ByteBuffer to decode from
34928 * @param {number} wireType The field wire type
34929 * @param {number} id The field number
34930 * @return {*} Decoded value
34931 * @throws {Error} If the field cannot be decoded
34932 * @expose
34933 */
34934 ElementPrototype.decode = function(buffer, wireType, id) {
34935 if (wireType != this.type.wireType)
34936 throw Error("Unexpected wire type for element");
34937
34938 var value, nBytes;
34939 switch (this.type) {
34940 // 32bit signed varint
34941 case ProtoBuf.TYPES["int32"]:
34942 return buffer.readVarint32() | 0;
34943
34944 // 32bit unsigned varint
34945 case ProtoBuf.TYPES["uint32"]:
34946 return buffer.readVarint32() >>> 0;
34947
34948 // 32bit signed varint zig-zag
34949 case ProtoBuf.TYPES["sint32"]:
34950 return buffer.readVarint32ZigZag() | 0;
34951
34952 // Fixed 32bit unsigned
34953 case ProtoBuf.TYPES["fixed32"]:
34954 return buffer.readUint32() >>> 0;
34955
34956 case ProtoBuf.TYPES["sfixed32"]:
34957 return buffer.readInt32() | 0;
34958
34959 // 64bit signed varint
34960 case ProtoBuf.TYPES["int64"]:
34961 return buffer.readVarint64();
34962
34963 // 64bit unsigned varint
34964 case ProtoBuf.TYPES["uint64"]:
34965 return buffer.readVarint64().toUnsigned();
34966
34967 // 64bit signed varint zig-zag
34968 case ProtoBuf.TYPES["sint64"]:
34969 return buffer.readVarint64ZigZag();
34970
34971 // Fixed 64bit unsigned
34972 case ProtoBuf.TYPES["fixed64"]:
34973 return buffer.readUint64();
34974
34975 // Fixed 64bit signed
34976 case ProtoBuf.TYPES["sfixed64"]:
34977 return buffer.readInt64();
34978
34979 // Bool varint
34980 case ProtoBuf.TYPES["bool"]:
34981 return !!buffer.readVarint32();
34982
34983 // Constant enum value (varint)
34984 case ProtoBuf.TYPES["enum"]:
34985 // The following Builder.Message#set will already throw
34986 return buffer.readVarint32();
34987
34988 // 32bit float
34989 case ProtoBuf.TYPES["float"]:
34990 return buffer.readFloat();
34991
34992 // 64bit float
34993 case ProtoBuf.TYPES["double"]:
34994 return buffer.readDouble();
34995
34996 // Length-delimited string
34997 case ProtoBuf.TYPES["string"]:
34998 return buffer.readVString();
34999
35000 // Length-delimited bytes
35001 case ProtoBuf.TYPES["bytes"]: {
35002 nBytes = buffer.readVarint32();
35003 if (buffer.remaining() < nBytes)
35004 throw Error("Illegal number of bytes for "+this.toString(true)+": "+nBytes+" required but got only "+buffer.remaining());
35005 value = buffer.clone(); // Offset already set
35006 value.limit = value.offset+nBytes;
35007 buffer.offset += nBytes;
35008 return value;
35009 }
35010
35011 // Length-delimited embedded message
35012 case ProtoBuf.TYPES["message"]: {
35013 nBytes = buffer.readVarint32();
35014 return this.resolvedType.decode(buffer, nBytes);
35015 }
35016
35017 // Legacy group
35018 case ProtoBuf.TYPES["group"]:
35019 return this.resolvedType.decode(buffer, -1, id);
35020 }
35021
35022 // We should never end here
35023 throw Error("[INTERNAL] Illegal decode type");
35024 };
35025
35026 /**
35027 * Converts a value from a string to the canonical element type.
35028 *
35029 * Legal only when isMapKey is true.
35030 *
35031 * @param {string} str The string value
35032 * @returns {*} The value
35033 */
35034 ElementPrototype.valueFromString = function(str) {
35035 if (!this.isMapKey) {
35036 throw Error("valueFromString() called on non-map-key element");
35037 }
35038
35039 switch (this.type) {
35040 case ProtoBuf.TYPES["int32"]:
35041 case ProtoBuf.TYPES["sint32"]:
35042 case ProtoBuf.TYPES["sfixed32"]:
35043 case ProtoBuf.TYPES["uint32"]:
35044 case ProtoBuf.TYPES["fixed32"]:
35045 return this.verifyValue(parseInt(str));
35046
35047 case ProtoBuf.TYPES["int64"]:
35048 case ProtoBuf.TYPES["sint64"]:
35049 case ProtoBuf.TYPES["sfixed64"]:
35050 case ProtoBuf.TYPES["uint64"]:
35051 case ProtoBuf.TYPES["fixed64"]:
35052 // Long-based fields support conversions from string already.
35053 return this.verifyValue(str);
35054
35055 case ProtoBuf.TYPES["bool"]:
35056 return str === "true";
35057
35058 case ProtoBuf.TYPES["string"]:
35059 return this.verifyValue(str);
35060
35061 case ProtoBuf.TYPES["bytes"]:
35062 return ByteBuffer.fromBinary(str);
35063 }
35064 };
35065
35066 /**
35067 * Converts a value from the canonical element type to a string.
35068 *
35069 * It should be the case that `valueFromString(valueToString(val))` returns
35070 * a value equivalent to `verifyValue(val)` for every legal value of `val`
35071 * according to this element type.
35072 *
35073 * This may be used when the element must be stored or used as a string,
35074 * e.g., as a map key on an Object.
35075 *
35076 * Legal only when isMapKey is true.
35077 *
35078 * @param {*} val The value
35079 * @returns {string} The string form of the value.
35080 */
35081 ElementPrototype.valueToString = function(value) {
35082 if (!this.isMapKey) {
35083 throw Error("valueToString() called on non-map-key element");
35084 }
35085
35086 if (this.type === ProtoBuf.TYPES["bytes"]) {
35087 return value.toString("binary");
35088 } else {
35089 return value.toString();
35090 }
35091 };
35092
35093 /**
35094 * @alias ProtoBuf.Reflect.Element
35095 * @expose
35096 */
35097 Reflect.Element = Element;
35098
35099 /**
35100 * Constructs a new Message.
35101 * @exports ProtoBuf.Reflect.Message
35102 * @param {!ProtoBuf.Builder} builder Builder reference
35103 * @param {!ProtoBuf.Reflect.Namespace} parent Parent message or namespace
35104 * @param {string} name Message name
35105 * @param {Object.<string,*>=} options Message options
35106 * @param {boolean=} isGroup `true` if this is a legacy group
35107 * @param {string?} syntax The syntax level of this definition (e.g., proto3)
35108 * @constructor
35109 * @extends ProtoBuf.Reflect.Namespace
35110 */
35111 var Message = function(builder, parent, name, options, isGroup, syntax) {
35112 Namespace.call(this, builder, parent, name, options, syntax);
35113
35114 /**
35115 * @override
35116 */
35117 this.className = "Message";
35118
35119 /**
35120 * Extensions range.
35121 * @type {!Array.<number>|undefined}
35122 * @expose
35123 */
35124 this.extensions = undefined;
35125
35126 /**
35127 * Runtime message class.
35128 * @type {?function(new:ProtoBuf.Builder.Message)}
35129 * @expose
35130 */
35131 this.clazz = null;
35132
35133 /**
35134 * Whether this is a legacy group or not.
35135 * @type {boolean}
35136 * @expose
35137 */
35138 this.isGroup = !!isGroup;
35139
35140 // The following cached collections are used to efficiently iterate over or look up fields when decoding.
35141
35142 /**
35143 * Cached fields.
35144 * @type {?Array.<!ProtoBuf.Reflect.Message.Field>}
35145 * @private
35146 */
35147 this._fields = null;
35148
35149 /**
35150 * Cached fields by id.
35151 * @type {?Object.<number,!ProtoBuf.Reflect.Message.Field>}
35152 * @private
35153 */
35154 this._fieldsById = null;
35155
35156 /**
35157 * Cached fields by name.
35158 * @type {?Object.<string,!ProtoBuf.Reflect.Message.Field>}
35159 * @private
35160 */
35161 this._fieldsByName = null;
35162 };
35163
35164 /**
35165 * @alias ProtoBuf.Reflect.Message.prototype
35166 * @inner
35167 */
35168 var MessagePrototype = Message.prototype = Object.create(Namespace.prototype);
35169
35170 /**
35171 * Builds the message and returns the runtime counterpart, which is a fully functional class.
35172 * @see ProtoBuf.Builder.Message
35173 * @param {boolean=} rebuild Whether to rebuild or not, defaults to false
35174 * @return {ProtoBuf.Reflect.Message} Message class
35175 * @throws {Error} If the message cannot be built
35176 * @expose
35177 */
35178 MessagePrototype.build = function(rebuild) {
35179 if (this.clazz && !rebuild)
35180 return this.clazz;
35181
35182 // Create the runtime Message class in its own scope
35183 var clazz = (function(ProtoBuf, T) {
35184
35185 var fields = T.getChildren(ProtoBuf.Reflect.Message.Field),
35186 oneofs = T.getChildren(ProtoBuf.Reflect.Message.OneOf);
35187
35188 /**
35189 * Constructs a new runtime Message.
35190 * @name ProtoBuf.Builder.Message
35191 * @class Barebone of all runtime messages.
35192 * @param {!Object.<string,*>|string} values Preset values
35193 * @param {...string} var_args
35194 * @constructor
35195 * @throws {Error} If the message cannot be created
35196 */
35197 var Message = function(values, var_args) {
35198 ProtoBuf.Builder.Message.call(this);
35199
35200 // Create virtual oneof properties
35201 for (var i=0, k=oneofs.length; i<k; ++i)
35202 this[oneofs[i].name] = null;
35203 // Create fields and set default values
35204 for (i=0, k=fields.length; i<k; ++i) {
35205 var field = fields[i];
35206 this[field.name] =
35207 field.repeated ? [] :
35208 (field.map ? new ProtoBuf.Map(field) : null);
35209 if ((field.required || T.syntax === 'proto3') &&
35210 field.defaultValue !== null)
35211 this[field.name] = field.defaultValue;
35212 }
35213
35214 if (arguments.length > 0) {
35215 var value;
35216 // Set field values from a values object
35217 if (arguments.length === 1 && values !== null && typeof values === 'object' &&
35218 /* not _another_ Message */ (typeof values.encode !== 'function' || values instanceof Message) &&
35219 /* not a repeated field */ !Array.isArray(values) &&
35220 /* not a Map */ !(values instanceof ProtoBuf.Map) &&
35221 /* not a ByteBuffer */ !ByteBuffer.isByteBuffer(values) &&
35222 /* not an ArrayBuffer */ !(values instanceof ArrayBuffer) &&
35223 /* not a Long */ !(ProtoBuf.Long && values instanceof ProtoBuf.Long)) {
35224 this.$set(values);
35225 } else // Set field values from arguments, in declaration order
35226 for (i=0, k=arguments.length; i<k; ++i)
35227 if (typeof (value = arguments[i]) !== 'undefined')
35228 this.$set(fields[i].name, value); // May throw
35229 }
35230 };
35231
35232 /**
35233 * @alias ProtoBuf.Builder.Message.prototype
35234 * @inner
35235 */
35236 var MessagePrototype = Message.prototype = Object.create(ProtoBuf.Builder.Message.prototype);
35237
35238 /**
35239 * Adds a value to a repeated field.
35240 * @name ProtoBuf.Builder.Message#add
35241 * @function
35242 * @param {string} key Field name
35243 * @param {*} value Value to add
35244 * @param {boolean=} noAssert Whether to assert the value or not (asserts by default)
35245 * @returns {!ProtoBuf.Builder.Message} this
35246 * @throws {Error} If the value cannot be added
35247 * @expose
35248 */
35249 MessagePrototype.add = function(key, value, noAssert) {
35250 var field = T._fieldsByName[key];
35251 if (!noAssert) {
35252 if (!field)
35253 throw Error(this+"#"+key+" is undefined");
35254 if (!(field instanceof ProtoBuf.Reflect.Message.Field))
35255 throw Error(this+"#"+key+" is not a field: "+field.toString(true)); // May throw if it's an enum or embedded message
35256 if (!field.repeated)
35257 throw Error(this+"#"+key+" is not a repeated field");
35258 value = field.verifyValue(value, true);
35259 }
35260 if (this[key] === null)
35261 this[key] = [];
35262 this[key].push(value);
35263 return this;
35264 };
35265
35266 /**
35267 * Adds a value to a repeated field. This is an alias for {@link ProtoBuf.Builder.Message#add}.
35268 * @name ProtoBuf.Builder.Message#$add
35269 * @function
35270 * @param {string} key Field name
35271 * @param {*} value Value to add
35272 * @param {boolean=} noAssert Whether to assert the value or not (asserts by default)
35273 * @returns {!ProtoBuf.Builder.Message} this
35274 * @throws {Error} If the value cannot be added
35275 * @expose
35276 */
35277 MessagePrototype.$add = MessagePrototype.add;
35278
35279 /**
35280 * Sets a field's value.
35281 * @name ProtoBuf.Builder.Message#set
35282 * @function
35283 * @param {string|!Object.<string,*>} keyOrObj String key or plain object holding multiple values
35284 * @param {(*|boolean)=} value Value to set if key is a string, otherwise omitted
35285 * @param {boolean=} noAssert Whether to not assert for an actual field / proper value type, defaults to `false`
35286 * @returns {!ProtoBuf.Builder.Message} this
35287 * @throws {Error} If the value cannot be set
35288 * @expose
35289 */
35290 MessagePrototype.set = function(keyOrObj, value, noAssert) {
35291 if (keyOrObj && typeof keyOrObj === 'object') {
35292 noAssert = value;
35293 for (var ikey in keyOrObj) {
35294 // Check if virtual oneof field - don't set these
35295 if (keyOrObj.hasOwnProperty(ikey) && typeof (value = keyOrObj[ikey]) !== 'undefined' && T._oneofsByName[ikey] === undefined)
35296 this.$set(ikey, value, noAssert);
35297 }
35298 return this;
35299 }
35300 var field = T._fieldsByName[keyOrObj];
35301 if (!noAssert) {
35302 if (!field)
35303 throw Error(this+"#"+keyOrObj+" is not a field: undefined");
35304 if (!(field instanceof ProtoBuf.Reflect.Message.Field))
35305 throw Error(this+"#"+keyOrObj+" is not a field: "+field.toString(true));
35306 this[field.name] = (value = field.verifyValue(value)); // May throw
35307 } else
35308 this[keyOrObj] = value;
35309 if (field && field.oneof) { // Field is part of an OneOf (not a virtual OneOf field)
35310 var currentField = this[field.oneof.name]; // Virtual field references currently set field
35311 if (value !== null) {
35312 if (currentField !== null && currentField !== field.name)
35313 this[currentField] = null; // Clear currently set field
35314 this[field.oneof.name] = field.name; // Point virtual field at this field
35315 } else if (/* value === null && */currentField === keyOrObj)
35316 this[field.oneof.name] = null; // Clear virtual field (current field explicitly cleared)
35317 }
35318 return this;
35319 };
35320
35321 /**
35322 * Sets a field's value. This is an alias for [@link ProtoBuf.Builder.Message#set}.
35323 * @name ProtoBuf.Builder.Message#$set
35324 * @function
35325 * @param {string|!Object.<string,*>} keyOrObj String key or plain object holding multiple values
35326 * @param {(*|boolean)=} value Value to set if key is a string, otherwise omitted
35327 * @param {boolean=} noAssert Whether to not assert the value, defaults to `false`
35328 * @throws {Error} If the value cannot be set
35329 * @expose
35330 */
35331 MessagePrototype.$set = MessagePrototype.set;
35332
35333 /**
35334 * Gets a field's value.
35335 * @name ProtoBuf.Builder.Message#get
35336 * @function
35337 * @param {string} key Key
35338 * @param {boolean=} noAssert Whether to not assert for an actual field, defaults to `false`
35339 * @return {*} Value
35340 * @throws {Error} If there is no such field
35341 * @expose
35342 */
35343 MessagePrototype.get = function(key, noAssert) {
35344 if (noAssert)
35345 return this[key];
35346 var field = T._fieldsByName[key];
35347 if (!field || !(field instanceof ProtoBuf.Reflect.Message.Field))
35348 throw Error(this+"#"+key+" is not a field: undefined");
35349 if (!(field instanceof ProtoBuf.Reflect.Message.Field))
35350 throw Error(this+"#"+key+" is not a field: "+field.toString(true));
35351 return this[field.name];
35352 };
35353
35354 /**
35355 * Gets a field's value. This is an alias for {@link ProtoBuf.Builder.Message#$get}.
35356 * @name ProtoBuf.Builder.Message#$get
35357 * @function
35358 * @param {string} key Key
35359 * @return {*} Value
35360 * @throws {Error} If there is no such field
35361 * @expose
35362 */
35363 MessagePrototype.$get = MessagePrototype.get;
35364
35365 // Getters and setters
35366
35367 for (var i=0; i<fields.length; i++) {
35368 var field = fields[i];
35369 // no setters for extension fields as these are named by their fqn
35370 if (field instanceof ProtoBuf.Reflect.Message.ExtensionField)
35371 continue;
35372
35373 if (T.builder.options['populateAccessors'])
35374 (function(field) {
35375 // set/get[SomeValue]
35376 var Name = field.originalName.replace(/(_[a-zA-Z])/g, function(match) {
35377 return match.toUpperCase().replace('_','');
35378 });
35379 Name = Name.substring(0,1).toUpperCase() + Name.substring(1);
35380
35381 // set/get_[some_value] FIXME: Do we really need these?
35382 var name = field.originalName.replace(/([A-Z])/g, function(match) {
35383 return "_"+match;
35384 });
35385
35386 /**
35387 * The current field's unbound setter function.
35388 * @function
35389 * @param {*} value
35390 * @param {boolean=} noAssert
35391 * @returns {!ProtoBuf.Builder.Message}
35392 * @inner
35393 */
35394 var setter = function(value, noAssert) {
35395 this[field.name] = noAssert ? value : field.verifyValue(value);
35396 return this;
35397 };
35398
35399 /**
35400 * The current field's unbound getter function.
35401 * @function
35402 * @returns {*}
35403 * @inner
35404 */
35405 var getter = function() {
35406 return this[field.name];
35407 };
35408
35409 if (T.getChild("set"+Name) === null)
35410 /**
35411 * Sets a value. This method is present for each field, but only if there is no name conflict with
35412 * another field.
35413 * @name ProtoBuf.Builder.Message#set[SomeField]
35414 * @function
35415 * @param {*} value Value to set
35416 * @param {boolean=} noAssert Whether to not assert the value, defaults to `false`
35417 * @returns {!ProtoBuf.Builder.Message} this
35418 * @abstract
35419 * @throws {Error} If the value cannot be set
35420 */
35421 MessagePrototype["set"+Name] = setter;
35422
35423 if (T.getChild("set_"+name) === null)
35424 /**
35425 * Sets a value. This method is present for each field, but only if there is no name conflict with
35426 * another field.
35427 * @name ProtoBuf.Builder.Message#set_[some_field]
35428 * @function
35429 * @param {*} value Value to set
35430 * @param {boolean=} noAssert Whether to not assert the value, defaults to `false`
35431 * @returns {!ProtoBuf.Builder.Message} this
35432 * @abstract
35433 * @throws {Error} If the value cannot be set
35434 */
35435 MessagePrototype["set_"+name] = setter;
35436
35437 if (T.getChild("get"+Name) === null)
35438 /**
35439 * Gets a value. This method is present for each field, but only if there is no name conflict with
35440 * another field.
35441 * @name ProtoBuf.Builder.Message#get[SomeField]
35442 * @function
35443 * @abstract
35444 * @return {*} The value
35445 */
35446 MessagePrototype["get"+Name] = getter;
35447
35448 if (T.getChild("get_"+name) === null)
35449 /**
35450 * Gets a value. This method is present for each field, but only if there is no name conflict with
35451 * another field.
35452 * @name ProtoBuf.Builder.Message#get_[some_field]
35453 * @function
35454 * @return {*} The value
35455 * @abstract
35456 */
35457 MessagePrototype["get_"+name] = getter;
35458
35459 })(field);
35460 }
35461
35462 // En-/decoding
35463
35464 /**
35465 * Encodes the message.
35466 * @name ProtoBuf.Builder.Message#$encode
35467 * @function
35468 * @param {(!ByteBuffer|boolean)=} buffer ByteBuffer to encode to. Will create a new one and flip it if omitted.
35469 * @param {boolean=} noVerify Whether to not verify field values, defaults to `false`
35470 * @return {!ByteBuffer} Encoded message as a ByteBuffer
35471 * @throws {Error} If the message cannot be encoded or if required fields are missing. The later still
35472 * returns the encoded ByteBuffer in the `encoded` property on the error.
35473 * @expose
35474 * @see ProtoBuf.Builder.Message#encode64
35475 * @see ProtoBuf.Builder.Message#encodeHex
35476 * @see ProtoBuf.Builder.Message#encodeAB
35477 */
35478 MessagePrototype.encode = function(buffer, noVerify) {
35479 if (typeof buffer === 'boolean')
35480 noVerify = buffer,
35481 buffer = undefined;
35482 var isNew = false;
35483 if (!buffer)
35484 buffer = new ByteBuffer(),
35485 isNew = true;
35486 var le = buffer.littleEndian;
35487 try {
35488 T.encode(this, buffer.LE(), noVerify);
35489 return (isNew ? buffer.flip() : buffer).LE(le);
35490 } catch (e) {
35491 buffer.LE(le);
35492 throw(e);
35493 }
35494 };
35495
35496 /**
35497 * Encodes a message using the specified data payload.
35498 * @param {!Object.<string,*>} data Data payload
35499 * @param {(!ByteBuffer|boolean)=} buffer ByteBuffer to encode to. Will create a new one and flip it if omitted.
35500 * @param {boolean=} noVerify Whether to not verify field values, defaults to `false`
35501 * @return {!ByteBuffer} Encoded message as a ByteBuffer
35502 * @expose
35503 */
35504 Message.encode = function(data, buffer, noVerify) {
35505 return new Message(data).encode(buffer, noVerify);
35506 };
35507
35508 /**
35509 * Calculates the byte length of the message.
35510 * @name ProtoBuf.Builder.Message#calculate
35511 * @function
35512 * @returns {number} Byte length
35513 * @throws {Error} If the message cannot be calculated or if required fields are missing.
35514 * @expose
35515 */
35516 MessagePrototype.calculate = function() {
35517 return T.calculate(this);
35518 };
35519
35520 /**
35521 * Encodes the varint32 length-delimited message.
35522 * @name ProtoBuf.Builder.Message#encodeDelimited
35523 * @function
35524 * @param {(!ByteBuffer|boolean)=} buffer ByteBuffer to encode to. Will create a new one and flip it if omitted.
35525 * @param {boolean=} noVerify Whether to not verify field values, defaults to `false`
35526 * @return {!ByteBuffer} Encoded message as a ByteBuffer
35527 * @throws {Error} If the message cannot be encoded or if required fields are missing. The later still
35528 * returns the encoded ByteBuffer in the `encoded` property on the error.
35529 * @expose
35530 */
35531 MessagePrototype.encodeDelimited = function(buffer, noVerify) {
35532 var isNew = false;
35533 if (!buffer)
35534 buffer = new ByteBuffer(),
35535 isNew = true;
35536 var enc = new ByteBuffer().LE();
35537 T.encode(this, enc, noVerify).flip();
35538 buffer.writeVarint32(enc.remaining());
35539 buffer.append(enc);
35540 return isNew ? buffer.flip() : buffer;
35541 };
35542
35543 /**
35544 * Directly encodes the message to an ArrayBuffer.
35545 * @name ProtoBuf.Builder.Message#encodeAB
35546 * @function
35547 * @return {ArrayBuffer} Encoded message as ArrayBuffer
35548 * @throws {Error} If the message cannot be encoded or if required fields are missing. The later still
35549 * returns the encoded ArrayBuffer in the `encoded` property on the error.
35550 * @expose
35551 */
35552 MessagePrototype.encodeAB = function() {
35553 try {
35554 return this.encode().toArrayBuffer();
35555 } catch (e) {
35556 if (e["encoded"]) e["encoded"] = e["encoded"].toArrayBuffer();
35557 throw(e);
35558 }
35559 };
35560
35561 /**
35562 * Returns the message as an ArrayBuffer. This is an alias for {@link ProtoBuf.Builder.Message#encodeAB}.
35563 * @name ProtoBuf.Builder.Message#toArrayBuffer
35564 * @function
35565 * @return {ArrayBuffer} Encoded message as ArrayBuffer
35566 * @throws {Error} If the message cannot be encoded or if required fields are missing. The later still
35567 * returns the encoded ArrayBuffer in the `encoded` property on the error.
35568 * @expose
35569 */
35570 MessagePrototype.toArrayBuffer = MessagePrototype.encodeAB;
35571
35572 /**
35573 * Directly encodes the message to a node Buffer.
35574 * @name ProtoBuf.Builder.Message#encodeNB
35575 * @function
35576 * @return {!Buffer}
35577 * @throws {Error} If the message cannot be encoded, not running under node.js or if required fields are
35578 * missing. The later still returns the encoded node Buffer in the `encoded` property on the error.
35579 * @expose
35580 */
35581 MessagePrototype.encodeNB = function() {
35582 try {
35583 return this.encode().toBuffer();
35584 } catch (e) {
35585 if (e["encoded"]) e["encoded"] = e["encoded"].toBuffer();
35586 throw(e);
35587 }
35588 };
35589
35590 /**
35591 * Returns the message as a node Buffer. This is an alias for {@link ProtoBuf.Builder.Message#encodeNB}.
35592 * @name ProtoBuf.Builder.Message#toBuffer
35593 * @function
35594 * @return {!Buffer}
35595 * @throws {Error} If the message cannot be encoded or if required fields are missing. The later still
35596 * returns the encoded node Buffer in the `encoded` property on the error.
35597 * @expose
35598 */
35599 MessagePrototype.toBuffer = MessagePrototype.encodeNB;
35600
35601 /**
35602 * Directly encodes the message to a base64 encoded string.
35603 * @name ProtoBuf.Builder.Message#encode64
35604 * @function
35605 * @return {string} Base64 encoded string
35606 * @throws {Error} If the underlying buffer cannot be encoded or if required fields are missing. The later
35607 * still returns the encoded base64 string in the `encoded` property on the error.
35608 * @expose
35609 */
35610 MessagePrototype.encode64 = function() {
35611 try {
35612 return this.encode().toBase64();
35613 } catch (e) {
35614 if (e["encoded"]) e["encoded"] = e["encoded"].toBase64();
35615 throw(e);
35616 }
35617 };
35618
35619 /**
35620 * Returns the message as a base64 encoded string. This is an alias for {@link ProtoBuf.Builder.Message#encode64}.
35621 * @name ProtoBuf.Builder.Message#toBase64
35622 * @function
35623 * @return {string} Base64 encoded string
35624 * @throws {Error} If the message cannot be encoded or if required fields are missing. The later still
35625 * returns the encoded base64 string in the `encoded` property on the error.
35626 * @expose
35627 */
35628 MessagePrototype.toBase64 = MessagePrototype.encode64;
35629
35630 /**
35631 * Directly encodes the message to a hex encoded string.
35632 * @name ProtoBuf.Builder.Message#encodeHex
35633 * @function
35634 * @return {string} Hex encoded string
35635 * @throws {Error} If the underlying buffer cannot be encoded or if required fields are missing. The later
35636 * still returns the encoded hex string in the `encoded` property on the error.
35637 * @expose
35638 */
35639 MessagePrototype.encodeHex = function() {
35640 try {
35641 return this.encode().toHex();
35642 } catch (e) {
35643 if (e["encoded"]) e["encoded"] = e["encoded"].toHex();
35644 throw(e);
35645 }
35646 };
35647
35648 /**
35649 * Returns the message as a hex encoded string. This is an alias for {@link ProtoBuf.Builder.Message#encodeHex}.
35650 * @name ProtoBuf.Builder.Message#toHex
35651 * @function
35652 * @return {string} Hex encoded string
35653 * @throws {Error} If the message cannot be encoded or if required fields are missing. The later still
35654 * returns the encoded hex string in the `encoded` property on the error.
35655 * @expose
35656 */
35657 MessagePrototype.toHex = MessagePrototype.encodeHex;
35658
35659 /**
35660 * Clones a message object or field value to a raw object.
35661 * @param {*} obj Object to clone
35662 * @param {boolean} binaryAsBase64 Whether to include binary data as base64 strings or as a buffer otherwise
35663 * @param {boolean} longsAsStrings Whether to encode longs as strings
35664 * @param {!ProtoBuf.Reflect.T=} resolvedType The resolved field type if a field
35665 * @returns {*} Cloned object
35666 * @inner
35667 */
35668 function cloneRaw(obj, binaryAsBase64, longsAsStrings, resolvedType) {
35669 if (obj === null || typeof obj !== 'object') {
35670 // Convert enum values to their respective names
35671 if (resolvedType && resolvedType instanceof ProtoBuf.Reflect.Enum) {
35672 var name = ProtoBuf.Reflect.Enum.getName(resolvedType.object, obj);
35673 if (name !== null)
35674 return name;
35675 }
35676 // Pass-through string, number, boolean, null...
35677 return obj;
35678 }
35679 // Convert ByteBuffers to raw buffer or strings
35680 if (ByteBuffer.isByteBuffer(obj))
35681 return binaryAsBase64 ? obj.toBase64() : obj.toBuffer();
35682 // Convert Longs to proper objects or strings
35683 if (ProtoBuf.Long.isLong(obj))
35684 return longsAsStrings ? obj.toString() : ProtoBuf.Long.fromValue(obj);
35685 var clone;
35686 // Clone arrays
35687 if (Array.isArray(obj)) {
35688 clone = [];
35689 obj.forEach(function(v, k) {
35690 clone[k] = cloneRaw(v, binaryAsBase64, longsAsStrings, resolvedType);
35691 });
35692 return clone;
35693 }
35694 clone = {};
35695 // Convert maps to objects
35696 if (obj instanceof ProtoBuf.Map) {
35697 var it = obj.entries();
35698 for (var e = it.next(); !e.done; e = it.next())
35699 clone[obj.keyElem.valueToString(e.value[0])] = cloneRaw(e.value[1], binaryAsBase64, longsAsStrings, obj.valueElem.resolvedType);
35700 return clone;
35701 }
35702 // Everything else is a non-null object
35703 var type = obj.$type,
35704 field = undefined;
35705 for (var i in obj)
35706 if (obj.hasOwnProperty(i)) {
35707 if (type && (field = type.getChild(i)))
35708 clone[i] = cloneRaw(obj[i], binaryAsBase64, longsAsStrings, field.resolvedType);
35709 else
35710 clone[i] = cloneRaw(obj[i], binaryAsBase64, longsAsStrings);
35711 }
35712 return clone;
35713 }
35714
35715 /**
35716 * Returns the message's raw payload.
35717 * @param {boolean=} binaryAsBase64 Whether to include binary data as base64 strings instead of Buffers, defaults to `false`
35718 * @param {boolean} longsAsStrings Whether to encode longs as strings
35719 * @returns {Object.<string,*>} Raw payload
35720 * @expose
35721 */
35722 MessagePrototype.toRaw = function(binaryAsBase64, longsAsStrings) {
35723 return cloneRaw(this, !!binaryAsBase64, !!longsAsStrings, this.$type);
35724 };
35725
35726 /**
35727 * Encodes a message to JSON.
35728 * @returns {string} JSON string
35729 * @expose
35730 */
35731 MessagePrototype.encodeJSON = function() {
35732 return JSON.stringify(
35733 cloneRaw(this,
35734 /* binary-as-base64 */ true,
35735 /* longs-as-strings */ true,
35736 this.$type
35737 )
35738 );
35739 };
35740
35741 /**
35742 * Decodes a message from the specified buffer or string.
35743 * @name ProtoBuf.Builder.Message.decode
35744 * @function
35745 * @param {!ByteBuffer|!ArrayBuffer|!Buffer|string} buffer Buffer to decode from
35746 * @param {(number|string)=} length Message length. Defaults to decode all the remainig data.
35747 * @param {string=} enc Encoding if buffer is a string: hex, utf8 (not recommended), defaults to base64
35748 * @return {!ProtoBuf.Builder.Message} Decoded message
35749 * @throws {Error} If the message cannot be decoded or if required fields are missing. The later still
35750 * returns the decoded message with missing fields in the `decoded` property on the error.
35751 * @expose
35752 * @see ProtoBuf.Builder.Message.decode64
35753 * @see ProtoBuf.Builder.Message.decodeHex
35754 */
35755 Message.decode = function(buffer, length, enc) {
35756 if (typeof length === 'string')
35757 enc = length,
35758 length = -1;
35759 if (typeof buffer === 'string')
35760 buffer = ByteBuffer.wrap(buffer, enc ? enc : "base64");
35761 else if (!ByteBuffer.isByteBuffer(buffer))
35762 buffer = ByteBuffer.wrap(buffer); // May throw
35763 var le = buffer.littleEndian;
35764 try {
35765 var msg = T.decode(buffer.LE(), length);
35766 buffer.LE(le);
35767 return msg;
35768 } catch (e) {
35769 buffer.LE(le);
35770 throw(e);
35771 }
35772 };
35773
35774 /**
35775 * Decodes a varint32 length-delimited message from the specified buffer or string.
35776 * @name ProtoBuf.Builder.Message.decodeDelimited
35777 * @function
35778 * @param {!ByteBuffer|!ArrayBuffer|!Buffer|string} buffer Buffer to decode from
35779 * @param {string=} enc Encoding if buffer is a string: hex, utf8 (not recommended), defaults to base64
35780 * @return {ProtoBuf.Builder.Message} Decoded message or `null` if not enough bytes are available yet
35781 * @throws {Error} If the message cannot be decoded or if required fields are missing. The later still
35782 * returns the decoded message with missing fields in the `decoded` property on the error.
35783 * @expose
35784 */
35785 Message.decodeDelimited = function(buffer, enc) {
35786 if (typeof buffer === 'string')
35787 buffer = ByteBuffer.wrap(buffer, enc ? enc : "base64");
35788 else if (!ByteBuffer.isByteBuffer(buffer))
35789 buffer = ByteBuffer.wrap(buffer); // May throw
35790 if (buffer.remaining() < 1)
35791 return null;
35792 var off = buffer.offset,
35793 len = buffer.readVarint32();
35794 if (buffer.remaining() < len) {
35795 buffer.offset = off;
35796 return null;
35797 }
35798 try {
35799 var msg = T.decode(buffer.slice(buffer.offset, buffer.offset + len).LE());
35800 buffer.offset += len;
35801 return msg;
35802 } catch (err) {
35803 buffer.offset += len;
35804 throw err;
35805 }
35806 };
35807
35808 /**
35809 * Decodes the message from the specified base64 encoded string.
35810 * @name ProtoBuf.Builder.Message.decode64
35811 * @function
35812 * @param {string} str String to decode from
35813 * @return {!ProtoBuf.Builder.Message} Decoded message
35814 * @throws {Error} If the message cannot be decoded or if required fields are missing. The later still
35815 * returns the decoded message with missing fields in the `decoded` property on the error.
35816 * @expose
35817 */
35818 Message.decode64 = function(str) {
35819 return Message.decode(str, "base64");
35820 };
35821
35822 /**
35823 * Decodes the message from the specified hex encoded string.
35824 * @name ProtoBuf.Builder.Message.decodeHex
35825 * @function
35826 * @param {string} str String to decode from
35827 * @return {!ProtoBuf.Builder.Message} Decoded message
35828 * @throws {Error} If the message cannot be decoded or if required fields are missing. The later still
35829 * returns the decoded message with missing fields in the `decoded` property on the error.
35830 * @expose
35831 */
35832 Message.decodeHex = function(str) {
35833 return Message.decode(str, "hex");
35834 };
35835
35836 /**
35837 * Decodes the message from a JSON string.
35838 * @name ProtoBuf.Builder.Message.decodeJSON
35839 * @function
35840 * @param {string} str String to decode from
35841 * @return {!ProtoBuf.Builder.Message} Decoded message
35842 * @throws {Error} If the message cannot be decoded or if required fields are
35843 * missing.
35844 * @expose
35845 */
35846 Message.decodeJSON = function(str) {
35847 return new Message(JSON.parse(str));
35848 };
35849
35850 // Utility
35851
35852 /**
35853 * Returns a string representation of this Message.
35854 * @name ProtoBuf.Builder.Message#toString
35855 * @function
35856 * @return {string} String representation as of ".Fully.Qualified.MessageName"
35857 * @expose
35858 */
35859 MessagePrototype.toString = function() {
35860 return T.toString();
35861 };
35862
35863 // Properties
35864
35865 /**
35866 * Message options.
35867 * @name ProtoBuf.Builder.Message.$options
35868 * @type {Object.<string,*>}
35869 * @expose
35870 */
35871 var $optionsS; // cc needs this
35872
35873 /**
35874 * Message options.
35875 * @name ProtoBuf.Builder.Message#$options
35876 * @type {Object.<string,*>}
35877 * @expose
35878 */
35879 var $options;
35880
35881 /**
35882 * Reflection type.
35883 * @name ProtoBuf.Builder.Message.$type
35884 * @type {!ProtoBuf.Reflect.Message}
35885 * @expose
35886 */
35887 var $typeS;
35888
35889 /**
35890 * Reflection type.
35891 * @name ProtoBuf.Builder.Message#$type
35892 * @type {!ProtoBuf.Reflect.Message}
35893 * @expose
35894 */
35895 var $type;
35896
35897 if (Object.defineProperty)
35898 Object.defineProperty(Message, '$options', { "value": T.buildOpt() }),
35899 Object.defineProperty(MessagePrototype, "$options", { "value": Message["$options"] }),
35900 Object.defineProperty(Message, "$type", { "value": T }),
35901 Object.defineProperty(MessagePrototype, "$type", { "value": T });
35902
35903 return Message;
35904
35905 })(ProtoBuf, this);
35906
35907 // Static enums and prototyped sub-messages / cached collections
35908 this._fields = [];
35909 this._fieldsById = {};
35910 this._fieldsByName = {};
35911 this._oneofsByName = {};
35912 for (var i=0, k=this.children.length, child; i<k; i++) {
35913 child = this.children[i];
35914 if (child instanceof Enum || child instanceof Message || child instanceof Service) {
35915 if (clazz.hasOwnProperty(child.name))
35916 throw Error("Illegal reflect child of "+this.toString(true)+": "+child.toString(true)+" cannot override static property '"+child.name+"'");
35917 clazz[child.name] = child.build();
35918 } else if (child instanceof Message.Field)
35919 child.build(),
35920 this._fields.push(child),
35921 this._fieldsById[child.id] = child,
35922 this._fieldsByName[child.name] = child;
35923 else if (child instanceof Message.OneOf) {
35924 this._oneofsByName[child.name] = child;
35925 }
35926 else if (!(child instanceof Message.OneOf) && !(child instanceof Extension)) // Not built
35927 throw Error("Illegal reflect child of "+this.toString(true)+": "+this.children[i].toString(true));
35928 }
35929
35930 return this.clazz = clazz;
35931 };
35932
35933 /**
35934 * Encodes a runtime message's contents to the specified buffer.
35935 * @param {!ProtoBuf.Builder.Message} message Runtime message to encode
35936 * @param {ByteBuffer} buffer ByteBuffer to write to
35937 * @param {boolean=} noVerify Whether to not verify field values, defaults to `false`
35938 * @return {ByteBuffer} The ByteBuffer for chaining
35939 * @throws {Error} If required fields are missing or the message cannot be encoded for another reason
35940 * @expose
35941 */
35942 MessagePrototype.encode = function(message, buffer, noVerify) {
35943 var fieldMissing = null,
35944 field;
35945 for (var i=0, k=this._fields.length, val; i<k; ++i) {
35946 field = this._fields[i];
35947 val = message[field.name];
35948 if (field.required && val === null) {
35949 if (fieldMissing === null)
35950 fieldMissing = field;
35951 } else
35952 field.encode(noVerify ? val : field.verifyValue(val), buffer, message);
35953 }
35954 if (fieldMissing !== null) {
35955 var err = Error("Missing at least one required field for "+this.toString(true)+": "+fieldMissing);
35956 err["encoded"] = buffer; // Still expose what we got
35957 throw(err);
35958 }
35959 return buffer;
35960 };
35961
35962 /**
35963 * Calculates a runtime message's byte length.
35964 * @param {!ProtoBuf.Builder.Message} message Runtime message to encode
35965 * @returns {number} Byte length
35966 * @throws {Error} If required fields are missing or the message cannot be calculated for another reason
35967 * @expose
35968 */
35969 MessagePrototype.calculate = function(message) {
35970 for (var n=0, i=0, k=this._fields.length, field, val; i<k; ++i) {
35971 field = this._fields[i];
35972 val = message[field.name];
35973 if (field.required && val === null)
35974 throw Error("Missing at least one required field for "+this.toString(true)+": "+field);
35975 else
35976 n += field.calculate(val, message);
35977 }
35978 return n;
35979 };
35980
35981 /**
35982 * Skips all data until the end of the specified group has been reached.
35983 * @param {number} expectedId Expected GROUPEND id
35984 * @param {!ByteBuffer} buf ByteBuffer
35985 * @returns {boolean} `true` if a value as been skipped, `false` if the end has been reached
35986 * @throws {Error} If it wasn't possible to find the end of the group (buffer overrun or end tag mismatch)
35987 * @inner
35988 */
35989 function skipTillGroupEnd(expectedId, buf) {
35990 var tag = buf.readVarint32(), // Throws on OOB
35991 wireType = tag & 0x07,
35992 id = tag >>> 3;
35993 switch (wireType) {
35994 case ProtoBuf.WIRE_TYPES.VARINT:
35995 do tag = buf.readUint8();
35996 while ((tag & 0x80) === 0x80);
35997 break;
35998 case ProtoBuf.WIRE_TYPES.BITS64:
35999 buf.offset += 8;
36000 break;
36001 case ProtoBuf.WIRE_TYPES.LDELIM:
36002 tag = buf.readVarint32(); // reads the varint
36003 buf.offset += tag; // skips n bytes
36004 break;
36005 case ProtoBuf.WIRE_TYPES.STARTGROUP:
36006 skipTillGroupEnd(id, buf);
36007 break;
36008 case ProtoBuf.WIRE_TYPES.ENDGROUP:
36009 if (id === expectedId)
36010 return false;
36011 else
36012 throw Error("Illegal GROUPEND after unknown group: "+id+" ("+expectedId+" expected)");
36013 case ProtoBuf.WIRE_TYPES.BITS32:
36014 buf.offset += 4;
36015 break;
36016 default:
36017 throw Error("Illegal wire type in unknown group "+expectedId+": "+wireType);
36018 }
36019 return true;
36020 }
36021
36022 /**
36023 * Decodes an encoded message and returns the decoded message.
36024 * @param {ByteBuffer} buffer ByteBuffer to decode from
36025 * @param {number=} length Message length. Defaults to decode all remaining data.
36026 * @param {number=} expectedGroupEndId Expected GROUPEND id if this is a legacy group
36027 * @return {ProtoBuf.Builder.Message} Decoded message
36028 * @throws {Error} If the message cannot be decoded
36029 * @expose
36030 */
36031 MessagePrototype.decode = function(buffer, length, expectedGroupEndId) {
36032 if (typeof length !== 'number')
36033 length = -1;
36034 var start = buffer.offset,
36035 msg = new (this.clazz)(),
36036 tag, wireType, id, field;
36037 while (buffer.offset < start+length || (length === -1 && buffer.remaining() > 0)) {
36038 tag = buffer.readVarint32();
36039 wireType = tag & 0x07;
36040 id = tag >>> 3;
36041 if (wireType === ProtoBuf.WIRE_TYPES.ENDGROUP) {
36042 if (id !== expectedGroupEndId)
36043 throw Error("Illegal group end indicator for "+this.toString(true)+": "+id+" ("+(expectedGroupEndId ? expectedGroupEndId+" expected" : "not a group")+")");
36044 break;
36045 }
36046 if (!(field = this._fieldsById[id])) {
36047 // "messages created by your new code can be parsed by your old code: old binaries simply ignore the new field when parsing."
36048 switch (wireType) {
36049 case ProtoBuf.WIRE_TYPES.VARINT:
36050 buffer.readVarint32();
36051 break;
36052 case ProtoBuf.WIRE_TYPES.BITS32:
36053 buffer.offset += 4;
36054 break;
36055 case ProtoBuf.WIRE_TYPES.BITS64:
36056 buffer.offset += 8;
36057 break;
36058 case ProtoBuf.WIRE_TYPES.LDELIM:
36059 var len = buffer.readVarint32();
36060 buffer.offset += len;
36061 break;
36062 case ProtoBuf.WIRE_TYPES.STARTGROUP:
36063 while (skipTillGroupEnd(id, buffer)) {}
36064 break;
36065 default:
36066 throw Error("Illegal wire type for unknown field "+id+" in "+this.toString(true)+"#decode: "+wireType);
36067 }
36068 continue;
36069 }
36070 if (field.repeated && !field.options["packed"]) {
36071 msg[field.name].push(field.decode(wireType, buffer));
36072 } else if (field.map) {
36073 var keyval = field.decode(wireType, buffer);
36074 msg[field.name].set(keyval[0], keyval[1]);
36075 } else {
36076 msg[field.name] = field.decode(wireType, buffer);
36077 if (field.oneof) { // Field is part of an OneOf (not a virtual OneOf field)
36078 var currentField = msg[field.oneof.name]; // Virtual field references currently set field
36079 if (currentField !== null && currentField !== field.name)
36080 msg[currentField] = null; // Clear currently set field
36081 msg[field.oneof.name] = field.name; // Point virtual field at this field
36082 }
36083 }
36084 }
36085
36086 // Check if all required fields are present and set default values for optional fields that are not
36087 for (var i=0, k=this._fields.length; i<k; ++i) {
36088 field = this._fields[i];
36089 if (msg[field.name] === null) {
36090 if (this.syntax === "proto3") { // Proto3 sets default values by specification
36091 msg[field.name] = field.defaultValue;
36092 } else if (field.required) {
36093 var err = Error("Missing at least one required field for " + this.toString(true) + ": " + field.name);
36094 err["decoded"] = msg; // Still expose what we got
36095 throw(err);
36096 } else if (ProtoBuf.populateDefaults && field.defaultValue !== null)
36097 msg[field.name] = field.defaultValue;
36098 }
36099 }
36100 return msg;
36101 };
36102
36103 /**
36104 * @alias ProtoBuf.Reflect.Message
36105 * @expose
36106 */
36107 Reflect.Message = Message;
36108
36109 /**
36110 * Constructs a new Message Field.
36111 * @exports ProtoBuf.Reflect.Message.Field
36112 * @param {!ProtoBuf.Builder} builder Builder reference
36113 * @param {!ProtoBuf.Reflect.Message} message Message reference
36114 * @param {string} rule Rule, one of requried, optional, repeated
36115 * @param {string?} keytype Key data type, if any.
36116 * @param {string} type Data type, e.g. int32
36117 * @param {string} name Field name
36118 * @param {number} id Unique field id
36119 * @param {Object.<string,*>=} options Options
36120 * @param {!ProtoBuf.Reflect.Message.OneOf=} oneof Enclosing OneOf
36121 * @param {string?} syntax The syntax level of this definition (e.g., proto3)
36122 * @constructor
36123 * @extends ProtoBuf.Reflect.T
36124 */
36125 var Field = function(builder, message, rule, keytype, type, name, id, options, oneof, syntax) {
36126 T.call(this, builder, message, name);
36127
36128 /**
36129 * @override
36130 */
36131 this.className = "Message.Field";
36132
36133 /**
36134 * Message field required flag.
36135 * @type {boolean}
36136 * @expose
36137 */
36138 this.required = rule === "required";
36139
36140 /**
36141 * Message field repeated flag.
36142 * @type {boolean}
36143 * @expose
36144 */
36145 this.repeated = rule === "repeated";
36146
36147 /**
36148 * Message field map flag.
36149 * @type {boolean}
36150 * @expose
36151 */
36152 this.map = rule === "map";
36153
36154 /**
36155 * Message field key type. Type reference string if unresolved, protobuf
36156 * type if resolved. Valid only if this.map === true, null otherwise.
36157 * @type {string|{name: string, wireType: number}|null}
36158 * @expose
36159 */
36160 this.keyType = keytype || null;
36161
36162 /**
36163 * Message field type. Type reference string if unresolved, protobuf type if
36164 * resolved. In a map field, this is the value type.
36165 * @type {string|{name: string, wireType: number}}
36166 * @expose
36167 */
36168 this.type = type;
36169
36170 /**
36171 * Resolved type reference inside the global namespace.
36172 * @type {ProtoBuf.Reflect.T|null}
36173 * @expose
36174 */
36175 this.resolvedType = null;
36176
36177 /**
36178 * Unique message field id.
36179 * @type {number}
36180 * @expose
36181 */
36182 this.id = id;
36183
36184 /**
36185 * Message field options.
36186 * @type {!Object.<string,*>}
36187 * @dict
36188 * @expose
36189 */
36190 this.options = options || {};
36191
36192 /**
36193 * Default value.
36194 * @type {*}
36195 * @expose
36196 */
36197 this.defaultValue = null;
36198
36199 /**
36200 * Enclosing OneOf.
36201 * @type {?ProtoBuf.Reflect.Message.OneOf}
36202 * @expose
36203 */
36204 this.oneof = oneof || null;
36205
36206 /**
36207 * Syntax level of this definition (e.g., proto3).
36208 * @type {string}
36209 * @expose
36210 */
36211 this.syntax = syntax || 'proto2';
36212
36213 /**
36214 * Original field name.
36215 * @type {string}
36216 * @expose
36217 */
36218 this.originalName = this.name; // Used to revert camelcase transformation on naming collisions
36219
36220 /**
36221 * Element implementation. Created in build() after types are resolved.
36222 * @type {ProtoBuf.Element}
36223 * @expose
36224 */
36225 this.element = null;
36226
36227 /**
36228 * Key element implementation, for map fields. Created in build() after
36229 * types are resolved.
36230 * @type {ProtoBuf.Element}
36231 * @expose
36232 */
36233 this.keyElement = null;
36234
36235 // Convert field names to camel case notation if the override is set
36236 if (this.builder.options['convertFieldsToCamelCase'] && !(this instanceof Message.ExtensionField))
36237 this.name = ProtoBuf.Util.toCamelCase(this.name);
36238 };
36239
36240 /**
36241 * @alias ProtoBuf.Reflect.Message.Field.prototype
36242 * @inner
36243 */
36244 var FieldPrototype = Field.prototype = Object.create(T.prototype);
36245
36246 /**
36247 * Builds the field.
36248 * @override
36249 * @expose
36250 */
36251 FieldPrototype.build = function() {
36252 this.element = new Element(this.type, this.resolvedType, false, this.syntax, this.name);
36253 if (this.map)
36254 this.keyElement = new Element(this.keyType, undefined, true, this.syntax, this.name);
36255
36256 // In proto3, fields do not have field presence, and every field is set to
36257 // its type's default value ("", 0, 0.0, or false).
36258 if (this.syntax === 'proto3' && !this.repeated && !this.map)
36259 this.defaultValue = Element.defaultFieldValue(this.type);
36260
36261 // Otherwise, default values are present when explicitly specified
36262 else if (typeof this.options['default'] !== 'undefined')
36263 this.defaultValue = this.verifyValue(this.options['default']);
36264 };
36265
36266 /**
36267 * Checks if the given value can be set for this field.
36268 * @param {*} value Value to check
36269 * @param {boolean=} skipRepeated Whether to skip the repeated value check or not. Defaults to false.
36270 * @return {*} Verified, maybe adjusted, value
36271 * @throws {Error} If the value cannot be set for this field
36272 * @expose
36273 */
36274 FieldPrototype.verifyValue = function(value, skipRepeated) {
36275 skipRepeated = skipRepeated || false;
36276 var self = this;
36277 function fail(val, msg) {
36278 throw Error("Illegal value for "+self.toString(true)+" of type "+self.type.name+": "+val+" ("+msg+")");
36279 }
36280 if (value === null) { // NULL values for optional fields
36281 if (this.required)
36282 fail(typeof value, "required");
36283 if (this.syntax === 'proto3' && this.type !== ProtoBuf.TYPES["message"])
36284 fail(typeof value, "proto3 field without field presence cannot be null");
36285 return null;
36286 }
36287 var i;
36288 if (this.repeated && !skipRepeated) { // Repeated values as arrays
36289 if (!Array.isArray(value))
36290 value = [value];
36291 var res = [];
36292 for (i=0; i<value.length; i++)
36293 res.push(this.element.verifyValue(value[i]));
36294 return res;
36295 }
36296 if (this.map && !skipRepeated) { // Map values as objects
36297 if (!(value instanceof ProtoBuf.Map)) {
36298 // If not already a Map, attempt to convert.
36299 if (!(value instanceof Object)) {
36300 fail(typeof value,
36301 "expected ProtoBuf.Map or raw object for map field");
36302 }
36303 return new ProtoBuf.Map(this, value);
36304 } else {
36305 return value;
36306 }
36307 }
36308 // All non-repeated fields expect no array
36309 if (!this.repeated && Array.isArray(value))
36310 fail(typeof value, "no array expected");
36311
36312 return this.element.verifyValue(value);
36313 };
36314
36315 /**
36316 * Determines whether the field will have a presence on the wire given its
36317 * value.
36318 * @param {*} value Verified field value
36319 * @param {!ProtoBuf.Builder.Message} message Runtime message
36320 * @return {boolean} Whether the field will be present on the wire
36321 */
36322 FieldPrototype.hasWirePresence = function(value, message) {
36323 if (this.syntax !== 'proto3')
36324 return (value !== null);
36325 if (this.oneof && message[this.oneof.name] === this.name)
36326 return true;
36327 switch (this.type) {
36328 case ProtoBuf.TYPES["int32"]:
36329 case ProtoBuf.TYPES["sint32"]:
36330 case ProtoBuf.TYPES["sfixed32"]:
36331 case ProtoBuf.TYPES["uint32"]:
36332 case ProtoBuf.TYPES["fixed32"]:
36333 return value !== 0;
36334
36335 case ProtoBuf.TYPES["int64"]:
36336 case ProtoBuf.TYPES["sint64"]:
36337 case ProtoBuf.TYPES["sfixed64"]:
36338 case ProtoBuf.TYPES["uint64"]:
36339 case ProtoBuf.TYPES["fixed64"]:
36340 return value.low !== 0 || value.high !== 0;
36341
36342 case ProtoBuf.TYPES["bool"]:
36343 return value;
36344
36345 case ProtoBuf.TYPES["float"]:
36346 case ProtoBuf.TYPES["double"]:
36347 return value !== 0.0;
36348
36349 case ProtoBuf.TYPES["string"]:
36350 return value.length > 0;
36351
36352 case ProtoBuf.TYPES["bytes"]:
36353 return value.remaining() > 0;
36354
36355 case ProtoBuf.TYPES["enum"]:
36356 return value !== 0;
36357
36358 case ProtoBuf.TYPES["message"]:
36359 return value !== null;
36360 default:
36361 return true;
36362 }
36363 };
36364
36365 /**
36366 * Encodes the specified field value to the specified buffer.
36367 * @param {*} value Verified field value
36368 * @param {ByteBuffer} buffer ByteBuffer to encode to
36369 * @param {!ProtoBuf.Builder.Message} message Runtime message
36370 * @return {ByteBuffer} The ByteBuffer for chaining
36371 * @throws {Error} If the field cannot be encoded
36372 * @expose
36373 */
36374 FieldPrototype.encode = function(value, buffer, message) {
36375 if (this.type === null || typeof this.type !== 'object')
36376 throw Error("[INTERNAL] Unresolved type in "+this.toString(true)+": "+this.type);
36377 if (value === null || (this.repeated && value.length == 0))
36378 return buffer; // Optional omitted
36379 try {
36380 if (this.repeated) {
36381 var i;
36382 // "Only repeated fields of primitive numeric types (types which use the varint, 32-bit, or 64-bit wire
36383 // types) can be declared 'packed'."
36384 if (this.options["packed"] && ProtoBuf.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType) >= 0) {
36385 // "All of the elements of the field are packed into a single key-value pair with wire type 2
36386 // (length-delimited). Each element is encoded the same way it would be normally, except without a
36387 // tag preceding it."
36388 buffer.writeVarint32((this.id << 3) | ProtoBuf.WIRE_TYPES.LDELIM);
36389 buffer.ensureCapacity(buffer.offset += 1); // We do not know the length yet, so let's assume a varint of length 1
36390 var start = buffer.offset; // Remember where the contents begin
36391 for (i=0; i<value.length; i++)
36392 this.element.encodeValue(this.id, value[i], buffer);
36393 var len = buffer.offset-start,
36394 varintLen = ByteBuffer.calculateVarint32(len);
36395 if (varintLen > 1) { // We need to move the contents
36396 var contents = buffer.slice(start, buffer.offset);
36397 start += varintLen-1;
36398 buffer.offset = start;
36399 buffer.append(contents);
36400 }
36401 buffer.writeVarint32(len, start-varintLen);
36402 } else {
36403 // "If your message definition has repeated elements (without the [packed=true] option), the encoded
36404 // message has zero or more key-value pairs with the same tag number"
36405 for (i=0; i<value.length; i++)
36406 buffer.writeVarint32((this.id << 3) | this.type.wireType),
36407 this.element.encodeValue(this.id, value[i], buffer);
36408 }
36409 } else if (this.map) {
36410 // Write out each map entry as a submessage.
36411 value.forEach(function(val, key, m) {
36412 // Compute the length of the submessage (key, val) pair.
36413 var length =
36414 ByteBuffer.calculateVarint32((1 << 3) | this.keyType.wireType) +
36415 this.keyElement.calculateLength(1, key) +
36416 ByteBuffer.calculateVarint32((2 << 3) | this.type.wireType) +
36417 this.element.calculateLength(2, val);
36418
36419 // Submessage with wire type of length-delimited.
36420 buffer.writeVarint32((this.id << 3) | ProtoBuf.WIRE_TYPES.LDELIM);
36421 buffer.writeVarint32(length);
36422
36423 // Write out the key and val.
36424 buffer.writeVarint32((1 << 3) | this.keyType.wireType);
36425 this.keyElement.encodeValue(1, key, buffer);
36426 buffer.writeVarint32((2 << 3) | this.type.wireType);
36427 this.element.encodeValue(2, val, buffer);
36428 }, this);
36429 } else {
36430 if (this.hasWirePresence(value, message)) {
36431 buffer.writeVarint32((this.id << 3) | this.type.wireType);
36432 this.element.encodeValue(this.id, value, buffer);
36433 }
36434 }
36435 } catch (e) {
36436 throw Error("Illegal value for "+this.toString(true)+": "+value+" ("+e+")");
36437 }
36438 return buffer;
36439 };
36440
36441 /**
36442 * Calculates the length of this field's value on the network level.
36443 * @param {*} value Field value
36444 * @param {!ProtoBuf.Builder.Message} message Runtime message
36445 * @returns {number} Byte length
36446 * @expose
36447 */
36448 FieldPrototype.calculate = function(value, message) {
36449 value = this.verifyValue(value); // May throw
36450 if (this.type === null || typeof this.type !== 'object')
36451 throw Error("[INTERNAL] Unresolved type in "+this.toString(true)+": "+this.type);
36452 if (value === null || (this.repeated && value.length == 0))
36453 return 0; // Optional omitted
36454 var n = 0;
36455 try {
36456 if (this.repeated) {
36457 var i, ni;
36458 if (this.options["packed"] && ProtoBuf.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType) >= 0) {
36459 n += ByteBuffer.calculateVarint32((this.id << 3) | ProtoBuf.WIRE_TYPES.LDELIM);
36460 ni = 0;
36461 for (i=0; i<value.length; i++)
36462 ni += this.element.calculateLength(this.id, value[i]);
36463 n += ByteBuffer.calculateVarint32(ni);
36464 n += ni;
36465 } else {
36466 for (i=0; i<value.length; i++)
36467 n += ByteBuffer.calculateVarint32((this.id << 3) | this.type.wireType),
36468 n += this.element.calculateLength(this.id, value[i]);
36469 }
36470 } else if (this.map) {
36471 // Each map entry becomes a submessage.
36472 value.forEach(function(val, key, m) {
36473 // Compute the length of the submessage (key, val) pair.
36474 var length =
36475 ByteBuffer.calculateVarint32((1 << 3) | this.keyType.wireType) +
36476 this.keyElement.calculateLength(1, key) +
36477 ByteBuffer.calculateVarint32((2 << 3) | this.type.wireType) +
36478 this.element.calculateLength(2, val);
36479
36480 n += ByteBuffer.calculateVarint32((this.id << 3) | ProtoBuf.WIRE_TYPES.LDELIM);
36481 n += ByteBuffer.calculateVarint32(length);
36482 n += length;
36483 }, this);
36484 } else {
36485 if (this.hasWirePresence(value, message)) {
36486 n += ByteBuffer.calculateVarint32((this.id << 3) | this.type.wireType);
36487 n += this.element.calculateLength(this.id, value);
36488 }
36489 }
36490 } catch (e) {
36491 throw Error("Illegal value for "+this.toString(true)+": "+value+" ("+e+")");
36492 }
36493 return n;
36494 };
36495
36496 /**
36497 * Decode the field value from the specified buffer.
36498 * @param {number} wireType Leading wire type
36499 * @param {ByteBuffer} buffer ByteBuffer to decode from
36500 * @param {boolean=} skipRepeated Whether to skip the repeated check or not. Defaults to false.
36501 * @return {*} Decoded value: array for packed repeated fields, [key, value] for
36502 * map fields, or an individual value otherwise.
36503 * @throws {Error} If the field cannot be decoded
36504 * @expose
36505 */
36506 FieldPrototype.decode = function(wireType, buffer, skipRepeated) {
36507 var value, nBytes;
36508
36509 // We expect wireType to match the underlying type's wireType unless we see
36510 // a packed repeated field, or unless this is a map field.
36511 var wireTypeOK =
36512 (!this.map && wireType == this.type.wireType) ||
36513 (!skipRepeated && this.repeated && this.options["packed"] &&
36514 wireType == ProtoBuf.WIRE_TYPES.LDELIM) ||
36515 (this.map && wireType == ProtoBuf.WIRE_TYPES.LDELIM);
36516 if (!wireTypeOK)
36517 throw Error("Illegal wire type for field "+this.toString(true)+": "+wireType+" ("+this.type.wireType+" expected)");
36518
36519 // Handle packed repeated fields.
36520 if (wireType == ProtoBuf.WIRE_TYPES.LDELIM && this.repeated && this.options["packed"] && ProtoBuf.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType) >= 0) {
36521 if (!skipRepeated) {
36522 nBytes = buffer.readVarint32();
36523 nBytes = buffer.offset + nBytes; // Limit
36524 var values = [];
36525 while (buffer.offset < nBytes)
36526 values.push(this.decode(this.type.wireType, buffer, true));
36527 return values;
36528 }
36529 // Read the next value otherwise...
36530 }
36531
36532 // Handle maps.
36533 if (this.map) {
36534 // Read one (key, value) submessage, and return [key, value]
36535 var key = Element.defaultFieldValue(this.keyType);
36536 value = Element.defaultFieldValue(this.type);
36537
36538 // Read the length
36539 nBytes = buffer.readVarint32();
36540 if (buffer.remaining() < nBytes)
36541 throw Error("Illegal number of bytes for "+this.toString(true)+": "+nBytes+" required but got only "+buffer.remaining());
36542
36543 // Get a sub-buffer of this key/value submessage
36544 var msgbuf = buffer.clone();
36545 msgbuf.limit = msgbuf.offset + nBytes;
36546 buffer.offset += nBytes;
36547
36548 while (msgbuf.remaining() > 0) {
36549 var tag = msgbuf.readVarint32();
36550 wireType = tag & 0x07;
36551 var id = tag >>> 3;
36552 if (id === 1) {
36553 key = this.keyElement.decode(msgbuf, wireType, id);
36554 } else if (id === 2) {
36555 value = this.element.decode(msgbuf, wireType, id);
36556 } else {
36557 throw Error("Unexpected tag in map field key/value submessage");
36558 }
36559 }
36560
36561 return [key, value];
36562 }
36563
36564 // Handle singular and non-packed repeated field values.
36565 return this.element.decode(buffer, wireType, this.id);
36566 };
36567
36568 /**
36569 * @alias ProtoBuf.Reflect.Message.Field
36570 * @expose
36571 */
36572 Reflect.Message.Field = Field;
36573
36574 /**
36575 * Constructs a new Message ExtensionField.
36576 * @exports ProtoBuf.Reflect.Message.ExtensionField
36577 * @param {!ProtoBuf.Builder} builder Builder reference
36578 * @param {!ProtoBuf.Reflect.Message} message Message reference
36579 * @param {string} rule Rule, one of requried, optional, repeated
36580 * @param {string} type Data type, e.g. int32
36581 * @param {string} name Field name
36582 * @param {number} id Unique field id
36583 * @param {!Object.<string,*>=} options Options
36584 * @constructor
36585 * @extends ProtoBuf.Reflect.Message.Field
36586 */
36587 var ExtensionField = function(builder, message, rule, type, name, id, options) {
36588 Field.call(this, builder, message, rule, /* keytype = */ null, type, name, id, options);
36589
36590 /**
36591 * Extension reference.
36592 * @type {!ProtoBuf.Reflect.Extension}
36593 * @expose
36594 */
36595 this.extension;
36596 };
36597
36598 // Extends Field
36599 ExtensionField.prototype = Object.create(Field.prototype);
36600
36601 /**
36602 * @alias ProtoBuf.Reflect.Message.ExtensionField
36603 * @expose
36604 */
36605 Reflect.Message.ExtensionField = ExtensionField;
36606
36607 /**
36608 * Constructs a new Message OneOf.
36609 * @exports ProtoBuf.Reflect.Message.OneOf
36610 * @param {!ProtoBuf.Builder} builder Builder reference
36611 * @param {!ProtoBuf.Reflect.Message} message Message reference
36612 * @param {string} name OneOf name
36613 * @constructor
36614 * @extends ProtoBuf.Reflect.T
36615 */
36616 var OneOf = function(builder, message, name) {
36617 T.call(this, builder, message, name);
36618
36619 /**
36620 * Enclosed fields.
36621 * @type {!Array.<!ProtoBuf.Reflect.Message.Field>}
36622 * @expose
36623 */
36624 this.fields = [];
36625 };
36626
36627 /**
36628 * @alias ProtoBuf.Reflect.Message.OneOf
36629 * @expose
36630 */
36631 Reflect.Message.OneOf = OneOf;
36632
36633 /**
36634 * Constructs a new Enum.
36635 * @exports ProtoBuf.Reflect.Enum
36636 * @param {!ProtoBuf.Builder} builder Builder reference
36637 * @param {!ProtoBuf.Reflect.T} parent Parent Reflect object
36638 * @param {string} name Enum name
36639 * @param {Object.<string,*>=} options Enum options
36640 * @param {string?} syntax The syntax level (e.g., proto3)
36641 * @constructor
36642 * @extends ProtoBuf.Reflect.Namespace
36643 */
36644 var Enum = function(builder, parent, name, options, syntax) {
36645 Namespace.call(this, builder, parent, name, options, syntax);
36646
36647 /**
36648 * @override
36649 */
36650 this.className = "Enum";
36651
36652 /**
36653 * Runtime enum object.
36654 * @type {Object.<string,number>|null}
36655 * @expose
36656 */
36657 this.object = null;
36658 };
36659
36660 /**
36661 * Gets the string name of an enum value.
36662 * @param {!ProtoBuf.Builder.Enum} enm Runtime enum
36663 * @param {number} value Enum value
36664 * @returns {?string} Name or `null` if not present
36665 * @expose
36666 */
36667 Enum.getName = function(enm, value) {
36668 var keys = Object.keys(enm);
36669 for (var i=0, key; i<keys.length; ++i)
36670 if (enm[key = keys[i]] === value)
36671 return key;
36672 return null;
36673 };
36674
36675 /**
36676 * @alias ProtoBuf.Reflect.Enum.prototype
36677 * @inner
36678 */
36679 var EnumPrototype = Enum.prototype = Object.create(Namespace.prototype);
36680
36681 /**
36682 * Builds this enum and returns the runtime counterpart.
36683 * @param {boolean} rebuild Whether to rebuild or not, defaults to false
36684 * @returns {!Object.<string,number>}
36685 * @expose
36686 */
36687 EnumPrototype.build = function(rebuild) {
36688 if (this.object && !rebuild)
36689 return this.object;
36690 var enm = new ProtoBuf.Builder.Enum(),
36691 values = this.getChildren(Enum.Value);
36692 for (var i=0, k=values.length; i<k; ++i)
36693 enm[values[i]['name']] = values[i]['id'];
36694 if (Object.defineProperty)
36695 Object.defineProperty(enm, '$options', {
36696 "value": this.buildOpt(),
36697 "enumerable": false
36698 });
36699 return this.object = enm;
36700 };
36701
36702 /**
36703 * @alias ProtoBuf.Reflect.Enum
36704 * @expose
36705 */
36706 Reflect.Enum = Enum;
36707
36708 /**
36709 * Constructs a new Enum Value.
36710 * @exports ProtoBuf.Reflect.Enum.Value
36711 * @param {!ProtoBuf.Builder} builder Builder reference
36712 * @param {!ProtoBuf.Reflect.Enum} enm Enum reference
36713 * @param {string} name Field name
36714 * @param {number} id Unique field id
36715 * @constructor
36716 * @extends ProtoBuf.Reflect.T
36717 */
36718 var Value = function(builder, enm, name, id) {
36719 T.call(this, builder, enm, name);
36720
36721 /**
36722 * @override
36723 */
36724 this.className = "Enum.Value";
36725
36726 /**
36727 * Unique enum value id.
36728 * @type {number}
36729 * @expose
36730 */
36731 this.id = id;
36732 };
36733
36734 // Extends T
36735 Value.prototype = Object.create(T.prototype);
36736
36737 /**
36738 * @alias ProtoBuf.Reflect.Enum.Value
36739 * @expose
36740 */
36741 Reflect.Enum.Value = Value;
36742
36743 /**
36744 * An extension (field).
36745 * @exports ProtoBuf.Reflect.Extension
36746 * @constructor
36747 * @param {!ProtoBuf.Builder} builder Builder reference
36748 * @param {!ProtoBuf.Reflect.T} parent Parent object
36749 * @param {string} name Object name
36750 * @param {!ProtoBuf.Reflect.Message.Field} field Extension field
36751 */
36752 var Extension = function(builder, parent, name, field) {
36753 T.call(this, builder, parent, name);
36754
36755 /**
36756 * Extended message field.
36757 * @type {!ProtoBuf.Reflect.Message.Field}
36758 * @expose
36759 */
36760 this.field = field;
36761 };
36762
36763 // Extends T
36764 Extension.prototype = Object.create(T.prototype);
36765
36766 /**
36767 * @alias ProtoBuf.Reflect.Extension
36768 * @expose
36769 */
36770 Reflect.Extension = Extension;
36771
36772 /**
36773 * Constructs a new Service.
36774 * @exports ProtoBuf.Reflect.Service
36775 * @param {!ProtoBuf.Builder} builder Builder reference
36776 * @param {!ProtoBuf.Reflect.Namespace} root Root
36777 * @param {string} name Service name
36778 * @param {Object.<string,*>=} options Options
36779 * @constructor
36780 * @extends ProtoBuf.Reflect.Namespace
36781 */
36782 var Service = function(builder, root, name, options) {
36783 Namespace.call(this, builder, root, name, options);
36784
36785 /**
36786 * @override
36787 */
36788 this.className = "Service";
36789
36790 /**
36791 * Built runtime service class.
36792 * @type {?function(new:ProtoBuf.Builder.Service)}
36793 */
36794 this.clazz = null;
36795 };
36796
36797 /**
36798 * @alias ProtoBuf.Reflect.Service.prototype
36799 * @inner
36800 */
36801 var ServicePrototype = Service.prototype = Object.create(Namespace.prototype);
36802
36803 /**
36804 * Builds the service and returns the runtime counterpart, which is a fully functional class.
36805 * @see ProtoBuf.Builder.Service
36806 * @param {boolean=} rebuild Whether to rebuild or not
36807 * @return {Function} Service class
36808 * @throws {Error} If the message cannot be built
36809 * @expose
36810 */
36811 ServicePrototype.build = function(rebuild) {
36812 if (this.clazz && !rebuild)
36813 return this.clazz;
36814
36815 // Create the runtime Service class in its own scope
36816 return this.clazz = (function(ProtoBuf, T) {
36817
36818 /**
36819 * Constructs a new runtime Service.
36820 * @name ProtoBuf.Builder.Service
36821 * @param {function(string, ProtoBuf.Builder.Message, function(Error, ProtoBuf.Builder.Message=))=} rpcImpl RPC implementation receiving the method name and the message
36822 * @class Barebone of all runtime services.
36823 * @constructor
36824 * @throws {Error} If the service cannot be created
36825 */
36826 var Service = function(rpcImpl) {
36827 ProtoBuf.Builder.Service.call(this);
36828
36829 /**
36830 * Service implementation.
36831 * @name ProtoBuf.Builder.Service#rpcImpl
36832 * @type {!function(string, ProtoBuf.Builder.Message, function(Error, ProtoBuf.Builder.Message=))}
36833 * @expose
36834 */
36835 this.rpcImpl = rpcImpl || function(name, msg, callback) {
36836 // This is what a user has to implement: A function receiving the method name, the actual message to
36837 // send (type checked) and the callback that's either provided with the error as its first
36838 // argument or null and the actual response message.
36839 setTimeout(callback.bind(this, Error("Not implemented, see: https://github.com/dcodeIO/ProtoBuf.js/wiki/Services")), 0); // Must be async!
36840 };
36841 };
36842
36843 /**
36844 * @alias ProtoBuf.Builder.Service.prototype
36845 * @inner
36846 */
36847 var ServicePrototype = Service.prototype = Object.create(ProtoBuf.Builder.Service.prototype);
36848
36849 /**
36850 * Asynchronously performs an RPC call using the given RPC implementation.
36851 * @name ProtoBuf.Builder.Service.[Method]
36852 * @function
36853 * @param {!function(string, ProtoBuf.Builder.Message, function(Error, ProtoBuf.Builder.Message=))} rpcImpl RPC implementation
36854 * @param {ProtoBuf.Builder.Message} req Request
36855 * @param {function(Error, (ProtoBuf.Builder.Message|ByteBuffer|Buffer|string)=)} callback Callback receiving
36856 * the error if any and the response either as a pre-parsed message or as its raw bytes
36857 * @abstract
36858 */
36859
36860 /**
36861 * Asynchronously performs an RPC call using the instance's RPC implementation.
36862 * @name ProtoBuf.Builder.Service#[Method]
36863 * @function
36864 * @param {ProtoBuf.Builder.Message} req Request
36865 * @param {function(Error, (ProtoBuf.Builder.Message|ByteBuffer|Buffer|string)=)} callback Callback receiving
36866 * the error if any and the response either as a pre-parsed message or as its raw bytes
36867 * @abstract
36868 */
36869
36870 var rpc = T.getChildren(ProtoBuf.Reflect.Service.RPCMethod);
36871 for (var i=0; i<rpc.length; i++) {
36872 (function(method) {
36873
36874 // service#Method(message, callback)
36875 ServicePrototype[method.name] = function(req, callback) {
36876 try {
36877 try {
36878 // If given as a buffer, decode the request. Will throw a TypeError if not a valid buffer.
36879 req = method.resolvedRequestType.clazz.decode(ByteBuffer.wrap(req));
36880 } catch (err) {
36881 if (!(err instanceof TypeError))
36882 throw err;
36883 }
36884 if (req === null || typeof req !== 'object')
36885 throw Error("Illegal arguments");
36886 if (!(req instanceof method.resolvedRequestType.clazz))
36887 req = new method.resolvedRequestType.clazz(req);
36888 this.rpcImpl(method.fqn(), req, function(err, res) { // Assumes that this is properly async
36889 if (err) {
36890 callback(err);
36891 return;
36892 }
36893 // Coalesce to empty string when service response has empty content
36894 if (res === null)
36895 res = ''
36896 try { res = method.resolvedResponseType.clazz.decode(res); } catch (notABuffer) {}
36897 if (!res || !(res instanceof method.resolvedResponseType.clazz)) {
36898 callback(Error("Illegal response type received in service method "+ T.name+"#"+method.name));
36899 return;
36900 }
36901 callback(null, res);
36902 });
36903 } catch (err) {
36904 setTimeout(callback.bind(this, err), 0);
36905 }
36906 };
36907
36908 // Service.Method(rpcImpl, message, callback)
36909 Service[method.name] = function(rpcImpl, req, callback) {
36910 new Service(rpcImpl)[method.name](req, callback);
36911 };
36912
36913 if (Object.defineProperty)
36914 Object.defineProperty(Service[method.name], "$options", { "value": method.buildOpt() }),
36915 Object.defineProperty(ServicePrototype[method.name], "$options", { "value": Service[method.name]["$options"] });
36916 })(rpc[i]);
36917 }
36918
36919 // Properties
36920
36921 /**
36922 * Service options.
36923 * @name ProtoBuf.Builder.Service.$options
36924 * @type {Object.<string,*>}
36925 * @expose
36926 */
36927 var $optionsS; // cc needs this
36928
36929 /**
36930 * Service options.
36931 * @name ProtoBuf.Builder.Service#$options
36932 * @type {Object.<string,*>}
36933 * @expose
36934 */
36935 var $options;
36936
36937 /**
36938 * Reflection type.
36939 * @name ProtoBuf.Builder.Service.$type
36940 * @type {!ProtoBuf.Reflect.Service}
36941 * @expose
36942 */
36943 var $typeS;
36944
36945 /**
36946 * Reflection type.
36947 * @name ProtoBuf.Builder.Service#$type
36948 * @type {!ProtoBuf.Reflect.Service}
36949 * @expose
36950 */
36951 var $type;
36952
36953 if (Object.defineProperty)
36954 Object.defineProperty(Service, "$options", { "value": T.buildOpt() }),
36955 Object.defineProperty(ServicePrototype, "$options", { "value": Service["$options"] }),
36956 Object.defineProperty(Service, "$type", { "value": T }),
36957 Object.defineProperty(ServicePrototype, "$type", { "value": T });
36958
36959 return Service;
36960
36961 })(ProtoBuf, this);
36962 };
36963
36964 /**
36965 * @alias ProtoBuf.Reflect.Service
36966 * @expose
36967 */
36968 Reflect.Service = Service;
36969
36970 /**
36971 * Abstract service method.
36972 * @exports ProtoBuf.Reflect.Service.Method
36973 * @param {!ProtoBuf.Builder} builder Builder reference
36974 * @param {!ProtoBuf.Reflect.Service} svc Service
36975 * @param {string} name Method name
36976 * @param {Object.<string,*>=} options Options
36977 * @constructor
36978 * @extends ProtoBuf.Reflect.T
36979 */
36980 var Method = function(builder, svc, name, options) {
36981 T.call(this, builder, svc, name);
36982
36983 /**
36984 * @override
36985 */
36986 this.className = "Service.Method";
36987
36988 /**
36989 * Options.
36990 * @type {Object.<string, *>}
36991 * @expose
36992 */
36993 this.options = options || {};
36994 };
36995
36996 /**
36997 * @alias ProtoBuf.Reflect.Service.Method.prototype
36998 * @inner
36999 */
37000 var MethodPrototype = Method.prototype = Object.create(T.prototype);
37001
37002 /**
37003 * Builds the method's '$options' property.
37004 * @name ProtoBuf.Reflect.Service.Method#buildOpt
37005 * @function
37006 * @return {Object.<string,*>}
37007 */
37008 MethodPrototype.buildOpt = NamespacePrototype.buildOpt;
37009
37010 /**
37011 * @alias ProtoBuf.Reflect.Service.Method
37012 * @expose
37013 */
37014 Reflect.Service.Method = Method;
37015
37016 /**
37017 * RPC service method.
37018 * @exports ProtoBuf.Reflect.Service.RPCMethod
37019 * @param {!ProtoBuf.Builder} builder Builder reference
37020 * @param {!ProtoBuf.Reflect.Service} svc Service
37021 * @param {string} name Method name
37022 * @param {string} request Request message name
37023 * @param {string} response Response message name
37024 * @param {boolean} request_stream Whether requests are streamed
37025 * @param {boolean} response_stream Whether responses are streamed
37026 * @param {Object.<string,*>=} options Options
37027 * @constructor
37028 * @extends ProtoBuf.Reflect.Service.Method
37029 */
37030 var RPCMethod = function(builder, svc, name, request, response, request_stream, response_stream, options) {
37031 Method.call(this, builder, svc, name, options);
37032
37033 /**
37034 * @override
37035 */
37036 this.className = "Service.RPCMethod";
37037
37038 /**
37039 * Request message name.
37040 * @type {string}
37041 * @expose
37042 */
37043 this.requestName = request;
37044
37045 /**
37046 * Response message name.
37047 * @type {string}
37048 * @expose
37049 */
37050 this.responseName = response;
37051
37052 /**
37053 * Whether requests are streamed
37054 * @type {bool}
37055 * @expose
37056 */
37057 this.requestStream = request_stream;
37058
37059 /**
37060 * Whether responses are streamed
37061 * @type {bool}
37062 * @expose
37063 */
37064 this.responseStream = response_stream;
37065
37066 /**
37067 * Resolved request message type.
37068 * @type {ProtoBuf.Reflect.Message}
37069 * @expose
37070 */
37071 this.resolvedRequestType = null;
37072
37073 /**
37074 * Resolved response message type.
37075 * @type {ProtoBuf.Reflect.Message}
37076 * @expose
37077 */
37078 this.resolvedResponseType = null;
37079 };
37080
37081 // Extends Method
37082 RPCMethod.prototype = Object.create(Method.prototype);
37083
37084 /**
37085 * @alias ProtoBuf.Reflect.Service.RPCMethod
37086 * @expose
37087 */
37088 Reflect.Service.RPCMethod = RPCMethod;
37089
37090 return Reflect;
37091
37092 })(ProtoBuf);
37093
37094 /**
37095 * @alias ProtoBuf.Builder
37096 * @expose
37097 */
37098 ProtoBuf.Builder = (function(ProtoBuf, Lang, Reflect) {
37099 "use strict";
37100
37101 /**
37102 * Constructs a new Builder.
37103 * @exports ProtoBuf.Builder
37104 * @class Provides the functionality to build protocol messages.
37105 * @param {Object.<string,*>=} options Options
37106 * @constructor
37107 */
37108 var Builder = function(options) {
37109
37110 /**
37111 * Namespace.
37112 * @type {ProtoBuf.Reflect.Namespace}
37113 * @expose
37114 */
37115 this.ns = new Reflect.Namespace(this, null, ""); // Global namespace
37116
37117 /**
37118 * Namespace pointer.
37119 * @type {ProtoBuf.Reflect.T}
37120 * @expose
37121 */
37122 this.ptr = this.ns;
37123
37124 /**
37125 * Resolved flag.
37126 * @type {boolean}
37127 * @expose
37128 */
37129 this.resolved = false;
37130
37131 /**
37132 * The current building result.
37133 * @type {Object.<string,ProtoBuf.Builder.Message|Object>|null}
37134 * @expose
37135 */
37136 this.result = null;
37137
37138 /**
37139 * Imported files.
37140 * @type {Array.<string>}
37141 * @expose
37142 */
37143 this.files = {};
37144
37145 /**
37146 * Import root override.
37147 * @type {?string}
37148 * @expose
37149 */
37150 this.importRoot = null;
37151
37152 /**
37153 * Options.
37154 * @type {!Object.<string, *>}
37155 * @expose
37156 */
37157 this.options = options || {};
37158 };
37159
37160 /**
37161 * @alias ProtoBuf.Builder.prototype
37162 * @inner
37163 */
37164 var BuilderPrototype = Builder.prototype;
37165
37166 // ----- Definition tests -----
37167
37168 /**
37169 * Tests if a definition most likely describes a message.
37170 * @param {!Object} def
37171 * @returns {boolean}
37172 * @expose
37173 */
37174 Builder.isMessage = function(def) {
37175 // Messages require a string name
37176 if (typeof def["name"] !== 'string')
37177 return false;
37178 // Messages do not contain values (enum) or rpc methods (service)
37179 if (typeof def["values"] !== 'undefined' || typeof def["rpc"] !== 'undefined')
37180 return false;
37181 return true;
37182 };
37183
37184 /**
37185 * Tests if a definition most likely describes a message field.
37186 * @param {!Object} def
37187 * @returns {boolean}
37188 * @expose
37189 */
37190 Builder.isMessageField = function(def) {
37191 // Message fields require a string rule, name and type and an id
37192 if (typeof def["rule"] !== 'string' || typeof def["name"] !== 'string' || typeof def["type"] !== 'string' || typeof def["id"] === 'undefined')
37193 return false;
37194 return true;
37195 };
37196
37197 /**
37198 * Tests if a definition most likely describes an enum.
37199 * @param {!Object} def
37200 * @returns {boolean}
37201 * @expose
37202 */
37203 Builder.isEnum = function(def) {
37204 // Enums require a string name
37205 if (typeof def["name"] !== 'string')
37206 return false;
37207 // Enums require at least one value
37208 if (typeof def["values"] === 'undefined' || !Array.isArray(def["values"]) || def["values"].length === 0)
37209 return false;
37210 return true;
37211 };
37212
37213 /**
37214 * Tests if a definition most likely describes a service.
37215 * @param {!Object} def
37216 * @returns {boolean}
37217 * @expose
37218 */
37219 Builder.isService = function(def) {
37220 // Services require a string name and an rpc object
37221 if (typeof def["name"] !== 'string' || typeof def["rpc"] !== 'object' || !def["rpc"])
37222 return false;
37223 return true;
37224 };
37225
37226 /**
37227 * Tests if a definition most likely describes an extended message
37228 * @param {!Object} def
37229 * @returns {boolean}
37230 * @expose
37231 */
37232 Builder.isExtend = function(def) {
37233 // Extends rquire a string ref
37234 if (typeof def["ref"] !== 'string')
37235 return false;
37236 return true;
37237 };
37238
37239 // ----- Building -----
37240
37241 /**
37242 * Resets the pointer to the root namespace.
37243 * @returns {!ProtoBuf.Builder} this
37244 * @expose
37245 */
37246 BuilderPrototype.reset = function() {
37247 this.ptr = this.ns;
37248 return this;
37249 };
37250
37251 /**
37252 * Defines a namespace on top of the current pointer position and places the pointer on it.
37253 * @param {string} namespace
37254 * @return {!ProtoBuf.Builder} this
37255 * @expose
37256 */
37257 BuilderPrototype.define = function(namespace) {
37258 if (typeof namespace !== 'string' || !Lang.TYPEREF.test(namespace))
37259 throw Error("illegal namespace: "+namespace);
37260 namespace.split(".").forEach(function(part) {
37261 var ns = this.ptr.getChild(part);
37262 if (ns === null) // Keep existing
37263 this.ptr.addChild(ns = new Reflect.Namespace(this, this.ptr, part));
37264 this.ptr = ns;
37265 }, this);
37266 return this;
37267 };
37268
37269 /**
37270 * Creates the specified definitions at the current pointer position.
37271 * @param {!Array.<!Object>} defs Messages, enums or services to create
37272 * @returns {!ProtoBuf.Builder} this
37273 * @throws {Error} If a message definition is invalid
37274 * @expose
37275 */
37276 BuilderPrototype.create = function(defs) {
37277 if (!defs)
37278 return this; // Nothing to create
37279 if (!Array.isArray(defs))
37280 defs = [defs];
37281 else {
37282 if (defs.length === 0)
37283 return this;
37284 defs = defs.slice();
37285 }
37286
37287 // It's quite hard to keep track of scopes and memory here, so let's do this iteratively.
37288 var stack = [defs];
37289 while (stack.length > 0) {
37290 defs = stack.pop();
37291
37292 if (!Array.isArray(defs)) // Stack always contains entire namespaces
37293 throw Error("not a valid namespace: "+JSON.stringify(defs));
37294
37295 while (defs.length > 0) {
37296 var def = defs.shift(); // Namespaces always contain an array of messages, enums and services
37297
37298 if (Builder.isMessage(def)) {
37299 var obj = new Reflect.Message(this, this.ptr, def["name"], def["options"], def["isGroup"], def["syntax"]);
37300
37301 // Create OneOfs
37302 var oneofs = {};
37303 if (def["oneofs"])
37304 Object.keys(def["oneofs"]).forEach(function(name) {
37305 obj.addChild(oneofs[name] = new Reflect.Message.OneOf(this, obj, name));
37306 }, this);
37307
37308 // Create fields
37309 if (def["fields"])
37310 def["fields"].forEach(function(fld) {
37311 if (obj.getChild(fld["id"]|0) !== null)
37312 throw Error("duplicate or invalid field id in "+obj.name+": "+fld['id']);
37313 if (fld["options"] && typeof fld["options"] !== 'object')
37314 throw Error("illegal field options in "+obj.name+"#"+fld["name"]);
37315 var oneof = null;
37316 if (typeof fld["oneof"] === 'string' && !(oneof = oneofs[fld["oneof"]]))
37317 throw Error("illegal oneof in "+obj.name+"#"+fld["name"]+": "+fld["oneof"]);
37318 fld = new Reflect.Message.Field(this, obj, fld["rule"], fld["keytype"], fld["type"], fld["name"], fld["id"], fld["options"], oneof, def["syntax"]);
37319 if (oneof)
37320 oneof.fields.push(fld);
37321 obj.addChild(fld);
37322 }, this);
37323
37324 // Push children to stack
37325 var subObj = [];
37326 if (def["enums"])
37327 def["enums"].forEach(function(enm) {
37328 subObj.push(enm);
37329 });
37330 if (def["messages"])
37331 def["messages"].forEach(function(msg) {
37332 subObj.push(msg);
37333 });
37334 if (def["services"])
37335 def["services"].forEach(function(svc) {
37336 subObj.push(svc);
37337 });
37338
37339 // Set extension ranges
37340 if (def["extensions"]) {
37341 if (typeof def["extensions"][0] === 'number') // pre 5.0.1
37342 obj.extensions = [ def["extensions"] ];
37343 else
37344 obj.extensions = def["extensions"];
37345 }
37346
37347 // Create on top of current namespace
37348 this.ptr.addChild(obj);
37349 if (subObj.length > 0) {
37350 stack.push(defs); // Push the current level back
37351 defs = subObj; // Continue processing sub level
37352 subObj = null;
37353 this.ptr = obj; // And move the pointer to this namespace
37354 obj = null;
37355 continue;
37356 }
37357 subObj = null;
37358
37359 } else if (Builder.isEnum(def)) {
37360
37361 obj = new Reflect.Enum(this, this.ptr, def["name"], def["options"], def["syntax"]);
37362 def["values"].forEach(function(val) {
37363 obj.addChild(new Reflect.Enum.Value(this, obj, val["name"], val["id"]));
37364 }, this);
37365 this.ptr.addChild(obj);
37366
37367 } else if (Builder.isService(def)) {
37368
37369 obj = new Reflect.Service(this, this.ptr, def["name"], def["options"]);
37370 Object.keys(def["rpc"]).forEach(function(name) {
37371 var mtd = def["rpc"][name];
37372 obj.addChild(new Reflect.Service.RPCMethod(this, obj, name, mtd["request"], mtd["response"], !!mtd["request_stream"], !!mtd["response_stream"], mtd["options"]));
37373 }, this);
37374 this.ptr.addChild(obj);
37375
37376 } else if (Builder.isExtend(def)) {
37377
37378 obj = this.ptr.resolve(def["ref"], true);
37379 if (obj) {
37380 def["fields"].forEach(function(fld) {
37381 if (obj.getChild(fld['id']|0) !== null)
37382 throw Error("duplicate extended field id in "+obj.name+": "+fld['id']);
37383 // Check if field id is allowed to be extended
37384 if (obj.extensions) {
37385 var valid = false;
37386 obj.extensions.forEach(function(range) {
37387 if (fld["id"] >= range[0] && fld["id"] <= range[1])
37388 valid = true;
37389 });
37390 if (!valid)
37391 throw Error("illegal extended field id in "+obj.name+": "+fld['id']+" (not within valid ranges)");
37392 }
37393 // Convert extension field names to camel case notation if the override is set
37394 var name = fld["name"];
37395 if (this.options['convertFieldsToCamelCase'])
37396 name = ProtoBuf.Util.toCamelCase(name);
37397 // see #161: Extensions use their fully qualified name as their runtime key and...
37398 var field = new Reflect.Message.ExtensionField(this, obj, fld["rule"], fld["type"], this.ptr.fqn()+'.'+name, fld["id"], fld["options"]);
37399 // ...are added on top of the current namespace as an extension which is used for
37400 // resolving their type later on (the extension always keeps the original name to
37401 // prevent naming collisions)
37402 var ext = new Reflect.Extension(this, this.ptr, fld["name"], field);
37403 field.extension = ext;
37404 this.ptr.addChild(ext);
37405 obj.addChild(field);
37406 }, this);
37407
37408 } else if (!/\.?google\.protobuf\./.test(def["ref"])) // Silently skip internal extensions
37409 throw Error("extended message "+def["ref"]+" is not defined");
37410
37411 } else
37412 throw Error("not a valid definition: "+JSON.stringify(def));
37413
37414 def = null;
37415 obj = null;
37416 }
37417 // Break goes here
37418 defs = null;
37419 this.ptr = this.ptr.parent; // Namespace done, continue at parent
37420 }
37421 this.resolved = false; // Require re-resolve
37422 this.result = null; // Require re-build
37423 return this;
37424 };
37425
37426 /**
37427 * Propagates syntax to all children.
37428 * @param {!Object} parent
37429 * @inner
37430 */
37431 function propagateSyntax(parent) {
37432 if (parent['messages']) {
37433 parent['messages'].forEach(function(child) {
37434 child["syntax"] = parent["syntax"];
37435 propagateSyntax(child);
37436 });
37437 }
37438 if (parent['enums']) {
37439 parent['enums'].forEach(function(child) {
37440 child["syntax"] = parent["syntax"];
37441 });
37442 }
37443 }
37444
37445 /**
37446 * Imports another definition into this builder.
37447 * @param {Object.<string,*>} json Parsed import
37448 * @param {(string|{root: string, file: string})=} filename Imported file name
37449 * @returns {!ProtoBuf.Builder} this
37450 * @throws {Error} If the definition or file cannot be imported
37451 * @expose
37452 */
37453 BuilderPrototype["import"] = function(json, filename) {
37454 var delim = '/';
37455
37456 // Make sure to skip duplicate imports
37457
37458 if (typeof filename === 'string') {
37459
37460 if (ProtoBuf.Util.IS_NODE)
37461 filename = __webpack_require__(118)['resolve'](filename);
37462 if (this.files[filename] === true)
37463 return this.reset();
37464 this.files[filename] = true;
37465
37466 } else if (typeof filename === 'object') { // Object with root, file.
37467
37468 var root = filename.root;
37469 if (ProtoBuf.Util.IS_NODE)
37470 root = __webpack_require__(118)['resolve'](root);
37471 if (root.indexOf("\\") >= 0 || filename.file.indexOf("\\") >= 0)
37472 delim = '\\';
37473 var fname;
37474 if (ProtoBuf.Util.IS_NODE)
37475 fname = __webpack_require__(118)['join'](root, filename.file);
37476 else
37477 fname = root + delim + filename.file;
37478 if (this.files[fname] === true)
37479 return this.reset();
37480 this.files[fname] = true;
37481 }
37482
37483 // Import imports
37484
37485 if (json['imports'] && json['imports'].length > 0) {
37486 var importRoot,
37487 resetRoot = false;
37488
37489 if (typeof filename === 'object') { // If an import root is specified, override
37490
37491 this.importRoot = filename["root"]; resetRoot = true; // ... and reset afterwards
37492 importRoot = this.importRoot;
37493 filename = filename["file"];
37494 if (importRoot.indexOf("\\") >= 0 || filename.indexOf("\\") >= 0)
37495 delim = '\\';
37496
37497 } else if (typeof filename === 'string') {
37498
37499 if (this.importRoot) // If import root is overridden, use it
37500 importRoot = this.importRoot;
37501 else { // Otherwise compute from filename
37502 if (filename.indexOf("/") >= 0) { // Unix
37503 importRoot = filename.replace(/\/[^\/]*$/, "");
37504 if (/* /file.proto */ importRoot === "")
37505 importRoot = "/";
37506 } else if (filename.indexOf("\\") >= 0) { // Windows
37507 importRoot = filename.replace(/\\[^\\]*$/, "");
37508 delim = '\\';
37509 } else
37510 importRoot = ".";
37511 }
37512
37513 } else
37514 importRoot = null;
37515
37516 for (var i=0; i<json['imports'].length; i++) {
37517 if (typeof json['imports'][i] === 'string') { // Import file
37518 if (!importRoot)
37519 throw Error("cannot determine import root");
37520 var importFilename = json['imports'][i];
37521 if (importFilename === "google/protobuf/descriptor.proto")
37522 continue; // Not needed and therefore not used
37523 if (ProtoBuf.Util.IS_NODE)
37524 importFilename = __webpack_require__(118)['join'](importRoot, importFilename);
37525 else
37526 importFilename = importRoot + delim + importFilename;
37527 if (this.files[importFilename] === true)
37528 continue; // Already imported
37529 if (/\.proto$/i.test(importFilename) && !ProtoBuf.DotProto) // If this is a light build
37530 importFilename = importFilename.replace(/\.proto$/, ".json"); // always load the JSON file
37531 var contents = ProtoBuf.Util.fetch(importFilename);
37532 if (contents === null)
37533 throw Error("failed to import '"+importFilename+"' in '"+filename+"': file not found");
37534 if (/\.json$/i.test(importFilename)) // Always possible
37535 this["import"](JSON.parse(contents+""), importFilename); // May throw
37536 else
37537 this["import"](ProtoBuf.DotProto.Parser.parse(contents), importFilename); // May throw
37538 } else // Import structure
37539 if (!filename)
37540 this["import"](json['imports'][i]);
37541 else if (/\.(\w+)$/.test(filename)) // With extension: Append _importN to the name portion to make it unique
37542 this["import"](json['imports'][i], filename.replace(/^(.+)\.(\w+)$/, function($0, $1, $2) { return $1+"_import"+i+"."+$2; }));
37543 else // Without extension: Append _importN to make it unique
37544 this["import"](json['imports'][i], filename+"_import"+i);
37545 }
37546 if (resetRoot) // Reset import root override when all imports are done
37547 this.importRoot = null;
37548 }
37549
37550 // Import structures
37551
37552 if (json['package'])
37553 this.define(json['package']);
37554 if (json['syntax'])
37555 propagateSyntax(json);
37556 var base = this.ptr;
37557 if (json['options'])
37558 Object.keys(json['options']).forEach(function(key) {
37559 base.options[key] = json['options'][key];
37560 });
37561 if (json['messages'])
37562 this.create(json['messages']),
37563 this.ptr = base;
37564 if (json['enums'])
37565 this.create(json['enums']),
37566 this.ptr = base;
37567 if (json['services'])
37568 this.create(json['services']),
37569 this.ptr = base;
37570 if (json['extends'])
37571 this.create(json['extends']);
37572
37573 return this.reset();
37574 };
37575
37576 /**
37577 * Resolves all namespace objects.
37578 * @throws {Error} If a type cannot be resolved
37579 * @returns {!ProtoBuf.Builder} this
37580 * @expose
37581 */
37582 BuilderPrototype.resolveAll = function() {
37583 // Resolve all reflected objects
37584 var res;
37585 if (this.ptr == null || typeof this.ptr.type === 'object')
37586 return this; // Done (already resolved)
37587
37588 if (this.ptr instanceof Reflect.Namespace) { // Resolve children
37589
37590 this.ptr.children.forEach(function(child) {
37591 this.ptr = child;
37592 this.resolveAll();
37593 }, this);
37594
37595 } else if (this.ptr instanceof Reflect.Message.Field) { // Resolve type
37596
37597 if (!Lang.TYPE.test(this.ptr.type)) {
37598 if (!Lang.TYPEREF.test(this.ptr.type))
37599 throw Error("illegal type reference in "+this.ptr.toString(true)+": "+this.ptr.type);
37600 res = (this.ptr instanceof Reflect.Message.ExtensionField ? this.ptr.extension.parent : this.ptr.parent).resolve(this.ptr.type, true);
37601 if (!res)
37602 throw Error("unresolvable type reference in "+this.ptr.toString(true)+": "+this.ptr.type);
37603 this.ptr.resolvedType = res;
37604 if (res instanceof Reflect.Enum) {
37605 this.ptr.type = ProtoBuf.TYPES["enum"];
37606 if (this.ptr.syntax === 'proto3' && res.syntax !== 'proto3')
37607 throw Error("proto3 message cannot reference proto2 enum");
37608 }
37609 else if (res instanceof Reflect.Message)
37610 this.ptr.type = res.isGroup ? ProtoBuf.TYPES["group"] : ProtoBuf.TYPES["message"];
37611 else
37612 throw Error("illegal type reference in "+this.ptr.toString(true)+": "+this.ptr.type);
37613 } else
37614 this.ptr.type = ProtoBuf.TYPES[this.ptr.type];
37615
37616 // If it's a map field, also resolve the key type. The key type can be only a numeric, string, or bool type
37617 // (i.e., no enums or messages), so we don't need to resolve against the current namespace.
37618 if (this.ptr.map) {
37619 if (!Lang.TYPE.test(this.ptr.keyType))
37620 throw Error("illegal key type for map field in "+this.ptr.toString(true)+": "+this.ptr.keyType);
37621 this.ptr.keyType = ProtoBuf.TYPES[this.ptr.keyType];
37622 }
37623
37624 // If it's a repeated and packable field then proto3 mandates it should be packed by
37625 // default
37626 if (
37627 this.ptr.syntax === 'proto3' &&
37628 this.ptr.repeated && this.ptr.options.packed === undefined &&
37629 ProtoBuf.PACKABLE_WIRE_TYPES.indexOf(this.ptr.type.wireType) !== -1
37630 ) {
37631 this.ptr.options.packed = true;
37632 }
37633
37634 } else if (this.ptr instanceof ProtoBuf.Reflect.Service.Method) {
37635
37636 if (this.ptr instanceof ProtoBuf.Reflect.Service.RPCMethod) {
37637 res = this.ptr.parent.resolve(this.ptr.requestName, true);
37638 if (!res || !(res instanceof ProtoBuf.Reflect.Message))
37639 throw Error("Illegal type reference in "+this.ptr.toString(true)+": "+this.ptr.requestName);
37640 this.ptr.resolvedRequestType = res;
37641 res = this.ptr.parent.resolve(this.ptr.responseName, true);
37642 if (!res || !(res instanceof ProtoBuf.Reflect.Message))
37643 throw Error("Illegal type reference in "+this.ptr.toString(true)+": "+this.ptr.responseName);
37644 this.ptr.resolvedResponseType = res;
37645 } else // Should not happen as nothing else is implemented
37646 throw Error("illegal service type in "+this.ptr.toString(true));
37647
37648 } else if (
37649 !(this.ptr instanceof ProtoBuf.Reflect.Message.OneOf) && // Not built
37650 !(this.ptr instanceof ProtoBuf.Reflect.Extension) && // Not built
37651 !(this.ptr instanceof ProtoBuf.Reflect.Enum.Value) // Built in enum
37652 )
37653 throw Error("illegal object in namespace: "+typeof(this.ptr)+": "+this.ptr);
37654
37655 return this.reset();
37656 };
37657
37658 /**
37659 * Builds the protocol. This will first try to resolve all definitions and, if this has been successful,
37660 * return the built package.
37661 * @param {(string|Array.<string>)=} path Specifies what to return. If omitted, the entire namespace will be returned.
37662 * @returns {!ProtoBuf.Builder.Message|!Object.<string,*>}
37663 * @throws {Error} If a type could not be resolved
37664 * @expose
37665 */
37666 BuilderPrototype.build = function(path) {
37667 this.reset();
37668 if (!this.resolved)
37669 this.resolveAll(),
37670 this.resolved = true,
37671 this.result = null; // Require re-build
37672 if (this.result === null) // (Re-)Build
37673 this.result = this.ns.build();
37674 if (!path)
37675 return this.result;
37676 var part = typeof path === 'string' ? path.split(".") : path,
37677 ptr = this.result; // Build namespace pointer (no hasChild etc.)
37678 for (var i=0; i<part.length; i++)
37679 if (ptr[part[i]])
37680 ptr = ptr[part[i]];
37681 else {
37682 ptr = null;
37683 break;
37684 }
37685 return ptr;
37686 };
37687
37688 /**
37689 * Similar to {@link ProtoBuf.Builder#build}, but looks up the internal reflection descriptor.
37690 * @param {string=} path Specifies what to return. If omitted, the entire namespace wiil be returned.
37691 * @param {boolean=} excludeNonNamespace Excludes non-namespace types like fields, defaults to `false`
37692 * @returns {?ProtoBuf.Reflect.T} Reflection descriptor or `null` if not found
37693 */
37694 BuilderPrototype.lookup = function(path, excludeNonNamespace) {
37695 return path ? this.ns.resolve(path, excludeNonNamespace) : this.ns;
37696 };
37697
37698 /**
37699 * Returns a string representation of this object.
37700 * @return {string} String representation as of "Builder"
37701 * @expose
37702 */
37703 BuilderPrototype.toString = function() {
37704 return "Builder";
37705 };
37706
37707 // ----- Base classes -----
37708 // Exist for the sole purpose of being able to "... instanceof ProtoBuf.Builder.Message" etc.
37709
37710 /**
37711 * @alias ProtoBuf.Builder.Message
37712 */
37713 Builder.Message = function() {};
37714
37715 /**
37716 * @alias ProtoBuf.Builder.Enum
37717 */
37718 Builder.Enum = function() {};
37719
37720 /**
37721 * @alias ProtoBuf.Builder.Message
37722 */
37723 Builder.Service = function() {};
37724
37725 return Builder;
37726
37727 })(ProtoBuf, ProtoBuf.Lang, ProtoBuf.Reflect);
37728
37729 /**
37730 * @alias ProtoBuf.Map
37731 * @expose
37732 */
37733 ProtoBuf.Map = (function(ProtoBuf, Reflect) {
37734 "use strict";
37735
37736 /**
37737 * Constructs a new Map. A Map is a container that is used to implement map
37738 * fields on message objects. It closely follows the ES6 Map API; however,
37739 * it is distinct because we do not want to depend on external polyfills or
37740 * on ES6 itself.
37741 *
37742 * @exports ProtoBuf.Map
37743 * @param {!ProtoBuf.Reflect.Field} field Map field
37744 * @param {Object.<string,*>=} contents Initial contents
37745 * @constructor
37746 */
37747 var Map = function(field, contents) {
37748 if (!field.map)
37749 throw Error("field is not a map");
37750
37751 /**
37752 * The field corresponding to this map.
37753 * @type {!ProtoBuf.Reflect.Field}
37754 */
37755 this.field = field;
37756
37757 /**
37758 * Element instance corresponding to key type.
37759 * @type {!ProtoBuf.Reflect.Element}
37760 */
37761 this.keyElem = new Reflect.Element(field.keyType, null, true, field.syntax);
37762
37763 /**
37764 * Element instance corresponding to value type.
37765 * @type {!ProtoBuf.Reflect.Element}
37766 */
37767 this.valueElem = new Reflect.Element(field.type, field.resolvedType, false, field.syntax);
37768
37769 /**
37770 * Internal map: stores mapping of (string form of key) -> (key, value)
37771 * pair.
37772 *
37773 * We provide map semantics for arbitrary key types, but we build on top
37774 * of an Object, which has only string keys. In order to avoid the need
37775 * to convert a string key back to its native type in many situations,
37776 * we store the native key value alongside the value. Thus, we only need
37777 * a one-way mapping from a key type to its string form that guarantees
37778 * uniqueness and equality (i.e., str(K1) === str(K2) if and only if K1
37779 * === K2).
37780 *
37781 * @type {!Object<string, {key: *, value: *}>}
37782 */
37783 this.map = {};
37784
37785 /**
37786 * Returns the number of elements in the map.
37787 */
37788 Object.defineProperty(this, "size", {
37789 get: function() { return Object.keys(this.map).length; }
37790 });
37791
37792 // Fill initial contents from a raw object.
37793 if (contents) {
37794 var keys = Object.keys(contents);
37795 for (var i = 0; i < keys.length; i++) {
37796 var key = this.keyElem.valueFromString(keys[i]);
37797 var val = this.valueElem.verifyValue(contents[keys[i]]);
37798 this.map[this.keyElem.valueToString(key)] =
37799 { key: key, value: val };
37800 }
37801 }
37802 };
37803
37804 var MapPrototype = Map.prototype;
37805
37806 /**
37807 * Helper: return an iterator over an array.
37808 * @param {!Array<*>} arr the array
37809 * @returns {!Object} an iterator
37810 * @inner
37811 */
37812 function arrayIterator(arr) {
37813 var idx = 0;
37814 return {
37815 next: function() {
37816 if (idx < arr.length)
37817 return { done: false, value: arr[idx++] };
37818 return { done: true };
37819 }
37820 }
37821 }
37822
37823 /**
37824 * Clears the map.
37825 */
37826 MapPrototype.clear = function() {
37827 this.map = {};
37828 };
37829
37830 /**
37831 * Deletes a particular key from the map.
37832 * @returns {boolean} Whether any entry with this key was deleted.
37833 */
37834 MapPrototype["delete"] = function(key) {
37835 var keyValue = this.keyElem.valueToString(this.keyElem.verifyValue(key));
37836 var hadKey = keyValue in this.map;
37837 delete this.map[keyValue];
37838 return hadKey;
37839 };
37840
37841 /**
37842 * Returns an iterator over [key, value] pairs in the map.
37843 * @returns {Object} The iterator
37844 */
37845 MapPrototype.entries = function() {
37846 var entries = [];
37847 var strKeys = Object.keys(this.map);
37848 for (var i = 0, entry; i < strKeys.length; i++)
37849 entries.push([(entry=this.map[strKeys[i]]).key, entry.value]);
37850 return arrayIterator(entries);
37851 };
37852
37853 /**
37854 * Returns an iterator over keys in the map.
37855 * @returns {Object} The iterator
37856 */
37857 MapPrototype.keys = function() {
37858 var keys = [];
37859 var strKeys = Object.keys(this.map);
37860 for (var i = 0; i < strKeys.length; i++)
37861 keys.push(this.map[strKeys[i]].key);
37862 return arrayIterator(keys);
37863 };
37864
37865 /**
37866 * Returns an iterator over values in the map.
37867 * @returns {!Object} The iterator
37868 */
37869 MapPrototype.values = function() {
37870 var values = [];
37871 var strKeys = Object.keys(this.map);
37872 for (var i = 0; i < strKeys.length; i++)
37873 values.push(this.map[strKeys[i]].value);
37874 return arrayIterator(values);
37875 };
37876
37877 /**
37878 * Iterates over entries in the map, calling a function on each.
37879 * @param {function(this:*, *, *, *)} cb The callback to invoke with value, key, and map arguments.
37880 * @param {Object=} thisArg The `this` value for the callback
37881 */
37882 MapPrototype.forEach = function(cb, thisArg) {
37883 var strKeys = Object.keys(this.map);
37884 for (var i = 0, entry; i < strKeys.length; i++)
37885 cb.call(thisArg, (entry=this.map[strKeys[i]]).value, entry.key, this);
37886 };
37887
37888 /**
37889 * Sets a key in the map to the given value.
37890 * @param {*} key The key
37891 * @param {*} value The value
37892 * @returns {!ProtoBuf.Map} The map instance
37893 */
37894 MapPrototype.set = function(key, value) {
37895 var keyValue = this.keyElem.verifyValue(key);
37896 var valValue = this.valueElem.verifyValue(value);
37897 this.map[this.keyElem.valueToString(keyValue)] =
37898 { key: keyValue, value: valValue };
37899 return this;
37900 };
37901
37902 /**
37903 * Gets the value corresponding to a key in the map.
37904 * @param {*} key The key
37905 * @returns {*|undefined} The value, or `undefined` if key not present
37906 */
37907 MapPrototype.get = function(key) {
37908 var keyValue = this.keyElem.valueToString(this.keyElem.verifyValue(key));
37909 if (!(keyValue in this.map))
37910 return undefined;
37911 return this.map[keyValue].value;
37912 };
37913
37914 /**
37915 * Determines whether the given key is present in the map.
37916 * @param {*} key The key
37917 * @returns {boolean} `true` if the key is present
37918 */
37919 MapPrototype.has = function(key) {
37920 var keyValue = this.keyElem.valueToString(this.keyElem.verifyValue(key));
37921 return (keyValue in this.map);
37922 };
37923
37924 return Map;
37925 })(ProtoBuf, ProtoBuf.Reflect);
37926
37927
37928 /**
37929 * Constructs a new empty Builder.
37930 * @param {Object.<string,*>=} options Builder options, defaults to global options set on ProtoBuf
37931 * @return {!ProtoBuf.Builder} Builder
37932 * @expose
37933 */
37934 ProtoBuf.newBuilder = function(options) {
37935 options = options || {};
37936 if (typeof options['convertFieldsToCamelCase'] === 'undefined')
37937 options['convertFieldsToCamelCase'] = ProtoBuf.convertFieldsToCamelCase;
37938 if (typeof options['populateAccessors'] === 'undefined')
37939 options['populateAccessors'] = ProtoBuf.populateAccessors;
37940 return new ProtoBuf.Builder(options);
37941 };
37942
37943 /**
37944 * Loads a .json definition and returns the Builder.
37945 * @param {!*|string} json JSON definition
37946 * @param {(ProtoBuf.Builder|string|{root: string, file: string})=} builder Builder to append to. Will create a new one if omitted.
37947 * @param {(string|{root: string, file: string})=} filename The corresponding file name if known. Must be specified for imports.
37948 * @return {ProtoBuf.Builder} Builder to create new messages
37949 * @throws {Error} If the definition cannot be parsed or built
37950 * @expose
37951 */
37952 ProtoBuf.loadJson = function(json, builder, filename) {
37953 if (typeof builder === 'string' || (builder && typeof builder["file"] === 'string' && typeof builder["root"] === 'string'))
37954 filename = builder,
37955 builder = null;
37956 if (!builder || typeof builder !== 'object')
37957 builder = ProtoBuf.newBuilder();
37958 if (typeof json === 'string')
37959 json = JSON.parse(json);
37960 builder["import"](json, filename);
37961 builder.resolveAll();
37962 return builder;
37963 };
37964
37965 /**
37966 * Loads a .json file and returns the Builder.
37967 * @param {string|!{root: string, file: string}} filename Path to json file or an object specifying 'file' with
37968 * an overridden 'root' path for all imported files.
37969 * @param {function(?Error, !ProtoBuf.Builder=)=} callback Callback that will receive `null` as the first and
37970 * the Builder as its second argument on success, otherwise the error as its first argument. If omitted, the
37971 * file will be read synchronously and this function will return the Builder.
37972 * @param {ProtoBuf.Builder=} builder Builder to append to. Will create a new one if omitted.
37973 * @return {?ProtoBuf.Builder|undefined} The Builder if synchronous (no callback specified, will be NULL if the
37974 * request has failed), else undefined
37975 * @expose
37976 */
37977 ProtoBuf.loadJsonFile = function(filename, callback, builder) {
37978 if (callback && typeof callback === 'object')
37979 builder = callback,
37980 callback = null;
37981 else if (!callback || typeof callback !== 'function')
37982 callback = null;
37983 if (callback)
37984 return ProtoBuf.Util.fetch(typeof filename === 'string' ? filename : filename["root"]+"/"+filename["file"], function(contents) {
37985 if (contents === null) {
37986 callback(Error("Failed to fetch file"));
37987 return;
37988 }
37989 try {
37990 callback(null, ProtoBuf.loadJson(JSON.parse(contents), builder, filename));
37991 } catch (e) {
37992 callback(e);
37993 }
37994 });
37995 var contents = ProtoBuf.Util.fetch(typeof filename === 'object' ? filename["root"]+"/"+filename["file"] : filename);
37996 return contents === null ? null : ProtoBuf.loadJson(JSON.parse(contents), builder, filename);
37997 };
37998
37999 return ProtoBuf;
38000});
38001
38002
38003/***/ }),
38004/* 653 */
38005/***/ (function(module, exports, __webpack_require__) {
38006
38007var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*
38008 Copyright 2013-2014 Daniel Wirtz <dcode@dcode.io>
38009
38010 Licensed under the Apache License, Version 2.0 (the "License");
38011 you may not use this file except in compliance with the License.
38012 You may obtain a copy of the License at
38013
38014 http://www.apache.org/licenses/LICENSE-2.0
38015
38016 Unless required by applicable law or agreed to in writing, software
38017 distributed under the License is distributed on an "AS IS" BASIS,
38018 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
38019 See the License for the specific language governing permissions and
38020 limitations under the License.
38021 */
38022
38023/**
38024 * @license bytebuffer.js (c) 2015 Daniel Wirtz <dcode@dcode.io>
38025 * Backing buffer: ArrayBuffer, Accessor: Uint8Array
38026 * Released under the Apache License, Version 2.0
38027 * see: https://github.com/dcodeIO/bytebuffer.js for details
38028 */
38029(function(global, factory) {
38030
38031 /* AMD */ if (true)
38032 !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(654)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
38033 __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
38034 (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
38035 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
38036 /* CommonJS */ else if (typeof require === 'function' && typeof module === "object" && module && module["exports"])
38037 module['exports'] = (function() {
38038 var Long; try { Long = require("long"); } catch (e) {}
38039 return factory(Long);
38040 })();
38041 /* Global */ else
38042 (global["dcodeIO"] = global["dcodeIO"] || {})["ByteBuffer"] = factory(global["dcodeIO"]["Long"]);
38043
38044})(this, function(Long) {
38045 "use strict";
38046
38047 /**
38048 * Constructs a new ByteBuffer.
38049 * @class The swiss army knife for binary data in JavaScript.
38050 * @exports ByteBuffer
38051 * @constructor
38052 * @param {number=} capacity Initial capacity. Defaults to {@link ByteBuffer.DEFAULT_CAPACITY}.
38053 * @param {boolean=} littleEndian Whether to use little or big endian byte order. Defaults to
38054 * {@link ByteBuffer.DEFAULT_ENDIAN}.
38055 * @param {boolean=} noAssert Whether to skip assertions of offsets and values. Defaults to
38056 * {@link ByteBuffer.DEFAULT_NOASSERT}.
38057 * @expose
38058 */
38059 var ByteBuffer = function(capacity, littleEndian, noAssert) {
38060 if (typeof capacity === 'undefined')
38061 capacity = ByteBuffer.DEFAULT_CAPACITY;
38062 if (typeof littleEndian === 'undefined')
38063 littleEndian = ByteBuffer.DEFAULT_ENDIAN;
38064 if (typeof noAssert === 'undefined')
38065 noAssert = ByteBuffer.DEFAULT_NOASSERT;
38066 if (!noAssert) {
38067 capacity = capacity | 0;
38068 if (capacity < 0)
38069 throw RangeError("Illegal capacity");
38070 littleEndian = !!littleEndian;
38071 noAssert = !!noAssert;
38072 }
38073
38074 /**
38075 * Backing ArrayBuffer.
38076 * @type {!ArrayBuffer}
38077 * @expose
38078 */
38079 this.buffer = capacity === 0 ? EMPTY_BUFFER : new ArrayBuffer(capacity);
38080
38081 /**
38082 * Uint8Array utilized to manipulate the backing buffer. Becomes `null` if the backing buffer has a capacity of `0`.
38083 * @type {?Uint8Array}
38084 * @expose
38085 */
38086 this.view = capacity === 0 ? null : new Uint8Array(this.buffer);
38087
38088 /**
38089 * Absolute read/write offset.
38090 * @type {number}
38091 * @expose
38092 * @see ByteBuffer#flip
38093 * @see ByteBuffer#clear
38094 */
38095 this.offset = 0;
38096
38097 /**
38098 * Marked offset.
38099 * @type {number}
38100 * @expose
38101 * @see ByteBuffer#mark
38102 * @see ByteBuffer#reset
38103 */
38104 this.markedOffset = -1;
38105
38106 /**
38107 * Absolute limit of the contained data. Set to the backing buffer's capacity upon allocation.
38108 * @type {number}
38109 * @expose
38110 * @see ByteBuffer#flip
38111 * @see ByteBuffer#clear
38112 */
38113 this.limit = capacity;
38114
38115 /**
38116 * Whether to use little endian byte order, defaults to `false` for big endian.
38117 * @type {boolean}
38118 * @expose
38119 */
38120 this.littleEndian = littleEndian;
38121
38122 /**
38123 * Whether to skip assertions of offsets and values, defaults to `false`.
38124 * @type {boolean}
38125 * @expose
38126 */
38127 this.noAssert = noAssert;
38128 };
38129
38130 /**
38131 * ByteBuffer version.
38132 * @type {string}
38133 * @const
38134 * @expose
38135 */
38136 ByteBuffer.VERSION = "5.0.1";
38137
38138 /**
38139 * Little endian constant that can be used instead of its boolean value. Evaluates to `true`.
38140 * @type {boolean}
38141 * @const
38142 * @expose
38143 */
38144 ByteBuffer.LITTLE_ENDIAN = true;
38145
38146 /**
38147 * Big endian constant that can be used instead of its boolean value. Evaluates to `false`.
38148 * @type {boolean}
38149 * @const
38150 * @expose
38151 */
38152 ByteBuffer.BIG_ENDIAN = false;
38153
38154 /**
38155 * Default initial capacity of `16`.
38156 * @type {number}
38157 * @expose
38158 */
38159 ByteBuffer.DEFAULT_CAPACITY = 16;
38160
38161 /**
38162 * Default endianess of `false` for big endian.
38163 * @type {boolean}
38164 * @expose
38165 */
38166 ByteBuffer.DEFAULT_ENDIAN = ByteBuffer.BIG_ENDIAN;
38167
38168 /**
38169 * Default no assertions flag of `false`.
38170 * @type {boolean}
38171 * @expose
38172 */
38173 ByteBuffer.DEFAULT_NOASSERT = false;
38174
38175 /**
38176 * A `Long` class for representing a 64-bit two's-complement integer value. May be `null` if Long.js has not been loaded
38177 * and int64 support is not available.
38178 * @type {?Long}
38179 * @const
38180 * @see https://github.com/dcodeIO/long.js
38181 * @expose
38182 */
38183 ByteBuffer.Long = Long || null;
38184
38185 /**
38186 * @alias ByteBuffer.prototype
38187 * @inner
38188 */
38189 var ByteBufferPrototype = ByteBuffer.prototype;
38190
38191 /**
38192 * An indicator used to reliably determine if an object is a ByteBuffer or not.
38193 * @type {boolean}
38194 * @const
38195 * @expose
38196 * @private
38197 */
38198 ByteBufferPrototype.__isByteBuffer__;
38199
38200 Object.defineProperty(ByteBufferPrototype, "__isByteBuffer__", {
38201 value: true,
38202 enumerable: false,
38203 configurable: false
38204 });
38205
38206 // helpers
38207
38208 /**
38209 * @type {!ArrayBuffer}
38210 * @inner
38211 */
38212 var EMPTY_BUFFER = new ArrayBuffer(0);
38213
38214 /**
38215 * String.fromCharCode reference for compile-time renaming.
38216 * @type {function(...number):string}
38217 * @inner
38218 */
38219 var stringFromCharCode = String.fromCharCode;
38220
38221 /**
38222 * Creates a source function for a string.
38223 * @param {string} s String to read from
38224 * @returns {function():number|null} Source function returning the next char code respectively `null` if there are
38225 * no more characters left.
38226 * @throws {TypeError} If the argument is invalid
38227 * @inner
38228 */
38229 function stringSource(s) {
38230 var i=0; return function() {
38231 return i < s.length ? s.charCodeAt(i++) : null;
38232 };
38233 }
38234
38235 /**
38236 * Creates a destination function for a string.
38237 * @returns {function(number=):undefined|string} Destination function successively called with the next char code.
38238 * Returns the final string when called without arguments.
38239 * @inner
38240 */
38241 function stringDestination() {
38242 var cs = [], ps = []; return function() {
38243 if (arguments.length === 0)
38244 return ps.join('')+stringFromCharCode.apply(String, cs);
38245 if (cs.length + arguments.length > 1024)
38246 ps.push(stringFromCharCode.apply(String, cs)),
38247 cs.length = 0;
38248 Array.prototype.push.apply(cs, arguments);
38249 };
38250 }
38251
38252 /**
38253 * Gets the accessor type.
38254 * @returns {Function} `Buffer` under node.js, `Uint8Array` respectively `DataView` in the browser (classes)
38255 * @expose
38256 */
38257 ByteBuffer.accessor = function() {
38258 return Uint8Array;
38259 };
38260 /**
38261 * Allocates a new ByteBuffer backed by a buffer of the specified capacity.
38262 * @param {number=} capacity Initial capacity. Defaults to {@link ByteBuffer.DEFAULT_CAPACITY}.
38263 * @param {boolean=} littleEndian Whether to use little or big endian byte order. Defaults to
38264 * {@link ByteBuffer.DEFAULT_ENDIAN}.
38265 * @param {boolean=} noAssert Whether to skip assertions of offsets and values. Defaults to
38266 * {@link ByteBuffer.DEFAULT_NOASSERT}.
38267 * @returns {!ByteBuffer}
38268 * @expose
38269 */
38270 ByteBuffer.allocate = function(capacity, littleEndian, noAssert) {
38271 return new ByteBuffer(capacity, littleEndian, noAssert);
38272 };
38273
38274 /**
38275 * Concatenates multiple ByteBuffers into one.
38276 * @param {!Array.<!ByteBuffer|!ArrayBuffer|!Uint8Array|string>} buffers Buffers to concatenate
38277 * @param {(string|boolean)=} encoding String encoding if `buffers` contains a string ("base64", "hex", "binary",
38278 * defaults to "utf8")
38279 * @param {boolean=} littleEndian Whether to use little or big endian byte order for the resulting ByteBuffer. Defaults
38280 * to {@link ByteBuffer.DEFAULT_ENDIAN}.
38281 * @param {boolean=} noAssert Whether to skip assertions of offsets and values for the resulting ByteBuffer. Defaults to
38282 * {@link ByteBuffer.DEFAULT_NOASSERT}.
38283 * @returns {!ByteBuffer} Concatenated ByteBuffer
38284 * @expose
38285 */
38286 ByteBuffer.concat = function(buffers, encoding, littleEndian, noAssert) {
38287 if (typeof encoding === 'boolean' || typeof encoding !== 'string') {
38288 noAssert = littleEndian;
38289 littleEndian = encoding;
38290 encoding = undefined;
38291 }
38292 var capacity = 0;
38293 for (var i=0, k=buffers.length, length; i<k; ++i) {
38294 if (!ByteBuffer.isByteBuffer(buffers[i]))
38295 buffers[i] = ByteBuffer.wrap(buffers[i], encoding);
38296 length = buffers[i].limit - buffers[i].offset;
38297 if (length > 0) capacity += length;
38298 }
38299 if (capacity === 0)
38300 return new ByteBuffer(0, littleEndian, noAssert);
38301 var bb = new ByteBuffer(capacity, littleEndian, noAssert),
38302 bi;
38303 i=0; while (i<k) {
38304 bi = buffers[i++];
38305 length = bi.limit - bi.offset;
38306 if (length <= 0) continue;
38307 bb.view.set(bi.view.subarray(bi.offset, bi.limit), bb.offset);
38308 bb.offset += length;
38309 }
38310 bb.limit = bb.offset;
38311 bb.offset = 0;
38312 return bb;
38313 };
38314
38315 /**
38316 * Tests if the specified type is a ByteBuffer.
38317 * @param {*} bb ByteBuffer to test
38318 * @returns {boolean} `true` if it is a ByteBuffer, otherwise `false`
38319 * @expose
38320 */
38321 ByteBuffer.isByteBuffer = function(bb) {
38322 return (bb && bb["__isByteBuffer__"]) === true;
38323 };
38324 /**
38325 * Gets the backing buffer type.
38326 * @returns {Function} `Buffer` under node.js, `ArrayBuffer` in the browser (classes)
38327 * @expose
38328 */
38329 ByteBuffer.type = function() {
38330 return ArrayBuffer;
38331 };
38332 /**
38333 * Wraps a buffer or a string. Sets the allocated ByteBuffer's {@link ByteBuffer#offset} to `0` and its
38334 * {@link ByteBuffer#limit} to the length of the wrapped data.
38335 * @param {!ByteBuffer|!ArrayBuffer|!Uint8Array|string|!Array.<number>} buffer Anything that can be wrapped
38336 * @param {(string|boolean)=} encoding String encoding if `buffer` is a string ("base64", "hex", "binary", defaults to
38337 * "utf8")
38338 * @param {boolean=} littleEndian Whether to use little or big endian byte order. Defaults to
38339 * {@link ByteBuffer.DEFAULT_ENDIAN}.
38340 * @param {boolean=} noAssert Whether to skip assertions of offsets and values. Defaults to
38341 * {@link ByteBuffer.DEFAULT_NOASSERT}.
38342 * @returns {!ByteBuffer} A ByteBuffer wrapping `buffer`
38343 * @expose
38344 */
38345 ByteBuffer.wrap = function(buffer, encoding, littleEndian, noAssert) {
38346 if (typeof encoding !== 'string') {
38347 noAssert = littleEndian;
38348 littleEndian = encoding;
38349 encoding = undefined;
38350 }
38351 if (typeof buffer === 'string') {
38352 if (typeof encoding === 'undefined')
38353 encoding = "utf8";
38354 switch (encoding) {
38355 case "base64":
38356 return ByteBuffer.fromBase64(buffer, littleEndian);
38357 case "hex":
38358 return ByteBuffer.fromHex(buffer, littleEndian);
38359 case "binary":
38360 return ByteBuffer.fromBinary(buffer, littleEndian);
38361 case "utf8":
38362 return ByteBuffer.fromUTF8(buffer, littleEndian);
38363 case "debug":
38364 return ByteBuffer.fromDebug(buffer, littleEndian);
38365 default:
38366 throw Error("Unsupported encoding: "+encoding);
38367 }
38368 }
38369 if (buffer === null || typeof buffer !== 'object')
38370 throw TypeError("Illegal buffer");
38371 var bb;
38372 if (ByteBuffer.isByteBuffer(buffer)) {
38373 bb = ByteBufferPrototype.clone.call(buffer);
38374 bb.markedOffset = -1;
38375 return bb;
38376 }
38377 if (buffer instanceof Uint8Array) { // Extract ArrayBuffer from Uint8Array
38378 bb = new ByteBuffer(0, littleEndian, noAssert);
38379 if (buffer.length > 0) { // Avoid references to more than one EMPTY_BUFFER
38380 bb.buffer = buffer.buffer;
38381 bb.offset = buffer.byteOffset;
38382 bb.limit = buffer.byteOffset + buffer.byteLength;
38383 bb.view = new Uint8Array(buffer.buffer);
38384 }
38385 } else if (buffer instanceof ArrayBuffer) { // Reuse ArrayBuffer
38386 bb = new ByteBuffer(0, littleEndian, noAssert);
38387 if (buffer.byteLength > 0) {
38388 bb.buffer = buffer;
38389 bb.offset = 0;
38390 bb.limit = buffer.byteLength;
38391 bb.view = buffer.byteLength > 0 ? new Uint8Array(buffer) : null;
38392 }
38393 } else if (Object.prototype.toString.call(buffer) === "[object Array]") { // Create from octets
38394 bb = new ByteBuffer(buffer.length, littleEndian, noAssert);
38395 bb.limit = buffer.length;
38396 for (var i=0; i<buffer.length; ++i)
38397 bb.view[i] = buffer[i];
38398 } else
38399 throw TypeError("Illegal buffer"); // Otherwise fail
38400 return bb;
38401 };
38402
38403 /**
38404 * Writes the array as a bitset.
38405 * @param {Array<boolean>} value Array of booleans to write
38406 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `length` if omitted.
38407 * @returns {!ByteBuffer}
38408 * @expose
38409 */
38410 ByteBufferPrototype.writeBitSet = function(value, offset) {
38411 var relative = typeof offset === 'undefined';
38412 if (relative) offset = this.offset;
38413 if (!this.noAssert) {
38414 if (!(value instanceof Array))
38415 throw TypeError("Illegal BitSet: Not an array");
38416 if (typeof offset !== 'number' || offset % 1 !== 0)
38417 throw TypeError("Illegal offset: "+offset+" (not an integer)");
38418 offset >>>= 0;
38419 if (offset < 0 || offset + 0 > this.buffer.byteLength)
38420 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
38421 }
38422
38423 var start = offset,
38424 bits = value.length,
38425 bytes = (bits >> 3),
38426 bit = 0,
38427 k;
38428
38429 offset += this.writeVarint32(bits,offset);
38430
38431 while(bytes--) {
38432 k = (!!value[bit++] & 1) |
38433 ((!!value[bit++] & 1) << 1) |
38434 ((!!value[bit++] & 1) << 2) |
38435 ((!!value[bit++] & 1) << 3) |
38436 ((!!value[bit++] & 1) << 4) |
38437 ((!!value[bit++] & 1) << 5) |
38438 ((!!value[bit++] & 1) << 6) |
38439 ((!!value[bit++] & 1) << 7);
38440 this.writeByte(k,offset++);
38441 }
38442
38443 if(bit < bits) {
38444 var m = 0; k = 0;
38445 while(bit < bits) k = k | ((!!value[bit++] & 1) << (m++));
38446 this.writeByte(k,offset++);
38447 }
38448
38449 if (relative) {
38450 this.offset = offset;
38451 return this;
38452 }
38453 return offset - start;
38454 }
38455
38456 /**
38457 * Reads a BitSet as an array of booleans.
38458 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `length` if omitted.
38459 * @returns {Array<boolean>
38460 * @expose
38461 */
38462 ByteBufferPrototype.readBitSet = function(offset) {
38463 var relative = typeof offset === 'undefined';
38464 if (relative) offset = this.offset;
38465
38466 var ret = this.readVarint32(offset),
38467 bits = ret.value,
38468 bytes = (bits >> 3),
38469 bit = 0,
38470 value = [],
38471 k;
38472
38473 offset += ret.length;
38474
38475 while(bytes--) {
38476 k = this.readByte(offset++);
38477 value[bit++] = !!(k & 0x01);
38478 value[bit++] = !!(k & 0x02);
38479 value[bit++] = !!(k & 0x04);
38480 value[bit++] = !!(k & 0x08);
38481 value[bit++] = !!(k & 0x10);
38482 value[bit++] = !!(k & 0x20);
38483 value[bit++] = !!(k & 0x40);
38484 value[bit++] = !!(k & 0x80);
38485 }
38486
38487 if(bit < bits) {
38488 var m = 0;
38489 k = this.readByte(offset++);
38490 while(bit < bits) value[bit++] = !!((k >> (m++)) & 1);
38491 }
38492
38493 if (relative) {
38494 this.offset = offset;
38495 }
38496 return value;
38497 }
38498 /**
38499 * Reads the specified number of bytes.
38500 * @param {number} length Number of bytes to read
38501 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `length` if omitted.
38502 * @returns {!ByteBuffer}
38503 * @expose
38504 */
38505 ByteBufferPrototype.readBytes = function(length, offset) {
38506 var relative = typeof offset === 'undefined';
38507 if (relative) offset = this.offset;
38508 if (!this.noAssert) {
38509 if (typeof offset !== 'number' || offset % 1 !== 0)
38510 throw TypeError("Illegal offset: "+offset+" (not an integer)");
38511 offset >>>= 0;
38512 if (offset < 0 || offset + length > this.buffer.byteLength)
38513 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+length+") <= "+this.buffer.byteLength);
38514 }
38515 var slice = this.slice(offset, offset + length);
38516 if (relative) this.offset += length;
38517 return slice;
38518 };
38519
38520 /**
38521 * Writes a payload of bytes. This is an alias of {@link ByteBuffer#append}.
38522 * @function
38523 * @param {!ByteBuffer|!ArrayBuffer|!Uint8Array|string} source Data to write. If `source` is a ByteBuffer, its offsets
38524 * will be modified according to the performed read operation.
38525 * @param {(string|number)=} encoding Encoding if `data` is a string ("base64", "hex", "binary", defaults to "utf8")
38526 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by the number of bytes
38527 * written if omitted.
38528 * @returns {!ByteBuffer} this
38529 * @expose
38530 */
38531 ByteBufferPrototype.writeBytes = ByteBufferPrototype.append;
38532
38533 // types/ints/int8
38534
38535 /**
38536 * Writes an 8bit signed integer.
38537 * @param {number} value Value to write
38538 * @param {number=} offset Offset to write to. Will use and advance {@link ByteBuffer#offset} by `1` if omitted.
38539 * @returns {!ByteBuffer} this
38540 * @expose
38541 */
38542 ByteBufferPrototype.writeInt8 = function(value, offset) {
38543 var relative = typeof offset === 'undefined';
38544 if (relative) offset = this.offset;
38545 if (!this.noAssert) {
38546 if (typeof value !== 'number' || value % 1 !== 0)
38547 throw TypeError("Illegal value: "+value+" (not an integer)");
38548 value |= 0;
38549 if (typeof offset !== 'number' || offset % 1 !== 0)
38550 throw TypeError("Illegal offset: "+offset+" (not an integer)");
38551 offset >>>= 0;
38552 if (offset < 0 || offset + 0 > this.buffer.byteLength)
38553 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
38554 }
38555 offset += 1;
38556 var capacity0 = this.buffer.byteLength;
38557 if (offset > capacity0)
38558 this.resize((capacity0 *= 2) > offset ? capacity0 : offset);
38559 offset -= 1;
38560 this.view[offset] = value;
38561 if (relative) this.offset += 1;
38562 return this;
38563 };
38564
38565 /**
38566 * Writes an 8bit signed integer. This is an alias of {@link ByteBuffer#writeInt8}.
38567 * @function
38568 * @param {number} value Value to write
38569 * @param {number=} offset Offset to write to. Will use and advance {@link ByteBuffer#offset} by `1` if omitted.
38570 * @returns {!ByteBuffer} this
38571 * @expose
38572 */
38573 ByteBufferPrototype.writeByte = ByteBufferPrototype.writeInt8;
38574
38575 /**
38576 * Reads an 8bit signed integer.
38577 * @param {number=} offset Offset to read from. Will use and advance {@link ByteBuffer#offset} by `1` if omitted.
38578 * @returns {number} Value read
38579 * @expose
38580 */
38581 ByteBufferPrototype.readInt8 = function(offset) {
38582 var relative = typeof offset === 'undefined';
38583 if (relative) offset = this.offset;
38584 if (!this.noAssert) {
38585 if (typeof offset !== 'number' || offset % 1 !== 0)
38586 throw TypeError("Illegal offset: "+offset+" (not an integer)");
38587 offset >>>= 0;
38588 if (offset < 0 || offset + 1 > this.buffer.byteLength)
38589 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+1+") <= "+this.buffer.byteLength);
38590 }
38591 var value = this.view[offset];
38592 if ((value & 0x80) === 0x80) value = -(0xFF - value + 1); // Cast to signed
38593 if (relative) this.offset += 1;
38594 return value;
38595 };
38596
38597 /**
38598 * Reads an 8bit signed integer. This is an alias of {@link ByteBuffer#readInt8}.
38599 * @function
38600 * @param {number=} offset Offset to read from. Will use and advance {@link ByteBuffer#offset} by `1` if omitted.
38601 * @returns {number} Value read
38602 * @expose
38603 */
38604 ByteBufferPrototype.readByte = ByteBufferPrototype.readInt8;
38605
38606 /**
38607 * Writes an 8bit unsigned integer.
38608 * @param {number} value Value to write
38609 * @param {number=} offset Offset to write to. Will use and advance {@link ByteBuffer#offset} by `1` if omitted.
38610 * @returns {!ByteBuffer} this
38611 * @expose
38612 */
38613 ByteBufferPrototype.writeUint8 = function(value, offset) {
38614 var relative = typeof offset === 'undefined';
38615 if (relative) offset = this.offset;
38616 if (!this.noAssert) {
38617 if (typeof value !== 'number' || value % 1 !== 0)
38618 throw TypeError("Illegal value: "+value+" (not an integer)");
38619 value >>>= 0;
38620 if (typeof offset !== 'number' || offset % 1 !== 0)
38621 throw TypeError("Illegal offset: "+offset+" (not an integer)");
38622 offset >>>= 0;
38623 if (offset < 0 || offset + 0 > this.buffer.byteLength)
38624 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
38625 }
38626 offset += 1;
38627 var capacity1 = this.buffer.byteLength;
38628 if (offset > capacity1)
38629 this.resize((capacity1 *= 2) > offset ? capacity1 : offset);
38630 offset -= 1;
38631 this.view[offset] = value;
38632 if (relative) this.offset += 1;
38633 return this;
38634 };
38635
38636 /**
38637 * Writes an 8bit unsigned integer. This is an alias of {@link ByteBuffer#writeUint8}.
38638 * @function
38639 * @param {number} value Value to write
38640 * @param {number=} offset Offset to write to. Will use and advance {@link ByteBuffer#offset} by `1` if omitted.
38641 * @returns {!ByteBuffer} this
38642 * @expose
38643 */
38644 ByteBufferPrototype.writeUInt8 = ByteBufferPrototype.writeUint8;
38645
38646 /**
38647 * Reads an 8bit unsigned integer.
38648 * @param {number=} offset Offset to read from. Will use and advance {@link ByteBuffer#offset} by `1` if omitted.
38649 * @returns {number} Value read
38650 * @expose
38651 */
38652 ByteBufferPrototype.readUint8 = function(offset) {
38653 var relative = typeof offset === 'undefined';
38654 if (relative) offset = this.offset;
38655 if (!this.noAssert) {
38656 if (typeof offset !== 'number' || offset % 1 !== 0)
38657 throw TypeError("Illegal offset: "+offset+" (not an integer)");
38658 offset >>>= 0;
38659 if (offset < 0 || offset + 1 > this.buffer.byteLength)
38660 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+1+") <= "+this.buffer.byteLength);
38661 }
38662 var value = this.view[offset];
38663 if (relative) this.offset += 1;
38664 return value;
38665 };
38666
38667 /**
38668 * Reads an 8bit unsigned integer. This is an alias of {@link ByteBuffer#readUint8}.
38669 * @function
38670 * @param {number=} offset Offset to read from. Will use and advance {@link ByteBuffer#offset} by `1` if omitted.
38671 * @returns {number} Value read
38672 * @expose
38673 */
38674 ByteBufferPrototype.readUInt8 = ByteBufferPrototype.readUint8;
38675
38676 // types/ints/int16
38677
38678 /**
38679 * Writes a 16bit signed integer.
38680 * @param {number} value Value to write
38681 * @param {number=} offset Offset to write to. Will use and advance {@link ByteBuffer#offset} by `2` if omitted.
38682 * @throws {TypeError} If `offset` or `value` is not a valid number
38683 * @throws {RangeError} If `offset` is out of bounds
38684 * @expose
38685 */
38686 ByteBufferPrototype.writeInt16 = function(value, offset) {
38687 var relative = typeof offset === 'undefined';
38688 if (relative) offset = this.offset;
38689 if (!this.noAssert) {
38690 if (typeof value !== 'number' || value % 1 !== 0)
38691 throw TypeError("Illegal value: "+value+" (not an integer)");
38692 value |= 0;
38693 if (typeof offset !== 'number' || offset % 1 !== 0)
38694 throw TypeError("Illegal offset: "+offset+" (not an integer)");
38695 offset >>>= 0;
38696 if (offset < 0 || offset + 0 > this.buffer.byteLength)
38697 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
38698 }
38699 offset += 2;
38700 var capacity2 = this.buffer.byteLength;
38701 if (offset > capacity2)
38702 this.resize((capacity2 *= 2) > offset ? capacity2 : offset);
38703 offset -= 2;
38704 if (this.littleEndian) {
38705 this.view[offset+1] = (value & 0xFF00) >>> 8;
38706 this.view[offset ] = value & 0x00FF;
38707 } else {
38708 this.view[offset] = (value & 0xFF00) >>> 8;
38709 this.view[offset+1] = value & 0x00FF;
38710 }
38711 if (relative) this.offset += 2;
38712 return this;
38713 };
38714
38715 /**
38716 * Writes a 16bit signed integer. This is an alias of {@link ByteBuffer#writeInt16}.
38717 * @function
38718 * @param {number} value Value to write
38719 * @param {number=} offset Offset to write to. Will use and advance {@link ByteBuffer#offset} by `2` if omitted.
38720 * @throws {TypeError} If `offset` or `value` is not a valid number
38721 * @throws {RangeError} If `offset` is out of bounds
38722 * @expose
38723 */
38724 ByteBufferPrototype.writeShort = ByteBufferPrototype.writeInt16;
38725
38726 /**
38727 * Reads a 16bit signed integer.
38728 * @param {number=} offset Offset to read from. Will use and advance {@link ByteBuffer#offset} by `2` if omitted.
38729 * @returns {number} Value read
38730 * @throws {TypeError} If `offset` is not a valid number
38731 * @throws {RangeError} If `offset` is out of bounds
38732 * @expose
38733 */
38734 ByteBufferPrototype.readInt16 = function(offset) {
38735 var relative = typeof offset === 'undefined';
38736 if (relative) offset = this.offset;
38737 if (!this.noAssert) {
38738 if (typeof offset !== 'number' || offset % 1 !== 0)
38739 throw TypeError("Illegal offset: "+offset+" (not an integer)");
38740 offset >>>= 0;
38741 if (offset < 0 || offset + 2 > this.buffer.byteLength)
38742 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+2+") <= "+this.buffer.byteLength);
38743 }
38744 var value = 0;
38745 if (this.littleEndian) {
38746 value = this.view[offset ];
38747 value |= this.view[offset+1] << 8;
38748 } else {
38749 value = this.view[offset ] << 8;
38750 value |= this.view[offset+1];
38751 }
38752 if ((value & 0x8000) === 0x8000) value = -(0xFFFF - value + 1); // Cast to signed
38753 if (relative) this.offset += 2;
38754 return value;
38755 };
38756
38757 /**
38758 * Reads a 16bit signed integer. This is an alias of {@link ByteBuffer#readInt16}.
38759 * @function
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.readShort = ByteBufferPrototype.readInt16;
38767
38768 /**
38769 * Writes a 16bit unsigned integer.
38770 * @param {number} value Value to write
38771 * @param {number=} offset Offset to write to. Will use and advance {@link ByteBuffer#offset} by `2` if omitted.
38772 * @throws {TypeError} If `offset` or `value` is not a valid number
38773 * @throws {RangeError} If `offset` is out of bounds
38774 * @expose
38775 */
38776 ByteBufferPrototype.writeUint16 = function(value, offset) {
38777 var relative = typeof offset === 'undefined';
38778 if (relative) offset = this.offset;
38779 if (!this.noAssert) {
38780 if (typeof value !== 'number' || value % 1 !== 0)
38781 throw TypeError("Illegal value: "+value+" (not an integer)");
38782 value >>>= 0;
38783 if (typeof offset !== 'number' || offset % 1 !== 0)
38784 throw TypeError("Illegal offset: "+offset+" (not an integer)");
38785 offset >>>= 0;
38786 if (offset < 0 || offset + 0 > this.buffer.byteLength)
38787 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
38788 }
38789 offset += 2;
38790 var capacity3 = this.buffer.byteLength;
38791 if (offset > capacity3)
38792 this.resize((capacity3 *= 2) > offset ? capacity3 : offset);
38793 offset -= 2;
38794 if (this.littleEndian) {
38795 this.view[offset+1] = (value & 0xFF00) >>> 8;
38796 this.view[offset ] = value & 0x00FF;
38797 } else {
38798 this.view[offset] = (value & 0xFF00) >>> 8;
38799 this.view[offset+1] = value & 0x00FF;
38800 }
38801 if (relative) this.offset += 2;
38802 return this;
38803 };
38804
38805 /**
38806 * Writes a 16bit unsigned integer. This is an alias of {@link ByteBuffer#writeUint16}.
38807 * @function
38808 * @param {number} value Value to write
38809 * @param {number=} offset Offset to write to. Will use and advance {@link ByteBuffer#offset} by `2` if omitted.
38810 * @throws {TypeError} If `offset` or `value` is not a valid number
38811 * @throws {RangeError} If `offset` is out of bounds
38812 * @expose
38813 */
38814 ByteBufferPrototype.writeUInt16 = ByteBufferPrototype.writeUint16;
38815
38816 /**
38817 * Reads a 16bit unsigned integer.
38818 * @param {number=} offset Offset to read from. Will use and advance {@link ByteBuffer#offset} by `2` if omitted.
38819 * @returns {number} Value read
38820 * @throws {TypeError} If `offset` is not a valid number
38821 * @throws {RangeError} If `offset` is out of bounds
38822 * @expose
38823 */
38824 ByteBufferPrototype.readUint16 = function(offset) {
38825 var relative = typeof offset === 'undefined';
38826 if (relative) offset = this.offset;
38827 if (!this.noAssert) {
38828 if (typeof offset !== 'number' || offset % 1 !== 0)
38829 throw TypeError("Illegal offset: "+offset+" (not an integer)");
38830 offset >>>= 0;
38831 if (offset < 0 || offset + 2 > this.buffer.byteLength)
38832 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+2+") <= "+this.buffer.byteLength);
38833 }
38834 var value = 0;
38835 if (this.littleEndian) {
38836 value = this.view[offset ];
38837 value |= this.view[offset+1] << 8;
38838 } else {
38839 value = this.view[offset ] << 8;
38840 value |= this.view[offset+1];
38841 }
38842 if (relative) this.offset += 2;
38843 return value;
38844 };
38845
38846 /**
38847 * Reads a 16bit unsigned integer. This is an alias of {@link ByteBuffer#readUint16}.
38848 * @function
38849 * @param {number=} offset Offset to read from. Will use and advance {@link ByteBuffer#offset} by `2` if omitted.
38850 * @returns {number} Value read
38851 * @throws {TypeError} If `offset` is not a valid number
38852 * @throws {RangeError} If `offset` is out of bounds
38853 * @expose
38854 */
38855 ByteBufferPrototype.readUInt16 = ByteBufferPrototype.readUint16;
38856
38857 // types/ints/int32
38858
38859 /**
38860 * Writes a 32bit signed integer.
38861 * @param {number} value Value to write
38862 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `4` if omitted.
38863 * @expose
38864 */
38865 ByteBufferPrototype.writeInt32 = function(value, offset) {
38866 var relative = typeof offset === 'undefined';
38867 if (relative) offset = this.offset;
38868 if (!this.noAssert) {
38869 if (typeof value !== 'number' || value % 1 !== 0)
38870 throw TypeError("Illegal value: "+value+" (not an integer)");
38871 value |= 0;
38872 if (typeof offset !== 'number' || offset % 1 !== 0)
38873 throw TypeError("Illegal offset: "+offset+" (not an integer)");
38874 offset >>>= 0;
38875 if (offset < 0 || offset + 0 > this.buffer.byteLength)
38876 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
38877 }
38878 offset += 4;
38879 var capacity4 = this.buffer.byteLength;
38880 if (offset > capacity4)
38881 this.resize((capacity4 *= 2) > offset ? capacity4 : offset);
38882 offset -= 4;
38883 if (this.littleEndian) {
38884 this.view[offset+3] = (value >>> 24) & 0xFF;
38885 this.view[offset+2] = (value >>> 16) & 0xFF;
38886 this.view[offset+1] = (value >>> 8) & 0xFF;
38887 this.view[offset ] = value & 0xFF;
38888 } else {
38889 this.view[offset ] = (value >>> 24) & 0xFF;
38890 this.view[offset+1] = (value >>> 16) & 0xFF;
38891 this.view[offset+2] = (value >>> 8) & 0xFF;
38892 this.view[offset+3] = value & 0xFF;
38893 }
38894 if (relative) this.offset += 4;
38895 return this;
38896 };
38897
38898 /**
38899 * Writes a 32bit signed integer. This is an alias of {@link ByteBuffer#writeInt32}.
38900 * @param {number} value Value to write
38901 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `4` if omitted.
38902 * @expose
38903 */
38904 ByteBufferPrototype.writeInt = ByteBufferPrototype.writeInt32;
38905
38906 /**
38907 * Reads a 32bit signed integer.
38908 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `4` if omitted.
38909 * @returns {number} Value read
38910 * @expose
38911 */
38912 ByteBufferPrototype.readInt32 = function(offset) {
38913 var relative = typeof offset === 'undefined';
38914 if (relative) offset = this.offset;
38915 if (!this.noAssert) {
38916 if (typeof offset !== 'number' || offset % 1 !== 0)
38917 throw TypeError("Illegal offset: "+offset+" (not an integer)");
38918 offset >>>= 0;
38919 if (offset < 0 || offset + 4 > this.buffer.byteLength)
38920 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+4+") <= "+this.buffer.byteLength);
38921 }
38922 var value = 0;
38923 if (this.littleEndian) {
38924 value = this.view[offset+2] << 16;
38925 value |= this.view[offset+1] << 8;
38926 value |= this.view[offset ];
38927 value += this.view[offset+3] << 24 >>> 0;
38928 } else {
38929 value = this.view[offset+1] << 16;
38930 value |= this.view[offset+2] << 8;
38931 value |= this.view[offset+3];
38932 value += this.view[offset ] << 24 >>> 0;
38933 }
38934 value |= 0; // Cast to signed
38935 if (relative) this.offset += 4;
38936 return value;
38937 };
38938
38939 /**
38940 * Reads a 32bit signed integer. This is an alias of {@link ByteBuffer#readInt32}.
38941 * @param {number=} offset Offset to read from. Will use and advance {@link ByteBuffer#offset} by `4` if omitted.
38942 * @returns {number} Value read
38943 * @expose
38944 */
38945 ByteBufferPrototype.readInt = ByteBufferPrototype.readInt32;
38946
38947 /**
38948 * Writes a 32bit unsigned integer.
38949 * @param {number} value Value to write
38950 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `4` if omitted.
38951 * @expose
38952 */
38953 ByteBufferPrototype.writeUint32 = function(value, offset) {
38954 var relative = typeof offset === 'undefined';
38955 if (relative) offset = this.offset;
38956 if (!this.noAssert) {
38957 if (typeof value !== 'number' || value % 1 !== 0)
38958 throw TypeError("Illegal value: "+value+" (not an integer)");
38959 value >>>= 0;
38960 if (typeof offset !== 'number' || offset % 1 !== 0)
38961 throw TypeError("Illegal offset: "+offset+" (not an integer)");
38962 offset >>>= 0;
38963 if (offset < 0 || offset + 0 > this.buffer.byteLength)
38964 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
38965 }
38966 offset += 4;
38967 var capacity5 = this.buffer.byteLength;
38968 if (offset > capacity5)
38969 this.resize((capacity5 *= 2) > offset ? capacity5 : offset);
38970 offset -= 4;
38971 if (this.littleEndian) {
38972 this.view[offset+3] = (value >>> 24) & 0xFF;
38973 this.view[offset+2] = (value >>> 16) & 0xFF;
38974 this.view[offset+1] = (value >>> 8) & 0xFF;
38975 this.view[offset ] = value & 0xFF;
38976 } else {
38977 this.view[offset ] = (value >>> 24) & 0xFF;
38978 this.view[offset+1] = (value >>> 16) & 0xFF;
38979 this.view[offset+2] = (value >>> 8) & 0xFF;
38980 this.view[offset+3] = value & 0xFF;
38981 }
38982 if (relative) this.offset += 4;
38983 return this;
38984 };
38985
38986 /**
38987 * Writes a 32bit unsigned integer. This is an alias of {@link ByteBuffer#writeUint32}.
38988 * @function
38989 * @param {number} value Value to write
38990 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `4` if omitted.
38991 * @expose
38992 */
38993 ByteBufferPrototype.writeUInt32 = ByteBufferPrototype.writeUint32;
38994
38995 /**
38996 * Reads a 32bit unsigned integer.
38997 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `4` if omitted.
38998 * @returns {number} Value read
38999 * @expose
39000 */
39001 ByteBufferPrototype.readUint32 = function(offset) {
39002 var relative = typeof offset === 'undefined';
39003 if (relative) offset = this.offset;
39004 if (!this.noAssert) {
39005 if (typeof offset !== 'number' || offset % 1 !== 0)
39006 throw TypeError("Illegal offset: "+offset+" (not an integer)");
39007 offset >>>= 0;
39008 if (offset < 0 || offset + 4 > this.buffer.byteLength)
39009 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+4+") <= "+this.buffer.byteLength);
39010 }
39011 var value = 0;
39012 if (this.littleEndian) {
39013 value = this.view[offset+2] << 16;
39014 value |= this.view[offset+1] << 8;
39015 value |= this.view[offset ];
39016 value += this.view[offset+3] << 24 >>> 0;
39017 } else {
39018 value = this.view[offset+1] << 16;
39019 value |= this.view[offset+2] << 8;
39020 value |= this.view[offset+3];
39021 value += this.view[offset ] << 24 >>> 0;
39022 }
39023 if (relative) this.offset += 4;
39024 return value;
39025 };
39026
39027 /**
39028 * Reads a 32bit unsigned integer. This is an alias of {@link ByteBuffer#readUint32}.
39029 * @function
39030 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `4` if omitted.
39031 * @returns {number} Value read
39032 * @expose
39033 */
39034 ByteBufferPrototype.readUInt32 = ByteBufferPrototype.readUint32;
39035
39036 // types/ints/int64
39037
39038 if (Long) {
39039
39040 /**
39041 * Writes a 64bit signed integer.
39042 * @param {number|!Long} value Value to write
39043 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
39044 * @returns {!ByteBuffer} this
39045 * @expose
39046 */
39047 ByteBufferPrototype.writeInt64 = function(value, offset) {
39048 var relative = typeof offset === 'undefined';
39049 if (relative) offset = this.offset;
39050 if (!this.noAssert) {
39051 if (typeof value === 'number')
39052 value = Long.fromNumber(value);
39053 else if (typeof value === 'string')
39054 value = Long.fromString(value);
39055 else if (!(value && value instanceof Long))
39056 throw TypeError("Illegal value: "+value+" (not an integer or Long)");
39057 if (typeof offset !== 'number' || offset % 1 !== 0)
39058 throw TypeError("Illegal offset: "+offset+" (not an integer)");
39059 offset >>>= 0;
39060 if (offset < 0 || offset + 0 > this.buffer.byteLength)
39061 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
39062 }
39063 if (typeof value === 'number')
39064 value = Long.fromNumber(value);
39065 else if (typeof value === 'string')
39066 value = Long.fromString(value);
39067 offset += 8;
39068 var capacity6 = this.buffer.byteLength;
39069 if (offset > capacity6)
39070 this.resize((capacity6 *= 2) > offset ? capacity6 : offset);
39071 offset -= 8;
39072 var lo = value.low,
39073 hi = value.high;
39074 if (this.littleEndian) {
39075 this.view[offset+3] = (lo >>> 24) & 0xFF;
39076 this.view[offset+2] = (lo >>> 16) & 0xFF;
39077 this.view[offset+1] = (lo >>> 8) & 0xFF;
39078 this.view[offset ] = lo & 0xFF;
39079 offset += 4;
39080 this.view[offset+3] = (hi >>> 24) & 0xFF;
39081 this.view[offset+2] = (hi >>> 16) & 0xFF;
39082 this.view[offset+1] = (hi >>> 8) & 0xFF;
39083 this.view[offset ] = hi & 0xFF;
39084 } else {
39085 this.view[offset ] = (hi >>> 24) & 0xFF;
39086 this.view[offset+1] = (hi >>> 16) & 0xFF;
39087 this.view[offset+2] = (hi >>> 8) & 0xFF;
39088 this.view[offset+3] = hi & 0xFF;
39089 offset += 4;
39090 this.view[offset ] = (lo >>> 24) & 0xFF;
39091 this.view[offset+1] = (lo >>> 16) & 0xFF;
39092 this.view[offset+2] = (lo >>> 8) & 0xFF;
39093 this.view[offset+3] = lo & 0xFF;
39094 }
39095 if (relative) this.offset += 8;
39096 return this;
39097 };
39098
39099 /**
39100 * Writes a 64bit signed integer. This is an alias of {@link ByteBuffer#writeInt64}.
39101 * @param {number|!Long} value Value to write
39102 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
39103 * @returns {!ByteBuffer} this
39104 * @expose
39105 */
39106 ByteBufferPrototype.writeLong = ByteBufferPrototype.writeInt64;
39107
39108 /**
39109 * Reads a 64bit signed integer.
39110 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
39111 * @returns {!Long}
39112 * @expose
39113 */
39114 ByteBufferPrototype.readInt64 = function(offset) {
39115 var relative = typeof offset === 'undefined';
39116 if (relative) offset = this.offset;
39117 if (!this.noAssert) {
39118 if (typeof offset !== 'number' || offset % 1 !== 0)
39119 throw TypeError("Illegal offset: "+offset+" (not an integer)");
39120 offset >>>= 0;
39121 if (offset < 0 || offset + 8 > this.buffer.byteLength)
39122 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+8+") <= "+this.buffer.byteLength);
39123 }
39124 var lo = 0,
39125 hi = 0;
39126 if (this.littleEndian) {
39127 lo = this.view[offset+2] << 16;
39128 lo |= this.view[offset+1] << 8;
39129 lo |= this.view[offset ];
39130 lo += this.view[offset+3] << 24 >>> 0;
39131 offset += 4;
39132 hi = this.view[offset+2] << 16;
39133 hi |= this.view[offset+1] << 8;
39134 hi |= this.view[offset ];
39135 hi += this.view[offset+3] << 24 >>> 0;
39136 } else {
39137 hi = this.view[offset+1] << 16;
39138 hi |= this.view[offset+2] << 8;
39139 hi |= this.view[offset+3];
39140 hi += this.view[offset ] << 24 >>> 0;
39141 offset += 4;
39142 lo = this.view[offset+1] << 16;
39143 lo |= this.view[offset+2] << 8;
39144 lo |= this.view[offset+3];
39145 lo += this.view[offset ] << 24 >>> 0;
39146 }
39147 var value = new Long(lo, hi, false);
39148 if (relative) this.offset += 8;
39149 return value;
39150 };
39151
39152 /**
39153 * Reads a 64bit signed integer. This is an alias of {@link ByteBuffer#readInt64}.
39154 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
39155 * @returns {!Long}
39156 * @expose
39157 */
39158 ByteBufferPrototype.readLong = ByteBufferPrototype.readInt64;
39159
39160 /**
39161 * Writes a 64bit unsigned integer.
39162 * @param {number|!Long} value Value to write
39163 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
39164 * @returns {!ByteBuffer} this
39165 * @expose
39166 */
39167 ByteBufferPrototype.writeUint64 = function(value, offset) {
39168 var relative = typeof offset === 'undefined';
39169 if (relative) offset = this.offset;
39170 if (!this.noAssert) {
39171 if (typeof value === 'number')
39172 value = Long.fromNumber(value);
39173 else if (typeof value === 'string')
39174 value = Long.fromString(value);
39175 else if (!(value && value instanceof Long))
39176 throw TypeError("Illegal value: "+value+" (not an integer or Long)");
39177 if (typeof offset !== 'number' || offset % 1 !== 0)
39178 throw TypeError("Illegal offset: "+offset+" (not an integer)");
39179 offset >>>= 0;
39180 if (offset < 0 || offset + 0 > this.buffer.byteLength)
39181 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
39182 }
39183 if (typeof value === 'number')
39184 value = Long.fromNumber(value);
39185 else if (typeof value === 'string')
39186 value = Long.fromString(value);
39187 offset += 8;
39188 var capacity7 = this.buffer.byteLength;
39189 if (offset > capacity7)
39190 this.resize((capacity7 *= 2) > offset ? capacity7 : offset);
39191 offset -= 8;
39192 var lo = value.low,
39193 hi = value.high;
39194 if (this.littleEndian) {
39195 this.view[offset+3] = (lo >>> 24) & 0xFF;
39196 this.view[offset+2] = (lo >>> 16) & 0xFF;
39197 this.view[offset+1] = (lo >>> 8) & 0xFF;
39198 this.view[offset ] = lo & 0xFF;
39199 offset += 4;
39200 this.view[offset+3] = (hi >>> 24) & 0xFF;
39201 this.view[offset+2] = (hi >>> 16) & 0xFF;
39202 this.view[offset+1] = (hi >>> 8) & 0xFF;
39203 this.view[offset ] = hi & 0xFF;
39204 } else {
39205 this.view[offset ] = (hi >>> 24) & 0xFF;
39206 this.view[offset+1] = (hi >>> 16) & 0xFF;
39207 this.view[offset+2] = (hi >>> 8) & 0xFF;
39208 this.view[offset+3] = hi & 0xFF;
39209 offset += 4;
39210 this.view[offset ] = (lo >>> 24) & 0xFF;
39211 this.view[offset+1] = (lo >>> 16) & 0xFF;
39212 this.view[offset+2] = (lo >>> 8) & 0xFF;
39213 this.view[offset+3] = lo & 0xFF;
39214 }
39215 if (relative) this.offset += 8;
39216 return this;
39217 };
39218
39219 /**
39220 * Writes a 64bit unsigned integer. This is an alias of {@link ByteBuffer#writeUint64}.
39221 * @function
39222 * @param {number|!Long} value Value to write
39223 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
39224 * @returns {!ByteBuffer} this
39225 * @expose
39226 */
39227 ByteBufferPrototype.writeUInt64 = ByteBufferPrototype.writeUint64;
39228
39229 /**
39230 * Reads a 64bit unsigned integer.
39231 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
39232 * @returns {!Long}
39233 * @expose
39234 */
39235 ByteBufferPrototype.readUint64 = function(offset) {
39236 var relative = typeof offset === 'undefined';
39237 if (relative) offset = this.offset;
39238 if (!this.noAssert) {
39239 if (typeof offset !== 'number' || offset % 1 !== 0)
39240 throw TypeError("Illegal offset: "+offset+" (not an integer)");
39241 offset >>>= 0;
39242 if (offset < 0 || offset + 8 > this.buffer.byteLength)
39243 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+8+") <= "+this.buffer.byteLength);
39244 }
39245 var lo = 0,
39246 hi = 0;
39247 if (this.littleEndian) {
39248 lo = this.view[offset+2] << 16;
39249 lo |= this.view[offset+1] << 8;
39250 lo |= this.view[offset ];
39251 lo += this.view[offset+3] << 24 >>> 0;
39252 offset += 4;
39253 hi = this.view[offset+2] << 16;
39254 hi |= this.view[offset+1] << 8;
39255 hi |= this.view[offset ];
39256 hi += this.view[offset+3] << 24 >>> 0;
39257 } else {
39258 hi = this.view[offset+1] << 16;
39259 hi |= this.view[offset+2] << 8;
39260 hi |= this.view[offset+3];
39261 hi += this.view[offset ] << 24 >>> 0;
39262 offset += 4;
39263 lo = this.view[offset+1] << 16;
39264 lo |= this.view[offset+2] << 8;
39265 lo |= this.view[offset+3];
39266 lo += this.view[offset ] << 24 >>> 0;
39267 }
39268 var value = new Long(lo, hi, true);
39269 if (relative) this.offset += 8;
39270 return value;
39271 };
39272
39273 /**
39274 * Reads a 64bit unsigned integer. This is an alias of {@link ByteBuffer#readUint64}.
39275 * @function
39276 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
39277 * @returns {!Long}
39278 * @expose
39279 */
39280 ByteBufferPrototype.readUInt64 = ByteBufferPrototype.readUint64;
39281
39282 } // Long
39283
39284
39285 // types/floats/float32
39286
39287 /*
39288 ieee754 - https://github.com/feross/ieee754
39289
39290 The MIT License (MIT)
39291
39292 Copyright (c) Feross Aboukhadijeh
39293
39294 Permission is hereby granted, free of charge, to any person obtaining a copy
39295 of this software and associated documentation files (the "Software"), to deal
39296 in the Software without restriction, including without limitation the rights
39297 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
39298 copies of the Software, and to permit persons to whom the Software is
39299 furnished to do so, subject to the following conditions:
39300
39301 The above copyright notice and this permission notice shall be included in
39302 all copies or substantial portions of the Software.
39303
39304 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
39305 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
39306 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
39307 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
39308 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
39309 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
39310 THE SOFTWARE.
39311 */
39312
39313 /**
39314 * Reads an IEEE754 float from a byte array.
39315 * @param {!Array} buffer
39316 * @param {number} offset
39317 * @param {boolean} isLE
39318 * @param {number} mLen
39319 * @param {number} nBytes
39320 * @returns {number}
39321 * @inner
39322 */
39323 function ieee754_read(buffer, offset, isLE, mLen, nBytes) {
39324 var e, m,
39325 eLen = nBytes * 8 - mLen - 1,
39326 eMax = (1 << eLen) - 1,
39327 eBias = eMax >> 1,
39328 nBits = -7,
39329 i = isLE ? (nBytes - 1) : 0,
39330 d = isLE ? -1 : 1,
39331 s = buffer[offset + i];
39332
39333 i += d;
39334
39335 e = s & ((1 << (-nBits)) - 1);
39336 s >>= (-nBits);
39337 nBits += eLen;
39338 for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8) {}
39339
39340 m = e & ((1 << (-nBits)) - 1);
39341 e >>= (-nBits);
39342 nBits += mLen;
39343 for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8) {}
39344
39345 if (e === 0) {
39346 e = 1 - eBias;
39347 } else if (e === eMax) {
39348 return m ? NaN : ((s ? -1 : 1) * Infinity);
39349 } else {
39350 m = m + Math.pow(2, mLen);
39351 e = e - eBias;
39352 }
39353 return (s ? -1 : 1) * m * Math.pow(2, e - mLen);
39354 }
39355
39356 /**
39357 * Writes an IEEE754 float to a byte array.
39358 * @param {!Array} buffer
39359 * @param {number} value
39360 * @param {number} offset
39361 * @param {boolean} isLE
39362 * @param {number} mLen
39363 * @param {number} nBytes
39364 * @inner
39365 */
39366 function ieee754_write(buffer, value, offset, isLE, mLen, nBytes) {
39367 var e, m, c,
39368 eLen = nBytes * 8 - mLen - 1,
39369 eMax = (1 << eLen) - 1,
39370 eBias = eMax >> 1,
39371 rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0),
39372 i = isLE ? 0 : (nBytes - 1),
39373 d = isLE ? 1 : -1,
39374 s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0;
39375
39376 value = Math.abs(value);
39377
39378 if (isNaN(value) || value === Infinity) {
39379 m = isNaN(value) ? 1 : 0;
39380 e = eMax;
39381 } else {
39382 e = Math.floor(Math.log(value) / Math.LN2);
39383 if (value * (c = Math.pow(2, -e)) < 1) {
39384 e--;
39385 c *= 2;
39386 }
39387 if (e + eBias >= 1) {
39388 value += rt / c;
39389 } else {
39390 value += rt * Math.pow(2, 1 - eBias);
39391 }
39392 if (value * c >= 2) {
39393 e++;
39394 c /= 2;
39395 }
39396
39397 if (e + eBias >= eMax) {
39398 m = 0;
39399 e = eMax;
39400 } else if (e + eBias >= 1) {
39401 m = (value * c - 1) * Math.pow(2, mLen);
39402 e = e + eBias;
39403 } else {
39404 m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen);
39405 e = 0;
39406 }
39407 }
39408
39409 for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
39410
39411 e = (e << mLen) | m;
39412 eLen += mLen;
39413 for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
39414
39415 buffer[offset + i - d] |= s * 128;
39416 }
39417
39418 /**
39419 * Writes a 32bit float.
39420 * @param {number} value Value to write
39421 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `4` if omitted.
39422 * @returns {!ByteBuffer} this
39423 * @expose
39424 */
39425 ByteBufferPrototype.writeFloat32 = function(value, offset) {
39426 var relative = typeof offset === 'undefined';
39427 if (relative) offset = this.offset;
39428 if (!this.noAssert) {
39429 if (typeof value !== 'number')
39430 throw TypeError("Illegal value: "+value+" (not a number)");
39431 if (typeof offset !== 'number' || offset % 1 !== 0)
39432 throw TypeError("Illegal offset: "+offset+" (not an integer)");
39433 offset >>>= 0;
39434 if (offset < 0 || offset + 0 > this.buffer.byteLength)
39435 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
39436 }
39437 offset += 4;
39438 var capacity8 = this.buffer.byteLength;
39439 if (offset > capacity8)
39440 this.resize((capacity8 *= 2) > offset ? capacity8 : offset);
39441 offset -= 4;
39442 ieee754_write(this.view, value, offset, this.littleEndian, 23, 4);
39443 if (relative) this.offset += 4;
39444 return this;
39445 };
39446
39447 /**
39448 * Writes a 32bit float. This is an alias of {@link ByteBuffer#writeFloat32}.
39449 * @function
39450 * @param {number} value Value to write
39451 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `4` if omitted.
39452 * @returns {!ByteBuffer} this
39453 * @expose
39454 */
39455 ByteBufferPrototype.writeFloat = ByteBufferPrototype.writeFloat32;
39456
39457 /**
39458 * Reads a 32bit float.
39459 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `4` if omitted.
39460 * @returns {number}
39461 * @expose
39462 */
39463 ByteBufferPrototype.readFloat32 = function(offset) {
39464 var relative = typeof offset === 'undefined';
39465 if (relative) offset = this.offset;
39466 if (!this.noAssert) {
39467 if (typeof offset !== 'number' || offset % 1 !== 0)
39468 throw TypeError("Illegal offset: "+offset+" (not an integer)");
39469 offset >>>= 0;
39470 if (offset < 0 || offset + 4 > this.buffer.byteLength)
39471 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+4+") <= "+this.buffer.byteLength);
39472 }
39473 var value = ieee754_read(this.view, offset, this.littleEndian, 23, 4);
39474 if (relative) this.offset += 4;
39475 return value;
39476 };
39477
39478 /**
39479 * Reads a 32bit float. This is an alias of {@link ByteBuffer#readFloat32}.
39480 * @function
39481 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `4` if omitted.
39482 * @returns {number}
39483 * @expose
39484 */
39485 ByteBufferPrototype.readFloat = ByteBufferPrototype.readFloat32;
39486
39487 // types/floats/float64
39488
39489 /**
39490 * Writes a 64bit float.
39491 * @param {number} value Value to write
39492 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
39493 * @returns {!ByteBuffer} this
39494 * @expose
39495 */
39496 ByteBufferPrototype.writeFloat64 = function(value, offset) {
39497 var relative = typeof offset === 'undefined';
39498 if (relative) offset = this.offset;
39499 if (!this.noAssert) {
39500 if (typeof value !== 'number')
39501 throw TypeError("Illegal value: "+value+" (not a number)");
39502 if (typeof offset !== 'number' || offset % 1 !== 0)
39503 throw TypeError("Illegal offset: "+offset+" (not an integer)");
39504 offset >>>= 0;
39505 if (offset < 0 || offset + 0 > this.buffer.byteLength)
39506 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
39507 }
39508 offset += 8;
39509 var capacity9 = this.buffer.byteLength;
39510 if (offset > capacity9)
39511 this.resize((capacity9 *= 2) > offset ? capacity9 : offset);
39512 offset -= 8;
39513 ieee754_write(this.view, value, offset, this.littleEndian, 52, 8);
39514 if (relative) this.offset += 8;
39515 return this;
39516 };
39517
39518 /**
39519 * Writes a 64bit float. This is an alias of {@link ByteBuffer#writeFloat64}.
39520 * @function
39521 * @param {number} value Value to write
39522 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
39523 * @returns {!ByteBuffer} this
39524 * @expose
39525 */
39526 ByteBufferPrototype.writeDouble = ByteBufferPrototype.writeFloat64;
39527
39528 /**
39529 * Reads a 64bit float.
39530 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
39531 * @returns {number}
39532 * @expose
39533 */
39534 ByteBufferPrototype.readFloat64 = function(offset) {
39535 var relative = typeof offset === 'undefined';
39536 if (relative) offset = this.offset;
39537 if (!this.noAssert) {
39538 if (typeof offset !== 'number' || offset % 1 !== 0)
39539 throw TypeError("Illegal offset: "+offset+" (not an integer)");
39540 offset >>>= 0;
39541 if (offset < 0 || offset + 8 > this.buffer.byteLength)
39542 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+8+") <= "+this.buffer.byteLength);
39543 }
39544 var value = ieee754_read(this.view, offset, this.littleEndian, 52, 8);
39545 if (relative) this.offset += 8;
39546 return value;
39547 };
39548
39549 /**
39550 * Reads a 64bit float. This is an alias of {@link ByteBuffer#readFloat64}.
39551 * @function
39552 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
39553 * @returns {number}
39554 * @expose
39555 */
39556 ByteBufferPrototype.readDouble = ByteBufferPrototype.readFloat64;
39557
39558
39559 // types/varints/varint32
39560
39561 /**
39562 * Maximum number of bytes required to store a 32bit base 128 variable-length integer.
39563 * @type {number}
39564 * @const
39565 * @expose
39566 */
39567 ByteBuffer.MAX_VARINT32_BYTES = 5;
39568
39569 /**
39570 * Calculates the actual number of bytes required to store a 32bit base 128 variable-length integer.
39571 * @param {number} value Value to encode
39572 * @returns {number} Number of bytes required. Capped to {@link ByteBuffer.MAX_VARINT32_BYTES}
39573 * @expose
39574 */
39575 ByteBuffer.calculateVarint32 = function(value) {
39576 // ref: src/google/protobuf/io/coded_stream.cc
39577 value = value >>> 0;
39578 if (value < 1 << 7 ) return 1;
39579 else if (value < 1 << 14) return 2;
39580 else if (value < 1 << 21) return 3;
39581 else if (value < 1 << 28) return 4;
39582 else return 5;
39583 };
39584
39585 /**
39586 * Zigzag encodes a signed 32bit integer so that it can be effectively used with varint encoding.
39587 * @param {number} n Signed 32bit integer
39588 * @returns {number} Unsigned zigzag encoded 32bit integer
39589 * @expose
39590 */
39591 ByteBuffer.zigZagEncode32 = function(n) {
39592 return (((n |= 0) << 1) ^ (n >> 31)) >>> 0; // ref: src/google/protobuf/wire_format_lite.h
39593 };
39594
39595 /**
39596 * Decodes a zigzag encoded signed 32bit integer.
39597 * @param {number} n Unsigned zigzag encoded 32bit integer
39598 * @returns {number} Signed 32bit integer
39599 * @expose
39600 */
39601 ByteBuffer.zigZagDecode32 = function(n) {
39602 return ((n >>> 1) ^ -(n & 1)) | 0; // // ref: src/google/protobuf/wire_format_lite.h
39603 };
39604
39605 /**
39606 * Writes a 32bit base 128 variable-length integer.
39607 * @param {number} value Value to write
39608 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by the number of bytes
39609 * written if omitted.
39610 * @returns {!ByteBuffer|number} this if `offset` is omitted, else the actual number of bytes written
39611 * @expose
39612 */
39613 ByteBufferPrototype.writeVarint32 = function(value, offset) {
39614 var relative = typeof offset === 'undefined';
39615 if (relative) offset = this.offset;
39616 if (!this.noAssert) {
39617 if (typeof value !== 'number' || value % 1 !== 0)
39618 throw TypeError("Illegal value: "+value+" (not an integer)");
39619 value |= 0;
39620 if (typeof offset !== 'number' || offset % 1 !== 0)
39621 throw TypeError("Illegal offset: "+offset+" (not an integer)");
39622 offset >>>= 0;
39623 if (offset < 0 || offset + 0 > this.buffer.byteLength)
39624 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
39625 }
39626 var size = ByteBuffer.calculateVarint32(value),
39627 b;
39628 offset += size;
39629 var capacity10 = this.buffer.byteLength;
39630 if (offset > capacity10)
39631 this.resize((capacity10 *= 2) > offset ? capacity10 : offset);
39632 offset -= size;
39633 value >>>= 0;
39634 while (value >= 0x80) {
39635 b = (value & 0x7f) | 0x80;
39636 this.view[offset++] = b;
39637 value >>>= 7;
39638 }
39639 this.view[offset++] = value;
39640 if (relative) {
39641 this.offset = offset;
39642 return this;
39643 }
39644 return size;
39645 };
39646
39647 /**
39648 * Writes a zig-zag encoded (signed) 32bit base 128 variable-length integer.
39649 * @param {number} value Value to write
39650 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by the number of bytes
39651 * written if omitted.
39652 * @returns {!ByteBuffer|number} this if `offset` is omitted, else the actual number of bytes written
39653 * @expose
39654 */
39655 ByteBufferPrototype.writeVarint32ZigZag = function(value, offset) {
39656 return this.writeVarint32(ByteBuffer.zigZagEncode32(value), offset);
39657 };
39658
39659 /**
39660 * Reads a 32bit base 128 variable-length integer.
39661 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by the number of bytes
39662 * written if omitted.
39663 * @returns {number|!{value: number, length: number}} The value read if offset is omitted, else the value read
39664 * and the actual number of bytes read.
39665 * @throws {Error} If it's not a valid varint. Has a property `truncated = true` if there is not enough data available
39666 * to fully decode the varint.
39667 * @expose
39668 */
39669 ByteBufferPrototype.readVarint32 = function(offset) {
39670 var relative = typeof offset === 'undefined';
39671 if (relative) offset = this.offset;
39672 if (!this.noAssert) {
39673 if (typeof offset !== 'number' || offset % 1 !== 0)
39674 throw TypeError("Illegal offset: "+offset+" (not an integer)");
39675 offset >>>= 0;
39676 if (offset < 0 || offset + 1 > this.buffer.byteLength)
39677 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+1+") <= "+this.buffer.byteLength);
39678 }
39679 var c = 0,
39680 value = 0 >>> 0,
39681 b;
39682 do {
39683 if (!this.noAssert && offset > this.limit) {
39684 var err = Error("Truncated");
39685 err['truncated'] = true;
39686 throw err;
39687 }
39688 b = this.view[offset++];
39689 if (c < 5)
39690 value |= (b & 0x7f) << (7*c);
39691 ++c;
39692 } while ((b & 0x80) !== 0);
39693 value |= 0;
39694 if (relative) {
39695 this.offset = offset;
39696 return value;
39697 }
39698 return {
39699 "value": value,
39700 "length": c
39701 };
39702 };
39703
39704 /**
39705 * Reads a zig-zag encoded (signed) 32bit base 128 variable-length integer.
39706 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by the number of bytes
39707 * written if omitted.
39708 * @returns {number|!{value: number, length: number}} The value read if offset is omitted, else the value read
39709 * and the actual number of bytes read.
39710 * @throws {Error} If it's not a valid varint
39711 * @expose
39712 */
39713 ByteBufferPrototype.readVarint32ZigZag = function(offset) {
39714 var val = this.readVarint32(offset);
39715 if (typeof val === 'object')
39716 val["value"] = ByteBuffer.zigZagDecode32(val["value"]);
39717 else
39718 val = ByteBuffer.zigZagDecode32(val);
39719 return val;
39720 };
39721
39722 // types/varints/varint64
39723
39724 if (Long) {
39725
39726 /**
39727 * Maximum number of bytes required to store a 64bit base 128 variable-length integer.
39728 * @type {number}
39729 * @const
39730 * @expose
39731 */
39732 ByteBuffer.MAX_VARINT64_BYTES = 10;
39733
39734 /**
39735 * Calculates the actual number of bytes required to store a 64bit base 128 variable-length integer.
39736 * @param {number|!Long} value Value to encode
39737 * @returns {number} Number of bytes required. Capped to {@link ByteBuffer.MAX_VARINT64_BYTES}
39738 * @expose
39739 */
39740 ByteBuffer.calculateVarint64 = function(value) {
39741 if (typeof value === 'number')
39742 value = Long.fromNumber(value);
39743 else if (typeof value === 'string')
39744 value = Long.fromString(value);
39745 // ref: src/google/protobuf/io/coded_stream.cc
39746 var part0 = value.toInt() >>> 0,
39747 part1 = value.shiftRightUnsigned(28).toInt() >>> 0,
39748 part2 = value.shiftRightUnsigned(56).toInt() >>> 0;
39749 if (part2 == 0) {
39750 if (part1 == 0) {
39751 if (part0 < 1 << 14)
39752 return part0 < 1 << 7 ? 1 : 2;
39753 else
39754 return part0 < 1 << 21 ? 3 : 4;
39755 } else {
39756 if (part1 < 1 << 14)
39757 return part1 < 1 << 7 ? 5 : 6;
39758 else
39759 return part1 < 1 << 21 ? 7 : 8;
39760 }
39761 } else
39762 return part2 < 1 << 7 ? 9 : 10;
39763 };
39764
39765 /**
39766 * Zigzag encodes a signed 64bit integer so that it can be effectively used with varint encoding.
39767 * @param {number|!Long} value Signed long
39768 * @returns {!Long} Unsigned zigzag encoded long
39769 * @expose
39770 */
39771 ByteBuffer.zigZagEncode64 = function(value) {
39772 if (typeof value === 'number')
39773 value = Long.fromNumber(value, false);
39774 else if (typeof value === 'string')
39775 value = Long.fromString(value, false);
39776 else if (value.unsigned !== false) value = value.toSigned();
39777 // ref: src/google/protobuf/wire_format_lite.h
39778 return value.shiftLeft(1).xor(value.shiftRight(63)).toUnsigned();
39779 };
39780
39781 /**
39782 * Decodes a zigzag encoded signed 64bit integer.
39783 * @param {!Long|number} value Unsigned zigzag encoded long or JavaScript number
39784 * @returns {!Long} Signed long
39785 * @expose
39786 */
39787 ByteBuffer.zigZagDecode64 = function(value) {
39788 if (typeof value === 'number')
39789 value = Long.fromNumber(value, false);
39790 else if (typeof value === 'string')
39791 value = Long.fromString(value, false);
39792 else if (value.unsigned !== false) value = value.toSigned();
39793 // ref: src/google/protobuf/wire_format_lite.h
39794 return value.shiftRightUnsigned(1).xor(value.and(Long.ONE).toSigned().negate()).toSigned();
39795 };
39796
39797 /**
39798 * Writes a 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.writeVarint64 = function(value, offset) {
39806 var relative = typeof offset === 'undefined';
39807 if (relative) offset = this.offset;
39808 if (!this.noAssert) {
39809 if (typeof value === 'number')
39810 value = Long.fromNumber(value);
39811 else if (typeof value === 'string')
39812 value = Long.fromString(value);
39813 else if (!(value && value instanceof Long))
39814 throw TypeError("Illegal value: "+value+" (not an integer or Long)");
39815 if (typeof offset !== 'number' || offset % 1 !== 0)
39816 throw TypeError("Illegal offset: "+offset+" (not an integer)");
39817 offset >>>= 0;
39818 if (offset < 0 || offset + 0 > this.buffer.byteLength)
39819 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
39820 }
39821 if (typeof value === 'number')
39822 value = Long.fromNumber(value, false);
39823 else if (typeof value === 'string')
39824 value = Long.fromString(value, false);
39825 else if (value.unsigned !== false) value = value.toSigned();
39826 var size = ByteBuffer.calculateVarint64(value),
39827 part0 = value.toInt() >>> 0,
39828 part1 = value.shiftRightUnsigned(28).toInt() >>> 0,
39829 part2 = value.shiftRightUnsigned(56).toInt() >>> 0;
39830 offset += size;
39831 var capacity11 = this.buffer.byteLength;
39832 if (offset > capacity11)
39833 this.resize((capacity11 *= 2) > offset ? capacity11 : offset);
39834 offset -= size;
39835 switch (size) {
39836 case 10: this.view[offset+9] = (part2 >>> 7) & 0x01;
39837 case 9 : this.view[offset+8] = size !== 9 ? (part2 ) | 0x80 : (part2 ) & 0x7F;
39838 case 8 : this.view[offset+7] = size !== 8 ? (part1 >>> 21) | 0x80 : (part1 >>> 21) & 0x7F;
39839 case 7 : this.view[offset+6] = size !== 7 ? (part1 >>> 14) | 0x80 : (part1 >>> 14) & 0x7F;
39840 case 6 : this.view[offset+5] = size !== 6 ? (part1 >>> 7) | 0x80 : (part1 >>> 7) & 0x7F;
39841 case 5 : this.view[offset+4] = size !== 5 ? (part1 ) | 0x80 : (part1 ) & 0x7F;
39842 case 4 : this.view[offset+3] = size !== 4 ? (part0 >>> 21) | 0x80 : (part0 >>> 21) & 0x7F;
39843 case 3 : this.view[offset+2] = size !== 3 ? (part0 >>> 14) | 0x80 : (part0 >>> 14) & 0x7F;
39844 case 2 : this.view[offset+1] = size !== 2 ? (part0 >>> 7) | 0x80 : (part0 >>> 7) & 0x7F;
39845 case 1 : this.view[offset ] = size !== 1 ? (part0 ) | 0x80 : (part0 ) & 0x7F;
39846 }
39847 if (relative) {
39848 this.offset += size;
39849 return this;
39850 } else {
39851 return size;
39852 }
39853 };
39854
39855 /**
39856 * Writes a zig-zag encoded 64bit base 128 variable-length integer.
39857 * @param {number|Long} value Value to write
39858 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by the number of bytes
39859 * written if omitted.
39860 * @returns {!ByteBuffer|number} `this` if offset is omitted, else the actual number of bytes written.
39861 * @expose
39862 */
39863 ByteBufferPrototype.writeVarint64ZigZag = function(value, offset) {
39864 return this.writeVarint64(ByteBuffer.zigZagEncode64(value), offset);
39865 };
39866
39867 /**
39868 * Reads a 64bit base 128 variable-length integer. Requires Long.js.
39869 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by the number of bytes
39870 * read if omitted.
39871 * @returns {!Long|!{value: Long, length: number}} The value read if offset is omitted, else the value read and
39872 * the actual number of bytes read.
39873 * @throws {Error} If it's not a valid varint
39874 * @expose
39875 */
39876 ByteBufferPrototype.readVarint64 = function(offset) {
39877 var relative = typeof offset === 'undefined';
39878 if (relative) offset = this.offset;
39879 if (!this.noAssert) {
39880 if (typeof offset !== 'number' || offset % 1 !== 0)
39881 throw TypeError("Illegal offset: "+offset+" (not an integer)");
39882 offset >>>= 0;
39883 if (offset < 0 || offset + 1 > this.buffer.byteLength)
39884 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+1+") <= "+this.buffer.byteLength);
39885 }
39886 // ref: src/google/protobuf/io/coded_stream.cc
39887 var start = offset,
39888 part0 = 0,
39889 part1 = 0,
39890 part2 = 0,
39891 b = 0;
39892 b = this.view[offset++]; part0 = (b & 0x7F) ; if ( b & 0x80 ) {
39893 b = this.view[offset++]; part0 |= (b & 0x7F) << 7; if ((b & 0x80) || (this.noAssert && typeof b === 'undefined')) {
39894 b = this.view[offset++]; part0 |= (b & 0x7F) << 14; if ((b & 0x80) || (this.noAssert && typeof b === 'undefined')) {
39895 b = this.view[offset++]; part0 |= (b & 0x7F) << 21; if ((b & 0x80) || (this.noAssert && typeof b === 'undefined')) {
39896 b = this.view[offset++]; part1 = (b & 0x7F) ; if ((b & 0x80) || (this.noAssert && typeof b === 'undefined')) {
39897 b = this.view[offset++]; part1 |= (b & 0x7F) << 7; if ((b & 0x80) || (this.noAssert && typeof b === 'undefined')) {
39898 b = this.view[offset++]; part1 |= (b & 0x7F) << 14; if ((b & 0x80) || (this.noAssert && typeof b === 'undefined')) {
39899 b = this.view[offset++]; part1 |= (b & 0x7F) << 21; if ((b & 0x80) || (this.noAssert && typeof b === 'undefined')) {
39900 b = this.view[offset++]; part2 = (b & 0x7F) ; if ((b & 0x80) || (this.noAssert && typeof b === 'undefined')) {
39901 b = this.view[offset++]; part2 |= (b & 0x7F) << 7; if ((b & 0x80) || (this.noAssert && typeof b === 'undefined')) {
39902 throw Error("Buffer overrun"); }}}}}}}}}}
39903 var value = Long.fromBits(part0 | (part1 << 28), (part1 >>> 4) | (part2) << 24, false);
39904 if (relative) {
39905 this.offset = offset;
39906 return value;
39907 } else {
39908 return {
39909 'value': value,
39910 'length': offset-start
39911 };
39912 }
39913 };
39914
39915 /**
39916 * Reads a zig-zag encoded 64bit base 128 variable-length integer. Requires Long.js.
39917 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by the number of bytes
39918 * read if omitted.
39919 * @returns {!Long|!{value: Long, length: number}} The value read if offset is omitted, else the value read and
39920 * the actual number of bytes read.
39921 * @throws {Error} If it's not a valid varint
39922 * @expose
39923 */
39924 ByteBufferPrototype.readVarint64ZigZag = function(offset) {
39925 var val = this.readVarint64(offset);
39926 if (val && val['value'] instanceof Long)
39927 val["value"] = ByteBuffer.zigZagDecode64(val["value"]);
39928 else
39929 val = ByteBuffer.zigZagDecode64(val);
39930 return val;
39931 };
39932
39933 } // Long
39934
39935
39936 // types/strings/cstring
39937
39938 /**
39939 * Writes a NULL-terminated UTF8 encoded string. For this to work the specified string must not contain any NULL
39940 * characters itself.
39941 * @param {string} str String to write
39942 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by the number of bytes
39943 * contained in `str` + 1 if omitted.
39944 * @returns {!ByteBuffer|number} this if offset is omitted, else the actual number of bytes written
39945 * @expose
39946 */
39947 ByteBufferPrototype.writeCString = function(str, offset) {
39948 var relative = typeof offset === 'undefined';
39949 if (relative) offset = this.offset;
39950 var i,
39951 k = str.length;
39952 if (!this.noAssert) {
39953 if (typeof str !== 'string')
39954 throw TypeError("Illegal str: Not a string");
39955 for (i=0; i<k; ++i) {
39956 if (str.charCodeAt(i) === 0)
39957 throw RangeError("Illegal str: Contains NULL-characters");
39958 }
39959 if (typeof offset !== 'number' || offset % 1 !== 0)
39960 throw TypeError("Illegal offset: "+offset+" (not an integer)");
39961 offset >>>= 0;
39962 if (offset < 0 || offset + 0 > this.buffer.byteLength)
39963 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
39964 }
39965 // UTF8 strings do not contain zero bytes in between except for the zero character, so:
39966 k = utfx.calculateUTF16asUTF8(stringSource(str))[1];
39967 offset += k+1;
39968 var capacity12 = this.buffer.byteLength;
39969 if (offset > capacity12)
39970 this.resize((capacity12 *= 2) > offset ? capacity12 : offset);
39971 offset -= k+1;
39972 utfx.encodeUTF16toUTF8(stringSource(str), function(b) {
39973 this.view[offset++] = b;
39974 }.bind(this));
39975 this.view[offset++] = 0;
39976 if (relative) {
39977 this.offset = offset;
39978 return this;
39979 }
39980 return k;
39981 };
39982
39983 /**
39984 * Reads a NULL-terminated UTF8 encoded string. For this to work the string read must not contain any NULL characters
39985 * itself.
39986 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by the number of bytes
39987 * read if omitted.
39988 * @returns {string|!{string: string, length: number}} The string read if offset is omitted, else the string
39989 * read and the actual number of bytes read.
39990 * @expose
39991 */
39992 ByteBufferPrototype.readCString = function(offset) {
39993 var relative = typeof offset === 'undefined';
39994 if (relative) offset = this.offset;
39995 if (!this.noAssert) {
39996 if (typeof offset !== 'number' || offset % 1 !== 0)
39997 throw TypeError("Illegal offset: "+offset+" (not an integer)");
39998 offset >>>= 0;
39999 if (offset < 0 || offset + 1 > this.buffer.byteLength)
40000 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+1+") <= "+this.buffer.byteLength);
40001 }
40002 var start = offset,
40003 temp;
40004 // UTF8 strings do not contain zero bytes in between except for the zero character itself, so:
40005 var sd, b = -1;
40006 utfx.decodeUTF8toUTF16(function() {
40007 if (b === 0) return null;
40008 if (offset >= this.limit)
40009 throw RangeError("Illegal range: Truncated data, "+offset+" < "+this.limit);
40010 b = this.view[offset++];
40011 return b === 0 ? null : b;
40012 }.bind(this), sd = stringDestination(), true);
40013 if (relative) {
40014 this.offset = offset;
40015 return sd();
40016 } else {
40017 return {
40018 "string": sd(),
40019 "length": offset - start
40020 };
40021 }
40022 };
40023
40024 // types/strings/istring
40025
40026 /**
40027 * Writes a length as uint32 prefixed UTF8 encoded string.
40028 * @param {string} str String to write
40029 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by the number of bytes
40030 * written if omitted.
40031 * @returns {!ByteBuffer|number} `this` if `offset` is omitted, else the actual number of bytes written
40032 * @expose
40033 * @see ByteBuffer#writeVarint32
40034 */
40035 ByteBufferPrototype.writeIString = function(str, offset) {
40036 var relative = typeof offset === 'undefined';
40037 if (relative) offset = this.offset;
40038 if (!this.noAssert) {
40039 if (typeof str !== 'string')
40040 throw TypeError("Illegal str: Not a string");
40041 if (typeof offset !== 'number' || offset % 1 !== 0)
40042 throw TypeError("Illegal offset: "+offset+" (not an integer)");
40043 offset >>>= 0;
40044 if (offset < 0 || offset + 0 > this.buffer.byteLength)
40045 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
40046 }
40047 var start = offset,
40048 k;
40049 k = utfx.calculateUTF16asUTF8(stringSource(str), this.noAssert)[1];
40050 offset += 4+k;
40051 var capacity13 = this.buffer.byteLength;
40052 if (offset > capacity13)
40053 this.resize((capacity13 *= 2) > offset ? capacity13 : offset);
40054 offset -= 4+k;
40055 if (this.littleEndian) {
40056 this.view[offset+3] = (k >>> 24) & 0xFF;
40057 this.view[offset+2] = (k >>> 16) & 0xFF;
40058 this.view[offset+1] = (k >>> 8) & 0xFF;
40059 this.view[offset ] = k & 0xFF;
40060 } else {
40061 this.view[offset ] = (k >>> 24) & 0xFF;
40062 this.view[offset+1] = (k >>> 16) & 0xFF;
40063 this.view[offset+2] = (k >>> 8) & 0xFF;
40064 this.view[offset+3] = k & 0xFF;
40065 }
40066 offset += 4;
40067 utfx.encodeUTF16toUTF8(stringSource(str), function(b) {
40068 this.view[offset++] = b;
40069 }.bind(this));
40070 if (offset !== start + 4 + k)
40071 throw RangeError("Illegal range: Truncated data, "+offset+" == "+(offset+4+k));
40072 if (relative) {
40073 this.offset = offset;
40074 return this;
40075 }
40076 return offset - start;
40077 };
40078
40079 /**
40080 * Reads a length as uint32 prefixed UTF8 encoded string.
40081 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by the number of bytes
40082 * read if omitted.
40083 * @returns {string|!{string: string, length: number}} The string read if offset is omitted, else the string
40084 * read and the actual number of bytes read.
40085 * @expose
40086 * @see ByteBuffer#readVarint32
40087 */
40088 ByteBufferPrototype.readIString = function(offset) {
40089 var relative = typeof offset === 'undefined';
40090 if (relative) offset = this.offset;
40091 if (!this.noAssert) {
40092 if (typeof offset !== 'number' || offset % 1 !== 0)
40093 throw TypeError("Illegal offset: "+offset+" (not an integer)");
40094 offset >>>= 0;
40095 if (offset < 0 || offset + 4 > this.buffer.byteLength)
40096 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+4+") <= "+this.buffer.byteLength);
40097 }
40098 var start = offset;
40099 var len = this.readUint32(offset);
40100 var str = this.readUTF8String(len, ByteBuffer.METRICS_BYTES, offset += 4);
40101 offset += str['length'];
40102 if (relative) {
40103 this.offset = offset;
40104 return str['string'];
40105 } else {
40106 return {
40107 'string': str['string'],
40108 'length': offset - start
40109 };
40110 }
40111 };
40112
40113 // types/strings/utf8string
40114
40115 /**
40116 * Metrics representing number of UTF8 characters. Evaluates to `c`.
40117 * @type {string}
40118 * @const
40119 * @expose
40120 */
40121 ByteBuffer.METRICS_CHARS = 'c';
40122
40123 /**
40124 * Metrics representing number of bytes. Evaluates to `b`.
40125 * @type {string}
40126 * @const
40127 * @expose
40128 */
40129 ByteBuffer.METRICS_BYTES = 'b';
40130
40131 /**
40132 * Writes an UTF8 encoded string.
40133 * @param {string} str String to write
40134 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} if omitted.
40135 * @returns {!ByteBuffer|number} this if offset is omitted, else the actual number of bytes written.
40136 * @expose
40137 */
40138 ByteBufferPrototype.writeUTF8String = function(str, offset) {
40139 var relative = typeof offset === 'undefined';
40140 if (relative) offset = this.offset;
40141 if (!this.noAssert) {
40142 if (typeof offset !== 'number' || offset % 1 !== 0)
40143 throw TypeError("Illegal offset: "+offset+" (not an integer)");
40144 offset >>>= 0;
40145 if (offset < 0 || offset + 0 > this.buffer.byteLength)
40146 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
40147 }
40148 var k;
40149 var start = offset;
40150 k = utfx.calculateUTF16asUTF8(stringSource(str))[1];
40151 offset += k;
40152 var capacity14 = this.buffer.byteLength;
40153 if (offset > capacity14)
40154 this.resize((capacity14 *= 2) > offset ? capacity14 : offset);
40155 offset -= k;
40156 utfx.encodeUTF16toUTF8(stringSource(str), function(b) {
40157 this.view[offset++] = b;
40158 }.bind(this));
40159 if (relative) {
40160 this.offset = offset;
40161 return this;
40162 }
40163 return offset - start;
40164 };
40165
40166 /**
40167 * Writes an UTF8 encoded string. This is an alias of {@link ByteBuffer#writeUTF8String}.
40168 * @function
40169 * @param {string} str String to write
40170 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} if omitted.
40171 * @returns {!ByteBuffer|number} this if offset is omitted, else the actual number of bytes written.
40172 * @expose
40173 */
40174 ByteBufferPrototype.writeString = ByteBufferPrototype.writeUTF8String;
40175
40176 /**
40177 * Calculates the number of UTF8 characters of a string. JavaScript itself uses UTF-16, so that a string's
40178 * `length` property does not reflect its actual UTF8 size if it contains code points larger than 0xFFFF.
40179 * @param {string} str String to calculate
40180 * @returns {number} Number of UTF8 characters
40181 * @expose
40182 */
40183 ByteBuffer.calculateUTF8Chars = function(str) {
40184 return utfx.calculateUTF16asUTF8(stringSource(str))[0];
40185 };
40186
40187 /**
40188 * Calculates the number of UTF8 bytes of a string.
40189 * @param {string} str String to calculate
40190 * @returns {number} Number of UTF8 bytes
40191 * @expose
40192 */
40193 ByteBuffer.calculateUTF8Bytes = function(str) {
40194 return utfx.calculateUTF16asUTF8(stringSource(str))[1];
40195 };
40196
40197 /**
40198 * Calculates the number of UTF8 bytes of a string. This is an alias of {@link ByteBuffer.calculateUTF8Bytes}.
40199 * @function
40200 * @param {string} str String to calculate
40201 * @returns {number} Number of UTF8 bytes
40202 * @expose
40203 */
40204 ByteBuffer.calculateString = ByteBuffer.calculateUTF8Bytes;
40205
40206 /**
40207 * Reads an UTF8 encoded string.
40208 * @param {number} length Number of characters or bytes to read.
40209 * @param {string=} metrics Metrics specifying what `length` is meant to count. Defaults to
40210 * {@link ByteBuffer.METRICS_CHARS}.
40211 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by the number of bytes
40212 * read if omitted.
40213 * @returns {string|!{string: string, length: number}} The string read if offset is omitted, else the string
40214 * read and the actual number of bytes read.
40215 * @expose
40216 */
40217 ByteBufferPrototype.readUTF8String = function(length, metrics, offset) {
40218 if (typeof metrics === 'number') {
40219 offset = metrics;
40220 metrics = undefined;
40221 }
40222 var relative = typeof offset === 'undefined';
40223 if (relative) offset = this.offset;
40224 if (typeof metrics === 'undefined') metrics = ByteBuffer.METRICS_CHARS;
40225 if (!this.noAssert) {
40226 if (typeof length !== 'number' || length % 1 !== 0)
40227 throw TypeError("Illegal length: "+length+" (not an integer)");
40228 length |= 0;
40229 if (typeof offset !== 'number' || offset % 1 !== 0)
40230 throw TypeError("Illegal offset: "+offset+" (not an integer)");
40231 offset >>>= 0;
40232 if (offset < 0 || offset + 0 > this.buffer.byteLength)
40233 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
40234 }
40235 var i = 0,
40236 start = offset,
40237 sd;
40238 if (metrics === ByteBuffer.METRICS_CHARS) { // The same for node and the browser
40239 sd = stringDestination();
40240 utfx.decodeUTF8(function() {
40241 return i < length && offset < this.limit ? this.view[offset++] : null;
40242 }.bind(this), function(cp) {
40243 ++i; utfx.UTF8toUTF16(cp, sd);
40244 });
40245 if (i !== length)
40246 throw RangeError("Illegal range: Truncated data, "+i+" == "+length);
40247 if (relative) {
40248 this.offset = offset;
40249 return sd();
40250 } else {
40251 return {
40252 "string": sd(),
40253 "length": offset - start
40254 };
40255 }
40256 } else if (metrics === ByteBuffer.METRICS_BYTES) {
40257 if (!this.noAssert) {
40258 if (typeof offset !== 'number' || offset % 1 !== 0)
40259 throw TypeError("Illegal offset: "+offset+" (not an integer)");
40260 offset >>>= 0;
40261 if (offset < 0 || offset + length > this.buffer.byteLength)
40262 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+length+") <= "+this.buffer.byteLength);
40263 }
40264 var k = offset + length;
40265 utfx.decodeUTF8toUTF16(function() {
40266 return offset < k ? this.view[offset++] : null;
40267 }.bind(this), sd = stringDestination(), this.noAssert);
40268 if (offset !== k)
40269 throw RangeError("Illegal range: Truncated data, "+offset+" == "+k);
40270 if (relative) {
40271 this.offset = offset;
40272 return sd();
40273 } else {
40274 return {
40275 'string': sd(),
40276 'length': offset - start
40277 };
40278 }
40279 } else
40280 throw TypeError("Unsupported metrics: "+metrics);
40281 };
40282
40283 /**
40284 * Reads an UTF8 encoded string. This is an alias of {@link ByteBuffer#readUTF8String}.
40285 * @function
40286 * @param {number} length Number of characters or bytes to read
40287 * @param {number=} metrics Metrics specifying what `n` is meant to count. Defaults to
40288 * {@link ByteBuffer.METRICS_CHARS}.
40289 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by the number of bytes
40290 * read if omitted.
40291 * @returns {string|!{string: string, length: number}} The string read if offset is omitted, else the string
40292 * read and the actual number of bytes read.
40293 * @expose
40294 */
40295 ByteBufferPrototype.readString = ByteBufferPrototype.readUTF8String;
40296
40297 // types/strings/vstring
40298
40299 /**
40300 * Writes a length as varint32 prefixed UTF8 encoded string.
40301 * @param {string} str String to write
40302 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by the number of bytes
40303 * written if omitted.
40304 * @returns {!ByteBuffer|number} `this` if `offset` is omitted, else the actual number of bytes written
40305 * @expose
40306 * @see ByteBuffer#writeVarint32
40307 */
40308 ByteBufferPrototype.writeVString = function(str, offset) {
40309 var relative = typeof offset === 'undefined';
40310 if (relative) offset = this.offset;
40311 if (!this.noAssert) {
40312 if (typeof str !== 'string')
40313 throw TypeError("Illegal str: Not a string");
40314 if (typeof offset !== 'number' || offset % 1 !== 0)
40315 throw TypeError("Illegal offset: "+offset+" (not an integer)");
40316 offset >>>= 0;
40317 if (offset < 0 || offset + 0 > this.buffer.byteLength)
40318 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
40319 }
40320 var start = offset,
40321 k, l;
40322 k = utfx.calculateUTF16asUTF8(stringSource(str), this.noAssert)[1];
40323 l = ByteBuffer.calculateVarint32(k);
40324 offset += l+k;
40325 var capacity15 = this.buffer.byteLength;
40326 if (offset > capacity15)
40327 this.resize((capacity15 *= 2) > offset ? capacity15 : offset);
40328 offset -= l+k;
40329 offset += this.writeVarint32(k, offset);
40330 utfx.encodeUTF16toUTF8(stringSource(str), function(b) {
40331 this.view[offset++] = b;
40332 }.bind(this));
40333 if (offset !== start+k+l)
40334 throw RangeError("Illegal range: Truncated data, "+offset+" == "+(offset+k+l));
40335 if (relative) {
40336 this.offset = offset;
40337 return this;
40338 }
40339 return offset - start;
40340 };
40341
40342 /**
40343 * Reads a length as varint32 prefixed UTF8 encoded string.
40344 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by the number of bytes
40345 * read if omitted.
40346 * @returns {string|!{string: string, length: number}} The string read if offset is omitted, else the string
40347 * read and the actual number of bytes read.
40348 * @expose
40349 * @see ByteBuffer#readVarint32
40350 */
40351 ByteBufferPrototype.readVString = function(offset) {
40352 var relative = typeof offset === 'undefined';
40353 if (relative) offset = this.offset;
40354 if (!this.noAssert) {
40355 if (typeof offset !== 'number' || offset % 1 !== 0)
40356 throw TypeError("Illegal offset: "+offset+" (not an integer)");
40357 offset >>>= 0;
40358 if (offset < 0 || offset + 1 > this.buffer.byteLength)
40359 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+1+") <= "+this.buffer.byteLength);
40360 }
40361 var start = offset;
40362 var len = this.readVarint32(offset);
40363 var str = this.readUTF8String(len['value'], ByteBuffer.METRICS_BYTES, offset += len['length']);
40364 offset += str['length'];
40365 if (relative) {
40366 this.offset = offset;
40367 return str['string'];
40368 } else {
40369 return {
40370 'string': str['string'],
40371 'length': offset - start
40372 };
40373 }
40374 };
40375
40376
40377 /**
40378 * Appends some data to this ByteBuffer. This will overwrite any contents behind the specified offset up to the appended
40379 * data's length.
40380 * @param {!ByteBuffer|!ArrayBuffer|!Uint8Array|string} source Data to append. If `source` is a ByteBuffer, its offsets
40381 * will be modified according to the performed read operation.
40382 * @param {(string|number)=} encoding Encoding if `data` is a string ("base64", "hex", "binary", defaults to "utf8")
40383 * @param {number=} offset Offset to append at. Will use and increase {@link ByteBuffer#offset} by the number of bytes
40384 * written if omitted.
40385 * @returns {!ByteBuffer} this
40386 * @expose
40387 * @example A relative `<01 02>03.append(<04 05>)` will result in `<01 02 04 05>, 04 05|`
40388 * @example An absolute `<01 02>03.append(04 05>, 1)` will result in `<01 04>05, 04 05|`
40389 */
40390 ByteBufferPrototype.append = function(source, encoding, offset) {
40391 if (typeof encoding === 'number' || typeof encoding !== 'string') {
40392 offset = encoding;
40393 encoding = undefined;
40394 }
40395 var relative = typeof offset === 'undefined';
40396 if (relative) offset = this.offset;
40397 if (!this.noAssert) {
40398 if (typeof offset !== 'number' || offset % 1 !== 0)
40399 throw TypeError("Illegal offset: "+offset+" (not an integer)");
40400 offset >>>= 0;
40401 if (offset < 0 || offset + 0 > this.buffer.byteLength)
40402 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
40403 }
40404 if (!(source instanceof ByteBuffer))
40405 source = ByteBuffer.wrap(source, encoding);
40406 var length = source.limit - source.offset;
40407 if (length <= 0) return this; // Nothing to append
40408 offset += length;
40409 var capacity16 = this.buffer.byteLength;
40410 if (offset > capacity16)
40411 this.resize((capacity16 *= 2) > offset ? capacity16 : offset);
40412 offset -= length;
40413 this.view.set(source.view.subarray(source.offset, source.limit), offset);
40414 source.offset += length;
40415 if (relative) this.offset += length;
40416 return this;
40417 };
40418
40419 /**
40420 * Appends this ByteBuffer's contents to another ByteBuffer. This will overwrite any contents at and after the
40421 specified offset up to the length of this ByteBuffer's data.
40422 * @param {!ByteBuffer} target Target ByteBuffer
40423 * @param {number=} offset Offset to append to. Will use and increase {@link ByteBuffer#offset} by the number of bytes
40424 * read if omitted.
40425 * @returns {!ByteBuffer} this
40426 * @expose
40427 * @see ByteBuffer#append
40428 */
40429 ByteBufferPrototype.appendTo = function(target, offset) {
40430 target.append(this, offset);
40431 return this;
40432 };
40433
40434 /**
40435 * Enables or disables assertions of argument types and offsets. Assertions are enabled by default but you can opt to
40436 * disable them if your code already makes sure that everything is valid.
40437 * @param {boolean} assert `true` to enable assertions, otherwise `false`
40438 * @returns {!ByteBuffer} this
40439 * @expose
40440 */
40441 ByteBufferPrototype.assert = function(assert) {
40442 this.noAssert = !assert;
40443 return this;
40444 };
40445
40446 /**
40447 * Gets the capacity of this ByteBuffer's backing buffer.
40448 * @returns {number} Capacity of the backing buffer
40449 * @expose
40450 */
40451 ByteBufferPrototype.capacity = function() {
40452 return this.buffer.byteLength;
40453 };
40454 /**
40455 * Clears this ByteBuffer's offsets by setting {@link ByteBuffer#offset} to `0` and {@link ByteBuffer#limit} to the
40456 * backing buffer's capacity. Discards {@link ByteBuffer#markedOffset}.
40457 * @returns {!ByteBuffer} this
40458 * @expose
40459 */
40460 ByteBufferPrototype.clear = function() {
40461 this.offset = 0;
40462 this.limit = this.buffer.byteLength;
40463 this.markedOffset = -1;
40464 return this;
40465 };
40466
40467 /**
40468 * Creates a cloned instance of this ByteBuffer, preset with this ByteBuffer's values for {@link ByteBuffer#offset},
40469 * {@link ByteBuffer#markedOffset} and {@link ByteBuffer#limit}.
40470 * @param {boolean=} copy Whether to copy the backing buffer or to return another view on the same, defaults to `false`
40471 * @returns {!ByteBuffer} Cloned instance
40472 * @expose
40473 */
40474 ByteBufferPrototype.clone = function(copy) {
40475 var bb = new ByteBuffer(0, this.littleEndian, this.noAssert);
40476 if (copy) {
40477 bb.buffer = new ArrayBuffer(this.buffer.byteLength);
40478 bb.view = new Uint8Array(bb.buffer);
40479 } else {
40480 bb.buffer = this.buffer;
40481 bb.view = this.view;
40482 }
40483 bb.offset = this.offset;
40484 bb.markedOffset = this.markedOffset;
40485 bb.limit = this.limit;
40486 return bb;
40487 };
40488
40489 /**
40490 * Compacts this ByteBuffer to be backed by a {@link ByteBuffer#buffer} of its contents' length. Contents are the bytes
40491 * between {@link ByteBuffer#offset} and {@link ByteBuffer#limit}. Will set `offset = 0` and `limit = capacity` and
40492 * adapt {@link ByteBuffer#markedOffset} to the same relative position if set.
40493 * @param {number=} begin Offset to start at, defaults to {@link ByteBuffer#offset}
40494 * @param {number=} end Offset to end at, defaults to {@link ByteBuffer#limit}
40495 * @returns {!ByteBuffer} this
40496 * @expose
40497 */
40498 ByteBufferPrototype.compact = function(begin, end) {
40499 if (typeof begin === 'undefined') begin = this.offset;
40500 if (typeof end === 'undefined') end = this.limit;
40501 if (!this.noAssert) {
40502 if (typeof begin !== 'number' || begin % 1 !== 0)
40503 throw TypeError("Illegal begin: Not an integer");
40504 begin >>>= 0;
40505 if (typeof end !== 'number' || end % 1 !== 0)
40506 throw TypeError("Illegal end: Not an integer");
40507 end >>>= 0;
40508 if (begin < 0 || begin > end || end > this.buffer.byteLength)
40509 throw RangeError("Illegal range: 0 <= "+begin+" <= "+end+" <= "+this.buffer.byteLength);
40510 }
40511 if (begin === 0 && end === this.buffer.byteLength)
40512 return this; // Already compacted
40513 var len = end - begin;
40514 if (len === 0) {
40515 this.buffer = EMPTY_BUFFER;
40516 this.view = null;
40517 if (this.markedOffset >= 0) this.markedOffset -= begin;
40518 this.offset = 0;
40519 this.limit = 0;
40520 return this;
40521 }
40522 var buffer = new ArrayBuffer(len);
40523 var view = new Uint8Array(buffer);
40524 view.set(this.view.subarray(begin, end));
40525 this.buffer = buffer;
40526 this.view = view;
40527 if (this.markedOffset >= 0) this.markedOffset -= begin;
40528 this.offset = 0;
40529 this.limit = len;
40530 return this;
40531 };
40532
40533 /**
40534 * Creates a copy of this ByteBuffer's contents. Contents are the bytes between {@link ByteBuffer#offset} and
40535 * {@link ByteBuffer#limit}.
40536 * @param {number=} begin Begin offset, defaults to {@link ByteBuffer#offset}.
40537 * @param {number=} end End offset, defaults to {@link ByteBuffer#limit}.
40538 * @returns {!ByteBuffer} Copy
40539 * @expose
40540 */
40541 ByteBufferPrototype.copy = function(begin, end) {
40542 if (typeof begin === 'undefined') begin = this.offset;
40543 if (typeof end === 'undefined') end = this.limit;
40544 if (!this.noAssert) {
40545 if (typeof begin !== 'number' || begin % 1 !== 0)
40546 throw TypeError("Illegal begin: Not an integer");
40547 begin >>>= 0;
40548 if (typeof end !== 'number' || end % 1 !== 0)
40549 throw TypeError("Illegal end: Not an integer");
40550 end >>>= 0;
40551 if (begin < 0 || begin > end || end > this.buffer.byteLength)
40552 throw RangeError("Illegal range: 0 <= "+begin+" <= "+end+" <= "+this.buffer.byteLength);
40553 }
40554 if (begin === end)
40555 return new ByteBuffer(0, this.littleEndian, this.noAssert);
40556 var capacity = end - begin,
40557 bb = new ByteBuffer(capacity, this.littleEndian, this.noAssert);
40558 bb.offset = 0;
40559 bb.limit = capacity;
40560 if (bb.markedOffset >= 0) bb.markedOffset -= begin;
40561 this.copyTo(bb, 0, begin, end);
40562 return bb;
40563 };
40564
40565 /**
40566 * Copies this ByteBuffer's contents to another ByteBuffer. Contents are the bytes between {@link ByteBuffer#offset} and
40567 * {@link ByteBuffer#limit}.
40568 * @param {!ByteBuffer} target Target ByteBuffer
40569 * @param {number=} targetOffset Offset to copy to. Will use and increase the target's {@link ByteBuffer#offset}
40570 * by the number of bytes copied if omitted.
40571 * @param {number=} sourceOffset Offset to start copying from. Will use and increase {@link ByteBuffer#offset} by the
40572 * number of bytes copied if omitted.
40573 * @param {number=} sourceLimit Offset to end copying from, defaults to {@link ByteBuffer#limit}
40574 * @returns {!ByteBuffer} this
40575 * @expose
40576 */
40577 ByteBufferPrototype.copyTo = function(target, targetOffset, sourceOffset, sourceLimit) {
40578 var relative,
40579 targetRelative;
40580 if (!this.noAssert) {
40581 if (!ByteBuffer.isByteBuffer(target))
40582 throw TypeError("Illegal target: Not a ByteBuffer");
40583 }
40584 targetOffset = (targetRelative = typeof targetOffset === 'undefined') ? target.offset : targetOffset | 0;
40585 sourceOffset = (relative = typeof sourceOffset === 'undefined') ? this.offset : sourceOffset | 0;
40586 sourceLimit = typeof sourceLimit === 'undefined' ? this.limit : sourceLimit | 0;
40587
40588 if (targetOffset < 0 || targetOffset > target.buffer.byteLength)
40589 throw RangeError("Illegal target range: 0 <= "+targetOffset+" <= "+target.buffer.byteLength);
40590 if (sourceOffset < 0 || sourceLimit > this.buffer.byteLength)
40591 throw RangeError("Illegal source range: 0 <= "+sourceOffset+" <= "+this.buffer.byteLength);
40592
40593 var len = sourceLimit - sourceOffset;
40594 if (len === 0)
40595 return target; // Nothing to copy
40596
40597 target.ensureCapacity(targetOffset + len);
40598
40599 target.view.set(this.view.subarray(sourceOffset, sourceLimit), targetOffset);
40600
40601 if (relative) this.offset += len;
40602 if (targetRelative) target.offset += len;
40603
40604 return this;
40605 };
40606
40607 /**
40608 * Makes sure that this ByteBuffer is backed by a {@link ByteBuffer#buffer} of at least the specified capacity. If the
40609 * current capacity is exceeded, it will be doubled. If double the current capacity is less than the required capacity,
40610 * the required capacity will be used instead.
40611 * @param {number} capacity Required capacity
40612 * @returns {!ByteBuffer} this
40613 * @expose
40614 */
40615 ByteBufferPrototype.ensureCapacity = function(capacity) {
40616 var current = this.buffer.byteLength;
40617 if (current < capacity)
40618 return this.resize((current *= 2) > capacity ? current : capacity);
40619 return this;
40620 };
40621
40622 /**
40623 * Overwrites this ByteBuffer's contents with the specified value. Contents are the bytes between
40624 * {@link ByteBuffer#offset} and {@link ByteBuffer#limit}.
40625 * @param {number|string} value Byte value to fill with. If given as a string, the first character is used.
40626 * @param {number=} begin Begin offset. Will use and increase {@link ByteBuffer#offset} by the number of bytes
40627 * written if omitted. defaults to {@link ByteBuffer#offset}.
40628 * @param {number=} end End offset, defaults to {@link ByteBuffer#limit}.
40629 * @returns {!ByteBuffer} this
40630 * @expose
40631 * @example `someByteBuffer.clear().fill(0)` fills the entire backing buffer with zeroes
40632 */
40633 ByteBufferPrototype.fill = function(value, begin, end) {
40634 var relative = typeof begin === 'undefined';
40635 if (relative) begin = this.offset;
40636 if (typeof value === 'string' && value.length > 0)
40637 value = value.charCodeAt(0);
40638 if (typeof begin === 'undefined') begin = this.offset;
40639 if (typeof end === 'undefined') end = this.limit;
40640 if (!this.noAssert) {
40641 if (typeof value !== 'number' || value % 1 !== 0)
40642 throw TypeError("Illegal value: "+value+" (not an integer)");
40643 value |= 0;
40644 if (typeof begin !== 'number' || begin % 1 !== 0)
40645 throw TypeError("Illegal begin: Not an integer");
40646 begin >>>= 0;
40647 if (typeof end !== 'number' || end % 1 !== 0)
40648 throw TypeError("Illegal end: Not an integer");
40649 end >>>= 0;
40650 if (begin < 0 || begin > end || end > this.buffer.byteLength)
40651 throw RangeError("Illegal range: 0 <= "+begin+" <= "+end+" <= "+this.buffer.byteLength);
40652 }
40653 if (begin >= end)
40654 return this; // Nothing to fill
40655 while (begin < end) this.view[begin++] = value;
40656 if (relative) this.offset = begin;
40657 return this;
40658 };
40659
40660 /**
40661 * Makes this ByteBuffer ready for a new sequence of write or relative read operations. Sets `limit = offset` and
40662 * `offset = 0`. Make sure always to flip a ByteBuffer when all relative read or write operations are complete.
40663 * @returns {!ByteBuffer} this
40664 * @expose
40665 */
40666 ByteBufferPrototype.flip = function() {
40667 this.limit = this.offset;
40668 this.offset = 0;
40669 return this;
40670 };
40671 /**
40672 * Marks an offset on this ByteBuffer to be used later.
40673 * @param {number=} offset Offset to mark. Defaults to {@link ByteBuffer#offset}.
40674 * @returns {!ByteBuffer} this
40675 * @throws {TypeError} If `offset` is not a valid number
40676 * @throws {RangeError} If `offset` is out of bounds
40677 * @see ByteBuffer#reset
40678 * @expose
40679 */
40680 ByteBufferPrototype.mark = function(offset) {
40681 offset = typeof offset === 'undefined' ? this.offset : offset;
40682 if (!this.noAssert) {
40683 if (typeof offset !== 'number' || offset % 1 !== 0)
40684 throw TypeError("Illegal offset: "+offset+" (not an integer)");
40685 offset >>>= 0;
40686 if (offset < 0 || offset + 0 > this.buffer.byteLength)
40687 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
40688 }
40689 this.markedOffset = offset;
40690 return this;
40691 };
40692 /**
40693 * Sets the byte order.
40694 * @param {boolean} littleEndian `true` for little endian byte order, `false` for big endian
40695 * @returns {!ByteBuffer} this
40696 * @expose
40697 */
40698 ByteBufferPrototype.order = function(littleEndian) {
40699 if (!this.noAssert) {
40700 if (typeof littleEndian !== 'boolean')
40701 throw TypeError("Illegal littleEndian: Not a boolean");
40702 }
40703 this.littleEndian = !!littleEndian;
40704 return this;
40705 };
40706
40707 /**
40708 * Switches (to) little endian byte order.
40709 * @param {boolean=} littleEndian Defaults to `true`, otherwise uses big endian
40710 * @returns {!ByteBuffer} this
40711 * @expose
40712 */
40713 ByteBufferPrototype.LE = function(littleEndian) {
40714 this.littleEndian = typeof littleEndian !== 'undefined' ? !!littleEndian : true;
40715 return this;
40716 };
40717
40718 /**
40719 * Switches (to) big endian byte order.
40720 * @param {boolean=} bigEndian Defaults to `true`, otherwise uses little endian
40721 * @returns {!ByteBuffer} this
40722 * @expose
40723 */
40724 ByteBufferPrototype.BE = function(bigEndian) {
40725 this.littleEndian = typeof bigEndian !== 'undefined' ? !bigEndian : false;
40726 return this;
40727 };
40728 /**
40729 * Prepends some data to this ByteBuffer. This will overwrite any contents before the specified offset up to the
40730 * prepended data's length. If there is not enough space available before the specified `offset`, the backing buffer
40731 * will be resized and its contents moved accordingly.
40732 * @param {!ByteBuffer|string|!ArrayBuffer} source Data to prepend. If `source` is a ByteBuffer, its offset will be
40733 * modified according to the performed read operation.
40734 * @param {(string|number)=} encoding Encoding if `data` is a string ("base64", "hex", "binary", defaults to "utf8")
40735 * @param {number=} offset Offset to prepend at. Will use and decrease {@link ByteBuffer#offset} by the number of bytes
40736 * prepended if omitted.
40737 * @returns {!ByteBuffer} this
40738 * @expose
40739 * @example A relative `00<01 02 03>.prepend(<04 05>)` results in `<04 05 01 02 03>, 04 05|`
40740 * @example An absolute `00<01 02 03>.prepend(<04 05>, 2)` results in `04<05 02 03>, 04 05|`
40741 */
40742 ByteBufferPrototype.prepend = function(source, encoding, offset) {
40743 if (typeof encoding === 'number' || typeof encoding !== 'string') {
40744 offset = encoding;
40745 encoding = undefined;
40746 }
40747 var relative = typeof offset === 'undefined';
40748 if (relative) offset = this.offset;
40749 if (!this.noAssert) {
40750 if (typeof offset !== 'number' || offset % 1 !== 0)
40751 throw TypeError("Illegal offset: "+offset+" (not an integer)");
40752 offset >>>= 0;
40753 if (offset < 0 || offset + 0 > this.buffer.byteLength)
40754 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
40755 }
40756 if (!(source instanceof ByteBuffer))
40757 source = ByteBuffer.wrap(source, encoding);
40758 var len = source.limit - source.offset;
40759 if (len <= 0) return this; // Nothing to prepend
40760 var diff = len - offset;
40761 if (diff > 0) { // Not enough space before offset, so resize + move
40762 var buffer = new ArrayBuffer(this.buffer.byteLength + diff);
40763 var view = new Uint8Array(buffer);
40764 view.set(this.view.subarray(offset, this.buffer.byteLength), len);
40765 this.buffer = buffer;
40766 this.view = view;
40767 this.offset += diff;
40768 if (this.markedOffset >= 0) this.markedOffset += diff;
40769 this.limit += diff;
40770 offset += diff;
40771 } else {
40772 var arrayView = new Uint8Array(this.buffer);
40773 }
40774 this.view.set(source.view.subarray(source.offset, source.limit), offset - len);
40775
40776 source.offset = source.limit;
40777 if (relative)
40778 this.offset -= len;
40779 return this;
40780 };
40781
40782 /**
40783 * Prepends this ByteBuffer to another ByteBuffer. This will overwrite any contents before the specified offset up to the
40784 * prepended data's length. If there is not enough space available before the specified `offset`, the backing buffer
40785 * will be resized and its contents moved accordingly.
40786 * @param {!ByteBuffer} target Target ByteBuffer
40787 * @param {number=} offset Offset to prepend at. Will use and decrease {@link ByteBuffer#offset} by the number of bytes
40788 * prepended if omitted.
40789 * @returns {!ByteBuffer} this
40790 * @expose
40791 * @see ByteBuffer#prepend
40792 */
40793 ByteBufferPrototype.prependTo = function(target, offset) {
40794 target.prepend(this, offset);
40795 return this;
40796 };
40797 /**
40798 * Prints debug information about this ByteBuffer's contents.
40799 * @param {function(string)=} out Output function to call, defaults to console.log
40800 * @expose
40801 */
40802 ByteBufferPrototype.printDebug = function(out) {
40803 if (typeof out !== 'function') out = console.log.bind(console);
40804 out(
40805 this.toString()+"\n"+
40806 "-------------------------------------------------------------------\n"+
40807 this.toDebug(/* columns */ true)
40808 );
40809 };
40810
40811 /**
40812 * Gets the number of remaining readable bytes. Contents are the bytes between {@link ByteBuffer#offset} and
40813 * {@link ByteBuffer#limit}, so this returns `limit - offset`.
40814 * @returns {number} Remaining readable bytes. May be negative if `offset > limit`.
40815 * @expose
40816 */
40817 ByteBufferPrototype.remaining = function() {
40818 return this.limit - this.offset;
40819 };
40820 /**
40821 * Resets this ByteBuffer's {@link ByteBuffer#offset}. If an offset has been marked through {@link ByteBuffer#mark}
40822 * before, `offset` will be set to {@link ByteBuffer#markedOffset}, which will then be discarded. If no offset has been
40823 * marked, sets `offset = 0`.
40824 * @returns {!ByteBuffer} this
40825 * @see ByteBuffer#mark
40826 * @expose
40827 */
40828 ByteBufferPrototype.reset = function() {
40829 if (this.markedOffset >= 0) {
40830 this.offset = this.markedOffset;
40831 this.markedOffset = -1;
40832 } else {
40833 this.offset = 0;
40834 }
40835 return this;
40836 };
40837 /**
40838 * Resizes this ByteBuffer to be backed by a buffer of at least the given capacity. Will do nothing if already that
40839 * large or larger.
40840 * @param {number} capacity Capacity required
40841 * @returns {!ByteBuffer} this
40842 * @throws {TypeError} If `capacity` is not a number
40843 * @throws {RangeError} If `capacity < 0`
40844 * @expose
40845 */
40846 ByteBufferPrototype.resize = function(capacity) {
40847 if (!this.noAssert) {
40848 if (typeof capacity !== 'number' || capacity % 1 !== 0)
40849 throw TypeError("Illegal capacity: "+capacity+" (not an integer)");
40850 capacity |= 0;
40851 if (capacity < 0)
40852 throw RangeError("Illegal capacity: 0 <= "+capacity);
40853 }
40854 if (this.buffer.byteLength < capacity) {
40855 var buffer = new ArrayBuffer(capacity);
40856 var view = new Uint8Array(buffer);
40857 view.set(this.view);
40858 this.buffer = buffer;
40859 this.view = view;
40860 }
40861 return this;
40862 };
40863 /**
40864 * Reverses this ByteBuffer's contents.
40865 * @param {number=} begin Offset to start at, defaults to {@link ByteBuffer#offset}
40866 * @param {number=} end Offset to end at, defaults to {@link ByteBuffer#limit}
40867 * @returns {!ByteBuffer} this
40868 * @expose
40869 */
40870 ByteBufferPrototype.reverse = function(begin, end) {
40871 if (typeof begin === 'undefined') begin = this.offset;
40872 if (typeof end === 'undefined') end = this.limit;
40873 if (!this.noAssert) {
40874 if (typeof begin !== 'number' || begin % 1 !== 0)
40875 throw TypeError("Illegal begin: Not an integer");
40876 begin >>>= 0;
40877 if (typeof end !== 'number' || end % 1 !== 0)
40878 throw TypeError("Illegal end: Not an integer");
40879 end >>>= 0;
40880 if (begin < 0 || begin > end || end > this.buffer.byteLength)
40881 throw RangeError("Illegal range: 0 <= "+begin+" <= "+end+" <= "+this.buffer.byteLength);
40882 }
40883 if (begin === end)
40884 return this; // Nothing to reverse
40885 Array.prototype.reverse.call(this.view.subarray(begin, end));
40886 return this;
40887 };
40888 /**
40889 * Skips the next `length` bytes. This will just advance
40890 * @param {number} length Number of bytes to skip. May also be negative to move the offset back.
40891 * @returns {!ByteBuffer} this
40892 * @expose
40893 */
40894 ByteBufferPrototype.skip = function(length) {
40895 if (!this.noAssert) {
40896 if (typeof length !== 'number' || length % 1 !== 0)
40897 throw TypeError("Illegal length: "+length+" (not an integer)");
40898 length |= 0;
40899 }
40900 var offset = this.offset + length;
40901 if (!this.noAssert) {
40902 if (offset < 0 || offset > this.buffer.byteLength)
40903 throw RangeError("Illegal length: 0 <= "+this.offset+" + "+length+" <= "+this.buffer.byteLength);
40904 }
40905 this.offset = offset;
40906 return this;
40907 };
40908
40909 /**
40910 * Slices this ByteBuffer by creating a cloned instance with `offset = begin` and `limit = end`.
40911 * @param {number=} begin Begin offset, defaults to {@link ByteBuffer#offset}.
40912 * @param {number=} end End offset, defaults to {@link ByteBuffer#limit}.
40913 * @returns {!ByteBuffer} Clone of this ByteBuffer with slicing applied, backed by the same {@link ByteBuffer#buffer}
40914 * @expose
40915 */
40916 ByteBufferPrototype.slice = function(begin, end) {
40917 if (typeof begin === 'undefined') begin = this.offset;
40918 if (typeof end === 'undefined') end = this.limit;
40919 if (!this.noAssert) {
40920 if (typeof begin !== 'number' || begin % 1 !== 0)
40921 throw TypeError("Illegal begin: Not an integer");
40922 begin >>>= 0;
40923 if (typeof end !== 'number' || end % 1 !== 0)
40924 throw TypeError("Illegal end: Not an integer");
40925 end >>>= 0;
40926 if (begin < 0 || begin > end || end > this.buffer.byteLength)
40927 throw RangeError("Illegal range: 0 <= "+begin+" <= "+end+" <= "+this.buffer.byteLength);
40928 }
40929 var bb = this.clone();
40930 bb.offset = begin;
40931 bb.limit = end;
40932 return bb;
40933 };
40934 /**
40935 * Returns a copy of the backing buffer that contains this ByteBuffer's contents. Contents are the bytes between
40936 * {@link ByteBuffer#offset} and {@link ByteBuffer#limit}.
40937 * @param {boolean=} forceCopy If `true` returns a copy, otherwise returns a view referencing the same memory if
40938 * possible. Defaults to `false`
40939 * @returns {!ArrayBuffer} Contents as an ArrayBuffer
40940 * @expose
40941 */
40942 ByteBufferPrototype.toBuffer = function(forceCopy) {
40943 var offset = this.offset,
40944 limit = this.limit;
40945 if (!this.noAssert) {
40946 if (typeof offset !== 'number' || offset % 1 !== 0)
40947 throw TypeError("Illegal offset: Not an integer");
40948 offset >>>= 0;
40949 if (typeof limit !== 'number' || limit % 1 !== 0)
40950 throw TypeError("Illegal limit: Not an integer");
40951 limit >>>= 0;
40952 if (offset < 0 || offset > limit || limit > this.buffer.byteLength)
40953 throw RangeError("Illegal range: 0 <= "+offset+" <= "+limit+" <= "+this.buffer.byteLength);
40954 }
40955 // NOTE: It's not possible to have another ArrayBuffer reference the same memory as the backing buffer. This is
40956 // possible with Uint8Array#subarray only, but we have to return an ArrayBuffer by contract. So:
40957 if (!forceCopy && offset === 0 && limit === this.buffer.byteLength)
40958 return this.buffer;
40959 if (offset === limit)
40960 return EMPTY_BUFFER;
40961 var buffer = new ArrayBuffer(limit - offset);
40962 new Uint8Array(buffer).set(new Uint8Array(this.buffer).subarray(offset, limit), 0);
40963 return buffer;
40964 };
40965
40966 /**
40967 * Returns a raw buffer compacted to contain this ByteBuffer's contents. Contents are the bytes between
40968 * {@link ByteBuffer#offset} and {@link ByteBuffer#limit}. This is an alias of {@link ByteBuffer#toBuffer}.
40969 * @function
40970 * @param {boolean=} forceCopy If `true` returns a copy, otherwise returns a view referencing the same memory.
40971 * Defaults to `false`
40972 * @returns {!ArrayBuffer} Contents as an ArrayBuffer
40973 * @expose
40974 */
40975 ByteBufferPrototype.toArrayBuffer = ByteBufferPrototype.toBuffer;
40976
40977 /**
40978 * Converts the ByteBuffer's contents to a string.
40979 * @param {string=} encoding Output encoding. Returns an informative string representation if omitted but also allows
40980 * direct conversion to "utf8", "hex", "base64" and "binary" encoding. "debug" returns a hex representation with
40981 * highlighted offsets.
40982 * @param {number=} begin Offset to begin at, defaults to {@link ByteBuffer#offset}
40983 * @param {number=} end Offset to end at, defaults to {@link ByteBuffer#limit}
40984 * @returns {string} String representation
40985 * @throws {Error} If `encoding` is invalid
40986 * @expose
40987 */
40988 ByteBufferPrototype.toString = function(encoding, begin, end) {
40989 if (typeof encoding === 'undefined')
40990 return "ByteBufferAB(offset="+this.offset+",markedOffset="+this.markedOffset+",limit="+this.limit+",capacity="+this.capacity()+")";
40991 if (typeof encoding === 'number')
40992 encoding = "utf8",
40993 begin = encoding,
40994 end = begin;
40995 switch (encoding) {
40996 case "utf8":
40997 return this.toUTF8(begin, end);
40998 case "base64":
40999 return this.toBase64(begin, end);
41000 case "hex":
41001 return this.toHex(begin, end);
41002 case "binary":
41003 return this.toBinary(begin, end);
41004 case "debug":
41005 return this.toDebug();
41006 case "columns":
41007 return this.toColumns();
41008 default:
41009 throw Error("Unsupported encoding: "+encoding);
41010 }
41011 };
41012
41013 // lxiv-embeddable
41014
41015 /**
41016 * lxiv-embeddable (c) 2014 Daniel Wirtz <dcode@dcode.io>
41017 * Released under the Apache License, Version 2.0
41018 * see: https://github.com/dcodeIO/lxiv for details
41019 */
41020 var lxiv = function() {
41021 "use strict";
41022
41023 /**
41024 * lxiv namespace.
41025 * @type {!Object.<string,*>}
41026 * @exports lxiv
41027 */
41028 var lxiv = {};
41029
41030 /**
41031 * Character codes for output.
41032 * @type {!Array.<number>}
41033 * @inner
41034 */
41035 var aout = [
41036 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
41037 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 97, 98, 99, 100, 101, 102,
41038 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118,
41039 119, 120, 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 43, 47
41040 ];
41041
41042 /**
41043 * Character codes for input.
41044 * @type {!Array.<number>}
41045 * @inner
41046 */
41047 var ain = [];
41048 for (var i=0, k=aout.length; i<k; ++i)
41049 ain[aout[i]] = i;
41050
41051 /**
41052 * Encodes bytes to base64 char codes.
41053 * @param {!function():number|null} src Bytes source as a function returning the next byte respectively `null` if
41054 * there are no more bytes left.
41055 * @param {!function(number)} dst Characters destination as a function successively called with each encoded char
41056 * code.
41057 */
41058 lxiv.encode = function(src, dst) {
41059 var b, t;
41060 while ((b = src()) !== null) {
41061 dst(aout[(b>>2)&0x3f]);
41062 t = (b&0x3)<<4;
41063 if ((b = src()) !== null) {
41064 t |= (b>>4)&0xf;
41065 dst(aout[(t|((b>>4)&0xf))&0x3f]);
41066 t = (b&0xf)<<2;
41067 if ((b = src()) !== null)
41068 dst(aout[(t|((b>>6)&0x3))&0x3f]),
41069 dst(aout[b&0x3f]);
41070 else
41071 dst(aout[t&0x3f]),
41072 dst(61);
41073 } else
41074 dst(aout[t&0x3f]),
41075 dst(61),
41076 dst(61);
41077 }
41078 };
41079
41080 /**
41081 * Decodes base64 char codes to bytes.
41082 * @param {!function():number|null} src Characters source as a function returning the next char code respectively
41083 * `null` if there are no more characters left.
41084 * @param {!function(number)} dst Bytes destination as a function successively called with the next byte.
41085 * @throws {Error} If a character code is invalid
41086 */
41087 lxiv.decode = function(src, dst) {
41088 var c, t1, t2;
41089 function fail(c) {
41090 throw Error("Illegal character code: "+c);
41091 }
41092 while ((c = src()) !== null) {
41093 t1 = ain[c];
41094 if (typeof t1 === 'undefined') fail(c);
41095 if ((c = src()) !== null) {
41096 t2 = ain[c];
41097 if (typeof t2 === 'undefined') fail(c);
41098 dst((t1<<2)>>>0|(t2&0x30)>>4);
41099 if ((c = src()) !== null) {
41100 t1 = ain[c];
41101 if (typeof t1 === 'undefined')
41102 if (c === 61) break; else fail(c);
41103 dst(((t2&0xf)<<4)>>>0|(t1&0x3c)>>2);
41104 if ((c = src()) !== null) {
41105 t2 = ain[c];
41106 if (typeof t2 === 'undefined')
41107 if (c === 61) break; else fail(c);
41108 dst(((t1&0x3)<<6)>>>0|t2);
41109 }
41110 }
41111 }
41112 }
41113 };
41114
41115 /**
41116 * Tests if a string is valid base64.
41117 * @param {string} str String to test
41118 * @returns {boolean} `true` if valid, otherwise `false`
41119 */
41120 lxiv.test = function(str) {
41121 return /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(str);
41122 };
41123
41124 return lxiv;
41125 }();
41126
41127 // encodings/base64
41128
41129 /**
41130 * Encodes this ByteBuffer's contents to a base64 encoded string.
41131 * @param {number=} begin Offset to begin at, defaults to {@link ByteBuffer#offset}.
41132 * @param {number=} end Offset to end at, defaults to {@link ByteBuffer#limit}.
41133 * @returns {string} Base64 encoded string
41134 * @throws {RangeError} If `begin` or `end` is out of bounds
41135 * @expose
41136 */
41137 ByteBufferPrototype.toBase64 = function(begin, end) {
41138 if (typeof begin === 'undefined')
41139 begin = this.offset;
41140 if (typeof end === 'undefined')
41141 end = this.limit;
41142 begin = begin | 0; end = end | 0;
41143 if (begin < 0 || end > this.capacity || begin > end)
41144 throw RangeError("begin, end");
41145 var sd; lxiv.encode(function() {
41146 return begin < end ? this.view[begin++] : null;
41147 }.bind(this), sd = stringDestination());
41148 return sd();
41149 };
41150
41151 /**
41152 * Decodes a base64 encoded string to a ByteBuffer.
41153 * @param {string} str String to decode
41154 * @param {boolean=} littleEndian Whether to use little or big endian byte order. Defaults to
41155 * {@link ByteBuffer.DEFAULT_ENDIAN}.
41156 * @returns {!ByteBuffer} ByteBuffer
41157 * @expose
41158 */
41159 ByteBuffer.fromBase64 = function(str, littleEndian) {
41160 if (typeof str !== 'string')
41161 throw TypeError("str");
41162 var bb = new ByteBuffer(str.length/4*3, littleEndian),
41163 i = 0;
41164 lxiv.decode(stringSource(str), function(b) {
41165 bb.view[i++] = b;
41166 });
41167 bb.limit = i;
41168 return bb;
41169 };
41170
41171 /**
41172 * Encodes a binary string to base64 like `window.btoa` does.
41173 * @param {string} str Binary string
41174 * @returns {string} Base64 encoded string
41175 * @see https://developer.mozilla.org/en-US/docs/Web/API/Window.btoa
41176 * @expose
41177 */
41178 ByteBuffer.btoa = function(str) {
41179 return ByteBuffer.fromBinary(str).toBase64();
41180 };
41181
41182 /**
41183 * Decodes a base64 encoded string to binary like `window.atob` does.
41184 * @param {string} b64 Base64 encoded string
41185 * @returns {string} Binary string
41186 * @see https://developer.mozilla.org/en-US/docs/Web/API/Window.atob
41187 * @expose
41188 */
41189 ByteBuffer.atob = function(b64) {
41190 return ByteBuffer.fromBase64(b64).toBinary();
41191 };
41192
41193 // encodings/binary
41194
41195 /**
41196 * Encodes this ByteBuffer to a binary encoded string, that is using only characters 0x00-0xFF as bytes.
41197 * @param {number=} begin Offset to begin at. Defaults to {@link ByteBuffer#offset}.
41198 * @param {number=} end Offset to end at. Defaults to {@link ByteBuffer#limit}.
41199 * @returns {string} Binary encoded string
41200 * @throws {RangeError} If `offset > limit`
41201 * @expose
41202 */
41203 ByteBufferPrototype.toBinary = function(begin, end) {
41204 if (typeof begin === 'undefined')
41205 begin = this.offset;
41206 if (typeof end === 'undefined')
41207 end = this.limit;
41208 begin |= 0; end |= 0;
41209 if (begin < 0 || end > this.capacity() || begin > end)
41210 throw RangeError("begin, end");
41211 if (begin === end)
41212 return "";
41213 var chars = [],
41214 parts = [];
41215 while (begin < end) {
41216 chars.push(this.view[begin++]);
41217 if (chars.length >= 1024)
41218 parts.push(String.fromCharCode.apply(String, chars)),
41219 chars = [];
41220 }
41221 return parts.join('') + String.fromCharCode.apply(String, chars);
41222 };
41223
41224 /**
41225 * Decodes a binary encoded string, that is using only characters 0x00-0xFF as bytes, to a ByteBuffer.
41226 * @param {string} str String to decode
41227 * @param {boolean=} littleEndian Whether to use little or big endian byte order. Defaults to
41228 * {@link ByteBuffer.DEFAULT_ENDIAN}.
41229 * @returns {!ByteBuffer} ByteBuffer
41230 * @expose
41231 */
41232 ByteBuffer.fromBinary = function(str, littleEndian) {
41233 if (typeof str !== 'string')
41234 throw TypeError("str");
41235 var i = 0,
41236 k = str.length,
41237 charCode,
41238 bb = new ByteBuffer(k, littleEndian);
41239 while (i<k) {
41240 charCode = str.charCodeAt(i);
41241 if (charCode > 0xff)
41242 throw RangeError("illegal char code: "+charCode);
41243 bb.view[i++] = charCode;
41244 }
41245 bb.limit = k;
41246 return bb;
41247 };
41248
41249 // encodings/debug
41250
41251 /**
41252 * Encodes this ByteBuffer to a hex encoded string with marked offsets. Offset symbols are:
41253 * * `<` : offset,
41254 * * `'` : markedOffset,
41255 * * `>` : limit,
41256 * * `|` : offset and limit,
41257 * * `[` : offset and markedOffset,
41258 * * `]` : markedOffset and limit,
41259 * * `!` : offset, markedOffset and limit
41260 * @param {boolean=} columns If `true` returns two columns hex + ascii, defaults to `false`
41261 * @returns {string|!Array.<string>} Debug string or array of lines if `asArray = true`
41262 * @expose
41263 * @example `>00'01 02<03` contains four bytes with `limit=0, markedOffset=1, offset=3`
41264 * @example `00[01 02 03>` contains four bytes with `offset=markedOffset=1, limit=4`
41265 * @example `00|01 02 03` contains four bytes with `offset=limit=1, markedOffset=-1`
41266 * @example `|` contains zero bytes with `offset=limit=0, markedOffset=-1`
41267 */
41268 ByteBufferPrototype.toDebug = function(columns) {
41269 var i = -1,
41270 k = this.buffer.byteLength,
41271 b,
41272 hex = "",
41273 asc = "",
41274 out = "";
41275 while (i<k) {
41276 if (i !== -1) {
41277 b = this.view[i];
41278 if (b < 0x10) hex += "0"+b.toString(16).toUpperCase();
41279 else hex += b.toString(16).toUpperCase();
41280 if (columns)
41281 asc += b > 32 && b < 127 ? String.fromCharCode(b) : '.';
41282 }
41283 ++i;
41284 if (columns) {
41285 if (i > 0 && i % 16 === 0 && i !== k) {
41286 while (hex.length < 3*16+3) hex += " ";
41287 out += hex+asc+"\n";
41288 hex = asc = "";
41289 }
41290 }
41291 if (i === this.offset && i === this.limit)
41292 hex += i === this.markedOffset ? "!" : "|";
41293 else if (i === this.offset)
41294 hex += i === this.markedOffset ? "[" : "<";
41295 else if (i === this.limit)
41296 hex += i === this.markedOffset ? "]" : ">";
41297 else
41298 hex += i === this.markedOffset ? "'" : (columns || (i !== 0 && i !== k) ? " " : "");
41299 }
41300 if (columns && hex !== " ") {
41301 while (hex.length < 3*16+3)
41302 hex += " ";
41303 out += hex + asc + "\n";
41304 }
41305 return columns ? out : hex;
41306 };
41307
41308 /**
41309 * Decodes a hex encoded string with marked offsets to a ByteBuffer.
41310 * @param {string} str Debug string to decode (not be generated with `columns = true`)
41311 * @param {boolean=} littleEndian Whether to use little or big endian byte order. Defaults to
41312 * {@link ByteBuffer.DEFAULT_ENDIAN}.
41313 * @param {boolean=} noAssert Whether to skip assertions of offsets and values. Defaults to
41314 * {@link ByteBuffer.DEFAULT_NOASSERT}.
41315 * @returns {!ByteBuffer} ByteBuffer
41316 * @expose
41317 * @see ByteBuffer#toDebug
41318 */
41319 ByteBuffer.fromDebug = function(str, littleEndian, noAssert) {
41320 var k = str.length,
41321 bb = new ByteBuffer(((k+1)/3)|0, littleEndian, noAssert);
41322 var i = 0, j = 0, ch, b,
41323 rs = false, // Require symbol next
41324 ho = false, hm = false, hl = false, // Already has offset (ho), markedOffset (hm), limit (hl)?
41325 fail = false;
41326 while (i<k) {
41327 switch (ch = str.charAt(i++)) {
41328 case '!':
41329 if (!noAssert) {
41330 if (ho || hm || hl) {
41331 fail = true;
41332 break;
41333 }
41334 ho = hm = hl = true;
41335 }
41336 bb.offset = bb.markedOffset = bb.limit = j;
41337 rs = false;
41338 break;
41339 case '|':
41340 if (!noAssert) {
41341 if (ho || hl) {
41342 fail = true;
41343 break;
41344 }
41345 ho = hl = true;
41346 }
41347 bb.offset = bb.limit = j;
41348 rs = false;
41349 break;
41350 case '[':
41351 if (!noAssert) {
41352 if (ho || hm) {
41353 fail = true;
41354 break;
41355 }
41356 ho = hm = true;
41357 }
41358 bb.offset = bb.markedOffset = j;
41359 rs = false;
41360 break;
41361 case '<':
41362 if (!noAssert) {
41363 if (ho) {
41364 fail = true;
41365 break;
41366 }
41367 ho = true;
41368 }
41369 bb.offset = j;
41370 rs = false;
41371 break;
41372 case ']':
41373 if (!noAssert) {
41374 if (hl || hm) {
41375 fail = true;
41376 break;
41377 }
41378 hl = hm = true;
41379 }
41380 bb.limit = bb.markedOffset = j;
41381 rs = false;
41382 break;
41383 case '>':
41384 if (!noAssert) {
41385 if (hl) {
41386 fail = true;
41387 break;
41388 }
41389 hl = true;
41390 }
41391 bb.limit = j;
41392 rs = false;
41393 break;
41394 case "'":
41395 if (!noAssert) {
41396 if (hm) {
41397 fail = true;
41398 break;
41399 }
41400 hm = true;
41401 }
41402 bb.markedOffset = j;
41403 rs = false;
41404 break;
41405 case ' ':
41406 rs = false;
41407 break;
41408 default:
41409 if (!noAssert) {
41410 if (rs) {
41411 fail = true;
41412 break;
41413 }
41414 }
41415 b = parseInt(ch+str.charAt(i++), 16);
41416 if (!noAssert) {
41417 if (isNaN(b) || b < 0 || b > 255)
41418 throw TypeError("Illegal str: Not a debug encoded string");
41419 }
41420 bb.view[j++] = b;
41421 rs = true;
41422 }
41423 if (fail)
41424 throw TypeError("Illegal str: Invalid symbol at "+i);
41425 }
41426 if (!noAssert) {
41427 if (!ho || !hl)
41428 throw TypeError("Illegal str: Missing offset or limit");
41429 if (j<bb.buffer.byteLength)
41430 throw TypeError("Illegal str: Not a debug encoded string (is it hex?) "+j+" < "+k);
41431 }
41432 return bb;
41433 };
41434
41435 // encodings/hex
41436
41437 /**
41438 * Encodes this ByteBuffer's contents to a hex encoded string.
41439 * @param {number=} begin Offset to begin at. Defaults to {@link ByteBuffer#offset}.
41440 * @param {number=} end Offset to end at. Defaults to {@link ByteBuffer#limit}.
41441 * @returns {string} Hex encoded string
41442 * @expose
41443 */
41444 ByteBufferPrototype.toHex = function(begin, end) {
41445 begin = typeof begin === 'undefined' ? this.offset : begin;
41446 end = typeof end === 'undefined' ? this.limit : end;
41447 if (!this.noAssert) {
41448 if (typeof begin !== 'number' || begin % 1 !== 0)
41449 throw TypeError("Illegal begin: Not an integer");
41450 begin >>>= 0;
41451 if (typeof end !== 'number' || end % 1 !== 0)
41452 throw TypeError("Illegal end: Not an integer");
41453 end >>>= 0;
41454 if (begin < 0 || begin > end || end > this.buffer.byteLength)
41455 throw RangeError("Illegal range: 0 <= "+begin+" <= "+end+" <= "+this.buffer.byteLength);
41456 }
41457 var out = new Array(end - begin),
41458 b;
41459 while (begin < end) {
41460 b = this.view[begin++];
41461 if (b < 0x10)
41462 out.push("0", b.toString(16));
41463 else out.push(b.toString(16));
41464 }
41465 return out.join('');
41466 };
41467
41468 /**
41469 * Decodes a hex encoded string to a ByteBuffer.
41470 * @param {string} str String to decode
41471 * @param {boolean=} littleEndian Whether to use little or big endian byte order. Defaults to
41472 * {@link ByteBuffer.DEFAULT_ENDIAN}.
41473 * @param {boolean=} noAssert Whether to skip assertions of offsets and values. Defaults to
41474 * {@link ByteBuffer.DEFAULT_NOASSERT}.
41475 * @returns {!ByteBuffer} ByteBuffer
41476 * @expose
41477 */
41478 ByteBuffer.fromHex = function(str, littleEndian, noAssert) {
41479 if (!noAssert) {
41480 if (typeof str !== 'string')
41481 throw TypeError("Illegal str: Not a string");
41482 if (str.length % 2 !== 0)
41483 throw TypeError("Illegal str: Length not a multiple of 2");
41484 }
41485 var k = str.length,
41486 bb = new ByteBuffer((k / 2) | 0, littleEndian),
41487 b;
41488 for (var i=0, j=0; i<k; i+=2) {
41489 b = parseInt(str.substring(i, i+2), 16);
41490 if (!noAssert)
41491 if (!isFinite(b) || b < 0 || b > 255)
41492 throw TypeError("Illegal str: Contains non-hex characters");
41493 bb.view[j++] = b;
41494 }
41495 bb.limit = j;
41496 return bb;
41497 };
41498
41499 // utfx-embeddable
41500
41501 /**
41502 * utfx-embeddable (c) 2014 Daniel Wirtz <dcode@dcode.io>
41503 * Released under the Apache License, Version 2.0
41504 * see: https://github.com/dcodeIO/utfx for details
41505 */
41506 var utfx = function() {
41507 "use strict";
41508
41509 /**
41510 * utfx namespace.
41511 * @inner
41512 * @type {!Object.<string,*>}
41513 */
41514 var utfx = {};
41515
41516 /**
41517 * Maximum valid code point.
41518 * @type {number}
41519 * @const
41520 */
41521 utfx.MAX_CODEPOINT = 0x10FFFF;
41522
41523 /**
41524 * Encodes UTF8 code points to UTF8 bytes.
41525 * @param {(!function():number|null) | number} src Code points source, either as a function returning the next code point
41526 * respectively `null` if there are no more code points left or a single numeric code point.
41527 * @param {!function(number)} dst Bytes destination as a function successively called with the next byte
41528 */
41529 utfx.encodeUTF8 = function(src, dst) {
41530 var cp = null;
41531 if (typeof src === 'number')
41532 cp = src,
41533 src = function() { return null; };
41534 while (cp !== null || (cp = src()) !== null) {
41535 if (cp < 0x80)
41536 dst(cp&0x7F);
41537 else if (cp < 0x800)
41538 dst(((cp>>6)&0x1F)|0xC0),
41539 dst((cp&0x3F)|0x80);
41540 else if (cp < 0x10000)
41541 dst(((cp>>12)&0x0F)|0xE0),
41542 dst(((cp>>6)&0x3F)|0x80),
41543 dst((cp&0x3F)|0x80);
41544 else
41545 dst(((cp>>18)&0x07)|0xF0),
41546 dst(((cp>>12)&0x3F)|0x80),
41547 dst(((cp>>6)&0x3F)|0x80),
41548 dst((cp&0x3F)|0x80);
41549 cp = null;
41550 }
41551 };
41552
41553 /**
41554 * Decodes UTF8 bytes to UTF8 code points.
41555 * @param {!function():number|null} src Bytes source as a function returning the next byte respectively `null` if there
41556 * are no more bytes left.
41557 * @param {!function(number)} dst Code points destination as a function successively called with each decoded code point.
41558 * @throws {RangeError} If a starting byte is invalid in UTF8
41559 * @throws {Error} If the last sequence is truncated. Has an array property `bytes` holding the
41560 * remaining bytes.
41561 */
41562 utfx.decodeUTF8 = function(src, dst) {
41563 var a, b, c, d, fail = function(b) {
41564 b = b.slice(0, b.indexOf(null));
41565 var err = Error(b.toString());
41566 err.name = "TruncatedError";
41567 err['bytes'] = b;
41568 throw err;
41569 };
41570 while ((a = src()) !== null) {
41571 if ((a&0x80) === 0)
41572 dst(a);
41573 else if ((a&0xE0) === 0xC0)
41574 ((b = src()) === null) && fail([a, b]),
41575 dst(((a&0x1F)<<6) | (b&0x3F));
41576 else if ((a&0xF0) === 0xE0)
41577 ((b=src()) === null || (c=src()) === null) && fail([a, b, c]),
41578 dst(((a&0x0F)<<12) | ((b&0x3F)<<6) | (c&0x3F));
41579 else if ((a&0xF8) === 0xF0)
41580 ((b=src()) === null || (c=src()) === null || (d=src()) === null) && fail([a, b, c ,d]),
41581 dst(((a&0x07)<<18) | ((b&0x3F)<<12) | ((c&0x3F)<<6) | (d&0x3F));
41582 else throw RangeError("Illegal starting byte: "+a);
41583 }
41584 };
41585
41586 /**
41587 * Converts UTF16 characters to UTF8 code points.
41588 * @param {!function():number|null} src Characters source as a function returning the next char code respectively
41589 * `null` if there are no more characters left.
41590 * @param {!function(number)} dst Code points destination as a function successively called with each converted code
41591 * point.
41592 */
41593 utfx.UTF16toUTF8 = function(src, dst) {
41594 var c1, c2 = null;
41595 while (true) {
41596 if ((c1 = c2 !== null ? c2 : src()) === null)
41597 break;
41598 if (c1 >= 0xD800 && c1 <= 0xDFFF) {
41599 if ((c2 = src()) !== null) {
41600 if (c2 >= 0xDC00 && c2 <= 0xDFFF) {
41601 dst((c1-0xD800)*0x400+c2-0xDC00+0x10000);
41602 c2 = null; continue;
41603 }
41604 }
41605 }
41606 dst(c1);
41607 }
41608 if (c2 !== null) dst(c2);
41609 };
41610
41611 /**
41612 * Converts UTF8 code points to UTF16 characters.
41613 * @param {(!function():number|null) | number} src Code points source, either as a function returning the next code point
41614 * respectively `null` if there are no more code points left or a single numeric code point.
41615 * @param {!function(number)} dst Characters destination as a function successively called with each converted char code.
41616 * @throws {RangeError} If a code point is out of range
41617 */
41618 utfx.UTF8toUTF16 = function(src, dst) {
41619 var cp = null;
41620 if (typeof src === 'number')
41621 cp = src, src = function() { return null; };
41622 while (cp !== null || (cp = src()) !== null) {
41623 if (cp <= 0xFFFF)
41624 dst(cp);
41625 else
41626 cp -= 0x10000,
41627 dst((cp>>10)+0xD800),
41628 dst((cp%0x400)+0xDC00);
41629 cp = null;
41630 }
41631 };
41632
41633 /**
41634 * Converts and encodes UTF16 characters to UTF8 bytes.
41635 * @param {!function():number|null} src Characters source as a function returning the next char code respectively `null`
41636 * if there are no more characters left.
41637 * @param {!function(number)} dst Bytes destination as a function successively called with the next byte.
41638 */
41639 utfx.encodeUTF16toUTF8 = function(src, dst) {
41640 utfx.UTF16toUTF8(src, function(cp) {
41641 utfx.encodeUTF8(cp, dst);
41642 });
41643 };
41644
41645 /**
41646 * Decodes and converts UTF8 bytes to UTF16 characters.
41647 * @param {!function():number|null} src Bytes source as a function returning the next byte respectively `null` if there
41648 * are no more bytes left.
41649 * @param {!function(number)} dst Characters destination as a function successively called with each converted char code.
41650 * @throws {RangeError} If a starting byte is invalid in UTF8
41651 * @throws {Error} If the last sequence is truncated. Has an array property `bytes` holding the remaining bytes.
41652 */
41653 utfx.decodeUTF8toUTF16 = function(src, dst) {
41654 utfx.decodeUTF8(src, function(cp) {
41655 utfx.UTF8toUTF16(cp, dst);
41656 });
41657 };
41658
41659 /**
41660 * Calculates the byte length of an UTF8 code point.
41661 * @param {number} cp UTF8 code point
41662 * @returns {number} Byte length
41663 */
41664 utfx.calculateCodePoint = function(cp) {
41665 return (cp < 0x80) ? 1 : (cp < 0x800) ? 2 : (cp < 0x10000) ? 3 : 4;
41666 };
41667
41668 /**
41669 * Calculates the number of UTF8 bytes required to store UTF8 code points.
41670 * @param {(!function():number|null)} src Code points source as a function returning the next code point respectively
41671 * `null` if there are no more code points left.
41672 * @returns {number} The number of UTF8 bytes required
41673 */
41674 utfx.calculateUTF8 = function(src) {
41675 var cp, l=0;
41676 while ((cp = src()) !== null)
41677 l += (cp < 0x80) ? 1 : (cp < 0x800) ? 2 : (cp < 0x10000) ? 3 : 4;
41678 return l;
41679 };
41680
41681 /**
41682 * Calculates the number of UTF8 code points respectively UTF8 bytes required to store UTF16 char codes.
41683 * @param {(!function():number|null)} src Characters source as a function returning the next char code respectively
41684 * `null` if there are no more characters left.
41685 * @returns {!Array.<number>} The number of UTF8 code points at index 0 and the number of UTF8 bytes required at index 1.
41686 */
41687 utfx.calculateUTF16asUTF8 = function(src) {
41688 var n=0, l=0;
41689 utfx.UTF16toUTF8(src, function(cp) {
41690 ++n; l += (cp < 0x80) ? 1 : (cp < 0x800) ? 2 : (cp < 0x10000) ? 3 : 4;
41691 });
41692 return [n,l];
41693 };
41694
41695 return utfx;
41696 }();
41697
41698 // encodings/utf8
41699
41700 /**
41701 * Encodes this ByteBuffer's contents between {@link ByteBuffer#offset} and {@link ByteBuffer#limit} to an UTF8 encoded
41702 * string.
41703 * @returns {string} Hex encoded string
41704 * @throws {RangeError} If `offset > limit`
41705 * @expose
41706 */
41707 ByteBufferPrototype.toUTF8 = function(begin, end) {
41708 if (typeof begin === 'undefined') begin = this.offset;
41709 if (typeof end === 'undefined') end = this.limit;
41710 if (!this.noAssert) {
41711 if (typeof begin !== 'number' || begin % 1 !== 0)
41712 throw TypeError("Illegal begin: Not an integer");
41713 begin >>>= 0;
41714 if (typeof end !== 'number' || end % 1 !== 0)
41715 throw TypeError("Illegal end: Not an integer");
41716 end >>>= 0;
41717 if (begin < 0 || begin > end || end > this.buffer.byteLength)
41718 throw RangeError("Illegal range: 0 <= "+begin+" <= "+end+" <= "+this.buffer.byteLength);
41719 }
41720 var sd; try {
41721 utfx.decodeUTF8toUTF16(function() {
41722 return begin < end ? this.view[begin++] : null;
41723 }.bind(this), sd = stringDestination());
41724 } catch (e) {
41725 if (begin !== end)
41726 throw RangeError("Illegal range: Truncated data, "+begin+" != "+end);
41727 }
41728 return sd();
41729 };
41730
41731 /**
41732 * Decodes an UTF8 encoded string to a ByteBuffer.
41733 * @param {string} str String to decode
41734 * @param {boolean=} littleEndian Whether to use little or big endian byte order. Defaults to
41735 * {@link ByteBuffer.DEFAULT_ENDIAN}.
41736 * @param {boolean=} noAssert Whether to skip assertions of offsets and values. Defaults to
41737 * {@link ByteBuffer.DEFAULT_NOASSERT}.
41738 * @returns {!ByteBuffer} ByteBuffer
41739 * @expose
41740 */
41741 ByteBuffer.fromUTF8 = function(str, littleEndian, noAssert) {
41742 if (!noAssert)
41743 if (typeof str !== 'string')
41744 throw TypeError("Illegal str: Not a string");
41745 var bb = new ByteBuffer(utfx.calculateUTF16asUTF8(stringSource(str), true)[1], littleEndian, noAssert),
41746 i = 0;
41747 utfx.encodeUTF16toUTF8(stringSource(str), function(b) {
41748 bb.view[i++] = b;
41749 });
41750 bb.limit = i;
41751 return bb;
41752 };
41753
41754 return ByteBuffer;
41755});
41756
41757
41758/***/ }),
41759/* 654 */
41760/***/ (function(module, exports, __webpack_require__) {
41761
41762var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*
41763 Copyright 2013 Daniel Wirtz <dcode@dcode.io>
41764 Copyright 2009 The Closure Library Authors. All Rights Reserved.
41765
41766 Licensed under the Apache License, Version 2.0 (the "License");
41767 you may not use this file except in compliance with the License.
41768 You may obtain a copy of the License at
41769
41770 http://www.apache.org/licenses/LICENSE-2.0
41771
41772 Unless required by applicable law or agreed to in writing, software
41773 distributed under the License is distributed on an "AS-IS" BASIS,
41774 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
41775 See the License for the specific language governing permissions and
41776 limitations under the License.
41777 */
41778
41779/**
41780 * @license long.js (c) 2013 Daniel Wirtz <dcode@dcode.io>
41781 * Released under the Apache License, Version 2.0
41782 * see: https://github.com/dcodeIO/long.js for details
41783 */
41784(function(global, factory) {
41785
41786 /* AMD */ if (true)
41787 !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
41788 __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
41789 (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
41790 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
41791 /* CommonJS */ else if (typeof require === 'function' && typeof module === "object" && module && module["exports"])
41792 module["exports"] = factory();
41793 /* Global */ else
41794 (global["dcodeIO"] = global["dcodeIO"] || {})["Long"] = factory();
41795
41796})(this, function() {
41797 "use strict";
41798
41799 /**
41800 * Constructs a 64 bit two's-complement integer, given its low and high 32 bit values as *signed* integers.
41801 * See the from* functions below for more convenient ways of constructing Longs.
41802 * @exports Long
41803 * @class A Long class for representing a 64 bit two's-complement integer value.
41804 * @param {number} low The low (signed) 32 bits of the long
41805 * @param {number} high The high (signed) 32 bits of the long
41806 * @param {boolean=} unsigned Whether unsigned or not, defaults to `false` for signed
41807 * @constructor
41808 */
41809 function Long(low, high, unsigned) {
41810
41811 /**
41812 * The low 32 bits as a signed value.
41813 * @type {number}
41814 */
41815 this.low = low | 0;
41816
41817 /**
41818 * The high 32 bits as a signed value.
41819 * @type {number}
41820 */
41821 this.high = high | 0;
41822
41823 /**
41824 * Whether unsigned or not.
41825 * @type {boolean}
41826 */
41827 this.unsigned = !!unsigned;
41828 }
41829
41830 // The internal representation of a long is the two given signed, 32-bit values.
41831 // We use 32-bit pieces because these are the size of integers on which
41832 // Javascript performs bit-operations. For operations like addition and
41833 // multiplication, we split each number into 16 bit pieces, which can easily be
41834 // multiplied within Javascript's floating-point representation without overflow
41835 // or change in sign.
41836 //
41837 // In the algorithms below, we frequently reduce the negative case to the
41838 // positive case by negating the input(s) and then post-processing the result.
41839 // Note that we must ALWAYS check specially whether those values are MIN_VALUE
41840 // (-2^63) because -MIN_VALUE == MIN_VALUE (since 2^63 cannot be represented as
41841 // a positive number, it overflows back into a negative). Not handling this
41842 // case would often result in infinite recursion.
41843 //
41844 // Common constant values ZERO, ONE, NEG_ONE, etc. are defined below the from*
41845 // methods on which they depend.
41846
41847 /**
41848 * An indicator used to reliably determine if an object is a Long or not.
41849 * @type {boolean}
41850 * @const
41851 * @private
41852 */
41853 Long.prototype.__isLong__;
41854
41855 Object.defineProperty(Long.prototype, "__isLong__", {
41856 value: true,
41857 enumerable: false,
41858 configurable: false
41859 });
41860
41861 /**
41862 * @function
41863 * @param {*} obj Object
41864 * @returns {boolean}
41865 * @inner
41866 */
41867 function isLong(obj) {
41868 return (obj && obj["__isLong__"]) === true;
41869 }
41870
41871 /**
41872 * Tests if the specified object is a Long.
41873 * @function
41874 * @param {*} obj Object
41875 * @returns {boolean}
41876 */
41877 Long.isLong = isLong;
41878
41879 /**
41880 * A cache of the Long representations of small integer values.
41881 * @type {!Object}
41882 * @inner
41883 */
41884 var INT_CACHE = {};
41885
41886 /**
41887 * A cache of the Long representations of small unsigned integer values.
41888 * @type {!Object}
41889 * @inner
41890 */
41891 var UINT_CACHE = {};
41892
41893 /**
41894 * @param {number} value
41895 * @param {boolean=} unsigned
41896 * @returns {!Long}
41897 * @inner
41898 */
41899 function fromInt(value, unsigned) {
41900 var obj, cachedObj, cache;
41901 if (unsigned) {
41902 value >>>= 0;
41903 if (cache = (0 <= value && value < 256)) {
41904 cachedObj = UINT_CACHE[value];
41905 if (cachedObj)
41906 return cachedObj;
41907 }
41908 obj = fromBits(value, (value | 0) < 0 ? -1 : 0, true);
41909 if (cache)
41910 UINT_CACHE[value] = obj;
41911 return obj;
41912 } else {
41913 value |= 0;
41914 if (cache = (-128 <= value && value < 128)) {
41915 cachedObj = INT_CACHE[value];
41916 if (cachedObj)
41917 return cachedObj;
41918 }
41919 obj = fromBits(value, value < 0 ? -1 : 0, false);
41920 if (cache)
41921 INT_CACHE[value] = obj;
41922 return obj;
41923 }
41924 }
41925
41926 /**
41927 * Returns a Long representing the given 32 bit integer value.
41928 * @function
41929 * @param {number} value The 32 bit integer in question
41930 * @param {boolean=} unsigned Whether unsigned or not, defaults to `false` for signed
41931 * @returns {!Long} The corresponding Long value
41932 */
41933 Long.fromInt = fromInt;
41934
41935 /**
41936 * @param {number} value
41937 * @param {boolean=} unsigned
41938 * @returns {!Long}
41939 * @inner
41940 */
41941 function fromNumber(value, unsigned) {
41942 if (isNaN(value) || !isFinite(value))
41943 return unsigned ? UZERO : ZERO;
41944 if (unsigned) {
41945 if (value < 0)
41946 return UZERO;
41947 if (value >= TWO_PWR_64_DBL)
41948 return MAX_UNSIGNED_VALUE;
41949 } else {
41950 if (value <= -TWO_PWR_63_DBL)
41951 return MIN_VALUE;
41952 if (value + 1 >= TWO_PWR_63_DBL)
41953 return MAX_VALUE;
41954 }
41955 if (value < 0)
41956 return fromNumber(-value, unsigned).neg();
41957 return fromBits((value % TWO_PWR_32_DBL) | 0, (value / TWO_PWR_32_DBL) | 0, unsigned);
41958 }
41959
41960 /**
41961 * Returns a Long representing the given value, provided that it is a finite number. Otherwise, zero is returned.
41962 * @function
41963 * @param {number} value The number in question
41964 * @param {boolean=} unsigned Whether unsigned or not, defaults to `false` for signed
41965 * @returns {!Long} The corresponding Long value
41966 */
41967 Long.fromNumber = fromNumber;
41968
41969 /**
41970 * @param {number} lowBits
41971 * @param {number} highBits
41972 * @param {boolean=} unsigned
41973 * @returns {!Long}
41974 * @inner
41975 */
41976 function fromBits(lowBits, highBits, unsigned) {
41977 return new Long(lowBits, highBits, unsigned);
41978 }
41979
41980 /**
41981 * Returns a Long representing the 64 bit integer that comes by concatenating the given low and high bits. Each is
41982 * assumed to use 32 bits.
41983 * @function
41984 * @param {number} lowBits The low 32 bits
41985 * @param {number} highBits The high 32 bits
41986 * @param {boolean=} unsigned Whether unsigned or not, defaults to `false` for signed
41987 * @returns {!Long} The corresponding Long value
41988 */
41989 Long.fromBits = fromBits;
41990
41991 /**
41992 * @function
41993 * @param {number} base
41994 * @param {number} exponent
41995 * @returns {number}
41996 * @inner
41997 */
41998 var pow_dbl = Math.pow; // Used 4 times (4*8 to 15+4)
41999
42000 /**
42001 * @param {string} str
42002 * @param {(boolean|number)=} unsigned
42003 * @param {number=} radix
42004 * @returns {!Long}
42005 * @inner
42006 */
42007 function fromString(str, unsigned, radix) {
42008 if (str.length === 0)
42009 throw Error('empty string');
42010 if (str === "NaN" || str === "Infinity" || str === "+Infinity" || str === "-Infinity")
42011 return ZERO;
42012 if (typeof unsigned === 'number') {
42013 // For goog.math.long compatibility
42014 radix = unsigned,
42015 unsigned = false;
42016 } else {
42017 unsigned = !! unsigned;
42018 }
42019 radix = radix || 10;
42020 if (radix < 2 || 36 < radix)
42021 throw RangeError('radix');
42022
42023 var p;
42024 if ((p = str.indexOf('-')) > 0)
42025 throw Error('interior hyphen');
42026 else if (p === 0) {
42027 return fromString(str.substring(1), unsigned, radix).neg();
42028 }
42029
42030 // Do several (8) digits each time through the loop, so as to
42031 // minimize the calls to the very expensive emulated div.
42032 var radixToPower = fromNumber(pow_dbl(radix, 8));
42033
42034 var result = ZERO;
42035 for (var i = 0; i < str.length; i += 8) {
42036 var size = Math.min(8, str.length - i),
42037 value = parseInt(str.substring(i, i + size), radix);
42038 if (size < 8) {
42039 var power = fromNumber(pow_dbl(radix, size));
42040 result = result.mul(power).add(fromNumber(value));
42041 } else {
42042 result = result.mul(radixToPower);
42043 result = result.add(fromNumber(value));
42044 }
42045 }
42046 result.unsigned = unsigned;
42047 return result;
42048 }
42049
42050 /**
42051 * Returns a Long representation of the given string, written using the specified radix.
42052 * @function
42053 * @param {string} str The textual representation of the Long
42054 * @param {(boolean|number)=} unsigned Whether unsigned or not, defaults to `false` for signed
42055 * @param {number=} radix The radix in which the text is written (2-36), defaults to 10
42056 * @returns {!Long} The corresponding Long value
42057 */
42058 Long.fromString = fromString;
42059
42060 /**
42061 * @function
42062 * @param {!Long|number|string|!{low: number, high: number, unsigned: boolean}} val
42063 * @returns {!Long}
42064 * @inner
42065 */
42066 function fromValue(val) {
42067 if (val /* is compatible */ instanceof Long)
42068 return val;
42069 if (typeof val === 'number')
42070 return fromNumber(val);
42071 if (typeof val === 'string')
42072 return fromString(val);
42073 // Throws for non-objects, converts non-instanceof Long:
42074 return fromBits(val.low, val.high, val.unsigned);
42075 }
42076
42077 /**
42078 * Converts the specified value to a Long.
42079 * @function
42080 * @param {!Long|number|string|!{low: number, high: number, unsigned: boolean}} val Value
42081 * @returns {!Long}
42082 */
42083 Long.fromValue = fromValue;
42084
42085 // NOTE: the compiler should inline these constant values below and then remove these variables, so there should be
42086 // no runtime penalty for these.
42087
42088 /**
42089 * @type {number}
42090 * @const
42091 * @inner
42092 */
42093 var TWO_PWR_16_DBL = 1 << 16;
42094
42095 /**
42096 * @type {number}
42097 * @const
42098 * @inner
42099 */
42100 var TWO_PWR_24_DBL = 1 << 24;
42101
42102 /**
42103 * @type {number}
42104 * @const
42105 * @inner
42106 */
42107 var TWO_PWR_32_DBL = TWO_PWR_16_DBL * TWO_PWR_16_DBL;
42108
42109 /**
42110 * @type {number}
42111 * @const
42112 * @inner
42113 */
42114 var TWO_PWR_64_DBL = TWO_PWR_32_DBL * TWO_PWR_32_DBL;
42115
42116 /**
42117 * @type {number}
42118 * @const
42119 * @inner
42120 */
42121 var TWO_PWR_63_DBL = TWO_PWR_64_DBL / 2;
42122
42123 /**
42124 * @type {!Long}
42125 * @const
42126 * @inner
42127 */
42128 var TWO_PWR_24 = fromInt(TWO_PWR_24_DBL);
42129
42130 /**
42131 * @type {!Long}
42132 * @inner
42133 */
42134 var ZERO = fromInt(0);
42135
42136 /**
42137 * Signed zero.
42138 * @type {!Long}
42139 */
42140 Long.ZERO = ZERO;
42141
42142 /**
42143 * @type {!Long}
42144 * @inner
42145 */
42146 var UZERO = fromInt(0, true);
42147
42148 /**
42149 * Unsigned zero.
42150 * @type {!Long}
42151 */
42152 Long.UZERO = UZERO;
42153
42154 /**
42155 * @type {!Long}
42156 * @inner
42157 */
42158 var ONE = fromInt(1);
42159
42160 /**
42161 * Signed one.
42162 * @type {!Long}
42163 */
42164 Long.ONE = ONE;
42165
42166 /**
42167 * @type {!Long}
42168 * @inner
42169 */
42170 var UONE = fromInt(1, true);
42171
42172 /**
42173 * Unsigned one.
42174 * @type {!Long}
42175 */
42176 Long.UONE = UONE;
42177
42178 /**
42179 * @type {!Long}
42180 * @inner
42181 */
42182 var NEG_ONE = fromInt(-1);
42183
42184 /**
42185 * Signed negative one.
42186 * @type {!Long}
42187 */
42188 Long.NEG_ONE = NEG_ONE;
42189
42190 /**
42191 * @type {!Long}
42192 * @inner
42193 */
42194 var MAX_VALUE = fromBits(0xFFFFFFFF|0, 0x7FFFFFFF|0, false);
42195
42196 /**
42197 * Maximum signed value.
42198 * @type {!Long}
42199 */
42200 Long.MAX_VALUE = MAX_VALUE;
42201
42202 /**
42203 * @type {!Long}
42204 * @inner
42205 */
42206 var MAX_UNSIGNED_VALUE = fromBits(0xFFFFFFFF|0, 0xFFFFFFFF|0, true);
42207
42208 /**
42209 * Maximum unsigned value.
42210 * @type {!Long}
42211 */
42212 Long.MAX_UNSIGNED_VALUE = MAX_UNSIGNED_VALUE;
42213
42214 /**
42215 * @type {!Long}
42216 * @inner
42217 */
42218 var MIN_VALUE = fromBits(0, 0x80000000|0, false);
42219
42220 /**
42221 * Minimum signed value.
42222 * @type {!Long}
42223 */
42224 Long.MIN_VALUE = MIN_VALUE;
42225
42226 /**
42227 * @alias Long.prototype
42228 * @inner
42229 */
42230 var LongPrototype = Long.prototype;
42231
42232 /**
42233 * Converts the Long to a 32 bit integer, assuming it is a 32 bit integer.
42234 * @returns {number}
42235 */
42236 LongPrototype.toInt = function toInt() {
42237 return this.unsigned ? this.low >>> 0 : this.low;
42238 };
42239
42240 /**
42241 * Converts the Long to a the nearest floating-point representation of this value (double, 53 bit mantissa).
42242 * @returns {number}
42243 */
42244 LongPrototype.toNumber = function toNumber() {
42245 if (this.unsigned)
42246 return ((this.high >>> 0) * TWO_PWR_32_DBL) + (this.low >>> 0);
42247 return this.high * TWO_PWR_32_DBL + (this.low >>> 0);
42248 };
42249
42250 /**
42251 * Converts the Long to a string written in the specified radix.
42252 * @param {number=} radix Radix (2-36), defaults to 10
42253 * @returns {string}
42254 * @override
42255 * @throws {RangeError} If `radix` is out of range
42256 */
42257 LongPrototype.toString = function toString(radix) {
42258 radix = radix || 10;
42259 if (radix < 2 || 36 < radix)
42260 throw RangeError('radix');
42261 if (this.isZero())
42262 return '0';
42263 if (this.isNegative()) { // Unsigned Longs are never negative
42264 if (this.eq(MIN_VALUE)) {
42265 // We need to change the Long value before it can be negated, so we remove
42266 // the bottom-most digit in this base and then recurse to do the rest.
42267 var radixLong = fromNumber(radix),
42268 div = this.div(radixLong),
42269 rem1 = div.mul(radixLong).sub(this);
42270 return div.toString(radix) + rem1.toInt().toString(radix);
42271 } else
42272 return '-' + this.neg().toString(radix);
42273 }
42274
42275 // Do several (6) digits each time through the loop, so as to
42276 // minimize the calls to the very expensive emulated div.
42277 var radixToPower = fromNumber(pow_dbl(radix, 6), this.unsigned),
42278 rem = this;
42279 var result = '';
42280 while (true) {
42281 var remDiv = rem.div(radixToPower),
42282 intval = rem.sub(remDiv.mul(radixToPower)).toInt() >>> 0,
42283 digits = intval.toString(radix);
42284 rem = remDiv;
42285 if (rem.isZero())
42286 return digits + result;
42287 else {
42288 while (digits.length < 6)
42289 digits = '0' + digits;
42290 result = '' + digits + result;
42291 }
42292 }
42293 };
42294
42295 /**
42296 * Gets the high 32 bits as a signed integer.
42297 * @returns {number} Signed high bits
42298 */
42299 LongPrototype.getHighBits = function getHighBits() {
42300 return this.high;
42301 };
42302
42303 /**
42304 * Gets the high 32 bits as an unsigned integer.
42305 * @returns {number} Unsigned high bits
42306 */
42307 LongPrototype.getHighBitsUnsigned = function getHighBitsUnsigned() {
42308 return this.high >>> 0;
42309 };
42310
42311 /**
42312 * Gets the low 32 bits as a signed integer.
42313 * @returns {number} Signed low bits
42314 */
42315 LongPrototype.getLowBits = function getLowBits() {
42316 return this.low;
42317 };
42318
42319 /**
42320 * Gets the low 32 bits as an unsigned integer.
42321 * @returns {number} Unsigned low bits
42322 */
42323 LongPrototype.getLowBitsUnsigned = function getLowBitsUnsigned() {
42324 return this.low >>> 0;
42325 };
42326
42327 /**
42328 * Gets the number of bits needed to represent the absolute value of this Long.
42329 * @returns {number}
42330 */
42331 LongPrototype.getNumBitsAbs = function getNumBitsAbs() {
42332 if (this.isNegative()) // Unsigned Longs are never negative
42333 return this.eq(MIN_VALUE) ? 64 : this.neg().getNumBitsAbs();
42334 var val = this.high != 0 ? this.high : this.low;
42335 for (var bit = 31; bit > 0; bit--)
42336 if ((val & (1 << bit)) != 0)
42337 break;
42338 return this.high != 0 ? bit + 33 : bit + 1;
42339 };
42340
42341 /**
42342 * Tests if this Long's value equals zero.
42343 * @returns {boolean}
42344 */
42345 LongPrototype.isZero = function isZero() {
42346 return this.high === 0 && this.low === 0;
42347 };
42348
42349 /**
42350 * Tests if this Long's value is negative.
42351 * @returns {boolean}
42352 */
42353 LongPrototype.isNegative = function isNegative() {
42354 return !this.unsigned && this.high < 0;
42355 };
42356
42357 /**
42358 * Tests if this Long's value is positive.
42359 * @returns {boolean}
42360 */
42361 LongPrototype.isPositive = function isPositive() {
42362 return this.unsigned || this.high >= 0;
42363 };
42364
42365 /**
42366 * Tests if this Long's value is odd.
42367 * @returns {boolean}
42368 */
42369 LongPrototype.isOdd = function isOdd() {
42370 return (this.low & 1) === 1;
42371 };
42372
42373 /**
42374 * Tests if this Long's value is even.
42375 * @returns {boolean}
42376 */
42377 LongPrototype.isEven = function isEven() {
42378 return (this.low & 1) === 0;
42379 };
42380
42381 /**
42382 * Tests if this Long's value equals the specified's.
42383 * @param {!Long|number|string} other Other value
42384 * @returns {boolean}
42385 */
42386 LongPrototype.equals = function equals(other) {
42387 if (!isLong(other))
42388 other = fromValue(other);
42389 if (this.unsigned !== other.unsigned && (this.high >>> 31) === 1 && (other.high >>> 31) === 1)
42390 return false;
42391 return this.high === other.high && this.low === other.low;
42392 };
42393
42394 /**
42395 * Tests if this Long's value equals the specified's. This is an alias of {@link Long#equals}.
42396 * @function
42397 * @param {!Long|number|string} other Other value
42398 * @returns {boolean}
42399 */
42400 LongPrototype.eq = LongPrototype.equals;
42401
42402 /**
42403 * Tests if this Long's value differs from the specified's.
42404 * @param {!Long|number|string} other Other value
42405 * @returns {boolean}
42406 */
42407 LongPrototype.notEquals = function notEquals(other) {
42408 return !this.eq(/* validates */ other);
42409 };
42410
42411 /**
42412 * Tests if this Long's value differs from the specified's. This is an alias of {@link Long#notEquals}.
42413 * @function
42414 * @param {!Long|number|string} other Other value
42415 * @returns {boolean}
42416 */
42417 LongPrototype.neq = LongPrototype.notEquals;
42418
42419 /**
42420 * Tests if this Long's value is less than the specified's.
42421 * @param {!Long|number|string} other Other value
42422 * @returns {boolean}
42423 */
42424 LongPrototype.lessThan = function lessThan(other) {
42425 return this.comp(/* validates */ other) < 0;
42426 };
42427
42428 /**
42429 * Tests if this Long's value is less than the specified's. This is an alias of {@link Long#lessThan}.
42430 * @function
42431 * @param {!Long|number|string} other Other value
42432 * @returns {boolean}
42433 */
42434 LongPrototype.lt = LongPrototype.lessThan;
42435
42436 /**
42437 * Tests if this Long's value is less than or equal the specified's.
42438 * @param {!Long|number|string} other Other value
42439 * @returns {boolean}
42440 */
42441 LongPrototype.lessThanOrEqual = function lessThanOrEqual(other) {
42442 return this.comp(/* validates */ other) <= 0;
42443 };
42444
42445 /**
42446 * Tests if this Long's value is less than or equal the specified's. This is an alias of {@link Long#lessThanOrEqual}.
42447 * @function
42448 * @param {!Long|number|string} other Other value
42449 * @returns {boolean}
42450 */
42451 LongPrototype.lte = LongPrototype.lessThanOrEqual;
42452
42453 /**
42454 * Tests if this Long's value is greater than the specified's.
42455 * @param {!Long|number|string} other Other value
42456 * @returns {boolean}
42457 */
42458 LongPrototype.greaterThan = function greaterThan(other) {
42459 return this.comp(/* validates */ other) > 0;
42460 };
42461
42462 /**
42463 * Tests if this Long's value is greater than the specified's. This is an alias of {@link Long#greaterThan}.
42464 * @function
42465 * @param {!Long|number|string} other Other value
42466 * @returns {boolean}
42467 */
42468 LongPrototype.gt = LongPrototype.greaterThan;
42469
42470 /**
42471 * Tests if this Long's value is greater than or equal the specified's.
42472 * @param {!Long|number|string} other Other value
42473 * @returns {boolean}
42474 */
42475 LongPrototype.greaterThanOrEqual = function greaterThanOrEqual(other) {
42476 return this.comp(/* validates */ other) >= 0;
42477 };
42478
42479 /**
42480 * Tests if this Long's value is greater than or equal the specified's. This is an alias of {@link Long#greaterThanOrEqual}.
42481 * @function
42482 * @param {!Long|number|string} other Other value
42483 * @returns {boolean}
42484 */
42485 LongPrototype.gte = LongPrototype.greaterThanOrEqual;
42486
42487 /**
42488 * Compares this Long's value with the specified's.
42489 * @param {!Long|number|string} other Other value
42490 * @returns {number} 0 if they are the same, 1 if the this is greater and -1
42491 * if the given one is greater
42492 */
42493 LongPrototype.compare = function compare(other) {
42494 if (!isLong(other))
42495 other = fromValue(other);
42496 if (this.eq(other))
42497 return 0;
42498 var thisNeg = this.isNegative(),
42499 otherNeg = other.isNegative();
42500 if (thisNeg && !otherNeg)
42501 return -1;
42502 if (!thisNeg && otherNeg)
42503 return 1;
42504 // At this point the sign bits are the same
42505 if (!this.unsigned)
42506 return this.sub(other).isNegative() ? -1 : 1;
42507 // Both are positive if at least one is unsigned
42508 return (other.high >>> 0) > (this.high >>> 0) || (other.high === this.high && (other.low >>> 0) > (this.low >>> 0)) ? -1 : 1;
42509 };
42510
42511 /**
42512 * Compares this Long's value with the specified's. This is an alias of {@link Long#compare}.
42513 * @function
42514 * @param {!Long|number|string} other Other value
42515 * @returns {number} 0 if they are the same, 1 if the this is greater and -1
42516 * if the given one is greater
42517 */
42518 LongPrototype.comp = LongPrototype.compare;
42519
42520 /**
42521 * Negates this Long's value.
42522 * @returns {!Long} Negated Long
42523 */
42524 LongPrototype.negate = function negate() {
42525 if (!this.unsigned && this.eq(MIN_VALUE))
42526 return MIN_VALUE;
42527 return this.not().add(ONE);
42528 };
42529
42530 /**
42531 * Negates this Long's value. This is an alias of {@link Long#negate}.
42532 * @function
42533 * @returns {!Long} Negated Long
42534 */
42535 LongPrototype.neg = LongPrototype.negate;
42536
42537 /**
42538 * Returns the sum of this and the specified Long.
42539 * @param {!Long|number|string} addend Addend
42540 * @returns {!Long} Sum
42541 */
42542 LongPrototype.add = function add(addend) {
42543 if (!isLong(addend))
42544 addend = fromValue(addend);
42545
42546 // Divide each number into 4 chunks of 16 bits, and then sum the chunks.
42547
42548 var a48 = this.high >>> 16;
42549 var a32 = this.high & 0xFFFF;
42550 var a16 = this.low >>> 16;
42551 var a00 = this.low & 0xFFFF;
42552
42553 var b48 = addend.high >>> 16;
42554 var b32 = addend.high & 0xFFFF;
42555 var b16 = addend.low >>> 16;
42556 var b00 = addend.low & 0xFFFF;
42557
42558 var c48 = 0, c32 = 0, c16 = 0, c00 = 0;
42559 c00 += a00 + b00;
42560 c16 += c00 >>> 16;
42561 c00 &= 0xFFFF;
42562 c16 += a16 + b16;
42563 c32 += c16 >>> 16;
42564 c16 &= 0xFFFF;
42565 c32 += a32 + b32;
42566 c48 += c32 >>> 16;
42567 c32 &= 0xFFFF;
42568 c48 += a48 + b48;
42569 c48 &= 0xFFFF;
42570 return fromBits((c16 << 16) | c00, (c48 << 16) | c32, this.unsigned);
42571 };
42572
42573 /**
42574 * Returns the difference of this and the specified Long.
42575 * @param {!Long|number|string} subtrahend Subtrahend
42576 * @returns {!Long} Difference
42577 */
42578 LongPrototype.subtract = function subtract(subtrahend) {
42579 if (!isLong(subtrahend))
42580 subtrahend = fromValue(subtrahend);
42581 return this.add(subtrahend.neg());
42582 };
42583
42584 /**
42585 * Returns the difference of this and the specified Long. This is an alias of {@link Long#subtract}.
42586 * @function
42587 * @param {!Long|number|string} subtrahend Subtrahend
42588 * @returns {!Long} Difference
42589 */
42590 LongPrototype.sub = LongPrototype.subtract;
42591
42592 /**
42593 * Returns the product of this and the specified Long.
42594 * @param {!Long|number|string} multiplier Multiplier
42595 * @returns {!Long} Product
42596 */
42597 LongPrototype.multiply = function multiply(multiplier) {
42598 if (this.isZero())
42599 return ZERO;
42600 if (!isLong(multiplier))
42601 multiplier = fromValue(multiplier);
42602 if (multiplier.isZero())
42603 return ZERO;
42604 if (this.eq(MIN_VALUE))
42605 return multiplier.isOdd() ? MIN_VALUE : ZERO;
42606 if (multiplier.eq(MIN_VALUE))
42607 return this.isOdd() ? MIN_VALUE : ZERO;
42608
42609 if (this.isNegative()) {
42610 if (multiplier.isNegative())
42611 return this.neg().mul(multiplier.neg());
42612 else
42613 return this.neg().mul(multiplier).neg();
42614 } else if (multiplier.isNegative())
42615 return this.mul(multiplier.neg()).neg();
42616
42617 // If both longs are small, use float multiplication
42618 if (this.lt(TWO_PWR_24) && multiplier.lt(TWO_PWR_24))
42619 return fromNumber(this.toNumber() * multiplier.toNumber(), this.unsigned);
42620
42621 // Divide each long into 4 chunks of 16 bits, and then add up 4x4 products.
42622 // We can skip products that would overflow.
42623
42624 var a48 = this.high >>> 16;
42625 var a32 = this.high & 0xFFFF;
42626 var a16 = this.low >>> 16;
42627 var a00 = this.low & 0xFFFF;
42628
42629 var b48 = multiplier.high >>> 16;
42630 var b32 = multiplier.high & 0xFFFF;
42631 var b16 = multiplier.low >>> 16;
42632 var b00 = multiplier.low & 0xFFFF;
42633
42634 var c48 = 0, c32 = 0, c16 = 0, c00 = 0;
42635 c00 += a00 * b00;
42636 c16 += c00 >>> 16;
42637 c00 &= 0xFFFF;
42638 c16 += a16 * b00;
42639 c32 += c16 >>> 16;
42640 c16 &= 0xFFFF;
42641 c16 += a00 * b16;
42642 c32 += c16 >>> 16;
42643 c16 &= 0xFFFF;
42644 c32 += a32 * b00;
42645 c48 += c32 >>> 16;
42646 c32 &= 0xFFFF;
42647 c32 += a16 * b16;
42648 c48 += c32 >>> 16;
42649 c32 &= 0xFFFF;
42650 c32 += a00 * b32;
42651 c48 += c32 >>> 16;
42652 c32 &= 0xFFFF;
42653 c48 += a48 * b00 + a32 * b16 + a16 * b32 + a00 * b48;
42654 c48 &= 0xFFFF;
42655 return fromBits((c16 << 16) | c00, (c48 << 16) | c32, this.unsigned);
42656 };
42657
42658 /**
42659 * Returns the product of this and the specified Long. This is an alias of {@link Long#multiply}.
42660 * @function
42661 * @param {!Long|number|string} multiplier Multiplier
42662 * @returns {!Long} Product
42663 */
42664 LongPrototype.mul = LongPrototype.multiply;
42665
42666 /**
42667 * Returns this Long divided by the specified. The result is signed if this Long is signed or
42668 * unsigned if this Long is unsigned.
42669 * @param {!Long|number|string} divisor Divisor
42670 * @returns {!Long} Quotient
42671 */
42672 LongPrototype.divide = function divide(divisor) {
42673 if (!isLong(divisor))
42674 divisor = fromValue(divisor);
42675 if (divisor.isZero())
42676 throw Error('division by zero');
42677 if (this.isZero())
42678 return this.unsigned ? UZERO : ZERO;
42679 var approx, rem, res;
42680 if (!this.unsigned) {
42681 // This section is only relevant for signed longs and is derived from the
42682 // closure library as a whole.
42683 if (this.eq(MIN_VALUE)) {
42684 if (divisor.eq(ONE) || divisor.eq(NEG_ONE))
42685 return MIN_VALUE; // recall that -MIN_VALUE == MIN_VALUE
42686 else if (divisor.eq(MIN_VALUE))
42687 return ONE;
42688 else {
42689 // At this point, we have |other| >= 2, so |this/other| < |MIN_VALUE|.
42690 var halfThis = this.shr(1);
42691 approx = halfThis.div(divisor).shl(1);
42692 if (approx.eq(ZERO)) {
42693 return divisor.isNegative() ? ONE : NEG_ONE;
42694 } else {
42695 rem = this.sub(divisor.mul(approx));
42696 res = approx.add(rem.div(divisor));
42697 return res;
42698 }
42699 }
42700 } else if (divisor.eq(MIN_VALUE))
42701 return this.unsigned ? UZERO : ZERO;
42702 if (this.isNegative()) {
42703 if (divisor.isNegative())
42704 return this.neg().div(divisor.neg());
42705 return this.neg().div(divisor).neg();
42706 } else if (divisor.isNegative())
42707 return this.div(divisor.neg()).neg();
42708 res = ZERO;
42709 } else {
42710 // The algorithm below has not been made for unsigned longs. It's therefore
42711 // required to take special care of the MSB prior to running it.
42712 if (!divisor.unsigned)
42713 divisor = divisor.toUnsigned();
42714 if (divisor.gt(this))
42715 return UZERO;
42716 if (divisor.gt(this.shru(1))) // 15 >>> 1 = 7 ; with divisor = 8 ; true
42717 return UONE;
42718 res = UZERO;
42719 }
42720
42721 // Repeat the following until the remainder is less than other: find a
42722 // floating-point that approximates remainder / other *from below*, add this
42723 // into the result, and subtract it from the remainder. It is critical that
42724 // the approximate value is less than or equal to the real value so that the
42725 // remainder never becomes negative.
42726 rem = this;
42727 while (rem.gte(divisor)) {
42728 // Approximate the result of division. This may be a little greater or
42729 // smaller than the actual value.
42730 approx = Math.max(1, Math.floor(rem.toNumber() / divisor.toNumber()));
42731
42732 // We will tweak the approximate result by changing it in the 48-th digit or
42733 // the smallest non-fractional digit, whichever is larger.
42734 var log2 = Math.ceil(Math.log(approx) / Math.LN2),
42735 delta = (log2 <= 48) ? 1 : pow_dbl(2, log2 - 48),
42736
42737 // Decrease the approximation until it is smaller than the remainder. Note
42738 // that if it is too large, the product overflows and is negative.
42739 approxRes = fromNumber(approx),
42740 approxRem = approxRes.mul(divisor);
42741 while (approxRem.isNegative() || approxRem.gt(rem)) {
42742 approx -= delta;
42743 approxRes = fromNumber(approx, this.unsigned);
42744 approxRem = approxRes.mul(divisor);
42745 }
42746
42747 // We know the answer can't be zero... and actually, zero would cause
42748 // infinite recursion since we would make no progress.
42749 if (approxRes.isZero())
42750 approxRes = ONE;
42751
42752 res = res.add(approxRes);
42753 rem = rem.sub(approxRem);
42754 }
42755 return res;
42756 };
42757
42758 /**
42759 * Returns this Long divided by the specified. This is an alias of {@link Long#divide}.
42760 * @function
42761 * @param {!Long|number|string} divisor Divisor
42762 * @returns {!Long} Quotient
42763 */
42764 LongPrototype.div = LongPrototype.divide;
42765
42766 /**
42767 * Returns this Long modulo the specified.
42768 * @param {!Long|number|string} divisor Divisor
42769 * @returns {!Long} Remainder
42770 */
42771 LongPrototype.modulo = function modulo(divisor) {
42772 if (!isLong(divisor))
42773 divisor = fromValue(divisor);
42774 return this.sub(this.div(divisor).mul(divisor));
42775 };
42776
42777 /**
42778 * Returns this Long modulo the specified. This is an alias of {@link Long#modulo}.
42779 * @function
42780 * @param {!Long|number|string} divisor Divisor
42781 * @returns {!Long} Remainder
42782 */
42783 LongPrototype.mod = LongPrototype.modulo;
42784
42785 /**
42786 * Returns the bitwise NOT of this Long.
42787 * @returns {!Long}
42788 */
42789 LongPrototype.not = function not() {
42790 return fromBits(~this.low, ~this.high, this.unsigned);
42791 };
42792
42793 /**
42794 * Returns the bitwise AND of this Long and the specified.
42795 * @param {!Long|number|string} other Other Long
42796 * @returns {!Long}
42797 */
42798 LongPrototype.and = function and(other) {
42799 if (!isLong(other))
42800 other = fromValue(other);
42801 return fromBits(this.low & other.low, this.high & other.high, this.unsigned);
42802 };
42803
42804 /**
42805 * Returns the bitwise OR of this Long and the specified.
42806 * @param {!Long|number|string} other Other Long
42807 * @returns {!Long}
42808 */
42809 LongPrototype.or = function or(other) {
42810 if (!isLong(other))
42811 other = fromValue(other);
42812 return fromBits(this.low | other.low, this.high | other.high, this.unsigned);
42813 };
42814
42815 /**
42816 * Returns the bitwise XOR of this Long and the given one.
42817 * @param {!Long|number|string} other Other Long
42818 * @returns {!Long}
42819 */
42820 LongPrototype.xor = function xor(other) {
42821 if (!isLong(other))
42822 other = fromValue(other);
42823 return fromBits(this.low ^ other.low, this.high ^ other.high, this.unsigned);
42824 };
42825
42826 /**
42827 * Returns this Long with bits shifted to the left by the given amount.
42828 * @param {number|!Long} numBits Number of bits
42829 * @returns {!Long} Shifted Long
42830 */
42831 LongPrototype.shiftLeft = function shiftLeft(numBits) {
42832 if (isLong(numBits))
42833 numBits = numBits.toInt();
42834 if ((numBits &= 63) === 0)
42835 return this;
42836 else if (numBits < 32)
42837 return fromBits(this.low << numBits, (this.high << numBits) | (this.low >>> (32 - numBits)), this.unsigned);
42838 else
42839 return fromBits(0, this.low << (numBits - 32), this.unsigned);
42840 };
42841
42842 /**
42843 * Returns this Long with bits shifted to the left by the given amount. This is an alias of {@link Long#shiftLeft}.
42844 * @function
42845 * @param {number|!Long} numBits Number of bits
42846 * @returns {!Long} Shifted Long
42847 */
42848 LongPrototype.shl = LongPrototype.shiftLeft;
42849
42850 /**
42851 * Returns this Long with bits arithmetically shifted to the right by the given amount.
42852 * @param {number|!Long} numBits Number of bits
42853 * @returns {!Long} Shifted Long
42854 */
42855 LongPrototype.shiftRight = function shiftRight(numBits) {
42856 if (isLong(numBits))
42857 numBits = numBits.toInt();
42858 if ((numBits &= 63) === 0)
42859 return this;
42860 else if (numBits < 32)
42861 return fromBits((this.low >>> numBits) | (this.high << (32 - numBits)), this.high >> numBits, this.unsigned);
42862 else
42863 return fromBits(this.high >> (numBits - 32), this.high >= 0 ? 0 : -1, this.unsigned);
42864 };
42865
42866 /**
42867 * Returns this Long with bits arithmetically shifted to the right by the given amount. This is an alias of {@link Long#shiftRight}.
42868 * @function
42869 * @param {number|!Long} numBits Number of bits
42870 * @returns {!Long} Shifted Long
42871 */
42872 LongPrototype.shr = LongPrototype.shiftRight;
42873
42874 /**
42875 * Returns this Long with bits logically shifted to the right by the given amount.
42876 * @param {number|!Long} numBits Number of bits
42877 * @returns {!Long} Shifted Long
42878 */
42879 LongPrototype.shiftRightUnsigned = function shiftRightUnsigned(numBits) {
42880 if (isLong(numBits))
42881 numBits = numBits.toInt();
42882 numBits &= 63;
42883 if (numBits === 0)
42884 return this;
42885 else {
42886 var high = this.high;
42887 if (numBits < 32) {
42888 var low = this.low;
42889 return fromBits((low >>> numBits) | (high << (32 - numBits)), high >>> numBits, this.unsigned);
42890 } else if (numBits === 32)
42891 return fromBits(high, 0, this.unsigned);
42892 else
42893 return fromBits(high >>> (numBits - 32), 0, this.unsigned);
42894 }
42895 };
42896
42897 /**
42898 * Returns this Long with bits logically shifted to the right by the given amount. This is an alias of {@link Long#shiftRightUnsigned}.
42899 * @function
42900 * @param {number|!Long} numBits Number of bits
42901 * @returns {!Long} Shifted Long
42902 */
42903 LongPrototype.shru = LongPrototype.shiftRightUnsigned;
42904
42905 /**
42906 * Converts this Long to signed.
42907 * @returns {!Long} Signed long
42908 */
42909 LongPrototype.toSigned = function toSigned() {
42910 if (!this.unsigned)
42911 return this;
42912 return fromBits(this.low, this.high, false);
42913 };
42914
42915 /**
42916 * Converts this Long to unsigned.
42917 * @returns {!Long} Unsigned long
42918 */
42919 LongPrototype.toUnsigned = function toUnsigned() {
42920 if (this.unsigned)
42921 return this;
42922 return fromBits(this.low, this.high, true);
42923 };
42924
42925 /**
42926 * Converts this Long to its byte representation.
42927 * @param {boolean=} le Whether little or big endian, defaults to big endian
42928 * @returns {!Array.<number>} Byte representation
42929 */
42930 LongPrototype.toBytes = function(le) {
42931 return le ? this.toBytesLE() : this.toBytesBE();
42932 }
42933
42934 /**
42935 * Converts this Long to its little endian byte representation.
42936 * @returns {!Array.<number>} Little endian byte representation
42937 */
42938 LongPrototype.toBytesLE = function() {
42939 var hi = this.high,
42940 lo = this.low;
42941 return [
42942 lo & 0xff,
42943 (lo >>> 8) & 0xff,
42944 (lo >>> 16) & 0xff,
42945 (lo >>> 24) & 0xff,
42946 hi & 0xff,
42947 (hi >>> 8) & 0xff,
42948 (hi >>> 16) & 0xff,
42949 (hi >>> 24) & 0xff
42950 ];
42951 }
42952
42953 /**
42954 * Converts this Long to its big endian byte representation.
42955 * @returns {!Array.<number>} Big endian byte representation
42956 */
42957 LongPrototype.toBytesBE = function() {
42958 var hi = this.high,
42959 lo = this.low;
42960 return [
42961 (hi >>> 24) & 0xff,
42962 (hi >>> 16) & 0xff,
42963 (hi >>> 8) & 0xff,
42964 hi & 0xff,
42965 (lo >>> 24) & 0xff,
42966 (lo >>> 16) & 0xff,
42967 (lo >>> 8) & 0xff,
42968 lo & 0xff
42969 ];
42970 }
42971
42972 return Long;
42973});
42974
42975
42976/***/ }),
42977/* 655 */
42978/***/ (function(module, exports) {
42979
42980/* (ignored) */
42981
42982/***/ }),
42983/* 656 */
42984/***/ (function(module, exports, __webpack_require__) {
42985
42986"use strict";
42987
42988
42989var _interopRequireDefault = __webpack_require__(1);
42990
42991var _slice = _interopRequireDefault(__webpack_require__(34));
42992
42993var _getOwnPropertySymbols = _interopRequireDefault(__webpack_require__(266));
42994
42995var _concat = _interopRequireDefault(__webpack_require__(19));
42996
42997var has = Object.prototype.hasOwnProperty,
42998 prefix = '~';
42999/**
43000 * Constructor to create a storage for our `EE` objects.
43001 * An `Events` instance is a plain object whose properties are event names.
43002 *
43003 * @constructor
43004 * @private
43005 */
43006
43007function Events() {} //
43008// We try to not inherit from `Object.prototype`. In some engines creating an
43009// instance in this way is faster than calling `Object.create(null)` directly.
43010// If `Object.create(null)` is not supported we prefix the event names with a
43011// character to make sure that the built-in object properties are not
43012// overridden or used as an attack vector.
43013//
43014
43015
43016if (Object.create) {
43017 Events.prototype = Object.create(null); //
43018 // This hack is needed because the `__proto__` property is still inherited in
43019 // some old browsers like Android 4, iPhone 5.1, Opera 11 and Safari 5.
43020 //
43021
43022 if (!new Events().__proto__) prefix = false;
43023}
43024/**
43025 * Representation of a single event listener.
43026 *
43027 * @param {Function} fn The listener function.
43028 * @param {*} context The context to invoke the listener with.
43029 * @param {Boolean} [once=false] Specify if the listener is a one-time listener.
43030 * @constructor
43031 * @private
43032 */
43033
43034
43035function EE(fn, context, once) {
43036 this.fn = fn;
43037 this.context = context;
43038 this.once = once || false;
43039}
43040/**
43041 * Add a listener for a given event.
43042 *
43043 * @param {EventEmitter} emitter Reference to the `EventEmitter` instance.
43044 * @param {(String|Symbol)} event The event name.
43045 * @param {Function} fn The listener function.
43046 * @param {*} context The context to invoke the listener with.
43047 * @param {Boolean} once Specify if the listener is a one-time listener.
43048 * @returns {EventEmitter}
43049 * @private
43050 */
43051
43052
43053function addListener(emitter, event, fn, context, once) {
43054 if (typeof fn !== 'function') {
43055 throw new TypeError('The listener must be a function');
43056 }
43057
43058 var listener = new EE(fn, context || emitter, once),
43059 evt = prefix ? prefix + event : event;
43060 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];
43061 return emitter;
43062}
43063/**
43064 * Clear event by name.
43065 *
43066 * @param {EventEmitter} emitter Reference to the `EventEmitter` instance.
43067 * @param {(String|Symbol)} evt The Event name.
43068 * @private
43069 */
43070
43071
43072function clearEvent(emitter, evt) {
43073 if (--emitter._eventsCount === 0) emitter._events = new Events();else delete emitter._events[evt];
43074}
43075/**
43076 * Minimal `EventEmitter` interface that is molded against the Node.js
43077 * `EventEmitter` interface.
43078 *
43079 * @constructor
43080 * @public
43081 */
43082
43083
43084function EventEmitter() {
43085 this._events = new Events();
43086 this._eventsCount = 0;
43087}
43088/**
43089 * Return an array listing the events for which the emitter has registered
43090 * listeners.
43091 *
43092 * @returns {Array}
43093 * @public
43094 */
43095
43096
43097EventEmitter.prototype.eventNames = function eventNames() {
43098 var names = [],
43099 events,
43100 name;
43101 if (this._eventsCount === 0) return names;
43102
43103 for (name in events = this._events) {
43104 if (has.call(events, name)) names.push(prefix ? (0, _slice.default)(name).call(name, 1) : name);
43105 }
43106
43107 if (_getOwnPropertySymbols.default) {
43108 return (0, _concat.default)(names).call(names, (0, _getOwnPropertySymbols.default)(events));
43109 }
43110
43111 return names;
43112};
43113/**
43114 * Return the listeners registered for a given event.
43115 *
43116 * @param {(String|Symbol)} event The event name.
43117 * @returns {Array} The registered listeners.
43118 * @public
43119 */
43120
43121
43122EventEmitter.prototype.listeners = function listeners(event) {
43123 var evt = prefix ? prefix + event : event,
43124 handlers = this._events[evt];
43125 if (!handlers) return [];
43126 if (handlers.fn) return [handlers.fn];
43127
43128 for (var i = 0, l = handlers.length, ee = new Array(l); i < l; i++) {
43129 ee[i] = handlers[i].fn;
43130 }
43131
43132 return ee;
43133};
43134/**
43135 * Return the number of listeners listening to a given event.
43136 *
43137 * @param {(String|Symbol)} event The event name.
43138 * @returns {Number} The number of listeners.
43139 * @public
43140 */
43141
43142
43143EventEmitter.prototype.listenerCount = function listenerCount(event) {
43144 var evt = prefix ? prefix + event : event,
43145 listeners = this._events[evt];
43146 if (!listeners) return 0;
43147 if (listeners.fn) return 1;
43148 return listeners.length;
43149};
43150/**
43151 * Calls each of the listeners registered for a given event.
43152 *
43153 * @param {(String|Symbol)} event The event name.
43154 * @returns {Boolean} `true` if the event had listeners, else `false`.
43155 * @public
43156 */
43157
43158
43159EventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {
43160 var evt = prefix ? prefix + event : event;
43161 if (!this._events[evt]) return false;
43162 var listeners = this._events[evt],
43163 len = arguments.length,
43164 args,
43165 i;
43166
43167 if (listeners.fn) {
43168 if (listeners.once) this.removeListener(event, listeners.fn, undefined, true);
43169
43170 switch (len) {
43171 case 1:
43172 return listeners.fn.call(listeners.context), true;
43173
43174 case 2:
43175 return listeners.fn.call(listeners.context, a1), true;
43176
43177 case 3:
43178 return listeners.fn.call(listeners.context, a1, a2), true;
43179
43180 case 4:
43181 return listeners.fn.call(listeners.context, a1, a2, a3), true;
43182
43183 case 5:
43184 return listeners.fn.call(listeners.context, a1, a2, a3, a4), true;
43185
43186 case 6:
43187 return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true;
43188 }
43189
43190 for (i = 1, args = new Array(len - 1); i < len; i++) {
43191 args[i - 1] = arguments[i];
43192 }
43193
43194 listeners.fn.apply(listeners.context, args);
43195 } else {
43196 var length = listeners.length,
43197 j;
43198
43199 for (i = 0; i < length; i++) {
43200 if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true);
43201
43202 switch (len) {
43203 case 1:
43204 listeners[i].fn.call(listeners[i].context);
43205 break;
43206
43207 case 2:
43208 listeners[i].fn.call(listeners[i].context, a1);
43209 break;
43210
43211 case 3:
43212 listeners[i].fn.call(listeners[i].context, a1, a2);
43213 break;
43214
43215 case 4:
43216 listeners[i].fn.call(listeners[i].context, a1, a2, a3);
43217 break;
43218
43219 default:
43220 if (!args) for (j = 1, args = new Array(len - 1); j < len; j++) {
43221 args[j - 1] = arguments[j];
43222 }
43223 listeners[i].fn.apply(listeners[i].context, args);
43224 }
43225 }
43226 }
43227
43228 return true;
43229};
43230/**
43231 * Add a listener for a given event.
43232 *
43233 * @param {(String|Symbol)} event The event name.
43234 * @param {Function} fn The listener function.
43235 * @param {*} [context=this] The context to invoke the listener with.
43236 * @returns {EventEmitter} `this`.
43237 * @public
43238 */
43239
43240
43241EventEmitter.prototype.on = function on(event, fn, context) {
43242 return addListener(this, event, fn, context, false);
43243};
43244/**
43245 * Add a one-time listener for a given event.
43246 *
43247 * @param {(String|Symbol)} event The event name.
43248 * @param {Function} fn The listener function.
43249 * @param {*} [context=this] The context to invoke the listener with.
43250 * @returns {EventEmitter} `this`.
43251 * @public
43252 */
43253
43254
43255EventEmitter.prototype.once = function once(event, fn, context) {
43256 return addListener(this, event, fn, context, true);
43257};
43258/**
43259 * Remove the listeners of a given event.
43260 *
43261 * @param {(String|Symbol)} event The event name.
43262 * @param {Function} fn Only remove the listeners that match this function.
43263 * @param {*} context Only remove the listeners that have this context.
43264 * @param {Boolean} once Only remove one-time listeners.
43265 * @returns {EventEmitter} `this`.
43266 * @public
43267 */
43268
43269
43270EventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) {
43271 var evt = prefix ? prefix + event : event;
43272 if (!this._events[evt]) return this;
43273
43274 if (!fn) {
43275 clearEvent(this, evt);
43276 return this;
43277 }
43278
43279 var listeners = this._events[evt];
43280
43281 if (listeners.fn) {
43282 if (listeners.fn === fn && (!once || listeners.once) && (!context || listeners.context === context)) {
43283 clearEvent(this, evt);
43284 }
43285 } else {
43286 for (var i = 0, events = [], length = listeners.length; i < length; i++) {
43287 if (listeners[i].fn !== fn || once && !listeners[i].once || context && listeners[i].context !== context) {
43288 events.push(listeners[i]);
43289 }
43290 } //
43291 // Reset the array, or remove it completely if we have no more listeners.
43292 //
43293
43294
43295 if (events.length) this._events[evt] = events.length === 1 ? events[0] : events;else clearEvent(this, evt);
43296 }
43297
43298 return this;
43299};
43300/**
43301 * Remove all listeners, or those of the specified event.
43302 *
43303 * @param {(String|Symbol)} [event] The event name.
43304 * @returns {EventEmitter} `this`.
43305 * @public
43306 */
43307
43308
43309EventEmitter.prototype.removeAllListeners = function removeAllListeners(event) {
43310 var evt;
43311
43312 if (event) {
43313 evt = prefix ? prefix + event : event;
43314 if (this._events[evt]) clearEvent(this, evt);
43315 } else {
43316 this._events = new Events();
43317 this._eventsCount = 0;
43318 }
43319
43320 return this;
43321}; //
43322// Alias methods names because people roll like that.
43323//
43324
43325
43326EventEmitter.prototype.off = EventEmitter.prototype.removeListener;
43327EventEmitter.prototype.addListener = EventEmitter.prototype.on; //
43328// Expose the prefix.
43329//
43330
43331EventEmitter.prefixed = prefix; //
43332// Allow `EventEmitter` to be imported as module namespace.
43333//
43334
43335EventEmitter.EventEmitter = EventEmitter; //
43336// Expose the module.
43337//
43338
43339if (true) {
43340 module.exports = EventEmitter;
43341}
43342
43343/***/ }),
43344/* 657 */
43345/***/ (function(module, exports, __webpack_require__) {
43346
43347module.exports = __webpack_require__(658);
43348
43349
43350/***/ }),
43351/* 658 */
43352/***/ (function(module, exports, __webpack_require__) {
43353
43354/**
43355 * Copyright (c) 2014-present, Facebook, Inc.
43356 *
43357 * This source code is licensed under the MIT license found in the
43358 * LICENSE file in the root directory of this source tree.
43359 */
43360
43361var runtime = (function (exports) {
43362 "use strict";
43363
43364 var Op = Object.prototype;
43365 var hasOwn = Op.hasOwnProperty;
43366 var undefined; // More compressible than void 0.
43367 var $Symbol = typeof Symbol === "function" ? Symbol : {};
43368 var iteratorSymbol = $Symbol.iterator || "@@iterator";
43369 var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
43370 var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
43371
43372 function define(obj, key, value) {
43373 Object.defineProperty(obj, key, {
43374 value: value,
43375 enumerable: true,
43376 configurable: true,
43377 writable: true
43378 });
43379 return obj[key];
43380 }
43381 try {
43382 // IE 8 has a broken Object.defineProperty that only works on DOM objects.
43383 define({}, "");
43384 } catch (err) {
43385 define = function(obj, key, value) {
43386 return obj[key] = value;
43387 };
43388 }
43389
43390 function wrap(innerFn, outerFn, self, tryLocsList) {
43391 // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.
43392 var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
43393 var generator = Object.create(protoGenerator.prototype);
43394 var context = new Context(tryLocsList || []);
43395
43396 // The ._invoke method unifies the implementations of the .next,
43397 // .throw, and .return methods.
43398 generator._invoke = makeInvokeMethod(innerFn, self, context);
43399
43400 return generator;
43401 }
43402 exports.wrap = wrap;
43403
43404 // Try/catch helper to minimize deoptimizations. Returns a completion
43405 // record like context.tryEntries[i].completion. This interface could
43406 // have been (and was previously) designed to take a closure to be
43407 // invoked without arguments, but in all the cases we care about we
43408 // already have an existing method we want to call, so there's no need
43409 // to create a new function object. We can even get away with assuming
43410 // the method takes exactly one argument, since that happens to be true
43411 // in every case, so we don't have to touch the arguments object. The
43412 // only additional allocation required is the completion record, which
43413 // has a stable shape and so hopefully should be cheap to allocate.
43414 function tryCatch(fn, obj, arg) {
43415 try {
43416 return { type: "normal", arg: fn.call(obj, arg) };
43417 } catch (err) {
43418 return { type: "throw", arg: err };
43419 }
43420 }
43421
43422 var GenStateSuspendedStart = "suspendedStart";
43423 var GenStateSuspendedYield = "suspendedYield";
43424 var GenStateExecuting = "executing";
43425 var GenStateCompleted = "completed";
43426
43427 // Returning this object from the innerFn has the same effect as
43428 // breaking out of the dispatch switch statement.
43429 var ContinueSentinel = {};
43430
43431 // Dummy constructor functions that we use as the .constructor and
43432 // .constructor.prototype properties for functions that return Generator
43433 // objects. For full spec compliance, you may wish to configure your
43434 // minifier not to mangle the names of these two functions.
43435 function Generator() {}
43436 function GeneratorFunction() {}
43437 function GeneratorFunctionPrototype() {}
43438
43439 // This is a polyfill for %IteratorPrototype% for environments that
43440 // don't natively support it.
43441 var IteratorPrototype = {};
43442 IteratorPrototype[iteratorSymbol] = function () {
43443 return this;
43444 };
43445
43446 var getProto = Object.getPrototypeOf;
43447 var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
43448 if (NativeIteratorPrototype &&
43449 NativeIteratorPrototype !== Op &&
43450 hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
43451 // This environment has a native %IteratorPrototype%; use it instead
43452 // of the polyfill.
43453 IteratorPrototype = NativeIteratorPrototype;
43454 }
43455
43456 var Gp = GeneratorFunctionPrototype.prototype =
43457 Generator.prototype = Object.create(IteratorPrototype);
43458 GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;
43459 GeneratorFunctionPrototype.constructor = GeneratorFunction;
43460 GeneratorFunction.displayName = define(
43461 GeneratorFunctionPrototype,
43462 toStringTagSymbol,
43463 "GeneratorFunction"
43464 );
43465
43466 // Helper for defining the .next, .throw, and .return methods of the
43467 // Iterator interface in terms of a single ._invoke method.
43468 function defineIteratorMethods(prototype) {
43469 ["next", "throw", "return"].forEach(function(method) {
43470 define(prototype, method, function(arg) {
43471 return this._invoke(method, arg);
43472 });
43473 });
43474 }
43475
43476 exports.isGeneratorFunction = function(genFun) {
43477 var ctor = typeof genFun === "function" && genFun.constructor;
43478 return ctor
43479 ? ctor === GeneratorFunction ||
43480 // For the native GeneratorFunction constructor, the best we can
43481 // do is to check its .name property.
43482 (ctor.displayName || ctor.name) === "GeneratorFunction"
43483 : false;
43484 };
43485
43486 exports.mark = function(genFun) {
43487 if (Object.setPrototypeOf) {
43488 Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
43489 } else {
43490 genFun.__proto__ = GeneratorFunctionPrototype;
43491 define(genFun, toStringTagSymbol, "GeneratorFunction");
43492 }
43493 genFun.prototype = Object.create(Gp);
43494 return genFun;
43495 };
43496
43497 // Within the body of any async function, `await x` is transformed to
43498 // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
43499 // `hasOwn.call(value, "__await")` to determine if the yielded value is
43500 // meant to be awaited.
43501 exports.awrap = function(arg) {
43502 return { __await: arg };
43503 };
43504
43505 function AsyncIterator(generator, PromiseImpl) {
43506 function invoke(method, arg, resolve, reject) {
43507 var record = tryCatch(generator[method], generator, arg);
43508 if (record.type === "throw") {
43509 reject(record.arg);
43510 } else {
43511 var result = record.arg;
43512 var value = result.value;
43513 if (value &&
43514 typeof value === "object" &&
43515 hasOwn.call(value, "__await")) {
43516 return PromiseImpl.resolve(value.__await).then(function(value) {
43517 invoke("next", value, resolve, reject);
43518 }, function(err) {
43519 invoke("throw", err, resolve, reject);
43520 });
43521 }
43522
43523 return PromiseImpl.resolve(value).then(function(unwrapped) {
43524 // When a yielded Promise is resolved, its final value becomes
43525 // the .value of the Promise<{value,done}> result for the
43526 // current iteration.
43527 result.value = unwrapped;
43528 resolve(result);
43529 }, function(error) {
43530 // If a rejected Promise was yielded, throw the rejection back
43531 // into the async generator function so it can be handled there.
43532 return invoke("throw", error, resolve, reject);
43533 });
43534 }
43535 }
43536
43537 var previousPromise;
43538
43539 function enqueue(method, arg) {
43540 function callInvokeWithMethodAndArg() {
43541 return new PromiseImpl(function(resolve, reject) {
43542 invoke(method, arg, resolve, reject);
43543 });
43544 }
43545
43546 return previousPromise =
43547 // If enqueue has been called before, then we want to wait until
43548 // all previous Promises have been resolved before calling invoke,
43549 // so that results are always delivered in the correct order. If
43550 // enqueue has not been called before, then it is important to
43551 // call invoke immediately, without waiting on a callback to fire,
43552 // so that the async generator function has the opportunity to do
43553 // any necessary setup in a predictable way. This predictability
43554 // is why the Promise constructor synchronously invokes its
43555 // executor callback, and why async functions synchronously
43556 // execute code before the first await. Since we implement simple
43557 // async functions in terms of async generators, it is especially
43558 // important to get this right, even though it requires care.
43559 previousPromise ? previousPromise.then(
43560 callInvokeWithMethodAndArg,
43561 // Avoid propagating failures to Promises returned by later
43562 // invocations of the iterator.
43563 callInvokeWithMethodAndArg
43564 ) : callInvokeWithMethodAndArg();
43565 }
43566
43567 // Define the unified helper method that is used to implement .next,
43568 // .throw, and .return (see defineIteratorMethods).
43569 this._invoke = enqueue;
43570 }
43571
43572 defineIteratorMethods(AsyncIterator.prototype);
43573 AsyncIterator.prototype[asyncIteratorSymbol] = function () {
43574 return this;
43575 };
43576 exports.AsyncIterator = AsyncIterator;
43577
43578 // Note that simple async functions are implemented on top of
43579 // AsyncIterator objects; they just return a Promise for the value of
43580 // the final result produced by the iterator.
43581 exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) {
43582 if (PromiseImpl === void 0) PromiseImpl = Promise;
43583
43584 var iter = new AsyncIterator(
43585 wrap(innerFn, outerFn, self, tryLocsList),
43586 PromiseImpl
43587 );
43588
43589 return exports.isGeneratorFunction(outerFn)
43590 ? iter // If outerFn is a generator, return the full iterator.
43591 : iter.next().then(function(result) {
43592 return result.done ? result.value : iter.next();
43593 });
43594 };
43595
43596 function makeInvokeMethod(innerFn, self, context) {
43597 var state = GenStateSuspendedStart;
43598
43599 return function invoke(method, arg) {
43600 if (state === GenStateExecuting) {
43601 throw new Error("Generator is already running");
43602 }
43603
43604 if (state === GenStateCompleted) {
43605 if (method === "throw") {
43606 throw arg;
43607 }
43608
43609 // Be forgiving, per 25.3.3.3.3 of the spec:
43610 // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
43611 return doneResult();
43612 }
43613
43614 context.method = method;
43615 context.arg = arg;
43616
43617 while (true) {
43618 var delegate = context.delegate;
43619 if (delegate) {
43620 var delegateResult = maybeInvokeDelegate(delegate, context);
43621 if (delegateResult) {
43622 if (delegateResult === ContinueSentinel) continue;
43623 return delegateResult;
43624 }
43625 }
43626
43627 if (context.method === "next") {
43628 // Setting context._sent for legacy support of Babel's
43629 // function.sent implementation.
43630 context.sent = context._sent = context.arg;
43631
43632 } else if (context.method === "throw") {
43633 if (state === GenStateSuspendedStart) {
43634 state = GenStateCompleted;
43635 throw context.arg;
43636 }
43637
43638 context.dispatchException(context.arg);
43639
43640 } else if (context.method === "return") {
43641 context.abrupt("return", context.arg);
43642 }
43643
43644 state = GenStateExecuting;
43645
43646 var record = tryCatch(innerFn, self, context);
43647 if (record.type === "normal") {
43648 // If an exception is thrown from innerFn, we leave state ===
43649 // GenStateExecuting and loop back for another invocation.
43650 state = context.done
43651 ? GenStateCompleted
43652 : GenStateSuspendedYield;
43653
43654 if (record.arg === ContinueSentinel) {
43655 continue;
43656 }
43657
43658 return {
43659 value: record.arg,
43660 done: context.done
43661 };
43662
43663 } else if (record.type === "throw") {
43664 state = GenStateCompleted;
43665 // Dispatch the exception by looping back around to the
43666 // context.dispatchException(context.arg) call above.
43667 context.method = "throw";
43668 context.arg = record.arg;
43669 }
43670 }
43671 };
43672 }
43673
43674 // Call delegate.iterator[context.method](context.arg) and handle the
43675 // result, either by returning a { value, done } result from the
43676 // delegate iterator, or by modifying context.method and context.arg,
43677 // setting context.delegate to null, and returning the ContinueSentinel.
43678 function maybeInvokeDelegate(delegate, context) {
43679 var method = delegate.iterator[context.method];
43680 if (method === undefined) {
43681 // A .throw or .return when the delegate iterator has no .throw
43682 // method always terminates the yield* loop.
43683 context.delegate = null;
43684
43685 if (context.method === "throw") {
43686 // Note: ["return"] must be used for ES3 parsing compatibility.
43687 if (delegate.iterator["return"]) {
43688 // If the delegate iterator has a return method, give it a
43689 // chance to clean up.
43690 context.method = "return";
43691 context.arg = undefined;
43692 maybeInvokeDelegate(delegate, context);
43693
43694 if (context.method === "throw") {
43695 // If maybeInvokeDelegate(context) changed context.method from
43696 // "return" to "throw", let that override the TypeError below.
43697 return ContinueSentinel;
43698 }
43699 }
43700
43701 context.method = "throw";
43702 context.arg = new TypeError(
43703 "The iterator does not provide a 'throw' method");
43704 }
43705
43706 return ContinueSentinel;
43707 }
43708
43709 var record = tryCatch(method, delegate.iterator, context.arg);
43710
43711 if (record.type === "throw") {
43712 context.method = "throw";
43713 context.arg = record.arg;
43714 context.delegate = null;
43715 return ContinueSentinel;
43716 }
43717
43718 var info = record.arg;
43719
43720 if (! info) {
43721 context.method = "throw";
43722 context.arg = new TypeError("iterator result is not an object");
43723 context.delegate = null;
43724 return ContinueSentinel;
43725 }
43726
43727 if (info.done) {
43728 // Assign the result of the finished delegate to the temporary
43729 // variable specified by delegate.resultName (see delegateYield).
43730 context[delegate.resultName] = info.value;
43731
43732 // Resume execution at the desired location (see delegateYield).
43733 context.next = delegate.nextLoc;
43734
43735 // If context.method was "throw" but the delegate handled the
43736 // exception, let the outer generator proceed normally. If
43737 // context.method was "next", forget context.arg since it has been
43738 // "consumed" by the delegate iterator. If context.method was
43739 // "return", allow the original .return call to continue in the
43740 // outer generator.
43741 if (context.method !== "return") {
43742 context.method = "next";
43743 context.arg = undefined;
43744 }
43745
43746 } else {
43747 // Re-yield the result returned by the delegate method.
43748 return info;
43749 }
43750
43751 // The delegate iterator is finished, so forget it and continue with
43752 // the outer generator.
43753 context.delegate = null;
43754 return ContinueSentinel;
43755 }
43756
43757 // Define Generator.prototype.{next,throw,return} in terms of the
43758 // unified ._invoke helper method.
43759 defineIteratorMethods(Gp);
43760
43761 define(Gp, toStringTagSymbol, "Generator");
43762
43763 // A Generator should always return itself as the iterator object when the
43764 // @@iterator function is called on it. Some browsers' implementations of the
43765 // iterator prototype chain incorrectly implement this, causing the Generator
43766 // object to not be returned from this call. This ensures that doesn't happen.
43767 // See https://github.com/facebook/regenerator/issues/274 for more details.
43768 Gp[iteratorSymbol] = function() {
43769 return this;
43770 };
43771
43772 Gp.toString = function() {
43773 return "[object Generator]";
43774 };
43775
43776 function pushTryEntry(locs) {
43777 var entry = { tryLoc: locs[0] };
43778
43779 if (1 in locs) {
43780 entry.catchLoc = locs[1];
43781 }
43782
43783 if (2 in locs) {
43784 entry.finallyLoc = locs[2];
43785 entry.afterLoc = locs[3];
43786 }
43787
43788 this.tryEntries.push(entry);
43789 }
43790
43791 function resetTryEntry(entry) {
43792 var record = entry.completion || {};
43793 record.type = "normal";
43794 delete record.arg;
43795 entry.completion = record;
43796 }
43797
43798 function Context(tryLocsList) {
43799 // The root entry object (effectively a try statement without a catch
43800 // or a finally block) gives us a place to store values thrown from
43801 // locations where there is no enclosing try statement.
43802 this.tryEntries = [{ tryLoc: "root" }];
43803 tryLocsList.forEach(pushTryEntry, this);
43804 this.reset(true);
43805 }
43806
43807 exports.keys = function(object) {
43808 var keys = [];
43809 for (var key in object) {
43810 keys.push(key);
43811 }
43812 keys.reverse();
43813
43814 // Rather than returning an object with a next method, we keep
43815 // things simple and return the next function itself.
43816 return function next() {
43817 while (keys.length) {
43818 var key = keys.pop();
43819 if (key in object) {
43820 next.value = key;
43821 next.done = false;
43822 return next;
43823 }
43824 }
43825
43826 // To avoid creating an additional object, we just hang the .value
43827 // and .done properties off the next function object itself. This
43828 // also ensures that the minifier will not anonymize the function.
43829 next.done = true;
43830 return next;
43831 };
43832 };
43833
43834 function values(iterable) {
43835 if (iterable) {
43836 var iteratorMethod = iterable[iteratorSymbol];
43837 if (iteratorMethod) {
43838 return iteratorMethod.call(iterable);
43839 }
43840
43841 if (typeof iterable.next === "function") {
43842 return iterable;
43843 }
43844
43845 if (!isNaN(iterable.length)) {
43846 var i = -1, next = function next() {
43847 while (++i < iterable.length) {
43848 if (hasOwn.call(iterable, i)) {
43849 next.value = iterable[i];
43850 next.done = false;
43851 return next;
43852 }
43853 }
43854
43855 next.value = undefined;
43856 next.done = true;
43857
43858 return next;
43859 };
43860
43861 return next.next = next;
43862 }
43863 }
43864
43865 // Return an iterator with no values.
43866 return { next: doneResult };
43867 }
43868 exports.values = values;
43869
43870 function doneResult() {
43871 return { value: undefined, done: true };
43872 }
43873
43874 Context.prototype = {
43875 constructor: Context,
43876
43877 reset: function(skipTempReset) {
43878 this.prev = 0;
43879 this.next = 0;
43880 // Resetting context._sent for legacy support of Babel's
43881 // function.sent implementation.
43882 this.sent = this._sent = undefined;
43883 this.done = false;
43884 this.delegate = null;
43885
43886 this.method = "next";
43887 this.arg = undefined;
43888
43889 this.tryEntries.forEach(resetTryEntry);
43890
43891 if (!skipTempReset) {
43892 for (var name in this) {
43893 // Not sure about the optimal order of these conditions:
43894 if (name.charAt(0) === "t" &&
43895 hasOwn.call(this, name) &&
43896 !isNaN(+name.slice(1))) {
43897 this[name] = undefined;
43898 }
43899 }
43900 }
43901 },
43902
43903 stop: function() {
43904 this.done = true;
43905
43906 var rootEntry = this.tryEntries[0];
43907 var rootRecord = rootEntry.completion;
43908 if (rootRecord.type === "throw") {
43909 throw rootRecord.arg;
43910 }
43911
43912 return this.rval;
43913 },
43914
43915 dispatchException: function(exception) {
43916 if (this.done) {
43917 throw exception;
43918 }
43919
43920 var context = this;
43921 function handle(loc, caught) {
43922 record.type = "throw";
43923 record.arg = exception;
43924 context.next = loc;
43925
43926 if (caught) {
43927 // If the dispatched exception was caught by a catch block,
43928 // then let that catch block handle the exception normally.
43929 context.method = "next";
43930 context.arg = undefined;
43931 }
43932
43933 return !! caught;
43934 }
43935
43936 for (var i = this.tryEntries.length - 1; i >= 0; --i) {
43937 var entry = this.tryEntries[i];
43938 var record = entry.completion;
43939
43940 if (entry.tryLoc === "root") {
43941 // Exception thrown outside of any try block that could handle
43942 // it, so set the completion value of the entire function to
43943 // throw the exception.
43944 return handle("end");
43945 }
43946
43947 if (entry.tryLoc <= this.prev) {
43948 var hasCatch = hasOwn.call(entry, "catchLoc");
43949 var hasFinally = hasOwn.call(entry, "finallyLoc");
43950
43951 if (hasCatch && hasFinally) {
43952 if (this.prev < entry.catchLoc) {
43953 return handle(entry.catchLoc, true);
43954 } else if (this.prev < entry.finallyLoc) {
43955 return handle(entry.finallyLoc);
43956 }
43957
43958 } else if (hasCatch) {
43959 if (this.prev < entry.catchLoc) {
43960 return handle(entry.catchLoc, true);
43961 }
43962
43963 } else if (hasFinally) {
43964 if (this.prev < entry.finallyLoc) {
43965 return handle(entry.finallyLoc);
43966 }
43967
43968 } else {
43969 throw new Error("try statement without catch or finally");
43970 }
43971 }
43972 }
43973 },
43974
43975 abrupt: function(type, arg) {
43976 for (var i = this.tryEntries.length - 1; i >= 0; --i) {
43977 var entry = this.tryEntries[i];
43978 if (entry.tryLoc <= this.prev &&
43979 hasOwn.call(entry, "finallyLoc") &&
43980 this.prev < entry.finallyLoc) {
43981 var finallyEntry = entry;
43982 break;
43983 }
43984 }
43985
43986 if (finallyEntry &&
43987 (type === "break" ||
43988 type === "continue") &&
43989 finallyEntry.tryLoc <= arg &&
43990 arg <= finallyEntry.finallyLoc) {
43991 // Ignore the finally entry if control is not jumping to a
43992 // location outside the try/catch block.
43993 finallyEntry = null;
43994 }
43995
43996 var record = finallyEntry ? finallyEntry.completion : {};
43997 record.type = type;
43998 record.arg = arg;
43999
44000 if (finallyEntry) {
44001 this.method = "next";
44002 this.next = finallyEntry.finallyLoc;
44003 return ContinueSentinel;
44004 }
44005
44006 return this.complete(record);
44007 },
44008
44009 complete: function(record, afterLoc) {
44010 if (record.type === "throw") {
44011 throw record.arg;
44012 }
44013
44014 if (record.type === "break" ||
44015 record.type === "continue") {
44016 this.next = record.arg;
44017 } else if (record.type === "return") {
44018 this.rval = this.arg = record.arg;
44019 this.method = "return";
44020 this.next = "end";
44021 } else if (record.type === "normal" && afterLoc) {
44022 this.next = afterLoc;
44023 }
44024
44025 return ContinueSentinel;
44026 },
44027
44028 finish: function(finallyLoc) {
44029 for (var i = this.tryEntries.length - 1; i >= 0; --i) {
44030 var entry = this.tryEntries[i];
44031 if (entry.finallyLoc === finallyLoc) {
44032 this.complete(entry.completion, entry.afterLoc);
44033 resetTryEntry(entry);
44034 return ContinueSentinel;
44035 }
44036 }
44037 },
44038
44039 "catch": function(tryLoc) {
44040 for (var i = this.tryEntries.length - 1; i >= 0; --i) {
44041 var entry = this.tryEntries[i];
44042 if (entry.tryLoc === tryLoc) {
44043 var record = entry.completion;
44044 if (record.type === "throw") {
44045 var thrown = record.arg;
44046 resetTryEntry(entry);
44047 }
44048 return thrown;
44049 }
44050 }
44051
44052 // The context.catch method must only be called with a location
44053 // argument that corresponds to a known catch block.
44054 throw new Error("illegal catch attempt");
44055 },
44056
44057 delegateYield: function(iterable, resultName, nextLoc) {
44058 this.delegate = {
44059 iterator: values(iterable),
44060 resultName: resultName,
44061 nextLoc: nextLoc
44062 };
44063
44064 if (this.method === "next") {
44065 // Deliberately forget the last sent value so that we don't
44066 // accidentally pass it on to the delegate.
44067 this.arg = undefined;
44068 }
44069
44070 return ContinueSentinel;
44071 }
44072 };
44073
44074 // Regardless of whether this script is executing as a CommonJS module
44075 // or not, return the runtime object so that we can declare the variable
44076 // regeneratorRuntime in the outer scope, which allows this module to be
44077 // injected easily by `bin/regenerator --include-runtime script.js`.
44078 return exports;
44079
44080}(
44081 // If this script is executing as a CommonJS module, use module.exports
44082 // as the regeneratorRuntime namespace. Otherwise create a new empty
44083 // object. Either way, the resulting object will be used to initialize
44084 // the regeneratorRuntime variable at the top of this file.
44085 true ? module.exports : {}
44086));
44087
44088try {
44089 regeneratorRuntime = runtime;
44090} catch (accidentalStrictMode) {
44091 // This module should not be running in strict mode, so the above
44092 // assignment should always work unless something is misconfigured. Just
44093 // in case runtime.js accidentally runs in strict mode, we can escape
44094 // strict mode using a global Function call. This could conceivably fail
44095 // if a Content Security Policy forbids using Function, but in that case
44096 // the proper solution is to fix the accidental strict mode problem. If
44097 // you've misconfigured your bundler to force strict mode and applied a
44098 // CSP to forbid Function, and you're not willing to fix either of those
44099 // problems, please detail your unique predicament in a GitHub issue.
44100 Function("r", "regeneratorRuntime = r")(runtime);
44101}
44102
44103
44104/***/ }),
44105/* 659 */
44106/***/ (function(module, exports) {
44107
44108function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
44109 try {
44110 var info = gen[key](arg);
44111 var value = info.value;
44112 } catch (error) {
44113 reject(error);
44114 return;
44115 }
44116
44117 if (info.done) {
44118 resolve(value);
44119 } else {
44120 Promise.resolve(value).then(_next, _throw);
44121 }
44122}
44123
44124function _asyncToGenerator(fn) {
44125 return function () {
44126 var self = this,
44127 args = arguments;
44128 return new Promise(function (resolve, reject) {
44129 var gen = fn.apply(self, args);
44130
44131 function _next(value) {
44132 asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
44133 }
44134
44135 function _throw(err) {
44136 asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
44137 }
44138
44139 _next(undefined);
44140 });
44141 };
44142}
44143
44144module.exports = _asyncToGenerator;
44145
44146/***/ }),
44147/* 660 */
44148/***/ (function(module, exports, __webpack_require__) {
44149
44150var arrayWithoutHoles = __webpack_require__(661);
44151
44152var iterableToArray = __webpack_require__(270);
44153
44154var unsupportedIterableToArray = __webpack_require__(271);
44155
44156var nonIterableSpread = __webpack_require__(662);
44157
44158function _toConsumableArray(arr) {
44159 return arrayWithoutHoles(arr) || iterableToArray(arr) || unsupportedIterableToArray(arr) || nonIterableSpread();
44160}
44161
44162module.exports = _toConsumableArray;
44163
44164/***/ }),
44165/* 661 */
44166/***/ (function(module, exports, __webpack_require__) {
44167
44168var arrayLikeToArray = __webpack_require__(269);
44169
44170function _arrayWithoutHoles(arr) {
44171 if (Array.isArray(arr)) return arrayLikeToArray(arr);
44172}
44173
44174module.exports = _arrayWithoutHoles;
44175
44176/***/ }),
44177/* 662 */
44178/***/ (function(module, exports) {
44179
44180function _nonIterableSpread() {
44181 throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
44182}
44183
44184module.exports = _nonIterableSpread;
44185
44186/***/ }),
44187/* 663 */
44188/***/ (function(module, exports) {
44189
44190function _defineProperty(obj, key, value) {
44191 if (key in obj) {
44192 Object.defineProperty(obj, key, {
44193 value: value,
44194 enumerable: true,
44195 configurable: true,
44196 writable: true
44197 });
44198 } else {
44199 obj[key] = value;
44200 }
44201
44202 return obj;
44203}
44204
44205module.exports = _defineProperty;
44206
44207/***/ }),
44208/* 664 */
44209/***/ (function(module, exports, __webpack_require__) {
44210
44211var objectWithoutPropertiesLoose = __webpack_require__(665);
44212
44213function _objectWithoutProperties(source, excluded) {
44214 if (source == null) return {};
44215 var target = objectWithoutPropertiesLoose(source, excluded);
44216 var key, i;
44217
44218 if (Object.getOwnPropertySymbols) {
44219 var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
44220
44221 for (i = 0; i < sourceSymbolKeys.length; i++) {
44222 key = sourceSymbolKeys[i];
44223 if (excluded.indexOf(key) >= 0) continue;
44224 if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
44225 target[key] = source[key];
44226 }
44227 }
44228
44229 return target;
44230}
44231
44232module.exports = _objectWithoutProperties;
44233
44234/***/ }),
44235/* 665 */
44236/***/ (function(module, exports) {
44237
44238function _objectWithoutPropertiesLoose(source, excluded) {
44239 if (source == null) return {};
44240 var target = {};
44241 var sourceKeys = Object.keys(source);
44242 var key, i;
44243
44244 for (i = 0; i < sourceKeys.length; i++) {
44245 key = sourceKeys[i];
44246 if (excluded.indexOf(key) >= 0) continue;
44247 target[key] = source[key];
44248 }
44249
44250 return target;
44251}
44252
44253module.exports = _objectWithoutPropertiesLoose;
44254
44255/***/ }),
44256/* 666 */
44257/***/ (function(module, exports) {
44258
44259function _assertThisInitialized(self) {
44260 if (self === void 0) {
44261 throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
44262 }
44263
44264 return self;
44265}
44266
44267module.exports = _assertThisInitialized;
44268
44269/***/ }),
44270/* 667 */
44271/***/ (function(module, exports) {
44272
44273function _inheritsLoose(subClass, superClass) {
44274 subClass.prototype = Object.create(superClass.prototype);
44275 subClass.prototype.constructor = subClass;
44276 subClass.__proto__ = superClass;
44277}
44278
44279module.exports = _inheritsLoose;
44280
44281/***/ }),
44282/* 668 */
44283/***/ (function(module, exports, __webpack_require__) {
44284
44285var arrayShuffle = __webpack_require__(669),
44286 baseShuffle = __webpack_require__(672),
44287 isArray = __webpack_require__(277);
44288
44289/**
44290 * Creates an array of shuffled values, using a version of the
44291 * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle).
44292 *
44293 * @static
44294 * @memberOf _
44295 * @since 0.1.0
44296 * @category Collection
44297 * @param {Array|Object} collection The collection to shuffle.
44298 * @returns {Array} Returns the new shuffled array.
44299 * @example
44300 *
44301 * _.shuffle([1, 2, 3, 4]);
44302 * // => [4, 1, 3, 2]
44303 */
44304function shuffle(collection) {
44305 var func = isArray(collection) ? arrayShuffle : baseShuffle;
44306 return func(collection);
44307}
44308
44309module.exports = shuffle;
44310
44311
44312/***/ }),
44313/* 669 */
44314/***/ (function(module, exports, __webpack_require__) {
44315
44316var copyArray = __webpack_require__(670),
44317 shuffleSelf = __webpack_require__(272);
44318
44319/**
44320 * A specialized version of `_.shuffle` for arrays.
44321 *
44322 * @private
44323 * @param {Array} array The array to shuffle.
44324 * @returns {Array} Returns the new shuffled array.
44325 */
44326function arrayShuffle(array) {
44327 return shuffleSelf(copyArray(array));
44328}
44329
44330module.exports = arrayShuffle;
44331
44332
44333/***/ }),
44334/* 670 */
44335/***/ (function(module, exports) {
44336
44337/**
44338 * Copies the values of `source` to `array`.
44339 *
44340 * @private
44341 * @param {Array} source The array to copy values from.
44342 * @param {Array} [array=[]] The array to copy values to.
44343 * @returns {Array} Returns `array`.
44344 */
44345function copyArray(source, array) {
44346 var index = -1,
44347 length = source.length;
44348
44349 array || (array = Array(length));
44350 while (++index < length) {
44351 array[index] = source[index];
44352 }
44353 return array;
44354}
44355
44356module.exports = copyArray;
44357
44358
44359/***/ }),
44360/* 671 */
44361/***/ (function(module, exports) {
44362
44363/* Built-in method references for those with the same name as other `lodash` methods. */
44364var nativeFloor = Math.floor,
44365 nativeRandom = Math.random;
44366
44367/**
44368 * The base implementation of `_.random` without support for returning
44369 * floating-point numbers.
44370 *
44371 * @private
44372 * @param {number} lower The lower bound.
44373 * @param {number} upper The upper bound.
44374 * @returns {number} Returns the random number.
44375 */
44376function baseRandom(lower, upper) {
44377 return lower + nativeFloor(nativeRandom() * (upper - lower + 1));
44378}
44379
44380module.exports = baseRandom;
44381
44382
44383/***/ }),
44384/* 672 */
44385/***/ (function(module, exports, __webpack_require__) {
44386
44387var shuffleSelf = __webpack_require__(272),
44388 values = __webpack_require__(273);
44389
44390/**
44391 * The base implementation of `_.shuffle`.
44392 *
44393 * @private
44394 * @param {Array|Object} collection The collection to shuffle.
44395 * @returns {Array} Returns the new shuffled array.
44396 */
44397function baseShuffle(collection) {
44398 return shuffleSelf(values(collection));
44399}
44400
44401module.exports = baseShuffle;
44402
44403
44404/***/ }),
44405/* 673 */
44406/***/ (function(module, exports, __webpack_require__) {
44407
44408var arrayMap = __webpack_require__(674);
44409
44410/**
44411 * The base implementation of `_.values` and `_.valuesIn` which creates an
44412 * array of `object` property values corresponding to the property names
44413 * of `props`.
44414 *
44415 * @private
44416 * @param {Object} object The object to query.
44417 * @param {Array} props The property names to get values for.
44418 * @returns {Object} Returns the array of property values.
44419 */
44420function baseValues(object, props) {
44421 return arrayMap(props, function(key) {
44422 return object[key];
44423 });
44424}
44425
44426module.exports = baseValues;
44427
44428
44429/***/ }),
44430/* 674 */
44431/***/ (function(module, exports) {
44432
44433/**
44434 * A specialized version of `_.map` for arrays without support for iteratee
44435 * shorthands.
44436 *
44437 * @private
44438 * @param {Array} [array] The array to iterate over.
44439 * @param {Function} iteratee The function invoked per iteration.
44440 * @returns {Array} Returns the new mapped array.
44441 */
44442function arrayMap(array, iteratee) {
44443 var index = -1,
44444 length = array == null ? 0 : array.length,
44445 result = Array(length);
44446
44447 while (++index < length) {
44448 result[index] = iteratee(array[index], index, array);
44449 }
44450 return result;
44451}
44452
44453module.exports = arrayMap;
44454
44455
44456/***/ }),
44457/* 675 */
44458/***/ (function(module, exports, __webpack_require__) {
44459
44460var arrayLikeKeys = __webpack_require__(676),
44461 baseKeys = __webpack_require__(689),
44462 isArrayLike = __webpack_require__(692);
44463
44464/**
44465 * Creates an array of the own enumerable property names of `object`.
44466 *
44467 * **Note:** Non-object values are coerced to objects. See the
44468 * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
44469 * for more details.
44470 *
44471 * @static
44472 * @since 0.1.0
44473 * @memberOf _
44474 * @category Object
44475 * @param {Object} object The object to query.
44476 * @returns {Array} Returns the array of property names.
44477 * @example
44478 *
44479 * function Foo() {
44480 * this.a = 1;
44481 * this.b = 2;
44482 * }
44483 *
44484 * Foo.prototype.c = 3;
44485 *
44486 * _.keys(new Foo);
44487 * // => ['a', 'b'] (iteration order is not guaranteed)
44488 *
44489 * _.keys('hi');
44490 * // => ['0', '1']
44491 */
44492function keys(object) {
44493 return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
44494}
44495
44496module.exports = keys;
44497
44498
44499/***/ }),
44500/* 676 */
44501/***/ (function(module, exports, __webpack_require__) {
44502
44503var baseTimes = __webpack_require__(677),
44504 isArguments = __webpack_require__(678),
44505 isArray = __webpack_require__(277),
44506 isBuffer = __webpack_require__(682),
44507 isIndex = __webpack_require__(684),
44508 isTypedArray = __webpack_require__(685);
44509
44510/** Used for built-in method references. */
44511var objectProto = Object.prototype;
44512
44513/** Used to check objects for own properties. */
44514var hasOwnProperty = objectProto.hasOwnProperty;
44515
44516/**
44517 * Creates an array of the enumerable property names of the array-like `value`.
44518 *
44519 * @private
44520 * @param {*} value The value to query.
44521 * @param {boolean} inherited Specify returning inherited property names.
44522 * @returns {Array} Returns the array of property names.
44523 */
44524function arrayLikeKeys(value, inherited) {
44525 var isArr = isArray(value),
44526 isArg = !isArr && isArguments(value),
44527 isBuff = !isArr && !isArg && isBuffer(value),
44528 isType = !isArr && !isArg && !isBuff && isTypedArray(value),
44529 skipIndexes = isArr || isArg || isBuff || isType,
44530 result = skipIndexes ? baseTimes(value.length, String) : [],
44531 length = result.length;
44532
44533 for (var key in value) {
44534 if ((inherited || hasOwnProperty.call(value, key)) &&
44535 !(skipIndexes && (
44536 // Safari 9 has enumerable `arguments.length` in strict mode.
44537 key == 'length' ||
44538 // Node.js 0.10 has enumerable non-index properties on buffers.
44539 (isBuff && (key == 'offset' || key == 'parent')) ||
44540 // PhantomJS 2 has enumerable non-index properties on typed arrays.
44541 (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
44542 // Skip index properties.
44543 isIndex(key, length)
44544 ))) {
44545 result.push(key);
44546 }
44547 }
44548 return result;
44549}
44550
44551module.exports = arrayLikeKeys;
44552
44553
44554/***/ }),
44555/* 677 */
44556/***/ (function(module, exports) {
44557
44558/**
44559 * The base implementation of `_.times` without support for iteratee shorthands
44560 * or max array length checks.
44561 *
44562 * @private
44563 * @param {number} n The number of times to invoke `iteratee`.
44564 * @param {Function} iteratee The function invoked per iteration.
44565 * @returns {Array} Returns the array of results.
44566 */
44567function baseTimes(n, iteratee) {
44568 var index = -1,
44569 result = Array(n);
44570
44571 while (++index < n) {
44572 result[index] = iteratee(index);
44573 }
44574 return result;
44575}
44576
44577module.exports = baseTimes;
44578
44579
44580/***/ }),
44581/* 678 */
44582/***/ (function(module, exports, __webpack_require__) {
44583
44584var baseIsArguments = __webpack_require__(679),
44585 isObjectLike = __webpack_require__(120);
44586
44587/** Used for built-in method references. */
44588var objectProto = Object.prototype;
44589
44590/** Used to check objects for own properties. */
44591var hasOwnProperty = objectProto.hasOwnProperty;
44592
44593/** Built-in value references. */
44594var propertyIsEnumerable = objectProto.propertyIsEnumerable;
44595
44596/**
44597 * Checks if `value` is likely an `arguments` object.
44598 *
44599 * @static
44600 * @memberOf _
44601 * @since 0.1.0
44602 * @category Lang
44603 * @param {*} value The value to check.
44604 * @returns {boolean} Returns `true` if `value` is an `arguments` object,
44605 * else `false`.
44606 * @example
44607 *
44608 * _.isArguments(function() { return arguments; }());
44609 * // => true
44610 *
44611 * _.isArguments([1, 2, 3]);
44612 * // => false
44613 */
44614var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
44615 return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&
44616 !propertyIsEnumerable.call(value, 'callee');
44617};
44618
44619module.exports = isArguments;
44620
44621
44622/***/ }),
44623/* 679 */
44624/***/ (function(module, exports, __webpack_require__) {
44625
44626var baseGetTag = __webpack_require__(119),
44627 isObjectLike = __webpack_require__(120);
44628
44629/** `Object#toString` result references. */
44630var argsTag = '[object Arguments]';
44631
44632/**
44633 * The base implementation of `_.isArguments`.
44634 *
44635 * @private
44636 * @param {*} value The value to check.
44637 * @returns {boolean} Returns `true` if `value` is an `arguments` object,
44638 */
44639function baseIsArguments(value) {
44640 return isObjectLike(value) && baseGetTag(value) == argsTag;
44641}
44642
44643module.exports = baseIsArguments;
44644
44645
44646/***/ }),
44647/* 680 */
44648/***/ (function(module, exports, __webpack_require__) {
44649
44650var Symbol = __webpack_require__(274);
44651
44652/** Used for built-in method references. */
44653var objectProto = Object.prototype;
44654
44655/** Used to check objects for own properties. */
44656var hasOwnProperty = objectProto.hasOwnProperty;
44657
44658/**
44659 * Used to resolve the
44660 * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
44661 * of values.
44662 */
44663var nativeObjectToString = objectProto.toString;
44664
44665/** Built-in value references. */
44666var symToStringTag = Symbol ? Symbol.toStringTag : undefined;
44667
44668/**
44669 * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
44670 *
44671 * @private
44672 * @param {*} value The value to query.
44673 * @returns {string} Returns the raw `toStringTag`.
44674 */
44675function getRawTag(value) {
44676 var isOwn = hasOwnProperty.call(value, symToStringTag),
44677 tag = value[symToStringTag];
44678
44679 try {
44680 value[symToStringTag] = undefined;
44681 var unmasked = true;
44682 } catch (e) {}
44683
44684 var result = nativeObjectToString.call(value);
44685 if (unmasked) {
44686 if (isOwn) {
44687 value[symToStringTag] = tag;
44688 } else {
44689 delete value[symToStringTag];
44690 }
44691 }
44692 return result;
44693}
44694
44695module.exports = getRawTag;
44696
44697
44698/***/ }),
44699/* 681 */
44700/***/ (function(module, exports) {
44701
44702/** Used for built-in method references. */
44703var objectProto = Object.prototype;
44704
44705/**
44706 * Used to resolve the
44707 * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
44708 * of values.
44709 */
44710var nativeObjectToString = objectProto.toString;
44711
44712/**
44713 * Converts `value` to a string using `Object.prototype.toString`.
44714 *
44715 * @private
44716 * @param {*} value The value to convert.
44717 * @returns {string} Returns the converted string.
44718 */
44719function objectToString(value) {
44720 return nativeObjectToString.call(value);
44721}
44722
44723module.exports = objectToString;
44724
44725
44726/***/ }),
44727/* 682 */
44728/***/ (function(module, exports, __webpack_require__) {
44729
44730/* WEBPACK VAR INJECTION */(function(module) {var root = __webpack_require__(275),
44731 stubFalse = __webpack_require__(683);
44732
44733/** Detect free variable `exports`. */
44734var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;
44735
44736/** Detect free variable `module`. */
44737var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
44738
44739/** Detect the popular CommonJS extension `module.exports`. */
44740var moduleExports = freeModule && freeModule.exports === freeExports;
44741
44742/** Built-in value references. */
44743var Buffer = moduleExports ? root.Buffer : undefined;
44744
44745/* Built-in method references for those with the same name as other `lodash` methods. */
44746var nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined;
44747
44748/**
44749 * Checks if `value` is a buffer.
44750 *
44751 * @static
44752 * @memberOf _
44753 * @since 4.3.0
44754 * @category Lang
44755 * @param {*} value The value to check.
44756 * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
44757 * @example
44758 *
44759 * _.isBuffer(new Buffer(2));
44760 * // => true
44761 *
44762 * _.isBuffer(new Uint8Array(2));
44763 * // => false
44764 */
44765var isBuffer = nativeIsBuffer || stubFalse;
44766
44767module.exports = isBuffer;
44768
44769/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(278)(module)))
44770
44771/***/ }),
44772/* 683 */
44773/***/ (function(module, exports) {
44774
44775/**
44776 * This method returns `false`.
44777 *
44778 * @static
44779 * @memberOf _
44780 * @since 4.13.0
44781 * @category Util
44782 * @returns {boolean} Returns `false`.
44783 * @example
44784 *
44785 * _.times(2, _.stubFalse);
44786 * // => [false, false]
44787 */
44788function stubFalse() {
44789 return false;
44790}
44791
44792module.exports = stubFalse;
44793
44794
44795/***/ }),
44796/* 684 */
44797/***/ (function(module, exports) {
44798
44799/** Used as references for various `Number` constants. */
44800var MAX_SAFE_INTEGER = 9007199254740991;
44801
44802/** Used to detect unsigned integer values. */
44803var reIsUint = /^(?:0|[1-9]\d*)$/;
44804
44805/**
44806 * Checks if `value` is a valid array-like index.
44807 *
44808 * @private
44809 * @param {*} value The value to check.
44810 * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
44811 * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
44812 */
44813function isIndex(value, length) {
44814 var type = typeof value;
44815 length = length == null ? MAX_SAFE_INTEGER : length;
44816
44817 return !!length &&
44818 (type == 'number' ||
44819 (type != 'symbol' && reIsUint.test(value))) &&
44820 (value > -1 && value % 1 == 0 && value < length);
44821}
44822
44823module.exports = isIndex;
44824
44825
44826/***/ }),
44827/* 685 */
44828/***/ (function(module, exports, __webpack_require__) {
44829
44830var baseIsTypedArray = __webpack_require__(686),
44831 baseUnary = __webpack_require__(687),
44832 nodeUtil = __webpack_require__(688);
44833
44834/* Node.js helper references. */
44835var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
44836
44837/**
44838 * Checks if `value` is classified as a typed array.
44839 *
44840 * @static
44841 * @memberOf _
44842 * @since 3.0.0
44843 * @category Lang
44844 * @param {*} value The value to check.
44845 * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
44846 * @example
44847 *
44848 * _.isTypedArray(new Uint8Array);
44849 * // => true
44850 *
44851 * _.isTypedArray([]);
44852 * // => false
44853 */
44854var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
44855
44856module.exports = isTypedArray;
44857
44858
44859/***/ }),
44860/* 686 */
44861/***/ (function(module, exports, __webpack_require__) {
44862
44863var baseGetTag = __webpack_require__(119),
44864 isLength = __webpack_require__(279),
44865 isObjectLike = __webpack_require__(120);
44866
44867/** `Object#toString` result references. */
44868var argsTag = '[object Arguments]',
44869 arrayTag = '[object Array]',
44870 boolTag = '[object Boolean]',
44871 dateTag = '[object Date]',
44872 errorTag = '[object Error]',
44873 funcTag = '[object Function]',
44874 mapTag = '[object Map]',
44875 numberTag = '[object Number]',
44876 objectTag = '[object Object]',
44877 regexpTag = '[object RegExp]',
44878 setTag = '[object Set]',
44879 stringTag = '[object String]',
44880 weakMapTag = '[object WeakMap]';
44881
44882var arrayBufferTag = '[object ArrayBuffer]',
44883 dataViewTag = '[object DataView]',
44884 float32Tag = '[object Float32Array]',
44885 float64Tag = '[object Float64Array]',
44886 int8Tag = '[object Int8Array]',
44887 int16Tag = '[object Int16Array]',
44888 int32Tag = '[object Int32Array]',
44889 uint8Tag = '[object Uint8Array]',
44890 uint8ClampedTag = '[object Uint8ClampedArray]',
44891 uint16Tag = '[object Uint16Array]',
44892 uint32Tag = '[object Uint32Array]';
44893
44894/** Used to identify `toStringTag` values of typed arrays. */
44895var typedArrayTags = {};
44896typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
44897typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
44898typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
44899typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
44900typedArrayTags[uint32Tag] = true;
44901typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
44902typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
44903typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
44904typedArrayTags[errorTag] = typedArrayTags[funcTag] =
44905typedArrayTags[mapTag] = typedArrayTags[numberTag] =
44906typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
44907typedArrayTags[setTag] = typedArrayTags[stringTag] =
44908typedArrayTags[weakMapTag] = false;
44909
44910/**
44911 * The base implementation of `_.isTypedArray` without Node.js optimizations.
44912 *
44913 * @private
44914 * @param {*} value The value to check.
44915 * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
44916 */
44917function baseIsTypedArray(value) {
44918 return isObjectLike(value) &&
44919 isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
44920}
44921
44922module.exports = baseIsTypedArray;
44923
44924
44925/***/ }),
44926/* 687 */
44927/***/ (function(module, exports) {
44928
44929/**
44930 * The base implementation of `_.unary` without support for storing metadata.
44931 *
44932 * @private
44933 * @param {Function} func The function to cap arguments for.
44934 * @returns {Function} Returns the new capped function.
44935 */
44936function baseUnary(func) {
44937 return function(value) {
44938 return func(value);
44939 };
44940}
44941
44942module.exports = baseUnary;
44943
44944
44945/***/ }),
44946/* 688 */
44947/***/ (function(module, exports, __webpack_require__) {
44948
44949/* WEBPACK VAR INJECTION */(function(module) {var freeGlobal = __webpack_require__(276);
44950
44951/** Detect free variable `exports`. */
44952var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;
44953
44954/** Detect free variable `module`. */
44955var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
44956
44957/** Detect the popular CommonJS extension `module.exports`. */
44958var moduleExports = freeModule && freeModule.exports === freeExports;
44959
44960/** Detect free variable `process` from Node.js. */
44961var freeProcess = moduleExports && freeGlobal.process;
44962
44963/** Used to access faster Node.js helpers. */
44964var nodeUtil = (function() {
44965 try {
44966 // Use `util.types` for Node.js 10+.
44967 var types = freeModule && freeModule.require && freeModule.require('util').types;
44968
44969 if (types) {
44970 return types;
44971 }
44972
44973 // Legacy `process.binding('util')` for Node.js < 10.
44974 return freeProcess && freeProcess.binding && freeProcess.binding('util');
44975 } catch (e) {}
44976}());
44977
44978module.exports = nodeUtil;
44979
44980/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(278)(module)))
44981
44982/***/ }),
44983/* 689 */
44984/***/ (function(module, exports, __webpack_require__) {
44985
44986var isPrototype = __webpack_require__(690),
44987 nativeKeys = __webpack_require__(691);
44988
44989/** Used for built-in method references. */
44990var objectProto = Object.prototype;
44991
44992/** Used to check objects for own properties. */
44993var hasOwnProperty = objectProto.hasOwnProperty;
44994
44995/**
44996 * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
44997 *
44998 * @private
44999 * @param {Object} object The object to query.
45000 * @returns {Array} Returns the array of property names.
45001 */
45002function baseKeys(object) {
45003 if (!isPrototype(object)) {
45004 return nativeKeys(object);
45005 }
45006 var result = [];
45007 for (var key in Object(object)) {
45008 if (hasOwnProperty.call(object, key) && key != 'constructor') {
45009 result.push(key);
45010 }
45011 }
45012 return result;
45013}
45014
45015module.exports = baseKeys;
45016
45017
45018/***/ }),
45019/* 690 */
45020/***/ (function(module, exports) {
45021
45022/** Used for built-in method references. */
45023var objectProto = Object.prototype;
45024
45025/**
45026 * Checks if `value` is likely a prototype object.
45027 *
45028 * @private
45029 * @param {*} value The value to check.
45030 * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
45031 */
45032function isPrototype(value) {
45033 var Ctor = value && value.constructor,
45034 proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
45035
45036 return value === proto;
45037}
45038
45039module.exports = isPrototype;
45040
45041
45042/***/ }),
45043/* 691 */
45044/***/ (function(module, exports, __webpack_require__) {
45045
45046var overArg = __webpack_require__(280);
45047
45048/* Built-in method references for those with the same name as other `lodash` methods. */
45049var nativeKeys = overArg(Object.keys, Object);
45050
45051module.exports = nativeKeys;
45052
45053
45054/***/ }),
45055/* 692 */
45056/***/ (function(module, exports, __webpack_require__) {
45057
45058var isFunction = __webpack_require__(693),
45059 isLength = __webpack_require__(279);
45060
45061/**
45062 * Checks if `value` is array-like. A value is considered array-like if it's
45063 * not a function and has a `value.length` that's an integer greater than or
45064 * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
45065 *
45066 * @static
45067 * @memberOf _
45068 * @since 4.0.0
45069 * @category Lang
45070 * @param {*} value The value to check.
45071 * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
45072 * @example
45073 *
45074 * _.isArrayLike([1, 2, 3]);
45075 * // => true
45076 *
45077 * _.isArrayLike(document.body.children);
45078 * // => true
45079 *
45080 * _.isArrayLike('abc');
45081 * // => true
45082 *
45083 * _.isArrayLike(_.noop);
45084 * // => false
45085 */
45086function isArrayLike(value) {
45087 return value != null && isLength(value.length) && !isFunction(value);
45088}
45089
45090module.exports = isArrayLike;
45091
45092
45093/***/ }),
45094/* 693 */
45095/***/ (function(module, exports, __webpack_require__) {
45096
45097var baseGetTag = __webpack_require__(119),
45098 isObject = __webpack_require__(694);
45099
45100/** `Object#toString` result references. */
45101var asyncTag = '[object AsyncFunction]',
45102 funcTag = '[object Function]',
45103 genTag = '[object GeneratorFunction]',
45104 proxyTag = '[object Proxy]';
45105
45106/**
45107 * Checks if `value` is classified as a `Function` object.
45108 *
45109 * @static
45110 * @memberOf _
45111 * @since 0.1.0
45112 * @category Lang
45113 * @param {*} value The value to check.
45114 * @returns {boolean} Returns `true` if `value` is a function, else `false`.
45115 * @example
45116 *
45117 * _.isFunction(_);
45118 * // => true
45119 *
45120 * _.isFunction(/abc/);
45121 * // => false
45122 */
45123function isFunction(value) {
45124 if (!isObject(value)) {
45125 return false;
45126 }
45127 // The use of `Object#toString` avoids issues with the `typeof` operator
45128 // in Safari 9 which returns 'object' for typed arrays and other constructors.
45129 var tag = baseGetTag(value);
45130 return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
45131}
45132
45133module.exports = isFunction;
45134
45135
45136/***/ }),
45137/* 694 */
45138/***/ (function(module, exports) {
45139
45140/**
45141 * Checks if `value` is the
45142 * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
45143 * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
45144 *
45145 * @static
45146 * @memberOf _
45147 * @since 0.1.0
45148 * @category Lang
45149 * @param {*} value The value to check.
45150 * @returns {boolean} Returns `true` if `value` is an object, else `false`.
45151 * @example
45152 *
45153 * _.isObject({});
45154 * // => true
45155 *
45156 * _.isObject([1, 2, 3]);
45157 * // => true
45158 *
45159 * _.isObject(_.noop);
45160 * // => true
45161 *
45162 * _.isObject(null);
45163 * // => false
45164 */
45165function isObject(value) {
45166 var type = typeof value;
45167 return value != null && (type == 'object' || type == 'function');
45168}
45169
45170module.exports = isObject;
45171
45172
45173/***/ }),
45174/* 695 */
45175/***/ (function(module, exports, __webpack_require__) {
45176
45177var arrayWithHoles = __webpack_require__(696);
45178
45179var iterableToArray = __webpack_require__(270);
45180
45181var unsupportedIterableToArray = __webpack_require__(271);
45182
45183var nonIterableRest = __webpack_require__(697);
45184
45185function _toArray(arr) {
45186 return arrayWithHoles(arr) || iterableToArray(arr) || unsupportedIterableToArray(arr) || nonIterableRest();
45187}
45188
45189module.exports = _toArray;
45190
45191/***/ }),
45192/* 696 */
45193/***/ (function(module, exports) {
45194
45195function _arrayWithHoles(arr) {
45196 if (Array.isArray(arr)) return arr;
45197}
45198
45199module.exports = _arrayWithHoles;
45200
45201/***/ }),
45202/* 697 */
45203/***/ (function(module, exports) {
45204
45205function _nonIterableRest() {
45206 throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
45207}
45208
45209module.exports = _nonIterableRest;
45210
45211/***/ }),
45212/* 698 */
45213/***/ (function(module, exports) {
45214
45215function _defineProperties(target, props) {
45216 for (var i = 0; i < props.length; i++) {
45217 var descriptor = props[i];
45218 descriptor.enumerable = descriptor.enumerable || false;
45219 descriptor.configurable = true;
45220 if ("value" in descriptor) descriptor.writable = true;
45221 Object.defineProperty(target, descriptor.key, descriptor);
45222 }
45223}
45224
45225function _createClass(Constructor, protoProps, staticProps) {
45226 if (protoProps) _defineProperties(Constructor.prototype, protoProps);
45227 if (staticProps) _defineProperties(Constructor, staticProps);
45228 return Constructor;
45229}
45230
45231module.exports = _createClass;
45232
45233/***/ }),
45234/* 699 */
45235/***/ (function(module, exports) {
45236
45237function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) {
45238 var desc = {};
45239 Object.keys(descriptor).forEach(function (key) {
45240 desc[key] = descriptor[key];
45241 });
45242 desc.enumerable = !!desc.enumerable;
45243 desc.configurable = !!desc.configurable;
45244
45245 if ('value' in desc || desc.initializer) {
45246 desc.writable = true;
45247 }
45248
45249 desc = decorators.slice().reverse().reduce(function (desc, decorator) {
45250 return decorator(target, property, desc) || desc;
45251 }, desc);
45252
45253 if (context && desc.initializer !== void 0) {
45254 desc.value = desc.initializer ? desc.initializer.call(context) : void 0;
45255 desc.initializer = undefined;
45256 }
45257
45258 if (desc.initializer === void 0) {
45259 Object.defineProperty(target, property, desc);
45260 desc = null;
45261 }
45262
45263 return desc;
45264}
45265
45266module.exports = _applyDecoratedDescriptor;
45267
45268/***/ }),
45269/* 700 */
45270/***/ (function(module, exports, __webpack_require__) {
45271
45272/*
45273
45274 Javascript State Machine Library - https://github.com/jakesgordon/javascript-state-machine
45275
45276 Copyright (c) 2012, 2013, 2014, 2015, Jake Gordon and contributors
45277 Released under the MIT license - https://github.com/jakesgordon/javascript-state-machine/blob/master/LICENSE
45278
45279*/
45280
45281(function () {
45282
45283 var StateMachine = {
45284
45285 //---------------------------------------------------------------------------
45286
45287 VERSION: "2.4.0",
45288
45289 //---------------------------------------------------------------------------
45290
45291 Result: {
45292 SUCCEEDED: 1, // the event transitioned successfully from one state to another
45293 NOTRANSITION: 2, // the event was successfull but no state transition was necessary
45294 CANCELLED: 3, // the event was cancelled by the caller in a beforeEvent callback
45295 PENDING: 4 // the event is asynchronous and the caller is in control of when the transition occurs
45296 },
45297
45298 Error: {
45299 INVALID_TRANSITION: 100, // caller tried to fire an event that was innapropriate in the current state
45300 PENDING_TRANSITION: 200, // caller tried to fire an event while an async transition was still pending
45301 INVALID_CALLBACK: 300 // caller provided callback function threw an exception
45302 },
45303
45304 WILDCARD: '*',
45305 ASYNC: 'async',
45306
45307 //---------------------------------------------------------------------------
45308
45309 create: function(cfg, target) {
45310
45311 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 }
45312 var terminal = cfg.terminal || cfg['final'];
45313 var fsm = target || cfg.target || {};
45314 var events = cfg.events || [];
45315 var callbacks = cfg.callbacks || {};
45316 var map = {}; // track state transitions allowed for an event { event: { from: [ to ] } }
45317 var transitions = {}; // track events allowed from a state { state: [ event ] }
45318
45319 var add = function(e) {
45320 var from = Array.isArray(e.from) ? e.from : (e.from ? [e.from] : [StateMachine.WILDCARD]); // allow 'wildcard' transition if 'from' is not specified
45321 map[e.name] = map[e.name] || {};
45322 for (var n = 0 ; n < from.length ; n++) {
45323 transitions[from[n]] = transitions[from[n]] || [];
45324 transitions[from[n]].push(e.name);
45325
45326 map[e.name][from[n]] = e.to || from[n]; // allow no-op transition if 'to' is not specified
45327 }
45328 if (e.to)
45329 transitions[e.to] = transitions[e.to] || [];
45330 };
45331
45332 if (initial) {
45333 initial.event = initial.event || 'startup';
45334 add({ name: initial.event, from: 'none', to: initial.state });
45335 }
45336
45337 for(var n = 0 ; n < events.length ; n++)
45338 add(events[n]);
45339
45340 for(var name in map) {
45341 if (map.hasOwnProperty(name))
45342 fsm[name] = StateMachine.buildEvent(name, map[name]);
45343 }
45344
45345 for(var name in callbacks) {
45346 if (callbacks.hasOwnProperty(name))
45347 fsm[name] = callbacks[name]
45348 }
45349
45350 fsm.current = 'none';
45351 fsm.is = function(state) { return Array.isArray(state) ? (state.indexOf(this.current) >= 0) : (this.current === state); };
45352 fsm.can = function(event) { return !this.transition && (map[event] !== undefined) && (map[event].hasOwnProperty(this.current) || map[event].hasOwnProperty(StateMachine.WILDCARD)); }
45353 fsm.cannot = function(event) { return !this.can(event); };
45354 fsm.transitions = function() { return (transitions[this.current] || []).concat(transitions[StateMachine.WILDCARD] || []); };
45355 fsm.isFinished = function() { return this.is(terminal); };
45356 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)
45357 fsm.states = function() { return Object.keys(transitions).sort() };
45358
45359 if (initial && !initial.defer)
45360 fsm[initial.event]();
45361
45362 return fsm;
45363
45364 },
45365
45366 //===========================================================================
45367
45368 doCallback: function(fsm, func, name, from, to, args) {
45369 if (func) {
45370 try {
45371 return func.apply(fsm, [name, from, to].concat(args));
45372 }
45373 catch(e) {
45374 return fsm.error(name, from, to, args, StateMachine.Error.INVALID_CALLBACK, "an exception occurred in a caller-provided callback function", e);
45375 }
45376 }
45377 },
45378
45379 beforeAnyEvent: function(fsm, name, from, to, args) { return StateMachine.doCallback(fsm, fsm['onbeforeevent'], name, from, to, args); },
45380 afterAnyEvent: function(fsm, name, from, to, args) { return StateMachine.doCallback(fsm, fsm['onafterevent'] || fsm['onevent'], name, from, to, args); },
45381 leaveAnyState: function(fsm, name, from, to, args) { return StateMachine.doCallback(fsm, fsm['onleavestate'], name, from, to, args); },
45382 enterAnyState: function(fsm, name, from, to, args) { return StateMachine.doCallback(fsm, fsm['onenterstate'] || fsm['onstate'], name, from, to, args); },
45383 changeState: function(fsm, name, from, to, args) { return StateMachine.doCallback(fsm, fsm['onchangestate'], name, from, to, args); },
45384
45385 beforeThisEvent: function(fsm, name, from, to, args) { return StateMachine.doCallback(fsm, fsm['onbefore' + name], name, from, to, args); },
45386 afterThisEvent: function(fsm, name, from, to, args) { return StateMachine.doCallback(fsm, fsm['onafter' + name] || fsm['on' + name], name, from, to, args); },
45387 leaveThisState: function(fsm, name, from, to, args) { return StateMachine.doCallback(fsm, fsm['onleave' + from], name, from, to, args); },
45388 enterThisState: function(fsm, name, from, to, args) { return StateMachine.doCallback(fsm, fsm['onenter' + to] || fsm['on' + to], name, from, to, args); },
45389
45390 beforeEvent: function(fsm, name, from, to, args) {
45391 if ((false === StateMachine.beforeThisEvent(fsm, name, from, to, args)) ||
45392 (false === StateMachine.beforeAnyEvent( fsm, name, from, to, args)))
45393 return false;
45394 },
45395
45396 afterEvent: function(fsm, name, from, to, args) {
45397 StateMachine.afterThisEvent(fsm, name, from, to, args);
45398 StateMachine.afterAnyEvent( fsm, name, from, to, args);
45399 },
45400
45401 leaveState: function(fsm, name, from, to, args) {
45402 var specific = StateMachine.leaveThisState(fsm, name, from, to, args),
45403 general = StateMachine.leaveAnyState( fsm, name, from, to, args);
45404 if ((false === specific) || (false === general))
45405 return false;
45406 else if ((StateMachine.ASYNC === specific) || (StateMachine.ASYNC === general))
45407 return StateMachine.ASYNC;
45408 },
45409
45410 enterState: function(fsm, name, from, to, args) {
45411 StateMachine.enterThisState(fsm, name, from, to, args);
45412 StateMachine.enterAnyState( fsm, name, from, to, args);
45413 },
45414
45415 //===========================================================================
45416
45417 buildEvent: function(name, map) {
45418 return function() {
45419
45420 var from = this.current;
45421 var to = map[from] || (map[StateMachine.WILDCARD] != StateMachine.WILDCARD ? map[StateMachine.WILDCARD] : from) || from;
45422 var args = Array.prototype.slice.call(arguments); // turn arguments into pure array
45423
45424 if (this.transition)
45425 return this.error(name, from, to, args, StateMachine.Error.PENDING_TRANSITION, "event " + name + " inappropriate because previous transition did not complete");
45426
45427 if (this.cannot(name))
45428 return this.error(name, from, to, args, StateMachine.Error.INVALID_TRANSITION, "event " + name + " inappropriate in current state " + this.current);
45429
45430 if (false === StateMachine.beforeEvent(this, name, from, to, args))
45431 return StateMachine.Result.CANCELLED;
45432
45433 if (from === to) {
45434 StateMachine.afterEvent(this, name, from, to, args);
45435 return StateMachine.Result.NOTRANSITION;
45436 }
45437
45438 // 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)
45439 var fsm = this;
45440 this.transition = function() {
45441 fsm.transition = null; // this method should only ever be called once
45442 fsm.current = to;
45443 StateMachine.enterState( fsm, name, from, to, args);
45444 StateMachine.changeState(fsm, name, from, to, args);
45445 StateMachine.afterEvent( fsm, name, from, to, args);
45446 return StateMachine.Result.SUCCEEDED;
45447 };
45448 this.transition.cancel = function() { // provide a way for caller to cancel async transition if desired (issue #22)
45449 fsm.transition = null;
45450 StateMachine.afterEvent(fsm, name, from, to, args);
45451 }
45452
45453 var leave = StateMachine.leaveState(this, name, from, to, args);
45454 if (false === leave) {
45455 this.transition = null;
45456 return StateMachine.Result.CANCELLED;
45457 }
45458 else if (StateMachine.ASYNC === leave) {
45459 return StateMachine.Result.PENDING;
45460 }
45461 else {
45462 if (this.transition) // need to check in case user manually called transition() but forgot to return StateMachine.ASYNC
45463 return this.transition();
45464 }
45465
45466 };
45467 }
45468
45469 }; // StateMachine
45470
45471 //===========================================================================
45472
45473 //======
45474 // NODE
45475 //======
45476 if (true) {
45477 if (typeof module !== 'undefined' && module.exports) {
45478 exports = module.exports = StateMachine;
45479 }
45480 exports.StateMachine = StateMachine;
45481 }
45482 //============
45483 // AMD/REQUIRE
45484 //============
45485 else if (typeof define === 'function' && define.amd) {
45486 define(function(require) { return StateMachine; });
45487 }
45488 //========
45489 // BROWSER
45490 //========
45491 else if (typeof window !== 'undefined') {
45492 window.StateMachine = StateMachine;
45493 }
45494 //===========
45495 // WEB WORKER
45496 //===========
45497 else if (typeof self !== 'undefined') {
45498 self.StateMachine = StateMachine;
45499 }
45500
45501}());
45502
45503
45504/***/ }),
45505/* 701 */
45506/***/ (function(module, exports) {
45507
45508function _typeof(obj) {
45509 "@babel/helpers - typeof";
45510
45511 if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
45512 module.exports = _typeof = function _typeof(obj) {
45513 return typeof obj;
45514 };
45515 } else {
45516 module.exports = _typeof = function _typeof(obj) {
45517 return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
45518 };
45519 }
45520
45521 return _typeof(obj);
45522}
45523
45524module.exports = _typeof;
45525
45526/***/ }),
45527/* 702 */
45528/***/ (function(module, exports, __webpack_require__) {
45529
45530var baseGetTag = __webpack_require__(119),
45531 getPrototype = __webpack_require__(703),
45532 isObjectLike = __webpack_require__(120);
45533
45534/** `Object#toString` result references. */
45535var objectTag = '[object Object]';
45536
45537/** Used for built-in method references. */
45538var funcProto = Function.prototype,
45539 objectProto = Object.prototype;
45540
45541/** Used to resolve the decompiled source of functions. */
45542var funcToString = funcProto.toString;
45543
45544/** Used to check objects for own properties. */
45545var hasOwnProperty = objectProto.hasOwnProperty;
45546
45547/** Used to infer the `Object` constructor. */
45548var objectCtorString = funcToString.call(Object);
45549
45550/**
45551 * Checks if `value` is a plain object, that is, an object created by the
45552 * `Object` constructor or one with a `[[Prototype]]` of `null`.
45553 *
45554 * @static
45555 * @memberOf _
45556 * @since 0.8.0
45557 * @category Lang
45558 * @param {*} value The value to check.
45559 * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
45560 * @example
45561 *
45562 * function Foo() {
45563 * this.a = 1;
45564 * }
45565 *
45566 * _.isPlainObject(new Foo);
45567 * // => false
45568 *
45569 * _.isPlainObject([1, 2, 3]);
45570 * // => false
45571 *
45572 * _.isPlainObject({ 'x': 0, 'y': 0 });
45573 * // => true
45574 *
45575 * _.isPlainObject(Object.create(null));
45576 * // => true
45577 */
45578function isPlainObject(value) {
45579 if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
45580 return false;
45581 }
45582 var proto = getPrototype(value);
45583 if (proto === null) {
45584 return true;
45585 }
45586 var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
45587 return typeof Ctor == 'function' && Ctor instanceof Ctor &&
45588 funcToString.call(Ctor) == objectCtorString;
45589}
45590
45591module.exports = isPlainObject;
45592
45593
45594/***/ }),
45595/* 703 */
45596/***/ (function(module, exports, __webpack_require__) {
45597
45598var overArg = __webpack_require__(280);
45599
45600/** Built-in value references. */
45601var getPrototype = overArg(Object.getPrototypeOf, Object);
45602
45603module.exports = getPrototype;
45604
45605
45606/***/ }),
45607/* 704 */
45608/***/ (function(module, exports, __webpack_require__) {
45609
45610"use strict";
45611var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
45612
45613var _interopRequireDefault = __webpack_require__(1);
45614
45615var _isIterable2 = _interopRequireDefault(__webpack_require__(262));
45616
45617var _from = _interopRequireDefault(__webpack_require__(152));
45618
45619var _set = _interopRequireDefault(__webpack_require__(268));
45620
45621var _concat = _interopRequireDefault(__webpack_require__(19));
45622
45623var _assign = _interopRequireDefault(__webpack_require__(265));
45624
45625var _map = _interopRequireDefault(__webpack_require__(37));
45626
45627var _defineProperty = _interopRequireDefault(__webpack_require__(94));
45628
45629var _typeof2 = _interopRequireDefault(__webpack_require__(95));
45630
45631(function (global, factory) {
45632 ( 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),
45633 __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
45634 (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
45635 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)) : (global = global || self, factory(global.AV = global.AV || {}, global.AV));
45636})(void 0, function (exports, core) {
45637 'use strict';
45638
45639 function _inheritsLoose(subClass, superClass) {
45640 subClass.prototype = Object.create(superClass.prototype);
45641 subClass.prototype.constructor = subClass;
45642 subClass.__proto__ = superClass;
45643 }
45644
45645 function _toConsumableArray(arr) {
45646 return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread();
45647 }
45648
45649 function _arrayWithoutHoles(arr) {
45650 if (Array.isArray(arr)) {
45651 for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) {
45652 arr2[i] = arr[i];
45653 }
45654
45655 return arr2;
45656 }
45657 }
45658
45659 function _iterableToArray(iter) {
45660 if ((0, _isIterable2.default)(Object(iter)) || Object.prototype.toString.call(iter) === "[object Arguments]") return (0, _from.default)(iter);
45661 }
45662
45663 function _nonIterableSpread() {
45664 throw new TypeError("Invalid attempt to spread non-iterable instance");
45665 }
45666 /* eslint-disable import/no-unresolved */
45667
45668
45669 if (!core.Protocals) {
45670 throw new Error('LeanCloud Realtime SDK not installed');
45671 }
45672
45673 var CommandType = core.Protocals.CommandType,
45674 GenericCommand = core.Protocals.GenericCommand,
45675 AckCommand = core.Protocals.AckCommand;
45676
45677 var warn = function warn(error) {
45678 return console.warn(error.message);
45679 };
45680
45681 var LiveQueryClient = /*#__PURE__*/function (_EventEmitter) {
45682 _inheritsLoose(LiveQueryClient, _EventEmitter);
45683
45684 function LiveQueryClient(appId, subscriptionId, connection) {
45685 var _this;
45686
45687 _this = _EventEmitter.call(this) || this;
45688 _this._appId = appId;
45689 _this.id = subscriptionId;
45690 _this._connection = connection;
45691 _this._eventemitter = new core.EventEmitter();
45692 _this._querys = new _set.default();
45693 return _this;
45694 }
45695
45696 var _proto = LiveQueryClient.prototype;
45697
45698 _proto._send = function _send(cmd) {
45699 var _context;
45700
45701 var _this$_connection;
45702
45703 for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
45704 args[_key - 1] = arguments[_key];
45705 }
45706
45707 return (_this$_connection = this._connection).send.apply(_this$_connection, (0, _concat.default)(_context = [(0, _assign.default)(cmd, {
45708 appId: this._appId,
45709 installationId: this.id,
45710 service: 1
45711 })]).call(_context, args));
45712 };
45713
45714 _proto._open = function _open() {
45715 return this._send(new GenericCommand({
45716 cmd: CommandType.login
45717 }));
45718 };
45719
45720 _proto.close = function close() {
45721 var _ee = this._eventemitter;
45722
45723 _ee.emit('beforeclose');
45724
45725 return this._send(new GenericCommand({
45726 cmd: CommandType.logout
45727 })).then(function () {
45728 return _ee.emit('close');
45729 });
45730 };
45731
45732 _proto.register = function register(liveQuery) {
45733 this._querys.add(liveQuery);
45734 };
45735
45736 _proto.deregister = function deregister(liveQuery) {
45737 var _this2 = this;
45738
45739 this._querys.delete(liveQuery);
45740
45741 setTimeout(function () {
45742 if (!_this2._querys.size) _this2.close().catch(warn);
45743 }, 0);
45744 };
45745
45746 _proto._dispatchCommand = function _dispatchCommand(command) {
45747 if (command.cmd !== CommandType.data) {
45748 this.emit('unhandledmessage', command);
45749 return core.Promise.resolve();
45750 }
45751
45752 return this._dispatchDataCommand(command);
45753 };
45754
45755 _proto._dispatchDataCommand = function _dispatchDataCommand(_ref) {
45756 var _ref$dataMessage = _ref.dataMessage,
45757 ids = _ref$dataMessage.ids,
45758 msg = _ref$dataMessage.msg;
45759 this.emit('message', (0, _map.default)(msg).call(msg, function (_ref2) {
45760 var data = _ref2.data;
45761 return JSON.parse(data);
45762 })); // send ack
45763
45764 var command = new GenericCommand({
45765 cmd: CommandType.ack,
45766 ackMessage: new AckCommand({
45767 ids: ids
45768 })
45769 });
45770 return this._send(command, false).catch(warn);
45771 };
45772
45773 return LiveQueryClient;
45774 }(core.EventEmitter);
45775
45776 var finalize = function finalize(callback) {
45777 return [// eslint-disable-next-line no-sequences
45778 function (value) {
45779 return callback(), value;
45780 }, function (error) {
45781 callback();
45782 throw error;
45783 }];
45784 };
45785
45786 var onRealtimeCreate = function onRealtimeCreate(realtime) {
45787 /* eslint-disable no-param-reassign */
45788 realtime._liveQueryClients = {};
45789
45790 realtime.createLiveQueryClient = function (subscriptionId) {
45791 var _realtime$_open$then;
45792
45793 if (realtime._liveQueryClients[subscriptionId] !== undefined) {
45794 return core.Promise.resolve(realtime._liveQueryClients[subscriptionId]);
45795 }
45796
45797 var promise = (_realtime$_open$then = realtime._open().then(function (connection) {
45798 var client = new LiveQueryClient(realtime._options.appId, subscriptionId, connection);
45799 connection.on('reconnect', function () {
45800 return client._open().then(function () {
45801 return client.emit('reconnect');
45802 }, function (error) {
45803 return client.emit('reconnecterror', error);
45804 });
45805 });
45806
45807 client._eventemitter.on('beforeclose', function () {
45808 delete realtime._liveQueryClients[client.id];
45809 }, realtime);
45810
45811 client._eventemitter.on('close', function () {
45812 realtime._deregister(client);
45813 }, realtime);
45814
45815 return client._open().then(function () {
45816 realtime._liveQueryClients[client.id] = client;
45817
45818 realtime._register(client);
45819
45820 return client;
45821 });
45822 })).then.apply(_realtime$_open$then, _toConsumableArray(finalize(function () {
45823 if (realtime._deregisterPending) realtime._deregisterPending(promise);
45824 })));
45825
45826 realtime._liveQueryClients[subscriptionId] = promise;
45827 if (realtime._registerPending) realtime._registerPending(promise);
45828 return promise;
45829 };
45830 /* eslint-enable no-param-reassign */
45831
45832 };
45833
45834 var beforeCommandDispatch = function beforeCommandDispatch(command, realtime) {
45835 var isLiveQueryCommand = command.installationId && command.service === 1;
45836 if (!isLiveQueryCommand) return true;
45837 var targetClient = realtime._liveQueryClients[command.installationId];
45838
45839 if (targetClient) {
45840 targetClient._dispatchCommand(command).catch(function (error) {
45841 return console.warn(error);
45842 });
45843 } else {
45844 console.warn('Unexpected message received without any live client match: %O', command);
45845 }
45846
45847 return false;
45848 }; // eslint-disable-next-line import/prefer-default-export
45849
45850
45851 var LiveQueryPlugin = {
45852 name: 'leancloud-realtime-plugin-live-query',
45853 onRealtimeCreate: onRealtimeCreate,
45854 beforeCommandDispatch: beforeCommandDispatch
45855 };
45856 exports.LiveQueryPlugin = LiveQueryPlugin;
45857 (0, _defineProperty.default)(exports, '__esModule', {
45858 value: true
45859 });
45860});
45861
45862/***/ })
45863/******/ ]);
45864});
45865//# sourceMappingURL=av-live-query.js.map
\No newline at end of file