UNPKG

1.44 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 = 279);
74/******/ })
75/************************************************************************/
76/******/ ([
77/* 0 */
78/***/ (function(module, exports, __webpack_require__) {
79
80"use strict";
81
82var global = __webpack_require__(7);
83var apply = __webpack_require__(75);
84var uncurryThis = __webpack_require__(4);
85var isCallable = __webpack_require__(8);
86var getOwnPropertyDescriptor = __webpack_require__(62).f;
87var isForced = __webpack_require__(160);
88var path = __webpack_require__(5);
89var bind = __webpack_require__(48);
90var createNonEnumerableProperty = __webpack_require__(37);
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__(320);
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__(133);
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__(76);
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) {
407
408module.exports = {};
409
410
411/***/ }),
412/* 6 */
413/***/ (function(module, __webpack_exports__, __webpack_require__) {
414
415"use strict";
416/* WEBPACK VAR INJECTION */(function(global) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return VERSION; });
417/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "p", function() { return root; });
418/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return ArrayProto; });
419/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return ObjProto; });
420/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return SymbolProto; });
421/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "o", function() { return push; });
422/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "q", function() { return slice; });
423/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "t", function() { return toString; });
424/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i", function() { return hasOwnProperty; });
425/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "r", function() { return supportsArrayBuffer; });
426/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "s", function() { return supportsDataView; });
427/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "k", function() { return nativeIsArray; });
428/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "m", function() { return nativeKeys; });
429/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "j", function() { return nativeCreate; });
430/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "l", function() { return nativeIsView; });
431/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return _isNaN; });
432/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return _isFinite; });
433/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return hasEnumBug; });
434/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "n", function() { return nonEnumerableProps; });
435/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return MAX_ARRAY_INDEX; });
436// Current version.
437var VERSION = '1.12.1';
438
439// Establish the root object, `window` (`self`) in the browser, `global`
440// on the server, or `this` in some virtual machines. We use `self`
441// instead of `window` for `WebWorker` support.
442var root = typeof self == 'object' && self.self === self && self ||
443 typeof global == 'object' && global.global === global && global ||
444 Function('return this')() ||
445 {};
446
447// Save bytes in the minified (but not gzipped) version:
448var ArrayProto = Array.prototype, ObjProto = Object.prototype;
449var SymbolProto = typeof Symbol !== 'undefined' ? Symbol.prototype : null;
450
451// Create quick reference variables for speed access to core prototypes.
452var push = ArrayProto.push,
453 slice = ArrayProto.slice,
454 toString = ObjProto.toString,
455 hasOwnProperty = ObjProto.hasOwnProperty;
456
457// Modern feature detection.
458var supportsArrayBuffer = typeof ArrayBuffer !== 'undefined',
459 supportsDataView = typeof DataView !== 'undefined';
460
461// All **ECMAScript 5+** native function implementations that we hope to use
462// are declared here.
463var nativeIsArray = Array.isArray,
464 nativeKeys = Object.keys,
465 nativeCreate = Object.create,
466 nativeIsView = supportsArrayBuffer && ArrayBuffer.isView;
467
468// Create references to these builtin functions because we override them.
469var _isNaN = isNaN,
470 _isFinite = isFinite;
471
472// Keys in IE < 9 that won't be iterated by `for key in ...` and thus missed.
473var hasEnumBug = !{toString: null}.propertyIsEnumerable('toString');
474var nonEnumerableProps = ['valueOf', 'isPrototypeOf', 'toString',
475 'propertyIsEnumerable', 'hasOwnProperty', 'toLocaleString'];
476
477// The largest integer that can be represented exactly.
478var MAX_ARRAY_INDEX = Math.pow(2, 53) - 1;
479
480/* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__(74)))
481
482/***/ }),
483/* 7 */
484/***/ (function(module, exports, __webpack_require__) {
485
486/* WEBPACK VAR INJECTION */(function(global) {var check = function (it) {
487 return it && it.Math == Math && it;
488};
489
490// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
491module.exports =
492 // eslint-disable-next-line es-x/no-global-this -- safe
493 check(typeof globalThis == 'object' && globalThis) ||
494 check(typeof window == 'object' && window) ||
495 // eslint-disable-next-line no-restricted-globals -- safe
496 check(typeof self == 'object' && self) ||
497 check(typeof global == 'object' && global) ||
498 // eslint-disable-next-line no-new-func -- fallback
499 (function () { return this; })() || Function('return this')();
500
501/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(74)))
502
503/***/ }),
504/* 8 */
505/***/ (function(module, exports) {
506
507// `IsCallable` abstract operation
508// https://tc39.es/ecma262/#sec-iscallable
509module.exports = function (argument) {
510 return typeof argument == 'function';
511};
512
513
514/***/ }),
515/* 9 */
516/***/ (function(module, exports, __webpack_require__) {
517
518var global = __webpack_require__(7);
519var shared = __webpack_require__(79);
520var hasOwn = __webpack_require__(13);
521var uid = __webpack_require__(99);
522var NATIVE_SYMBOL = __webpack_require__(64);
523var USE_SYMBOL_AS_UID = __webpack_require__(158);
524
525var WellKnownSymbolsStore = shared('wks');
526var Symbol = global.Symbol;
527var symbolFor = Symbol && Symbol['for'];
528var createWellKnownSymbol = USE_SYMBOL_AS_UID ? Symbol : Symbol && Symbol.withoutSetter || uid;
529
530module.exports = function (name) {
531 if (!hasOwn(WellKnownSymbolsStore, name) || !(NATIVE_SYMBOL || typeof WellKnownSymbolsStore[name] == 'string')) {
532 var description = 'Symbol.' + name;
533 if (NATIVE_SYMBOL && hasOwn(Symbol, name)) {
534 WellKnownSymbolsStore[name] = Symbol[name];
535 } else if (USE_SYMBOL_AS_UID && symbolFor) {
536 WellKnownSymbolsStore[name] = symbolFor(description);
537 } else {
538 WellKnownSymbolsStore[name] = createWellKnownSymbol(description);
539 }
540 } return WellKnownSymbolsStore[name];
541};
542
543
544/***/ }),
545/* 10 */
546/***/ (function(module, exports, __webpack_require__) {
547
548var path = __webpack_require__(5);
549var hasOwn = __webpack_require__(13);
550var wrappedWellKnownSymbolModule = __webpack_require__(149);
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__(8);
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__(283);
577
578/***/ }),
579/* 13 */
580/***/ (function(module, exports, __webpack_require__) {
581
582var uncurryThis = __webpack_require__(4);
583var toObject = __webpack_require__(34);
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__(76);
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, __webpack_exports__, __webpack_require__) {
624
625"use strict";
626/* harmony export (immutable) */ __webpack_exports__["a"] = keys;
627/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isObject_js__ = __webpack_require__(56);
628/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__setup_js__ = __webpack_require__(6);
629/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__has_js__ = __webpack_require__(45);
630/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__collectNonEnumProps_js__ = __webpack_require__(191);
631
632
633
634
635
636// Retrieve the names of an object's own properties.
637// Delegates to **ECMAScript 5**'s native `Object.keys`.
638function keys(obj) {
639 if (!Object(__WEBPACK_IMPORTED_MODULE_0__isObject_js__["a" /* default */])(obj)) return [];
640 if (__WEBPACK_IMPORTED_MODULE_1__setup_js__["m" /* nativeKeys */]) return Object(__WEBPACK_IMPORTED_MODULE_1__setup_js__["m" /* nativeKeys */])(obj);
641 var keys = [];
642 for (var key in obj) if (Object(__WEBPACK_IMPORTED_MODULE_2__has_js__["a" /* default */])(obj, key)) keys.push(key);
643 // Ahem, IE < 9.
644 if (__WEBPACK_IMPORTED_MODULE_1__setup_js__["h" /* hasEnumBug */]) Object(__WEBPACK_IMPORTED_MODULE_3__collectNonEnumProps_js__["a" /* default */])(obj, keys);
645 return keys;
646}
647
648
649/***/ }),
650/* 17 */
651/***/ (function(module, __webpack_exports__, __webpack_require__) {
652
653"use strict";
654/* harmony export (immutable) */ __webpack_exports__["a"] = tagTester;
655/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(6);
656
657
658// Internal function for creating a `toString`-based type tester.
659function tagTester(name) {
660 var tag = '[object ' + name + ']';
661 return function(obj) {
662 return __WEBPACK_IMPORTED_MODULE_0__setup_js__["t" /* toString */].call(obj) === tag;
663 };
664}
665
666
667/***/ }),
668/* 18 */
669/***/ (function(module, exports, __webpack_require__) {
670
671var path = __webpack_require__(5);
672var global = __webpack_require__(7);
673var isCallable = __webpack_require__(8);
674
675var aFunction = function (variable) {
676 return isCallable(variable) ? variable : undefined;
677};
678
679module.exports = function (namespace, method) {
680 return arguments.length < 2 ? aFunction(path[namespace]) || aFunction(global[namespace])
681 : path[namespace] && path[namespace][method] || global[namespace] && global[namespace][method];
682};
683
684
685/***/ }),
686/* 19 */
687/***/ (function(module, exports, __webpack_require__) {
688
689var uncurryThis = __webpack_require__(4);
690
691module.exports = uncurryThis({}.isPrototypeOf);
692
693
694/***/ }),
695/* 20 */
696/***/ (function(module, exports, __webpack_require__) {
697
698var isObject = __webpack_require__(11);
699
700var $String = String;
701var $TypeError = TypeError;
702
703// `Assert: Type(argument) is Object`
704module.exports = function (argument) {
705 if (isObject(argument)) return argument;
706 throw $TypeError($String(argument) + ' is not an object');
707};
708
709
710/***/ }),
711/* 21 */
712/***/ (function(module, __webpack_exports__, __webpack_require__) {
713
714"use strict";
715/* harmony export (immutable) */ __webpack_exports__["a"] = cb;
716/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__underscore_js__ = __webpack_require__(25);
717/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__baseIteratee_js__ = __webpack_require__(201);
718/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__iteratee_js__ = __webpack_require__(202);
719
720
721
722
723// The function we call internally to generate a callback. It invokes
724// `_.iteratee` if overridden, otherwise `baseIteratee`.
725function cb(value, context, argCount) {
726 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);
727 return Object(__WEBPACK_IMPORTED_MODULE_1__baseIteratee_js__["a" /* default */])(value, context, argCount);
728}
729
730
731/***/ }),
732/* 22 */
733/***/ (function(module, exports, __webpack_require__) {
734
735module.exports = __webpack_require__(392);
736
737/***/ }),
738/* 23 */
739/***/ (function(module, exports, __webpack_require__) {
740
741var DESCRIPTORS = __webpack_require__(14);
742var IE8_DOM_DEFINE = __webpack_require__(159);
743var V8_PROTOTYPE_DEFINE_BUG = __webpack_require__(161);
744var anObject = __webpack_require__(20);
745var toPropertyKey = __webpack_require__(96);
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__(189);
861/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__getLength_js__ = __webpack_require__(29);
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
876"use strict";
877
878
879var _interopRequireDefault = __webpack_require__(1);
880
881var _concat = _interopRequireDefault(__webpack_require__(22));
882
883var _promise = _interopRequireDefault(__webpack_require__(12));
884
885var _ = __webpack_require__(3);
886
887var md5 = __webpack_require__(528);
888
889var _require = __webpack_require__(3),
890 extend = _require.extend;
891
892var AV = __webpack_require__(69);
893
894var AVError = __webpack_require__(46);
895
896var _require2 = __webpack_require__(30),
897 getSessionToken = _require2.getSessionToken;
898
899var ajax = __webpack_require__(116); // 计算 X-LC-Sign 的签名方法
900
901
902var sign = function sign(key, isMasterKey) {
903 var _context2;
904
905 var now = new Date().getTime();
906 var signature = md5(now + key);
907
908 if (isMasterKey) {
909 var _context;
910
911 return (0, _concat.default)(_context = "".concat(signature, ",")).call(_context, now, ",master");
912 }
913
914 return (0, _concat.default)(_context2 = "".concat(signature, ",")).call(_context2, now);
915};
916
917var setAppKey = function setAppKey(headers, signKey) {
918 if (signKey) {
919 headers['X-LC-Sign'] = sign(AV.applicationKey);
920 } else {
921 headers['X-LC-Key'] = AV.applicationKey;
922 }
923};
924
925var setHeaders = function setHeaders() {
926 var authOptions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
927 var signKey = arguments.length > 1 ? arguments[1] : undefined;
928 var headers = {
929 'X-LC-Id': AV.applicationId,
930 'Content-Type': 'application/json;charset=UTF-8'
931 };
932 var useMasterKey = false;
933
934 if (typeof authOptions.useMasterKey === 'boolean') {
935 useMasterKey = authOptions.useMasterKey;
936 } else if (typeof AV._config.useMasterKey === 'boolean') {
937 useMasterKey = AV._config.useMasterKey;
938 }
939
940 if (useMasterKey) {
941 if (AV.masterKey) {
942 if (signKey) {
943 headers['X-LC-Sign'] = sign(AV.masterKey, true);
944 } else {
945 headers['X-LC-Key'] = "".concat(AV.masterKey, ",master");
946 }
947 } else {
948 console.warn('masterKey is not set, fall back to use appKey');
949 setAppKey(headers, signKey);
950 }
951 } else {
952 setAppKey(headers, signKey);
953 }
954
955 if (AV.hookKey) {
956 headers['X-LC-Hook-Key'] = AV.hookKey;
957 }
958
959 if (AV._config.production !== null) {
960 headers['X-LC-Prod'] = String(AV._config.production);
961 }
962
963 headers[ false ? 'User-Agent' : 'X-LC-UA'] = AV._sharedConfig.userAgent;
964 return _promise.default.resolve().then(function () {
965 // Pass the session token
966 var sessionToken = getSessionToken(authOptions);
967
968 if (sessionToken) {
969 headers['X-LC-Session'] = sessionToken;
970 } else if (!AV._config.disableCurrentUser) {
971 return AV.User.currentAsync().then(function (currentUser) {
972 if (currentUser && currentUser._sessionToken) {
973 headers['X-LC-Session'] = currentUser._sessionToken;
974 }
975
976 return headers;
977 });
978 }
979
980 return headers;
981 });
982};
983
984var createApiUrl = function createApiUrl(_ref) {
985 var _ref$service = _ref.service,
986 service = _ref$service === void 0 ? 'api' : _ref$service,
987 _ref$version = _ref.version,
988 version = _ref$version === void 0 ? '1.1' : _ref$version,
989 path = _ref.path;
990 var apiURL = AV._config.serverURLs[service];
991 if (!apiURL) throw new Error("undefined server URL for ".concat(service));
992
993 if (apiURL.charAt(apiURL.length - 1) !== '/') {
994 apiURL += '/';
995 }
996
997 apiURL += version;
998
999 if (path) {
1000 apiURL += path;
1001 }
1002
1003 return apiURL;
1004};
1005/**
1006 * Low level REST API client. Call REST endpoints with authorization headers.
1007 * @function AV.request
1008 * @since 3.0.0
1009 * @param {Object} options
1010 * @param {String} options.method HTTP method
1011 * @param {String} options.path endpoint path, e.g. `/classes/Test/55759577e4b029ae6015ac20`
1012 * @param {Object} [options.query] query string dict
1013 * @param {Object} [options.data] HTTP body
1014 * @param {AuthOptions} [options.authOptions]
1015 * @param {String} [options.service = 'api']
1016 * @param {String} [options.version = '1.1']
1017 */
1018
1019
1020var request = function request(_ref2) {
1021 var service = _ref2.service,
1022 version = _ref2.version,
1023 method = _ref2.method,
1024 path = _ref2.path,
1025 query = _ref2.query,
1026 data = _ref2.data,
1027 authOptions = _ref2.authOptions,
1028 _ref2$signKey = _ref2.signKey,
1029 signKey = _ref2$signKey === void 0 ? true : _ref2$signKey;
1030
1031 if (!(AV.applicationId && (AV.applicationKey || AV.masterKey))) {
1032 throw new Error('Not initialized');
1033 }
1034
1035 if (AV._appRouter) {
1036 AV._appRouter.refresh();
1037 }
1038
1039 var timeout = AV._config.requestTimeout;
1040 var url = createApiUrl({
1041 service: service,
1042 path: path,
1043 version: version
1044 });
1045 return setHeaders(authOptions, signKey).then(function (headers) {
1046 return ajax({
1047 method: method,
1048 url: url,
1049 query: query,
1050 data: data,
1051 headers: headers,
1052 timeout: timeout
1053 }).catch(function (error) {
1054 var errorJSON = {
1055 code: error.code || -1,
1056 error: error.message || error.responseText
1057 };
1058
1059 if (error.response && error.response.code) {
1060 errorJSON = error.response;
1061 } else if (error.responseText) {
1062 try {
1063 errorJSON = JSON.parse(error.responseText);
1064 } catch (e) {// If we fail to parse the error text, that's okay.
1065 }
1066 }
1067
1068 errorJSON.rawMessage = errorJSON.rawMessage || errorJSON.error;
1069
1070 if (!AV._sharedConfig.keepErrorRawMessage) {
1071 var _context3, _context4;
1072
1073 errorJSON.error += (0, _concat.default)(_context3 = (0, _concat.default)(_context4 = " [".concat(error.statusCode || 'N/A', " ")).call(_context4, method, " ")).call(_context3, url, "]");
1074 } // Transform the error into an instance of AVError by trying to parse
1075 // the error string as JSON.
1076
1077
1078 var err = new AVError(errorJSON.code, errorJSON.error);
1079 delete errorJSON.error;
1080 throw _.extend(err, errorJSON);
1081 });
1082 });
1083}; // lagecy request
1084
1085
1086var _request = function _request(route, className, objectId, method, data, authOptions, query) {
1087 var path = '';
1088 if (route) path += "/".concat(route);
1089 if (className) path += "/".concat(className);
1090 if (objectId) path += "/".concat(objectId); // for migeration
1091
1092 if (data && data._fetchWhenSave) throw new Error('_fetchWhenSave should be in the query');
1093 if (data && data._where) throw new Error('_where should be in the query');
1094
1095 if (method && method.toLowerCase() === 'get') {
1096 query = extend({}, query, data);
1097 data = null;
1098 }
1099
1100 return request({
1101 method: method,
1102 path: path,
1103 query: query,
1104 data: data,
1105 authOptions: authOptions
1106 });
1107};
1108
1109AV.request = request;
1110module.exports = {
1111 _request: _request,
1112 request: request
1113};
1114
1115/***/ }),
1116/* 28 */
1117/***/ (function(module, __webpack_exports__, __webpack_require__) {
1118
1119"use strict";
1120/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(17);
1121/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__setup_js__ = __webpack_require__(6);
1122
1123
1124
1125var isFunction = Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('Function');
1126
1127// Optimize `isFunction` if appropriate. Work around some `typeof` bugs in old
1128// v8, IE 11 (#1621), Safari 8 (#1929), and PhantomJS (#2236).
1129var nodelist = __WEBPACK_IMPORTED_MODULE_1__setup_js__["p" /* root */].document && __WEBPACK_IMPORTED_MODULE_1__setup_js__["p" /* root */].document.childNodes;
1130if (typeof /./ != 'function' && typeof Int8Array != 'object' && typeof nodelist != 'function') {
1131 isFunction = function(obj) {
1132 return typeof obj == 'function' || false;
1133 };
1134}
1135
1136/* harmony default export */ __webpack_exports__["a"] = (isFunction);
1137
1138
1139/***/ }),
1140/* 29 */
1141/***/ (function(module, __webpack_exports__, __webpack_require__) {
1142
1143"use strict";
1144/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__shallowProperty_js__ = __webpack_require__(190);
1145
1146
1147// Internal helper to obtain the `length` property of an object.
1148/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__shallowProperty_js__["a" /* default */])('length'));
1149
1150
1151/***/ }),
1152/* 30 */
1153/***/ (function(module, exports, __webpack_require__) {
1154
1155"use strict";
1156
1157
1158var _interopRequireDefault = __webpack_require__(1);
1159
1160var _keys = _interopRequireDefault(__webpack_require__(59));
1161
1162var _getPrototypeOf = _interopRequireDefault(__webpack_require__(148));
1163
1164var _promise = _interopRequireDefault(__webpack_require__(12));
1165
1166var _ = __webpack_require__(3); // Helper function to check null or undefined.
1167
1168
1169var isNullOrUndefined = function isNullOrUndefined(x) {
1170 return _.isNull(x) || _.isUndefined(x);
1171};
1172
1173var ensureArray = function ensureArray(target) {
1174 if (_.isArray(target)) {
1175 return target;
1176 }
1177
1178 if (target === undefined || target === null) {
1179 return [];
1180 }
1181
1182 return [target];
1183};
1184
1185var transformFetchOptions = function transformFetchOptions() {
1186 var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
1187 keys = (0, _keys.default)(_ref),
1188 include = _ref.include,
1189 includeACL = _ref.includeACL;
1190
1191 var fetchOptions = {};
1192
1193 if (keys) {
1194 fetchOptions.keys = ensureArray(keys).join(',');
1195 }
1196
1197 if (include) {
1198 fetchOptions.include = ensureArray(include).join(',');
1199 }
1200
1201 if (includeACL) {
1202 fetchOptions.returnACL = includeACL;
1203 }
1204
1205 return fetchOptions;
1206};
1207
1208var getSessionToken = function getSessionToken(authOptions) {
1209 if (authOptions.sessionToken) {
1210 return authOptions.sessionToken;
1211 }
1212
1213 if (authOptions.user && typeof authOptions.user.getSessionToken === 'function') {
1214 return authOptions.user.getSessionToken();
1215 }
1216};
1217
1218var tap = function tap(interceptor) {
1219 return function (value) {
1220 return interceptor(value), value;
1221 };
1222}; // Shared empty constructor function to aid in prototype-chain creation.
1223
1224
1225var EmptyConstructor = function EmptyConstructor() {}; // Helper function to correctly set up the prototype chain, for subclasses.
1226// Similar to `goog.inherits`, but uses a hash of prototype properties and
1227// class properties to be extended.
1228
1229
1230var inherits = function inherits(parent, protoProps, staticProps) {
1231 var child; // The constructor function for the new subclass is either defined by you
1232 // (the "constructor" property in your `extend` definition), or defaulted
1233 // by us to simply call the parent's constructor.
1234
1235 if (protoProps && protoProps.hasOwnProperty('constructor')) {
1236 child = protoProps.constructor;
1237 } else {
1238 /** @ignore */
1239 child = function child() {
1240 parent.apply(this, arguments);
1241 };
1242 } // Inherit class (static) properties from parent.
1243
1244
1245 _.extend(child, parent); // Set the prototype chain to inherit from `parent`, without calling
1246 // `parent`'s constructor function.
1247
1248
1249 EmptyConstructor.prototype = parent.prototype;
1250 child.prototype = new EmptyConstructor(); // Add prototype properties (instance properties) to the subclass,
1251 // if supplied.
1252
1253 if (protoProps) {
1254 _.extend(child.prototype, protoProps);
1255 } // Add static properties to the constructor function, if supplied.
1256
1257
1258 if (staticProps) {
1259 _.extend(child, staticProps);
1260 } // Correctly set child's `prototype.constructor`.
1261
1262
1263 child.prototype.constructor = child; // Set a convenience property in case the parent's prototype is
1264 // needed later.
1265
1266 child.__super__ = parent.prototype;
1267 return child;
1268}; // Suppress the date string format warning in Weixin DevTools
1269// Link: https://developers.weixin.qq.com/community/minihome/doc/00080c6f244718053550067736b401
1270
1271
1272var parseDate = typeof wx === 'undefined' ? function (iso8601) {
1273 return new Date(iso8601);
1274} : function (iso8601) {
1275 return new Date(Date.parse(iso8601));
1276};
1277
1278var setValue = function setValue(target, key, value) {
1279 // '.' is not allowed in Class keys, escaping is not in concern now.
1280 var segs = key.split('.');
1281 var lastSeg = segs.pop();
1282 var currentTarget = target;
1283 segs.forEach(function (seg) {
1284 if (currentTarget[seg] === undefined) currentTarget[seg] = {};
1285 currentTarget = currentTarget[seg];
1286 });
1287 currentTarget[lastSeg] = value;
1288 return target;
1289};
1290
1291var findValue = function findValue(target, key) {
1292 var segs = key.split('.');
1293 var firstSeg = segs[0];
1294 var lastSeg = segs.pop();
1295 var currentTarget = target;
1296
1297 for (var i = 0; i < segs.length; i++) {
1298 currentTarget = currentTarget[segs[i]];
1299
1300 if (currentTarget === undefined) {
1301 return [undefined, undefined, lastSeg];
1302 }
1303 }
1304
1305 var value = currentTarget[lastSeg];
1306 return [value, currentTarget, lastSeg, firstSeg];
1307};
1308
1309var isPlainObject = function isPlainObject(obj) {
1310 return _.isObject(obj) && (0, _getPrototypeOf.default)(obj) === Object.prototype;
1311};
1312
1313var continueWhile = function continueWhile(predicate, asyncFunction) {
1314 if (predicate()) {
1315 return asyncFunction().then(function () {
1316 return continueWhile(predicate, asyncFunction);
1317 });
1318 }
1319
1320 return _promise.default.resolve();
1321};
1322
1323module.exports = {
1324 isNullOrUndefined: isNullOrUndefined,
1325 ensureArray: ensureArray,
1326 transformFetchOptions: transformFetchOptions,
1327 getSessionToken: getSessionToken,
1328 tap: tap,
1329 inherits: inherits,
1330 parseDate: parseDate,
1331 setValue: setValue,
1332 findValue: findValue,
1333 isPlainObject: isPlainObject,
1334 continueWhile: continueWhile
1335};
1336
1337/***/ }),
1338/* 31 */
1339/***/ (function(module, exports, __webpack_require__) {
1340
1341var isCallable = __webpack_require__(8);
1342var tryToString = __webpack_require__(78);
1343
1344var $TypeError = TypeError;
1345
1346// `Assert: IsCallable(argument) is true`
1347module.exports = function (argument) {
1348 if (isCallable(argument)) return argument;
1349 throw $TypeError(tryToString(argument) + ' is not a function');
1350};
1351
1352
1353/***/ }),
1354/* 32 */
1355/***/ (function(module, exports, __webpack_require__) {
1356
1357// toObject with fallback for non-array-like ES3 strings
1358var IndexedObject = __webpack_require__(95);
1359var requireObjectCoercible = __webpack_require__(122);
1360
1361module.exports = function (it) {
1362 return IndexedObject(requireObjectCoercible(it));
1363};
1364
1365
1366/***/ }),
1367/* 33 */
1368/***/ (function(module, exports) {
1369
1370module.exports = true;
1371
1372
1373/***/ }),
1374/* 34 */
1375/***/ (function(module, exports, __webpack_require__) {
1376
1377var requireObjectCoercible = __webpack_require__(122);
1378
1379var $Object = Object;
1380
1381// `ToObject` abstract operation
1382// https://tc39.es/ecma262/#sec-toobject
1383module.exports = function (argument) {
1384 return $Object(requireObjectCoercible(argument));
1385};
1386
1387
1388/***/ }),
1389/* 35 */
1390/***/ (function(module, exports, __webpack_require__) {
1391
1392module.exports = __webpack_require__(397);
1393
1394/***/ }),
1395/* 36 */
1396/***/ (function(module, exports, __webpack_require__) {
1397
1398module.exports = __webpack_require__(404);
1399
1400/***/ }),
1401/* 37 */
1402/***/ (function(module, exports, __webpack_require__) {
1403
1404var DESCRIPTORS = __webpack_require__(14);
1405var definePropertyModule = __webpack_require__(23);
1406var createPropertyDescriptor = __webpack_require__(47);
1407
1408module.exports = DESCRIPTORS ? function (object, key, value) {
1409 return definePropertyModule.f(object, key, createPropertyDescriptor(1, value));
1410} : function (object, key, value) {
1411 object[key] = value;
1412 return object;
1413};
1414
1415
1416/***/ }),
1417/* 38 */
1418/***/ (function(module, exports, __webpack_require__) {
1419
1420"use strict";
1421
1422var toIndexedObject = __webpack_require__(32);
1423var addToUnscopables = __webpack_require__(170);
1424var Iterators = __webpack_require__(50);
1425var InternalStateModule = __webpack_require__(43);
1426var defineProperty = __webpack_require__(23).f;
1427var defineIterator = __webpack_require__(132);
1428var IS_PURE = __webpack_require__(33);
1429var DESCRIPTORS = __webpack_require__(14);
1430
1431var ARRAY_ITERATOR = 'Array Iterator';
1432var setInternalState = InternalStateModule.set;
1433var getInternalState = InternalStateModule.getterFor(ARRAY_ITERATOR);
1434
1435// `Array.prototype.entries` method
1436// https://tc39.es/ecma262/#sec-array.prototype.entries
1437// `Array.prototype.keys` method
1438// https://tc39.es/ecma262/#sec-array.prototype.keys
1439// `Array.prototype.values` method
1440// https://tc39.es/ecma262/#sec-array.prototype.values
1441// `Array.prototype[@@iterator]` method
1442// https://tc39.es/ecma262/#sec-array.prototype-@@iterator
1443// `CreateArrayIterator` internal method
1444// https://tc39.es/ecma262/#sec-createarrayiterator
1445module.exports = defineIterator(Array, 'Array', function (iterated, kind) {
1446 setInternalState(this, {
1447 type: ARRAY_ITERATOR,
1448 target: toIndexedObject(iterated), // target
1449 index: 0, // next index
1450 kind: kind // kind
1451 });
1452// `%ArrayIteratorPrototype%.next` method
1453// https://tc39.es/ecma262/#sec-%arrayiteratorprototype%.next
1454}, function () {
1455 var state = getInternalState(this);
1456 var target = state.target;
1457 var kind = state.kind;
1458 var index = state.index++;
1459 if (!target || index >= target.length) {
1460 state.target = undefined;
1461 return { value: undefined, done: true };
1462 }
1463 if (kind == 'keys') return { value: index, done: false };
1464 if (kind == 'values') return { value: target[index], done: false };
1465 return { value: [index, target[index]], done: false };
1466}, 'values');
1467
1468// argumentsList[@@iterator] is %ArrayProto_values%
1469// https://tc39.es/ecma262/#sec-createunmappedargumentsobject
1470// https://tc39.es/ecma262/#sec-createmappedargumentsobject
1471var values = Iterators.Arguments = Iterators.Array;
1472
1473// https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
1474addToUnscopables('keys');
1475addToUnscopables('values');
1476addToUnscopables('entries');
1477
1478// V8 ~ Chrome 45- bug
1479if (!IS_PURE && DESCRIPTORS && values.name !== 'values') try {
1480 defineProperty(values, 'name', { value: 'values' });
1481} catch (error) { /* empty */ }
1482
1483
1484/***/ }),
1485/* 39 */
1486/***/ (function(module, exports, __webpack_require__) {
1487
1488__webpack_require__(38);
1489var DOMIterables = __webpack_require__(319);
1490var global = __webpack_require__(7);
1491var classof = __webpack_require__(51);
1492var createNonEnumerableProperty = __webpack_require__(37);
1493var Iterators = __webpack_require__(50);
1494var wellKnownSymbol = __webpack_require__(9);
1495
1496var TO_STRING_TAG = wellKnownSymbol('toStringTag');
1497
1498for (var COLLECTION_NAME in DOMIterables) {
1499 var Collection = global[COLLECTION_NAME];
1500 var CollectionPrototype = Collection && Collection.prototype;
1501 if (CollectionPrototype && classof(CollectionPrototype) !== TO_STRING_TAG) {
1502 createNonEnumerableProperty(CollectionPrototype, TO_STRING_TAG, COLLECTION_NAME);
1503 }
1504 Iterators[COLLECTION_NAME] = Iterators.Array;
1505}
1506
1507
1508/***/ }),
1509/* 40 */
1510/***/ (function(module, exports, __webpack_require__) {
1511
1512var path = __webpack_require__(5);
1513
1514module.exports = function (CONSTRUCTOR) {
1515 return path[CONSTRUCTOR + 'Prototype'];
1516};
1517
1518
1519/***/ }),
1520/* 41 */
1521/***/ (function(module, exports, __webpack_require__) {
1522
1523var toLength = __webpack_require__(293);
1524
1525// `LengthOfArrayLike` abstract operation
1526// https://tc39.es/ecma262/#sec-lengthofarraylike
1527module.exports = function (obj) {
1528 return toLength(obj.length);
1529};
1530
1531
1532/***/ }),
1533/* 42 */
1534/***/ (function(module, exports, __webpack_require__) {
1535
1536var bind = __webpack_require__(48);
1537var call = __webpack_require__(15);
1538var anObject = __webpack_require__(20);
1539var tryToString = __webpack_require__(78);
1540var isArrayIteratorMethod = __webpack_require__(167);
1541var lengthOfArrayLike = __webpack_require__(41);
1542var isPrototypeOf = __webpack_require__(19);
1543var getIterator = __webpack_require__(168);
1544var getIteratorMethod = __webpack_require__(106);
1545var iteratorClose = __webpack_require__(169);
1546
1547var $TypeError = TypeError;
1548
1549var Result = function (stopped, result) {
1550 this.stopped = stopped;
1551 this.result = result;
1552};
1553
1554var ResultPrototype = Result.prototype;
1555
1556module.exports = function (iterable, unboundFunction, options) {
1557 var that = options && options.that;
1558 var AS_ENTRIES = !!(options && options.AS_ENTRIES);
1559 var IS_ITERATOR = !!(options && options.IS_ITERATOR);
1560 var INTERRUPTED = !!(options && options.INTERRUPTED);
1561 var fn = bind(unboundFunction, that);
1562 var iterator, iterFn, index, length, result, next, step;
1563
1564 var stop = function (condition) {
1565 if (iterator) iteratorClose(iterator, 'normal', condition);
1566 return new Result(true, condition);
1567 };
1568
1569 var callFn = function (value) {
1570 if (AS_ENTRIES) {
1571 anObject(value);
1572 return INTERRUPTED ? fn(value[0], value[1], stop) : fn(value[0], value[1]);
1573 } return INTERRUPTED ? fn(value, stop) : fn(value);
1574 };
1575
1576 if (IS_ITERATOR) {
1577 iterator = iterable;
1578 } else {
1579 iterFn = getIteratorMethod(iterable);
1580 if (!iterFn) throw $TypeError(tryToString(iterable) + ' is not iterable');
1581 // optimisation for array iterators
1582 if (isArrayIteratorMethod(iterFn)) {
1583 for (index = 0, length = lengthOfArrayLike(iterable); length > index; index++) {
1584 result = callFn(iterable[index]);
1585 if (result && isPrototypeOf(ResultPrototype, result)) return result;
1586 } return new Result(false);
1587 }
1588 iterator = getIterator(iterable, iterFn);
1589 }
1590
1591 next = iterator.next;
1592 while (!(step = call(next, iterator)).done) {
1593 try {
1594 result = callFn(step.value);
1595 } catch (error) {
1596 iteratorClose(iterator, 'throw', error);
1597 }
1598 if (typeof result == 'object' && result && isPrototypeOf(ResultPrototype, result)) return result;
1599 } return new Result(false);
1600};
1601
1602
1603/***/ }),
1604/* 43 */
1605/***/ (function(module, exports, __webpack_require__) {
1606
1607var NATIVE_WEAK_MAP = __webpack_require__(171);
1608var global = __webpack_require__(7);
1609var uncurryThis = __webpack_require__(4);
1610var isObject = __webpack_require__(11);
1611var createNonEnumerableProperty = __webpack_require__(37);
1612var hasOwn = __webpack_require__(13);
1613var shared = __webpack_require__(124);
1614var sharedKey = __webpack_require__(101);
1615var hiddenKeys = __webpack_require__(80);
1616
1617var OBJECT_ALREADY_INITIALIZED = 'Object already initialized';
1618var TypeError = global.TypeError;
1619var WeakMap = global.WeakMap;
1620var set, get, has;
1621
1622var enforce = function (it) {
1623 return has(it) ? get(it) : set(it, {});
1624};
1625
1626var getterFor = function (TYPE) {
1627 return function (it) {
1628 var state;
1629 if (!isObject(it) || (state = get(it)).type !== TYPE) {
1630 throw TypeError('Incompatible receiver, ' + TYPE + ' required');
1631 } return state;
1632 };
1633};
1634
1635if (NATIVE_WEAK_MAP || shared.state) {
1636 var store = shared.state || (shared.state = new WeakMap());
1637 var wmget = uncurryThis(store.get);
1638 var wmhas = uncurryThis(store.has);
1639 var wmset = uncurryThis(store.set);
1640 set = function (it, metadata) {
1641 if (wmhas(store, it)) throw new TypeError(OBJECT_ALREADY_INITIALIZED);
1642 metadata.facade = it;
1643 wmset(store, it, metadata);
1644 return metadata;
1645 };
1646 get = function (it) {
1647 return wmget(store, it) || {};
1648 };
1649 has = function (it) {
1650 return wmhas(store, it);
1651 };
1652} else {
1653 var STATE = sharedKey('state');
1654 hiddenKeys[STATE] = true;
1655 set = function (it, metadata) {
1656 if (hasOwn(it, STATE)) throw new TypeError(OBJECT_ALREADY_INITIALIZED);
1657 metadata.facade = it;
1658 createNonEnumerableProperty(it, STATE, metadata);
1659 return metadata;
1660 };
1661 get = function (it) {
1662 return hasOwn(it, STATE) ? it[STATE] : {};
1663 };
1664 has = function (it) {
1665 return hasOwn(it, STATE);
1666 };
1667}
1668
1669module.exports = {
1670 set: set,
1671 get: get,
1672 has: has,
1673 enforce: enforce,
1674 getterFor: getterFor
1675};
1676
1677
1678/***/ }),
1679/* 44 */
1680/***/ (function(module, exports, __webpack_require__) {
1681
1682var createNonEnumerableProperty = __webpack_require__(37);
1683
1684module.exports = function (target, key, value, options) {
1685 if (options && options.enumerable) target[key] = value;
1686 else createNonEnumerableProperty(target, key, value);
1687 return target;
1688};
1689
1690
1691/***/ }),
1692/* 45 */
1693/***/ (function(module, __webpack_exports__, __webpack_require__) {
1694
1695"use strict";
1696/* harmony export (immutable) */ __webpack_exports__["a"] = has;
1697/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(6);
1698
1699
1700// Internal function to check whether `key` is an own property name of `obj`.
1701function has(obj, key) {
1702 return obj != null && __WEBPACK_IMPORTED_MODULE_0__setup_js__["i" /* hasOwnProperty */].call(obj, key);
1703}
1704
1705
1706/***/ }),
1707/* 46 */
1708/***/ (function(module, exports, __webpack_require__) {
1709
1710"use strict";
1711
1712
1713var _interopRequireDefault = __webpack_require__(1);
1714
1715var _setPrototypeOf = _interopRequireDefault(__webpack_require__(239));
1716
1717var _getPrototypeOf = _interopRequireDefault(__webpack_require__(148));
1718
1719var _ = __webpack_require__(3);
1720/**
1721 * @class AV.Error
1722 */
1723
1724
1725function AVError(code, message) {
1726 if (this instanceof AVError ? this.constructor : void 0) {
1727 var error = new Error(message);
1728 (0, _setPrototypeOf.default)(error, (0, _getPrototypeOf.default)(this));
1729 error.code = code;
1730 return error;
1731 }
1732
1733 return new AVError(code, message);
1734}
1735
1736AVError.prototype = Object.create(Error.prototype, {
1737 constructor: {
1738 value: Error,
1739 enumerable: false,
1740 writable: true,
1741 configurable: true
1742 }
1743});
1744(0, _setPrototypeOf.default)(AVError, Error);
1745
1746_.extend(AVError,
1747/** @lends AV.Error */
1748{
1749 /**
1750 * Error code indicating some error other than those enumerated here.
1751 * @constant
1752 */
1753 OTHER_CAUSE: -1,
1754
1755 /**
1756 * Error code indicating that something has gone wrong with the server.
1757 * If you get this error code, it is AV's fault.
1758 * @constant
1759 */
1760 INTERNAL_SERVER_ERROR: 1,
1761
1762 /**
1763 * Error code indicating the connection to the AV servers failed.
1764 * @constant
1765 */
1766 CONNECTION_FAILED: 100,
1767
1768 /**
1769 * Error code indicating the specified object doesn't exist.
1770 * @constant
1771 */
1772 OBJECT_NOT_FOUND: 101,
1773
1774 /**
1775 * Error code indicating you tried to query with a datatype that doesn't
1776 * support it, like exact matching an array or object.
1777 * @constant
1778 */
1779 INVALID_QUERY: 102,
1780
1781 /**
1782 * Error code indicating a missing or invalid classname. Classnames are
1783 * case-sensitive. They must start with a letter, and a-zA-Z0-9_ are the
1784 * only valid characters.
1785 * @constant
1786 */
1787 INVALID_CLASS_NAME: 103,
1788
1789 /**
1790 * Error code indicating an unspecified object id.
1791 * @constant
1792 */
1793 MISSING_OBJECT_ID: 104,
1794
1795 /**
1796 * Error code indicating an invalid key name. Keys are case-sensitive. They
1797 * must start with a letter, and a-zA-Z0-9_ are the only valid characters.
1798 * @constant
1799 */
1800 INVALID_KEY_NAME: 105,
1801
1802 /**
1803 * Error code indicating a malformed pointer. You should not see this unless
1804 * you have been mucking about changing internal AV code.
1805 * @constant
1806 */
1807 INVALID_POINTER: 106,
1808
1809 /**
1810 * Error code indicating that badly formed JSON was received upstream. This
1811 * either indicates you have done something unusual with modifying how
1812 * things encode to JSON, or the network is failing badly.
1813 * @constant
1814 */
1815 INVALID_JSON: 107,
1816
1817 /**
1818 * Error code indicating that the feature you tried to access is only
1819 * available internally for testing purposes.
1820 * @constant
1821 */
1822 COMMAND_UNAVAILABLE: 108,
1823
1824 /**
1825 * You must call AV.initialize before using the AV library.
1826 * @constant
1827 */
1828 NOT_INITIALIZED: 109,
1829
1830 /**
1831 * Error code indicating that a field was set to an inconsistent type.
1832 * @constant
1833 */
1834 INCORRECT_TYPE: 111,
1835
1836 /**
1837 * Error code indicating an invalid channel name. A channel name is either
1838 * an empty string (the broadcast channel) or contains only a-zA-Z0-9_
1839 * characters.
1840 * @constant
1841 */
1842 INVALID_CHANNEL_NAME: 112,
1843
1844 /**
1845 * Error code indicating that push is misconfigured.
1846 * @constant
1847 */
1848 PUSH_MISCONFIGURED: 115,
1849
1850 /**
1851 * Error code indicating that the object is too large.
1852 * @constant
1853 */
1854 OBJECT_TOO_LARGE: 116,
1855
1856 /**
1857 * Error code indicating that the operation isn't allowed for clients.
1858 * @constant
1859 */
1860 OPERATION_FORBIDDEN: 119,
1861
1862 /**
1863 * Error code indicating the result was not found in the cache.
1864 * @constant
1865 */
1866 CACHE_MISS: 120,
1867
1868 /**
1869 * Error code indicating that an invalid key was used in a nested
1870 * JSONObject.
1871 * @constant
1872 */
1873 INVALID_NESTED_KEY: 121,
1874
1875 /**
1876 * Error code indicating that an invalid filename was used for AVFile.
1877 * A valid file name contains only a-zA-Z0-9_. characters and is between 1
1878 * and 128 characters.
1879 * @constant
1880 */
1881 INVALID_FILE_NAME: 122,
1882
1883 /**
1884 * Error code indicating an invalid ACL was provided.
1885 * @constant
1886 */
1887 INVALID_ACL: 123,
1888
1889 /**
1890 * Error code indicating that the request timed out on the server. Typically
1891 * this indicates that the request is too expensive to run.
1892 * @constant
1893 */
1894 TIMEOUT: 124,
1895
1896 /**
1897 * Error code indicating that the email address was invalid.
1898 * @constant
1899 */
1900 INVALID_EMAIL_ADDRESS: 125,
1901
1902 /**
1903 * Error code indicating a missing content type.
1904 * @constant
1905 */
1906 MISSING_CONTENT_TYPE: 126,
1907
1908 /**
1909 * Error code indicating a missing content length.
1910 * @constant
1911 */
1912 MISSING_CONTENT_LENGTH: 127,
1913
1914 /**
1915 * Error code indicating an invalid content length.
1916 * @constant
1917 */
1918 INVALID_CONTENT_LENGTH: 128,
1919
1920 /**
1921 * Error code indicating a file that was too large.
1922 * @constant
1923 */
1924 FILE_TOO_LARGE: 129,
1925
1926 /**
1927 * Error code indicating an error saving a file.
1928 * @constant
1929 */
1930 FILE_SAVE_ERROR: 130,
1931
1932 /**
1933 * Error code indicating an error deleting a file.
1934 * @constant
1935 */
1936 FILE_DELETE_ERROR: 153,
1937
1938 /**
1939 * Error code indicating that a unique field was given a value that is
1940 * already taken.
1941 * @constant
1942 */
1943 DUPLICATE_VALUE: 137,
1944
1945 /**
1946 * Error code indicating that a role's name is invalid.
1947 * @constant
1948 */
1949 INVALID_ROLE_NAME: 139,
1950
1951 /**
1952 * Error code indicating that an application quota was exceeded. Upgrade to
1953 * resolve.
1954 * @constant
1955 */
1956 EXCEEDED_QUOTA: 140,
1957
1958 /**
1959 * Error code indicating that a Cloud Code script failed.
1960 * @constant
1961 */
1962 SCRIPT_FAILED: 141,
1963
1964 /**
1965 * Error code indicating that a Cloud Code validation failed.
1966 * @constant
1967 */
1968 VALIDATION_ERROR: 142,
1969
1970 /**
1971 * Error code indicating that invalid image data was provided.
1972 * @constant
1973 */
1974 INVALID_IMAGE_DATA: 150,
1975
1976 /**
1977 * Error code indicating an unsaved file.
1978 * @constant
1979 */
1980 UNSAVED_FILE_ERROR: 151,
1981
1982 /**
1983 * Error code indicating an invalid push time.
1984 * @constant
1985 */
1986 INVALID_PUSH_TIME_ERROR: 152,
1987
1988 /**
1989 * Error code indicating that the username is missing or empty.
1990 * @constant
1991 */
1992 USERNAME_MISSING: 200,
1993
1994 /**
1995 * Error code indicating that the password is missing or empty.
1996 * @constant
1997 */
1998 PASSWORD_MISSING: 201,
1999
2000 /**
2001 * Error code indicating that the username has already been taken.
2002 * @constant
2003 */
2004 USERNAME_TAKEN: 202,
2005
2006 /**
2007 * Error code indicating that the email has already been taken.
2008 * @constant
2009 */
2010 EMAIL_TAKEN: 203,
2011
2012 /**
2013 * Error code indicating that the email is missing, but must be specified.
2014 * @constant
2015 */
2016 EMAIL_MISSING: 204,
2017
2018 /**
2019 * Error code indicating that a user with the specified email was not found.
2020 * @constant
2021 */
2022 EMAIL_NOT_FOUND: 205,
2023
2024 /**
2025 * Error code indicating that a user object without a valid session could
2026 * not be altered.
2027 * @constant
2028 */
2029 SESSION_MISSING: 206,
2030
2031 /**
2032 * Error code indicating that a user can only be created through signup.
2033 * @constant
2034 */
2035 MUST_CREATE_USER_THROUGH_SIGNUP: 207,
2036
2037 /**
2038 * Error code indicating that an an account being linked is already linked
2039 * to another user.
2040 * @constant
2041 */
2042 ACCOUNT_ALREADY_LINKED: 208,
2043
2044 /**
2045 * Error code indicating that a user cannot be linked to an account because
2046 * that account's id could not be found.
2047 * @constant
2048 */
2049 LINKED_ID_MISSING: 250,
2050
2051 /**
2052 * Error code indicating that a user with a linked (e.g. Facebook) account
2053 * has an invalid session.
2054 * @constant
2055 */
2056 INVALID_LINKED_SESSION: 251,
2057
2058 /**
2059 * Error code indicating that a service being linked (e.g. Facebook or
2060 * Twitter) is unsupported.
2061 * @constant
2062 */
2063 UNSUPPORTED_SERVICE: 252,
2064
2065 /**
2066 * Error code indicating a real error code is unavailable because
2067 * we had to use an XDomainRequest object to allow CORS requests in
2068 * Internet Explorer, which strips the body from HTTP responses that have
2069 * a non-2XX status code.
2070 * @constant
2071 */
2072 X_DOMAIN_REQUEST: 602
2073});
2074
2075module.exports = AVError;
2076
2077/***/ }),
2078/* 47 */
2079/***/ (function(module, exports) {
2080
2081module.exports = function (bitmap, value) {
2082 return {
2083 enumerable: !(bitmap & 1),
2084 configurable: !(bitmap & 2),
2085 writable: !(bitmap & 4),
2086 value: value
2087 };
2088};
2089
2090
2091/***/ }),
2092/* 48 */
2093/***/ (function(module, exports, __webpack_require__) {
2094
2095var uncurryThis = __webpack_require__(4);
2096var aCallable = __webpack_require__(31);
2097var NATIVE_BIND = __webpack_require__(76);
2098
2099var bind = uncurryThis(uncurryThis.bind);
2100
2101// optional / simple context binding
2102module.exports = function (fn, that) {
2103 aCallable(fn);
2104 return that === undefined ? fn : NATIVE_BIND ? bind(fn, that) : function (/* ...args */) {
2105 return fn.apply(that, arguments);
2106 };
2107};
2108
2109
2110/***/ }),
2111/* 49 */
2112/***/ (function(module, exports, __webpack_require__) {
2113
2114/* global ActiveXObject -- old IE, WSH */
2115var anObject = __webpack_require__(20);
2116var definePropertiesModule = __webpack_require__(129);
2117var enumBugKeys = __webpack_require__(128);
2118var hiddenKeys = __webpack_require__(80);
2119var html = __webpack_require__(166);
2120var documentCreateElement = __webpack_require__(125);
2121var sharedKey = __webpack_require__(101);
2122
2123var GT = '>';
2124var LT = '<';
2125var PROTOTYPE = 'prototype';
2126var SCRIPT = 'script';
2127var IE_PROTO = sharedKey('IE_PROTO');
2128
2129var EmptyConstructor = function () { /* empty */ };
2130
2131var scriptTag = function (content) {
2132 return LT + SCRIPT + GT + content + LT + '/' + SCRIPT + GT;
2133};
2134
2135// Create object with fake `null` prototype: use ActiveX Object with cleared prototype
2136var NullProtoObjectViaActiveX = function (activeXDocument) {
2137 activeXDocument.write(scriptTag(''));
2138 activeXDocument.close();
2139 var temp = activeXDocument.parentWindow.Object;
2140 activeXDocument = null; // avoid memory leak
2141 return temp;
2142};
2143
2144// Create object with fake `null` prototype: use iframe Object with cleared prototype
2145var NullProtoObjectViaIFrame = function () {
2146 // Thrash, waste and sodomy: IE GC bug
2147 var iframe = documentCreateElement('iframe');
2148 var JS = 'java' + SCRIPT + ':';
2149 var iframeDocument;
2150 iframe.style.display = 'none';
2151 html.appendChild(iframe);
2152 // https://github.com/zloirock/core-js/issues/475
2153 iframe.src = String(JS);
2154 iframeDocument = iframe.contentWindow.document;
2155 iframeDocument.open();
2156 iframeDocument.write(scriptTag('document.F=Object'));
2157 iframeDocument.close();
2158 return iframeDocument.F;
2159};
2160
2161// Check for document.domain and active x support
2162// No need to use active x approach when document.domain is not set
2163// see https://github.com/es-shims/es5-shim/issues/150
2164// variation of https://github.com/kitcambridge/es5-shim/commit/4f738ac066346
2165// avoid IE GC bug
2166var activeXDocument;
2167var NullProtoObject = function () {
2168 try {
2169 activeXDocument = new ActiveXObject('htmlfile');
2170 } catch (error) { /* ignore */ }
2171 NullProtoObject = typeof document != 'undefined'
2172 ? document.domain && activeXDocument
2173 ? NullProtoObjectViaActiveX(activeXDocument) // old IE
2174 : NullProtoObjectViaIFrame()
2175 : NullProtoObjectViaActiveX(activeXDocument); // WSH
2176 var length = enumBugKeys.length;
2177 while (length--) delete NullProtoObject[PROTOTYPE][enumBugKeys[length]];
2178 return NullProtoObject();
2179};
2180
2181hiddenKeys[IE_PROTO] = true;
2182
2183// `Object.create` method
2184// https://tc39.es/ecma262/#sec-object.create
2185// eslint-disable-next-line es-x/no-object-create -- safe
2186module.exports = Object.create || function create(O, Properties) {
2187 var result;
2188 if (O !== null) {
2189 EmptyConstructor[PROTOTYPE] = anObject(O);
2190 result = new EmptyConstructor();
2191 EmptyConstructor[PROTOTYPE] = null;
2192 // add "__proto__" for Object.getPrototypeOf polyfill
2193 result[IE_PROTO] = O;
2194 } else result = NullProtoObject();
2195 return Properties === undefined ? result : definePropertiesModule.f(result, Properties);
2196};
2197
2198
2199/***/ }),
2200/* 50 */
2201/***/ (function(module, exports) {
2202
2203module.exports = {};
2204
2205
2206/***/ }),
2207/* 51 */
2208/***/ (function(module, exports, __webpack_require__) {
2209
2210var TO_STRING_TAG_SUPPORT = __webpack_require__(130);
2211var isCallable = __webpack_require__(8);
2212var classofRaw = __webpack_require__(63);
2213var wellKnownSymbol = __webpack_require__(9);
2214
2215var TO_STRING_TAG = wellKnownSymbol('toStringTag');
2216var $Object = Object;
2217
2218// ES3 wrong here
2219var CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) == 'Arguments';
2220
2221// fallback for IE11 Script Access Denied error
2222var tryGet = function (it, key) {
2223 try {
2224 return it[key];
2225 } catch (error) { /* empty */ }
2226};
2227
2228// getting tag from ES6+ `Object.prototype.toString`
2229module.exports = TO_STRING_TAG_SUPPORT ? classofRaw : function (it) {
2230 var O, tag, result;
2231 return it === undefined ? 'Undefined' : it === null ? 'Null'
2232 // @@toStringTag case
2233 : typeof (tag = tryGet(O = $Object(it), TO_STRING_TAG)) == 'string' ? tag
2234 // builtinTag case
2235 : CORRECT_ARGUMENTS ? classofRaw(O)
2236 // ES3 arguments fallback
2237 : (result = classofRaw(O)) == 'Object' && isCallable(O.callee) ? 'Arguments' : result;
2238};
2239
2240
2241/***/ }),
2242/* 52 */
2243/***/ (function(module, exports, __webpack_require__) {
2244
2245var TO_STRING_TAG_SUPPORT = __webpack_require__(130);
2246var defineProperty = __webpack_require__(23).f;
2247var createNonEnumerableProperty = __webpack_require__(37);
2248var hasOwn = __webpack_require__(13);
2249var toString = __webpack_require__(300);
2250var wellKnownSymbol = __webpack_require__(9);
2251
2252var TO_STRING_TAG = wellKnownSymbol('toStringTag');
2253
2254module.exports = function (it, TAG, STATIC, SET_METHOD) {
2255 if (it) {
2256 var target = STATIC ? it : it.prototype;
2257 if (!hasOwn(target, TO_STRING_TAG)) {
2258 defineProperty(target, TO_STRING_TAG, { configurable: true, value: TAG });
2259 }
2260 if (SET_METHOD && !TO_STRING_TAG_SUPPORT) {
2261 createNonEnumerableProperty(target, 'toString', toString);
2262 }
2263 }
2264};
2265
2266
2267/***/ }),
2268/* 53 */
2269/***/ (function(module, exports) {
2270
2271// empty
2272
2273
2274/***/ }),
2275/* 54 */
2276/***/ (function(module, exports, __webpack_require__) {
2277
2278"use strict";
2279
2280var aCallable = __webpack_require__(31);
2281
2282var PromiseCapability = function (C) {
2283 var resolve, reject;
2284 this.promise = new C(function ($$resolve, $$reject) {
2285 if (resolve !== undefined || reject !== undefined) throw TypeError('Bad Promise constructor');
2286 resolve = $$resolve;
2287 reject = $$reject;
2288 });
2289 this.resolve = aCallable(resolve);
2290 this.reject = aCallable(reject);
2291};
2292
2293// `NewPromiseCapability` abstract operation
2294// https://tc39.es/ecma262/#sec-newpromisecapability
2295module.exports.f = function (C) {
2296 return new PromiseCapability(C);
2297};
2298
2299
2300/***/ }),
2301/* 55 */
2302/***/ (function(module, exports, __webpack_require__) {
2303
2304"use strict";
2305
2306var charAt = __webpack_require__(318).charAt;
2307var toString = __webpack_require__(81);
2308var InternalStateModule = __webpack_require__(43);
2309var defineIterator = __webpack_require__(132);
2310
2311var STRING_ITERATOR = 'String Iterator';
2312var setInternalState = InternalStateModule.set;
2313var getInternalState = InternalStateModule.getterFor(STRING_ITERATOR);
2314
2315// `String.prototype[@@iterator]` method
2316// https://tc39.es/ecma262/#sec-string.prototype-@@iterator
2317defineIterator(String, 'String', function (iterated) {
2318 setInternalState(this, {
2319 type: STRING_ITERATOR,
2320 string: toString(iterated),
2321 index: 0
2322 });
2323// `%StringIteratorPrototype%.next` method
2324// https://tc39.es/ecma262/#sec-%stringiteratorprototype%.next
2325}, function next() {
2326 var state = getInternalState(this);
2327 var string = state.string;
2328 var index = state.index;
2329 var point;
2330 if (index >= string.length) return { value: undefined, done: true };
2331 point = charAt(string, index);
2332 state.index += point.length;
2333 return { value: point, done: false };
2334});
2335
2336
2337/***/ }),
2338/* 56 */
2339/***/ (function(module, __webpack_exports__, __webpack_require__) {
2340
2341"use strict";
2342/* harmony export (immutable) */ __webpack_exports__["a"] = isObject;
2343// Is a given variable an object?
2344function isObject(obj) {
2345 var type = typeof obj;
2346 return type === 'function' || type === 'object' && !!obj;
2347}
2348
2349
2350/***/ }),
2351/* 57 */
2352/***/ (function(module, __webpack_exports__, __webpack_require__) {
2353
2354"use strict";
2355/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(6);
2356/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__tagTester_js__ = __webpack_require__(17);
2357
2358
2359
2360// Is a given value an array?
2361// Delegates to ECMA5's native `Array.isArray`.
2362/* harmony default export */ __webpack_exports__["a"] = (__WEBPACK_IMPORTED_MODULE_0__setup_js__["k" /* nativeIsArray */] || Object(__WEBPACK_IMPORTED_MODULE_1__tagTester_js__["a" /* default */])('Array'));
2363
2364
2365/***/ }),
2366/* 58 */
2367/***/ (function(module, __webpack_exports__, __webpack_require__) {
2368
2369"use strict";
2370/* harmony export (immutable) */ __webpack_exports__["a"] = each;
2371/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__optimizeCb_js__ = __webpack_require__(87);
2372/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isArrayLike_js__ = __webpack_require__(26);
2373/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__keys_js__ = __webpack_require__(16);
2374
2375
2376
2377
2378// The cornerstone for collection functions, an `each`
2379// implementation, aka `forEach`.
2380// Handles raw objects in addition to array-likes. Treats all
2381// sparse array-likes as if they were dense.
2382function each(obj, iteratee, context) {
2383 iteratee = Object(__WEBPACK_IMPORTED_MODULE_0__optimizeCb_js__["a" /* default */])(iteratee, context);
2384 var i, length;
2385 if (Object(__WEBPACK_IMPORTED_MODULE_1__isArrayLike_js__["a" /* default */])(obj)) {
2386 for (i = 0, length = obj.length; i < length; i++) {
2387 iteratee(obj[i], i, obj);
2388 }
2389 } else {
2390 var _keys = Object(__WEBPACK_IMPORTED_MODULE_2__keys_js__["a" /* default */])(obj);
2391 for (i = 0, length = _keys.length; i < length; i++) {
2392 iteratee(obj[_keys[i]], _keys[i], obj);
2393 }
2394 }
2395 return obj;
2396}
2397
2398
2399/***/ }),
2400/* 59 */
2401/***/ (function(module, exports, __webpack_require__) {
2402
2403module.exports = __webpack_require__(410);
2404
2405/***/ }),
2406/* 60 */
2407/***/ (function(module, exports, __webpack_require__) {
2408
2409"use strict";
2410
2411
2412function _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); }
2413
2414/* eslint-env browser */
2415
2416/**
2417 * This is the web browser implementation of `debug()`.
2418 */
2419exports.log = log;
2420exports.formatArgs = formatArgs;
2421exports.save = save;
2422exports.load = load;
2423exports.useColors = useColors;
2424exports.storage = localstorage();
2425/**
2426 * Colors.
2427 */
2428
2429exports.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'];
2430/**
2431 * Currently only WebKit-based Web Inspectors, Firefox >= v31,
2432 * and the Firebug extension (any Firefox version) are known
2433 * to support "%c" CSS customizations.
2434 *
2435 * TODO: add a `localStorage` variable to explicitly enable/disable colors
2436 */
2437// eslint-disable-next-line complexity
2438
2439function useColors() {
2440 // NB: In an Electron preload script, document will be defined but not fully
2441 // initialized. Since we know we're in Chrome, we'll just detect this case
2442 // explicitly
2443 if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) {
2444 return true;
2445 } // Internet Explorer and Edge do not support colors.
2446
2447
2448 if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
2449 return false;
2450 } // Is webkit? http://stackoverflow.com/a/16459606/376773
2451 // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
2452
2453
2454 return typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || // Is firebug? http://stackoverflow.com/a/398120/376773
2455 typeof window !== 'undefined' && window.console && (window.console.firebug || window.console.exception && window.console.table) || // Is firefox >= v31?
2456 // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
2457 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
2458 typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/);
2459}
2460/**
2461 * Colorize log arguments if enabled.
2462 *
2463 * @api public
2464 */
2465
2466
2467function formatArgs(args) {
2468 args[0] = (this.useColors ? '%c' : '') + this.namespace + (this.useColors ? ' %c' : ' ') + args[0] + (this.useColors ? '%c ' : ' ') + '+' + module.exports.humanize(this.diff);
2469
2470 if (!this.useColors) {
2471 return;
2472 }
2473
2474 var c = 'color: ' + this.color;
2475 args.splice(1, 0, c, 'color: inherit'); // The final "%c" is somewhat tricky, because there could be other
2476 // arguments passed either before or after the %c, so we need to
2477 // figure out the correct index to insert the CSS into
2478
2479 var index = 0;
2480 var lastC = 0;
2481 args[0].replace(/%[a-zA-Z%]/g, function (match) {
2482 if (match === '%%') {
2483 return;
2484 }
2485
2486 index++;
2487
2488 if (match === '%c') {
2489 // We only are interested in the *last* %c
2490 // (the user may have provided their own)
2491 lastC = index;
2492 }
2493 });
2494 args.splice(lastC, 0, c);
2495}
2496/**
2497 * Invokes `console.log()` when available.
2498 * No-op when `console.log` is not a "function".
2499 *
2500 * @api public
2501 */
2502
2503
2504function log() {
2505 var _console;
2506
2507 // This hackery is required for IE8/9, where
2508 // the `console.log` function doesn't have 'apply'
2509 return (typeof console === "undefined" ? "undefined" : _typeof(console)) === 'object' && console.log && (_console = console).log.apply(_console, arguments);
2510}
2511/**
2512 * Save `namespaces`.
2513 *
2514 * @param {String} namespaces
2515 * @api private
2516 */
2517
2518
2519function save(namespaces) {
2520 try {
2521 if (namespaces) {
2522 exports.storage.setItem('debug', namespaces);
2523 } else {
2524 exports.storage.removeItem('debug');
2525 }
2526 } catch (error) {// Swallow
2527 // XXX (@Qix-) should we be logging these?
2528 }
2529}
2530/**
2531 * Load `namespaces`.
2532 *
2533 * @return {String} returns the previously persisted debug modes
2534 * @api private
2535 */
2536
2537
2538function load() {
2539 var r;
2540
2541 try {
2542 r = exports.storage.getItem('debug');
2543 } catch (error) {} // Swallow
2544 // XXX (@Qix-) should we be logging these?
2545 // If debug isn't set in LS, and we're in Electron, try to load $DEBUG
2546
2547
2548 if (!r && typeof process !== 'undefined' && 'env' in process) {
2549 r = process.env.DEBUG;
2550 }
2551
2552 return r;
2553}
2554/**
2555 * Localstorage attempts to return the localstorage.
2556 *
2557 * This is necessary because safari throws
2558 * when a user disables cookies/localstorage
2559 * and you attempt to access it.
2560 *
2561 * @return {LocalStorage}
2562 * @api private
2563 */
2564
2565
2566function localstorage() {
2567 try {
2568 // TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context
2569 // The Browser also has localStorage in the global context.
2570 return localStorage;
2571 } catch (error) {// Swallow
2572 // XXX (@Qix-) should we be logging these?
2573 }
2574}
2575
2576module.exports = __webpack_require__(415)(exports);
2577var formatters = module.exports.formatters;
2578/**
2579 * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
2580 */
2581
2582formatters.j = function (v) {
2583 try {
2584 return JSON.stringify(v);
2585 } catch (error) {
2586 return '[UnexpectedJSONParseError]: ' + error.message;
2587 }
2588};
2589
2590
2591
2592/***/ }),
2593/* 61 */
2594/***/ (function(module, exports, __webpack_require__) {
2595
2596module.exports = __webpack_require__(241);
2597
2598/***/ }),
2599/* 62 */
2600/***/ (function(module, exports, __webpack_require__) {
2601
2602var DESCRIPTORS = __webpack_require__(14);
2603var call = __webpack_require__(15);
2604var propertyIsEnumerableModule = __webpack_require__(121);
2605var createPropertyDescriptor = __webpack_require__(47);
2606var toIndexedObject = __webpack_require__(32);
2607var toPropertyKey = __webpack_require__(96);
2608var hasOwn = __webpack_require__(13);
2609var IE8_DOM_DEFINE = __webpack_require__(159);
2610
2611// eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
2612var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
2613
2614// `Object.getOwnPropertyDescriptor` method
2615// https://tc39.es/ecma262/#sec-object.getownpropertydescriptor
2616exports.f = DESCRIPTORS ? $getOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {
2617 O = toIndexedObject(O);
2618 P = toPropertyKey(P);
2619 if (IE8_DOM_DEFINE) try {
2620 return $getOwnPropertyDescriptor(O, P);
2621 } catch (error) { /* empty */ }
2622 if (hasOwn(O, P)) return createPropertyDescriptor(!call(propertyIsEnumerableModule.f, O, P), O[P]);
2623};
2624
2625
2626/***/ }),
2627/* 63 */
2628/***/ (function(module, exports, __webpack_require__) {
2629
2630var uncurryThis = __webpack_require__(4);
2631
2632var toString = uncurryThis({}.toString);
2633var stringSlice = uncurryThis(''.slice);
2634
2635module.exports = function (it) {
2636 return stringSlice(toString(it), 8, -1);
2637};
2638
2639
2640/***/ }),
2641/* 64 */
2642/***/ (function(module, exports, __webpack_require__) {
2643
2644/* eslint-disable es-x/no-symbol -- required for testing */
2645var V8_VERSION = __webpack_require__(77);
2646var fails = __webpack_require__(2);
2647
2648// eslint-disable-next-line es-x/no-object-getownpropertysymbols -- required for testing
2649module.exports = !!Object.getOwnPropertySymbols && !fails(function () {
2650 var symbol = Symbol();
2651 // Chrome 38 Symbol has incorrect toString conversion
2652 // `get-own-property-symbols` polyfill symbols converted to object are not Symbol instances
2653 return !String(symbol) || !(Object(symbol) instanceof Symbol) ||
2654 // Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances
2655 !Symbol.sham && V8_VERSION && V8_VERSION < 41;
2656});
2657
2658
2659/***/ }),
2660/* 65 */
2661/***/ (function(module, exports, __webpack_require__) {
2662
2663var global = __webpack_require__(7);
2664
2665module.exports = global.Promise;
2666
2667
2668/***/ }),
2669/* 66 */
2670/***/ (function(module, __webpack_exports__, __webpack_require__) {
2671
2672"use strict";
2673/* harmony export (immutable) */ __webpack_exports__["a"] = values;
2674/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__keys_js__ = __webpack_require__(16);
2675
2676
2677// Retrieve the values of an object's properties.
2678function values(obj) {
2679 var _keys = Object(__WEBPACK_IMPORTED_MODULE_0__keys_js__["a" /* default */])(obj);
2680 var length = _keys.length;
2681 var values = Array(length);
2682 for (var i = 0; i < length; i++) {
2683 values[i] = obj[_keys[i]];
2684 }
2685 return values;
2686}
2687
2688
2689/***/ }),
2690/* 67 */
2691/***/ (function(module, __webpack_exports__, __webpack_require__) {
2692
2693"use strict";
2694/* harmony export (immutable) */ __webpack_exports__["a"] = flatten;
2695/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__getLength_js__ = __webpack_require__(29);
2696/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isArrayLike_js__ = __webpack_require__(26);
2697/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__isArray_js__ = __webpack_require__(57);
2698/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__isArguments_js__ = __webpack_require__(136);
2699
2700
2701
2702
2703
2704// Internal implementation of a recursive `flatten` function.
2705function flatten(input, depth, strict, output) {
2706 output = output || [];
2707 if (!depth && depth !== 0) {
2708 depth = Infinity;
2709 } else if (depth <= 0) {
2710 return output.concat(input);
2711 }
2712 var idx = output.length;
2713 for (var i = 0, length = Object(__WEBPACK_IMPORTED_MODULE_0__getLength_js__["a" /* default */])(input); i < length; i++) {
2714 var value = input[i];
2715 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))) {
2716 // Flatten current level of array or arguments object.
2717 if (depth > 1) {
2718 flatten(value, depth - 1, strict, output);
2719 idx = output.length;
2720 } else {
2721 var j = 0, len = value.length;
2722 while (j < len) output[idx++] = value[j++];
2723 }
2724 } else if (!strict) {
2725 output[idx++] = value;
2726 }
2727 }
2728 return output;
2729}
2730
2731
2732/***/ }),
2733/* 68 */
2734/***/ (function(module, __webpack_exports__, __webpack_require__) {
2735
2736"use strict";
2737/* harmony export (immutable) */ __webpack_exports__["a"] = map;
2738/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(21);
2739/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isArrayLike_js__ = __webpack_require__(26);
2740/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__keys_js__ = __webpack_require__(16);
2741
2742
2743
2744
2745// Return the results of applying the iteratee to each element.
2746function map(obj, iteratee, context) {
2747 iteratee = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(iteratee, context);
2748 var _keys = !Object(__WEBPACK_IMPORTED_MODULE_1__isArrayLike_js__["a" /* default */])(obj) && Object(__WEBPACK_IMPORTED_MODULE_2__keys_js__["a" /* default */])(obj),
2749 length = (_keys || obj).length,
2750 results = Array(length);
2751 for (var index = 0; index < length; index++) {
2752 var currentKey = _keys ? _keys[index] : index;
2753 results[index] = iteratee(obj[currentKey], currentKey, obj);
2754 }
2755 return results;
2756}
2757
2758
2759/***/ }),
2760/* 69 */
2761/***/ (function(module, exports, __webpack_require__) {
2762
2763"use strict";
2764/* WEBPACK VAR INJECTION */(function(global) {
2765
2766var _interopRequireDefault = __webpack_require__(1);
2767
2768var _promise = _interopRequireDefault(__webpack_require__(12));
2769
2770var _concat = _interopRequireDefault(__webpack_require__(22));
2771
2772var _map = _interopRequireDefault(__webpack_require__(35));
2773
2774var _keys = _interopRequireDefault(__webpack_require__(115));
2775
2776var _stringify = _interopRequireDefault(__webpack_require__(36));
2777
2778var _indexOf = _interopRequireDefault(__webpack_require__(71));
2779
2780var _keys2 = _interopRequireDefault(__webpack_require__(59));
2781
2782var _ = __webpack_require__(3);
2783
2784var uuid = __webpack_require__(233);
2785
2786var debug = __webpack_require__(60);
2787
2788var _require = __webpack_require__(30),
2789 inherits = _require.inherits,
2790 parseDate = _require.parseDate;
2791
2792var version = __webpack_require__(235);
2793
2794var _require2 = __webpack_require__(72),
2795 setAdapters = _require2.setAdapters,
2796 adapterManager = _require2.adapterManager;
2797
2798var AV = global.AV || {}; // All internal configuration items
2799
2800AV._config = {
2801 serverURLs: {},
2802 useMasterKey: false,
2803 production: null,
2804 realtime: null,
2805 requestTimeout: null
2806};
2807var initialUserAgent = "LeanCloud-JS-SDK/".concat(version); // configs shared by all AV instances
2808
2809AV._sharedConfig = {
2810 userAgent: initialUserAgent,
2811 liveQueryRealtime: null
2812};
2813adapterManager.on('platformInfo', function (platformInfo) {
2814 var ua = initialUserAgent;
2815
2816 if (platformInfo) {
2817 if (platformInfo.userAgent) {
2818 ua = platformInfo.userAgent;
2819 } else {
2820 var comments = platformInfo.name;
2821
2822 if (platformInfo.version) {
2823 comments += "/".concat(platformInfo.version);
2824 }
2825
2826 if (platformInfo.extra) {
2827 comments += "; ".concat(platformInfo.extra);
2828 }
2829
2830 ua += " (".concat(comments, ")");
2831 }
2832 }
2833
2834 AV._sharedConfig.userAgent = ua;
2835});
2836/**
2837 * Contains all AV API classes and functions.
2838 * @namespace AV
2839 */
2840
2841/**
2842 * Returns prefix for localStorage keys used by this instance of AV.
2843 * @param {String} path The relative suffix to append to it.
2844 * null or undefined is treated as the empty string.
2845 * @return {String} The full key name.
2846 * @private
2847 */
2848
2849AV._getAVPath = function (path) {
2850 if (!AV.applicationId) {
2851 throw new Error('You need to call AV.initialize before using AV.');
2852 }
2853
2854 if (!path) {
2855 path = '';
2856 }
2857
2858 if (!_.isString(path)) {
2859 throw new Error("Tried to get a localStorage path that wasn't a String.");
2860 }
2861
2862 if (path[0] === '/') {
2863 path = path.substring(1);
2864 }
2865
2866 return 'AV/' + AV.applicationId + '/' + path;
2867};
2868/**
2869 * Returns the unique string for this app on this machine.
2870 * Gets reset when localStorage is cleared.
2871 * @private
2872 */
2873
2874
2875AV._installationId = null;
2876
2877AV._getInstallationId = function () {
2878 // See if it's cached in RAM.
2879 if (AV._installationId) {
2880 return _promise.default.resolve(AV._installationId);
2881 } // Try to get it from localStorage.
2882
2883
2884 var path = AV._getAVPath('installationId');
2885
2886 return AV.localStorage.getItemAsync(path).then(function (_installationId) {
2887 AV._installationId = _installationId;
2888
2889 if (!AV._installationId) {
2890 // It wasn't in localStorage, so create a new one.
2891 AV._installationId = _installationId = uuid();
2892 return AV.localStorage.setItemAsync(path, _installationId).then(function () {
2893 return _installationId;
2894 });
2895 }
2896
2897 return _installationId;
2898 });
2899};
2900
2901AV._subscriptionId = null;
2902
2903AV._refreshSubscriptionId = function () {
2904 var path = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : AV._getAVPath('subscriptionId');
2905 var subscriptionId = AV._subscriptionId = uuid();
2906 return AV.localStorage.setItemAsync(path, subscriptionId).then(function () {
2907 return subscriptionId;
2908 });
2909};
2910
2911AV._getSubscriptionId = function () {
2912 // See if it's cached in RAM.
2913 if (AV._subscriptionId) {
2914 return _promise.default.resolve(AV._subscriptionId);
2915 } // Try to get it from localStorage.
2916
2917
2918 var path = AV._getAVPath('subscriptionId');
2919
2920 return AV.localStorage.getItemAsync(path).then(function (_subscriptionId) {
2921 AV._subscriptionId = _subscriptionId;
2922
2923 if (!AV._subscriptionId) {
2924 // It wasn't in localStorage, so create a new one.
2925 _subscriptionId = AV._refreshSubscriptionId(path);
2926 }
2927
2928 return _subscriptionId;
2929 });
2930};
2931
2932AV._parseDate = parseDate; // A self-propagating extend function.
2933
2934AV._extend = function (protoProps, classProps) {
2935 var child = inherits(this, protoProps, classProps);
2936 child.extend = this.extend;
2937 return child;
2938};
2939/**
2940 * Converts a value in a AV Object into the appropriate representation.
2941 * This is the JS equivalent of Java's AV.maybeReferenceAndEncode(Object)
2942 * if seenObjects is falsey. Otherwise any AV.Objects not in
2943 * seenObjects will be fully embedded rather than encoded
2944 * as a pointer. This array will be used to prevent going into an infinite
2945 * loop because we have circular references. If <seenObjects>
2946 * is set, then none of the AV Objects that are serialized can be dirty.
2947 * @private
2948 */
2949
2950
2951AV._encode = function (value, seenObjects, disallowObjects) {
2952 var full = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
2953
2954 if (value instanceof AV.Object) {
2955 if (disallowObjects) {
2956 throw new Error('AV.Objects not allowed here');
2957 }
2958
2959 if (!seenObjects || _.include(seenObjects, value) || !value._hasData) {
2960 return value._toPointer();
2961 }
2962
2963 return value._toFullJSON((0, _concat.default)(seenObjects).call(seenObjects, value), full);
2964 }
2965
2966 if (value instanceof AV.ACL) {
2967 return value.toJSON();
2968 }
2969
2970 if (_.isDate(value)) {
2971 return full ? {
2972 __type: 'Date',
2973 iso: value.toJSON()
2974 } : value.toJSON();
2975 }
2976
2977 if (value instanceof AV.GeoPoint) {
2978 return value.toJSON();
2979 }
2980
2981 if (_.isArray(value)) {
2982 return (0, _map.default)(_).call(_, value, function (x) {
2983 return AV._encode(x, seenObjects, disallowObjects, full);
2984 });
2985 }
2986
2987 if (_.isRegExp(value)) {
2988 return value.source;
2989 }
2990
2991 if (value instanceof AV.Relation) {
2992 return value.toJSON();
2993 }
2994
2995 if (value instanceof AV.Op) {
2996 return value.toJSON();
2997 }
2998
2999 if (value instanceof AV.File) {
3000 if (!value.url() && !value.id) {
3001 throw new Error('Tried to save an object containing an unsaved file.');
3002 }
3003
3004 return value._toFullJSON(seenObjects, full);
3005 }
3006
3007 if (_.isObject(value)) {
3008 return _.mapObject(value, function (v, k) {
3009 return AV._encode(v, seenObjects, disallowObjects, full);
3010 });
3011 }
3012
3013 return value;
3014};
3015/**
3016 * The inverse function of AV._encode.
3017 * @private
3018 */
3019
3020
3021AV._decode = function (value, key) {
3022 if (!_.isObject(value) || _.isDate(value)) {
3023 return value;
3024 }
3025
3026 if (_.isArray(value)) {
3027 return (0, _map.default)(_).call(_, value, function (v) {
3028 return AV._decode(v);
3029 });
3030 }
3031
3032 if (value instanceof AV.Object) {
3033 return value;
3034 }
3035
3036 if (value instanceof AV.File) {
3037 return value;
3038 }
3039
3040 if (value instanceof AV.Op) {
3041 return value;
3042 }
3043
3044 if (value instanceof AV.GeoPoint) {
3045 return value;
3046 }
3047
3048 if (value instanceof AV.ACL) {
3049 return value;
3050 }
3051
3052 if (key === 'ACL') {
3053 return new AV.ACL(value);
3054 }
3055
3056 if (value.__op) {
3057 return AV.Op._decode(value);
3058 }
3059
3060 var className;
3061
3062 if (value.__type === 'Pointer') {
3063 className = value.className;
3064
3065 var pointer = AV.Object._create(className);
3066
3067 if ((0, _keys.default)(value).length > 3) {
3068 var v = _.clone(value);
3069
3070 delete v.__type;
3071 delete v.className;
3072
3073 pointer._finishFetch(v, true);
3074 } else {
3075 pointer._finishFetch({
3076 objectId: value.objectId
3077 }, false);
3078 }
3079
3080 return pointer;
3081 }
3082
3083 if (value.__type === 'Object') {
3084 // It's an Object included in a query result.
3085 className = value.className;
3086
3087 var _v = _.clone(value);
3088
3089 delete _v.__type;
3090 delete _v.className;
3091
3092 var object = AV.Object._create(className);
3093
3094 object._finishFetch(_v, true);
3095
3096 return object;
3097 }
3098
3099 if (value.__type === 'Date') {
3100 return AV._parseDate(value.iso);
3101 }
3102
3103 if (value.__type === 'GeoPoint') {
3104 return new AV.GeoPoint({
3105 latitude: value.latitude,
3106 longitude: value.longitude
3107 });
3108 }
3109
3110 if (value.__type === 'Relation') {
3111 if (!key) throw new Error('key missing decoding a Relation');
3112 var relation = new AV.Relation(null, key);
3113 relation.targetClassName = value.className;
3114 return relation;
3115 }
3116
3117 if (value.__type === 'File') {
3118 var file = new AV.File(value.name);
3119
3120 var _v2 = _.clone(value);
3121
3122 delete _v2.__type;
3123
3124 file._finishFetch(_v2);
3125
3126 return file;
3127 }
3128
3129 return _.mapObject(value, AV._decode);
3130};
3131/**
3132 * The inverse function of {@link AV.Object#toFullJSON}.
3133 * @since 3.0.0
3134 * @method
3135 * @param {Object}
3136 * return {AV.Object|AV.File|any}
3137 */
3138
3139
3140AV.parseJSON = AV._decode;
3141/**
3142 * Similar to JSON.parse, except that AV internal types will be used if possible.
3143 * Inverse to {@link AV.stringify}
3144 * @since 3.14.0
3145 * @param {string} text the string to parse.
3146 * @return {AV.Object|AV.File|any}
3147 */
3148
3149AV.parse = function (text) {
3150 return AV.parseJSON(JSON.parse(text));
3151};
3152/**
3153 * Serialize a target containing AV.Object, similar to JSON.stringify.
3154 * Inverse to {@link AV.parse}
3155 * @since 3.14.0
3156 * @return {string}
3157 */
3158
3159
3160AV.stringify = function (target) {
3161 return (0, _stringify.default)(AV._encode(target, [], false, true));
3162};
3163
3164AV._encodeObjectOrArray = function (value) {
3165 var encodeAVObject = function encodeAVObject(object) {
3166 if (object && object._toFullJSON) {
3167 object = object._toFullJSON([]);
3168 }
3169
3170 return _.mapObject(object, function (value) {
3171 return AV._encode(value, []);
3172 });
3173 };
3174
3175 if (_.isArray(value)) {
3176 return (0, _map.default)(value).call(value, function (object) {
3177 return encodeAVObject(object);
3178 });
3179 } else {
3180 return encodeAVObject(value);
3181 }
3182};
3183
3184AV._arrayEach = _.each;
3185/**
3186 * Does a deep traversal of every item in object, calling func on every one.
3187 * @param {Object} object The object or array to traverse deeply.
3188 * @param {Function} func The function to call for every item. It will
3189 * be passed the item as an argument. If it returns a truthy value, that
3190 * value will replace the item in its parent container.
3191 * @returns {} the result of calling func on the top-level object itself.
3192 * @private
3193 */
3194
3195AV._traverse = function (object, func, seen) {
3196 if (object instanceof AV.Object) {
3197 seen = seen || [];
3198
3199 if ((0, _indexOf.default)(_).call(_, seen, object) >= 0) {
3200 // We've already visited this object in this call.
3201 return;
3202 }
3203
3204 seen.push(object);
3205
3206 AV._traverse(object.attributes, func, seen);
3207
3208 return func(object);
3209 }
3210
3211 if (object instanceof AV.Relation || object instanceof AV.File) {
3212 // Nothing needs to be done, but we don't want to recurse into the
3213 // object's parent infinitely, so we catch this case.
3214 return func(object);
3215 }
3216
3217 if (_.isArray(object)) {
3218 _.each(object, function (child, index) {
3219 var newChild = AV._traverse(child, func, seen);
3220
3221 if (newChild) {
3222 object[index] = newChild;
3223 }
3224 });
3225
3226 return func(object);
3227 }
3228
3229 if (_.isObject(object)) {
3230 AV._each(object, function (child, key) {
3231 var newChild = AV._traverse(child, func, seen);
3232
3233 if (newChild) {
3234 object[key] = newChild;
3235 }
3236 });
3237
3238 return func(object);
3239 }
3240
3241 return func(object);
3242};
3243/**
3244 * This is like _.each, except:
3245 * * it doesn't work for so-called array-like objects,
3246 * * it does work for dictionaries with a "length" attribute.
3247 * @private
3248 */
3249
3250
3251AV._objectEach = AV._each = function (obj, callback) {
3252 if (_.isObject(obj)) {
3253 _.each((0, _keys2.default)(_).call(_, obj), function (key) {
3254 callback(obj[key], key);
3255 });
3256 } else {
3257 _.each(obj, callback);
3258 }
3259};
3260/**
3261 * @namespace
3262 * @since 3.14.0
3263 */
3264
3265
3266AV.debug = {
3267 /**
3268 * Enable debug
3269 */
3270 enable: function enable() {
3271 var namespaces = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'leancloud*';
3272 return debug.enable(namespaces);
3273 },
3274
3275 /**
3276 * Disable debug
3277 */
3278 disable: debug.disable
3279};
3280/**
3281 * Specify Adapters
3282 * @since 4.4.0
3283 * @function
3284 * @param {Adapters} newAdapters See {@link https://url.leanapp.cn/adapter-type-definitions @leancloud/adapter-types} for detailed definitions.
3285 */
3286
3287AV.setAdapters = setAdapters;
3288module.exports = AV;
3289/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(74)))
3290
3291/***/ }),
3292/* 70 */
3293/***/ (function(module, exports, __webpack_require__) {
3294
3295var bind = __webpack_require__(48);
3296var uncurryThis = __webpack_require__(4);
3297var IndexedObject = __webpack_require__(95);
3298var toObject = __webpack_require__(34);
3299var lengthOfArrayLike = __webpack_require__(41);
3300var arraySpeciesCreate = __webpack_require__(230);
3301
3302var push = uncurryThis([].push);
3303
3304// `Array.prototype.{ forEach, map, filter, some, every, find, findIndex, filterReject }` methods implementation
3305var createMethod = function (TYPE) {
3306 var IS_MAP = TYPE == 1;
3307 var IS_FILTER = TYPE == 2;
3308 var IS_SOME = TYPE == 3;
3309 var IS_EVERY = TYPE == 4;
3310 var IS_FIND_INDEX = TYPE == 6;
3311 var IS_FILTER_REJECT = TYPE == 7;
3312 var NO_HOLES = TYPE == 5 || IS_FIND_INDEX;
3313 return function ($this, callbackfn, that, specificCreate) {
3314 var O = toObject($this);
3315 var self = IndexedObject(O);
3316 var boundFunction = bind(callbackfn, that);
3317 var length = lengthOfArrayLike(self);
3318 var index = 0;
3319 var create = specificCreate || arraySpeciesCreate;
3320 var target = IS_MAP ? create($this, length) : IS_FILTER || IS_FILTER_REJECT ? create($this, 0) : undefined;
3321 var value, result;
3322 for (;length > index; index++) if (NO_HOLES || index in self) {
3323 value = self[index];
3324 result = boundFunction(value, index, O);
3325 if (TYPE) {
3326 if (IS_MAP) target[index] = result; // map
3327 else if (result) switch (TYPE) {
3328 case 3: return true; // some
3329 case 5: return value; // find
3330 case 6: return index; // findIndex
3331 case 2: push(target, value); // filter
3332 } else switch (TYPE) {
3333 case 4: return false; // every
3334 case 7: push(target, value); // filterReject
3335 }
3336 }
3337 }
3338 return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : target;
3339 };
3340};
3341
3342module.exports = {
3343 // `Array.prototype.forEach` method
3344 // https://tc39.es/ecma262/#sec-array.prototype.foreach
3345 forEach: createMethod(0),
3346 // `Array.prototype.map` method
3347 // https://tc39.es/ecma262/#sec-array.prototype.map
3348 map: createMethod(1),
3349 // `Array.prototype.filter` method
3350 // https://tc39.es/ecma262/#sec-array.prototype.filter
3351 filter: createMethod(2),
3352 // `Array.prototype.some` method
3353 // https://tc39.es/ecma262/#sec-array.prototype.some
3354 some: createMethod(3),
3355 // `Array.prototype.every` method
3356 // https://tc39.es/ecma262/#sec-array.prototype.every
3357 every: createMethod(4),
3358 // `Array.prototype.find` method
3359 // https://tc39.es/ecma262/#sec-array.prototype.find
3360 find: createMethod(5),
3361 // `Array.prototype.findIndex` method
3362 // https://tc39.es/ecma262/#sec-array.prototype.findIndex
3363 findIndex: createMethod(6),
3364 // `Array.prototype.filterReject` method
3365 // https://github.com/tc39/proposal-array-filtering
3366 filterReject: createMethod(7)
3367};
3368
3369
3370/***/ }),
3371/* 71 */
3372/***/ (function(module, exports, __webpack_require__) {
3373
3374module.exports = __webpack_require__(406);
3375
3376/***/ }),
3377/* 72 */
3378/***/ (function(module, exports, __webpack_require__) {
3379
3380"use strict";
3381
3382
3383var _interopRequireDefault = __webpack_require__(1);
3384
3385var _keys = _interopRequireDefault(__webpack_require__(59));
3386
3387var _ = __webpack_require__(3);
3388
3389var EventEmitter = __webpack_require__(236);
3390
3391var _require = __webpack_require__(30),
3392 inherits = _require.inherits;
3393
3394var AdapterManager = inherits(EventEmitter, {
3395 constructor: function constructor() {
3396 EventEmitter.apply(this);
3397 this._adapters = {};
3398 },
3399 getAdapter: function getAdapter(name) {
3400 var adapter = this._adapters[name];
3401
3402 if (adapter === undefined) {
3403 throw new Error("".concat(name, " adapter is not configured"));
3404 }
3405
3406 return adapter;
3407 },
3408 setAdapters: function setAdapters(newAdapters) {
3409 var _this = this;
3410
3411 _.extend(this._adapters, newAdapters);
3412
3413 (0, _keys.default)(_).call(_, newAdapters).forEach(function (name) {
3414 return _this.emit(name, newAdapters[name]);
3415 });
3416 }
3417});
3418var adapterManager = new AdapterManager();
3419module.exports = {
3420 getAdapter: adapterManager.getAdapter.bind(adapterManager),
3421 setAdapters: adapterManager.setAdapters.bind(adapterManager),
3422 adapterManager: adapterManager
3423};
3424
3425/***/ }),
3426/* 73 */
3427/***/ (function(module, exports, __webpack_require__) {
3428
3429var _Symbol = __webpack_require__(243);
3430
3431var _Symbol$iterator = __webpack_require__(461);
3432
3433function _typeof(obj) {
3434 "@babel/helpers - typeof";
3435
3436 return (module.exports = _typeof = "function" == typeof _Symbol && "symbol" == typeof _Symbol$iterator ? function (obj) {
3437 return typeof obj;
3438 } : function (obj) {
3439 return obj && "function" == typeof _Symbol && obj.constructor === _Symbol && obj !== _Symbol.prototype ? "symbol" : typeof obj;
3440 }, module.exports.__esModule = true, module.exports["default"] = module.exports), _typeof(obj);
3441}
3442
3443module.exports = _typeof, module.exports.__esModule = true, module.exports["default"] = module.exports;
3444
3445/***/ }),
3446/* 74 */
3447/***/ (function(module, exports) {
3448
3449var g;
3450
3451// This works in non-strict mode
3452g = (function() {
3453 return this;
3454})();
3455
3456try {
3457 // This works if eval is allowed (see CSP)
3458 g = g || Function("return this")() || (1,eval)("this");
3459} catch(e) {
3460 // This works if the window reference is available
3461 if(typeof window === "object")
3462 g = window;
3463}
3464
3465// g can still be undefined, but nothing to do about it...
3466// We return undefined, instead of nothing here, so it's
3467// easier to handle this case. if(!global) { ...}
3468
3469module.exports = g;
3470
3471
3472/***/ }),
3473/* 75 */
3474/***/ (function(module, exports, __webpack_require__) {
3475
3476var NATIVE_BIND = __webpack_require__(76);
3477
3478var FunctionPrototype = Function.prototype;
3479var apply = FunctionPrototype.apply;
3480var call = FunctionPrototype.call;
3481
3482// eslint-disable-next-line es-x/no-reflect -- safe
3483module.exports = typeof Reflect == 'object' && Reflect.apply || (NATIVE_BIND ? call.bind(apply) : function () {
3484 return call.apply(apply, arguments);
3485});
3486
3487
3488/***/ }),
3489/* 76 */
3490/***/ (function(module, exports, __webpack_require__) {
3491
3492var fails = __webpack_require__(2);
3493
3494module.exports = !fails(function () {
3495 // eslint-disable-next-line es-x/no-function-prototype-bind -- safe
3496 var test = (function () { /* empty */ }).bind();
3497 // eslint-disable-next-line no-prototype-builtins -- safe
3498 return typeof test != 'function' || test.hasOwnProperty('prototype');
3499});
3500
3501
3502/***/ }),
3503/* 77 */
3504/***/ (function(module, exports, __webpack_require__) {
3505
3506var global = __webpack_require__(7);
3507var userAgent = __webpack_require__(98);
3508
3509var process = global.process;
3510var Deno = global.Deno;
3511var versions = process && process.versions || Deno && Deno.version;
3512var v8 = versions && versions.v8;
3513var match, version;
3514
3515if (v8) {
3516 match = v8.split('.');
3517 // in old Chrome, versions of V8 isn't V8 = Chrome / 10
3518 // but their correct versions are not interesting for us
3519 version = match[0] > 0 && match[0] < 4 ? 1 : +(match[0] + match[1]);
3520}
3521
3522// BrowserFS NodeJS `process` polyfill incorrectly set `.v8` to `0.0`
3523// so check `userAgent` even if `.v8` exists, but 0
3524if (!version && userAgent) {
3525 match = userAgent.match(/Edge\/(\d+)/);
3526 if (!match || match[1] >= 74) {
3527 match = userAgent.match(/Chrome\/(\d+)/);
3528 if (match) version = +match[1];
3529 }
3530}
3531
3532module.exports = version;
3533
3534
3535/***/ }),
3536/* 78 */
3537/***/ (function(module, exports) {
3538
3539var $String = String;
3540
3541module.exports = function (argument) {
3542 try {
3543 return $String(argument);
3544 } catch (error) {
3545 return 'Object';
3546 }
3547};
3548
3549
3550/***/ }),
3551/* 79 */
3552/***/ (function(module, exports, __webpack_require__) {
3553
3554var IS_PURE = __webpack_require__(33);
3555var store = __webpack_require__(124);
3556
3557(module.exports = function (key, value) {
3558 return store[key] || (store[key] = value !== undefined ? value : {});
3559})('versions', []).push({
3560 version: '3.23.3',
3561 mode: IS_PURE ? 'pure' : 'global',
3562 copyright: '© 2014-2022 Denis Pushkarev (zloirock.ru)',
3563 license: 'https://github.com/zloirock/core-js/blob/v3.23.3/LICENSE',
3564 source: 'https://github.com/zloirock/core-js'
3565});
3566
3567
3568/***/ }),
3569/* 80 */
3570/***/ (function(module, exports) {
3571
3572module.exports = {};
3573
3574
3575/***/ }),
3576/* 81 */
3577/***/ (function(module, exports, __webpack_require__) {
3578
3579var classof = __webpack_require__(51);
3580
3581var $String = String;
3582
3583module.exports = function (argument) {
3584 if (classof(argument) === 'Symbol') throw TypeError('Cannot convert a Symbol value to a string');
3585 return $String(argument);
3586};
3587
3588
3589/***/ }),
3590/* 82 */
3591/***/ (function(module, exports) {
3592
3593module.exports = function (exec) {
3594 try {
3595 return { error: false, value: exec() };
3596 } catch (error) {
3597 return { error: true, value: error };
3598 }
3599};
3600
3601
3602/***/ }),
3603/* 83 */
3604/***/ (function(module, exports, __webpack_require__) {
3605
3606var global = __webpack_require__(7);
3607var NativePromiseConstructor = __webpack_require__(65);
3608var isCallable = __webpack_require__(8);
3609var isForced = __webpack_require__(160);
3610var inspectSource = __webpack_require__(131);
3611var wellKnownSymbol = __webpack_require__(9);
3612var IS_BROWSER = __webpack_require__(309);
3613var IS_PURE = __webpack_require__(33);
3614var V8_VERSION = __webpack_require__(77);
3615
3616var NativePromisePrototype = NativePromiseConstructor && NativePromiseConstructor.prototype;
3617var SPECIES = wellKnownSymbol('species');
3618var SUBCLASSING = false;
3619var NATIVE_PROMISE_REJECTION_EVENT = isCallable(global.PromiseRejectionEvent);
3620
3621var FORCED_PROMISE_CONSTRUCTOR = isForced('Promise', function () {
3622 var PROMISE_CONSTRUCTOR_SOURCE = inspectSource(NativePromiseConstructor);
3623 var GLOBAL_CORE_JS_PROMISE = PROMISE_CONSTRUCTOR_SOURCE !== String(NativePromiseConstructor);
3624 // V8 6.6 (Node 10 and Chrome 66) have a bug with resolving custom thenables
3625 // https://bugs.chromium.org/p/chromium/issues/detail?id=830565
3626 // We can't detect it synchronously, so just check versions
3627 if (!GLOBAL_CORE_JS_PROMISE && V8_VERSION === 66) return true;
3628 // We need Promise#{ catch, finally } in the pure version for preventing prototype pollution
3629 if (IS_PURE && !(NativePromisePrototype['catch'] && NativePromisePrototype['finally'])) return true;
3630 // We can't use @@species feature detection in V8 since it causes
3631 // deoptimization and performance degradation
3632 // https://github.com/zloirock/core-js/issues/679
3633 if (V8_VERSION >= 51 && /native code/.test(PROMISE_CONSTRUCTOR_SOURCE)) return false;
3634 // Detect correctness of subclassing with @@species support
3635 var promise = new NativePromiseConstructor(function (resolve) { resolve(1); });
3636 var FakePromise = function (exec) {
3637 exec(function () { /* empty */ }, function () { /* empty */ });
3638 };
3639 var constructor = promise.constructor = {};
3640 constructor[SPECIES] = FakePromise;
3641 SUBCLASSING = promise.then(function () { /* empty */ }) instanceof FakePromise;
3642 if (!SUBCLASSING) return true;
3643 // Unhandled rejections tracking support, NodeJS Promise without it fails @@species test
3644 return !GLOBAL_CORE_JS_PROMISE && IS_BROWSER && !NATIVE_PROMISE_REJECTION_EVENT;
3645});
3646
3647module.exports = {
3648 CONSTRUCTOR: FORCED_PROMISE_CONSTRUCTOR,
3649 REJECTION_EVENT: NATIVE_PROMISE_REJECTION_EVENT,
3650 SUBCLASSING: SUBCLASSING
3651};
3652
3653
3654/***/ }),
3655/* 84 */
3656/***/ (function(module, __webpack_exports__, __webpack_require__) {
3657
3658"use strict";
3659/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return hasStringTagBug; });
3660/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return isIE11; });
3661/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(6);
3662/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__hasObjectTag_js__ = __webpack_require__(326);
3663
3664
3665
3666// In IE 10 - Edge 13, `DataView` has string tag `'[object Object]'`.
3667// In IE 11, the most common among them, this problem also applies to
3668// `Map`, `WeakMap` and `Set`.
3669var hasStringTagBug = (
3670 __WEBPACK_IMPORTED_MODULE_0__setup_js__["s" /* supportsDataView */] && Object(__WEBPACK_IMPORTED_MODULE_1__hasObjectTag_js__["a" /* default */])(new DataView(new ArrayBuffer(8)))
3671 ),
3672 isIE11 = (typeof Map !== 'undefined' && Object(__WEBPACK_IMPORTED_MODULE_1__hasObjectTag_js__["a" /* default */])(new Map));
3673
3674
3675/***/ }),
3676/* 85 */
3677/***/ (function(module, __webpack_exports__, __webpack_require__) {
3678
3679"use strict";
3680/* harmony export (immutable) */ __webpack_exports__["a"] = allKeys;
3681/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isObject_js__ = __webpack_require__(56);
3682/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__setup_js__ = __webpack_require__(6);
3683/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__collectNonEnumProps_js__ = __webpack_require__(191);
3684
3685
3686
3687
3688// Retrieve all the enumerable property names of an object.
3689function allKeys(obj) {
3690 if (!Object(__WEBPACK_IMPORTED_MODULE_0__isObject_js__["a" /* default */])(obj)) return [];
3691 var keys = [];
3692 for (var key in obj) keys.push(key);
3693 // Ahem, IE < 9.
3694 if (__WEBPACK_IMPORTED_MODULE_1__setup_js__["h" /* hasEnumBug */]) Object(__WEBPACK_IMPORTED_MODULE_2__collectNonEnumProps_js__["a" /* default */])(obj, keys);
3695 return keys;
3696}
3697
3698
3699/***/ }),
3700/* 86 */
3701/***/ (function(module, __webpack_exports__, __webpack_require__) {
3702
3703"use strict";
3704/* harmony export (immutable) */ __webpack_exports__["a"] = toPath;
3705/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__underscore_js__ = __webpack_require__(25);
3706/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__toPath_js__ = __webpack_require__(200);
3707
3708
3709
3710// Internal wrapper for `_.toPath` to enable minification.
3711// Similar to `cb` for `_.iteratee`.
3712function toPath(path) {
3713 return __WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */].toPath(path);
3714}
3715
3716
3717/***/ }),
3718/* 87 */
3719/***/ (function(module, __webpack_exports__, __webpack_require__) {
3720
3721"use strict";
3722/* harmony export (immutable) */ __webpack_exports__["a"] = optimizeCb;
3723// Internal function that returns an efficient (for current engines) version
3724// of the passed-in callback, to be repeatedly applied in other Underscore
3725// functions.
3726function optimizeCb(func, context, argCount) {
3727 if (context === void 0) return func;
3728 switch (argCount == null ? 3 : argCount) {
3729 case 1: return function(value) {
3730 return func.call(context, value);
3731 };
3732 // The 2-argument case is omitted because we’re not using it.
3733 case 3: return function(value, index, collection) {
3734 return func.call(context, value, index, collection);
3735 };
3736 case 4: return function(accumulator, value, index, collection) {
3737 return func.call(context, accumulator, value, index, collection);
3738 };
3739 }
3740 return function() {
3741 return func.apply(context, arguments);
3742 };
3743}
3744
3745
3746/***/ }),
3747/* 88 */
3748/***/ (function(module, __webpack_exports__, __webpack_require__) {
3749
3750"use strict";
3751/* harmony export (immutable) */ __webpack_exports__["a"] = filter;
3752/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(21);
3753/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__each_js__ = __webpack_require__(58);
3754
3755
3756
3757// Return all the elements that pass a truth test.
3758function filter(obj, predicate, context) {
3759 var results = [];
3760 predicate = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(predicate, context);
3761 Object(__WEBPACK_IMPORTED_MODULE_1__each_js__["a" /* default */])(obj, function(value, index, list) {
3762 if (predicate(value, index, list)) results.push(value);
3763 });
3764 return results;
3765}
3766
3767
3768/***/ }),
3769/* 89 */
3770/***/ (function(module, __webpack_exports__, __webpack_require__) {
3771
3772"use strict";
3773/* harmony export (immutable) */ __webpack_exports__["a"] = contains;
3774/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__ = __webpack_require__(26);
3775/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__values_js__ = __webpack_require__(66);
3776/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__indexOf_js__ = __webpack_require__(216);
3777
3778
3779
3780
3781// Determine if the array or object contains a given item (using `===`).
3782function contains(obj, item, fromIndex, guard) {
3783 if (!Object(__WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__["a" /* default */])(obj)) obj = Object(__WEBPACK_IMPORTED_MODULE_1__values_js__["a" /* default */])(obj);
3784 if (typeof fromIndex != 'number' || guard) fromIndex = 0;
3785 return Object(__WEBPACK_IMPORTED_MODULE_2__indexOf_js__["a" /* default */])(obj, item, fromIndex) >= 0;
3786}
3787
3788
3789/***/ }),
3790/* 90 */
3791/***/ (function(module, exports, __webpack_require__) {
3792
3793var classof = __webpack_require__(63);
3794
3795// `IsArray` abstract operation
3796// https://tc39.es/ecma262/#sec-isarray
3797// eslint-disable-next-line es-x/no-array-isarray -- safe
3798module.exports = Array.isArray || function isArray(argument) {
3799 return classof(argument) == 'Array';
3800};
3801
3802
3803/***/ }),
3804/* 91 */
3805/***/ (function(module, exports, __webpack_require__) {
3806
3807"use strict";
3808
3809var toPropertyKey = __webpack_require__(96);
3810var definePropertyModule = __webpack_require__(23);
3811var createPropertyDescriptor = __webpack_require__(47);
3812
3813module.exports = function (object, key, value) {
3814 var propertyKey = toPropertyKey(key);
3815 if (propertyKey in object) definePropertyModule.f(object, propertyKey, createPropertyDescriptor(0, value));
3816 else object[propertyKey] = value;
3817};
3818
3819
3820/***/ }),
3821/* 92 */
3822/***/ (function(module, exports, __webpack_require__) {
3823
3824module.exports = __webpack_require__(242);
3825
3826/***/ }),
3827/* 93 */
3828/***/ (function(module, exports, __webpack_require__) {
3829
3830module.exports = __webpack_require__(474);
3831
3832/***/ }),
3833/* 94 */
3834/***/ (function(module, exports, __webpack_require__) {
3835
3836var $ = __webpack_require__(0);
3837var uncurryThis = __webpack_require__(4);
3838var hiddenKeys = __webpack_require__(80);
3839var isObject = __webpack_require__(11);
3840var hasOwn = __webpack_require__(13);
3841var defineProperty = __webpack_require__(23).f;
3842var getOwnPropertyNamesModule = __webpack_require__(103);
3843var getOwnPropertyNamesExternalModule = __webpack_require__(246);
3844var isExtensible = __webpack_require__(262);
3845var uid = __webpack_require__(99);
3846var FREEZING = __webpack_require__(263);
3847
3848var REQUIRED = false;
3849var METADATA = uid('meta');
3850var id = 0;
3851
3852var setMetadata = function (it) {
3853 defineProperty(it, METADATA, { value: {
3854 objectID: 'O' + id++, // object ID
3855 weakData: {} // weak collections IDs
3856 } });
3857};
3858
3859var fastKey = function (it, create) {
3860 // return a primitive with prefix
3861 if (!isObject(it)) return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it;
3862 if (!hasOwn(it, METADATA)) {
3863 // can't set metadata to uncaught frozen object
3864 if (!isExtensible(it)) return 'F';
3865 // not necessary to add metadata
3866 if (!create) return 'E';
3867 // add missing metadata
3868 setMetadata(it);
3869 // return object ID
3870 } return it[METADATA].objectID;
3871};
3872
3873var getWeakData = function (it, create) {
3874 if (!hasOwn(it, METADATA)) {
3875 // can't set metadata to uncaught frozen object
3876 if (!isExtensible(it)) return true;
3877 // not necessary to add metadata
3878 if (!create) return false;
3879 // add missing metadata
3880 setMetadata(it);
3881 // return the store of weak collections IDs
3882 } return it[METADATA].weakData;
3883};
3884
3885// add metadata on freeze-family methods calling
3886var onFreeze = function (it) {
3887 if (FREEZING && REQUIRED && isExtensible(it) && !hasOwn(it, METADATA)) setMetadata(it);
3888 return it;
3889};
3890
3891var enable = function () {
3892 meta.enable = function () { /* empty */ };
3893 REQUIRED = true;
3894 var getOwnPropertyNames = getOwnPropertyNamesModule.f;
3895 var splice = uncurryThis([].splice);
3896 var test = {};
3897 test[METADATA] = 1;
3898
3899 // prevent exposing of metadata key
3900 if (getOwnPropertyNames(test).length) {
3901 getOwnPropertyNamesModule.f = function (it) {
3902 var result = getOwnPropertyNames(it);
3903 for (var i = 0, length = result.length; i < length; i++) {
3904 if (result[i] === METADATA) {
3905 splice(result, i, 1);
3906 break;
3907 }
3908 } return result;
3909 };
3910
3911 $({ target: 'Object', stat: true, forced: true }, {
3912 getOwnPropertyNames: getOwnPropertyNamesExternalModule.f
3913 });
3914 }
3915};
3916
3917var meta = module.exports = {
3918 enable: enable,
3919 fastKey: fastKey,
3920 getWeakData: getWeakData,
3921 onFreeze: onFreeze
3922};
3923
3924hiddenKeys[METADATA] = true;
3925
3926
3927/***/ }),
3928/* 95 */
3929/***/ (function(module, exports, __webpack_require__) {
3930
3931var uncurryThis = __webpack_require__(4);
3932var fails = __webpack_require__(2);
3933var classof = __webpack_require__(63);
3934
3935var $Object = Object;
3936var split = uncurryThis(''.split);
3937
3938// fallback for non-array-like ES3 and non-enumerable old V8 strings
3939module.exports = fails(function () {
3940 // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
3941 // eslint-disable-next-line no-prototype-builtins -- safe
3942 return !$Object('z').propertyIsEnumerable(0);
3943}) ? function (it) {
3944 return classof(it) == 'String' ? split(it, '') : $Object(it);
3945} : $Object;
3946
3947
3948/***/ }),
3949/* 96 */
3950/***/ (function(module, exports, __webpack_require__) {
3951
3952var toPrimitive = __webpack_require__(287);
3953var isSymbol = __webpack_require__(97);
3954
3955// `ToPropertyKey` abstract operation
3956// https://tc39.es/ecma262/#sec-topropertykey
3957module.exports = function (argument) {
3958 var key = toPrimitive(argument, 'string');
3959 return isSymbol(key) ? key : key + '';
3960};
3961
3962
3963/***/ }),
3964/* 97 */
3965/***/ (function(module, exports, __webpack_require__) {
3966
3967var getBuiltIn = __webpack_require__(18);
3968var isCallable = __webpack_require__(8);
3969var isPrototypeOf = __webpack_require__(19);
3970var USE_SYMBOL_AS_UID = __webpack_require__(158);
3971
3972var $Object = Object;
3973
3974module.exports = USE_SYMBOL_AS_UID ? function (it) {
3975 return typeof it == 'symbol';
3976} : function (it) {
3977 var $Symbol = getBuiltIn('Symbol');
3978 return isCallable($Symbol) && isPrototypeOf($Symbol.prototype, $Object(it));
3979};
3980
3981
3982/***/ }),
3983/* 98 */
3984/***/ (function(module, exports, __webpack_require__) {
3985
3986var getBuiltIn = __webpack_require__(18);
3987
3988module.exports = getBuiltIn('navigator', 'userAgent') || '';
3989
3990
3991/***/ }),
3992/* 99 */
3993/***/ (function(module, exports, __webpack_require__) {
3994
3995var uncurryThis = __webpack_require__(4);
3996
3997var id = 0;
3998var postfix = Math.random();
3999var toString = uncurryThis(1.0.toString);
4000
4001module.exports = function (key) {
4002 return 'Symbol(' + (key === undefined ? '' : key) + ')_' + toString(++id + postfix, 36);
4003};
4004
4005
4006/***/ }),
4007/* 100 */
4008/***/ (function(module, exports, __webpack_require__) {
4009
4010var hasOwn = __webpack_require__(13);
4011var isCallable = __webpack_require__(8);
4012var toObject = __webpack_require__(34);
4013var sharedKey = __webpack_require__(101);
4014var CORRECT_PROTOTYPE_GETTER = __webpack_require__(162);
4015
4016var IE_PROTO = sharedKey('IE_PROTO');
4017var $Object = Object;
4018var ObjectPrototype = $Object.prototype;
4019
4020// `Object.getPrototypeOf` method
4021// https://tc39.es/ecma262/#sec-object.getprototypeof
4022// eslint-disable-next-line es-x/no-object-getprototypeof -- safe
4023module.exports = CORRECT_PROTOTYPE_GETTER ? $Object.getPrototypeOf : function (O) {
4024 var object = toObject(O);
4025 if (hasOwn(object, IE_PROTO)) return object[IE_PROTO];
4026 var constructor = object.constructor;
4027 if (isCallable(constructor) && object instanceof constructor) {
4028 return constructor.prototype;
4029 } return object instanceof $Object ? ObjectPrototype : null;
4030};
4031
4032
4033/***/ }),
4034/* 101 */
4035/***/ (function(module, exports, __webpack_require__) {
4036
4037var shared = __webpack_require__(79);
4038var uid = __webpack_require__(99);
4039
4040var keys = shared('keys');
4041
4042module.exports = function (key) {
4043 return keys[key] || (keys[key] = uid(key));
4044};
4045
4046
4047/***/ }),
4048/* 102 */
4049/***/ (function(module, exports, __webpack_require__) {
4050
4051/* eslint-disable no-proto -- safe */
4052var uncurryThis = __webpack_require__(4);
4053var anObject = __webpack_require__(20);
4054var aPossiblePrototype = __webpack_require__(290);
4055
4056// `Object.setPrototypeOf` method
4057// https://tc39.es/ecma262/#sec-object.setprototypeof
4058// Works with __proto__ only. Old v8 can't work with null proto objects.
4059// eslint-disable-next-line es-x/no-object-setprototypeof -- safe
4060module.exports = Object.setPrototypeOf || ('__proto__' in {} ? function () {
4061 var CORRECT_SETTER = false;
4062 var test = {};
4063 var setter;
4064 try {
4065 // eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
4066 setter = uncurryThis(Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set);
4067 setter(test, []);
4068 CORRECT_SETTER = test instanceof Array;
4069 } catch (error) { /* empty */ }
4070 return function setPrototypeOf(O, proto) {
4071 anObject(O);
4072 aPossiblePrototype(proto);
4073 if (CORRECT_SETTER) setter(O, proto);
4074 else O.__proto__ = proto;
4075 return O;
4076 };
4077}() : undefined);
4078
4079
4080/***/ }),
4081/* 103 */
4082/***/ (function(module, exports, __webpack_require__) {
4083
4084var internalObjectKeys = __webpack_require__(164);
4085var enumBugKeys = __webpack_require__(128);
4086
4087var hiddenKeys = enumBugKeys.concat('length', 'prototype');
4088
4089// `Object.getOwnPropertyNames` method
4090// https://tc39.es/ecma262/#sec-object.getownpropertynames
4091// eslint-disable-next-line es-x/no-object-getownpropertynames -- safe
4092exports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
4093 return internalObjectKeys(O, hiddenKeys);
4094};
4095
4096
4097/***/ }),
4098/* 104 */
4099/***/ (function(module, exports) {
4100
4101// eslint-disable-next-line es-x/no-object-getownpropertysymbols -- safe
4102exports.f = Object.getOwnPropertySymbols;
4103
4104
4105/***/ }),
4106/* 105 */
4107/***/ (function(module, exports, __webpack_require__) {
4108
4109var internalObjectKeys = __webpack_require__(164);
4110var enumBugKeys = __webpack_require__(128);
4111
4112// `Object.keys` method
4113// https://tc39.es/ecma262/#sec-object.keys
4114// eslint-disable-next-line es-x/no-object-keys -- safe
4115module.exports = Object.keys || function keys(O) {
4116 return internalObjectKeys(O, enumBugKeys);
4117};
4118
4119
4120/***/ }),
4121/* 106 */
4122/***/ (function(module, exports, __webpack_require__) {
4123
4124var classof = __webpack_require__(51);
4125var getMethod = __webpack_require__(123);
4126var Iterators = __webpack_require__(50);
4127var wellKnownSymbol = __webpack_require__(9);
4128
4129var ITERATOR = wellKnownSymbol('iterator');
4130
4131module.exports = function (it) {
4132 if (it != undefined) return getMethod(it, ITERATOR)
4133 || getMethod(it, '@@iterator')
4134 || Iterators[classof(it)];
4135};
4136
4137
4138/***/ }),
4139/* 107 */
4140/***/ (function(module, exports, __webpack_require__) {
4141
4142var classof = __webpack_require__(63);
4143var global = __webpack_require__(7);
4144
4145module.exports = classof(global.process) == 'process';
4146
4147
4148/***/ }),
4149/* 108 */
4150/***/ (function(module, exports, __webpack_require__) {
4151
4152var isPrototypeOf = __webpack_require__(19);
4153
4154var $TypeError = TypeError;
4155
4156module.exports = function (it, Prototype) {
4157 if (isPrototypeOf(Prototype, it)) return it;
4158 throw $TypeError('Incorrect invocation');
4159};
4160
4161
4162/***/ }),
4163/* 109 */
4164/***/ (function(module, exports, __webpack_require__) {
4165
4166var uncurryThis = __webpack_require__(4);
4167var fails = __webpack_require__(2);
4168var isCallable = __webpack_require__(8);
4169var classof = __webpack_require__(51);
4170var getBuiltIn = __webpack_require__(18);
4171var inspectSource = __webpack_require__(131);
4172
4173var noop = function () { /* empty */ };
4174var empty = [];
4175var construct = getBuiltIn('Reflect', 'construct');
4176var constructorRegExp = /^\s*(?:class|function)\b/;
4177var exec = uncurryThis(constructorRegExp.exec);
4178var INCORRECT_TO_STRING = !constructorRegExp.exec(noop);
4179
4180var isConstructorModern = function isConstructor(argument) {
4181 if (!isCallable(argument)) return false;
4182 try {
4183 construct(noop, empty, argument);
4184 return true;
4185 } catch (error) {
4186 return false;
4187 }
4188};
4189
4190var isConstructorLegacy = function isConstructor(argument) {
4191 if (!isCallable(argument)) return false;
4192 switch (classof(argument)) {
4193 case 'AsyncFunction':
4194 case 'GeneratorFunction':
4195 case 'AsyncGeneratorFunction': return false;
4196 }
4197 try {
4198 // we can't check .prototype since constructors produced by .bind haven't it
4199 // `Function#toString` throws on some built-it function in some legacy engines
4200 // (for example, `DOMQuad` and similar in FF41-)
4201 return INCORRECT_TO_STRING || !!exec(constructorRegExp, inspectSource(argument));
4202 } catch (error) {
4203 return true;
4204 }
4205};
4206
4207isConstructorLegacy.sham = true;
4208
4209// `IsConstructor` abstract operation
4210// https://tc39.es/ecma262/#sec-isconstructor
4211module.exports = !construct || fails(function () {
4212 var called;
4213 return isConstructorModern(isConstructorModern.call)
4214 || !isConstructorModern(Object)
4215 || !isConstructorModern(function () { called = true; })
4216 || called;
4217}) ? isConstructorLegacy : isConstructorModern;
4218
4219
4220/***/ }),
4221/* 110 */
4222/***/ (function(module, exports, __webpack_require__) {
4223
4224var uncurryThis = __webpack_require__(4);
4225
4226module.exports = uncurryThis([].slice);
4227
4228
4229/***/ }),
4230/* 111 */
4231/***/ (function(module, __webpack_exports__, __webpack_require__) {
4232
4233"use strict";
4234/* harmony export (immutable) */ __webpack_exports__["a"] = matcher;
4235/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__extendOwn_js__ = __webpack_require__(140);
4236/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isMatch_js__ = __webpack_require__(192);
4237
4238
4239
4240// Returns a predicate for checking whether an object has a given set of
4241// `key:value` pairs.
4242function matcher(attrs) {
4243 attrs = Object(__WEBPACK_IMPORTED_MODULE_0__extendOwn_js__["a" /* default */])({}, attrs);
4244 return function(obj) {
4245 return Object(__WEBPACK_IMPORTED_MODULE_1__isMatch_js__["a" /* default */])(obj, attrs);
4246 };
4247}
4248
4249
4250/***/ }),
4251/* 112 */
4252/***/ (function(module, __webpack_exports__, __webpack_require__) {
4253
4254"use strict";
4255/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(24);
4256/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__executeBound_js__ = __webpack_require__(208);
4257/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__underscore_js__ = __webpack_require__(25);
4258
4259
4260
4261
4262// Partially apply a function by creating a version that has had some of its
4263// arguments pre-filled, without changing its dynamic `this` context. `_` acts
4264// as a placeholder by default, allowing any combination of arguments to be
4265// pre-filled. Set `_.partial.placeholder` for a custom placeholder argument.
4266var partial = Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(func, boundArgs) {
4267 var placeholder = partial.placeholder;
4268 var bound = function() {
4269 var position = 0, length = boundArgs.length;
4270 var args = Array(length);
4271 for (var i = 0; i < length; i++) {
4272 args[i] = boundArgs[i] === placeholder ? arguments[position++] : boundArgs[i];
4273 }
4274 while (position < arguments.length) args.push(arguments[position++]);
4275 return Object(__WEBPACK_IMPORTED_MODULE_1__executeBound_js__["a" /* default */])(func, bound, this, this, args);
4276 };
4277 return bound;
4278});
4279
4280partial.placeholder = __WEBPACK_IMPORTED_MODULE_2__underscore_js__["a" /* default */];
4281/* harmony default export */ __webpack_exports__["a"] = (partial);
4282
4283
4284/***/ }),
4285/* 113 */
4286/***/ (function(module, __webpack_exports__, __webpack_require__) {
4287
4288"use strict";
4289/* harmony export (immutable) */ __webpack_exports__["a"] = group;
4290/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(21);
4291/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__each_js__ = __webpack_require__(58);
4292
4293
4294
4295// An internal function used for aggregate "group by" operations.
4296function group(behavior, partition) {
4297 return function(obj, iteratee, context) {
4298 var result = partition ? [[], []] : {};
4299 iteratee = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(iteratee, context);
4300 Object(__WEBPACK_IMPORTED_MODULE_1__each_js__["a" /* default */])(obj, function(value, index) {
4301 var key = iteratee(value, index, obj);
4302 behavior(result, value, key);
4303 });
4304 return result;
4305 };
4306}
4307
4308
4309/***/ }),
4310/* 114 */
4311/***/ (function(module, exports, __webpack_require__) {
4312
4313var fails = __webpack_require__(2);
4314var wellKnownSymbol = __webpack_require__(9);
4315var V8_VERSION = __webpack_require__(77);
4316
4317var SPECIES = wellKnownSymbol('species');
4318
4319module.exports = function (METHOD_NAME) {
4320 // We can't use this feature detection in V8 since it causes
4321 // deoptimization and serious performance degradation
4322 // https://github.com/zloirock/core-js/issues/677
4323 return V8_VERSION >= 51 || !fails(function () {
4324 var array = [];
4325 var constructor = array.constructor = {};
4326 constructor[SPECIES] = function () {
4327 return { foo: 1 };
4328 };
4329 return array[METHOD_NAME](Boolean).foo !== 1;
4330 });
4331};
4332
4333
4334/***/ }),
4335/* 115 */
4336/***/ (function(module, exports, __webpack_require__) {
4337
4338module.exports = __webpack_require__(401);
4339
4340/***/ }),
4341/* 116 */
4342/***/ (function(module, exports, __webpack_require__) {
4343
4344"use strict";
4345
4346
4347var _interopRequireDefault = __webpack_require__(1);
4348
4349var _typeof2 = _interopRequireDefault(__webpack_require__(73));
4350
4351var _filter = _interopRequireDefault(__webpack_require__(251));
4352
4353var _map = _interopRequireDefault(__webpack_require__(35));
4354
4355var _keys = _interopRequireDefault(__webpack_require__(115));
4356
4357var _stringify = _interopRequireDefault(__webpack_require__(36));
4358
4359var _concat = _interopRequireDefault(__webpack_require__(22));
4360
4361var _ = __webpack_require__(3);
4362
4363var _require = __webpack_require__(252),
4364 timeout = _require.timeout;
4365
4366var debug = __webpack_require__(60);
4367
4368var debugRequest = debug('leancloud:request');
4369var debugRequestError = debug('leancloud:request:error');
4370
4371var _require2 = __webpack_require__(72),
4372 getAdapter = _require2.getAdapter;
4373
4374var requestsCount = 0;
4375
4376var ajax = function ajax(_ref) {
4377 var method = _ref.method,
4378 url = _ref.url,
4379 query = _ref.query,
4380 data = _ref.data,
4381 _ref$headers = _ref.headers,
4382 headers = _ref$headers === void 0 ? {} : _ref$headers,
4383 time = _ref.timeout,
4384 onprogress = _ref.onprogress;
4385
4386 if (query) {
4387 var _context, _context2, _context4;
4388
4389 var queryString = (0, _filter.default)(_context = (0, _map.default)(_context2 = (0, _keys.default)(query)).call(_context2, function (key) {
4390 var _context3;
4391
4392 var value = query[key];
4393 if (value === undefined) return undefined;
4394 var v = (0, _typeof2.default)(value) === 'object' ? (0, _stringify.default)(value) : value;
4395 return (0, _concat.default)(_context3 = "".concat(encodeURIComponent(key), "=")).call(_context3, encodeURIComponent(v));
4396 })).call(_context, function (qs) {
4397 return qs;
4398 }).join('&');
4399 url = (0, _concat.default)(_context4 = "".concat(url, "?")).call(_context4, queryString);
4400 }
4401
4402 var count = requestsCount++;
4403 debugRequest('request(%d) %s %s %o %o %o', count, method, url, query, data, headers);
4404 var request = getAdapter('request');
4405 var promise = request(url, {
4406 method: method,
4407 headers: headers,
4408 data: data,
4409 onprogress: onprogress
4410 }).then(function (response) {
4411 debugRequest('response(%d) %d %O %o', count, response.status, response.data || response.text, response.header);
4412
4413 if (response.ok === false) {
4414 var error = new Error();
4415 error.response = response;
4416 throw error;
4417 }
4418
4419 return response.data;
4420 }).catch(function (error) {
4421 if (error.response) {
4422 if (!debug.enabled('leancloud:request')) {
4423 debugRequestError('request(%d) %s %s %o %o %o', count, method, url, query, data, headers);
4424 }
4425
4426 debugRequestError('response(%d) %d %O %o', count, error.response.status, error.response.data || error.response.text, error.response.header);
4427 error.statusCode = error.response.status;
4428 error.responseText = error.response.text;
4429 error.response = error.response.data;
4430 }
4431
4432 throw error;
4433 });
4434 return time ? timeout(promise, time) : promise;
4435};
4436
4437module.exports = ajax;
4438
4439/***/ }),
4440/* 117 */
4441/***/ (function(module, exports) {
4442
4443/* (ignored) */
4444
4445/***/ }),
4446/* 118 */
4447/***/ (function(module, exports) {
4448
4449function _typeof(o) {
4450 "@babel/helpers - typeof";
4451
4452 return (module.exports = _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
4453 return typeof o;
4454 } : function (o) {
4455 return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
4456 }, module.exports.__esModule = true, module.exports["default"] = module.exports), _typeof(o);
4457}
4458module.exports = _typeof, module.exports.__esModule = true, module.exports["default"] = module.exports;
4459
4460/***/ }),
4461/* 119 */
4462/***/ (function(module, exports, __webpack_require__) {
4463
4464var Symbol = __webpack_require__(272),
4465 getRawTag = __webpack_require__(644),
4466 objectToString = __webpack_require__(645);
4467
4468/** `Object#toString` result references. */
4469var nullTag = '[object Null]',
4470 undefinedTag = '[object Undefined]';
4471
4472/** Built-in value references. */
4473var symToStringTag = Symbol ? Symbol.toStringTag : undefined;
4474
4475/**
4476 * The base implementation of `getTag` without fallbacks for buggy environments.
4477 *
4478 * @private
4479 * @param {*} value The value to query.
4480 * @returns {string} Returns the `toStringTag`.
4481 */
4482function baseGetTag(value) {
4483 if (value == null) {
4484 return value === undefined ? undefinedTag : nullTag;
4485 }
4486 return (symToStringTag && symToStringTag in Object(value))
4487 ? getRawTag(value)
4488 : objectToString(value);
4489}
4490
4491module.exports = baseGetTag;
4492
4493
4494/***/ }),
4495/* 120 */
4496/***/ (function(module, exports) {
4497
4498/**
4499 * Checks if `value` is object-like. A value is object-like if it's not `null`
4500 * and has a `typeof` result of "object".
4501 *
4502 * @static
4503 * @memberOf _
4504 * @since 4.0.0
4505 * @category Lang
4506 * @param {*} value The value to check.
4507 * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
4508 * @example
4509 *
4510 * _.isObjectLike({});
4511 * // => true
4512 *
4513 * _.isObjectLike([1, 2, 3]);
4514 * // => true
4515 *
4516 * _.isObjectLike(_.noop);
4517 * // => false
4518 *
4519 * _.isObjectLike(null);
4520 * // => false
4521 */
4522function isObjectLike(value) {
4523 return value != null && typeof value == 'object';
4524}
4525
4526module.exports = isObjectLike;
4527
4528
4529/***/ }),
4530/* 121 */
4531/***/ (function(module, exports, __webpack_require__) {
4532
4533"use strict";
4534
4535var $propertyIsEnumerable = {}.propertyIsEnumerable;
4536// eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
4537var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
4538
4539// Nashorn ~ JDK8 bug
4540var NASHORN_BUG = getOwnPropertyDescriptor && !$propertyIsEnumerable.call({ 1: 2 }, 1);
4541
4542// `Object.prototype.propertyIsEnumerable` method implementation
4543// https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable
4544exports.f = NASHORN_BUG ? function propertyIsEnumerable(V) {
4545 var descriptor = getOwnPropertyDescriptor(this, V);
4546 return !!descriptor && descriptor.enumerable;
4547} : $propertyIsEnumerable;
4548
4549
4550/***/ }),
4551/* 122 */
4552/***/ (function(module, exports) {
4553
4554var $TypeError = TypeError;
4555
4556// `RequireObjectCoercible` abstract operation
4557// https://tc39.es/ecma262/#sec-requireobjectcoercible
4558module.exports = function (it) {
4559 if (it == undefined) throw $TypeError("Can't call method on " + it);
4560 return it;
4561};
4562
4563
4564/***/ }),
4565/* 123 */
4566/***/ (function(module, exports, __webpack_require__) {
4567
4568var aCallable = __webpack_require__(31);
4569
4570// `GetMethod` abstract operation
4571// https://tc39.es/ecma262/#sec-getmethod
4572module.exports = function (V, P) {
4573 var func = V[P];
4574 return func == null ? undefined : aCallable(func);
4575};
4576
4577
4578/***/ }),
4579/* 124 */
4580/***/ (function(module, exports, __webpack_require__) {
4581
4582var global = __webpack_require__(7);
4583var defineGlobalProperty = __webpack_require__(289);
4584
4585var SHARED = '__core-js_shared__';
4586var store = global[SHARED] || defineGlobalProperty(SHARED, {});
4587
4588module.exports = store;
4589
4590
4591/***/ }),
4592/* 125 */
4593/***/ (function(module, exports, __webpack_require__) {
4594
4595var global = __webpack_require__(7);
4596var isObject = __webpack_require__(11);
4597
4598var document = global.document;
4599// typeof document.createElement is 'object' in old IE
4600var EXISTS = isObject(document) && isObject(document.createElement);
4601
4602module.exports = function (it) {
4603 return EXISTS ? document.createElement(it) : {};
4604};
4605
4606
4607/***/ }),
4608/* 126 */
4609/***/ (function(module, exports, __webpack_require__) {
4610
4611var toIntegerOrInfinity = __webpack_require__(127);
4612
4613var max = Math.max;
4614var min = Math.min;
4615
4616// Helper for a popular repeating case of the spec:
4617// Let integer be ? ToInteger(index).
4618// If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length).
4619module.exports = function (index, length) {
4620 var integer = toIntegerOrInfinity(index);
4621 return integer < 0 ? max(integer + length, 0) : min(integer, length);
4622};
4623
4624
4625/***/ }),
4626/* 127 */
4627/***/ (function(module, exports, __webpack_require__) {
4628
4629var trunc = __webpack_require__(292);
4630
4631// `ToIntegerOrInfinity` abstract operation
4632// https://tc39.es/ecma262/#sec-tointegerorinfinity
4633module.exports = function (argument) {
4634 var number = +argument;
4635 // eslint-disable-next-line no-self-compare -- NaN check
4636 return number !== number || number === 0 ? 0 : trunc(number);
4637};
4638
4639
4640/***/ }),
4641/* 128 */
4642/***/ (function(module, exports) {
4643
4644// IE8- don't enum bug keys
4645module.exports = [
4646 'constructor',
4647 'hasOwnProperty',
4648 'isPrototypeOf',
4649 'propertyIsEnumerable',
4650 'toLocaleString',
4651 'toString',
4652 'valueOf'
4653];
4654
4655
4656/***/ }),
4657/* 129 */
4658/***/ (function(module, exports, __webpack_require__) {
4659
4660var DESCRIPTORS = __webpack_require__(14);
4661var V8_PROTOTYPE_DEFINE_BUG = __webpack_require__(161);
4662var definePropertyModule = __webpack_require__(23);
4663var anObject = __webpack_require__(20);
4664var toIndexedObject = __webpack_require__(32);
4665var objectKeys = __webpack_require__(105);
4666
4667// `Object.defineProperties` method
4668// https://tc39.es/ecma262/#sec-object.defineproperties
4669// eslint-disable-next-line es-x/no-object-defineproperties -- safe
4670exports.f = DESCRIPTORS && !V8_PROTOTYPE_DEFINE_BUG ? Object.defineProperties : function defineProperties(O, Properties) {
4671 anObject(O);
4672 var props = toIndexedObject(Properties);
4673 var keys = objectKeys(Properties);
4674 var length = keys.length;
4675 var index = 0;
4676 var key;
4677 while (length > index) definePropertyModule.f(O, key = keys[index++], props[key]);
4678 return O;
4679};
4680
4681
4682/***/ }),
4683/* 130 */
4684/***/ (function(module, exports, __webpack_require__) {
4685
4686var wellKnownSymbol = __webpack_require__(9);
4687
4688var TO_STRING_TAG = wellKnownSymbol('toStringTag');
4689var test = {};
4690
4691test[TO_STRING_TAG] = 'z';
4692
4693module.exports = String(test) === '[object z]';
4694
4695
4696/***/ }),
4697/* 131 */
4698/***/ (function(module, exports, __webpack_require__) {
4699
4700var uncurryThis = __webpack_require__(4);
4701var isCallable = __webpack_require__(8);
4702var store = __webpack_require__(124);
4703
4704var functionToString = uncurryThis(Function.toString);
4705
4706// this helper broken in `core-js@3.4.1-3.4.4`, so we can't use `shared` helper
4707if (!isCallable(store.inspectSource)) {
4708 store.inspectSource = function (it) {
4709 return functionToString(it);
4710 };
4711}
4712
4713module.exports = store.inspectSource;
4714
4715
4716/***/ }),
4717/* 132 */
4718/***/ (function(module, exports, __webpack_require__) {
4719
4720"use strict";
4721
4722var $ = __webpack_require__(0);
4723var call = __webpack_require__(15);
4724var IS_PURE = __webpack_require__(33);
4725var FunctionName = __webpack_require__(298);
4726var isCallable = __webpack_require__(8);
4727var createIteratorConstructor = __webpack_require__(299);
4728var getPrototypeOf = __webpack_require__(100);
4729var setPrototypeOf = __webpack_require__(102);
4730var setToStringTag = __webpack_require__(52);
4731var createNonEnumerableProperty = __webpack_require__(37);
4732var defineBuiltIn = __webpack_require__(44);
4733var wellKnownSymbol = __webpack_require__(9);
4734var Iterators = __webpack_require__(50);
4735var IteratorsCore = __webpack_require__(172);
4736
4737var PROPER_FUNCTION_NAME = FunctionName.PROPER;
4738var CONFIGURABLE_FUNCTION_NAME = FunctionName.CONFIGURABLE;
4739var IteratorPrototype = IteratorsCore.IteratorPrototype;
4740var BUGGY_SAFARI_ITERATORS = IteratorsCore.BUGGY_SAFARI_ITERATORS;
4741var ITERATOR = wellKnownSymbol('iterator');
4742var KEYS = 'keys';
4743var VALUES = 'values';
4744var ENTRIES = 'entries';
4745
4746var returnThis = function () { return this; };
4747
4748module.exports = function (Iterable, NAME, IteratorConstructor, next, DEFAULT, IS_SET, FORCED) {
4749 createIteratorConstructor(IteratorConstructor, NAME, next);
4750
4751 var getIterationMethod = function (KIND) {
4752 if (KIND === DEFAULT && defaultIterator) return defaultIterator;
4753 if (!BUGGY_SAFARI_ITERATORS && KIND in IterablePrototype) return IterablePrototype[KIND];
4754 switch (KIND) {
4755 case KEYS: return function keys() { return new IteratorConstructor(this, KIND); };
4756 case VALUES: return function values() { return new IteratorConstructor(this, KIND); };
4757 case ENTRIES: return function entries() { return new IteratorConstructor(this, KIND); };
4758 } return function () { return new IteratorConstructor(this); };
4759 };
4760
4761 var TO_STRING_TAG = NAME + ' Iterator';
4762 var INCORRECT_VALUES_NAME = false;
4763 var IterablePrototype = Iterable.prototype;
4764 var nativeIterator = IterablePrototype[ITERATOR]
4765 || IterablePrototype['@@iterator']
4766 || DEFAULT && IterablePrototype[DEFAULT];
4767 var defaultIterator = !BUGGY_SAFARI_ITERATORS && nativeIterator || getIterationMethod(DEFAULT);
4768 var anyNativeIterator = NAME == 'Array' ? IterablePrototype.entries || nativeIterator : nativeIterator;
4769 var CurrentIteratorPrototype, methods, KEY;
4770
4771 // fix native
4772 if (anyNativeIterator) {
4773 CurrentIteratorPrototype = getPrototypeOf(anyNativeIterator.call(new Iterable()));
4774 if (CurrentIteratorPrototype !== Object.prototype && CurrentIteratorPrototype.next) {
4775 if (!IS_PURE && getPrototypeOf(CurrentIteratorPrototype) !== IteratorPrototype) {
4776 if (setPrototypeOf) {
4777 setPrototypeOf(CurrentIteratorPrototype, IteratorPrototype);
4778 } else if (!isCallable(CurrentIteratorPrototype[ITERATOR])) {
4779 defineBuiltIn(CurrentIteratorPrototype, ITERATOR, returnThis);
4780 }
4781 }
4782 // Set @@toStringTag to native iterators
4783 setToStringTag(CurrentIteratorPrototype, TO_STRING_TAG, true, true);
4784 if (IS_PURE) Iterators[TO_STRING_TAG] = returnThis;
4785 }
4786 }
4787
4788 // fix Array.prototype.{ values, @@iterator }.name in V8 / FF
4789 if (PROPER_FUNCTION_NAME && DEFAULT == VALUES && nativeIterator && nativeIterator.name !== VALUES) {
4790 if (!IS_PURE && CONFIGURABLE_FUNCTION_NAME) {
4791 createNonEnumerableProperty(IterablePrototype, 'name', VALUES);
4792 } else {
4793 INCORRECT_VALUES_NAME = true;
4794 defaultIterator = function values() { return call(nativeIterator, this); };
4795 }
4796 }
4797
4798 // export additional methods
4799 if (DEFAULT) {
4800 methods = {
4801 values: getIterationMethod(VALUES),
4802 keys: IS_SET ? defaultIterator : getIterationMethod(KEYS),
4803 entries: getIterationMethod(ENTRIES)
4804 };
4805 if (FORCED) for (KEY in methods) {
4806 if (BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME || !(KEY in IterablePrototype)) {
4807 defineBuiltIn(IterablePrototype, KEY, methods[KEY]);
4808 }
4809 } else $({ target: NAME, proto: true, forced: BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME }, methods);
4810 }
4811
4812 // define iterator
4813 if ((!IS_PURE || FORCED) && IterablePrototype[ITERATOR] !== defaultIterator) {
4814 defineBuiltIn(IterablePrototype, ITERATOR, defaultIterator, { name: DEFAULT });
4815 }
4816 Iterators[NAME] = defaultIterator;
4817
4818 return methods;
4819};
4820
4821
4822/***/ }),
4823/* 133 */
4824/***/ (function(module, __webpack_exports__, __webpack_require__) {
4825
4826"use strict";
4827Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
4828/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(6);
4829/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "VERSION", function() { return __WEBPACK_IMPORTED_MODULE_0__setup_js__["e"]; });
4830/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__restArguments_js__ = __webpack_require__(24);
4831/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "restArguments", function() { return __WEBPACK_IMPORTED_MODULE_1__restArguments_js__["a"]; });
4832/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__isObject_js__ = __webpack_require__(56);
4833/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isObject", function() { return __WEBPACK_IMPORTED_MODULE_2__isObject_js__["a"]; });
4834/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__isNull_js__ = __webpack_require__(321);
4835/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isNull", function() { return __WEBPACK_IMPORTED_MODULE_3__isNull_js__["a"]; });
4836/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__isUndefined_js__ = __webpack_require__(181);
4837/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isUndefined", function() { return __WEBPACK_IMPORTED_MODULE_4__isUndefined_js__["a"]; });
4838/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__isBoolean_js__ = __webpack_require__(182);
4839/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isBoolean", function() { return __WEBPACK_IMPORTED_MODULE_5__isBoolean_js__["a"]; });
4840/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__isElement_js__ = __webpack_require__(322);
4841/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isElement", function() { return __WEBPACK_IMPORTED_MODULE_6__isElement_js__["a"]; });
4842/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__isString_js__ = __webpack_require__(134);
4843/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isString", function() { return __WEBPACK_IMPORTED_MODULE_7__isString_js__["a"]; });
4844/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__isNumber_js__ = __webpack_require__(183);
4845/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isNumber", function() { return __WEBPACK_IMPORTED_MODULE_8__isNumber_js__["a"]; });
4846/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__isDate_js__ = __webpack_require__(323);
4847/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isDate", function() { return __WEBPACK_IMPORTED_MODULE_9__isDate_js__["a"]; });
4848/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__isRegExp_js__ = __webpack_require__(324);
4849/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isRegExp", function() { return __WEBPACK_IMPORTED_MODULE_10__isRegExp_js__["a"]; });
4850/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__isError_js__ = __webpack_require__(325);
4851/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isError", function() { return __WEBPACK_IMPORTED_MODULE_11__isError_js__["a"]; });
4852/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__isSymbol_js__ = __webpack_require__(184);
4853/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isSymbol", function() { return __WEBPACK_IMPORTED_MODULE_12__isSymbol_js__["a"]; });
4854/* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__isArrayBuffer_js__ = __webpack_require__(185);
4855/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isArrayBuffer", function() { return __WEBPACK_IMPORTED_MODULE_13__isArrayBuffer_js__["a"]; });
4856/* harmony import */ var __WEBPACK_IMPORTED_MODULE_14__isDataView_js__ = __webpack_require__(135);
4857/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isDataView", function() { return __WEBPACK_IMPORTED_MODULE_14__isDataView_js__["a"]; });
4858/* harmony import */ var __WEBPACK_IMPORTED_MODULE_15__isArray_js__ = __webpack_require__(57);
4859/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isArray", function() { return __WEBPACK_IMPORTED_MODULE_15__isArray_js__["a"]; });
4860/* harmony import */ var __WEBPACK_IMPORTED_MODULE_16__isFunction_js__ = __webpack_require__(28);
4861/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isFunction", function() { return __WEBPACK_IMPORTED_MODULE_16__isFunction_js__["a"]; });
4862/* harmony import */ var __WEBPACK_IMPORTED_MODULE_17__isArguments_js__ = __webpack_require__(136);
4863/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isArguments", function() { return __WEBPACK_IMPORTED_MODULE_17__isArguments_js__["a"]; });
4864/* harmony import */ var __WEBPACK_IMPORTED_MODULE_18__isFinite_js__ = __webpack_require__(327);
4865/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isFinite", function() { return __WEBPACK_IMPORTED_MODULE_18__isFinite_js__["a"]; });
4866/* harmony import */ var __WEBPACK_IMPORTED_MODULE_19__isNaN_js__ = __webpack_require__(186);
4867/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isNaN", function() { return __WEBPACK_IMPORTED_MODULE_19__isNaN_js__["a"]; });
4868/* harmony import */ var __WEBPACK_IMPORTED_MODULE_20__isTypedArray_js__ = __webpack_require__(187);
4869/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isTypedArray", function() { return __WEBPACK_IMPORTED_MODULE_20__isTypedArray_js__["a"]; });
4870/* harmony import */ var __WEBPACK_IMPORTED_MODULE_21__isEmpty_js__ = __webpack_require__(329);
4871/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isEmpty", function() { return __WEBPACK_IMPORTED_MODULE_21__isEmpty_js__["a"]; });
4872/* harmony import */ var __WEBPACK_IMPORTED_MODULE_22__isMatch_js__ = __webpack_require__(192);
4873/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isMatch", function() { return __WEBPACK_IMPORTED_MODULE_22__isMatch_js__["a"]; });
4874/* harmony import */ var __WEBPACK_IMPORTED_MODULE_23__isEqual_js__ = __webpack_require__(330);
4875/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isEqual", function() { return __WEBPACK_IMPORTED_MODULE_23__isEqual_js__["a"]; });
4876/* harmony import */ var __WEBPACK_IMPORTED_MODULE_24__isMap_js__ = __webpack_require__(332);
4877/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isMap", function() { return __WEBPACK_IMPORTED_MODULE_24__isMap_js__["a"]; });
4878/* harmony import */ var __WEBPACK_IMPORTED_MODULE_25__isWeakMap_js__ = __webpack_require__(333);
4879/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isWeakMap", function() { return __WEBPACK_IMPORTED_MODULE_25__isWeakMap_js__["a"]; });
4880/* harmony import */ var __WEBPACK_IMPORTED_MODULE_26__isSet_js__ = __webpack_require__(334);
4881/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isSet", function() { return __WEBPACK_IMPORTED_MODULE_26__isSet_js__["a"]; });
4882/* harmony import */ var __WEBPACK_IMPORTED_MODULE_27__isWeakSet_js__ = __webpack_require__(335);
4883/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isWeakSet", function() { return __WEBPACK_IMPORTED_MODULE_27__isWeakSet_js__["a"]; });
4884/* harmony import */ var __WEBPACK_IMPORTED_MODULE_28__keys_js__ = __webpack_require__(16);
4885/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "keys", function() { return __WEBPACK_IMPORTED_MODULE_28__keys_js__["a"]; });
4886/* harmony import */ var __WEBPACK_IMPORTED_MODULE_29__allKeys_js__ = __webpack_require__(85);
4887/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "allKeys", function() { return __WEBPACK_IMPORTED_MODULE_29__allKeys_js__["a"]; });
4888/* harmony import */ var __WEBPACK_IMPORTED_MODULE_30__values_js__ = __webpack_require__(66);
4889/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "values", function() { return __WEBPACK_IMPORTED_MODULE_30__values_js__["a"]; });
4890/* harmony import */ var __WEBPACK_IMPORTED_MODULE_31__pairs_js__ = __webpack_require__(336);
4891/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "pairs", function() { return __WEBPACK_IMPORTED_MODULE_31__pairs_js__["a"]; });
4892/* harmony import */ var __WEBPACK_IMPORTED_MODULE_32__invert_js__ = __webpack_require__(193);
4893/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "invert", function() { return __WEBPACK_IMPORTED_MODULE_32__invert_js__["a"]; });
4894/* harmony import */ var __WEBPACK_IMPORTED_MODULE_33__functions_js__ = __webpack_require__(194);
4895/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "functions", function() { return __WEBPACK_IMPORTED_MODULE_33__functions_js__["a"]; });
4896/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "methods", function() { return __WEBPACK_IMPORTED_MODULE_33__functions_js__["a"]; });
4897/* harmony import */ var __WEBPACK_IMPORTED_MODULE_34__extend_js__ = __webpack_require__(195);
4898/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "extend", function() { return __WEBPACK_IMPORTED_MODULE_34__extend_js__["a"]; });
4899/* harmony import */ var __WEBPACK_IMPORTED_MODULE_35__extendOwn_js__ = __webpack_require__(140);
4900/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "extendOwn", function() { return __WEBPACK_IMPORTED_MODULE_35__extendOwn_js__["a"]; });
4901/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "assign", function() { return __WEBPACK_IMPORTED_MODULE_35__extendOwn_js__["a"]; });
4902/* harmony import */ var __WEBPACK_IMPORTED_MODULE_36__defaults_js__ = __webpack_require__(196);
4903/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "defaults", function() { return __WEBPACK_IMPORTED_MODULE_36__defaults_js__["a"]; });
4904/* harmony import */ var __WEBPACK_IMPORTED_MODULE_37__create_js__ = __webpack_require__(337);
4905/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "create", function() { return __WEBPACK_IMPORTED_MODULE_37__create_js__["a"]; });
4906/* harmony import */ var __WEBPACK_IMPORTED_MODULE_38__clone_js__ = __webpack_require__(198);
4907/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "clone", function() { return __WEBPACK_IMPORTED_MODULE_38__clone_js__["a"]; });
4908/* harmony import */ var __WEBPACK_IMPORTED_MODULE_39__tap_js__ = __webpack_require__(338);
4909/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "tap", function() { return __WEBPACK_IMPORTED_MODULE_39__tap_js__["a"]; });
4910/* harmony import */ var __WEBPACK_IMPORTED_MODULE_40__get_js__ = __webpack_require__(199);
4911/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "get", function() { return __WEBPACK_IMPORTED_MODULE_40__get_js__["a"]; });
4912/* harmony import */ var __WEBPACK_IMPORTED_MODULE_41__has_js__ = __webpack_require__(339);
4913/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "has", function() { return __WEBPACK_IMPORTED_MODULE_41__has_js__["a"]; });
4914/* harmony import */ var __WEBPACK_IMPORTED_MODULE_42__mapObject_js__ = __webpack_require__(340);
4915/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "mapObject", function() { return __WEBPACK_IMPORTED_MODULE_42__mapObject_js__["a"]; });
4916/* harmony import */ var __WEBPACK_IMPORTED_MODULE_43__identity_js__ = __webpack_require__(142);
4917/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "identity", function() { return __WEBPACK_IMPORTED_MODULE_43__identity_js__["a"]; });
4918/* harmony import */ var __WEBPACK_IMPORTED_MODULE_44__constant_js__ = __webpack_require__(188);
4919/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "constant", function() { return __WEBPACK_IMPORTED_MODULE_44__constant_js__["a"]; });
4920/* harmony import */ var __WEBPACK_IMPORTED_MODULE_45__noop_js__ = __webpack_require__(203);
4921/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "noop", function() { return __WEBPACK_IMPORTED_MODULE_45__noop_js__["a"]; });
4922/* harmony import */ var __WEBPACK_IMPORTED_MODULE_46__toPath_js__ = __webpack_require__(200);
4923/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "toPath", function() { return __WEBPACK_IMPORTED_MODULE_46__toPath_js__["a"]; });
4924/* harmony import */ var __WEBPACK_IMPORTED_MODULE_47__property_js__ = __webpack_require__(143);
4925/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "property", function() { return __WEBPACK_IMPORTED_MODULE_47__property_js__["a"]; });
4926/* harmony import */ var __WEBPACK_IMPORTED_MODULE_48__propertyOf_js__ = __webpack_require__(341);
4927/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "propertyOf", function() { return __WEBPACK_IMPORTED_MODULE_48__propertyOf_js__["a"]; });
4928/* harmony import */ var __WEBPACK_IMPORTED_MODULE_49__matcher_js__ = __webpack_require__(111);
4929/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "matcher", function() { return __WEBPACK_IMPORTED_MODULE_49__matcher_js__["a"]; });
4930/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "matches", function() { return __WEBPACK_IMPORTED_MODULE_49__matcher_js__["a"]; });
4931/* harmony import */ var __WEBPACK_IMPORTED_MODULE_50__times_js__ = __webpack_require__(342);
4932/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "times", function() { return __WEBPACK_IMPORTED_MODULE_50__times_js__["a"]; });
4933/* harmony import */ var __WEBPACK_IMPORTED_MODULE_51__random_js__ = __webpack_require__(204);
4934/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "random", function() { return __WEBPACK_IMPORTED_MODULE_51__random_js__["a"]; });
4935/* harmony import */ var __WEBPACK_IMPORTED_MODULE_52__now_js__ = __webpack_require__(144);
4936/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "now", function() { return __WEBPACK_IMPORTED_MODULE_52__now_js__["a"]; });
4937/* harmony import */ var __WEBPACK_IMPORTED_MODULE_53__escape_js__ = __webpack_require__(343);
4938/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "escape", function() { return __WEBPACK_IMPORTED_MODULE_53__escape_js__["a"]; });
4939/* harmony import */ var __WEBPACK_IMPORTED_MODULE_54__unescape_js__ = __webpack_require__(344);
4940/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "unescape", function() { return __WEBPACK_IMPORTED_MODULE_54__unescape_js__["a"]; });
4941/* harmony import */ var __WEBPACK_IMPORTED_MODULE_55__templateSettings_js__ = __webpack_require__(207);
4942/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "templateSettings", function() { return __WEBPACK_IMPORTED_MODULE_55__templateSettings_js__["a"]; });
4943/* harmony import */ var __WEBPACK_IMPORTED_MODULE_56__template_js__ = __webpack_require__(346);
4944/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "template", function() { return __WEBPACK_IMPORTED_MODULE_56__template_js__["a"]; });
4945/* harmony import */ var __WEBPACK_IMPORTED_MODULE_57__result_js__ = __webpack_require__(347);
4946/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "result", function() { return __WEBPACK_IMPORTED_MODULE_57__result_js__["a"]; });
4947/* harmony import */ var __WEBPACK_IMPORTED_MODULE_58__uniqueId_js__ = __webpack_require__(348);
4948/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "uniqueId", function() { return __WEBPACK_IMPORTED_MODULE_58__uniqueId_js__["a"]; });
4949/* harmony import */ var __WEBPACK_IMPORTED_MODULE_59__chain_js__ = __webpack_require__(349);
4950/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "chain", function() { return __WEBPACK_IMPORTED_MODULE_59__chain_js__["a"]; });
4951/* harmony import */ var __WEBPACK_IMPORTED_MODULE_60__iteratee_js__ = __webpack_require__(202);
4952/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "iteratee", function() { return __WEBPACK_IMPORTED_MODULE_60__iteratee_js__["a"]; });
4953/* harmony import */ var __WEBPACK_IMPORTED_MODULE_61__partial_js__ = __webpack_require__(112);
4954/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "partial", function() { return __WEBPACK_IMPORTED_MODULE_61__partial_js__["a"]; });
4955/* harmony import */ var __WEBPACK_IMPORTED_MODULE_62__bind_js__ = __webpack_require__(209);
4956/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "bind", function() { return __WEBPACK_IMPORTED_MODULE_62__bind_js__["a"]; });
4957/* harmony import */ var __WEBPACK_IMPORTED_MODULE_63__bindAll_js__ = __webpack_require__(350);
4958/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "bindAll", function() { return __WEBPACK_IMPORTED_MODULE_63__bindAll_js__["a"]; });
4959/* harmony import */ var __WEBPACK_IMPORTED_MODULE_64__memoize_js__ = __webpack_require__(351);
4960/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "memoize", function() { return __WEBPACK_IMPORTED_MODULE_64__memoize_js__["a"]; });
4961/* harmony import */ var __WEBPACK_IMPORTED_MODULE_65__delay_js__ = __webpack_require__(210);
4962/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "delay", function() { return __WEBPACK_IMPORTED_MODULE_65__delay_js__["a"]; });
4963/* harmony import */ var __WEBPACK_IMPORTED_MODULE_66__defer_js__ = __webpack_require__(352);
4964/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "defer", function() { return __WEBPACK_IMPORTED_MODULE_66__defer_js__["a"]; });
4965/* harmony import */ var __WEBPACK_IMPORTED_MODULE_67__throttle_js__ = __webpack_require__(353);
4966/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "throttle", function() { return __WEBPACK_IMPORTED_MODULE_67__throttle_js__["a"]; });
4967/* harmony import */ var __WEBPACK_IMPORTED_MODULE_68__debounce_js__ = __webpack_require__(354);
4968/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "debounce", function() { return __WEBPACK_IMPORTED_MODULE_68__debounce_js__["a"]; });
4969/* harmony import */ var __WEBPACK_IMPORTED_MODULE_69__wrap_js__ = __webpack_require__(355);
4970/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "wrap", function() { return __WEBPACK_IMPORTED_MODULE_69__wrap_js__["a"]; });
4971/* harmony import */ var __WEBPACK_IMPORTED_MODULE_70__negate_js__ = __webpack_require__(145);
4972/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "negate", function() { return __WEBPACK_IMPORTED_MODULE_70__negate_js__["a"]; });
4973/* harmony import */ var __WEBPACK_IMPORTED_MODULE_71__compose_js__ = __webpack_require__(356);
4974/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "compose", function() { return __WEBPACK_IMPORTED_MODULE_71__compose_js__["a"]; });
4975/* harmony import */ var __WEBPACK_IMPORTED_MODULE_72__after_js__ = __webpack_require__(357);
4976/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "after", function() { return __WEBPACK_IMPORTED_MODULE_72__after_js__["a"]; });
4977/* harmony import */ var __WEBPACK_IMPORTED_MODULE_73__before_js__ = __webpack_require__(211);
4978/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "before", function() { return __WEBPACK_IMPORTED_MODULE_73__before_js__["a"]; });
4979/* harmony import */ var __WEBPACK_IMPORTED_MODULE_74__once_js__ = __webpack_require__(358);
4980/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "once", function() { return __WEBPACK_IMPORTED_MODULE_74__once_js__["a"]; });
4981/* harmony import */ var __WEBPACK_IMPORTED_MODULE_75__findKey_js__ = __webpack_require__(212);
4982/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "findKey", function() { return __WEBPACK_IMPORTED_MODULE_75__findKey_js__["a"]; });
4983/* harmony import */ var __WEBPACK_IMPORTED_MODULE_76__findIndex_js__ = __webpack_require__(146);
4984/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "findIndex", function() { return __WEBPACK_IMPORTED_MODULE_76__findIndex_js__["a"]; });
4985/* harmony import */ var __WEBPACK_IMPORTED_MODULE_77__findLastIndex_js__ = __webpack_require__(214);
4986/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "findLastIndex", function() { return __WEBPACK_IMPORTED_MODULE_77__findLastIndex_js__["a"]; });
4987/* harmony import */ var __WEBPACK_IMPORTED_MODULE_78__sortedIndex_js__ = __webpack_require__(215);
4988/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "sortedIndex", function() { return __WEBPACK_IMPORTED_MODULE_78__sortedIndex_js__["a"]; });
4989/* harmony import */ var __WEBPACK_IMPORTED_MODULE_79__indexOf_js__ = __webpack_require__(216);
4990/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "indexOf", function() { return __WEBPACK_IMPORTED_MODULE_79__indexOf_js__["a"]; });
4991/* harmony import */ var __WEBPACK_IMPORTED_MODULE_80__lastIndexOf_js__ = __webpack_require__(359);
4992/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "lastIndexOf", function() { return __WEBPACK_IMPORTED_MODULE_80__lastIndexOf_js__["a"]; });
4993/* harmony import */ var __WEBPACK_IMPORTED_MODULE_81__find_js__ = __webpack_require__(218);
4994/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "find", function() { return __WEBPACK_IMPORTED_MODULE_81__find_js__["a"]; });
4995/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "detect", function() { return __WEBPACK_IMPORTED_MODULE_81__find_js__["a"]; });
4996/* harmony import */ var __WEBPACK_IMPORTED_MODULE_82__findWhere_js__ = __webpack_require__(360);
4997/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "findWhere", function() { return __WEBPACK_IMPORTED_MODULE_82__findWhere_js__["a"]; });
4998/* harmony import */ var __WEBPACK_IMPORTED_MODULE_83__each_js__ = __webpack_require__(58);
4999/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "each", function() { return __WEBPACK_IMPORTED_MODULE_83__each_js__["a"]; });
5000/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "forEach", function() { return __WEBPACK_IMPORTED_MODULE_83__each_js__["a"]; });
5001/* harmony import */ var __WEBPACK_IMPORTED_MODULE_84__map_js__ = __webpack_require__(68);
5002/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "map", function() { return __WEBPACK_IMPORTED_MODULE_84__map_js__["a"]; });
5003/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "collect", function() { return __WEBPACK_IMPORTED_MODULE_84__map_js__["a"]; });
5004/* harmony import */ var __WEBPACK_IMPORTED_MODULE_85__reduce_js__ = __webpack_require__(361);
5005/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "reduce", function() { return __WEBPACK_IMPORTED_MODULE_85__reduce_js__["a"]; });
5006/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "foldl", function() { return __WEBPACK_IMPORTED_MODULE_85__reduce_js__["a"]; });
5007/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "inject", function() { return __WEBPACK_IMPORTED_MODULE_85__reduce_js__["a"]; });
5008/* harmony import */ var __WEBPACK_IMPORTED_MODULE_86__reduceRight_js__ = __webpack_require__(362);
5009/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "reduceRight", function() { return __WEBPACK_IMPORTED_MODULE_86__reduceRight_js__["a"]; });
5010/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "foldr", function() { return __WEBPACK_IMPORTED_MODULE_86__reduceRight_js__["a"]; });
5011/* harmony import */ var __WEBPACK_IMPORTED_MODULE_87__filter_js__ = __webpack_require__(88);
5012/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "filter", function() { return __WEBPACK_IMPORTED_MODULE_87__filter_js__["a"]; });
5013/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "select", function() { return __WEBPACK_IMPORTED_MODULE_87__filter_js__["a"]; });
5014/* harmony import */ var __WEBPACK_IMPORTED_MODULE_88__reject_js__ = __webpack_require__(363);
5015/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "reject", function() { return __WEBPACK_IMPORTED_MODULE_88__reject_js__["a"]; });
5016/* harmony import */ var __WEBPACK_IMPORTED_MODULE_89__every_js__ = __webpack_require__(364);
5017/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "every", function() { return __WEBPACK_IMPORTED_MODULE_89__every_js__["a"]; });
5018/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "all", function() { return __WEBPACK_IMPORTED_MODULE_89__every_js__["a"]; });
5019/* harmony import */ var __WEBPACK_IMPORTED_MODULE_90__some_js__ = __webpack_require__(365);
5020/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "some", function() { return __WEBPACK_IMPORTED_MODULE_90__some_js__["a"]; });
5021/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "any", function() { return __WEBPACK_IMPORTED_MODULE_90__some_js__["a"]; });
5022/* harmony import */ var __WEBPACK_IMPORTED_MODULE_91__contains_js__ = __webpack_require__(89);
5023/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "contains", function() { return __WEBPACK_IMPORTED_MODULE_91__contains_js__["a"]; });
5024/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "includes", function() { return __WEBPACK_IMPORTED_MODULE_91__contains_js__["a"]; });
5025/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "include", function() { return __WEBPACK_IMPORTED_MODULE_91__contains_js__["a"]; });
5026/* harmony import */ var __WEBPACK_IMPORTED_MODULE_92__invoke_js__ = __webpack_require__(366);
5027/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "invoke", function() { return __WEBPACK_IMPORTED_MODULE_92__invoke_js__["a"]; });
5028/* harmony import */ var __WEBPACK_IMPORTED_MODULE_93__pluck_js__ = __webpack_require__(147);
5029/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "pluck", function() { return __WEBPACK_IMPORTED_MODULE_93__pluck_js__["a"]; });
5030/* harmony import */ var __WEBPACK_IMPORTED_MODULE_94__where_js__ = __webpack_require__(367);
5031/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "where", function() { return __WEBPACK_IMPORTED_MODULE_94__where_js__["a"]; });
5032/* harmony import */ var __WEBPACK_IMPORTED_MODULE_95__max_js__ = __webpack_require__(220);
5033/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "max", function() { return __WEBPACK_IMPORTED_MODULE_95__max_js__["a"]; });
5034/* harmony import */ var __WEBPACK_IMPORTED_MODULE_96__min_js__ = __webpack_require__(368);
5035/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "min", function() { return __WEBPACK_IMPORTED_MODULE_96__min_js__["a"]; });
5036/* harmony import */ var __WEBPACK_IMPORTED_MODULE_97__shuffle_js__ = __webpack_require__(369);
5037/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "shuffle", function() { return __WEBPACK_IMPORTED_MODULE_97__shuffle_js__["a"]; });
5038/* harmony import */ var __WEBPACK_IMPORTED_MODULE_98__sample_js__ = __webpack_require__(221);
5039/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "sample", function() { return __WEBPACK_IMPORTED_MODULE_98__sample_js__["a"]; });
5040/* harmony import */ var __WEBPACK_IMPORTED_MODULE_99__sortBy_js__ = __webpack_require__(370);
5041/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "sortBy", function() { return __WEBPACK_IMPORTED_MODULE_99__sortBy_js__["a"]; });
5042/* harmony import */ var __WEBPACK_IMPORTED_MODULE_100__groupBy_js__ = __webpack_require__(371);
5043/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "groupBy", function() { return __WEBPACK_IMPORTED_MODULE_100__groupBy_js__["a"]; });
5044/* harmony import */ var __WEBPACK_IMPORTED_MODULE_101__indexBy_js__ = __webpack_require__(372);
5045/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "indexBy", function() { return __WEBPACK_IMPORTED_MODULE_101__indexBy_js__["a"]; });
5046/* harmony import */ var __WEBPACK_IMPORTED_MODULE_102__countBy_js__ = __webpack_require__(373);
5047/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "countBy", function() { return __WEBPACK_IMPORTED_MODULE_102__countBy_js__["a"]; });
5048/* harmony import */ var __WEBPACK_IMPORTED_MODULE_103__partition_js__ = __webpack_require__(374);
5049/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "partition", function() { return __WEBPACK_IMPORTED_MODULE_103__partition_js__["a"]; });
5050/* harmony import */ var __WEBPACK_IMPORTED_MODULE_104__toArray_js__ = __webpack_require__(375);
5051/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "toArray", function() { return __WEBPACK_IMPORTED_MODULE_104__toArray_js__["a"]; });
5052/* harmony import */ var __WEBPACK_IMPORTED_MODULE_105__size_js__ = __webpack_require__(376);
5053/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "size", function() { return __WEBPACK_IMPORTED_MODULE_105__size_js__["a"]; });
5054/* harmony import */ var __WEBPACK_IMPORTED_MODULE_106__pick_js__ = __webpack_require__(222);
5055/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "pick", function() { return __WEBPACK_IMPORTED_MODULE_106__pick_js__["a"]; });
5056/* harmony import */ var __WEBPACK_IMPORTED_MODULE_107__omit_js__ = __webpack_require__(378);
5057/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "omit", function() { return __WEBPACK_IMPORTED_MODULE_107__omit_js__["a"]; });
5058/* harmony import */ var __WEBPACK_IMPORTED_MODULE_108__first_js__ = __webpack_require__(379);
5059/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "first", function() { return __WEBPACK_IMPORTED_MODULE_108__first_js__["a"]; });
5060/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "head", function() { return __WEBPACK_IMPORTED_MODULE_108__first_js__["a"]; });
5061/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "take", function() { return __WEBPACK_IMPORTED_MODULE_108__first_js__["a"]; });
5062/* harmony import */ var __WEBPACK_IMPORTED_MODULE_109__initial_js__ = __webpack_require__(223);
5063/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "initial", function() { return __WEBPACK_IMPORTED_MODULE_109__initial_js__["a"]; });
5064/* harmony import */ var __WEBPACK_IMPORTED_MODULE_110__last_js__ = __webpack_require__(380);
5065/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "last", function() { return __WEBPACK_IMPORTED_MODULE_110__last_js__["a"]; });
5066/* harmony import */ var __WEBPACK_IMPORTED_MODULE_111__rest_js__ = __webpack_require__(224);
5067/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "rest", function() { return __WEBPACK_IMPORTED_MODULE_111__rest_js__["a"]; });
5068/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "tail", function() { return __WEBPACK_IMPORTED_MODULE_111__rest_js__["a"]; });
5069/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "drop", function() { return __WEBPACK_IMPORTED_MODULE_111__rest_js__["a"]; });
5070/* harmony import */ var __WEBPACK_IMPORTED_MODULE_112__compact_js__ = __webpack_require__(381);
5071/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "compact", function() { return __WEBPACK_IMPORTED_MODULE_112__compact_js__["a"]; });
5072/* harmony import */ var __WEBPACK_IMPORTED_MODULE_113__flatten_js__ = __webpack_require__(382);
5073/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "flatten", function() { return __WEBPACK_IMPORTED_MODULE_113__flatten_js__["a"]; });
5074/* harmony import */ var __WEBPACK_IMPORTED_MODULE_114__without_js__ = __webpack_require__(383);
5075/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "without", function() { return __WEBPACK_IMPORTED_MODULE_114__without_js__["a"]; });
5076/* harmony import */ var __WEBPACK_IMPORTED_MODULE_115__uniq_js__ = __webpack_require__(226);
5077/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "uniq", function() { return __WEBPACK_IMPORTED_MODULE_115__uniq_js__["a"]; });
5078/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "unique", function() { return __WEBPACK_IMPORTED_MODULE_115__uniq_js__["a"]; });
5079/* harmony import */ var __WEBPACK_IMPORTED_MODULE_116__union_js__ = __webpack_require__(384);
5080/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "union", function() { return __WEBPACK_IMPORTED_MODULE_116__union_js__["a"]; });
5081/* harmony import */ var __WEBPACK_IMPORTED_MODULE_117__intersection_js__ = __webpack_require__(385);
5082/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "intersection", function() { return __WEBPACK_IMPORTED_MODULE_117__intersection_js__["a"]; });
5083/* harmony import */ var __WEBPACK_IMPORTED_MODULE_118__difference_js__ = __webpack_require__(225);
5084/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "difference", function() { return __WEBPACK_IMPORTED_MODULE_118__difference_js__["a"]; });
5085/* harmony import */ var __WEBPACK_IMPORTED_MODULE_119__unzip_js__ = __webpack_require__(227);
5086/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "unzip", function() { return __WEBPACK_IMPORTED_MODULE_119__unzip_js__["a"]; });
5087/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "transpose", function() { return __WEBPACK_IMPORTED_MODULE_119__unzip_js__["a"]; });
5088/* harmony import */ var __WEBPACK_IMPORTED_MODULE_120__zip_js__ = __webpack_require__(386);
5089/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "zip", function() { return __WEBPACK_IMPORTED_MODULE_120__zip_js__["a"]; });
5090/* harmony import */ var __WEBPACK_IMPORTED_MODULE_121__object_js__ = __webpack_require__(387);
5091/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "object", function() { return __WEBPACK_IMPORTED_MODULE_121__object_js__["a"]; });
5092/* harmony import */ var __WEBPACK_IMPORTED_MODULE_122__range_js__ = __webpack_require__(388);
5093/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "range", function() { return __WEBPACK_IMPORTED_MODULE_122__range_js__["a"]; });
5094/* harmony import */ var __WEBPACK_IMPORTED_MODULE_123__chunk_js__ = __webpack_require__(389);
5095/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "chunk", function() { return __WEBPACK_IMPORTED_MODULE_123__chunk_js__["a"]; });
5096/* harmony import */ var __WEBPACK_IMPORTED_MODULE_124__mixin_js__ = __webpack_require__(390);
5097/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "mixin", function() { return __WEBPACK_IMPORTED_MODULE_124__mixin_js__["a"]; });
5098/* harmony import */ var __WEBPACK_IMPORTED_MODULE_125__underscore_array_methods_js__ = __webpack_require__(391);
5099/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return __WEBPACK_IMPORTED_MODULE_125__underscore_array_methods_js__["a"]; });
5100// Named Exports
5101// =============
5102
5103// Underscore.js 1.12.1
5104// https://underscorejs.org
5105// (c) 2009-2020 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
5106// Underscore may be freely distributed under the MIT license.
5107
5108// Baseline setup.
5109
5110
5111
5112// Object Functions
5113// ----------------
5114// Our most fundamental functions operate on any JavaScript object.
5115// Most functions in Underscore depend on at least one function in this section.
5116
5117// A group of functions that check the types of core JavaScript values.
5118// These are often informally referred to as the "isType" functions.
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146// Functions that treat an object as a dictionary of key-value pairs.
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163// Utility Functions
5164// -----------------
5165// A bit of a grab bag: Predicate-generating functions for use with filters and
5166// loops, string escaping and templating, create random numbers and unique ids,
5167// and functions that facilitate Underscore's chaining and iteration conventions.
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187// Function (ahem) Functions
5188// -------------------------
5189// These functions take a function as an argument and return a new function
5190// as the result. Also known as higher-order functions.
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206// Finders
5207// -------
5208// Functions that extract (the position of) a single element from an object
5209// or array based on some criterion.
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219// Collection Functions
5220// --------------------
5221// Functions that work on any collection of elements: either an array, or
5222// an object of key-value pairs.
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247// `_.pick` and `_.omit` are actually object functions, but we put
5248// them here in order to create a more natural reading order in the
5249// monolithic build as they depend on `_.contains`.
5250
5251
5252
5253// Array Functions
5254// ---------------
5255// Functions that operate on arrays (and array-likes) only, because they’re
5256// expressed in terms of operations on an ordered list of values.
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274// OOP
5275// ---
5276// These modules support the "object-oriented" calling style. See also
5277// `underscore.js` and `index-default.js`.
5278
5279
5280
5281
5282/***/ }),
5283/* 134 */
5284/***/ (function(module, __webpack_exports__, __webpack_require__) {
5285
5286"use strict";
5287/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(17);
5288
5289
5290/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('String'));
5291
5292
5293/***/ }),
5294/* 135 */
5295/***/ (function(module, __webpack_exports__, __webpack_require__) {
5296
5297"use strict";
5298/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(17);
5299/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isFunction_js__ = __webpack_require__(28);
5300/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__isArrayBuffer_js__ = __webpack_require__(185);
5301/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__stringTagBug_js__ = __webpack_require__(84);
5302
5303
5304
5305
5306
5307var isDataView = Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('DataView');
5308
5309// In IE 10 - Edge 13, we need a different heuristic
5310// to determine whether an object is a `DataView`.
5311function ie10IsDataView(obj) {
5312 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);
5313}
5314
5315/* harmony default export */ __webpack_exports__["a"] = (__WEBPACK_IMPORTED_MODULE_3__stringTagBug_js__["a" /* hasStringTagBug */] ? ie10IsDataView : isDataView);
5316
5317
5318/***/ }),
5319/* 136 */
5320/***/ (function(module, __webpack_exports__, __webpack_require__) {
5321
5322"use strict";
5323/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(17);
5324/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__has_js__ = __webpack_require__(45);
5325
5326
5327
5328var isArguments = Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('Arguments');
5329
5330// Define a fallback version of the method in browsers (ahem, IE < 9), where
5331// there isn't any inspectable "Arguments" type.
5332(function() {
5333 if (!isArguments(arguments)) {
5334 isArguments = function(obj) {
5335 return Object(__WEBPACK_IMPORTED_MODULE_1__has_js__["a" /* default */])(obj, 'callee');
5336 };
5337 }
5338}());
5339
5340/* harmony default export */ __webpack_exports__["a"] = (isArguments);
5341
5342
5343/***/ }),
5344/* 137 */
5345/***/ (function(module, __webpack_exports__, __webpack_require__) {
5346
5347"use strict";
5348/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__shallowProperty_js__ = __webpack_require__(190);
5349
5350
5351// Internal helper to obtain the `byteLength` property of an object.
5352/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__shallowProperty_js__["a" /* default */])('byteLength'));
5353
5354
5355/***/ }),
5356/* 138 */
5357/***/ (function(module, __webpack_exports__, __webpack_require__) {
5358
5359"use strict";
5360/* harmony export (immutable) */ __webpack_exports__["a"] = ie11fingerprint;
5361/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return mapMethods; });
5362/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return weakMapMethods; });
5363/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return setMethods; });
5364/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__getLength_js__ = __webpack_require__(29);
5365/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isFunction_js__ = __webpack_require__(28);
5366/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__allKeys_js__ = __webpack_require__(85);
5367
5368
5369
5370
5371// Since the regular `Object.prototype.toString` type tests don't work for
5372// some types in IE 11, we use a fingerprinting heuristic instead, based
5373// on the methods. It's not great, but it's the best we got.
5374// The fingerprint method lists are defined below.
5375function ie11fingerprint(methods) {
5376 var length = Object(__WEBPACK_IMPORTED_MODULE_0__getLength_js__["a" /* default */])(methods);
5377 return function(obj) {
5378 if (obj == null) return false;
5379 // `Map`, `WeakMap` and `Set` have no enumerable keys.
5380 var keys = Object(__WEBPACK_IMPORTED_MODULE_2__allKeys_js__["a" /* default */])(obj);
5381 if (Object(__WEBPACK_IMPORTED_MODULE_0__getLength_js__["a" /* default */])(keys)) return false;
5382 for (var i = 0; i < length; i++) {
5383 if (!Object(__WEBPACK_IMPORTED_MODULE_1__isFunction_js__["a" /* default */])(obj[methods[i]])) return false;
5384 }
5385 // If we are testing against `WeakMap`, we need to ensure that
5386 // `obj` doesn't have a `forEach` method in order to distinguish
5387 // it from a regular `Map`.
5388 return methods !== weakMapMethods || !Object(__WEBPACK_IMPORTED_MODULE_1__isFunction_js__["a" /* default */])(obj[forEachName]);
5389 };
5390}
5391
5392// In the interest of compact minification, we write
5393// each string in the fingerprints only once.
5394var forEachName = 'forEach',
5395 hasName = 'has',
5396 commonInit = ['clear', 'delete'],
5397 mapTail = ['get', hasName, 'set'];
5398
5399// `Map`, `WeakMap` and `Set` each have slightly different
5400// combinations of the above sublists.
5401var mapMethods = commonInit.concat(forEachName, mapTail),
5402 weakMapMethods = commonInit.concat(mapTail),
5403 setMethods = ['add'].concat(commonInit, forEachName, hasName);
5404
5405
5406/***/ }),
5407/* 139 */
5408/***/ (function(module, __webpack_exports__, __webpack_require__) {
5409
5410"use strict";
5411/* harmony export (immutable) */ __webpack_exports__["a"] = createAssigner;
5412// An internal function for creating assigner functions.
5413function createAssigner(keysFunc, defaults) {
5414 return function(obj) {
5415 var length = arguments.length;
5416 if (defaults) obj = Object(obj);
5417 if (length < 2 || obj == null) return obj;
5418 for (var index = 1; index < length; index++) {
5419 var source = arguments[index],
5420 keys = keysFunc(source),
5421 l = keys.length;
5422 for (var i = 0; i < l; i++) {
5423 var key = keys[i];
5424 if (!defaults || obj[key] === void 0) obj[key] = source[key];
5425 }
5426 }
5427 return obj;
5428 };
5429}
5430
5431
5432/***/ }),
5433/* 140 */
5434/***/ (function(module, __webpack_exports__, __webpack_require__) {
5435
5436"use strict";
5437/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createAssigner_js__ = __webpack_require__(139);
5438/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__keys_js__ = __webpack_require__(16);
5439
5440
5441
5442// Assigns a given object with all the own properties in the passed-in
5443// object(s).
5444// (https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object/assign)
5445/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createAssigner_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__keys_js__["a" /* default */]));
5446
5447
5448/***/ }),
5449/* 141 */
5450/***/ (function(module, __webpack_exports__, __webpack_require__) {
5451
5452"use strict";
5453/* harmony export (immutable) */ __webpack_exports__["a"] = deepGet;
5454// Internal function to obtain a nested property in `obj` along `path`.
5455function deepGet(obj, path) {
5456 var length = path.length;
5457 for (var i = 0; i < length; i++) {
5458 if (obj == null) return void 0;
5459 obj = obj[path[i]];
5460 }
5461 return length ? obj : void 0;
5462}
5463
5464
5465/***/ }),
5466/* 142 */
5467/***/ (function(module, __webpack_exports__, __webpack_require__) {
5468
5469"use strict";
5470/* harmony export (immutable) */ __webpack_exports__["a"] = identity;
5471// Keep the identity function around for default iteratees.
5472function identity(value) {
5473 return value;
5474}
5475
5476
5477/***/ }),
5478/* 143 */
5479/***/ (function(module, __webpack_exports__, __webpack_require__) {
5480
5481"use strict";
5482/* harmony export (immutable) */ __webpack_exports__["a"] = property;
5483/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__deepGet_js__ = __webpack_require__(141);
5484/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__toPath_js__ = __webpack_require__(86);
5485
5486
5487
5488// Creates a function that, when passed an object, will traverse that object’s
5489// properties down the given `path`, specified as an array of keys or indices.
5490function property(path) {
5491 path = Object(__WEBPACK_IMPORTED_MODULE_1__toPath_js__["a" /* default */])(path);
5492 return function(obj) {
5493 return Object(__WEBPACK_IMPORTED_MODULE_0__deepGet_js__["a" /* default */])(obj, path);
5494 };
5495}
5496
5497
5498/***/ }),
5499/* 144 */
5500/***/ (function(module, __webpack_exports__, __webpack_require__) {
5501
5502"use strict";
5503// A (possibly faster) way to get the current timestamp as an integer.
5504/* harmony default export */ __webpack_exports__["a"] = (Date.now || function() {
5505 return new Date().getTime();
5506});
5507
5508
5509/***/ }),
5510/* 145 */
5511/***/ (function(module, __webpack_exports__, __webpack_require__) {
5512
5513"use strict";
5514/* harmony export (immutable) */ __webpack_exports__["a"] = negate;
5515// Returns a negated version of the passed-in predicate.
5516function negate(predicate) {
5517 return function() {
5518 return !predicate.apply(this, arguments);
5519 };
5520}
5521
5522
5523/***/ }),
5524/* 146 */
5525/***/ (function(module, __webpack_exports__, __webpack_require__) {
5526
5527"use strict";
5528/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createPredicateIndexFinder_js__ = __webpack_require__(213);
5529
5530
5531// Returns the first index on an array-like that passes a truth test.
5532/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createPredicateIndexFinder_js__["a" /* default */])(1));
5533
5534
5535/***/ }),
5536/* 147 */
5537/***/ (function(module, __webpack_exports__, __webpack_require__) {
5538
5539"use strict";
5540/* harmony export (immutable) */ __webpack_exports__["a"] = pluck;
5541/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__map_js__ = __webpack_require__(68);
5542/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__property_js__ = __webpack_require__(143);
5543
5544
5545
5546// Convenience version of a common use case of `_.map`: fetching a property.
5547function pluck(obj, key) {
5548 return Object(__WEBPACK_IMPORTED_MODULE_0__map_js__["a" /* default */])(obj, Object(__WEBPACK_IMPORTED_MODULE_1__property_js__["a" /* default */])(key));
5549}
5550
5551
5552/***/ }),
5553/* 148 */
5554/***/ (function(module, exports, __webpack_require__) {
5555
5556module.exports = __webpack_require__(234);
5557
5558/***/ }),
5559/* 149 */
5560/***/ (function(module, exports, __webpack_require__) {
5561
5562var wellKnownSymbol = __webpack_require__(9);
5563
5564exports.f = wellKnownSymbol;
5565
5566
5567/***/ }),
5568/* 150 */
5569/***/ (function(module, exports, __webpack_require__) {
5570
5571module.exports = __webpack_require__(244);
5572
5573/***/ }),
5574/* 151 */
5575/***/ (function(module, exports, __webpack_require__) {
5576
5577module.exports = __webpack_require__(503);
5578
5579/***/ }),
5580/* 152 */
5581/***/ (function(module, exports, __webpack_require__) {
5582
5583module.exports = __webpack_require__(554);
5584
5585/***/ }),
5586/* 153 */
5587/***/ (function(module, exports, __webpack_require__) {
5588
5589module.exports = __webpack_require__(572);
5590
5591/***/ }),
5592/* 154 */
5593/***/ (function(module, exports, __webpack_require__) {
5594
5595module.exports = __webpack_require__(576);
5596
5597/***/ }),
5598/* 155 */
5599/***/ (function(module, exports, __webpack_require__) {
5600
5601var defineBuiltIn = __webpack_require__(44);
5602
5603module.exports = function (target, src, options) {
5604 for (var key in src) {
5605 if (options && options.unsafe && target[key]) target[key] = src[key];
5606 else defineBuiltIn(target, key, src[key], options);
5607 } return target;
5608};
5609
5610
5611/***/ }),
5612/* 156 */
5613/***/ (function(module, exports, __webpack_require__) {
5614
5615"use strict";
5616
5617var $ = __webpack_require__(0);
5618var global = __webpack_require__(7);
5619var InternalMetadataModule = __webpack_require__(94);
5620var fails = __webpack_require__(2);
5621var createNonEnumerableProperty = __webpack_require__(37);
5622var iterate = __webpack_require__(42);
5623var anInstance = __webpack_require__(108);
5624var isCallable = __webpack_require__(8);
5625var isObject = __webpack_require__(11);
5626var setToStringTag = __webpack_require__(52);
5627var defineProperty = __webpack_require__(23).f;
5628var forEach = __webpack_require__(70).forEach;
5629var DESCRIPTORS = __webpack_require__(14);
5630var InternalStateModule = __webpack_require__(43);
5631
5632var setInternalState = InternalStateModule.set;
5633var internalStateGetterFor = InternalStateModule.getterFor;
5634
5635module.exports = function (CONSTRUCTOR_NAME, wrapper, common) {
5636 var IS_MAP = CONSTRUCTOR_NAME.indexOf('Map') !== -1;
5637 var IS_WEAK = CONSTRUCTOR_NAME.indexOf('Weak') !== -1;
5638 var ADDER = IS_MAP ? 'set' : 'add';
5639 var NativeConstructor = global[CONSTRUCTOR_NAME];
5640 var NativePrototype = NativeConstructor && NativeConstructor.prototype;
5641 var exported = {};
5642 var Constructor;
5643
5644 if (!DESCRIPTORS || !isCallable(NativeConstructor)
5645 || !(IS_WEAK || NativePrototype.forEach && !fails(function () { new NativeConstructor().entries().next(); }))
5646 ) {
5647 // create collection constructor
5648 Constructor = common.getConstructor(wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER);
5649 InternalMetadataModule.enable();
5650 } else {
5651 Constructor = wrapper(function (target, iterable) {
5652 setInternalState(anInstance(target, Prototype), {
5653 type: CONSTRUCTOR_NAME,
5654 collection: new NativeConstructor()
5655 });
5656 if (iterable != undefined) iterate(iterable, target[ADDER], { that: target, AS_ENTRIES: IS_MAP });
5657 });
5658
5659 var Prototype = Constructor.prototype;
5660
5661 var getInternalState = internalStateGetterFor(CONSTRUCTOR_NAME);
5662
5663 forEach(['add', 'clear', 'delete', 'forEach', 'get', 'has', 'set', 'keys', 'values', 'entries'], function (KEY) {
5664 var IS_ADDER = KEY == 'add' || KEY == 'set';
5665 if (KEY in NativePrototype && !(IS_WEAK && KEY == 'clear')) {
5666 createNonEnumerableProperty(Prototype, KEY, function (a, b) {
5667 var collection = getInternalState(this).collection;
5668 if (!IS_ADDER && IS_WEAK && !isObject(a)) return KEY == 'get' ? undefined : false;
5669 var result = collection[KEY](a === 0 ? 0 : a, b);
5670 return IS_ADDER ? this : result;
5671 });
5672 }
5673 });
5674
5675 IS_WEAK || defineProperty(Prototype, 'size', {
5676 configurable: true,
5677 get: function () {
5678 return getInternalState(this).collection.size;
5679 }
5680 });
5681 }
5682
5683 setToStringTag(Constructor, CONSTRUCTOR_NAME, false, true);
5684
5685 exported[CONSTRUCTOR_NAME] = Constructor;
5686 $({ global: true, forced: true }, exported);
5687
5688 if (!IS_WEAK) common.setStrong(Constructor, CONSTRUCTOR_NAME, IS_MAP);
5689
5690 return Constructor;
5691};
5692
5693
5694/***/ }),
5695/* 157 */
5696/***/ (function(module, exports, __webpack_require__) {
5697
5698"use strict";
5699
5700
5701module.exports = __webpack_require__(591);
5702
5703/***/ }),
5704/* 158 */
5705/***/ (function(module, exports, __webpack_require__) {
5706
5707/* eslint-disable es-x/no-symbol -- required for testing */
5708var NATIVE_SYMBOL = __webpack_require__(64);
5709
5710module.exports = NATIVE_SYMBOL
5711 && !Symbol.sham
5712 && typeof Symbol.iterator == 'symbol';
5713
5714
5715/***/ }),
5716/* 159 */
5717/***/ (function(module, exports, __webpack_require__) {
5718
5719var DESCRIPTORS = __webpack_require__(14);
5720var fails = __webpack_require__(2);
5721var createElement = __webpack_require__(125);
5722
5723// Thanks to IE8 for its funny defineProperty
5724module.exports = !DESCRIPTORS && !fails(function () {
5725 // eslint-disable-next-line es-x/no-object-defineproperty -- required for testing
5726 return Object.defineProperty(createElement('div'), 'a', {
5727 get: function () { return 7; }
5728 }).a != 7;
5729});
5730
5731
5732/***/ }),
5733/* 160 */
5734/***/ (function(module, exports, __webpack_require__) {
5735
5736var fails = __webpack_require__(2);
5737var isCallable = __webpack_require__(8);
5738
5739var replacement = /#|\.prototype\./;
5740
5741var isForced = function (feature, detection) {
5742 var value = data[normalize(feature)];
5743 return value == POLYFILL ? true
5744 : value == NATIVE ? false
5745 : isCallable(detection) ? fails(detection)
5746 : !!detection;
5747};
5748
5749var normalize = isForced.normalize = function (string) {
5750 return String(string).replace(replacement, '.').toLowerCase();
5751};
5752
5753var data = isForced.data = {};
5754var NATIVE = isForced.NATIVE = 'N';
5755var POLYFILL = isForced.POLYFILL = 'P';
5756
5757module.exports = isForced;
5758
5759
5760/***/ }),
5761/* 161 */
5762/***/ (function(module, exports, __webpack_require__) {
5763
5764var DESCRIPTORS = __webpack_require__(14);
5765var fails = __webpack_require__(2);
5766
5767// V8 ~ Chrome 36-
5768// https://bugs.chromium.org/p/v8/issues/detail?id=3334
5769module.exports = DESCRIPTORS && fails(function () {
5770 // eslint-disable-next-line es-x/no-object-defineproperty -- required for testing
5771 return Object.defineProperty(function () { /* empty */ }, 'prototype', {
5772 value: 42,
5773 writable: false
5774 }).prototype != 42;
5775});
5776
5777
5778/***/ }),
5779/* 162 */
5780/***/ (function(module, exports, __webpack_require__) {
5781
5782var fails = __webpack_require__(2);
5783
5784module.exports = !fails(function () {
5785 function F() { /* empty */ }
5786 F.prototype.constructor = null;
5787 // eslint-disable-next-line es-x/no-object-getprototypeof -- required for testing
5788 return Object.getPrototypeOf(new F()) !== F.prototype;
5789});
5790
5791
5792/***/ }),
5793/* 163 */
5794/***/ (function(module, exports, __webpack_require__) {
5795
5796var getBuiltIn = __webpack_require__(18);
5797var uncurryThis = __webpack_require__(4);
5798var getOwnPropertyNamesModule = __webpack_require__(103);
5799var getOwnPropertySymbolsModule = __webpack_require__(104);
5800var anObject = __webpack_require__(20);
5801
5802var concat = uncurryThis([].concat);
5803
5804// all object keys, includes non-enumerable and symbols
5805module.exports = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) {
5806 var keys = getOwnPropertyNamesModule.f(anObject(it));
5807 var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;
5808 return getOwnPropertySymbols ? concat(keys, getOwnPropertySymbols(it)) : keys;
5809};
5810
5811
5812/***/ }),
5813/* 164 */
5814/***/ (function(module, exports, __webpack_require__) {
5815
5816var uncurryThis = __webpack_require__(4);
5817var hasOwn = __webpack_require__(13);
5818var toIndexedObject = __webpack_require__(32);
5819var indexOf = __webpack_require__(165).indexOf;
5820var hiddenKeys = __webpack_require__(80);
5821
5822var push = uncurryThis([].push);
5823
5824module.exports = function (object, names) {
5825 var O = toIndexedObject(object);
5826 var i = 0;
5827 var result = [];
5828 var key;
5829 for (key in O) !hasOwn(hiddenKeys, key) && hasOwn(O, key) && push(result, key);
5830 // Don't enum bug & hidden keys
5831 while (names.length > i) if (hasOwn(O, key = names[i++])) {
5832 ~indexOf(result, key) || push(result, key);
5833 }
5834 return result;
5835};
5836
5837
5838/***/ }),
5839/* 165 */
5840/***/ (function(module, exports, __webpack_require__) {
5841
5842var toIndexedObject = __webpack_require__(32);
5843var toAbsoluteIndex = __webpack_require__(126);
5844var lengthOfArrayLike = __webpack_require__(41);
5845
5846// `Array.prototype.{ indexOf, includes }` methods implementation
5847var createMethod = function (IS_INCLUDES) {
5848 return function ($this, el, fromIndex) {
5849 var O = toIndexedObject($this);
5850 var length = lengthOfArrayLike(O);
5851 var index = toAbsoluteIndex(fromIndex, length);
5852 var value;
5853 // Array#includes uses SameValueZero equality algorithm
5854 // eslint-disable-next-line no-self-compare -- NaN check
5855 if (IS_INCLUDES && el != el) while (length > index) {
5856 value = O[index++];
5857 // eslint-disable-next-line no-self-compare -- NaN check
5858 if (value != value) return true;
5859 // Array#indexOf ignores holes, Array#includes - not
5860 } else for (;length > index; index++) {
5861 if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;
5862 } return !IS_INCLUDES && -1;
5863 };
5864};
5865
5866module.exports = {
5867 // `Array.prototype.includes` method
5868 // https://tc39.es/ecma262/#sec-array.prototype.includes
5869 includes: createMethod(true),
5870 // `Array.prototype.indexOf` method
5871 // https://tc39.es/ecma262/#sec-array.prototype.indexof
5872 indexOf: createMethod(false)
5873};
5874
5875
5876/***/ }),
5877/* 166 */
5878/***/ (function(module, exports, __webpack_require__) {
5879
5880var getBuiltIn = __webpack_require__(18);
5881
5882module.exports = getBuiltIn('document', 'documentElement');
5883
5884
5885/***/ }),
5886/* 167 */
5887/***/ (function(module, exports, __webpack_require__) {
5888
5889var wellKnownSymbol = __webpack_require__(9);
5890var Iterators = __webpack_require__(50);
5891
5892var ITERATOR = wellKnownSymbol('iterator');
5893var ArrayPrototype = Array.prototype;
5894
5895// check on default Array iterator
5896module.exports = function (it) {
5897 return it !== undefined && (Iterators.Array === it || ArrayPrototype[ITERATOR] === it);
5898};
5899
5900
5901/***/ }),
5902/* 168 */
5903/***/ (function(module, exports, __webpack_require__) {
5904
5905var call = __webpack_require__(15);
5906var aCallable = __webpack_require__(31);
5907var anObject = __webpack_require__(20);
5908var tryToString = __webpack_require__(78);
5909var getIteratorMethod = __webpack_require__(106);
5910
5911var $TypeError = TypeError;
5912
5913module.exports = function (argument, usingIterator) {
5914 var iteratorMethod = arguments.length < 2 ? getIteratorMethod(argument) : usingIterator;
5915 if (aCallable(iteratorMethod)) return anObject(call(iteratorMethod, argument));
5916 throw $TypeError(tryToString(argument) + ' is not iterable');
5917};
5918
5919
5920/***/ }),
5921/* 169 */
5922/***/ (function(module, exports, __webpack_require__) {
5923
5924var call = __webpack_require__(15);
5925var anObject = __webpack_require__(20);
5926var getMethod = __webpack_require__(123);
5927
5928module.exports = function (iterator, kind, value) {
5929 var innerResult, innerError;
5930 anObject(iterator);
5931 try {
5932 innerResult = getMethod(iterator, 'return');
5933 if (!innerResult) {
5934 if (kind === 'throw') throw value;
5935 return value;
5936 }
5937 innerResult = call(innerResult, iterator);
5938 } catch (error) {
5939 innerError = true;
5940 innerResult = error;
5941 }
5942 if (kind === 'throw') throw value;
5943 if (innerError) throw innerResult;
5944 anObject(innerResult);
5945 return value;
5946};
5947
5948
5949/***/ }),
5950/* 170 */
5951/***/ (function(module, exports) {
5952
5953module.exports = function () { /* empty */ };
5954
5955
5956/***/ }),
5957/* 171 */
5958/***/ (function(module, exports, __webpack_require__) {
5959
5960var global = __webpack_require__(7);
5961var isCallable = __webpack_require__(8);
5962var inspectSource = __webpack_require__(131);
5963
5964var WeakMap = global.WeakMap;
5965
5966module.exports = isCallable(WeakMap) && /native code/.test(inspectSource(WeakMap));
5967
5968
5969/***/ }),
5970/* 172 */
5971/***/ (function(module, exports, __webpack_require__) {
5972
5973"use strict";
5974
5975var fails = __webpack_require__(2);
5976var isCallable = __webpack_require__(8);
5977var create = __webpack_require__(49);
5978var getPrototypeOf = __webpack_require__(100);
5979var defineBuiltIn = __webpack_require__(44);
5980var wellKnownSymbol = __webpack_require__(9);
5981var IS_PURE = __webpack_require__(33);
5982
5983var ITERATOR = wellKnownSymbol('iterator');
5984var BUGGY_SAFARI_ITERATORS = false;
5985
5986// `%IteratorPrototype%` object
5987// https://tc39.es/ecma262/#sec-%iteratorprototype%-object
5988var IteratorPrototype, PrototypeOfArrayIteratorPrototype, arrayIterator;
5989
5990/* eslint-disable es-x/no-array-prototype-keys -- safe */
5991if ([].keys) {
5992 arrayIterator = [].keys();
5993 // Safari 8 has buggy iterators w/o `next`
5994 if (!('next' in arrayIterator)) BUGGY_SAFARI_ITERATORS = true;
5995 else {
5996 PrototypeOfArrayIteratorPrototype = getPrototypeOf(getPrototypeOf(arrayIterator));
5997 if (PrototypeOfArrayIteratorPrototype !== Object.prototype) IteratorPrototype = PrototypeOfArrayIteratorPrototype;
5998 }
5999}
6000
6001var NEW_ITERATOR_PROTOTYPE = IteratorPrototype == undefined || fails(function () {
6002 var test = {};
6003 // FF44- legacy iterators case
6004 return IteratorPrototype[ITERATOR].call(test) !== test;
6005});
6006
6007if (NEW_ITERATOR_PROTOTYPE) IteratorPrototype = {};
6008else if (IS_PURE) IteratorPrototype = create(IteratorPrototype);
6009
6010// `%IteratorPrototype%[@@iterator]()` method
6011// https://tc39.es/ecma262/#sec-%iteratorprototype%-@@iterator
6012if (!isCallable(IteratorPrototype[ITERATOR])) {
6013 defineBuiltIn(IteratorPrototype, ITERATOR, function () {
6014 return this;
6015 });
6016}
6017
6018module.exports = {
6019 IteratorPrototype: IteratorPrototype,
6020 BUGGY_SAFARI_ITERATORS: BUGGY_SAFARI_ITERATORS
6021};
6022
6023
6024/***/ }),
6025/* 173 */
6026/***/ (function(module, exports, __webpack_require__) {
6027
6028"use strict";
6029
6030var getBuiltIn = __webpack_require__(18);
6031var definePropertyModule = __webpack_require__(23);
6032var wellKnownSymbol = __webpack_require__(9);
6033var DESCRIPTORS = __webpack_require__(14);
6034
6035var SPECIES = wellKnownSymbol('species');
6036
6037module.exports = function (CONSTRUCTOR_NAME) {
6038 var Constructor = getBuiltIn(CONSTRUCTOR_NAME);
6039 var defineProperty = definePropertyModule.f;
6040
6041 if (DESCRIPTORS && Constructor && !Constructor[SPECIES]) {
6042 defineProperty(Constructor, SPECIES, {
6043 configurable: true,
6044 get: function () { return this; }
6045 });
6046 }
6047};
6048
6049
6050/***/ }),
6051/* 174 */
6052/***/ (function(module, exports, __webpack_require__) {
6053
6054var anObject = __webpack_require__(20);
6055var aConstructor = __webpack_require__(175);
6056var wellKnownSymbol = __webpack_require__(9);
6057
6058var SPECIES = wellKnownSymbol('species');
6059
6060// `SpeciesConstructor` abstract operation
6061// https://tc39.es/ecma262/#sec-speciesconstructor
6062module.exports = function (O, defaultConstructor) {
6063 var C = anObject(O).constructor;
6064 var S;
6065 return C === undefined || (S = anObject(C)[SPECIES]) == undefined ? defaultConstructor : aConstructor(S);
6066};
6067
6068
6069/***/ }),
6070/* 175 */
6071/***/ (function(module, exports, __webpack_require__) {
6072
6073var isConstructor = __webpack_require__(109);
6074var tryToString = __webpack_require__(78);
6075
6076var $TypeError = TypeError;
6077
6078// `Assert: IsConstructor(argument) is true`
6079module.exports = function (argument) {
6080 if (isConstructor(argument)) return argument;
6081 throw $TypeError(tryToString(argument) + ' is not a constructor');
6082};
6083
6084
6085/***/ }),
6086/* 176 */
6087/***/ (function(module, exports, __webpack_require__) {
6088
6089var global = __webpack_require__(7);
6090var apply = __webpack_require__(75);
6091var bind = __webpack_require__(48);
6092var isCallable = __webpack_require__(8);
6093var hasOwn = __webpack_require__(13);
6094var fails = __webpack_require__(2);
6095var html = __webpack_require__(166);
6096var arraySlice = __webpack_require__(110);
6097var createElement = __webpack_require__(125);
6098var validateArgumentsLength = __webpack_require__(303);
6099var IS_IOS = __webpack_require__(177);
6100var IS_NODE = __webpack_require__(107);
6101
6102var set = global.setImmediate;
6103var clear = global.clearImmediate;
6104var process = global.process;
6105var Dispatch = global.Dispatch;
6106var Function = global.Function;
6107var MessageChannel = global.MessageChannel;
6108var String = global.String;
6109var counter = 0;
6110var queue = {};
6111var ONREADYSTATECHANGE = 'onreadystatechange';
6112var location, defer, channel, port;
6113
6114try {
6115 // Deno throws a ReferenceError on `location` access without `--location` flag
6116 location = global.location;
6117} catch (error) { /* empty */ }
6118
6119var run = function (id) {
6120 if (hasOwn(queue, id)) {
6121 var fn = queue[id];
6122 delete queue[id];
6123 fn();
6124 }
6125};
6126
6127var runner = function (id) {
6128 return function () {
6129 run(id);
6130 };
6131};
6132
6133var listener = function (event) {
6134 run(event.data);
6135};
6136
6137var post = function (id) {
6138 // old engines have not location.origin
6139 global.postMessage(String(id), location.protocol + '//' + location.host);
6140};
6141
6142// Node.js 0.9+ & IE10+ has setImmediate, otherwise:
6143if (!set || !clear) {
6144 set = function setImmediate(handler) {
6145 validateArgumentsLength(arguments.length, 1);
6146 var fn = isCallable(handler) ? handler : Function(handler);
6147 var args = arraySlice(arguments, 1);
6148 queue[++counter] = function () {
6149 apply(fn, undefined, args);
6150 };
6151 defer(counter);
6152 return counter;
6153 };
6154 clear = function clearImmediate(id) {
6155 delete queue[id];
6156 };
6157 // Node.js 0.8-
6158 if (IS_NODE) {
6159 defer = function (id) {
6160 process.nextTick(runner(id));
6161 };
6162 // Sphere (JS game engine) Dispatch API
6163 } else if (Dispatch && Dispatch.now) {
6164 defer = function (id) {
6165 Dispatch.now(runner(id));
6166 };
6167 // Browsers with MessageChannel, includes WebWorkers
6168 // except iOS - https://github.com/zloirock/core-js/issues/624
6169 } else if (MessageChannel && !IS_IOS) {
6170 channel = new MessageChannel();
6171 port = channel.port2;
6172 channel.port1.onmessage = listener;
6173 defer = bind(port.postMessage, port);
6174 // Browsers with postMessage, skip WebWorkers
6175 // IE8 has postMessage, but it's sync & typeof its postMessage is 'object'
6176 } else if (
6177 global.addEventListener &&
6178 isCallable(global.postMessage) &&
6179 !global.importScripts &&
6180 location && location.protocol !== 'file:' &&
6181 !fails(post)
6182 ) {
6183 defer = post;
6184 global.addEventListener('message', listener, false);
6185 // IE8-
6186 } else if (ONREADYSTATECHANGE in createElement('script')) {
6187 defer = function (id) {
6188 html.appendChild(createElement('script'))[ONREADYSTATECHANGE] = function () {
6189 html.removeChild(this);
6190 run(id);
6191 };
6192 };
6193 // Rest old browsers
6194 } else {
6195 defer = function (id) {
6196 setTimeout(runner(id), 0);
6197 };
6198 }
6199}
6200
6201module.exports = {
6202 set: set,
6203 clear: clear
6204};
6205
6206
6207/***/ }),
6208/* 177 */
6209/***/ (function(module, exports, __webpack_require__) {
6210
6211var userAgent = __webpack_require__(98);
6212
6213module.exports = /(?:ipad|iphone|ipod).*applewebkit/i.test(userAgent);
6214
6215
6216/***/ }),
6217/* 178 */
6218/***/ (function(module, exports, __webpack_require__) {
6219
6220var NativePromiseConstructor = __webpack_require__(65);
6221var checkCorrectnessOfIteration = __webpack_require__(179);
6222var FORCED_PROMISE_CONSTRUCTOR = __webpack_require__(83).CONSTRUCTOR;
6223
6224module.exports = FORCED_PROMISE_CONSTRUCTOR || !checkCorrectnessOfIteration(function (iterable) {
6225 NativePromiseConstructor.all(iterable).then(undefined, function () { /* empty */ });
6226});
6227
6228
6229/***/ }),
6230/* 179 */
6231/***/ (function(module, exports, __webpack_require__) {
6232
6233var wellKnownSymbol = __webpack_require__(9);
6234
6235var ITERATOR = wellKnownSymbol('iterator');
6236var SAFE_CLOSING = false;
6237
6238try {
6239 var called = 0;
6240 var iteratorWithReturn = {
6241 next: function () {
6242 return { done: !!called++ };
6243 },
6244 'return': function () {
6245 SAFE_CLOSING = true;
6246 }
6247 };
6248 iteratorWithReturn[ITERATOR] = function () {
6249 return this;
6250 };
6251 // eslint-disable-next-line es-x/no-array-from, no-throw-literal -- required for testing
6252 Array.from(iteratorWithReturn, function () { throw 2; });
6253} catch (error) { /* empty */ }
6254
6255module.exports = function (exec, SKIP_CLOSING) {
6256 if (!SKIP_CLOSING && !SAFE_CLOSING) return false;
6257 var ITERATION_SUPPORT = false;
6258 try {
6259 var object = {};
6260 object[ITERATOR] = function () {
6261 return {
6262 next: function () {
6263 return { done: ITERATION_SUPPORT = true };
6264 }
6265 };
6266 };
6267 exec(object);
6268 } catch (error) { /* empty */ }
6269 return ITERATION_SUPPORT;
6270};
6271
6272
6273/***/ }),
6274/* 180 */
6275/***/ (function(module, exports, __webpack_require__) {
6276
6277var anObject = __webpack_require__(20);
6278var isObject = __webpack_require__(11);
6279var newPromiseCapability = __webpack_require__(54);
6280
6281module.exports = function (C, x) {
6282 anObject(C);
6283 if (isObject(x) && x.constructor === C) return x;
6284 var promiseCapability = newPromiseCapability.f(C);
6285 var resolve = promiseCapability.resolve;
6286 resolve(x);
6287 return promiseCapability.promise;
6288};
6289
6290
6291/***/ }),
6292/* 181 */
6293/***/ (function(module, __webpack_exports__, __webpack_require__) {
6294
6295"use strict";
6296/* harmony export (immutable) */ __webpack_exports__["a"] = isUndefined;
6297// Is a given variable undefined?
6298function isUndefined(obj) {
6299 return obj === void 0;
6300}
6301
6302
6303/***/ }),
6304/* 182 */
6305/***/ (function(module, __webpack_exports__, __webpack_require__) {
6306
6307"use strict";
6308/* harmony export (immutable) */ __webpack_exports__["a"] = isBoolean;
6309/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(6);
6310
6311
6312// Is a given value a boolean?
6313function isBoolean(obj) {
6314 return obj === true || obj === false || __WEBPACK_IMPORTED_MODULE_0__setup_js__["t" /* toString */].call(obj) === '[object Boolean]';
6315}
6316
6317
6318/***/ }),
6319/* 183 */
6320/***/ (function(module, __webpack_exports__, __webpack_require__) {
6321
6322"use strict";
6323/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(17);
6324
6325
6326/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('Number'));
6327
6328
6329/***/ }),
6330/* 184 */
6331/***/ (function(module, __webpack_exports__, __webpack_require__) {
6332
6333"use strict";
6334/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(17);
6335
6336
6337/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('Symbol'));
6338
6339
6340/***/ }),
6341/* 185 */
6342/***/ (function(module, __webpack_exports__, __webpack_require__) {
6343
6344"use strict";
6345/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(17);
6346
6347
6348/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('ArrayBuffer'));
6349
6350
6351/***/ }),
6352/* 186 */
6353/***/ (function(module, __webpack_exports__, __webpack_require__) {
6354
6355"use strict";
6356/* harmony export (immutable) */ __webpack_exports__["a"] = isNaN;
6357/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(6);
6358/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isNumber_js__ = __webpack_require__(183);
6359
6360
6361
6362// Is the given value `NaN`?
6363function isNaN(obj) {
6364 return Object(__WEBPACK_IMPORTED_MODULE_1__isNumber_js__["a" /* default */])(obj) && Object(__WEBPACK_IMPORTED_MODULE_0__setup_js__["g" /* _isNaN */])(obj);
6365}
6366
6367
6368/***/ }),
6369/* 187 */
6370/***/ (function(module, __webpack_exports__, __webpack_require__) {
6371
6372"use strict";
6373/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(6);
6374/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isDataView_js__ = __webpack_require__(135);
6375/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__constant_js__ = __webpack_require__(188);
6376/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__isBufferLike_js__ = __webpack_require__(328);
6377
6378
6379
6380
6381
6382// Is a given value a typed array?
6383var typedArrayPattern = /\[object ((I|Ui)nt(8|16|32)|Float(32|64)|Uint8Clamped|Big(I|Ui)nt64)Array\]/;
6384function isTypedArray(obj) {
6385 // `ArrayBuffer.isView` is the most future-proof, so use it when available.
6386 // Otherwise, fall back on the above regular expression.
6387 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)) :
6388 Object(__WEBPACK_IMPORTED_MODULE_3__isBufferLike_js__["a" /* default */])(obj) && typedArrayPattern.test(__WEBPACK_IMPORTED_MODULE_0__setup_js__["t" /* toString */].call(obj));
6389}
6390
6391/* 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));
6392
6393
6394/***/ }),
6395/* 188 */
6396/***/ (function(module, __webpack_exports__, __webpack_require__) {
6397
6398"use strict";
6399/* harmony export (immutable) */ __webpack_exports__["a"] = constant;
6400// Predicate-generating function. Often useful outside of Underscore.
6401function constant(value) {
6402 return function() {
6403 return value;
6404 };
6405}
6406
6407
6408/***/ }),
6409/* 189 */
6410/***/ (function(module, __webpack_exports__, __webpack_require__) {
6411
6412"use strict";
6413/* harmony export (immutable) */ __webpack_exports__["a"] = createSizePropertyCheck;
6414/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(6);
6415
6416
6417// Common internal logic for `isArrayLike` and `isBufferLike`.
6418function createSizePropertyCheck(getSizeProperty) {
6419 return function(collection) {
6420 var sizeProperty = getSizeProperty(collection);
6421 return typeof sizeProperty == 'number' && sizeProperty >= 0 && sizeProperty <= __WEBPACK_IMPORTED_MODULE_0__setup_js__["b" /* MAX_ARRAY_INDEX */];
6422 }
6423}
6424
6425
6426/***/ }),
6427/* 190 */
6428/***/ (function(module, __webpack_exports__, __webpack_require__) {
6429
6430"use strict";
6431/* harmony export (immutable) */ __webpack_exports__["a"] = shallowProperty;
6432// Internal helper to generate a function to obtain property `key` from `obj`.
6433function shallowProperty(key) {
6434 return function(obj) {
6435 return obj == null ? void 0 : obj[key];
6436 };
6437}
6438
6439
6440/***/ }),
6441/* 191 */
6442/***/ (function(module, __webpack_exports__, __webpack_require__) {
6443
6444"use strict";
6445/* harmony export (immutable) */ __webpack_exports__["a"] = collectNonEnumProps;
6446/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(6);
6447/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isFunction_js__ = __webpack_require__(28);
6448/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__has_js__ = __webpack_require__(45);
6449
6450
6451
6452
6453// Internal helper to create a simple lookup structure.
6454// `collectNonEnumProps` used to depend on `_.contains`, but this led to
6455// circular imports. `emulatedSet` is a one-off solution that only works for
6456// arrays of strings.
6457function emulatedSet(keys) {
6458 var hash = {};
6459 for (var l = keys.length, i = 0; i < l; ++i) hash[keys[i]] = true;
6460 return {
6461 contains: function(key) { return hash[key]; },
6462 push: function(key) {
6463 hash[key] = true;
6464 return keys.push(key);
6465 }
6466 };
6467}
6468
6469// Internal helper. Checks `keys` for the presence of keys in IE < 9 that won't
6470// be iterated by `for key in ...` and thus missed. Extends `keys` in place if
6471// needed.
6472function collectNonEnumProps(obj, keys) {
6473 keys = emulatedSet(keys);
6474 var nonEnumIdx = __WEBPACK_IMPORTED_MODULE_0__setup_js__["n" /* nonEnumerableProps */].length;
6475 var constructor = obj.constructor;
6476 var proto = Object(__WEBPACK_IMPORTED_MODULE_1__isFunction_js__["a" /* default */])(constructor) && constructor.prototype || __WEBPACK_IMPORTED_MODULE_0__setup_js__["c" /* ObjProto */];
6477
6478 // Constructor is a special case.
6479 var prop = 'constructor';
6480 if (Object(__WEBPACK_IMPORTED_MODULE_2__has_js__["a" /* default */])(obj, prop) && !keys.contains(prop)) keys.push(prop);
6481
6482 while (nonEnumIdx--) {
6483 prop = __WEBPACK_IMPORTED_MODULE_0__setup_js__["n" /* nonEnumerableProps */][nonEnumIdx];
6484 if (prop in obj && obj[prop] !== proto[prop] && !keys.contains(prop)) {
6485 keys.push(prop);
6486 }
6487 }
6488}
6489
6490
6491/***/ }),
6492/* 192 */
6493/***/ (function(module, __webpack_exports__, __webpack_require__) {
6494
6495"use strict";
6496/* harmony export (immutable) */ __webpack_exports__["a"] = isMatch;
6497/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__keys_js__ = __webpack_require__(16);
6498
6499
6500// Returns whether an object has a given set of `key:value` pairs.
6501function isMatch(object, attrs) {
6502 var _keys = Object(__WEBPACK_IMPORTED_MODULE_0__keys_js__["a" /* default */])(attrs), length = _keys.length;
6503 if (object == null) return !length;
6504 var obj = Object(object);
6505 for (var i = 0; i < length; i++) {
6506 var key = _keys[i];
6507 if (attrs[key] !== obj[key] || !(key in obj)) return false;
6508 }
6509 return true;
6510}
6511
6512
6513/***/ }),
6514/* 193 */
6515/***/ (function(module, __webpack_exports__, __webpack_require__) {
6516
6517"use strict";
6518/* harmony export (immutable) */ __webpack_exports__["a"] = invert;
6519/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__keys_js__ = __webpack_require__(16);
6520
6521
6522// Invert the keys and values of an object. The values must be serializable.
6523function invert(obj) {
6524 var result = {};
6525 var _keys = Object(__WEBPACK_IMPORTED_MODULE_0__keys_js__["a" /* default */])(obj);
6526 for (var i = 0, length = _keys.length; i < length; i++) {
6527 result[obj[_keys[i]]] = _keys[i];
6528 }
6529 return result;
6530}
6531
6532
6533/***/ }),
6534/* 194 */
6535/***/ (function(module, __webpack_exports__, __webpack_require__) {
6536
6537"use strict";
6538/* harmony export (immutable) */ __webpack_exports__["a"] = functions;
6539/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isFunction_js__ = __webpack_require__(28);
6540
6541
6542// Return a sorted list of the function names available on the object.
6543function functions(obj) {
6544 var names = [];
6545 for (var key in obj) {
6546 if (Object(__WEBPACK_IMPORTED_MODULE_0__isFunction_js__["a" /* default */])(obj[key])) names.push(key);
6547 }
6548 return names.sort();
6549}
6550
6551
6552/***/ }),
6553/* 195 */
6554/***/ (function(module, __webpack_exports__, __webpack_require__) {
6555
6556"use strict";
6557/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createAssigner_js__ = __webpack_require__(139);
6558/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__allKeys_js__ = __webpack_require__(85);
6559
6560
6561
6562// Extend a given object with all the properties in passed-in object(s).
6563/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createAssigner_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__allKeys_js__["a" /* default */]));
6564
6565
6566/***/ }),
6567/* 196 */
6568/***/ (function(module, __webpack_exports__, __webpack_require__) {
6569
6570"use strict";
6571/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createAssigner_js__ = __webpack_require__(139);
6572/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__allKeys_js__ = __webpack_require__(85);
6573
6574
6575
6576// Fill in a given object with default properties.
6577/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createAssigner_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__allKeys_js__["a" /* default */], true));
6578
6579
6580/***/ }),
6581/* 197 */
6582/***/ (function(module, __webpack_exports__, __webpack_require__) {
6583
6584"use strict";
6585/* harmony export (immutable) */ __webpack_exports__["a"] = baseCreate;
6586/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isObject_js__ = __webpack_require__(56);
6587/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__setup_js__ = __webpack_require__(6);
6588
6589
6590
6591// Create a naked function reference for surrogate-prototype-swapping.
6592function ctor() {
6593 return function(){};
6594}
6595
6596// An internal function for creating a new object that inherits from another.
6597function baseCreate(prototype) {
6598 if (!Object(__WEBPACK_IMPORTED_MODULE_0__isObject_js__["a" /* default */])(prototype)) return {};
6599 if (__WEBPACK_IMPORTED_MODULE_1__setup_js__["j" /* nativeCreate */]) return Object(__WEBPACK_IMPORTED_MODULE_1__setup_js__["j" /* nativeCreate */])(prototype);
6600 var Ctor = ctor();
6601 Ctor.prototype = prototype;
6602 var result = new Ctor;
6603 Ctor.prototype = null;
6604 return result;
6605}
6606
6607
6608/***/ }),
6609/* 198 */
6610/***/ (function(module, __webpack_exports__, __webpack_require__) {
6611
6612"use strict";
6613/* harmony export (immutable) */ __webpack_exports__["a"] = clone;
6614/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isObject_js__ = __webpack_require__(56);
6615/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isArray_js__ = __webpack_require__(57);
6616/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__extend_js__ = __webpack_require__(195);
6617
6618
6619
6620
6621// Create a (shallow-cloned) duplicate of an object.
6622function clone(obj) {
6623 if (!Object(__WEBPACK_IMPORTED_MODULE_0__isObject_js__["a" /* default */])(obj)) return obj;
6624 return Object(__WEBPACK_IMPORTED_MODULE_1__isArray_js__["a" /* default */])(obj) ? obj.slice() : Object(__WEBPACK_IMPORTED_MODULE_2__extend_js__["a" /* default */])({}, obj);
6625}
6626
6627
6628/***/ }),
6629/* 199 */
6630/***/ (function(module, __webpack_exports__, __webpack_require__) {
6631
6632"use strict";
6633/* harmony export (immutable) */ __webpack_exports__["a"] = get;
6634/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__toPath_js__ = __webpack_require__(86);
6635/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__deepGet_js__ = __webpack_require__(141);
6636/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__isUndefined_js__ = __webpack_require__(181);
6637
6638
6639
6640
6641// Get the value of the (deep) property on `path` from `object`.
6642// If any property in `path` does not exist or if the value is
6643// `undefined`, return `defaultValue` instead.
6644// The `path` is normalized through `_.toPath`.
6645function get(object, path, defaultValue) {
6646 var value = Object(__WEBPACK_IMPORTED_MODULE_1__deepGet_js__["a" /* default */])(object, Object(__WEBPACK_IMPORTED_MODULE_0__toPath_js__["a" /* default */])(path));
6647 return Object(__WEBPACK_IMPORTED_MODULE_2__isUndefined_js__["a" /* default */])(value) ? defaultValue : value;
6648}
6649
6650
6651/***/ }),
6652/* 200 */
6653/***/ (function(module, __webpack_exports__, __webpack_require__) {
6654
6655"use strict";
6656/* harmony export (immutable) */ __webpack_exports__["a"] = toPath;
6657/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__underscore_js__ = __webpack_require__(25);
6658/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isArray_js__ = __webpack_require__(57);
6659
6660
6661
6662// Normalize a (deep) property `path` to array.
6663// Like `_.iteratee`, this function can be customized.
6664function toPath(path) {
6665 return Object(__WEBPACK_IMPORTED_MODULE_1__isArray_js__["a" /* default */])(path) ? path : [path];
6666}
6667__WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */].toPath = toPath;
6668
6669
6670/***/ }),
6671/* 201 */
6672/***/ (function(module, __webpack_exports__, __webpack_require__) {
6673
6674"use strict";
6675/* harmony export (immutable) */ __webpack_exports__["a"] = baseIteratee;
6676/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__identity_js__ = __webpack_require__(142);
6677/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isFunction_js__ = __webpack_require__(28);
6678/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__isObject_js__ = __webpack_require__(56);
6679/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__isArray_js__ = __webpack_require__(57);
6680/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__matcher_js__ = __webpack_require__(111);
6681/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__property_js__ = __webpack_require__(143);
6682/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__optimizeCb_js__ = __webpack_require__(87);
6683
6684
6685
6686
6687
6688
6689
6690
6691// An internal function to generate callbacks that can be applied to each
6692// element in a collection, returning the desired result — either `_.identity`,
6693// an arbitrary callback, a property matcher, or a property accessor.
6694function baseIteratee(value, context, argCount) {
6695 if (value == null) return __WEBPACK_IMPORTED_MODULE_0__identity_js__["a" /* default */];
6696 if (Object(__WEBPACK_IMPORTED_MODULE_1__isFunction_js__["a" /* default */])(value)) return Object(__WEBPACK_IMPORTED_MODULE_6__optimizeCb_js__["a" /* default */])(value, context, argCount);
6697 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);
6698 return Object(__WEBPACK_IMPORTED_MODULE_5__property_js__["a" /* default */])(value);
6699}
6700
6701
6702/***/ }),
6703/* 202 */
6704/***/ (function(module, __webpack_exports__, __webpack_require__) {
6705
6706"use strict";
6707/* harmony export (immutable) */ __webpack_exports__["a"] = iteratee;
6708/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__underscore_js__ = __webpack_require__(25);
6709/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__baseIteratee_js__ = __webpack_require__(201);
6710
6711
6712
6713// External wrapper for our callback generator. Users may customize
6714// `_.iteratee` if they want additional predicate/iteratee shorthand styles.
6715// This abstraction hides the internal-only `argCount` argument.
6716function iteratee(value, context) {
6717 return Object(__WEBPACK_IMPORTED_MODULE_1__baseIteratee_js__["a" /* default */])(value, context, Infinity);
6718}
6719__WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */].iteratee = iteratee;
6720
6721
6722/***/ }),
6723/* 203 */
6724/***/ (function(module, __webpack_exports__, __webpack_require__) {
6725
6726"use strict";
6727/* harmony export (immutable) */ __webpack_exports__["a"] = noop;
6728// Predicate-generating function. Often useful outside of Underscore.
6729function noop(){}
6730
6731
6732/***/ }),
6733/* 204 */
6734/***/ (function(module, __webpack_exports__, __webpack_require__) {
6735
6736"use strict";
6737/* harmony export (immutable) */ __webpack_exports__["a"] = random;
6738// Return a random integer between `min` and `max` (inclusive).
6739function random(min, max) {
6740 if (max == null) {
6741 max = min;
6742 min = 0;
6743 }
6744 return min + Math.floor(Math.random() * (max - min + 1));
6745}
6746
6747
6748/***/ }),
6749/* 205 */
6750/***/ (function(module, __webpack_exports__, __webpack_require__) {
6751
6752"use strict";
6753/* harmony export (immutable) */ __webpack_exports__["a"] = createEscaper;
6754/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__keys_js__ = __webpack_require__(16);
6755
6756
6757// Internal helper to generate functions for escaping and unescaping strings
6758// to/from HTML interpolation.
6759function createEscaper(map) {
6760 var escaper = function(match) {
6761 return map[match];
6762 };
6763 // Regexes for identifying a key that needs to be escaped.
6764 var source = '(?:' + Object(__WEBPACK_IMPORTED_MODULE_0__keys_js__["a" /* default */])(map).join('|') + ')';
6765 var testRegexp = RegExp(source);
6766 var replaceRegexp = RegExp(source, 'g');
6767 return function(string) {
6768 string = string == null ? '' : '' + string;
6769 return testRegexp.test(string) ? string.replace(replaceRegexp, escaper) : string;
6770 };
6771}
6772
6773
6774/***/ }),
6775/* 206 */
6776/***/ (function(module, __webpack_exports__, __webpack_require__) {
6777
6778"use strict";
6779// Internal list of HTML entities for escaping.
6780/* harmony default export */ __webpack_exports__["a"] = ({
6781 '&': '&amp;',
6782 '<': '&lt;',
6783 '>': '&gt;',
6784 '"': '&quot;',
6785 "'": '&#x27;',
6786 '`': '&#x60;'
6787});
6788
6789
6790/***/ }),
6791/* 207 */
6792/***/ (function(module, __webpack_exports__, __webpack_require__) {
6793
6794"use strict";
6795/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__underscore_js__ = __webpack_require__(25);
6796
6797
6798// By default, Underscore uses ERB-style template delimiters. Change the
6799// following template settings to use alternative delimiters.
6800/* harmony default export */ __webpack_exports__["a"] = (__WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */].templateSettings = {
6801 evaluate: /<%([\s\S]+?)%>/g,
6802 interpolate: /<%=([\s\S]+?)%>/g,
6803 escape: /<%-([\s\S]+?)%>/g
6804});
6805
6806
6807/***/ }),
6808/* 208 */
6809/***/ (function(module, __webpack_exports__, __webpack_require__) {
6810
6811"use strict";
6812/* harmony export (immutable) */ __webpack_exports__["a"] = executeBound;
6813/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__baseCreate_js__ = __webpack_require__(197);
6814/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isObject_js__ = __webpack_require__(56);
6815
6816
6817
6818// Internal function to execute `sourceFunc` bound to `context` with optional
6819// `args`. Determines whether to execute a function as a constructor or as a
6820// normal function.
6821function executeBound(sourceFunc, boundFunc, context, callingContext, args) {
6822 if (!(callingContext instanceof boundFunc)) return sourceFunc.apply(context, args);
6823 var self = Object(__WEBPACK_IMPORTED_MODULE_0__baseCreate_js__["a" /* default */])(sourceFunc.prototype);
6824 var result = sourceFunc.apply(self, args);
6825 if (Object(__WEBPACK_IMPORTED_MODULE_1__isObject_js__["a" /* default */])(result)) return result;
6826 return self;
6827}
6828
6829
6830/***/ }),
6831/* 209 */
6832/***/ (function(module, __webpack_exports__, __webpack_require__) {
6833
6834"use strict";
6835/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(24);
6836/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isFunction_js__ = __webpack_require__(28);
6837/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__executeBound_js__ = __webpack_require__(208);
6838
6839
6840
6841
6842// Create a function bound to a given object (assigning `this`, and arguments,
6843// optionally).
6844/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(func, context, args) {
6845 if (!Object(__WEBPACK_IMPORTED_MODULE_1__isFunction_js__["a" /* default */])(func)) throw new TypeError('Bind must be called on a function');
6846 var bound = Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(callArgs) {
6847 return Object(__WEBPACK_IMPORTED_MODULE_2__executeBound_js__["a" /* default */])(func, bound, context, this, args.concat(callArgs));
6848 });
6849 return bound;
6850}));
6851
6852
6853/***/ }),
6854/* 210 */
6855/***/ (function(module, __webpack_exports__, __webpack_require__) {
6856
6857"use strict";
6858/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(24);
6859
6860
6861// Delays a function for the given number of milliseconds, and then calls
6862// it with the arguments supplied.
6863/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(func, wait, args) {
6864 return setTimeout(function() {
6865 return func.apply(null, args);
6866 }, wait);
6867}));
6868
6869
6870/***/ }),
6871/* 211 */
6872/***/ (function(module, __webpack_exports__, __webpack_require__) {
6873
6874"use strict";
6875/* harmony export (immutable) */ __webpack_exports__["a"] = before;
6876// Returns a function that will only be executed up to (but not including) the
6877// Nth call.
6878function before(times, func) {
6879 var memo;
6880 return function() {
6881 if (--times > 0) {
6882 memo = func.apply(this, arguments);
6883 }
6884 if (times <= 1) func = null;
6885 return memo;
6886 };
6887}
6888
6889
6890/***/ }),
6891/* 212 */
6892/***/ (function(module, __webpack_exports__, __webpack_require__) {
6893
6894"use strict";
6895/* harmony export (immutable) */ __webpack_exports__["a"] = findKey;
6896/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(21);
6897/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__keys_js__ = __webpack_require__(16);
6898
6899
6900
6901// Returns the first key on an object that passes a truth test.
6902function findKey(obj, predicate, context) {
6903 predicate = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(predicate, context);
6904 var _keys = Object(__WEBPACK_IMPORTED_MODULE_1__keys_js__["a" /* default */])(obj), key;
6905 for (var i = 0, length = _keys.length; i < length; i++) {
6906 key = _keys[i];
6907 if (predicate(obj[key], key, obj)) return key;
6908 }
6909}
6910
6911
6912/***/ }),
6913/* 213 */
6914/***/ (function(module, __webpack_exports__, __webpack_require__) {
6915
6916"use strict";
6917/* harmony export (immutable) */ __webpack_exports__["a"] = createPredicateIndexFinder;
6918/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(21);
6919/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__getLength_js__ = __webpack_require__(29);
6920
6921
6922
6923// Internal function to generate `_.findIndex` and `_.findLastIndex`.
6924function createPredicateIndexFinder(dir) {
6925 return function(array, predicate, context) {
6926 predicate = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(predicate, context);
6927 var length = Object(__WEBPACK_IMPORTED_MODULE_1__getLength_js__["a" /* default */])(array);
6928 var index = dir > 0 ? 0 : length - 1;
6929 for (; index >= 0 && index < length; index += dir) {
6930 if (predicate(array[index], index, array)) return index;
6931 }
6932 return -1;
6933 };
6934}
6935
6936
6937/***/ }),
6938/* 214 */
6939/***/ (function(module, __webpack_exports__, __webpack_require__) {
6940
6941"use strict";
6942/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createPredicateIndexFinder_js__ = __webpack_require__(213);
6943
6944
6945// Returns the last index on an array-like that passes a truth test.
6946/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createPredicateIndexFinder_js__["a" /* default */])(-1));
6947
6948
6949/***/ }),
6950/* 215 */
6951/***/ (function(module, __webpack_exports__, __webpack_require__) {
6952
6953"use strict";
6954/* harmony export (immutable) */ __webpack_exports__["a"] = sortedIndex;
6955/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(21);
6956/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__getLength_js__ = __webpack_require__(29);
6957
6958
6959
6960// Use a comparator function to figure out the smallest index at which
6961// an object should be inserted so as to maintain order. Uses binary search.
6962function sortedIndex(array, obj, iteratee, context) {
6963 iteratee = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(iteratee, context, 1);
6964 var value = iteratee(obj);
6965 var low = 0, high = Object(__WEBPACK_IMPORTED_MODULE_1__getLength_js__["a" /* default */])(array);
6966 while (low < high) {
6967 var mid = Math.floor((low + high) / 2);
6968 if (iteratee(array[mid]) < value) low = mid + 1; else high = mid;
6969 }
6970 return low;
6971}
6972
6973
6974/***/ }),
6975/* 216 */
6976/***/ (function(module, __webpack_exports__, __webpack_require__) {
6977
6978"use strict";
6979/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__sortedIndex_js__ = __webpack_require__(215);
6980/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__findIndex_js__ = __webpack_require__(146);
6981/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__createIndexFinder_js__ = __webpack_require__(217);
6982
6983
6984
6985
6986// Return the position of the first occurrence of an item in an array,
6987// or -1 if the item is not included in the array.
6988// If the array is large and already in sort order, pass `true`
6989// for **isSorted** to use binary search.
6990/* 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 */]));
6991
6992
6993/***/ }),
6994/* 217 */
6995/***/ (function(module, __webpack_exports__, __webpack_require__) {
6996
6997"use strict";
6998/* harmony export (immutable) */ __webpack_exports__["a"] = createIndexFinder;
6999/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__getLength_js__ = __webpack_require__(29);
7000/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__setup_js__ = __webpack_require__(6);
7001/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__isNaN_js__ = __webpack_require__(186);
7002
7003
7004
7005
7006// Internal function to generate the `_.indexOf` and `_.lastIndexOf` functions.
7007function createIndexFinder(dir, predicateFind, sortedIndex) {
7008 return function(array, item, idx) {
7009 var i = 0, length = Object(__WEBPACK_IMPORTED_MODULE_0__getLength_js__["a" /* default */])(array);
7010 if (typeof idx == 'number') {
7011 if (dir > 0) {
7012 i = idx >= 0 ? idx : Math.max(idx + length, i);
7013 } else {
7014 length = idx >= 0 ? Math.min(idx + 1, length) : idx + length + 1;
7015 }
7016 } else if (sortedIndex && idx && length) {
7017 idx = sortedIndex(array, item);
7018 return array[idx] === item ? idx : -1;
7019 }
7020 if (item !== item) {
7021 idx = predicateFind(__WEBPACK_IMPORTED_MODULE_1__setup_js__["q" /* slice */].call(array, i, length), __WEBPACK_IMPORTED_MODULE_2__isNaN_js__["a" /* default */]);
7022 return idx >= 0 ? idx + i : -1;
7023 }
7024 for (idx = dir > 0 ? i : length - 1; idx >= 0 && idx < length; idx += dir) {
7025 if (array[idx] === item) return idx;
7026 }
7027 return -1;
7028 };
7029}
7030
7031
7032/***/ }),
7033/* 218 */
7034/***/ (function(module, __webpack_exports__, __webpack_require__) {
7035
7036"use strict";
7037/* harmony export (immutable) */ __webpack_exports__["a"] = find;
7038/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__ = __webpack_require__(26);
7039/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__findIndex_js__ = __webpack_require__(146);
7040/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__findKey_js__ = __webpack_require__(212);
7041
7042
7043
7044
7045// Return the first value which passes a truth test.
7046function find(obj, predicate, context) {
7047 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 */];
7048 var key = keyFinder(obj, predicate, context);
7049 if (key !== void 0 && key !== -1) return obj[key];
7050}
7051
7052
7053/***/ }),
7054/* 219 */
7055/***/ (function(module, __webpack_exports__, __webpack_require__) {
7056
7057"use strict";
7058/* harmony export (immutable) */ __webpack_exports__["a"] = createReduce;
7059/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__ = __webpack_require__(26);
7060/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__keys_js__ = __webpack_require__(16);
7061/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__optimizeCb_js__ = __webpack_require__(87);
7062
7063
7064
7065
7066// Internal helper to create a reducing function, iterating left or right.
7067function createReduce(dir) {
7068 // Wrap code that reassigns argument variables in a separate function than
7069 // the one that accesses `arguments.length` to avoid a perf hit. (#1991)
7070 var reducer = function(obj, iteratee, memo, initial) {
7071 var _keys = !Object(__WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__["a" /* default */])(obj) && Object(__WEBPACK_IMPORTED_MODULE_1__keys_js__["a" /* default */])(obj),
7072 length = (_keys || obj).length,
7073 index = dir > 0 ? 0 : length - 1;
7074 if (!initial) {
7075 memo = obj[_keys ? _keys[index] : index];
7076 index += dir;
7077 }
7078 for (; index >= 0 && index < length; index += dir) {
7079 var currentKey = _keys ? _keys[index] : index;
7080 memo = iteratee(memo, obj[currentKey], currentKey, obj);
7081 }
7082 return memo;
7083 };
7084
7085 return function(obj, iteratee, memo, context) {
7086 var initial = arguments.length >= 3;
7087 return reducer(obj, Object(__WEBPACK_IMPORTED_MODULE_2__optimizeCb_js__["a" /* default */])(iteratee, context, 4), memo, initial);
7088 };
7089}
7090
7091
7092/***/ }),
7093/* 220 */
7094/***/ (function(module, __webpack_exports__, __webpack_require__) {
7095
7096"use strict";
7097/* harmony export (immutable) */ __webpack_exports__["a"] = max;
7098/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__ = __webpack_require__(26);
7099/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__values_js__ = __webpack_require__(66);
7100/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__cb_js__ = __webpack_require__(21);
7101/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__each_js__ = __webpack_require__(58);
7102
7103
7104
7105
7106
7107// Return the maximum element (or element-based computation).
7108function max(obj, iteratee, context) {
7109 var result = -Infinity, lastComputed = -Infinity,
7110 value, computed;
7111 if (iteratee == null || typeof iteratee == 'number' && typeof obj[0] != 'object' && obj != null) {
7112 obj = Object(__WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__["a" /* default */])(obj) ? obj : Object(__WEBPACK_IMPORTED_MODULE_1__values_js__["a" /* default */])(obj);
7113 for (var i = 0, length = obj.length; i < length; i++) {
7114 value = obj[i];
7115 if (value != null && value > result) {
7116 result = value;
7117 }
7118 }
7119 } else {
7120 iteratee = Object(__WEBPACK_IMPORTED_MODULE_2__cb_js__["a" /* default */])(iteratee, context);
7121 Object(__WEBPACK_IMPORTED_MODULE_3__each_js__["a" /* default */])(obj, function(v, index, list) {
7122 computed = iteratee(v, index, list);
7123 if (computed > lastComputed || computed === -Infinity && result === -Infinity) {
7124 result = v;
7125 lastComputed = computed;
7126 }
7127 });
7128 }
7129 return result;
7130}
7131
7132
7133/***/ }),
7134/* 221 */
7135/***/ (function(module, __webpack_exports__, __webpack_require__) {
7136
7137"use strict";
7138/* harmony export (immutable) */ __webpack_exports__["a"] = sample;
7139/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__ = __webpack_require__(26);
7140/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__clone_js__ = __webpack_require__(198);
7141/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__values_js__ = __webpack_require__(66);
7142/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__getLength_js__ = __webpack_require__(29);
7143/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__random_js__ = __webpack_require__(204);
7144
7145
7146
7147
7148
7149
7150// Sample **n** random values from a collection using the modern version of the
7151// [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher–Yates_shuffle).
7152// If **n** is not specified, returns a single random element.
7153// The internal `guard` argument allows it to work with `_.map`.
7154function sample(obj, n, guard) {
7155 if (n == null || guard) {
7156 if (!Object(__WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__["a" /* default */])(obj)) obj = Object(__WEBPACK_IMPORTED_MODULE_2__values_js__["a" /* default */])(obj);
7157 return obj[Object(__WEBPACK_IMPORTED_MODULE_4__random_js__["a" /* default */])(obj.length - 1)];
7158 }
7159 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);
7160 var length = Object(__WEBPACK_IMPORTED_MODULE_3__getLength_js__["a" /* default */])(sample);
7161 n = Math.max(Math.min(n, length), 0);
7162 var last = length - 1;
7163 for (var index = 0; index < n; index++) {
7164 var rand = Object(__WEBPACK_IMPORTED_MODULE_4__random_js__["a" /* default */])(index, last);
7165 var temp = sample[index];
7166 sample[index] = sample[rand];
7167 sample[rand] = temp;
7168 }
7169 return sample.slice(0, n);
7170}
7171
7172
7173/***/ }),
7174/* 222 */
7175/***/ (function(module, __webpack_exports__, __webpack_require__) {
7176
7177"use strict";
7178/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(24);
7179/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isFunction_js__ = __webpack_require__(28);
7180/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__optimizeCb_js__ = __webpack_require__(87);
7181/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__allKeys_js__ = __webpack_require__(85);
7182/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__keyInObj_js__ = __webpack_require__(377);
7183/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__flatten_js__ = __webpack_require__(67);
7184
7185
7186
7187
7188
7189
7190
7191// Return a copy of the object only containing the allowed properties.
7192/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(obj, keys) {
7193 var result = {}, iteratee = keys[0];
7194 if (obj == null) return result;
7195 if (Object(__WEBPACK_IMPORTED_MODULE_1__isFunction_js__["a" /* default */])(iteratee)) {
7196 if (keys.length > 1) iteratee = Object(__WEBPACK_IMPORTED_MODULE_2__optimizeCb_js__["a" /* default */])(iteratee, keys[1]);
7197 keys = Object(__WEBPACK_IMPORTED_MODULE_3__allKeys_js__["a" /* default */])(obj);
7198 } else {
7199 iteratee = __WEBPACK_IMPORTED_MODULE_4__keyInObj_js__["a" /* default */];
7200 keys = Object(__WEBPACK_IMPORTED_MODULE_5__flatten_js__["a" /* default */])(keys, false, false);
7201 obj = Object(obj);
7202 }
7203 for (var i = 0, length = keys.length; i < length; i++) {
7204 var key = keys[i];
7205 var value = obj[key];
7206 if (iteratee(value, key, obj)) result[key] = value;
7207 }
7208 return result;
7209}));
7210
7211
7212/***/ }),
7213/* 223 */
7214/***/ (function(module, __webpack_exports__, __webpack_require__) {
7215
7216"use strict";
7217/* harmony export (immutable) */ __webpack_exports__["a"] = initial;
7218/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(6);
7219
7220
7221// Returns everything but the last entry of the array. Especially useful on
7222// the arguments object. Passing **n** will return all the values in
7223// the array, excluding the last N.
7224function initial(array, n, guard) {
7225 return __WEBPACK_IMPORTED_MODULE_0__setup_js__["q" /* slice */].call(array, 0, Math.max(0, array.length - (n == null || guard ? 1 : n)));
7226}
7227
7228
7229/***/ }),
7230/* 224 */
7231/***/ (function(module, __webpack_exports__, __webpack_require__) {
7232
7233"use strict";
7234/* harmony export (immutable) */ __webpack_exports__["a"] = rest;
7235/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(6);
7236
7237
7238// Returns everything but the first entry of the `array`. Especially useful on
7239// the `arguments` object. Passing an **n** will return the rest N values in the
7240// `array`.
7241function rest(array, n, guard) {
7242 return __WEBPACK_IMPORTED_MODULE_0__setup_js__["q" /* slice */].call(array, n == null || guard ? 1 : n);
7243}
7244
7245
7246/***/ }),
7247/* 225 */
7248/***/ (function(module, __webpack_exports__, __webpack_require__) {
7249
7250"use strict";
7251/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(24);
7252/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__flatten_js__ = __webpack_require__(67);
7253/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__filter_js__ = __webpack_require__(88);
7254/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__contains_js__ = __webpack_require__(89);
7255
7256
7257
7258
7259
7260// Take the difference between one array and a number of other arrays.
7261// Only the elements present in just the first array will remain.
7262/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(array, rest) {
7263 rest = Object(__WEBPACK_IMPORTED_MODULE_1__flatten_js__["a" /* default */])(rest, true, true);
7264 return Object(__WEBPACK_IMPORTED_MODULE_2__filter_js__["a" /* default */])(array, function(value){
7265 return !Object(__WEBPACK_IMPORTED_MODULE_3__contains_js__["a" /* default */])(rest, value);
7266 });
7267}));
7268
7269
7270/***/ }),
7271/* 226 */
7272/***/ (function(module, __webpack_exports__, __webpack_require__) {
7273
7274"use strict";
7275/* harmony export (immutable) */ __webpack_exports__["a"] = uniq;
7276/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isBoolean_js__ = __webpack_require__(182);
7277/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__cb_js__ = __webpack_require__(21);
7278/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__getLength_js__ = __webpack_require__(29);
7279/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__contains_js__ = __webpack_require__(89);
7280
7281
7282
7283
7284
7285// Produce a duplicate-free version of the array. If the array has already
7286// been sorted, you have the option of using a faster algorithm.
7287// The faster algorithm will not work with an iteratee if the iteratee
7288// is not a one-to-one function, so providing an iteratee will disable
7289// the faster algorithm.
7290function uniq(array, isSorted, iteratee, context) {
7291 if (!Object(__WEBPACK_IMPORTED_MODULE_0__isBoolean_js__["a" /* default */])(isSorted)) {
7292 context = iteratee;
7293 iteratee = isSorted;
7294 isSorted = false;
7295 }
7296 if (iteratee != null) iteratee = Object(__WEBPACK_IMPORTED_MODULE_1__cb_js__["a" /* default */])(iteratee, context);
7297 var result = [];
7298 var seen = [];
7299 for (var i = 0, length = Object(__WEBPACK_IMPORTED_MODULE_2__getLength_js__["a" /* default */])(array); i < length; i++) {
7300 var value = array[i],
7301 computed = iteratee ? iteratee(value, i, array) : value;
7302 if (isSorted && !iteratee) {
7303 if (!i || seen !== computed) result.push(value);
7304 seen = computed;
7305 } else if (iteratee) {
7306 if (!Object(__WEBPACK_IMPORTED_MODULE_3__contains_js__["a" /* default */])(seen, computed)) {
7307 seen.push(computed);
7308 result.push(value);
7309 }
7310 } else if (!Object(__WEBPACK_IMPORTED_MODULE_3__contains_js__["a" /* default */])(result, value)) {
7311 result.push(value);
7312 }
7313 }
7314 return result;
7315}
7316
7317
7318/***/ }),
7319/* 227 */
7320/***/ (function(module, __webpack_exports__, __webpack_require__) {
7321
7322"use strict";
7323/* harmony export (immutable) */ __webpack_exports__["a"] = unzip;
7324/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__max_js__ = __webpack_require__(220);
7325/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__getLength_js__ = __webpack_require__(29);
7326/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__pluck_js__ = __webpack_require__(147);
7327
7328
7329
7330
7331// Complement of zip. Unzip accepts an array of arrays and groups
7332// each array's elements on shared indices.
7333function unzip(array) {
7334 var length = array && Object(__WEBPACK_IMPORTED_MODULE_0__max_js__["a" /* default */])(array, __WEBPACK_IMPORTED_MODULE_1__getLength_js__["a" /* default */]).length || 0;
7335 var result = Array(length);
7336
7337 for (var index = 0; index < length; index++) {
7338 result[index] = Object(__WEBPACK_IMPORTED_MODULE_2__pluck_js__["a" /* default */])(array, index);
7339 }
7340 return result;
7341}
7342
7343
7344/***/ }),
7345/* 228 */
7346/***/ (function(module, __webpack_exports__, __webpack_require__) {
7347
7348"use strict";
7349/* harmony export (immutable) */ __webpack_exports__["a"] = chainResult;
7350/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__underscore_js__ = __webpack_require__(25);
7351
7352
7353// Helper function to continue chaining intermediate results.
7354function chainResult(instance, obj) {
7355 return instance._chain ? Object(__WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */])(obj).chain() : obj;
7356}
7357
7358
7359/***/ }),
7360/* 229 */
7361/***/ (function(module, exports, __webpack_require__) {
7362
7363"use strict";
7364
7365var $ = __webpack_require__(0);
7366var fails = __webpack_require__(2);
7367var isArray = __webpack_require__(90);
7368var isObject = __webpack_require__(11);
7369var toObject = __webpack_require__(34);
7370var lengthOfArrayLike = __webpack_require__(41);
7371var doesNotExceedSafeInteger = __webpack_require__(395);
7372var createProperty = __webpack_require__(91);
7373var arraySpeciesCreate = __webpack_require__(230);
7374var arrayMethodHasSpeciesSupport = __webpack_require__(114);
7375var wellKnownSymbol = __webpack_require__(9);
7376var V8_VERSION = __webpack_require__(77);
7377
7378var IS_CONCAT_SPREADABLE = wellKnownSymbol('isConcatSpreadable');
7379
7380// We can't use this feature detection in V8 since it causes
7381// deoptimization and serious performance degradation
7382// https://github.com/zloirock/core-js/issues/679
7383var IS_CONCAT_SPREADABLE_SUPPORT = V8_VERSION >= 51 || !fails(function () {
7384 var array = [];
7385 array[IS_CONCAT_SPREADABLE] = false;
7386 return array.concat()[0] !== array;
7387});
7388
7389var SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('concat');
7390
7391var isConcatSpreadable = function (O) {
7392 if (!isObject(O)) return false;
7393 var spreadable = O[IS_CONCAT_SPREADABLE];
7394 return spreadable !== undefined ? !!spreadable : isArray(O);
7395};
7396
7397var FORCED = !IS_CONCAT_SPREADABLE_SUPPORT || !SPECIES_SUPPORT;
7398
7399// `Array.prototype.concat` method
7400// https://tc39.es/ecma262/#sec-array.prototype.concat
7401// with adding support of @@isConcatSpreadable and @@species
7402$({ target: 'Array', proto: true, arity: 1, forced: FORCED }, {
7403 // eslint-disable-next-line no-unused-vars -- required for `.length`
7404 concat: function concat(arg) {
7405 var O = toObject(this);
7406 var A = arraySpeciesCreate(O, 0);
7407 var n = 0;
7408 var i, k, length, len, E;
7409 for (i = -1, length = arguments.length; i < length; i++) {
7410 E = i === -1 ? O : arguments[i];
7411 if (isConcatSpreadable(E)) {
7412 len = lengthOfArrayLike(E);
7413 doesNotExceedSafeInteger(n + len);
7414 for (k = 0; k < len; k++, n++) if (k in E) createProperty(A, n, E[k]);
7415 } else {
7416 doesNotExceedSafeInteger(n + 1);
7417 createProperty(A, n++, E);
7418 }
7419 }
7420 A.length = n;
7421 return A;
7422 }
7423});
7424
7425
7426/***/ }),
7427/* 230 */
7428/***/ (function(module, exports, __webpack_require__) {
7429
7430var arraySpeciesConstructor = __webpack_require__(396);
7431
7432// `ArraySpeciesCreate` abstract operation
7433// https://tc39.es/ecma262/#sec-arrayspeciescreate
7434module.exports = function (originalArray, length) {
7435 return new (arraySpeciesConstructor(originalArray))(length === 0 ? 0 : length);
7436};
7437
7438
7439/***/ }),
7440/* 231 */
7441/***/ (function(module, exports, __webpack_require__) {
7442
7443var $ = __webpack_require__(0);
7444var getBuiltIn = __webpack_require__(18);
7445var apply = __webpack_require__(75);
7446var call = __webpack_require__(15);
7447var uncurryThis = __webpack_require__(4);
7448var fails = __webpack_require__(2);
7449var isArray = __webpack_require__(90);
7450var isCallable = __webpack_require__(8);
7451var isObject = __webpack_require__(11);
7452var isSymbol = __webpack_require__(97);
7453var arraySlice = __webpack_require__(110);
7454var NATIVE_SYMBOL = __webpack_require__(64);
7455
7456var $stringify = getBuiltIn('JSON', 'stringify');
7457var exec = uncurryThis(/./.exec);
7458var charAt = uncurryThis(''.charAt);
7459var charCodeAt = uncurryThis(''.charCodeAt);
7460var replace = uncurryThis(''.replace);
7461var numberToString = uncurryThis(1.0.toString);
7462
7463var tester = /[\uD800-\uDFFF]/g;
7464var low = /^[\uD800-\uDBFF]$/;
7465var hi = /^[\uDC00-\uDFFF]$/;
7466
7467var WRONG_SYMBOLS_CONVERSION = !NATIVE_SYMBOL || fails(function () {
7468 var symbol = getBuiltIn('Symbol')();
7469 // MS Edge converts symbol values to JSON as {}
7470 return $stringify([symbol]) != '[null]'
7471 // WebKit converts symbol values to JSON as null
7472 || $stringify({ a: symbol }) != '{}'
7473 // V8 throws on boxed symbols
7474 || $stringify(Object(symbol)) != '{}';
7475});
7476
7477// https://github.com/tc39/proposal-well-formed-stringify
7478var ILL_FORMED_UNICODE = fails(function () {
7479 return $stringify('\uDF06\uD834') !== '"\\udf06\\ud834"'
7480 || $stringify('\uDEAD') !== '"\\udead"';
7481});
7482
7483var stringifyWithSymbolsFix = function (it, replacer) {
7484 var args = arraySlice(arguments);
7485 var $replacer = replacer;
7486 if (!isObject(replacer) && it === undefined || isSymbol(it)) return; // IE8 returns string on undefined
7487 if (!isArray(replacer)) replacer = function (key, value) {
7488 if (isCallable($replacer)) value = call($replacer, this, key, value);
7489 if (!isSymbol(value)) return value;
7490 };
7491 args[1] = replacer;
7492 return apply($stringify, null, args);
7493};
7494
7495var fixIllFormed = function (match, offset, string) {
7496 var prev = charAt(string, offset - 1);
7497 var next = charAt(string, offset + 1);
7498 if ((exec(low, match) && !exec(hi, next)) || (exec(hi, match) && !exec(low, prev))) {
7499 return '\\u' + numberToString(charCodeAt(match, 0), 16);
7500 } return match;
7501};
7502
7503if ($stringify) {
7504 // `JSON.stringify` method
7505 // https://tc39.es/ecma262/#sec-json.stringify
7506 $({ target: 'JSON', stat: true, arity: 3, forced: WRONG_SYMBOLS_CONVERSION || ILL_FORMED_UNICODE }, {
7507 // eslint-disable-next-line no-unused-vars -- required for `.length`
7508 stringify: function stringify(it, replacer, space) {
7509 var args = arraySlice(arguments);
7510 var result = apply(WRONG_SYMBOLS_CONVERSION ? stringifyWithSymbolsFix : $stringify, null, args);
7511 return ILL_FORMED_UNICODE && typeof result == 'string' ? replace(result, tester, fixIllFormed) : result;
7512 }
7513 });
7514}
7515
7516
7517/***/ }),
7518/* 232 */
7519/***/ (function(module, exports, __webpack_require__) {
7520
7521"use strict";
7522
7523var fails = __webpack_require__(2);
7524
7525module.exports = function (METHOD_NAME, argument) {
7526 var method = [][METHOD_NAME];
7527 return !!method && fails(function () {
7528 // eslint-disable-next-line no-useless-call -- required for testing
7529 method.call(null, argument || function () { return 1; }, 1);
7530 });
7531};
7532
7533
7534/***/ }),
7535/* 233 */
7536/***/ (function(module, exports, __webpack_require__) {
7537
7538var rng = __webpack_require__(413);
7539var bytesToUuid = __webpack_require__(414);
7540
7541function v4(options, buf, offset) {
7542 var i = buf && offset || 0;
7543
7544 if (typeof(options) == 'string') {
7545 buf = options === 'binary' ? new Array(16) : null;
7546 options = null;
7547 }
7548 options = options || {};
7549
7550 var rnds = options.random || (options.rng || rng)();
7551
7552 // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
7553 rnds[6] = (rnds[6] & 0x0f) | 0x40;
7554 rnds[8] = (rnds[8] & 0x3f) | 0x80;
7555
7556 // Copy bytes to buffer, if provided
7557 if (buf) {
7558 for (var ii = 0; ii < 16; ++ii) {
7559 buf[i + ii] = rnds[ii];
7560 }
7561 }
7562
7563 return buf || bytesToUuid(rnds);
7564}
7565
7566module.exports = v4;
7567
7568
7569/***/ }),
7570/* 234 */
7571/***/ (function(module, exports, __webpack_require__) {
7572
7573var parent = __webpack_require__(417);
7574
7575module.exports = parent;
7576
7577
7578/***/ }),
7579/* 235 */
7580/***/ (function(module, exports, __webpack_require__) {
7581
7582"use strict";
7583
7584
7585module.exports = '4.15.2';
7586
7587/***/ }),
7588/* 236 */
7589/***/ (function(module, exports, __webpack_require__) {
7590
7591"use strict";
7592
7593
7594var has = Object.prototype.hasOwnProperty
7595 , prefix = '~';
7596
7597/**
7598 * Constructor to create a storage for our `EE` objects.
7599 * An `Events` instance is a plain object whose properties are event names.
7600 *
7601 * @constructor
7602 * @api private
7603 */
7604function Events() {}
7605
7606//
7607// We try to not inherit from `Object.prototype`. In some engines creating an
7608// instance in this way is faster than calling `Object.create(null)` directly.
7609// If `Object.create(null)` is not supported we prefix the event names with a
7610// character to make sure that the built-in object properties are not
7611// overridden or used as an attack vector.
7612//
7613if (Object.create) {
7614 Events.prototype = Object.create(null);
7615
7616 //
7617 // This hack is needed because the `__proto__` property is still inherited in
7618 // some old browsers like Android 4, iPhone 5.1, Opera 11 and Safari 5.
7619 //
7620 if (!new Events().__proto__) prefix = false;
7621}
7622
7623/**
7624 * Representation of a single event listener.
7625 *
7626 * @param {Function} fn The listener function.
7627 * @param {Mixed} context The context to invoke the listener with.
7628 * @param {Boolean} [once=false] Specify if the listener is a one-time listener.
7629 * @constructor
7630 * @api private
7631 */
7632function EE(fn, context, once) {
7633 this.fn = fn;
7634 this.context = context;
7635 this.once = once || false;
7636}
7637
7638/**
7639 * Minimal `EventEmitter` interface that is molded against the Node.js
7640 * `EventEmitter` interface.
7641 *
7642 * @constructor
7643 * @api public
7644 */
7645function EventEmitter() {
7646 this._events = new Events();
7647 this._eventsCount = 0;
7648}
7649
7650/**
7651 * Return an array listing the events for which the emitter has registered
7652 * listeners.
7653 *
7654 * @returns {Array}
7655 * @api public
7656 */
7657EventEmitter.prototype.eventNames = function eventNames() {
7658 var names = []
7659 , events
7660 , name;
7661
7662 if (this._eventsCount === 0) return names;
7663
7664 for (name in (events = this._events)) {
7665 if (has.call(events, name)) names.push(prefix ? name.slice(1) : name);
7666 }
7667
7668 if (Object.getOwnPropertySymbols) {
7669 return names.concat(Object.getOwnPropertySymbols(events));
7670 }
7671
7672 return names;
7673};
7674
7675/**
7676 * Return the listeners registered for a given event.
7677 *
7678 * @param {String|Symbol} event The event name.
7679 * @param {Boolean} exists Only check if there are listeners.
7680 * @returns {Array|Boolean}
7681 * @api public
7682 */
7683EventEmitter.prototype.listeners = function listeners(event, exists) {
7684 var evt = prefix ? prefix + event : event
7685 , available = this._events[evt];
7686
7687 if (exists) return !!available;
7688 if (!available) return [];
7689 if (available.fn) return [available.fn];
7690
7691 for (var i = 0, l = available.length, ee = new Array(l); i < l; i++) {
7692 ee[i] = available[i].fn;
7693 }
7694
7695 return ee;
7696};
7697
7698/**
7699 * Calls each of the listeners registered for a given event.
7700 *
7701 * @param {String|Symbol} event The event name.
7702 * @returns {Boolean} `true` if the event had listeners, else `false`.
7703 * @api public
7704 */
7705EventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {
7706 var evt = prefix ? prefix + event : event;
7707
7708 if (!this._events[evt]) return false;
7709
7710 var listeners = this._events[evt]
7711 , len = arguments.length
7712 , args
7713 , i;
7714
7715 if (listeners.fn) {
7716 if (listeners.once) this.removeListener(event, listeners.fn, undefined, true);
7717
7718 switch (len) {
7719 case 1: return listeners.fn.call(listeners.context), true;
7720 case 2: return listeners.fn.call(listeners.context, a1), true;
7721 case 3: return listeners.fn.call(listeners.context, a1, a2), true;
7722 case 4: return listeners.fn.call(listeners.context, a1, a2, a3), true;
7723 case 5: return listeners.fn.call(listeners.context, a1, a2, a3, a4), true;
7724 case 6: return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true;
7725 }
7726
7727 for (i = 1, args = new Array(len -1); i < len; i++) {
7728 args[i - 1] = arguments[i];
7729 }
7730
7731 listeners.fn.apply(listeners.context, args);
7732 } else {
7733 var length = listeners.length
7734 , j;
7735
7736 for (i = 0; i < length; i++) {
7737 if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true);
7738
7739 switch (len) {
7740 case 1: listeners[i].fn.call(listeners[i].context); break;
7741 case 2: listeners[i].fn.call(listeners[i].context, a1); break;
7742 case 3: listeners[i].fn.call(listeners[i].context, a1, a2); break;
7743 case 4: listeners[i].fn.call(listeners[i].context, a1, a2, a3); break;
7744 default:
7745 if (!args) for (j = 1, args = new Array(len -1); j < len; j++) {
7746 args[j - 1] = arguments[j];
7747 }
7748
7749 listeners[i].fn.apply(listeners[i].context, args);
7750 }
7751 }
7752 }
7753
7754 return true;
7755};
7756
7757/**
7758 * Add a listener for a given event.
7759 *
7760 * @param {String|Symbol} event The event name.
7761 * @param {Function} fn The listener function.
7762 * @param {Mixed} [context=this] The context to invoke the listener with.
7763 * @returns {EventEmitter} `this`.
7764 * @api public
7765 */
7766EventEmitter.prototype.on = function on(event, fn, context) {
7767 var listener = new EE(fn, context || this)
7768 , evt = prefix ? prefix + event : event;
7769
7770 if (!this._events[evt]) this._events[evt] = listener, this._eventsCount++;
7771 else if (!this._events[evt].fn) this._events[evt].push(listener);
7772 else this._events[evt] = [this._events[evt], listener];
7773
7774 return this;
7775};
7776
7777/**
7778 * Add a one-time listener for a given event.
7779 *
7780 * @param {String|Symbol} event The event name.
7781 * @param {Function} fn The listener function.
7782 * @param {Mixed} [context=this] The context to invoke the listener with.
7783 * @returns {EventEmitter} `this`.
7784 * @api public
7785 */
7786EventEmitter.prototype.once = function once(event, fn, context) {
7787 var listener = new EE(fn, context || this, true)
7788 , evt = prefix ? prefix + event : event;
7789
7790 if (!this._events[evt]) this._events[evt] = listener, this._eventsCount++;
7791 else if (!this._events[evt].fn) this._events[evt].push(listener);
7792 else this._events[evt] = [this._events[evt], listener];
7793
7794 return this;
7795};
7796
7797/**
7798 * Remove the listeners of a given event.
7799 *
7800 * @param {String|Symbol} event The event name.
7801 * @param {Function} fn Only remove the listeners that match this function.
7802 * @param {Mixed} context Only remove the listeners that have this context.
7803 * @param {Boolean} once Only remove one-time listeners.
7804 * @returns {EventEmitter} `this`.
7805 * @api public
7806 */
7807EventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) {
7808 var evt = prefix ? prefix + event : event;
7809
7810 if (!this._events[evt]) return this;
7811 if (!fn) {
7812 if (--this._eventsCount === 0) this._events = new Events();
7813 else delete this._events[evt];
7814 return this;
7815 }
7816
7817 var listeners = this._events[evt];
7818
7819 if (listeners.fn) {
7820 if (
7821 listeners.fn === fn
7822 && (!once || listeners.once)
7823 && (!context || listeners.context === context)
7824 ) {
7825 if (--this._eventsCount === 0) this._events = new Events();
7826 else delete this._events[evt];
7827 }
7828 } else {
7829 for (var i = 0, events = [], length = listeners.length; i < length; i++) {
7830 if (
7831 listeners[i].fn !== fn
7832 || (once && !listeners[i].once)
7833 || (context && listeners[i].context !== context)
7834 ) {
7835 events.push(listeners[i]);
7836 }
7837 }
7838
7839 //
7840 // Reset the array, or remove it completely if we have no more listeners.
7841 //
7842 if (events.length) this._events[evt] = events.length === 1 ? events[0] : events;
7843 else if (--this._eventsCount === 0) this._events = new Events();
7844 else delete this._events[evt];
7845 }
7846
7847 return this;
7848};
7849
7850/**
7851 * Remove all listeners, or those of the specified event.
7852 *
7853 * @param {String|Symbol} [event] The event name.
7854 * @returns {EventEmitter} `this`.
7855 * @api public
7856 */
7857EventEmitter.prototype.removeAllListeners = function removeAllListeners(event) {
7858 var evt;
7859
7860 if (event) {
7861 evt = prefix ? prefix + event : event;
7862 if (this._events[evt]) {
7863 if (--this._eventsCount === 0) this._events = new Events();
7864 else delete this._events[evt];
7865 }
7866 } else {
7867 this._events = new Events();
7868 this._eventsCount = 0;
7869 }
7870
7871 return this;
7872};
7873
7874//
7875// Alias methods names because people roll like that.
7876//
7877EventEmitter.prototype.off = EventEmitter.prototype.removeListener;
7878EventEmitter.prototype.addListener = EventEmitter.prototype.on;
7879
7880//
7881// This function doesn't apply anymore.
7882//
7883EventEmitter.prototype.setMaxListeners = function setMaxListeners() {
7884 return this;
7885};
7886
7887//
7888// Expose the prefix.
7889//
7890EventEmitter.prefixed = prefix;
7891
7892//
7893// Allow `EventEmitter` to be imported as module namespace.
7894//
7895EventEmitter.EventEmitter = EventEmitter;
7896
7897//
7898// Expose the module.
7899//
7900if (true) {
7901 module.exports = EventEmitter;
7902}
7903
7904
7905/***/ }),
7906/* 237 */
7907/***/ (function(module, exports, __webpack_require__) {
7908
7909"use strict";
7910
7911
7912var _interopRequireDefault = __webpack_require__(1);
7913
7914var _promise = _interopRequireDefault(__webpack_require__(12));
7915
7916var _require = __webpack_require__(72),
7917 getAdapter = _require.getAdapter;
7918
7919var syncApiNames = ['getItem', 'setItem', 'removeItem', 'clear'];
7920var localStorage = {
7921 get async() {
7922 return getAdapter('storage').async;
7923 }
7924
7925}; // wrap sync apis with async ones.
7926
7927syncApiNames.forEach(function (apiName) {
7928 localStorage[apiName + 'Async'] = function () {
7929 var storage = getAdapter('storage');
7930 return _promise.default.resolve(storage[apiName].apply(storage, arguments));
7931 };
7932
7933 localStorage[apiName] = function () {
7934 var storage = getAdapter('storage');
7935
7936 if (!storage.async) {
7937 return storage[apiName].apply(storage, arguments);
7938 }
7939
7940 var error = new Error('Synchronous API [' + apiName + '] is not available in this runtime.');
7941 error.code = 'SYNC_API_NOT_AVAILABLE';
7942 throw error;
7943 };
7944});
7945module.exports = localStorage;
7946
7947/***/ }),
7948/* 238 */
7949/***/ (function(module, exports, __webpack_require__) {
7950
7951"use strict";
7952
7953
7954var _interopRequireDefault = __webpack_require__(1);
7955
7956var _concat = _interopRequireDefault(__webpack_require__(22));
7957
7958var _stringify = _interopRequireDefault(__webpack_require__(36));
7959
7960var storage = __webpack_require__(237);
7961
7962var AV = __webpack_require__(69);
7963
7964var removeAsync = exports.removeAsync = storage.removeItemAsync.bind(storage);
7965
7966var getCacheData = function getCacheData(cacheData, key) {
7967 try {
7968 cacheData = JSON.parse(cacheData);
7969 } catch (e) {
7970 return null;
7971 }
7972
7973 if (cacheData) {
7974 var expired = cacheData.expiredAt && cacheData.expiredAt < Date.now();
7975
7976 if (!expired) {
7977 return cacheData.value;
7978 }
7979
7980 return removeAsync(key).then(function () {
7981 return null;
7982 });
7983 }
7984
7985 return null;
7986};
7987
7988exports.getAsync = function (key) {
7989 var _context;
7990
7991 key = (0, _concat.default)(_context = "AV/".concat(AV.applicationId, "/")).call(_context, key);
7992 return storage.getItemAsync(key).then(function (cache) {
7993 return getCacheData(cache, key);
7994 });
7995};
7996
7997exports.setAsync = function (key, value, ttl) {
7998 var _context2;
7999
8000 var cache = {
8001 value: value
8002 };
8003
8004 if (typeof ttl === 'number') {
8005 cache.expiredAt = Date.now() + ttl;
8006 }
8007
8008 return storage.setItemAsync((0, _concat.default)(_context2 = "AV/".concat(AV.applicationId, "/")).call(_context2, key), (0, _stringify.default)(cache));
8009};
8010
8011/***/ }),
8012/* 239 */
8013/***/ (function(module, exports, __webpack_require__) {
8014
8015module.exports = __webpack_require__(240);
8016
8017/***/ }),
8018/* 240 */
8019/***/ (function(module, exports, __webpack_require__) {
8020
8021var parent = __webpack_require__(419);
8022
8023module.exports = parent;
8024
8025
8026/***/ }),
8027/* 241 */
8028/***/ (function(module, exports, __webpack_require__) {
8029
8030var parent = __webpack_require__(422);
8031
8032module.exports = parent;
8033
8034
8035/***/ }),
8036/* 242 */
8037/***/ (function(module, exports, __webpack_require__) {
8038
8039var parent = __webpack_require__(425);
8040
8041module.exports = parent;
8042
8043
8044/***/ }),
8045/* 243 */
8046/***/ (function(module, exports, __webpack_require__) {
8047
8048module.exports = __webpack_require__(428);
8049
8050/***/ }),
8051/* 244 */
8052/***/ (function(module, exports, __webpack_require__) {
8053
8054var parent = __webpack_require__(431);
8055__webpack_require__(39);
8056
8057module.exports = parent;
8058
8059
8060/***/ }),
8061/* 245 */
8062/***/ (function(module, exports, __webpack_require__) {
8063
8064// TODO: Remove this module from `core-js@4` since it's split to modules listed below
8065__webpack_require__(432);
8066__webpack_require__(434);
8067__webpack_require__(435);
8068__webpack_require__(231);
8069__webpack_require__(436);
8070
8071
8072/***/ }),
8073/* 246 */
8074/***/ (function(module, exports, __webpack_require__) {
8075
8076/* eslint-disable es-x/no-object-getownpropertynames -- safe */
8077var classof = __webpack_require__(63);
8078var toIndexedObject = __webpack_require__(32);
8079var $getOwnPropertyNames = __webpack_require__(103).f;
8080var arraySlice = __webpack_require__(433);
8081
8082var windowNames = typeof window == 'object' && window && Object.getOwnPropertyNames
8083 ? Object.getOwnPropertyNames(window) : [];
8084
8085var getWindowNames = function (it) {
8086 try {
8087 return $getOwnPropertyNames(it);
8088 } catch (error) {
8089 return arraySlice(windowNames);
8090 }
8091};
8092
8093// fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window
8094module.exports.f = function getOwnPropertyNames(it) {
8095 return windowNames && classof(it) == 'Window'
8096 ? getWindowNames(it)
8097 : $getOwnPropertyNames(toIndexedObject(it));
8098};
8099
8100
8101/***/ }),
8102/* 247 */
8103/***/ (function(module, exports, __webpack_require__) {
8104
8105var call = __webpack_require__(15);
8106var getBuiltIn = __webpack_require__(18);
8107var wellKnownSymbol = __webpack_require__(9);
8108var defineBuiltIn = __webpack_require__(44);
8109
8110module.exports = function () {
8111 var Symbol = getBuiltIn('Symbol');
8112 var SymbolPrototype = Symbol && Symbol.prototype;
8113 var valueOf = SymbolPrototype && SymbolPrototype.valueOf;
8114 var TO_PRIMITIVE = wellKnownSymbol('toPrimitive');
8115
8116 if (SymbolPrototype && !SymbolPrototype[TO_PRIMITIVE]) {
8117 // `Symbol.prototype[@@toPrimitive]` method
8118 // https://tc39.es/ecma262/#sec-symbol.prototype-@@toprimitive
8119 // eslint-disable-next-line no-unused-vars -- required for .length
8120 defineBuiltIn(SymbolPrototype, TO_PRIMITIVE, function (hint) {
8121 return call(valueOf, this);
8122 }, { arity: 1 });
8123 }
8124};
8125
8126
8127/***/ }),
8128/* 248 */
8129/***/ (function(module, exports, __webpack_require__) {
8130
8131var NATIVE_SYMBOL = __webpack_require__(64);
8132
8133/* eslint-disable es-x/no-symbol -- safe */
8134module.exports = NATIVE_SYMBOL && !!Symbol['for'] && !!Symbol.keyFor;
8135
8136
8137/***/ }),
8138/* 249 */
8139/***/ (function(module, exports, __webpack_require__) {
8140
8141var defineWellKnownSymbol = __webpack_require__(10);
8142
8143// `Symbol.iterator` well-known symbol
8144// https://tc39.es/ecma262/#sec-symbol.iterator
8145defineWellKnownSymbol('iterator');
8146
8147
8148/***/ }),
8149/* 250 */
8150/***/ (function(module, exports, __webpack_require__) {
8151
8152var parent = __webpack_require__(465);
8153__webpack_require__(39);
8154
8155module.exports = parent;
8156
8157
8158/***/ }),
8159/* 251 */
8160/***/ (function(module, exports, __webpack_require__) {
8161
8162module.exports = __webpack_require__(466);
8163
8164/***/ }),
8165/* 252 */
8166/***/ (function(module, exports, __webpack_require__) {
8167
8168"use strict";
8169// Copyright (c) 2015-2017 David M. Lee, II
8170
8171
8172/**
8173 * Local reference to TimeoutError
8174 * @private
8175 */
8176var TimeoutError;
8177
8178/**
8179 * Rejects a promise with a {@link TimeoutError} if it does not settle within
8180 * the specified timeout.
8181 *
8182 * @param {Promise} promise The promise.
8183 * @param {number} timeoutMillis Number of milliseconds to wait on settling.
8184 * @returns {Promise} Either resolves/rejects with `promise`, or rejects with
8185 * `TimeoutError`, whichever settles first.
8186 */
8187var timeout = module.exports.timeout = function(promise, timeoutMillis) {
8188 var error = new TimeoutError(),
8189 timeout;
8190
8191 return Promise.race([
8192 promise,
8193 new Promise(function(resolve, reject) {
8194 timeout = setTimeout(function() {
8195 reject(error);
8196 }, timeoutMillis);
8197 }),
8198 ]).then(function(v) {
8199 clearTimeout(timeout);
8200 return v;
8201 }, function(err) {
8202 clearTimeout(timeout);
8203 throw err;
8204 });
8205};
8206
8207/**
8208 * Exception indicating that the timeout expired.
8209 */
8210TimeoutError = module.exports.TimeoutError = function() {
8211 Error.call(this)
8212 this.stack = Error().stack
8213 this.message = 'Timeout';
8214};
8215
8216TimeoutError.prototype = Object.create(Error.prototype);
8217TimeoutError.prototype.name = "TimeoutError";
8218
8219
8220/***/ }),
8221/* 253 */
8222/***/ (function(module, exports, __webpack_require__) {
8223
8224module.exports = __webpack_require__(254);
8225
8226/***/ }),
8227/* 254 */
8228/***/ (function(module, exports, __webpack_require__) {
8229
8230var parent = __webpack_require__(482);
8231
8232module.exports = parent;
8233
8234
8235/***/ }),
8236/* 255 */
8237/***/ (function(module, exports, __webpack_require__) {
8238
8239module.exports = __webpack_require__(486);
8240
8241/***/ }),
8242/* 256 */
8243/***/ (function(module, exports, __webpack_require__) {
8244
8245"use strict";
8246
8247var uncurryThis = __webpack_require__(4);
8248var aCallable = __webpack_require__(31);
8249var isObject = __webpack_require__(11);
8250var hasOwn = __webpack_require__(13);
8251var arraySlice = __webpack_require__(110);
8252var NATIVE_BIND = __webpack_require__(76);
8253
8254var $Function = Function;
8255var concat = uncurryThis([].concat);
8256var join = uncurryThis([].join);
8257var factories = {};
8258
8259var construct = function (C, argsLength, args) {
8260 if (!hasOwn(factories, argsLength)) {
8261 for (var list = [], i = 0; i < argsLength; i++) list[i] = 'a[' + i + ']';
8262 factories[argsLength] = $Function('C,a', 'return new C(' + join(list, ',') + ')');
8263 } return factories[argsLength](C, args);
8264};
8265
8266// `Function.prototype.bind` method implementation
8267// https://tc39.es/ecma262/#sec-function.prototype.bind
8268module.exports = NATIVE_BIND ? $Function.bind : function bind(that /* , ...args */) {
8269 var F = aCallable(this);
8270 var Prototype = F.prototype;
8271 var partArgs = arraySlice(arguments, 1);
8272 var boundFunction = function bound(/* args... */) {
8273 var args = concat(partArgs, arraySlice(arguments));
8274 return this instanceof boundFunction ? construct(F, args.length, args) : F.apply(that, args);
8275 };
8276 if (isObject(Prototype)) boundFunction.prototype = Prototype;
8277 return boundFunction;
8278};
8279
8280
8281/***/ }),
8282/* 257 */
8283/***/ (function(module, exports, __webpack_require__) {
8284
8285module.exports = __webpack_require__(507);
8286
8287/***/ }),
8288/* 258 */
8289/***/ (function(module, exports, __webpack_require__) {
8290
8291module.exports = __webpack_require__(510);
8292
8293/***/ }),
8294/* 259 */
8295/***/ (function(module, exports) {
8296
8297var charenc = {
8298 // UTF-8 encoding
8299 utf8: {
8300 // Convert a string to a byte array
8301 stringToBytes: function(str) {
8302 return charenc.bin.stringToBytes(unescape(encodeURIComponent(str)));
8303 },
8304
8305 // Convert a byte array to a string
8306 bytesToString: function(bytes) {
8307 return decodeURIComponent(escape(charenc.bin.bytesToString(bytes)));
8308 }
8309 },
8310
8311 // Binary encoding
8312 bin: {
8313 // Convert a string to a byte array
8314 stringToBytes: function(str) {
8315 for (var bytes = [], i = 0; i < str.length; i++)
8316 bytes.push(str.charCodeAt(i) & 0xFF);
8317 return bytes;
8318 },
8319
8320 // Convert a byte array to a string
8321 bytesToString: function(bytes) {
8322 for (var str = [], i = 0; i < bytes.length; i++)
8323 str.push(String.fromCharCode(bytes[i]));
8324 return str.join('');
8325 }
8326 }
8327};
8328
8329module.exports = charenc;
8330
8331
8332/***/ }),
8333/* 260 */
8334/***/ (function(module, exports, __webpack_require__) {
8335
8336"use strict";
8337
8338
8339var adapters = __webpack_require__(571);
8340
8341module.exports = function (AV) {
8342 AV.setAdapters(adapters);
8343 return AV;
8344};
8345
8346/***/ }),
8347/* 261 */
8348/***/ (function(module, exports, __webpack_require__) {
8349
8350module.exports = __webpack_require__(579);
8351
8352/***/ }),
8353/* 262 */
8354/***/ (function(module, exports, __webpack_require__) {
8355
8356var fails = __webpack_require__(2);
8357var isObject = __webpack_require__(11);
8358var classof = __webpack_require__(63);
8359var ARRAY_BUFFER_NON_EXTENSIBLE = __webpack_require__(583);
8360
8361// eslint-disable-next-line es-x/no-object-isextensible -- safe
8362var $isExtensible = Object.isExtensible;
8363var FAILS_ON_PRIMITIVES = fails(function () { $isExtensible(1); });
8364
8365// `Object.isExtensible` method
8366// https://tc39.es/ecma262/#sec-object.isextensible
8367module.exports = (FAILS_ON_PRIMITIVES || ARRAY_BUFFER_NON_EXTENSIBLE) ? function isExtensible(it) {
8368 if (!isObject(it)) return false;
8369 if (ARRAY_BUFFER_NON_EXTENSIBLE && classof(it) == 'ArrayBuffer') return false;
8370 return $isExtensible ? $isExtensible(it) : true;
8371} : $isExtensible;
8372
8373
8374/***/ }),
8375/* 263 */
8376/***/ (function(module, exports, __webpack_require__) {
8377
8378var fails = __webpack_require__(2);
8379
8380module.exports = !fails(function () {
8381 // eslint-disable-next-line es-x/no-object-isextensible, es-x/no-object-preventextensions -- required for testing
8382 return Object.isExtensible(Object.preventExtensions({}));
8383});
8384
8385
8386/***/ }),
8387/* 264 */
8388/***/ (function(module, exports, __webpack_require__) {
8389
8390"use strict";
8391
8392var defineProperty = __webpack_require__(23).f;
8393var create = __webpack_require__(49);
8394var defineBuiltIns = __webpack_require__(155);
8395var bind = __webpack_require__(48);
8396var anInstance = __webpack_require__(108);
8397var iterate = __webpack_require__(42);
8398var defineIterator = __webpack_require__(132);
8399var setSpecies = __webpack_require__(173);
8400var DESCRIPTORS = __webpack_require__(14);
8401var fastKey = __webpack_require__(94).fastKey;
8402var InternalStateModule = __webpack_require__(43);
8403
8404var setInternalState = InternalStateModule.set;
8405var internalStateGetterFor = InternalStateModule.getterFor;
8406
8407module.exports = {
8408 getConstructor: function (wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER) {
8409 var Constructor = wrapper(function (that, iterable) {
8410 anInstance(that, Prototype);
8411 setInternalState(that, {
8412 type: CONSTRUCTOR_NAME,
8413 index: create(null),
8414 first: undefined,
8415 last: undefined,
8416 size: 0
8417 });
8418 if (!DESCRIPTORS) that.size = 0;
8419 if (iterable != undefined) iterate(iterable, that[ADDER], { that: that, AS_ENTRIES: IS_MAP });
8420 });
8421
8422 var Prototype = Constructor.prototype;
8423
8424 var getInternalState = internalStateGetterFor(CONSTRUCTOR_NAME);
8425
8426 var define = function (that, key, value) {
8427 var state = getInternalState(that);
8428 var entry = getEntry(that, key);
8429 var previous, index;
8430 // change existing entry
8431 if (entry) {
8432 entry.value = value;
8433 // create new entry
8434 } else {
8435 state.last = entry = {
8436 index: index = fastKey(key, true),
8437 key: key,
8438 value: value,
8439 previous: previous = state.last,
8440 next: undefined,
8441 removed: false
8442 };
8443 if (!state.first) state.first = entry;
8444 if (previous) previous.next = entry;
8445 if (DESCRIPTORS) state.size++;
8446 else that.size++;
8447 // add to index
8448 if (index !== 'F') state.index[index] = entry;
8449 } return that;
8450 };
8451
8452 var getEntry = function (that, key) {
8453 var state = getInternalState(that);
8454 // fast case
8455 var index = fastKey(key);
8456 var entry;
8457 if (index !== 'F') return state.index[index];
8458 // frozen object case
8459 for (entry = state.first; entry; entry = entry.next) {
8460 if (entry.key == key) return entry;
8461 }
8462 };
8463
8464 defineBuiltIns(Prototype, {
8465 // `{ Map, Set }.prototype.clear()` methods
8466 // https://tc39.es/ecma262/#sec-map.prototype.clear
8467 // https://tc39.es/ecma262/#sec-set.prototype.clear
8468 clear: function clear() {
8469 var that = this;
8470 var state = getInternalState(that);
8471 var data = state.index;
8472 var entry = state.first;
8473 while (entry) {
8474 entry.removed = true;
8475 if (entry.previous) entry.previous = entry.previous.next = undefined;
8476 delete data[entry.index];
8477 entry = entry.next;
8478 }
8479 state.first = state.last = undefined;
8480 if (DESCRIPTORS) state.size = 0;
8481 else that.size = 0;
8482 },
8483 // `{ Map, Set }.prototype.delete(key)` methods
8484 // https://tc39.es/ecma262/#sec-map.prototype.delete
8485 // https://tc39.es/ecma262/#sec-set.prototype.delete
8486 'delete': function (key) {
8487 var that = this;
8488 var state = getInternalState(that);
8489 var entry = getEntry(that, key);
8490 if (entry) {
8491 var next = entry.next;
8492 var prev = entry.previous;
8493 delete state.index[entry.index];
8494 entry.removed = true;
8495 if (prev) prev.next = next;
8496 if (next) next.previous = prev;
8497 if (state.first == entry) state.first = next;
8498 if (state.last == entry) state.last = prev;
8499 if (DESCRIPTORS) state.size--;
8500 else that.size--;
8501 } return !!entry;
8502 },
8503 // `{ Map, Set }.prototype.forEach(callbackfn, thisArg = undefined)` methods
8504 // https://tc39.es/ecma262/#sec-map.prototype.foreach
8505 // https://tc39.es/ecma262/#sec-set.prototype.foreach
8506 forEach: function forEach(callbackfn /* , that = undefined */) {
8507 var state = getInternalState(this);
8508 var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined);
8509 var entry;
8510 while (entry = entry ? entry.next : state.first) {
8511 boundFunction(entry.value, entry.key, this);
8512 // revert to the last existing entry
8513 while (entry && entry.removed) entry = entry.previous;
8514 }
8515 },
8516 // `{ Map, Set}.prototype.has(key)` methods
8517 // https://tc39.es/ecma262/#sec-map.prototype.has
8518 // https://tc39.es/ecma262/#sec-set.prototype.has
8519 has: function has(key) {
8520 return !!getEntry(this, key);
8521 }
8522 });
8523
8524 defineBuiltIns(Prototype, IS_MAP ? {
8525 // `Map.prototype.get(key)` method
8526 // https://tc39.es/ecma262/#sec-map.prototype.get
8527 get: function get(key) {
8528 var entry = getEntry(this, key);
8529 return entry && entry.value;
8530 },
8531 // `Map.prototype.set(key, value)` method
8532 // https://tc39.es/ecma262/#sec-map.prototype.set
8533 set: function set(key, value) {
8534 return define(this, key === 0 ? 0 : key, value);
8535 }
8536 } : {
8537 // `Set.prototype.add(value)` method
8538 // https://tc39.es/ecma262/#sec-set.prototype.add
8539 add: function add(value) {
8540 return define(this, value = value === 0 ? 0 : value, value);
8541 }
8542 });
8543 if (DESCRIPTORS) defineProperty(Prototype, 'size', {
8544 get: function () {
8545 return getInternalState(this).size;
8546 }
8547 });
8548 return Constructor;
8549 },
8550 setStrong: function (Constructor, CONSTRUCTOR_NAME, IS_MAP) {
8551 var ITERATOR_NAME = CONSTRUCTOR_NAME + ' Iterator';
8552 var getInternalCollectionState = internalStateGetterFor(CONSTRUCTOR_NAME);
8553 var getInternalIteratorState = internalStateGetterFor(ITERATOR_NAME);
8554 // `{ Map, Set }.prototype.{ keys, values, entries, @@iterator }()` methods
8555 // https://tc39.es/ecma262/#sec-map.prototype.entries
8556 // https://tc39.es/ecma262/#sec-map.prototype.keys
8557 // https://tc39.es/ecma262/#sec-map.prototype.values
8558 // https://tc39.es/ecma262/#sec-map.prototype-@@iterator
8559 // https://tc39.es/ecma262/#sec-set.prototype.entries
8560 // https://tc39.es/ecma262/#sec-set.prototype.keys
8561 // https://tc39.es/ecma262/#sec-set.prototype.values
8562 // https://tc39.es/ecma262/#sec-set.prototype-@@iterator
8563 defineIterator(Constructor, CONSTRUCTOR_NAME, function (iterated, kind) {
8564 setInternalState(this, {
8565 type: ITERATOR_NAME,
8566 target: iterated,
8567 state: getInternalCollectionState(iterated),
8568 kind: kind,
8569 last: undefined
8570 });
8571 }, function () {
8572 var state = getInternalIteratorState(this);
8573 var kind = state.kind;
8574 var entry = state.last;
8575 // revert to the last existing entry
8576 while (entry && entry.removed) entry = entry.previous;
8577 // get next entry
8578 if (!state.target || !(state.last = entry = entry ? entry.next : state.state.first)) {
8579 // or finish the iteration
8580 state.target = undefined;
8581 return { value: undefined, done: true };
8582 }
8583 // return step by kind
8584 if (kind == 'keys') return { value: entry.key, done: false };
8585 if (kind == 'values') return { value: entry.value, done: false };
8586 return { value: [entry.key, entry.value], done: false };
8587 }, IS_MAP ? 'entries' : 'values', !IS_MAP, true);
8588
8589 // `{ Map, Set }.prototype[@@species]` accessors
8590 // https://tc39.es/ecma262/#sec-get-map-@@species
8591 // https://tc39.es/ecma262/#sec-get-set-@@species
8592 setSpecies(CONSTRUCTOR_NAME);
8593 }
8594};
8595
8596
8597/***/ }),
8598/* 265 */
8599/***/ (function(module, exports, __webpack_require__) {
8600
8601module.exports = __webpack_require__(610);
8602
8603/***/ }),
8604/* 266 */
8605/***/ (function(module, exports) {
8606
8607function _arrayLikeToArray(arr, len) {
8608 if (len == null || len > arr.length) len = arr.length;
8609 for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
8610 return arr2;
8611}
8612module.exports = _arrayLikeToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
8613
8614/***/ }),
8615/* 267 */
8616/***/ (function(module, exports) {
8617
8618function _iterableToArray(iter) {
8619 if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
8620}
8621module.exports = _iterableToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
8622
8623/***/ }),
8624/* 268 */
8625/***/ (function(module, exports, __webpack_require__) {
8626
8627var arrayLikeToArray = __webpack_require__(266);
8628function _unsupportedIterableToArray(o, minLen) {
8629 if (!o) return;
8630 if (typeof o === "string") return arrayLikeToArray(o, minLen);
8631 var n = Object.prototype.toString.call(o).slice(8, -1);
8632 if (n === "Object" && o.constructor) n = o.constructor.name;
8633 if (n === "Map" || n === "Set") return Array.from(o);
8634 if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return arrayLikeToArray(o, minLen);
8635}
8636module.exports = _unsupportedIterableToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
8637
8638/***/ }),
8639/* 269 */
8640/***/ (function(module, exports, __webpack_require__) {
8641
8642var _typeof = __webpack_require__(118)["default"];
8643var toPrimitive = __webpack_require__(624);
8644function _toPropertyKey(arg) {
8645 var key = toPrimitive(arg, "string");
8646 return _typeof(key) === "symbol" ? key : String(key);
8647}
8648module.exports = _toPropertyKey, module.exports.__esModule = true, module.exports["default"] = module.exports;
8649
8650/***/ }),
8651/* 270 */
8652/***/ (function(module, exports, __webpack_require__) {
8653
8654var baseRandom = __webpack_require__(635);
8655
8656/**
8657 * A specialized version of `_.shuffle` which mutates and sets the size of `array`.
8658 *
8659 * @private
8660 * @param {Array} array The array to shuffle.
8661 * @param {number} [size=array.length] The size of `array`.
8662 * @returns {Array} Returns `array`.
8663 */
8664function shuffleSelf(array, size) {
8665 var index = -1,
8666 length = array.length,
8667 lastIndex = length - 1;
8668
8669 size = size === undefined ? length : size;
8670 while (++index < size) {
8671 var rand = baseRandom(index, lastIndex),
8672 value = array[rand];
8673
8674 array[rand] = array[index];
8675 array[index] = value;
8676 }
8677 array.length = size;
8678 return array;
8679}
8680
8681module.exports = shuffleSelf;
8682
8683
8684/***/ }),
8685/* 271 */
8686/***/ (function(module, exports, __webpack_require__) {
8687
8688var baseValues = __webpack_require__(637),
8689 keys = __webpack_require__(639);
8690
8691/**
8692 * Creates an array of the own enumerable string keyed property values of `object`.
8693 *
8694 * **Note:** Non-object values are coerced to objects.
8695 *
8696 * @static
8697 * @since 0.1.0
8698 * @memberOf _
8699 * @category Object
8700 * @param {Object} object The object to query.
8701 * @returns {Array} Returns the array of property values.
8702 * @example
8703 *
8704 * function Foo() {
8705 * this.a = 1;
8706 * this.b = 2;
8707 * }
8708 *
8709 * Foo.prototype.c = 3;
8710 *
8711 * _.values(new Foo);
8712 * // => [1, 2] (iteration order is not guaranteed)
8713 *
8714 * _.values('hi');
8715 * // => ['h', 'i']
8716 */
8717function values(object) {
8718 return object == null ? [] : baseValues(object, keys(object));
8719}
8720
8721module.exports = values;
8722
8723
8724/***/ }),
8725/* 272 */
8726/***/ (function(module, exports, __webpack_require__) {
8727
8728var root = __webpack_require__(273);
8729
8730/** Built-in value references. */
8731var Symbol = root.Symbol;
8732
8733module.exports = Symbol;
8734
8735
8736/***/ }),
8737/* 273 */
8738/***/ (function(module, exports, __webpack_require__) {
8739
8740var freeGlobal = __webpack_require__(274);
8741
8742/** Detect free variable `self`. */
8743var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
8744
8745/** Used as a reference to the global object. */
8746var root = freeGlobal || freeSelf || Function('return this')();
8747
8748module.exports = root;
8749
8750
8751/***/ }),
8752/* 274 */
8753/***/ (function(module, exports, __webpack_require__) {
8754
8755/* WEBPACK VAR INJECTION */(function(global) {/** Detect free variable `global` from Node.js. */
8756var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
8757
8758module.exports = freeGlobal;
8759
8760/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(74)))
8761
8762/***/ }),
8763/* 275 */
8764/***/ (function(module, exports) {
8765
8766/**
8767 * Checks if `value` is classified as an `Array` object.
8768 *
8769 * @static
8770 * @memberOf _
8771 * @since 0.1.0
8772 * @category Lang
8773 * @param {*} value The value to check.
8774 * @returns {boolean} Returns `true` if `value` is an array, else `false`.
8775 * @example
8776 *
8777 * _.isArray([1, 2, 3]);
8778 * // => true
8779 *
8780 * _.isArray(document.body.children);
8781 * // => false
8782 *
8783 * _.isArray('abc');
8784 * // => false
8785 *
8786 * _.isArray(_.noop);
8787 * // => false
8788 */
8789var isArray = Array.isArray;
8790
8791module.exports = isArray;
8792
8793
8794/***/ }),
8795/* 276 */
8796/***/ (function(module, exports) {
8797
8798module.exports = function(module) {
8799 if(!module.webpackPolyfill) {
8800 module.deprecate = function() {};
8801 module.paths = [];
8802 // module.parent = undefined by default
8803 if(!module.children) module.children = [];
8804 Object.defineProperty(module, "loaded", {
8805 enumerable: true,
8806 get: function() {
8807 return module.l;
8808 }
8809 });
8810 Object.defineProperty(module, "id", {
8811 enumerable: true,
8812 get: function() {
8813 return module.i;
8814 }
8815 });
8816 module.webpackPolyfill = 1;
8817 }
8818 return module;
8819};
8820
8821
8822/***/ }),
8823/* 277 */
8824/***/ (function(module, exports) {
8825
8826/** Used as references for various `Number` constants. */
8827var MAX_SAFE_INTEGER = 9007199254740991;
8828
8829/**
8830 * Checks if `value` is a valid array-like length.
8831 *
8832 * **Note:** This method is loosely based on
8833 * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
8834 *
8835 * @static
8836 * @memberOf _
8837 * @since 4.0.0
8838 * @category Lang
8839 * @param {*} value The value to check.
8840 * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
8841 * @example
8842 *
8843 * _.isLength(3);
8844 * // => true
8845 *
8846 * _.isLength(Number.MIN_VALUE);
8847 * // => false
8848 *
8849 * _.isLength(Infinity);
8850 * // => false
8851 *
8852 * _.isLength('3');
8853 * // => false
8854 */
8855function isLength(value) {
8856 return typeof value == 'number' &&
8857 value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
8858}
8859
8860module.exports = isLength;
8861
8862
8863/***/ }),
8864/* 278 */
8865/***/ (function(module, exports) {
8866
8867/**
8868 * Creates a unary function that invokes `func` with its argument transformed.
8869 *
8870 * @private
8871 * @param {Function} func The function to wrap.
8872 * @param {Function} transform The argument transform.
8873 * @returns {Function} Returns the new function.
8874 */
8875function overArg(func, transform) {
8876 return function(arg) {
8877 return func(transform(arg));
8878 };
8879}
8880
8881module.exports = overArg;
8882
8883
8884/***/ }),
8885/* 279 */
8886/***/ (function(module, exports, __webpack_require__) {
8887
8888"use strict";
8889
8890
8891var AV = __webpack_require__(280);
8892
8893var useLiveQuery = __webpack_require__(590);
8894
8895var useAdatpers = __webpack_require__(260);
8896
8897module.exports = useAdatpers(useLiveQuery(AV));
8898
8899/***/ }),
8900/* 280 */
8901/***/ (function(module, exports, __webpack_require__) {
8902
8903"use strict";
8904
8905
8906var AV = __webpack_require__(281);
8907
8908var useAdatpers = __webpack_require__(260);
8909
8910module.exports = useAdatpers(AV);
8911
8912/***/ }),
8913/* 281 */
8914/***/ (function(module, exports, __webpack_require__) {
8915
8916"use strict";
8917
8918
8919module.exports = __webpack_require__(282);
8920
8921/***/ }),
8922/* 282 */
8923/***/ (function(module, exports, __webpack_require__) {
8924
8925"use strict";
8926
8927
8928var _interopRequireDefault = __webpack_require__(1);
8929
8930var _promise = _interopRequireDefault(__webpack_require__(12));
8931
8932/*!
8933 * LeanCloud JavaScript SDK
8934 * https://leancloud.cn
8935 *
8936 * Copyright 2016 LeanCloud.cn, Inc.
8937 * The LeanCloud JavaScript SDK is freely distributable under the MIT license.
8938 */
8939var _ = __webpack_require__(3);
8940
8941var AV = __webpack_require__(69);
8942
8943AV._ = _;
8944AV.version = __webpack_require__(235);
8945AV.Promise = _promise.default;
8946AV.localStorage = __webpack_require__(237);
8947AV.Cache = __webpack_require__(238);
8948AV.Error = __webpack_require__(46);
8949
8950__webpack_require__(421);
8951
8952__webpack_require__(470)(AV);
8953
8954__webpack_require__(471)(AV);
8955
8956__webpack_require__(472)(AV);
8957
8958__webpack_require__(473)(AV);
8959
8960__webpack_require__(478)(AV);
8961
8962__webpack_require__(479)(AV);
8963
8964__webpack_require__(532)(AV);
8965
8966__webpack_require__(557)(AV);
8967
8968__webpack_require__(558)(AV);
8969
8970__webpack_require__(560)(AV);
8971
8972__webpack_require__(561)(AV);
8973
8974__webpack_require__(562)(AV);
8975
8976__webpack_require__(563)(AV);
8977
8978__webpack_require__(564)(AV);
8979
8980__webpack_require__(565)(AV);
8981
8982__webpack_require__(566)(AV);
8983
8984__webpack_require__(567)(AV);
8985
8986__webpack_require__(568)(AV);
8987
8988AV.Conversation = __webpack_require__(569);
8989
8990__webpack_require__(570);
8991
8992module.exports = AV;
8993/**
8994 * Options to controll the authentication for an operation
8995 * @typedef {Object} AuthOptions
8996 * @property {String} [sessionToken] Specify a user to excute the operation as.
8997 * @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.
8998 * @property {Boolean} [useMasterKey] Indicates whether masterKey is used for this operation. Only valid when masterKey is set.
8999 */
9000
9001/**
9002 * Options to controll the authentication for an SMS operation
9003 * @typedef {Object} SMSAuthOptions
9004 * @property {String} [sessionToken] Specify a user to excute the operation as.
9005 * @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.
9006 * @property {Boolean} [useMasterKey] Indicates whether masterKey is used for this operation. Only valid when masterKey is set.
9007 * @property {String} [validateToken] a validate token returned by {@link AV.Cloud.verifyCaptcha}
9008 */
9009
9010/***/ }),
9011/* 283 */
9012/***/ (function(module, exports, __webpack_require__) {
9013
9014var parent = __webpack_require__(284);
9015__webpack_require__(39);
9016
9017module.exports = parent;
9018
9019
9020/***/ }),
9021/* 284 */
9022/***/ (function(module, exports, __webpack_require__) {
9023
9024__webpack_require__(285);
9025__webpack_require__(38);
9026__webpack_require__(53);
9027__webpack_require__(301);
9028__webpack_require__(315);
9029__webpack_require__(316);
9030__webpack_require__(317);
9031__webpack_require__(55);
9032var path = __webpack_require__(5);
9033
9034module.exports = path.Promise;
9035
9036
9037/***/ }),
9038/* 285 */
9039/***/ (function(module, exports, __webpack_require__) {
9040
9041// TODO: Remove this module from `core-js@4` since it's replaced to module below
9042__webpack_require__(286);
9043
9044
9045/***/ }),
9046/* 286 */
9047/***/ (function(module, exports, __webpack_require__) {
9048
9049"use strict";
9050
9051var $ = __webpack_require__(0);
9052var isPrototypeOf = __webpack_require__(19);
9053var getPrototypeOf = __webpack_require__(100);
9054var setPrototypeOf = __webpack_require__(102);
9055var copyConstructorProperties = __webpack_require__(291);
9056var create = __webpack_require__(49);
9057var createNonEnumerableProperty = __webpack_require__(37);
9058var createPropertyDescriptor = __webpack_require__(47);
9059var clearErrorStack = __webpack_require__(294);
9060var installErrorCause = __webpack_require__(295);
9061var iterate = __webpack_require__(42);
9062var normalizeStringArgument = __webpack_require__(296);
9063var wellKnownSymbol = __webpack_require__(9);
9064var ERROR_STACK_INSTALLABLE = __webpack_require__(297);
9065
9066var TO_STRING_TAG = wellKnownSymbol('toStringTag');
9067var $Error = Error;
9068var push = [].push;
9069
9070var $AggregateError = function AggregateError(errors, message /* , options */) {
9071 var options = arguments.length > 2 ? arguments[2] : undefined;
9072 var isInstance = isPrototypeOf(AggregateErrorPrototype, this);
9073 var that;
9074 if (setPrototypeOf) {
9075 that = setPrototypeOf(new $Error(), isInstance ? getPrototypeOf(this) : AggregateErrorPrototype);
9076 } else {
9077 that = isInstance ? this : create(AggregateErrorPrototype);
9078 createNonEnumerableProperty(that, TO_STRING_TAG, 'Error');
9079 }
9080 if (message !== undefined) createNonEnumerableProperty(that, 'message', normalizeStringArgument(message));
9081 if (ERROR_STACK_INSTALLABLE) createNonEnumerableProperty(that, 'stack', clearErrorStack(that.stack, 1));
9082 installErrorCause(that, options);
9083 var errorsArray = [];
9084 iterate(errors, push, { that: errorsArray });
9085 createNonEnumerableProperty(that, 'errors', errorsArray);
9086 return that;
9087};
9088
9089if (setPrototypeOf) setPrototypeOf($AggregateError, $Error);
9090else copyConstructorProperties($AggregateError, $Error, { name: true });
9091
9092var AggregateErrorPrototype = $AggregateError.prototype = create($Error.prototype, {
9093 constructor: createPropertyDescriptor(1, $AggregateError),
9094 message: createPropertyDescriptor(1, ''),
9095 name: createPropertyDescriptor(1, 'AggregateError')
9096});
9097
9098// `AggregateError` constructor
9099// https://tc39.es/ecma262/#sec-aggregate-error-constructor
9100$({ global: true, constructor: true, arity: 2 }, {
9101 AggregateError: $AggregateError
9102});
9103
9104
9105/***/ }),
9106/* 287 */
9107/***/ (function(module, exports, __webpack_require__) {
9108
9109var call = __webpack_require__(15);
9110var isObject = __webpack_require__(11);
9111var isSymbol = __webpack_require__(97);
9112var getMethod = __webpack_require__(123);
9113var ordinaryToPrimitive = __webpack_require__(288);
9114var wellKnownSymbol = __webpack_require__(9);
9115
9116var $TypeError = TypeError;
9117var TO_PRIMITIVE = wellKnownSymbol('toPrimitive');
9118
9119// `ToPrimitive` abstract operation
9120// https://tc39.es/ecma262/#sec-toprimitive
9121module.exports = function (input, pref) {
9122 if (!isObject(input) || isSymbol(input)) return input;
9123 var exoticToPrim = getMethod(input, TO_PRIMITIVE);
9124 var result;
9125 if (exoticToPrim) {
9126 if (pref === undefined) pref = 'default';
9127 result = call(exoticToPrim, input, pref);
9128 if (!isObject(result) || isSymbol(result)) return result;
9129 throw $TypeError("Can't convert object to primitive value");
9130 }
9131 if (pref === undefined) pref = 'number';
9132 return ordinaryToPrimitive(input, pref);
9133};
9134
9135
9136/***/ }),
9137/* 288 */
9138/***/ (function(module, exports, __webpack_require__) {
9139
9140var call = __webpack_require__(15);
9141var isCallable = __webpack_require__(8);
9142var isObject = __webpack_require__(11);
9143
9144var $TypeError = TypeError;
9145
9146// `OrdinaryToPrimitive` abstract operation
9147// https://tc39.es/ecma262/#sec-ordinarytoprimitive
9148module.exports = function (input, pref) {
9149 var fn, val;
9150 if (pref === 'string' && isCallable(fn = input.toString) && !isObject(val = call(fn, input))) return val;
9151 if (isCallable(fn = input.valueOf) && !isObject(val = call(fn, input))) return val;
9152 if (pref !== 'string' && isCallable(fn = input.toString) && !isObject(val = call(fn, input))) return val;
9153 throw $TypeError("Can't convert object to primitive value");
9154};
9155
9156
9157/***/ }),
9158/* 289 */
9159/***/ (function(module, exports, __webpack_require__) {
9160
9161var global = __webpack_require__(7);
9162
9163// eslint-disable-next-line es-x/no-object-defineproperty -- safe
9164var defineProperty = Object.defineProperty;
9165
9166module.exports = function (key, value) {
9167 try {
9168 defineProperty(global, key, { value: value, configurable: true, writable: true });
9169 } catch (error) {
9170 global[key] = value;
9171 } return value;
9172};
9173
9174
9175/***/ }),
9176/* 290 */
9177/***/ (function(module, exports, __webpack_require__) {
9178
9179var isCallable = __webpack_require__(8);
9180
9181var $String = String;
9182var $TypeError = TypeError;
9183
9184module.exports = function (argument) {
9185 if (typeof argument == 'object' || isCallable(argument)) return argument;
9186 throw $TypeError("Can't set " + $String(argument) + ' as a prototype');
9187};
9188
9189
9190/***/ }),
9191/* 291 */
9192/***/ (function(module, exports, __webpack_require__) {
9193
9194var hasOwn = __webpack_require__(13);
9195var ownKeys = __webpack_require__(163);
9196var getOwnPropertyDescriptorModule = __webpack_require__(62);
9197var definePropertyModule = __webpack_require__(23);
9198
9199module.exports = function (target, source, exceptions) {
9200 var keys = ownKeys(source);
9201 var defineProperty = definePropertyModule.f;
9202 var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
9203 for (var i = 0; i < keys.length; i++) {
9204 var key = keys[i];
9205 if (!hasOwn(target, key) && !(exceptions && hasOwn(exceptions, key))) {
9206 defineProperty(target, key, getOwnPropertyDescriptor(source, key));
9207 }
9208 }
9209};
9210
9211
9212/***/ }),
9213/* 292 */
9214/***/ (function(module, exports) {
9215
9216var ceil = Math.ceil;
9217var floor = Math.floor;
9218
9219// `Math.trunc` method
9220// https://tc39.es/ecma262/#sec-math.trunc
9221// eslint-disable-next-line es-x/no-math-trunc -- safe
9222module.exports = Math.trunc || function trunc(x) {
9223 var n = +x;
9224 return (n > 0 ? floor : ceil)(n);
9225};
9226
9227
9228/***/ }),
9229/* 293 */
9230/***/ (function(module, exports, __webpack_require__) {
9231
9232var toIntegerOrInfinity = __webpack_require__(127);
9233
9234var min = Math.min;
9235
9236// `ToLength` abstract operation
9237// https://tc39.es/ecma262/#sec-tolength
9238module.exports = function (argument) {
9239 return argument > 0 ? min(toIntegerOrInfinity(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991
9240};
9241
9242
9243/***/ }),
9244/* 294 */
9245/***/ (function(module, exports, __webpack_require__) {
9246
9247var uncurryThis = __webpack_require__(4);
9248
9249var $Error = Error;
9250var replace = uncurryThis(''.replace);
9251
9252var TEST = (function (arg) { return String($Error(arg).stack); })('zxcasd');
9253var V8_OR_CHAKRA_STACK_ENTRY = /\n\s*at [^:]*:[^\n]*/;
9254var IS_V8_OR_CHAKRA_STACK = V8_OR_CHAKRA_STACK_ENTRY.test(TEST);
9255
9256module.exports = function (stack, dropEntries) {
9257 if (IS_V8_OR_CHAKRA_STACK && typeof stack == 'string' && !$Error.prepareStackTrace) {
9258 while (dropEntries--) stack = replace(stack, V8_OR_CHAKRA_STACK_ENTRY, '');
9259 } return stack;
9260};
9261
9262
9263/***/ }),
9264/* 295 */
9265/***/ (function(module, exports, __webpack_require__) {
9266
9267var isObject = __webpack_require__(11);
9268var createNonEnumerableProperty = __webpack_require__(37);
9269
9270// `InstallErrorCause` abstract operation
9271// https://tc39.es/proposal-error-cause/#sec-errorobjects-install-error-cause
9272module.exports = function (O, options) {
9273 if (isObject(options) && 'cause' in options) {
9274 createNonEnumerableProperty(O, 'cause', options.cause);
9275 }
9276};
9277
9278
9279/***/ }),
9280/* 296 */
9281/***/ (function(module, exports, __webpack_require__) {
9282
9283var toString = __webpack_require__(81);
9284
9285module.exports = function (argument, $default) {
9286 return argument === undefined ? arguments.length < 2 ? '' : $default : toString(argument);
9287};
9288
9289
9290/***/ }),
9291/* 297 */
9292/***/ (function(module, exports, __webpack_require__) {
9293
9294var fails = __webpack_require__(2);
9295var createPropertyDescriptor = __webpack_require__(47);
9296
9297module.exports = !fails(function () {
9298 var error = Error('a');
9299 if (!('stack' in error)) return true;
9300 // eslint-disable-next-line es-x/no-object-defineproperty -- safe
9301 Object.defineProperty(error, 'stack', createPropertyDescriptor(1, 7));
9302 return error.stack !== 7;
9303});
9304
9305
9306/***/ }),
9307/* 298 */
9308/***/ (function(module, exports, __webpack_require__) {
9309
9310var DESCRIPTORS = __webpack_require__(14);
9311var hasOwn = __webpack_require__(13);
9312
9313var FunctionPrototype = Function.prototype;
9314// eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
9315var getDescriptor = DESCRIPTORS && Object.getOwnPropertyDescriptor;
9316
9317var EXISTS = hasOwn(FunctionPrototype, 'name');
9318// additional protection from minified / mangled / dropped function names
9319var PROPER = EXISTS && (function something() { /* empty */ }).name === 'something';
9320var CONFIGURABLE = EXISTS && (!DESCRIPTORS || (DESCRIPTORS && getDescriptor(FunctionPrototype, 'name').configurable));
9321
9322module.exports = {
9323 EXISTS: EXISTS,
9324 PROPER: PROPER,
9325 CONFIGURABLE: CONFIGURABLE
9326};
9327
9328
9329/***/ }),
9330/* 299 */
9331/***/ (function(module, exports, __webpack_require__) {
9332
9333"use strict";
9334
9335var IteratorPrototype = __webpack_require__(172).IteratorPrototype;
9336var create = __webpack_require__(49);
9337var createPropertyDescriptor = __webpack_require__(47);
9338var setToStringTag = __webpack_require__(52);
9339var Iterators = __webpack_require__(50);
9340
9341var returnThis = function () { return this; };
9342
9343module.exports = function (IteratorConstructor, NAME, next, ENUMERABLE_NEXT) {
9344 var TO_STRING_TAG = NAME + ' Iterator';
9345 IteratorConstructor.prototype = create(IteratorPrototype, { next: createPropertyDescriptor(+!ENUMERABLE_NEXT, next) });
9346 setToStringTag(IteratorConstructor, TO_STRING_TAG, false, true);
9347 Iterators[TO_STRING_TAG] = returnThis;
9348 return IteratorConstructor;
9349};
9350
9351
9352/***/ }),
9353/* 300 */
9354/***/ (function(module, exports, __webpack_require__) {
9355
9356"use strict";
9357
9358var TO_STRING_TAG_SUPPORT = __webpack_require__(130);
9359var classof = __webpack_require__(51);
9360
9361// `Object.prototype.toString` method implementation
9362// https://tc39.es/ecma262/#sec-object.prototype.tostring
9363module.exports = TO_STRING_TAG_SUPPORT ? {}.toString : function toString() {
9364 return '[object ' + classof(this) + ']';
9365};
9366
9367
9368/***/ }),
9369/* 301 */
9370/***/ (function(module, exports, __webpack_require__) {
9371
9372// TODO: Remove this module from `core-js@4` since it's split to modules listed below
9373__webpack_require__(302);
9374__webpack_require__(310);
9375__webpack_require__(311);
9376__webpack_require__(312);
9377__webpack_require__(313);
9378__webpack_require__(314);
9379
9380
9381/***/ }),
9382/* 302 */
9383/***/ (function(module, exports, __webpack_require__) {
9384
9385"use strict";
9386
9387var $ = __webpack_require__(0);
9388var IS_PURE = __webpack_require__(33);
9389var IS_NODE = __webpack_require__(107);
9390var global = __webpack_require__(7);
9391var call = __webpack_require__(15);
9392var defineBuiltIn = __webpack_require__(44);
9393var setPrototypeOf = __webpack_require__(102);
9394var setToStringTag = __webpack_require__(52);
9395var setSpecies = __webpack_require__(173);
9396var aCallable = __webpack_require__(31);
9397var isCallable = __webpack_require__(8);
9398var isObject = __webpack_require__(11);
9399var anInstance = __webpack_require__(108);
9400var speciesConstructor = __webpack_require__(174);
9401var task = __webpack_require__(176).set;
9402var microtask = __webpack_require__(304);
9403var hostReportErrors = __webpack_require__(307);
9404var perform = __webpack_require__(82);
9405var Queue = __webpack_require__(308);
9406var InternalStateModule = __webpack_require__(43);
9407var NativePromiseConstructor = __webpack_require__(65);
9408var PromiseConstructorDetection = __webpack_require__(83);
9409var newPromiseCapabilityModule = __webpack_require__(54);
9410
9411var PROMISE = 'Promise';
9412var FORCED_PROMISE_CONSTRUCTOR = PromiseConstructorDetection.CONSTRUCTOR;
9413var NATIVE_PROMISE_REJECTION_EVENT = PromiseConstructorDetection.REJECTION_EVENT;
9414var NATIVE_PROMISE_SUBCLASSING = PromiseConstructorDetection.SUBCLASSING;
9415var getInternalPromiseState = InternalStateModule.getterFor(PROMISE);
9416var setInternalState = InternalStateModule.set;
9417var NativePromisePrototype = NativePromiseConstructor && NativePromiseConstructor.prototype;
9418var PromiseConstructor = NativePromiseConstructor;
9419var PromisePrototype = NativePromisePrototype;
9420var TypeError = global.TypeError;
9421var document = global.document;
9422var process = global.process;
9423var newPromiseCapability = newPromiseCapabilityModule.f;
9424var newGenericPromiseCapability = newPromiseCapability;
9425
9426var DISPATCH_EVENT = !!(document && document.createEvent && global.dispatchEvent);
9427var UNHANDLED_REJECTION = 'unhandledrejection';
9428var REJECTION_HANDLED = 'rejectionhandled';
9429var PENDING = 0;
9430var FULFILLED = 1;
9431var REJECTED = 2;
9432var HANDLED = 1;
9433var UNHANDLED = 2;
9434
9435var Internal, OwnPromiseCapability, PromiseWrapper, nativeThen;
9436
9437// helpers
9438var isThenable = function (it) {
9439 var then;
9440 return isObject(it) && isCallable(then = it.then) ? then : false;
9441};
9442
9443var callReaction = function (reaction, state) {
9444 var value = state.value;
9445 var ok = state.state == FULFILLED;
9446 var handler = ok ? reaction.ok : reaction.fail;
9447 var resolve = reaction.resolve;
9448 var reject = reaction.reject;
9449 var domain = reaction.domain;
9450 var result, then, exited;
9451 try {
9452 if (handler) {
9453 if (!ok) {
9454 if (state.rejection === UNHANDLED) onHandleUnhandled(state);
9455 state.rejection = HANDLED;
9456 }
9457 if (handler === true) result = value;
9458 else {
9459 if (domain) domain.enter();
9460 result = handler(value); // can throw
9461 if (domain) {
9462 domain.exit();
9463 exited = true;
9464 }
9465 }
9466 if (result === reaction.promise) {
9467 reject(TypeError('Promise-chain cycle'));
9468 } else if (then = isThenable(result)) {
9469 call(then, result, resolve, reject);
9470 } else resolve(result);
9471 } else reject(value);
9472 } catch (error) {
9473 if (domain && !exited) domain.exit();
9474 reject(error);
9475 }
9476};
9477
9478var notify = function (state, isReject) {
9479 if (state.notified) return;
9480 state.notified = true;
9481 microtask(function () {
9482 var reactions = state.reactions;
9483 var reaction;
9484 while (reaction = reactions.get()) {
9485 callReaction(reaction, state);
9486 }
9487 state.notified = false;
9488 if (isReject && !state.rejection) onUnhandled(state);
9489 });
9490};
9491
9492var dispatchEvent = function (name, promise, reason) {
9493 var event, handler;
9494 if (DISPATCH_EVENT) {
9495 event = document.createEvent('Event');
9496 event.promise = promise;
9497 event.reason = reason;
9498 event.initEvent(name, false, true);
9499 global.dispatchEvent(event);
9500 } else event = { promise: promise, reason: reason };
9501 if (!NATIVE_PROMISE_REJECTION_EVENT && (handler = global['on' + name])) handler(event);
9502 else if (name === UNHANDLED_REJECTION) hostReportErrors('Unhandled promise rejection', reason);
9503};
9504
9505var onUnhandled = function (state) {
9506 call(task, global, function () {
9507 var promise = state.facade;
9508 var value = state.value;
9509 var IS_UNHANDLED = isUnhandled(state);
9510 var result;
9511 if (IS_UNHANDLED) {
9512 result = perform(function () {
9513 if (IS_NODE) {
9514 process.emit('unhandledRejection', value, promise);
9515 } else dispatchEvent(UNHANDLED_REJECTION, promise, value);
9516 });
9517 // Browsers should not trigger `rejectionHandled` event if it was handled here, NodeJS - should
9518 state.rejection = IS_NODE || isUnhandled(state) ? UNHANDLED : HANDLED;
9519 if (result.error) throw result.value;
9520 }
9521 });
9522};
9523
9524var isUnhandled = function (state) {
9525 return state.rejection !== HANDLED && !state.parent;
9526};
9527
9528var onHandleUnhandled = function (state) {
9529 call(task, global, function () {
9530 var promise = state.facade;
9531 if (IS_NODE) {
9532 process.emit('rejectionHandled', promise);
9533 } else dispatchEvent(REJECTION_HANDLED, promise, state.value);
9534 });
9535};
9536
9537var bind = function (fn, state, unwrap) {
9538 return function (value) {
9539 fn(state, value, unwrap);
9540 };
9541};
9542
9543var internalReject = function (state, value, unwrap) {
9544 if (state.done) return;
9545 state.done = true;
9546 if (unwrap) state = unwrap;
9547 state.value = value;
9548 state.state = REJECTED;
9549 notify(state, true);
9550};
9551
9552var internalResolve = function (state, value, unwrap) {
9553 if (state.done) return;
9554 state.done = true;
9555 if (unwrap) state = unwrap;
9556 try {
9557 if (state.facade === value) throw TypeError("Promise can't be resolved itself");
9558 var then = isThenable(value);
9559 if (then) {
9560 microtask(function () {
9561 var wrapper = { done: false };
9562 try {
9563 call(then, value,
9564 bind(internalResolve, wrapper, state),
9565 bind(internalReject, wrapper, state)
9566 );
9567 } catch (error) {
9568 internalReject(wrapper, error, state);
9569 }
9570 });
9571 } else {
9572 state.value = value;
9573 state.state = FULFILLED;
9574 notify(state, false);
9575 }
9576 } catch (error) {
9577 internalReject({ done: false }, error, state);
9578 }
9579};
9580
9581// constructor polyfill
9582if (FORCED_PROMISE_CONSTRUCTOR) {
9583 // 25.4.3.1 Promise(executor)
9584 PromiseConstructor = function Promise(executor) {
9585 anInstance(this, PromisePrototype);
9586 aCallable(executor);
9587 call(Internal, this);
9588 var state = getInternalPromiseState(this);
9589 try {
9590 executor(bind(internalResolve, state), bind(internalReject, state));
9591 } catch (error) {
9592 internalReject(state, error);
9593 }
9594 };
9595
9596 PromisePrototype = PromiseConstructor.prototype;
9597
9598 // eslint-disable-next-line no-unused-vars -- required for `.length`
9599 Internal = function Promise(executor) {
9600 setInternalState(this, {
9601 type: PROMISE,
9602 done: false,
9603 notified: false,
9604 parent: false,
9605 reactions: new Queue(),
9606 rejection: false,
9607 state: PENDING,
9608 value: undefined
9609 });
9610 };
9611
9612 // `Promise.prototype.then` method
9613 // https://tc39.es/ecma262/#sec-promise.prototype.then
9614 Internal.prototype = defineBuiltIn(PromisePrototype, 'then', function then(onFulfilled, onRejected) {
9615 var state = getInternalPromiseState(this);
9616 var reaction = newPromiseCapability(speciesConstructor(this, PromiseConstructor));
9617 state.parent = true;
9618 reaction.ok = isCallable(onFulfilled) ? onFulfilled : true;
9619 reaction.fail = isCallable(onRejected) && onRejected;
9620 reaction.domain = IS_NODE ? process.domain : undefined;
9621 if (state.state == PENDING) state.reactions.add(reaction);
9622 else microtask(function () {
9623 callReaction(reaction, state);
9624 });
9625 return reaction.promise;
9626 });
9627
9628 OwnPromiseCapability = function () {
9629 var promise = new Internal();
9630 var state = getInternalPromiseState(promise);
9631 this.promise = promise;
9632 this.resolve = bind(internalResolve, state);
9633 this.reject = bind(internalReject, state);
9634 };
9635
9636 newPromiseCapabilityModule.f = newPromiseCapability = function (C) {
9637 return C === PromiseConstructor || C === PromiseWrapper
9638 ? new OwnPromiseCapability(C)
9639 : newGenericPromiseCapability(C);
9640 };
9641
9642 if (!IS_PURE && isCallable(NativePromiseConstructor) && NativePromisePrototype !== Object.prototype) {
9643 nativeThen = NativePromisePrototype.then;
9644
9645 if (!NATIVE_PROMISE_SUBCLASSING) {
9646 // make `Promise#then` return a polyfilled `Promise` for native promise-based APIs
9647 defineBuiltIn(NativePromisePrototype, 'then', function then(onFulfilled, onRejected) {
9648 var that = this;
9649 return new PromiseConstructor(function (resolve, reject) {
9650 call(nativeThen, that, resolve, reject);
9651 }).then(onFulfilled, onRejected);
9652 // https://github.com/zloirock/core-js/issues/640
9653 }, { unsafe: true });
9654 }
9655
9656 // make `.constructor === Promise` work for native promise-based APIs
9657 try {
9658 delete NativePromisePrototype.constructor;
9659 } catch (error) { /* empty */ }
9660
9661 // make `instanceof Promise` work for native promise-based APIs
9662 if (setPrototypeOf) {
9663 setPrototypeOf(NativePromisePrototype, PromisePrototype);
9664 }
9665 }
9666}
9667
9668$({ global: true, constructor: true, wrap: true, forced: FORCED_PROMISE_CONSTRUCTOR }, {
9669 Promise: PromiseConstructor
9670});
9671
9672setToStringTag(PromiseConstructor, PROMISE, false, true);
9673setSpecies(PROMISE);
9674
9675
9676/***/ }),
9677/* 303 */
9678/***/ (function(module, exports) {
9679
9680var $TypeError = TypeError;
9681
9682module.exports = function (passed, required) {
9683 if (passed < required) throw $TypeError('Not enough arguments');
9684 return passed;
9685};
9686
9687
9688/***/ }),
9689/* 304 */
9690/***/ (function(module, exports, __webpack_require__) {
9691
9692var global = __webpack_require__(7);
9693var bind = __webpack_require__(48);
9694var getOwnPropertyDescriptor = __webpack_require__(62).f;
9695var macrotask = __webpack_require__(176).set;
9696var IS_IOS = __webpack_require__(177);
9697var IS_IOS_PEBBLE = __webpack_require__(305);
9698var IS_WEBOS_WEBKIT = __webpack_require__(306);
9699var IS_NODE = __webpack_require__(107);
9700
9701var MutationObserver = global.MutationObserver || global.WebKitMutationObserver;
9702var document = global.document;
9703var process = global.process;
9704var Promise = global.Promise;
9705// Node.js 11 shows ExperimentalWarning on getting `queueMicrotask`
9706var queueMicrotaskDescriptor = getOwnPropertyDescriptor(global, 'queueMicrotask');
9707var queueMicrotask = queueMicrotaskDescriptor && queueMicrotaskDescriptor.value;
9708
9709var flush, head, last, notify, toggle, node, promise, then;
9710
9711// modern engines have queueMicrotask method
9712if (!queueMicrotask) {
9713 flush = function () {
9714 var parent, fn;
9715 if (IS_NODE && (parent = process.domain)) parent.exit();
9716 while (head) {
9717 fn = head.fn;
9718 head = head.next;
9719 try {
9720 fn();
9721 } catch (error) {
9722 if (head) notify();
9723 else last = undefined;
9724 throw error;
9725 }
9726 } last = undefined;
9727 if (parent) parent.enter();
9728 };
9729
9730 // browsers with MutationObserver, except iOS - https://github.com/zloirock/core-js/issues/339
9731 // also except WebOS Webkit https://github.com/zloirock/core-js/issues/898
9732 if (!IS_IOS && !IS_NODE && !IS_WEBOS_WEBKIT && MutationObserver && document) {
9733 toggle = true;
9734 node = document.createTextNode('');
9735 new MutationObserver(flush).observe(node, { characterData: true });
9736 notify = function () {
9737 node.data = toggle = !toggle;
9738 };
9739 // environments with maybe non-completely correct, but existent Promise
9740 } else if (!IS_IOS_PEBBLE && Promise && Promise.resolve) {
9741 // Promise.resolve without an argument throws an error in LG WebOS 2
9742 promise = Promise.resolve(undefined);
9743 // workaround of WebKit ~ iOS Safari 10.1 bug
9744 promise.constructor = Promise;
9745 then = bind(promise.then, promise);
9746 notify = function () {
9747 then(flush);
9748 };
9749 // Node.js without promises
9750 } else if (IS_NODE) {
9751 notify = function () {
9752 process.nextTick(flush);
9753 };
9754 // for other environments - macrotask based on:
9755 // - setImmediate
9756 // - MessageChannel
9757 // - window.postMessage
9758 // - onreadystatechange
9759 // - setTimeout
9760 } else {
9761 // strange IE + webpack dev server bug - use .bind(global)
9762 macrotask = bind(macrotask, global);
9763 notify = function () {
9764 macrotask(flush);
9765 };
9766 }
9767}
9768
9769module.exports = queueMicrotask || function (fn) {
9770 var task = { fn: fn, next: undefined };
9771 if (last) last.next = task;
9772 if (!head) {
9773 head = task;
9774 notify();
9775 } last = task;
9776};
9777
9778
9779/***/ }),
9780/* 305 */
9781/***/ (function(module, exports, __webpack_require__) {
9782
9783var userAgent = __webpack_require__(98);
9784var global = __webpack_require__(7);
9785
9786module.exports = /ipad|iphone|ipod/i.test(userAgent) && global.Pebble !== undefined;
9787
9788
9789/***/ }),
9790/* 306 */
9791/***/ (function(module, exports, __webpack_require__) {
9792
9793var userAgent = __webpack_require__(98);
9794
9795module.exports = /web0s(?!.*chrome)/i.test(userAgent);
9796
9797
9798/***/ }),
9799/* 307 */
9800/***/ (function(module, exports, __webpack_require__) {
9801
9802var global = __webpack_require__(7);
9803
9804module.exports = function (a, b) {
9805 var console = global.console;
9806 if (console && console.error) {
9807 arguments.length == 1 ? console.error(a) : console.error(a, b);
9808 }
9809};
9810
9811
9812/***/ }),
9813/* 308 */
9814/***/ (function(module, exports) {
9815
9816var Queue = function () {
9817 this.head = null;
9818 this.tail = null;
9819};
9820
9821Queue.prototype = {
9822 add: function (item) {
9823 var entry = { item: item, next: null };
9824 if (this.head) this.tail.next = entry;
9825 else this.head = entry;
9826 this.tail = entry;
9827 },
9828 get: function () {
9829 var entry = this.head;
9830 if (entry) {
9831 this.head = entry.next;
9832 if (this.tail === entry) this.tail = null;
9833 return entry.item;
9834 }
9835 }
9836};
9837
9838module.exports = Queue;
9839
9840
9841/***/ }),
9842/* 309 */
9843/***/ (function(module, exports) {
9844
9845module.exports = typeof window == 'object' && typeof Deno != 'object';
9846
9847
9848/***/ }),
9849/* 310 */
9850/***/ (function(module, exports, __webpack_require__) {
9851
9852"use strict";
9853
9854var $ = __webpack_require__(0);
9855var call = __webpack_require__(15);
9856var aCallable = __webpack_require__(31);
9857var newPromiseCapabilityModule = __webpack_require__(54);
9858var perform = __webpack_require__(82);
9859var iterate = __webpack_require__(42);
9860var PROMISE_STATICS_INCORRECT_ITERATION = __webpack_require__(178);
9861
9862// `Promise.all` method
9863// https://tc39.es/ecma262/#sec-promise.all
9864$({ target: 'Promise', stat: true, forced: PROMISE_STATICS_INCORRECT_ITERATION }, {
9865 all: function all(iterable) {
9866 var C = this;
9867 var capability = newPromiseCapabilityModule.f(C);
9868 var resolve = capability.resolve;
9869 var reject = capability.reject;
9870 var result = perform(function () {
9871 var $promiseResolve = aCallable(C.resolve);
9872 var values = [];
9873 var counter = 0;
9874 var remaining = 1;
9875 iterate(iterable, function (promise) {
9876 var index = counter++;
9877 var alreadyCalled = false;
9878 remaining++;
9879 call($promiseResolve, C, promise).then(function (value) {
9880 if (alreadyCalled) return;
9881 alreadyCalled = true;
9882 values[index] = value;
9883 --remaining || resolve(values);
9884 }, reject);
9885 });
9886 --remaining || resolve(values);
9887 });
9888 if (result.error) reject(result.value);
9889 return capability.promise;
9890 }
9891});
9892
9893
9894/***/ }),
9895/* 311 */
9896/***/ (function(module, exports, __webpack_require__) {
9897
9898"use strict";
9899
9900var $ = __webpack_require__(0);
9901var IS_PURE = __webpack_require__(33);
9902var FORCED_PROMISE_CONSTRUCTOR = __webpack_require__(83).CONSTRUCTOR;
9903var NativePromiseConstructor = __webpack_require__(65);
9904var getBuiltIn = __webpack_require__(18);
9905var isCallable = __webpack_require__(8);
9906var defineBuiltIn = __webpack_require__(44);
9907
9908var NativePromisePrototype = NativePromiseConstructor && NativePromiseConstructor.prototype;
9909
9910// `Promise.prototype.catch` method
9911// https://tc39.es/ecma262/#sec-promise.prototype.catch
9912$({ target: 'Promise', proto: true, forced: FORCED_PROMISE_CONSTRUCTOR, real: true }, {
9913 'catch': function (onRejected) {
9914 return this.then(undefined, onRejected);
9915 }
9916});
9917
9918// makes sure that native promise-based APIs `Promise#catch` properly works with patched `Promise#then`
9919if (!IS_PURE && isCallable(NativePromiseConstructor)) {
9920 var method = getBuiltIn('Promise').prototype['catch'];
9921 if (NativePromisePrototype['catch'] !== method) {
9922 defineBuiltIn(NativePromisePrototype, 'catch', method, { unsafe: true });
9923 }
9924}
9925
9926
9927/***/ }),
9928/* 312 */
9929/***/ (function(module, exports, __webpack_require__) {
9930
9931"use strict";
9932
9933var $ = __webpack_require__(0);
9934var call = __webpack_require__(15);
9935var aCallable = __webpack_require__(31);
9936var newPromiseCapabilityModule = __webpack_require__(54);
9937var perform = __webpack_require__(82);
9938var iterate = __webpack_require__(42);
9939var PROMISE_STATICS_INCORRECT_ITERATION = __webpack_require__(178);
9940
9941// `Promise.race` method
9942// https://tc39.es/ecma262/#sec-promise.race
9943$({ target: 'Promise', stat: true, forced: PROMISE_STATICS_INCORRECT_ITERATION }, {
9944 race: function race(iterable) {
9945 var C = this;
9946 var capability = newPromiseCapabilityModule.f(C);
9947 var reject = capability.reject;
9948 var result = perform(function () {
9949 var $promiseResolve = aCallable(C.resolve);
9950 iterate(iterable, function (promise) {
9951 call($promiseResolve, C, promise).then(capability.resolve, reject);
9952 });
9953 });
9954 if (result.error) reject(result.value);
9955 return capability.promise;
9956 }
9957});
9958
9959
9960/***/ }),
9961/* 313 */
9962/***/ (function(module, exports, __webpack_require__) {
9963
9964"use strict";
9965
9966var $ = __webpack_require__(0);
9967var call = __webpack_require__(15);
9968var newPromiseCapabilityModule = __webpack_require__(54);
9969var FORCED_PROMISE_CONSTRUCTOR = __webpack_require__(83).CONSTRUCTOR;
9970
9971// `Promise.reject` method
9972// https://tc39.es/ecma262/#sec-promise.reject
9973$({ target: 'Promise', stat: true, forced: FORCED_PROMISE_CONSTRUCTOR }, {
9974 reject: function reject(r) {
9975 var capability = newPromiseCapabilityModule.f(this);
9976 call(capability.reject, undefined, r);
9977 return capability.promise;
9978 }
9979});
9980
9981
9982/***/ }),
9983/* 314 */
9984/***/ (function(module, exports, __webpack_require__) {
9985
9986"use strict";
9987
9988var $ = __webpack_require__(0);
9989var getBuiltIn = __webpack_require__(18);
9990var IS_PURE = __webpack_require__(33);
9991var NativePromiseConstructor = __webpack_require__(65);
9992var FORCED_PROMISE_CONSTRUCTOR = __webpack_require__(83).CONSTRUCTOR;
9993var promiseResolve = __webpack_require__(180);
9994
9995var PromiseConstructorWrapper = getBuiltIn('Promise');
9996var CHECK_WRAPPER = IS_PURE && !FORCED_PROMISE_CONSTRUCTOR;
9997
9998// `Promise.resolve` method
9999// https://tc39.es/ecma262/#sec-promise.resolve
10000$({ target: 'Promise', stat: true, forced: IS_PURE || FORCED_PROMISE_CONSTRUCTOR }, {
10001 resolve: function resolve(x) {
10002 return promiseResolve(CHECK_WRAPPER && this === PromiseConstructorWrapper ? NativePromiseConstructor : this, x);
10003 }
10004});
10005
10006
10007/***/ }),
10008/* 315 */
10009/***/ (function(module, exports, __webpack_require__) {
10010
10011"use strict";
10012
10013var $ = __webpack_require__(0);
10014var call = __webpack_require__(15);
10015var aCallable = __webpack_require__(31);
10016var newPromiseCapabilityModule = __webpack_require__(54);
10017var perform = __webpack_require__(82);
10018var iterate = __webpack_require__(42);
10019
10020// `Promise.allSettled` method
10021// https://tc39.es/ecma262/#sec-promise.allsettled
10022$({ target: 'Promise', stat: true }, {
10023 allSettled: function allSettled(iterable) {
10024 var C = this;
10025 var capability = newPromiseCapabilityModule.f(C);
10026 var resolve = capability.resolve;
10027 var reject = capability.reject;
10028 var result = perform(function () {
10029 var promiseResolve = aCallable(C.resolve);
10030 var values = [];
10031 var counter = 0;
10032 var remaining = 1;
10033 iterate(iterable, function (promise) {
10034 var index = counter++;
10035 var alreadyCalled = false;
10036 remaining++;
10037 call(promiseResolve, C, promise).then(function (value) {
10038 if (alreadyCalled) return;
10039 alreadyCalled = true;
10040 values[index] = { status: 'fulfilled', value: value };
10041 --remaining || resolve(values);
10042 }, function (error) {
10043 if (alreadyCalled) return;
10044 alreadyCalled = true;
10045 values[index] = { status: 'rejected', reason: error };
10046 --remaining || resolve(values);
10047 });
10048 });
10049 --remaining || resolve(values);
10050 });
10051 if (result.error) reject(result.value);
10052 return capability.promise;
10053 }
10054});
10055
10056
10057/***/ }),
10058/* 316 */
10059/***/ (function(module, exports, __webpack_require__) {
10060
10061"use strict";
10062
10063var $ = __webpack_require__(0);
10064var call = __webpack_require__(15);
10065var aCallable = __webpack_require__(31);
10066var getBuiltIn = __webpack_require__(18);
10067var newPromiseCapabilityModule = __webpack_require__(54);
10068var perform = __webpack_require__(82);
10069var iterate = __webpack_require__(42);
10070
10071var PROMISE_ANY_ERROR = 'No one promise resolved';
10072
10073// `Promise.any` method
10074// https://tc39.es/ecma262/#sec-promise.any
10075$({ target: 'Promise', stat: true }, {
10076 any: function any(iterable) {
10077 var C = this;
10078 var AggregateError = getBuiltIn('AggregateError');
10079 var capability = newPromiseCapabilityModule.f(C);
10080 var resolve = capability.resolve;
10081 var reject = capability.reject;
10082 var result = perform(function () {
10083 var promiseResolve = aCallable(C.resolve);
10084 var errors = [];
10085 var counter = 0;
10086 var remaining = 1;
10087 var alreadyResolved = false;
10088 iterate(iterable, function (promise) {
10089 var index = counter++;
10090 var alreadyRejected = false;
10091 remaining++;
10092 call(promiseResolve, C, promise).then(function (value) {
10093 if (alreadyRejected || alreadyResolved) return;
10094 alreadyResolved = true;
10095 resolve(value);
10096 }, function (error) {
10097 if (alreadyRejected || alreadyResolved) return;
10098 alreadyRejected = true;
10099 errors[index] = error;
10100 --remaining || reject(new AggregateError(errors, PROMISE_ANY_ERROR));
10101 });
10102 });
10103 --remaining || reject(new AggregateError(errors, PROMISE_ANY_ERROR));
10104 });
10105 if (result.error) reject(result.value);
10106 return capability.promise;
10107 }
10108});
10109
10110
10111/***/ }),
10112/* 317 */
10113/***/ (function(module, exports, __webpack_require__) {
10114
10115"use strict";
10116
10117var $ = __webpack_require__(0);
10118var IS_PURE = __webpack_require__(33);
10119var NativePromiseConstructor = __webpack_require__(65);
10120var fails = __webpack_require__(2);
10121var getBuiltIn = __webpack_require__(18);
10122var isCallable = __webpack_require__(8);
10123var speciesConstructor = __webpack_require__(174);
10124var promiseResolve = __webpack_require__(180);
10125var defineBuiltIn = __webpack_require__(44);
10126
10127var NativePromisePrototype = NativePromiseConstructor && NativePromiseConstructor.prototype;
10128
10129// Safari bug https://bugs.webkit.org/show_bug.cgi?id=200829
10130var NON_GENERIC = !!NativePromiseConstructor && fails(function () {
10131 // eslint-disable-next-line unicorn/no-thenable -- required for testing
10132 NativePromisePrototype['finally'].call({ then: function () { /* empty */ } }, function () { /* empty */ });
10133});
10134
10135// `Promise.prototype.finally` method
10136// https://tc39.es/ecma262/#sec-promise.prototype.finally
10137$({ target: 'Promise', proto: true, real: true, forced: NON_GENERIC }, {
10138 'finally': function (onFinally) {
10139 var C = speciesConstructor(this, getBuiltIn('Promise'));
10140 var isFunction = isCallable(onFinally);
10141 return this.then(
10142 isFunction ? function (x) {
10143 return promiseResolve(C, onFinally()).then(function () { return x; });
10144 } : onFinally,
10145 isFunction ? function (e) {
10146 return promiseResolve(C, onFinally()).then(function () { throw e; });
10147 } : onFinally
10148 );
10149 }
10150});
10151
10152// makes sure that native promise-based APIs `Promise#finally` properly works with patched `Promise#then`
10153if (!IS_PURE && isCallable(NativePromiseConstructor)) {
10154 var method = getBuiltIn('Promise').prototype['finally'];
10155 if (NativePromisePrototype['finally'] !== method) {
10156 defineBuiltIn(NativePromisePrototype, 'finally', method, { unsafe: true });
10157 }
10158}
10159
10160
10161/***/ }),
10162/* 318 */
10163/***/ (function(module, exports, __webpack_require__) {
10164
10165var uncurryThis = __webpack_require__(4);
10166var toIntegerOrInfinity = __webpack_require__(127);
10167var toString = __webpack_require__(81);
10168var requireObjectCoercible = __webpack_require__(122);
10169
10170var charAt = uncurryThis(''.charAt);
10171var charCodeAt = uncurryThis(''.charCodeAt);
10172var stringSlice = uncurryThis(''.slice);
10173
10174var createMethod = function (CONVERT_TO_STRING) {
10175 return function ($this, pos) {
10176 var S = toString(requireObjectCoercible($this));
10177 var position = toIntegerOrInfinity(pos);
10178 var size = S.length;
10179 var first, second;
10180 if (position < 0 || position >= size) return CONVERT_TO_STRING ? '' : undefined;
10181 first = charCodeAt(S, position);
10182 return first < 0xD800 || first > 0xDBFF || position + 1 === size
10183 || (second = charCodeAt(S, position + 1)) < 0xDC00 || second > 0xDFFF
10184 ? CONVERT_TO_STRING
10185 ? charAt(S, position)
10186 : first
10187 : CONVERT_TO_STRING
10188 ? stringSlice(S, position, position + 2)
10189 : (first - 0xD800 << 10) + (second - 0xDC00) + 0x10000;
10190 };
10191};
10192
10193module.exports = {
10194 // `String.prototype.codePointAt` method
10195 // https://tc39.es/ecma262/#sec-string.prototype.codepointat
10196 codeAt: createMethod(false),
10197 // `String.prototype.at` method
10198 // https://github.com/mathiasbynens/String.prototype.at
10199 charAt: createMethod(true)
10200};
10201
10202
10203/***/ }),
10204/* 319 */
10205/***/ (function(module, exports) {
10206
10207// iterable DOM collections
10208// flag - `iterable` interface - 'entries', 'keys', 'values', 'forEach' methods
10209module.exports = {
10210 CSSRuleList: 0,
10211 CSSStyleDeclaration: 0,
10212 CSSValueList: 0,
10213 ClientRectList: 0,
10214 DOMRectList: 0,
10215 DOMStringList: 0,
10216 DOMTokenList: 1,
10217 DataTransferItemList: 0,
10218 FileList: 0,
10219 HTMLAllCollection: 0,
10220 HTMLCollection: 0,
10221 HTMLFormElement: 0,
10222 HTMLSelectElement: 0,
10223 MediaList: 0,
10224 MimeTypeArray: 0,
10225 NamedNodeMap: 0,
10226 NodeList: 1,
10227 PaintRequestList: 0,
10228 Plugin: 0,
10229 PluginArray: 0,
10230 SVGLengthList: 0,
10231 SVGNumberList: 0,
10232 SVGPathSegList: 0,
10233 SVGPointList: 0,
10234 SVGStringList: 0,
10235 SVGTransformList: 0,
10236 SourceBufferList: 0,
10237 StyleSheetList: 0,
10238 TextTrackCueList: 0,
10239 TextTrackList: 0,
10240 TouchList: 0
10241};
10242
10243
10244/***/ }),
10245/* 320 */
10246/***/ (function(module, __webpack_exports__, __webpack_require__) {
10247
10248"use strict";
10249/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__index_js__ = __webpack_require__(133);
10250// Default Export
10251// ==============
10252// In this module, we mix our bundled exports into the `_` object and export
10253// the result. This is analogous to setting `module.exports = _` in CommonJS.
10254// Hence, this module is also the entry point of our UMD bundle and the package
10255// entry point for CommonJS and AMD users. In other words, this is (the source
10256// of) the module you are interfacing with when you do any of the following:
10257//
10258// ```js
10259// // CommonJS
10260// var _ = require('underscore');
10261//
10262// // AMD
10263// define(['underscore'], function(_) {...});
10264//
10265// // UMD in the browser
10266// // _ is available as a global variable
10267// ```
10268
10269
10270
10271// Add all of the Underscore functions to the wrapper object.
10272var _ = Object(__WEBPACK_IMPORTED_MODULE_0__index_js__["mixin"])(__WEBPACK_IMPORTED_MODULE_0__index_js__);
10273// Legacy Node.js API.
10274_._ = _;
10275// Export the Underscore API.
10276/* harmony default export */ __webpack_exports__["a"] = (_);
10277
10278
10279/***/ }),
10280/* 321 */
10281/***/ (function(module, __webpack_exports__, __webpack_require__) {
10282
10283"use strict";
10284/* harmony export (immutable) */ __webpack_exports__["a"] = isNull;
10285// Is a given value equal to null?
10286function isNull(obj) {
10287 return obj === null;
10288}
10289
10290
10291/***/ }),
10292/* 322 */
10293/***/ (function(module, __webpack_exports__, __webpack_require__) {
10294
10295"use strict";
10296/* harmony export (immutable) */ __webpack_exports__["a"] = isElement;
10297// Is a given value a DOM element?
10298function isElement(obj) {
10299 return !!(obj && obj.nodeType === 1);
10300}
10301
10302
10303/***/ }),
10304/* 323 */
10305/***/ (function(module, __webpack_exports__, __webpack_require__) {
10306
10307"use strict";
10308/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(17);
10309
10310
10311/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('Date'));
10312
10313
10314/***/ }),
10315/* 324 */
10316/***/ (function(module, __webpack_exports__, __webpack_require__) {
10317
10318"use strict";
10319/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(17);
10320
10321
10322/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('RegExp'));
10323
10324
10325/***/ }),
10326/* 325 */
10327/***/ (function(module, __webpack_exports__, __webpack_require__) {
10328
10329"use strict";
10330/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(17);
10331
10332
10333/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('Error'));
10334
10335
10336/***/ }),
10337/* 326 */
10338/***/ (function(module, __webpack_exports__, __webpack_require__) {
10339
10340"use strict";
10341/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(17);
10342
10343
10344/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('Object'));
10345
10346
10347/***/ }),
10348/* 327 */
10349/***/ (function(module, __webpack_exports__, __webpack_require__) {
10350
10351"use strict";
10352/* harmony export (immutable) */ __webpack_exports__["a"] = isFinite;
10353/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(6);
10354/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isSymbol_js__ = __webpack_require__(184);
10355
10356
10357
10358// Is a given object a finite number?
10359function isFinite(obj) {
10360 return !Object(__WEBPACK_IMPORTED_MODULE_1__isSymbol_js__["a" /* default */])(obj) && Object(__WEBPACK_IMPORTED_MODULE_0__setup_js__["f" /* _isFinite */])(obj) && !isNaN(parseFloat(obj));
10361}
10362
10363
10364/***/ }),
10365/* 328 */
10366/***/ (function(module, __webpack_exports__, __webpack_require__) {
10367
10368"use strict";
10369/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createSizePropertyCheck_js__ = __webpack_require__(189);
10370/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__getByteLength_js__ = __webpack_require__(137);
10371
10372
10373
10374// Internal helper to determine whether we should spend extensive checks against
10375// `ArrayBuffer` et al.
10376/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createSizePropertyCheck_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__getByteLength_js__["a" /* default */]));
10377
10378
10379/***/ }),
10380/* 329 */
10381/***/ (function(module, __webpack_exports__, __webpack_require__) {
10382
10383"use strict";
10384/* harmony export (immutable) */ __webpack_exports__["a"] = isEmpty;
10385/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__getLength_js__ = __webpack_require__(29);
10386/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isArray_js__ = __webpack_require__(57);
10387/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__isString_js__ = __webpack_require__(134);
10388/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__isArguments_js__ = __webpack_require__(136);
10389/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__keys_js__ = __webpack_require__(16);
10390
10391
10392
10393
10394
10395
10396// Is a given array, string, or object empty?
10397// An "empty" object has no enumerable own-properties.
10398function isEmpty(obj) {
10399 if (obj == null) return true;
10400 // Skip the more expensive `toString`-based type checks if `obj` has no
10401 // `.length`.
10402 var length = Object(__WEBPACK_IMPORTED_MODULE_0__getLength_js__["a" /* default */])(obj);
10403 if (typeof length == 'number' && (
10404 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)
10405 )) return length === 0;
10406 return Object(__WEBPACK_IMPORTED_MODULE_0__getLength_js__["a" /* default */])(Object(__WEBPACK_IMPORTED_MODULE_4__keys_js__["a" /* default */])(obj)) === 0;
10407}
10408
10409
10410/***/ }),
10411/* 330 */
10412/***/ (function(module, __webpack_exports__, __webpack_require__) {
10413
10414"use strict";
10415/* harmony export (immutable) */ __webpack_exports__["a"] = isEqual;
10416/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__underscore_js__ = __webpack_require__(25);
10417/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__setup_js__ = __webpack_require__(6);
10418/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__getByteLength_js__ = __webpack_require__(137);
10419/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__isTypedArray_js__ = __webpack_require__(187);
10420/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__isFunction_js__ = __webpack_require__(28);
10421/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__stringTagBug_js__ = __webpack_require__(84);
10422/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__isDataView_js__ = __webpack_require__(135);
10423/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__keys_js__ = __webpack_require__(16);
10424/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__has_js__ = __webpack_require__(45);
10425/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__toBufferView_js__ = __webpack_require__(331);
10426
10427
10428
10429
10430
10431
10432
10433
10434
10435
10436
10437// We use this string twice, so give it a name for minification.
10438var tagDataView = '[object DataView]';
10439
10440// Internal recursive comparison function for `_.isEqual`.
10441function eq(a, b, aStack, bStack) {
10442 // Identical objects are equal. `0 === -0`, but they aren't identical.
10443 // See the [Harmony `egal` proposal](https://wiki.ecmascript.org/doku.php?id=harmony:egal).
10444 if (a === b) return a !== 0 || 1 / a === 1 / b;
10445 // `null` or `undefined` only equal to itself (strict comparison).
10446 if (a == null || b == null) return false;
10447 // `NaN`s are equivalent, but non-reflexive.
10448 if (a !== a) return b !== b;
10449 // Exhaust primitive checks
10450 var type = typeof a;
10451 if (type !== 'function' && type !== 'object' && typeof b != 'object') return false;
10452 return deepEq(a, b, aStack, bStack);
10453}
10454
10455// Internal recursive comparison function for `_.isEqual`.
10456function deepEq(a, b, aStack, bStack) {
10457 // Unwrap any wrapped objects.
10458 if (a instanceof __WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */]) a = a._wrapped;
10459 if (b instanceof __WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */]) b = b._wrapped;
10460 // Compare `[[Class]]` names.
10461 var className = __WEBPACK_IMPORTED_MODULE_1__setup_js__["t" /* toString */].call(a);
10462 if (className !== __WEBPACK_IMPORTED_MODULE_1__setup_js__["t" /* toString */].call(b)) return false;
10463 // Work around a bug in IE 10 - Edge 13.
10464 if (__WEBPACK_IMPORTED_MODULE_5__stringTagBug_js__["a" /* hasStringTagBug */] && className == '[object Object]' && Object(__WEBPACK_IMPORTED_MODULE_6__isDataView_js__["a" /* default */])(a)) {
10465 if (!Object(__WEBPACK_IMPORTED_MODULE_6__isDataView_js__["a" /* default */])(b)) return false;
10466 className = tagDataView;
10467 }
10468 switch (className) {
10469 // These types are compared by value.
10470 case '[object RegExp]':
10471 // RegExps are coerced to strings for comparison (Note: '' + /a/i === '/a/i')
10472 case '[object String]':
10473 // Primitives and their corresponding object wrappers are equivalent; thus, `"5"` is
10474 // equivalent to `new String("5")`.
10475 return '' + a === '' + b;
10476 case '[object Number]':
10477 // `NaN`s are equivalent, but non-reflexive.
10478 // Object(NaN) is equivalent to NaN.
10479 if (+a !== +a) return +b !== +b;
10480 // An `egal` comparison is performed for other numeric values.
10481 return +a === 0 ? 1 / +a === 1 / b : +a === +b;
10482 case '[object Date]':
10483 case '[object Boolean]':
10484 // Coerce dates and booleans to numeric primitive values. Dates are compared by their
10485 // millisecond representations. Note that invalid dates with millisecond representations
10486 // of `NaN` are not equivalent.
10487 return +a === +b;
10488 case '[object Symbol]':
10489 return __WEBPACK_IMPORTED_MODULE_1__setup_js__["d" /* SymbolProto */].valueOf.call(a) === __WEBPACK_IMPORTED_MODULE_1__setup_js__["d" /* SymbolProto */].valueOf.call(b);
10490 case '[object ArrayBuffer]':
10491 case tagDataView:
10492 // Coerce to typed array so we can fall through.
10493 return deepEq(Object(__WEBPACK_IMPORTED_MODULE_9__toBufferView_js__["a" /* default */])(a), Object(__WEBPACK_IMPORTED_MODULE_9__toBufferView_js__["a" /* default */])(b), aStack, bStack);
10494 }
10495
10496 var areArrays = className === '[object Array]';
10497 if (!areArrays && Object(__WEBPACK_IMPORTED_MODULE_3__isTypedArray_js__["a" /* default */])(a)) {
10498 var byteLength = Object(__WEBPACK_IMPORTED_MODULE_2__getByteLength_js__["a" /* default */])(a);
10499 if (byteLength !== Object(__WEBPACK_IMPORTED_MODULE_2__getByteLength_js__["a" /* default */])(b)) return false;
10500 if (a.buffer === b.buffer && a.byteOffset === b.byteOffset) return true;
10501 areArrays = true;
10502 }
10503 if (!areArrays) {
10504 if (typeof a != 'object' || typeof b != 'object') return false;
10505
10506 // Objects with different constructors are not equivalent, but `Object`s or `Array`s
10507 // from different frames are.
10508 var aCtor = a.constructor, bCtor = b.constructor;
10509 if (aCtor !== bCtor && !(Object(__WEBPACK_IMPORTED_MODULE_4__isFunction_js__["a" /* default */])(aCtor) && aCtor instanceof aCtor &&
10510 Object(__WEBPACK_IMPORTED_MODULE_4__isFunction_js__["a" /* default */])(bCtor) && bCtor instanceof bCtor)
10511 && ('constructor' in a && 'constructor' in b)) {
10512 return false;
10513 }
10514 }
10515 // Assume equality for cyclic structures. The algorithm for detecting cyclic
10516 // structures is adapted from ES 5.1 section 15.12.3, abstract operation `JO`.
10517
10518 // Initializing stack of traversed objects.
10519 // It's done here since we only need them for objects and arrays comparison.
10520 aStack = aStack || [];
10521 bStack = bStack || [];
10522 var length = aStack.length;
10523 while (length--) {
10524 // Linear search. Performance is inversely proportional to the number of
10525 // unique nested structures.
10526 if (aStack[length] === a) return bStack[length] === b;
10527 }
10528
10529 // Add the first object to the stack of traversed objects.
10530 aStack.push(a);
10531 bStack.push(b);
10532
10533 // Recursively compare objects and arrays.
10534 if (areArrays) {
10535 // Compare array lengths to determine if a deep comparison is necessary.
10536 length = a.length;
10537 if (length !== b.length) return false;
10538 // Deep compare the contents, ignoring non-numeric properties.
10539 while (length--) {
10540 if (!eq(a[length], b[length], aStack, bStack)) return false;
10541 }
10542 } else {
10543 // Deep compare objects.
10544 var _keys = Object(__WEBPACK_IMPORTED_MODULE_7__keys_js__["a" /* default */])(a), key;
10545 length = _keys.length;
10546 // Ensure that both objects contain the same number of properties before comparing deep equality.
10547 if (Object(__WEBPACK_IMPORTED_MODULE_7__keys_js__["a" /* default */])(b).length !== length) return false;
10548 while (length--) {
10549 // Deep compare each member
10550 key = _keys[length];
10551 if (!(Object(__WEBPACK_IMPORTED_MODULE_8__has_js__["a" /* default */])(b, key) && eq(a[key], b[key], aStack, bStack))) return false;
10552 }
10553 }
10554 // Remove the first object from the stack of traversed objects.
10555 aStack.pop();
10556 bStack.pop();
10557 return true;
10558}
10559
10560// Perform a deep comparison to check if two objects are equal.
10561function isEqual(a, b) {
10562 return eq(a, b);
10563}
10564
10565
10566/***/ }),
10567/* 331 */
10568/***/ (function(module, __webpack_exports__, __webpack_require__) {
10569
10570"use strict";
10571/* harmony export (immutable) */ __webpack_exports__["a"] = toBufferView;
10572/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__getByteLength_js__ = __webpack_require__(137);
10573
10574
10575// Internal function to wrap or shallow-copy an ArrayBuffer,
10576// typed array or DataView to a new view, reusing the buffer.
10577function toBufferView(bufferSource) {
10578 return new Uint8Array(
10579 bufferSource.buffer || bufferSource,
10580 bufferSource.byteOffset || 0,
10581 Object(__WEBPACK_IMPORTED_MODULE_0__getByteLength_js__["a" /* default */])(bufferSource)
10582 );
10583}
10584
10585
10586/***/ }),
10587/* 332 */
10588/***/ (function(module, __webpack_exports__, __webpack_require__) {
10589
10590"use strict";
10591/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(17);
10592/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__stringTagBug_js__ = __webpack_require__(84);
10593/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__methodFingerprint_js__ = __webpack_require__(138);
10594
10595
10596
10597
10598/* 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'));
10599
10600
10601/***/ }),
10602/* 333 */
10603/***/ (function(module, __webpack_exports__, __webpack_require__) {
10604
10605"use strict";
10606/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(17);
10607/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__stringTagBug_js__ = __webpack_require__(84);
10608/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__methodFingerprint_js__ = __webpack_require__(138);
10609
10610
10611
10612
10613/* 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'));
10614
10615
10616/***/ }),
10617/* 334 */
10618/***/ (function(module, __webpack_exports__, __webpack_require__) {
10619
10620"use strict";
10621/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(17);
10622/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__stringTagBug_js__ = __webpack_require__(84);
10623/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__methodFingerprint_js__ = __webpack_require__(138);
10624
10625
10626
10627
10628/* 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'));
10629
10630
10631/***/ }),
10632/* 335 */
10633/***/ (function(module, __webpack_exports__, __webpack_require__) {
10634
10635"use strict";
10636/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(17);
10637
10638
10639/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('WeakSet'));
10640
10641
10642/***/ }),
10643/* 336 */
10644/***/ (function(module, __webpack_exports__, __webpack_require__) {
10645
10646"use strict";
10647/* harmony export (immutable) */ __webpack_exports__["a"] = pairs;
10648/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__keys_js__ = __webpack_require__(16);
10649
10650
10651// Convert an object into a list of `[key, value]` pairs.
10652// The opposite of `_.object` with one argument.
10653function pairs(obj) {
10654 var _keys = Object(__WEBPACK_IMPORTED_MODULE_0__keys_js__["a" /* default */])(obj);
10655 var length = _keys.length;
10656 var pairs = Array(length);
10657 for (var i = 0; i < length; i++) {
10658 pairs[i] = [_keys[i], obj[_keys[i]]];
10659 }
10660 return pairs;
10661}
10662
10663
10664/***/ }),
10665/* 337 */
10666/***/ (function(module, __webpack_exports__, __webpack_require__) {
10667
10668"use strict";
10669/* harmony export (immutable) */ __webpack_exports__["a"] = create;
10670/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__baseCreate_js__ = __webpack_require__(197);
10671/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__extendOwn_js__ = __webpack_require__(140);
10672
10673
10674
10675// Creates an object that inherits from the given prototype object.
10676// If additional properties are provided then they will be added to the
10677// created object.
10678function create(prototype, props) {
10679 var result = Object(__WEBPACK_IMPORTED_MODULE_0__baseCreate_js__["a" /* default */])(prototype);
10680 if (props) Object(__WEBPACK_IMPORTED_MODULE_1__extendOwn_js__["a" /* default */])(result, props);
10681 return result;
10682}
10683
10684
10685/***/ }),
10686/* 338 */
10687/***/ (function(module, __webpack_exports__, __webpack_require__) {
10688
10689"use strict";
10690/* harmony export (immutable) */ __webpack_exports__["a"] = tap;
10691// Invokes `interceptor` with the `obj` and then returns `obj`.
10692// The primary purpose of this method is to "tap into" a method chain, in
10693// order to perform operations on intermediate results within the chain.
10694function tap(obj, interceptor) {
10695 interceptor(obj);
10696 return obj;
10697}
10698
10699
10700/***/ }),
10701/* 339 */
10702/***/ (function(module, __webpack_exports__, __webpack_require__) {
10703
10704"use strict";
10705/* harmony export (immutable) */ __webpack_exports__["a"] = has;
10706/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__has_js__ = __webpack_require__(45);
10707/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__toPath_js__ = __webpack_require__(86);
10708
10709
10710
10711// Shortcut function for checking if an object has a given property directly on
10712// itself (in other words, not on a prototype). Unlike the internal `has`
10713// function, this public version can also traverse nested properties.
10714function has(obj, path) {
10715 path = Object(__WEBPACK_IMPORTED_MODULE_1__toPath_js__["a" /* default */])(path);
10716 var length = path.length;
10717 for (var i = 0; i < length; i++) {
10718 var key = path[i];
10719 if (!Object(__WEBPACK_IMPORTED_MODULE_0__has_js__["a" /* default */])(obj, key)) return false;
10720 obj = obj[key];
10721 }
10722 return !!length;
10723}
10724
10725
10726/***/ }),
10727/* 340 */
10728/***/ (function(module, __webpack_exports__, __webpack_require__) {
10729
10730"use strict";
10731/* harmony export (immutable) */ __webpack_exports__["a"] = mapObject;
10732/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(21);
10733/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__keys_js__ = __webpack_require__(16);
10734
10735
10736
10737// Returns the results of applying the `iteratee` to each element of `obj`.
10738// In contrast to `_.map` it returns an object.
10739function mapObject(obj, iteratee, context) {
10740 iteratee = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(iteratee, context);
10741 var _keys = Object(__WEBPACK_IMPORTED_MODULE_1__keys_js__["a" /* default */])(obj),
10742 length = _keys.length,
10743 results = {};
10744 for (var index = 0; index < length; index++) {
10745 var currentKey = _keys[index];
10746 results[currentKey] = iteratee(obj[currentKey], currentKey, obj);
10747 }
10748 return results;
10749}
10750
10751
10752/***/ }),
10753/* 341 */
10754/***/ (function(module, __webpack_exports__, __webpack_require__) {
10755
10756"use strict";
10757/* harmony export (immutable) */ __webpack_exports__["a"] = propertyOf;
10758/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__noop_js__ = __webpack_require__(203);
10759/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__get_js__ = __webpack_require__(199);
10760
10761
10762
10763// Generates a function for a given object that returns a given property.
10764function propertyOf(obj) {
10765 if (obj == null) return __WEBPACK_IMPORTED_MODULE_0__noop_js__["a" /* default */];
10766 return function(path) {
10767 return Object(__WEBPACK_IMPORTED_MODULE_1__get_js__["a" /* default */])(obj, path);
10768 };
10769}
10770
10771
10772/***/ }),
10773/* 342 */
10774/***/ (function(module, __webpack_exports__, __webpack_require__) {
10775
10776"use strict";
10777/* harmony export (immutable) */ __webpack_exports__["a"] = times;
10778/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__optimizeCb_js__ = __webpack_require__(87);
10779
10780
10781// Run a function **n** times.
10782function times(n, iteratee, context) {
10783 var accum = Array(Math.max(0, n));
10784 iteratee = Object(__WEBPACK_IMPORTED_MODULE_0__optimizeCb_js__["a" /* default */])(iteratee, context, 1);
10785 for (var i = 0; i < n; i++) accum[i] = iteratee(i);
10786 return accum;
10787}
10788
10789
10790/***/ }),
10791/* 343 */
10792/***/ (function(module, __webpack_exports__, __webpack_require__) {
10793
10794"use strict";
10795/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createEscaper_js__ = __webpack_require__(205);
10796/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__escapeMap_js__ = __webpack_require__(206);
10797
10798
10799
10800// Function for escaping strings to HTML interpolation.
10801/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createEscaper_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__escapeMap_js__["a" /* default */]));
10802
10803
10804/***/ }),
10805/* 344 */
10806/***/ (function(module, __webpack_exports__, __webpack_require__) {
10807
10808"use strict";
10809/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createEscaper_js__ = __webpack_require__(205);
10810/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__unescapeMap_js__ = __webpack_require__(345);
10811
10812
10813
10814// Function for unescaping strings from HTML interpolation.
10815/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createEscaper_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__unescapeMap_js__["a" /* default */]));
10816
10817
10818/***/ }),
10819/* 345 */
10820/***/ (function(module, __webpack_exports__, __webpack_require__) {
10821
10822"use strict";
10823/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__invert_js__ = __webpack_require__(193);
10824/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__escapeMap_js__ = __webpack_require__(206);
10825
10826
10827
10828// Internal list of HTML entities for unescaping.
10829/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__invert_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__escapeMap_js__["a" /* default */]));
10830
10831
10832/***/ }),
10833/* 346 */
10834/***/ (function(module, __webpack_exports__, __webpack_require__) {
10835
10836"use strict";
10837/* harmony export (immutable) */ __webpack_exports__["a"] = template;
10838/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__defaults_js__ = __webpack_require__(196);
10839/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__underscore_js__ = __webpack_require__(25);
10840/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__templateSettings_js__ = __webpack_require__(207);
10841
10842
10843
10844
10845// When customizing `_.templateSettings`, if you don't want to define an
10846// interpolation, evaluation or escaping regex, we need one that is
10847// guaranteed not to match.
10848var noMatch = /(.)^/;
10849
10850// Certain characters need to be escaped so that they can be put into a
10851// string literal.
10852var escapes = {
10853 "'": "'",
10854 '\\': '\\',
10855 '\r': 'r',
10856 '\n': 'n',
10857 '\u2028': 'u2028',
10858 '\u2029': 'u2029'
10859};
10860
10861var escapeRegExp = /\\|'|\r|\n|\u2028|\u2029/g;
10862
10863function escapeChar(match) {
10864 return '\\' + escapes[match];
10865}
10866
10867var bareIdentifier = /^\s*(\w|\$)+\s*$/;
10868
10869// JavaScript micro-templating, similar to John Resig's implementation.
10870// Underscore templating handles arbitrary delimiters, preserves whitespace,
10871// and correctly escapes quotes within interpolated code.
10872// NB: `oldSettings` only exists for backwards compatibility.
10873function template(text, settings, oldSettings) {
10874 if (!settings && oldSettings) settings = oldSettings;
10875 settings = Object(__WEBPACK_IMPORTED_MODULE_0__defaults_js__["a" /* default */])({}, settings, __WEBPACK_IMPORTED_MODULE_1__underscore_js__["a" /* default */].templateSettings);
10876
10877 // Combine delimiters into one regular expression via alternation.
10878 var matcher = RegExp([
10879 (settings.escape || noMatch).source,
10880 (settings.interpolate || noMatch).source,
10881 (settings.evaluate || noMatch).source
10882 ].join('|') + '|$', 'g');
10883
10884 // Compile the template source, escaping string literals appropriately.
10885 var index = 0;
10886 var source = "__p+='";
10887 text.replace(matcher, function(match, escape, interpolate, evaluate, offset) {
10888 source += text.slice(index, offset).replace(escapeRegExp, escapeChar);
10889 index = offset + match.length;
10890
10891 if (escape) {
10892 source += "'+\n((__t=(" + escape + "))==null?'':_.escape(__t))+\n'";
10893 } else if (interpolate) {
10894 source += "'+\n((__t=(" + interpolate + "))==null?'':__t)+\n'";
10895 } else if (evaluate) {
10896 source += "';\n" + evaluate + "\n__p+='";
10897 }
10898
10899 // Adobe VMs need the match returned to produce the correct offset.
10900 return match;
10901 });
10902 source += "';\n";
10903
10904 var argument = settings.variable;
10905 if (argument) {
10906 if (!bareIdentifier.test(argument)) throw new Error(argument);
10907 } else {
10908 // If a variable is not specified, place data values in local scope.
10909 source = 'with(obj||{}){\n' + source + '}\n';
10910 argument = 'obj';
10911 }
10912
10913 source = "var __t,__p='',__j=Array.prototype.join," +
10914 "print=function(){__p+=__j.call(arguments,'');};\n" +
10915 source + 'return __p;\n';
10916
10917 var render;
10918 try {
10919 render = new Function(argument, '_', source);
10920 } catch (e) {
10921 e.source = source;
10922 throw e;
10923 }
10924
10925 var template = function(data) {
10926 return render.call(this, data, __WEBPACK_IMPORTED_MODULE_1__underscore_js__["a" /* default */]);
10927 };
10928
10929 // Provide the compiled source as a convenience for precompilation.
10930 template.source = 'function(' + argument + '){\n' + source + '}';
10931
10932 return template;
10933}
10934
10935
10936/***/ }),
10937/* 347 */
10938/***/ (function(module, __webpack_exports__, __webpack_require__) {
10939
10940"use strict";
10941/* harmony export (immutable) */ __webpack_exports__["a"] = result;
10942/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isFunction_js__ = __webpack_require__(28);
10943/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__toPath_js__ = __webpack_require__(86);
10944
10945
10946
10947// Traverses the children of `obj` along `path`. If a child is a function, it
10948// is invoked with its parent as context. Returns the value of the final
10949// child, or `fallback` if any child is undefined.
10950function result(obj, path, fallback) {
10951 path = Object(__WEBPACK_IMPORTED_MODULE_1__toPath_js__["a" /* default */])(path);
10952 var length = path.length;
10953 if (!length) {
10954 return Object(__WEBPACK_IMPORTED_MODULE_0__isFunction_js__["a" /* default */])(fallback) ? fallback.call(obj) : fallback;
10955 }
10956 for (var i = 0; i < length; i++) {
10957 var prop = obj == null ? void 0 : obj[path[i]];
10958 if (prop === void 0) {
10959 prop = fallback;
10960 i = length; // Ensure we don't continue iterating.
10961 }
10962 obj = Object(__WEBPACK_IMPORTED_MODULE_0__isFunction_js__["a" /* default */])(prop) ? prop.call(obj) : prop;
10963 }
10964 return obj;
10965}
10966
10967
10968/***/ }),
10969/* 348 */
10970/***/ (function(module, __webpack_exports__, __webpack_require__) {
10971
10972"use strict";
10973/* harmony export (immutable) */ __webpack_exports__["a"] = uniqueId;
10974// Generate a unique integer id (unique within the entire client session).
10975// Useful for temporary DOM ids.
10976var idCounter = 0;
10977function uniqueId(prefix) {
10978 var id = ++idCounter + '';
10979 return prefix ? prefix + id : id;
10980}
10981
10982
10983/***/ }),
10984/* 349 */
10985/***/ (function(module, __webpack_exports__, __webpack_require__) {
10986
10987"use strict";
10988/* harmony export (immutable) */ __webpack_exports__["a"] = chain;
10989/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__underscore_js__ = __webpack_require__(25);
10990
10991
10992// Start chaining a wrapped Underscore object.
10993function chain(obj) {
10994 var instance = Object(__WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */])(obj);
10995 instance._chain = true;
10996 return instance;
10997}
10998
10999
11000/***/ }),
11001/* 350 */
11002/***/ (function(module, __webpack_exports__, __webpack_require__) {
11003
11004"use strict";
11005/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(24);
11006/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__flatten_js__ = __webpack_require__(67);
11007/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__bind_js__ = __webpack_require__(209);
11008
11009
11010
11011
11012// Bind a number of an object's methods to that object. Remaining arguments
11013// are the method names to be bound. Useful for ensuring that all callbacks
11014// defined on an object belong to it.
11015/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(obj, keys) {
11016 keys = Object(__WEBPACK_IMPORTED_MODULE_1__flatten_js__["a" /* default */])(keys, false, false);
11017 var index = keys.length;
11018 if (index < 1) throw new Error('bindAll must be passed function names');
11019 while (index--) {
11020 var key = keys[index];
11021 obj[key] = Object(__WEBPACK_IMPORTED_MODULE_2__bind_js__["a" /* default */])(obj[key], obj);
11022 }
11023 return obj;
11024}));
11025
11026
11027/***/ }),
11028/* 351 */
11029/***/ (function(module, __webpack_exports__, __webpack_require__) {
11030
11031"use strict";
11032/* harmony export (immutable) */ __webpack_exports__["a"] = memoize;
11033/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__has_js__ = __webpack_require__(45);
11034
11035
11036// Memoize an expensive function by storing its results.
11037function memoize(func, hasher) {
11038 var memoize = function(key) {
11039 var cache = memoize.cache;
11040 var address = '' + (hasher ? hasher.apply(this, arguments) : key);
11041 if (!Object(__WEBPACK_IMPORTED_MODULE_0__has_js__["a" /* default */])(cache, address)) cache[address] = func.apply(this, arguments);
11042 return cache[address];
11043 };
11044 memoize.cache = {};
11045 return memoize;
11046}
11047
11048
11049/***/ }),
11050/* 352 */
11051/***/ (function(module, __webpack_exports__, __webpack_require__) {
11052
11053"use strict";
11054/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__partial_js__ = __webpack_require__(112);
11055/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__delay_js__ = __webpack_require__(210);
11056/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__underscore_js__ = __webpack_require__(25);
11057
11058
11059
11060
11061// Defers a function, scheduling it to run after the current call stack has
11062// cleared.
11063/* 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));
11064
11065
11066/***/ }),
11067/* 353 */
11068/***/ (function(module, __webpack_exports__, __webpack_require__) {
11069
11070"use strict";
11071/* harmony export (immutable) */ __webpack_exports__["a"] = throttle;
11072/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__now_js__ = __webpack_require__(144);
11073
11074
11075// Returns a function, that, when invoked, will only be triggered at most once
11076// during a given window of time. Normally, the throttled function will run
11077// as much as it can, without ever going more than once per `wait` duration;
11078// but if you'd like to disable the execution on the leading edge, pass
11079// `{leading: false}`. To disable execution on the trailing edge, ditto.
11080function throttle(func, wait, options) {
11081 var timeout, context, args, result;
11082 var previous = 0;
11083 if (!options) options = {};
11084
11085 var later = function() {
11086 previous = options.leading === false ? 0 : Object(__WEBPACK_IMPORTED_MODULE_0__now_js__["a" /* default */])();
11087 timeout = null;
11088 result = func.apply(context, args);
11089 if (!timeout) context = args = null;
11090 };
11091
11092 var throttled = function() {
11093 var _now = Object(__WEBPACK_IMPORTED_MODULE_0__now_js__["a" /* default */])();
11094 if (!previous && options.leading === false) previous = _now;
11095 var remaining = wait - (_now - previous);
11096 context = this;
11097 args = arguments;
11098 if (remaining <= 0 || remaining > wait) {
11099 if (timeout) {
11100 clearTimeout(timeout);
11101 timeout = null;
11102 }
11103 previous = _now;
11104 result = func.apply(context, args);
11105 if (!timeout) context = args = null;
11106 } else if (!timeout && options.trailing !== false) {
11107 timeout = setTimeout(later, remaining);
11108 }
11109 return result;
11110 };
11111
11112 throttled.cancel = function() {
11113 clearTimeout(timeout);
11114 previous = 0;
11115 timeout = context = args = null;
11116 };
11117
11118 return throttled;
11119}
11120
11121
11122/***/ }),
11123/* 354 */
11124/***/ (function(module, __webpack_exports__, __webpack_require__) {
11125
11126"use strict";
11127/* harmony export (immutable) */ __webpack_exports__["a"] = debounce;
11128/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(24);
11129/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__now_js__ = __webpack_require__(144);
11130
11131
11132
11133// When a sequence of calls of the returned function ends, the argument
11134// function is triggered. The end of a sequence is defined by the `wait`
11135// parameter. If `immediate` is passed, the argument function will be
11136// triggered at the beginning of the sequence instead of at the end.
11137function debounce(func, wait, immediate) {
11138 var timeout, previous, args, result, context;
11139
11140 var later = function() {
11141 var passed = Object(__WEBPACK_IMPORTED_MODULE_1__now_js__["a" /* default */])() - previous;
11142 if (wait > passed) {
11143 timeout = setTimeout(later, wait - passed);
11144 } else {
11145 timeout = null;
11146 if (!immediate) result = func.apply(context, args);
11147 // This check is needed because `func` can recursively invoke `debounced`.
11148 if (!timeout) args = context = null;
11149 }
11150 };
11151
11152 var debounced = Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(_args) {
11153 context = this;
11154 args = _args;
11155 previous = Object(__WEBPACK_IMPORTED_MODULE_1__now_js__["a" /* default */])();
11156 if (!timeout) {
11157 timeout = setTimeout(later, wait);
11158 if (immediate) result = func.apply(context, args);
11159 }
11160 return result;
11161 });
11162
11163 debounced.cancel = function() {
11164 clearTimeout(timeout);
11165 timeout = args = context = null;
11166 };
11167
11168 return debounced;
11169}
11170
11171
11172/***/ }),
11173/* 355 */
11174/***/ (function(module, __webpack_exports__, __webpack_require__) {
11175
11176"use strict";
11177/* harmony export (immutable) */ __webpack_exports__["a"] = wrap;
11178/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__partial_js__ = __webpack_require__(112);
11179
11180
11181// Returns the first function passed as an argument to the second,
11182// allowing you to adjust arguments, run code before and after, and
11183// conditionally execute the original function.
11184function wrap(func, wrapper) {
11185 return Object(__WEBPACK_IMPORTED_MODULE_0__partial_js__["a" /* default */])(wrapper, func);
11186}
11187
11188
11189/***/ }),
11190/* 356 */
11191/***/ (function(module, __webpack_exports__, __webpack_require__) {
11192
11193"use strict";
11194/* harmony export (immutable) */ __webpack_exports__["a"] = compose;
11195// Returns a function that is the composition of a list of functions, each
11196// consuming the return value of the function that follows.
11197function compose() {
11198 var args = arguments;
11199 var start = args.length - 1;
11200 return function() {
11201 var i = start;
11202 var result = args[start].apply(this, arguments);
11203 while (i--) result = args[i].call(this, result);
11204 return result;
11205 };
11206}
11207
11208
11209/***/ }),
11210/* 357 */
11211/***/ (function(module, __webpack_exports__, __webpack_require__) {
11212
11213"use strict";
11214/* harmony export (immutable) */ __webpack_exports__["a"] = after;
11215// Returns a function that will only be executed on and after the Nth call.
11216function after(times, func) {
11217 return function() {
11218 if (--times < 1) {
11219 return func.apply(this, arguments);
11220 }
11221 };
11222}
11223
11224
11225/***/ }),
11226/* 358 */
11227/***/ (function(module, __webpack_exports__, __webpack_require__) {
11228
11229"use strict";
11230/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__partial_js__ = __webpack_require__(112);
11231/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__before_js__ = __webpack_require__(211);
11232
11233
11234
11235// Returns a function that will be executed at most one time, no matter how
11236// often you call it. Useful for lazy initialization.
11237/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__partial_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__before_js__["a" /* default */], 2));
11238
11239
11240/***/ }),
11241/* 359 */
11242/***/ (function(module, __webpack_exports__, __webpack_require__) {
11243
11244"use strict";
11245/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__findLastIndex_js__ = __webpack_require__(214);
11246/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__createIndexFinder_js__ = __webpack_require__(217);
11247
11248
11249
11250// Return the position of the last occurrence of an item in an array,
11251// or -1 if the item is not included in the array.
11252/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_1__createIndexFinder_js__["a" /* default */])(-1, __WEBPACK_IMPORTED_MODULE_0__findLastIndex_js__["a" /* default */]));
11253
11254
11255/***/ }),
11256/* 360 */
11257/***/ (function(module, __webpack_exports__, __webpack_require__) {
11258
11259"use strict";
11260/* harmony export (immutable) */ __webpack_exports__["a"] = findWhere;
11261/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__find_js__ = __webpack_require__(218);
11262/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__matcher_js__ = __webpack_require__(111);
11263
11264
11265
11266// Convenience version of a common use case of `_.find`: getting the first
11267// object containing specific `key:value` pairs.
11268function findWhere(obj, attrs) {
11269 return Object(__WEBPACK_IMPORTED_MODULE_0__find_js__["a" /* default */])(obj, Object(__WEBPACK_IMPORTED_MODULE_1__matcher_js__["a" /* default */])(attrs));
11270}
11271
11272
11273/***/ }),
11274/* 361 */
11275/***/ (function(module, __webpack_exports__, __webpack_require__) {
11276
11277"use strict";
11278/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createReduce_js__ = __webpack_require__(219);
11279
11280
11281// **Reduce** builds up a single result from a list of values, aka `inject`,
11282// or `foldl`.
11283/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createReduce_js__["a" /* default */])(1));
11284
11285
11286/***/ }),
11287/* 362 */
11288/***/ (function(module, __webpack_exports__, __webpack_require__) {
11289
11290"use strict";
11291/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createReduce_js__ = __webpack_require__(219);
11292
11293
11294// The right-associative version of reduce, also known as `foldr`.
11295/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createReduce_js__["a" /* default */])(-1));
11296
11297
11298/***/ }),
11299/* 363 */
11300/***/ (function(module, __webpack_exports__, __webpack_require__) {
11301
11302"use strict";
11303/* harmony export (immutable) */ __webpack_exports__["a"] = reject;
11304/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__filter_js__ = __webpack_require__(88);
11305/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__negate_js__ = __webpack_require__(145);
11306/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__cb_js__ = __webpack_require__(21);
11307
11308
11309
11310
11311// Return all the elements for which a truth test fails.
11312function reject(obj, predicate, context) {
11313 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);
11314}
11315
11316
11317/***/ }),
11318/* 364 */
11319/***/ (function(module, __webpack_exports__, __webpack_require__) {
11320
11321"use strict";
11322/* harmony export (immutable) */ __webpack_exports__["a"] = every;
11323/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(21);
11324/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isArrayLike_js__ = __webpack_require__(26);
11325/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__keys_js__ = __webpack_require__(16);
11326
11327
11328
11329
11330// Determine whether all of the elements pass a truth test.
11331function every(obj, predicate, context) {
11332 predicate = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(predicate, context);
11333 var _keys = !Object(__WEBPACK_IMPORTED_MODULE_1__isArrayLike_js__["a" /* default */])(obj) && Object(__WEBPACK_IMPORTED_MODULE_2__keys_js__["a" /* default */])(obj),
11334 length = (_keys || obj).length;
11335 for (var index = 0; index < length; index++) {
11336 var currentKey = _keys ? _keys[index] : index;
11337 if (!predicate(obj[currentKey], currentKey, obj)) return false;
11338 }
11339 return true;
11340}
11341
11342
11343/***/ }),
11344/* 365 */
11345/***/ (function(module, __webpack_exports__, __webpack_require__) {
11346
11347"use strict";
11348/* harmony export (immutable) */ __webpack_exports__["a"] = some;
11349/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(21);
11350/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isArrayLike_js__ = __webpack_require__(26);
11351/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__keys_js__ = __webpack_require__(16);
11352
11353
11354
11355
11356// Determine if at least one element in the object passes a truth test.
11357function some(obj, predicate, context) {
11358 predicate = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(predicate, context);
11359 var _keys = !Object(__WEBPACK_IMPORTED_MODULE_1__isArrayLike_js__["a" /* default */])(obj) && Object(__WEBPACK_IMPORTED_MODULE_2__keys_js__["a" /* default */])(obj),
11360 length = (_keys || obj).length;
11361 for (var index = 0; index < length; index++) {
11362 var currentKey = _keys ? _keys[index] : index;
11363 if (predicate(obj[currentKey], currentKey, obj)) return true;
11364 }
11365 return false;
11366}
11367
11368
11369/***/ }),
11370/* 366 */
11371/***/ (function(module, __webpack_exports__, __webpack_require__) {
11372
11373"use strict";
11374/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(24);
11375/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isFunction_js__ = __webpack_require__(28);
11376/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__map_js__ = __webpack_require__(68);
11377/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__deepGet_js__ = __webpack_require__(141);
11378/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__toPath_js__ = __webpack_require__(86);
11379
11380
11381
11382
11383
11384
11385// Invoke a method (with arguments) on every item in a collection.
11386/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(obj, path, args) {
11387 var contextPath, func;
11388 if (Object(__WEBPACK_IMPORTED_MODULE_1__isFunction_js__["a" /* default */])(path)) {
11389 func = path;
11390 } else {
11391 path = Object(__WEBPACK_IMPORTED_MODULE_4__toPath_js__["a" /* default */])(path);
11392 contextPath = path.slice(0, -1);
11393 path = path[path.length - 1];
11394 }
11395 return Object(__WEBPACK_IMPORTED_MODULE_2__map_js__["a" /* default */])(obj, function(context) {
11396 var method = func;
11397 if (!method) {
11398 if (contextPath && contextPath.length) {
11399 context = Object(__WEBPACK_IMPORTED_MODULE_3__deepGet_js__["a" /* default */])(context, contextPath);
11400 }
11401 if (context == null) return void 0;
11402 method = context[path];
11403 }
11404 return method == null ? method : method.apply(context, args);
11405 });
11406}));
11407
11408
11409/***/ }),
11410/* 367 */
11411/***/ (function(module, __webpack_exports__, __webpack_require__) {
11412
11413"use strict";
11414/* harmony export (immutable) */ __webpack_exports__["a"] = where;
11415/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__filter_js__ = __webpack_require__(88);
11416/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__matcher_js__ = __webpack_require__(111);
11417
11418
11419
11420// Convenience version of a common use case of `_.filter`: selecting only
11421// objects containing specific `key:value` pairs.
11422function where(obj, attrs) {
11423 return Object(__WEBPACK_IMPORTED_MODULE_0__filter_js__["a" /* default */])(obj, Object(__WEBPACK_IMPORTED_MODULE_1__matcher_js__["a" /* default */])(attrs));
11424}
11425
11426
11427/***/ }),
11428/* 368 */
11429/***/ (function(module, __webpack_exports__, __webpack_require__) {
11430
11431"use strict";
11432/* harmony export (immutable) */ __webpack_exports__["a"] = min;
11433/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__ = __webpack_require__(26);
11434/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__values_js__ = __webpack_require__(66);
11435/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__cb_js__ = __webpack_require__(21);
11436/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__each_js__ = __webpack_require__(58);
11437
11438
11439
11440
11441
11442// Return the minimum element (or element-based computation).
11443function min(obj, iteratee, context) {
11444 var result = Infinity, lastComputed = Infinity,
11445 value, computed;
11446 if (iteratee == null || typeof iteratee == 'number' && typeof obj[0] != 'object' && obj != null) {
11447 obj = Object(__WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__["a" /* default */])(obj) ? obj : Object(__WEBPACK_IMPORTED_MODULE_1__values_js__["a" /* default */])(obj);
11448 for (var i = 0, length = obj.length; i < length; i++) {
11449 value = obj[i];
11450 if (value != null && value < result) {
11451 result = value;
11452 }
11453 }
11454 } else {
11455 iteratee = Object(__WEBPACK_IMPORTED_MODULE_2__cb_js__["a" /* default */])(iteratee, context);
11456 Object(__WEBPACK_IMPORTED_MODULE_3__each_js__["a" /* default */])(obj, function(v, index, list) {
11457 computed = iteratee(v, index, list);
11458 if (computed < lastComputed || computed === Infinity && result === Infinity) {
11459 result = v;
11460 lastComputed = computed;
11461 }
11462 });
11463 }
11464 return result;
11465}
11466
11467
11468/***/ }),
11469/* 369 */
11470/***/ (function(module, __webpack_exports__, __webpack_require__) {
11471
11472"use strict";
11473/* harmony export (immutable) */ __webpack_exports__["a"] = shuffle;
11474/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__sample_js__ = __webpack_require__(221);
11475
11476
11477// Shuffle a collection.
11478function shuffle(obj) {
11479 return Object(__WEBPACK_IMPORTED_MODULE_0__sample_js__["a" /* default */])(obj, Infinity);
11480}
11481
11482
11483/***/ }),
11484/* 370 */
11485/***/ (function(module, __webpack_exports__, __webpack_require__) {
11486
11487"use strict";
11488/* harmony export (immutable) */ __webpack_exports__["a"] = sortBy;
11489/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(21);
11490/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__pluck_js__ = __webpack_require__(147);
11491/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__map_js__ = __webpack_require__(68);
11492
11493
11494
11495
11496// Sort the object's values by a criterion produced by an iteratee.
11497function sortBy(obj, iteratee, context) {
11498 var index = 0;
11499 iteratee = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(iteratee, context);
11500 return Object(__WEBPACK_IMPORTED_MODULE_1__pluck_js__["a" /* default */])(Object(__WEBPACK_IMPORTED_MODULE_2__map_js__["a" /* default */])(obj, function(value, key, list) {
11501 return {
11502 value: value,
11503 index: index++,
11504 criteria: iteratee(value, key, list)
11505 };
11506 }).sort(function(left, right) {
11507 var a = left.criteria;
11508 var b = right.criteria;
11509 if (a !== b) {
11510 if (a > b || a === void 0) return 1;
11511 if (a < b || b === void 0) return -1;
11512 }
11513 return left.index - right.index;
11514 }), 'value');
11515}
11516
11517
11518/***/ }),
11519/* 371 */
11520/***/ (function(module, __webpack_exports__, __webpack_require__) {
11521
11522"use strict";
11523/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__group_js__ = __webpack_require__(113);
11524/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__has_js__ = __webpack_require__(45);
11525
11526
11527
11528// Groups the object's values by a criterion. Pass either a string attribute
11529// to group by, or a function that returns the criterion.
11530/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__group_js__["a" /* default */])(function(result, value, key) {
11531 if (Object(__WEBPACK_IMPORTED_MODULE_1__has_js__["a" /* default */])(result, key)) result[key].push(value); else result[key] = [value];
11532}));
11533
11534
11535/***/ }),
11536/* 372 */
11537/***/ (function(module, __webpack_exports__, __webpack_require__) {
11538
11539"use strict";
11540/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__group_js__ = __webpack_require__(113);
11541
11542
11543// Indexes the object's values by a criterion, similar to `_.groupBy`, but for
11544// when you know that your index values will be unique.
11545/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__group_js__["a" /* default */])(function(result, value, key) {
11546 result[key] = value;
11547}));
11548
11549
11550/***/ }),
11551/* 373 */
11552/***/ (function(module, __webpack_exports__, __webpack_require__) {
11553
11554"use strict";
11555/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__group_js__ = __webpack_require__(113);
11556/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__has_js__ = __webpack_require__(45);
11557
11558
11559
11560// Counts instances of an object that group by a certain criterion. Pass
11561// either a string attribute to count by, or a function that returns the
11562// criterion.
11563/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__group_js__["a" /* default */])(function(result, value, key) {
11564 if (Object(__WEBPACK_IMPORTED_MODULE_1__has_js__["a" /* default */])(result, key)) result[key]++; else result[key] = 1;
11565}));
11566
11567
11568/***/ }),
11569/* 374 */
11570/***/ (function(module, __webpack_exports__, __webpack_require__) {
11571
11572"use strict";
11573/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__group_js__ = __webpack_require__(113);
11574
11575
11576// Split a collection into two arrays: one whose elements all pass the given
11577// truth test, and one whose elements all do not pass the truth test.
11578/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__group_js__["a" /* default */])(function(result, value, pass) {
11579 result[pass ? 0 : 1].push(value);
11580}, true));
11581
11582
11583/***/ }),
11584/* 375 */
11585/***/ (function(module, __webpack_exports__, __webpack_require__) {
11586
11587"use strict";
11588/* harmony export (immutable) */ __webpack_exports__["a"] = toArray;
11589/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isArray_js__ = __webpack_require__(57);
11590/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__setup_js__ = __webpack_require__(6);
11591/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__isString_js__ = __webpack_require__(134);
11592/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__isArrayLike_js__ = __webpack_require__(26);
11593/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__map_js__ = __webpack_require__(68);
11594/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__identity_js__ = __webpack_require__(142);
11595/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__values_js__ = __webpack_require__(66);
11596
11597
11598
11599
11600
11601
11602
11603
11604// Safely create a real, live array from anything iterable.
11605var reStrSymbol = /[^\ud800-\udfff]|[\ud800-\udbff][\udc00-\udfff]|[\ud800-\udfff]/g;
11606function toArray(obj) {
11607 if (!obj) return [];
11608 if (Object(__WEBPACK_IMPORTED_MODULE_0__isArray_js__["a" /* default */])(obj)) return __WEBPACK_IMPORTED_MODULE_1__setup_js__["q" /* slice */].call(obj);
11609 if (Object(__WEBPACK_IMPORTED_MODULE_2__isString_js__["a" /* default */])(obj)) {
11610 // Keep surrogate pair characters together.
11611 return obj.match(reStrSymbol);
11612 }
11613 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 */]);
11614 return Object(__WEBPACK_IMPORTED_MODULE_6__values_js__["a" /* default */])(obj);
11615}
11616
11617
11618/***/ }),
11619/* 376 */
11620/***/ (function(module, __webpack_exports__, __webpack_require__) {
11621
11622"use strict";
11623/* harmony export (immutable) */ __webpack_exports__["a"] = size;
11624/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__ = __webpack_require__(26);
11625/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__keys_js__ = __webpack_require__(16);
11626
11627
11628
11629// Return the number of elements in a collection.
11630function size(obj) {
11631 if (obj == null) return 0;
11632 return Object(__WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__["a" /* default */])(obj) ? obj.length : Object(__WEBPACK_IMPORTED_MODULE_1__keys_js__["a" /* default */])(obj).length;
11633}
11634
11635
11636/***/ }),
11637/* 377 */
11638/***/ (function(module, __webpack_exports__, __webpack_require__) {
11639
11640"use strict";
11641/* harmony export (immutable) */ __webpack_exports__["a"] = keyInObj;
11642// Internal `_.pick` helper function to determine whether `key` is an enumerable
11643// property name of `obj`.
11644function keyInObj(value, key, obj) {
11645 return key in obj;
11646}
11647
11648
11649/***/ }),
11650/* 378 */
11651/***/ (function(module, __webpack_exports__, __webpack_require__) {
11652
11653"use strict";
11654/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(24);
11655/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isFunction_js__ = __webpack_require__(28);
11656/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__negate_js__ = __webpack_require__(145);
11657/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__map_js__ = __webpack_require__(68);
11658/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__flatten_js__ = __webpack_require__(67);
11659/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__contains_js__ = __webpack_require__(89);
11660/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__pick_js__ = __webpack_require__(222);
11661
11662
11663
11664
11665
11666
11667
11668
11669// Return a copy of the object without the disallowed properties.
11670/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(obj, keys) {
11671 var iteratee = keys[0], context;
11672 if (Object(__WEBPACK_IMPORTED_MODULE_1__isFunction_js__["a" /* default */])(iteratee)) {
11673 iteratee = Object(__WEBPACK_IMPORTED_MODULE_2__negate_js__["a" /* default */])(iteratee);
11674 if (keys.length > 1) context = keys[1];
11675 } else {
11676 keys = Object(__WEBPACK_IMPORTED_MODULE_3__map_js__["a" /* default */])(Object(__WEBPACK_IMPORTED_MODULE_4__flatten_js__["a" /* default */])(keys, false, false), String);
11677 iteratee = function(value, key) {
11678 return !Object(__WEBPACK_IMPORTED_MODULE_5__contains_js__["a" /* default */])(keys, key);
11679 };
11680 }
11681 return Object(__WEBPACK_IMPORTED_MODULE_6__pick_js__["a" /* default */])(obj, iteratee, context);
11682}));
11683
11684
11685/***/ }),
11686/* 379 */
11687/***/ (function(module, __webpack_exports__, __webpack_require__) {
11688
11689"use strict";
11690/* harmony export (immutable) */ __webpack_exports__["a"] = first;
11691/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__initial_js__ = __webpack_require__(223);
11692
11693
11694// Get the first element of an array. Passing **n** will return the first N
11695// values in the array. The **guard** check allows it to work with `_.map`.
11696function first(array, n, guard) {
11697 if (array == null || array.length < 1) return n == null || guard ? void 0 : [];
11698 if (n == null || guard) return array[0];
11699 return Object(__WEBPACK_IMPORTED_MODULE_0__initial_js__["a" /* default */])(array, array.length - n);
11700}
11701
11702
11703/***/ }),
11704/* 380 */
11705/***/ (function(module, __webpack_exports__, __webpack_require__) {
11706
11707"use strict";
11708/* harmony export (immutable) */ __webpack_exports__["a"] = last;
11709/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__rest_js__ = __webpack_require__(224);
11710
11711
11712// Get the last element of an array. Passing **n** will return the last N
11713// values in the array.
11714function last(array, n, guard) {
11715 if (array == null || array.length < 1) return n == null || guard ? void 0 : [];
11716 if (n == null || guard) return array[array.length - 1];
11717 return Object(__WEBPACK_IMPORTED_MODULE_0__rest_js__["a" /* default */])(array, Math.max(0, array.length - n));
11718}
11719
11720
11721/***/ }),
11722/* 381 */
11723/***/ (function(module, __webpack_exports__, __webpack_require__) {
11724
11725"use strict";
11726/* harmony export (immutable) */ __webpack_exports__["a"] = compact;
11727/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__filter_js__ = __webpack_require__(88);
11728
11729
11730// Trim out all falsy values from an array.
11731function compact(array) {
11732 return Object(__WEBPACK_IMPORTED_MODULE_0__filter_js__["a" /* default */])(array, Boolean);
11733}
11734
11735
11736/***/ }),
11737/* 382 */
11738/***/ (function(module, __webpack_exports__, __webpack_require__) {
11739
11740"use strict";
11741/* harmony export (immutable) */ __webpack_exports__["a"] = flatten;
11742/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__flatten_js__ = __webpack_require__(67);
11743
11744
11745// Flatten out an array, either recursively (by default), or up to `depth`.
11746// Passing `true` or `false` as `depth` means `1` or `Infinity`, respectively.
11747function flatten(array, depth) {
11748 return Object(__WEBPACK_IMPORTED_MODULE_0__flatten_js__["a" /* default */])(array, depth, false);
11749}
11750
11751
11752/***/ }),
11753/* 383 */
11754/***/ (function(module, __webpack_exports__, __webpack_require__) {
11755
11756"use strict";
11757/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(24);
11758/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__difference_js__ = __webpack_require__(225);
11759
11760
11761
11762// Return a version of the array that does not contain the specified value(s).
11763/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(array, otherArrays) {
11764 return Object(__WEBPACK_IMPORTED_MODULE_1__difference_js__["a" /* default */])(array, otherArrays);
11765}));
11766
11767
11768/***/ }),
11769/* 384 */
11770/***/ (function(module, __webpack_exports__, __webpack_require__) {
11771
11772"use strict";
11773/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(24);
11774/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__uniq_js__ = __webpack_require__(226);
11775/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__flatten_js__ = __webpack_require__(67);
11776
11777
11778
11779
11780// Produce an array that contains the union: each distinct element from all of
11781// the passed-in arrays.
11782/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(arrays) {
11783 return Object(__WEBPACK_IMPORTED_MODULE_1__uniq_js__["a" /* default */])(Object(__WEBPACK_IMPORTED_MODULE_2__flatten_js__["a" /* default */])(arrays, true, true));
11784}));
11785
11786
11787/***/ }),
11788/* 385 */
11789/***/ (function(module, __webpack_exports__, __webpack_require__) {
11790
11791"use strict";
11792/* harmony export (immutable) */ __webpack_exports__["a"] = intersection;
11793/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__getLength_js__ = __webpack_require__(29);
11794/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__contains_js__ = __webpack_require__(89);
11795
11796
11797
11798// Produce an array that contains every item shared between all the
11799// passed-in arrays.
11800function intersection(array) {
11801 var result = [];
11802 var argsLength = arguments.length;
11803 for (var i = 0, length = Object(__WEBPACK_IMPORTED_MODULE_0__getLength_js__["a" /* default */])(array); i < length; i++) {
11804 var item = array[i];
11805 if (Object(__WEBPACK_IMPORTED_MODULE_1__contains_js__["a" /* default */])(result, item)) continue;
11806 var j;
11807 for (j = 1; j < argsLength; j++) {
11808 if (!Object(__WEBPACK_IMPORTED_MODULE_1__contains_js__["a" /* default */])(arguments[j], item)) break;
11809 }
11810 if (j === argsLength) result.push(item);
11811 }
11812 return result;
11813}
11814
11815
11816/***/ }),
11817/* 386 */
11818/***/ (function(module, __webpack_exports__, __webpack_require__) {
11819
11820"use strict";
11821/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(24);
11822/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__unzip_js__ = __webpack_require__(227);
11823
11824
11825
11826// Zip together multiple lists into a single array -- elements that share
11827// an index go together.
11828/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__unzip_js__["a" /* default */]));
11829
11830
11831/***/ }),
11832/* 387 */
11833/***/ (function(module, __webpack_exports__, __webpack_require__) {
11834
11835"use strict";
11836/* harmony export (immutable) */ __webpack_exports__["a"] = object;
11837/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__getLength_js__ = __webpack_require__(29);
11838
11839
11840// Converts lists into objects. Pass either a single array of `[key, value]`
11841// pairs, or two parallel arrays of the same length -- one of keys, and one of
11842// the corresponding values. Passing by pairs is the reverse of `_.pairs`.
11843function object(list, values) {
11844 var result = {};
11845 for (var i = 0, length = Object(__WEBPACK_IMPORTED_MODULE_0__getLength_js__["a" /* default */])(list); i < length; i++) {
11846 if (values) {
11847 result[list[i]] = values[i];
11848 } else {
11849 result[list[i][0]] = list[i][1];
11850 }
11851 }
11852 return result;
11853}
11854
11855
11856/***/ }),
11857/* 388 */
11858/***/ (function(module, __webpack_exports__, __webpack_require__) {
11859
11860"use strict";
11861/* harmony export (immutable) */ __webpack_exports__["a"] = range;
11862// Generate an integer Array containing an arithmetic progression. A port of
11863// the native Python `range()` function. See
11864// [the Python documentation](https://docs.python.org/library/functions.html#range).
11865function range(start, stop, step) {
11866 if (stop == null) {
11867 stop = start || 0;
11868 start = 0;
11869 }
11870 if (!step) {
11871 step = stop < start ? -1 : 1;
11872 }
11873
11874 var length = Math.max(Math.ceil((stop - start) / step), 0);
11875 var range = Array(length);
11876
11877 for (var idx = 0; idx < length; idx++, start += step) {
11878 range[idx] = start;
11879 }
11880
11881 return range;
11882}
11883
11884
11885/***/ }),
11886/* 389 */
11887/***/ (function(module, __webpack_exports__, __webpack_require__) {
11888
11889"use strict";
11890/* harmony export (immutable) */ __webpack_exports__["a"] = chunk;
11891/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(6);
11892
11893
11894// Chunk a single array into multiple arrays, each containing `count` or fewer
11895// items.
11896function chunk(array, count) {
11897 if (count == null || count < 1) return [];
11898 var result = [];
11899 var i = 0, length = array.length;
11900 while (i < length) {
11901 result.push(__WEBPACK_IMPORTED_MODULE_0__setup_js__["q" /* slice */].call(array, i, i += count));
11902 }
11903 return result;
11904}
11905
11906
11907/***/ }),
11908/* 390 */
11909/***/ (function(module, __webpack_exports__, __webpack_require__) {
11910
11911"use strict";
11912/* harmony export (immutable) */ __webpack_exports__["a"] = mixin;
11913/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__underscore_js__ = __webpack_require__(25);
11914/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__each_js__ = __webpack_require__(58);
11915/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__functions_js__ = __webpack_require__(194);
11916/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__setup_js__ = __webpack_require__(6);
11917/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__chainResult_js__ = __webpack_require__(228);
11918
11919
11920
11921
11922
11923
11924// Add your own custom functions to the Underscore object.
11925function mixin(obj) {
11926 Object(__WEBPACK_IMPORTED_MODULE_1__each_js__["a" /* default */])(Object(__WEBPACK_IMPORTED_MODULE_2__functions_js__["a" /* default */])(obj), function(name) {
11927 var func = __WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */][name] = obj[name];
11928 __WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */].prototype[name] = function() {
11929 var args = [this._wrapped];
11930 __WEBPACK_IMPORTED_MODULE_3__setup_js__["o" /* push */].apply(args, arguments);
11931 return Object(__WEBPACK_IMPORTED_MODULE_4__chainResult_js__["a" /* default */])(this, func.apply(__WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */], args));
11932 };
11933 });
11934 return __WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */];
11935}
11936
11937
11938/***/ }),
11939/* 391 */
11940/***/ (function(module, __webpack_exports__, __webpack_require__) {
11941
11942"use strict";
11943/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__underscore_js__ = __webpack_require__(25);
11944/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__each_js__ = __webpack_require__(58);
11945/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__setup_js__ = __webpack_require__(6);
11946/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__chainResult_js__ = __webpack_require__(228);
11947
11948
11949
11950
11951
11952// Add all mutator `Array` functions to the wrapper.
11953Object(__WEBPACK_IMPORTED_MODULE_1__each_js__["a" /* default */])(['pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift'], function(name) {
11954 var method = __WEBPACK_IMPORTED_MODULE_2__setup_js__["a" /* ArrayProto */][name];
11955 __WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */].prototype[name] = function() {
11956 var obj = this._wrapped;
11957 if (obj != null) {
11958 method.apply(obj, arguments);
11959 if ((name === 'shift' || name === 'splice') && obj.length === 0) {
11960 delete obj[0];
11961 }
11962 }
11963 return Object(__WEBPACK_IMPORTED_MODULE_3__chainResult_js__["a" /* default */])(this, obj);
11964 };
11965});
11966
11967// Add all accessor `Array` functions to the wrapper.
11968Object(__WEBPACK_IMPORTED_MODULE_1__each_js__["a" /* default */])(['concat', 'join', 'slice'], function(name) {
11969 var method = __WEBPACK_IMPORTED_MODULE_2__setup_js__["a" /* ArrayProto */][name];
11970 __WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */].prototype[name] = function() {
11971 var obj = this._wrapped;
11972 if (obj != null) obj = method.apply(obj, arguments);
11973 return Object(__WEBPACK_IMPORTED_MODULE_3__chainResult_js__["a" /* default */])(this, obj);
11974 };
11975});
11976
11977/* harmony default export */ __webpack_exports__["a"] = (__WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */]);
11978
11979
11980/***/ }),
11981/* 392 */
11982/***/ (function(module, exports, __webpack_require__) {
11983
11984var parent = __webpack_require__(393);
11985
11986module.exports = parent;
11987
11988
11989/***/ }),
11990/* 393 */
11991/***/ (function(module, exports, __webpack_require__) {
11992
11993var isPrototypeOf = __webpack_require__(19);
11994var method = __webpack_require__(394);
11995
11996var ArrayPrototype = Array.prototype;
11997
11998module.exports = function (it) {
11999 var own = it.concat;
12000 return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.concat) ? method : own;
12001};
12002
12003
12004/***/ }),
12005/* 394 */
12006/***/ (function(module, exports, __webpack_require__) {
12007
12008__webpack_require__(229);
12009var entryVirtual = __webpack_require__(40);
12010
12011module.exports = entryVirtual('Array').concat;
12012
12013
12014/***/ }),
12015/* 395 */
12016/***/ (function(module, exports) {
12017
12018var $TypeError = TypeError;
12019var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF; // 2 ** 53 - 1 == 9007199254740991
12020
12021module.exports = function (it) {
12022 if (it > MAX_SAFE_INTEGER) throw $TypeError('Maximum allowed index exceeded');
12023 return it;
12024};
12025
12026
12027/***/ }),
12028/* 396 */
12029/***/ (function(module, exports, __webpack_require__) {
12030
12031var isArray = __webpack_require__(90);
12032var isConstructor = __webpack_require__(109);
12033var isObject = __webpack_require__(11);
12034var wellKnownSymbol = __webpack_require__(9);
12035
12036var SPECIES = wellKnownSymbol('species');
12037var $Array = Array;
12038
12039// a part of `ArraySpeciesCreate` abstract operation
12040// https://tc39.es/ecma262/#sec-arrayspeciescreate
12041module.exports = function (originalArray) {
12042 var C;
12043 if (isArray(originalArray)) {
12044 C = originalArray.constructor;
12045 // cross-realm fallback
12046 if (isConstructor(C) && (C === $Array || isArray(C.prototype))) C = undefined;
12047 else if (isObject(C)) {
12048 C = C[SPECIES];
12049 if (C === null) C = undefined;
12050 }
12051 } return C === undefined ? $Array : C;
12052};
12053
12054
12055/***/ }),
12056/* 397 */
12057/***/ (function(module, exports, __webpack_require__) {
12058
12059var parent = __webpack_require__(398);
12060
12061module.exports = parent;
12062
12063
12064/***/ }),
12065/* 398 */
12066/***/ (function(module, exports, __webpack_require__) {
12067
12068var isPrototypeOf = __webpack_require__(19);
12069var method = __webpack_require__(399);
12070
12071var ArrayPrototype = Array.prototype;
12072
12073module.exports = function (it) {
12074 var own = it.map;
12075 return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.map) ? method : own;
12076};
12077
12078
12079/***/ }),
12080/* 399 */
12081/***/ (function(module, exports, __webpack_require__) {
12082
12083__webpack_require__(400);
12084var entryVirtual = __webpack_require__(40);
12085
12086module.exports = entryVirtual('Array').map;
12087
12088
12089/***/ }),
12090/* 400 */
12091/***/ (function(module, exports, __webpack_require__) {
12092
12093"use strict";
12094
12095var $ = __webpack_require__(0);
12096var $map = __webpack_require__(70).map;
12097var arrayMethodHasSpeciesSupport = __webpack_require__(114);
12098
12099var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('map');
12100
12101// `Array.prototype.map` method
12102// https://tc39.es/ecma262/#sec-array.prototype.map
12103// with adding support of @@species
12104$({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT }, {
12105 map: function map(callbackfn /* , thisArg */) {
12106 return $map(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
12107 }
12108});
12109
12110
12111/***/ }),
12112/* 401 */
12113/***/ (function(module, exports, __webpack_require__) {
12114
12115var parent = __webpack_require__(402);
12116
12117module.exports = parent;
12118
12119
12120/***/ }),
12121/* 402 */
12122/***/ (function(module, exports, __webpack_require__) {
12123
12124__webpack_require__(403);
12125var path = __webpack_require__(5);
12126
12127module.exports = path.Object.keys;
12128
12129
12130/***/ }),
12131/* 403 */
12132/***/ (function(module, exports, __webpack_require__) {
12133
12134var $ = __webpack_require__(0);
12135var toObject = __webpack_require__(34);
12136var nativeKeys = __webpack_require__(105);
12137var fails = __webpack_require__(2);
12138
12139var FAILS_ON_PRIMITIVES = fails(function () { nativeKeys(1); });
12140
12141// `Object.keys` method
12142// https://tc39.es/ecma262/#sec-object.keys
12143$({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES }, {
12144 keys: function keys(it) {
12145 return nativeKeys(toObject(it));
12146 }
12147});
12148
12149
12150/***/ }),
12151/* 404 */
12152/***/ (function(module, exports, __webpack_require__) {
12153
12154var parent = __webpack_require__(405);
12155
12156module.exports = parent;
12157
12158
12159/***/ }),
12160/* 405 */
12161/***/ (function(module, exports, __webpack_require__) {
12162
12163__webpack_require__(231);
12164var path = __webpack_require__(5);
12165var apply = __webpack_require__(75);
12166
12167// eslint-disable-next-line es-x/no-json -- safe
12168if (!path.JSON) path.JSON = { stringify: JSON.stringify };
12169
12170// eslint-disable-next-line no-unused-vars -- required for `.length`
12171module.exports = function stringify(it, replacer, space) {
12172 return apply(path.JSON.stringify, null, arguments);
12173};
12174
12175
12176/***/ }),
12177/* 406 */
12178/***/ (function(module, exports, __webpack_require__) {
12179
12180var parent = __webpack_require__(407);
12181
12182module.exports = parent;
12183
12184
12185/***/ }),
12186/* 407 */
12187/***/ (function(module, exports, __webpack_require__) {
12188
12189var isPrototypeOf = __webpack_require__(19);
12190var method = __webpack_require__(408);
12191
12192var ArrayPrototype = Array.prototype;
12193
12194module.exports = function (it) {
12195 var own = it.indexOf;
12196 return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.indexOf) ? method : own;
12197};
12198
12199
12200/***/ }),
12201/* 408 */
12202/***/ (function(module, exports, __webpack_require__) {
12203
12204__webpack_require__(409);
12205var entryVirtual = __webpack_require__(40);
12206
12207module.exports = entryVirtual('Array').indexOf;
12208
12209
12210/***/ }),
12211/* 409 */
12212/***/ (function(module, exports, __webpack_require__) {
12213
12214"use strict";
12215
12216/* eslint-disable es-x/no-array-prototype-indexof -- required for testing */
12217var $ = __webpack_require__(0);
12218var uncurryThis = __webpack_require__(4);
12219var $IndexOf = __webpack_require__(165).indexOf;
12220var arrayMethodIsStrict = __webpack_require__(232);
12221
12222var un$IndexOf = uncurryThis([].indexOf);
12223
12224var NEGATIVE_ZERO = !!un$IndexOf && 1 / un$IndexOf([1], 1, -0) < 0;
12225var STRICT_METHOD = arrayMethodIsStrict('indexOf');
12226
12227// `Array.prototype.indexOf` method
12228// https://tc39.es/ecma262/#sec-array.prototype.indexof
12229$({ target: 'Array', proto: true, forced: NEGATIVE_ZERO || !STRICT_METHOD }, {
12230 indexOf: function indexOf(searchElement /* , fromIndex = 0 */) {
12231 var fromIndex = arguments.length > 1 ? arguments[1] : undefined;
12232 return NEGATIVE_ZERO
12233 // convert -0 to +0
12234 ? un$IndexOf(this, searchElement, fromIndex) || 0
12235 : $IndexOf(this, searchElement, fromIndex);
12236 }
12237});
12238
12239
12240/***/ }),
12241/* 410 */
12242/***/ (function(module, exports, __webpack_require__) {
12243
12244__webpack_require__(39);
12245var classof = __webpack_require__(51);
12246var hasOwn = __webpack_require__(13);
12247var isPrototypeOf = __webpack_require__(19);
12248var method = __webpack_require__(411);
12249
12250var ArrayPrototype = Array.prototype;
12251
12252var DOMIterables = {
12253 DOMTokenList: true,
12254 NodeList: true
12255};
12256
12257module.exports = function (it) {
12258 var own = it.keys;
12259 return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.keys)
12260 || hasOwn(DOMIterables, classof(it)) ? method : own;
12261};
12262
12263
12264/***/ }),
12265/* 411 */
12266/***/ (function(module, exports, __webpack_require__) {
12267
12268var parent = __webpack_require__(412);
12269
12270module.exports = parent;
12271
12272
12273/***/ }),
12274/* 412 */
12275/***/ (function(module, exports, __webpack_require__) {
12276
12277__webpack_require__(38);
12278__webpack_require__(53);
12279var entryVirtual = __webpack_require__(40);
12280
12281module.exports = entryVirtual('Array').keys;
12282
12283
12284/***/ }),
12285/* 413 */
12286/***/ (function(module, exports) {
12287
12288// Unique ID creation requires a high quality random # generator. In the
12289// browser this is a little complicated due to unknown quality of Math.random()
12290// and inconsistent support for the `crypto` API. We do the best we can via
12291// feature-detection
12292
12293// getRandomValues needs to be invoked in a context where "this" is a Crypto
12294// implementation. Also, find the complete implementation of crypto on IE11.
12295var getRandomValues = (typeof(crypto) != 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto)) ||
12296 (typeof(msCrypto) != 'undefined' && typeof window.msCrypto.getRandomValues == 'function' && msCrypto.getRandomValues.bind(msCrypto));
12297
12298if (getRandomValues) {
12299 // WHATWG crypto RNG - http://wiki.whatwg.org/wiki/Crypto
12300 var rnds8 = new Uint8Array(16); // eslint-disable-line no-undef
12301
12302 module.exports = function whatwgRNG() {
12303 getRandomValues(rnds8);
12304 return rnds8;
12305 };
12306} else {
12307 // Math.random()-based (RNG)
12308 //
12309 // If all else fails, use Math.random(). It's fast, but is of unspecified
12310 // quality.
12311 var rnds = new Array(16);
12312
12313 module.exports = function mathRNG() {
12314 for (var i = 0, r; i < 16; i++) {
12315 if ((i & 0x03) === 0) r = Math.random() * 0x100000000;
12316 rnds[i] = r >>> ((i & 0x03) << 3) & 0xff;
12317 }
12318
12319 return rnds;
12320 };
12321}
12322
12323
12324/***/ }),
12325/* 414 */
12326/***/ (function(module, exports) {
12327
12328/**
12329 * Convert array of 16 byte values to UUID string format of the form:
12330 * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
12331 */
12332var byteToHex = [];
12333for (var i = 0; i < 256; ++i) {
12334 byteToHex[i] = (i + 0x100).toString(16).substr(1);
12335}
12336
12337function bytesToUuid(buf, offset) {
12338 var i = offset || 0;
12339 var bth = byteToHex;
12340 // join used to fix memory issue caused by concatenation: https://bugs.chromium.org/p/v8/issues/detail?id=3175#c4
12341 return ([bth[buf[i++]], bth[buf[i++]],
12342 bth[buf[i++]], bth[buf[i++]], '-',
12343 bth[buf[i++]], bth[buf[i++]], '-',
12344 bth[buf[i++]], bth[buf[i++]], '-',
12345 bth[buf[i++]], bth[buf[i++]], '-',
12346 bth[buf[i++]], bth[buf[i++]],
12347 bth[buf[i++]], bth[buf[i++]],
12348 bth[buf[i++]], bth[buf[i++]]]).join('');
12349}
12350
12351module.exports = bytesToUuid;
12352
12353
12354/***/ }),
12355/* 415 */
12356/***/ (function(module, exports, __webpack_require__) {
12357
12358"use strict";
12359
12360
12361/**
12362 * This is the common logic for both the Node.js and web browser
12363 * implementations of `debug()`.
12364 */
12365function setup(env) {
12366 createDebug.debug = createDebug;
12367 createDebug.default = createDebug;
12368 createDebug.coerce = coerce;
12369 createDebug.disable = disable;
12370 createDebug.enable = enable;
12371 createDebug.enabled = enabled;
12372 createDebug.humanize = __webpack_require__(416);
12373 Object.keys(env).forEach(function (key) {
12374 createDebug[key] = env[key];
12375 });
12376 /**
12377 * Active `debug` instances.
12378 */
12379
12380 createDebug.instances = [];
12381 /**
12382 * The currently active debug mode names, and names to skip.
12383 */
12384
12385 createDebug.names = [];
12386 createDebug.skips = [];
12387 /**
12388 * Map of special "%n" handling functions, for the debug "format" argument.
12389 *
12390 * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N".
12391 */
12392
12393 createDebug.formatters = {};
12394 /**
12395 * Selects a color for a debug namespace
12396 * @param {String} namespace The namespace string for the for the debug instance to be colored
12397 * @return {Number|String} An ANSI color code for the given namespace
12398 * @api private
12399 */
12400
12401 function selectColor(namespace) {
12402 var hash = 0;
12403
12404 for (var i = 0; i < namespace.length; i++) {
12405 hash = (hash << 5) - hash + namespace.charCodeAt(i);
12406 hash |= 0; // Convert to 32bit integer
12407 }
12408
12409 return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
12410 }
12411
12412 createDebug.selectColor = selectColor;
12413 /**
12414 * Create a debugger with the given `namespace`.
12415 *
12416 * @param {String} namespace
12417 * @return {Function}
12418 * @api public
12419 */
12420
12421 function createDebug(namespace) {
12422 var prevTime;
12423
12424 function debug() {
12425 // Disabled?
12426 if (!debug.enabled) {
12427 return;
12428 }
12429
12430 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
12431 args[_key] = arguments[_key];
12432 }
12433
12434 var self = debug; // Set `diff` timestamp
12435
12436 var curr = Number(new Date());
12437 var ms = curr - (prevTime || curr);
12438 self.diff = ms;
12439 self.prev = prevTime;
12440 self.curr = curr;
12441 prevTime = curr;
12442 args[0] = createDebug.coerce(args[0]);
12443
12444 if (typeof args[0] !== 'string') {
12445 // Anything else let's inspect with %O
12446 args.unshift('%O');
12447 } // Apply any `formatters` transformations
12448
12449
12450 var index = 0;
12451 args[0] = args[0].replace(/%([a-zA-Z%])/g, function (match, format) {
12452 // If we encounter an escaped % then don't increase the array index
12453 if (match === '%%') {
12454 return match;
12455 }
12456
12457 index++;
12458 var formatter = createDebug.formatters[format];
12459
12460 if (typeof formatter === 'function') {
12461 var val = args[index];
12462 match = formatter.call(self, val); // Now we need to remove `args[index]` since it's inlined in the `format`
12463
12464 args.splice(index, 1);
12465 index--;
12466 }
12467
12468 return match;
12469 }); // Apply env-specific formatting (colors, etc.)
12470
12471 createDebug.formatArgs.call(self, args);
12472 var logFn = self.log || createDebug.log;
12473 logFn.apply(self, args);
12474 }
12475
12476 debug.namespace = namespace;
12477 debug.enabled = createDebug.enabled(namespace);
12478 debug.useColors = createDebug.useColors();
12479 debug.color = selectColor(namespace);
12480 debug.destroy = destroy;
12481 debug.extend = extend; // Debug.formatArgs = formatArgs;
12482 // debug.rawLog = rawLog;
12483 // env-specific initialization logic for debug instances
12484
12485 if (typeof createDebug.init === 'function') {
12486 createDebug.init(debug);
12487 }
12488
12489 createDebug.instances.push(debug);
12490 return debug;
12491 }
12492
12493 function destroy() {
12494 var index = createDebug.instances.indexOf(this);
12495
12496 if (index !== -1) {
12497 createDebug.instances.splice(index, 1);
12498 return true;
12499 }
12500
12501 return false;
12502 }
12503
12504 function extend(namespace, delimiter) {
12505 return createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace);
12506 }
12507 /**
12508 * Enables a debug mode by namespaces. This can include modes
12509 * separated by a colon and wildcards.
12510 *
12511 * @param {String} namespaces
12512 * @api public
12513 */
12514
12515
12516 function enable(namespaces) {
12517 createDebug.save(namespaces);
12518 createDebug.names = [];
12519 createDebug.skips = [];
12520 var i;
12521 var split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/);
12522 var len = split.length;
12523
12524 for (i = 0; i < len; i++) {
12525 if (!split[i]) {
12526 // ignore empty strings
12527 continue;
12528 }
12529
12530 namespaces = split[i].replace(/\*/g, '.*?');
12531
12532 if (namespaces[0] === '-') {
12533 createDebug.skips.push(new RegExp('^' + namespaces.substr(1) + '$'));
12534 } else {
12535 createDebug.names.push(new RegExp('^' + namespaces + '$'));
12536 }
12537 }
12538
12539 for (i = 0; i < createDebug.instances.length; i++) {
12540 var instance = createDebug.instances[i];
12541 instance.enabled = createDebug.enabled(instance.namespace);
12542 }
12543 }
12544 /**
12545 * Disable debug output.
12546 *
12547 * @api public
12548 */
12549
12550
12551 function disable() {
12552 createDebug.enable('');
12553 }
12554 /**
12555 * Returns true if the given mode name is enabled, false otherwise.
12556 *
12557 * @param {String} name
12558 * @return {Boolean}
12559 * @api public
12560 */
12561
12562
12563 function enabled(name) {
12564 if (name[name.length - 1] === '*') {
12565 return true;
12566 }
12567
12568 var i;
12569 var len;
12570
12571 for (i = 0, len = createDebug.skips.length; i < len; i++) {
12572 if (createDebug.skips[i].test(name)) {
12573 return false;
12574 }
12575 }
12576
12577 for (i = 0, len = createDebug.names.length; i < len; i++) {
12578 if (createDebug.names[i].test(name)) {
12579 return true;
12580 }
12581 }
12582
12583 return false;
12584 }
12585 /**
12586 * Coerce `val`.
12587 *
12588 * @param {Mixed} val
12589 * @return {Mixed}
12590 * @api private
12591 */
12592
12593
12594 function coerce(val) {
12595 if (val instanceof Error) {
12596 return val.stack || val.message;
12597 }
12598
12599 return val;
12600 }
12601
12602 createDebug.enable(createDebug.load());
12603 return createDebug;
12604}
12605
12606module.exports = setup;
12607
12608
12609
12610/***/ }),
12611/* 416 */
12612/***/ (function(module, exports) {
12613
12614/**
12615 * Helpers.
12616 */
12617
12618var s = 1000;
12619var m = s * 60;
12620var h = m * 60;
12621var d = h * 24;
12622var w = d * 7;
12623var y = d * 365.25;
12624
12625/**
12626 * Parse or format the given `val`.
12627 *
12628 * Options:
12629 *
12630 * - `long` verbose formatting [false]
12631 *
12632 * @param {String|Number} val
12633 * @param {Object} [options]
12634 * @throws {Error} throw an error if val is not a non-empty string or a number
12635 * @return {String|Number}
12636 * @api public
12637 */
12638
12639module.exports = function(val, options) {
12640 options = options || {};
12641 var type = typeof val;
12642 if (type === 'string' && val.length > 0) {
12643 return parse(val);
12644 } else if (type === 'number' && isFinite(val)) {
12645 return options.long ? fmtLong(val) : fmtShort(val);
12646 }
12647 throw new Error(
12648 'val is not a non-empty string or a valid number. val=' +
12649 JSON.stringify(val)
12650 );
12651};
12652
12653/**
12654 * Parse the given `str` and return milliseconds.
12655 *
12656 * @param {String} str
12657 * @return {Number}
12658 * @api private
12659 */
12660
12661function parse(str) {
12662 str = String(str);
12663 if (str.length > 100) {
12664 return;
12665 }
12666 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(
12667 str
12668 );
12669 if (!match) {
12670 return;
12671 }
12672 var n = parseFloat(match[1]);
12673 var type = (match[2] || 'ms').toLowerCase();
12674 switch (type) {
12675 case 'years':
12676 case 'year':
12677 case 'yrs':
12678 case 'yr':
12679 case 'y':
12680 return n * y;
12681 case 'weeks':
12682 case 'week':
12683 case 'w':
12684 return n * w;
12685 case 'days':
12686 case 'day':
12687 case 'd':
12688 return n * d;
12689 case 'hours':
12690 case 'hour':
12691 case 'hrs':
12692 case 'hr':
12693 case 'h':
12694 return n * h;
12695 case 'minutes':
12696 case 'minute':
12697 case 'mins':
12698 case 'min':
12699 case 'm':
12700 return n * m;
12701 case 'seconds':
12702 case 'second':
12703 case 'secs':
12704 case 'sec':
12705 case 's':
12706 return n * s;
12707 case 'milliseconds':
12708 case 'millisecond':
12709 case 'msecs':
12710 case 'msec':
12711 case 'ms':
12712 return n;
12713 default:
12714 return undefined;
12715 }
12716}
12717
12718/**
12719 * Short format for `ms`.
12720 *
12721 * @param {Number} ms
12722 * @return {String}
12723 * @api private
12724 */
12725
12726function fmtShort(ms) {
12727 var msAbs = Math.abs(ms);
12728 if (msAbs >= d) {
12729 return Math.round(ms / d) + 'd';
12730 }
12731 if (msAbs >= h) {
12732 return Math.round(ms / h) + 'h';
12733 }
12734 if (msAbs >= m) {
12735 return Math.round(ms / m) + 'm';
12736 }
12737 if (msAbs >= s) {
12738 return Math.round(ms / s) + 's';
12739 }
12740 return ms + 'ms';
12741}
12742
12743/**
12744 * Long format for `ms`.
12745 *
12746 * @param {Number} ms
12747 * @return {String}
12748 * @api private
12749 */
12750
12751function fmtLong(ms) {
12752 var msAbs = Math.abs(ms);
12753 if (msAbs >= d) {
12754 return plural(ms, msAbs, d, 'day');
12755 }
12756 if (msAbs >= h) {
12757 return plural(ms, msAbs, h, 'hour');
12758 }
12759 if (msAbs >= m) {
12760 return plural(ms, msAbs, m, 'minute');
12761 }
12762 if (msAbs >= s) {
12763 return plural(ms, msAbs, s, 'second');
12764 }
12765 return ms + ' ms';
12766}
12767
12768/**
12769 * Pluralization helper.
12770 */
12771
12772function plural(ms, msAbs, n, name) {
12773 var isPlural = msAbs >= n * 1.5;
12774 return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');
12775}
12776
12777
12778/***/ }),
12779/* 417 */
12780/***/ (function(module, exports, __webpack_require__) {
12781
12782__webpack_require__(418);
12783var path = __webpack_require__(5);
12784
12785module.exports = path.Object.getPrototypeOf;
12786
12787
12788/***/ }),
12789/* 418 */
12790/***/ (function(module, exports, __webpack_require__) {
12791
12792var $ = __webpack_require__(0);
12793var fails = __webpack_require__(2);
12794var toObject = __webpack_require__(34);
12795var nativeGetPrototypeOf = __webpack_require__(100);
12796var CORRECT_PROTOTYPE_GETTER = __webpack_require__(162);
12797
12798var FAILS_ON_PRIMITIVES = fails(function () { nativeGetPrototypeOf(1); });
12799
12800// `Object.getPrototypeOf` method
12801// https://tc39.es/ecma262/#sec-object.getprototypeof
12802$({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES, sham: !CORRECT_PROTOTYPE_GETTER }, {
12803 getPrototypeOf: function getPrototypeOf(it) {
12804 return nativeGetPrototypeOf(toObject(it));
12805 }
12806});
12807
12808
12809
12810/***/ }),
12811/* 419 */
12812/***/ (function(module, exports, __webpack_require__) {
12813
12814__webpack_require__(420);
12815var path = __webpack_require__(5);
12816
12817module.exports = path.Object.setPrototypeOf;
12818
12819
12820/***/ }),
12821/* 420 */
12822/***/ (function(module, exports, __webpack_require__) {
12823
12824var $ = __webpack_require__(0);
12825var setPrototypeOf = __webpack_require__(102);
12826
12827// `Object.setPrototypeOf` method
12828// https://tc39.es/ecma262/#sec-object.setprototypeof
12829$({ target: 'Object', stat: true }, {
12830 setPrototypeOf: setPrototypeOf
12831});
12832
12833
12834/***/ }),
12835/* 421 */
12836/***/ (function(module, exports, __webpack_require__) {
12837
12838"use strict";
12839
12840
12841var _interopRequireDefault = __webpack_require__(1);
12842
12843var _slice = _interopRequireDefault(__webpack_require__(61));
12844
12845var _concat = _interopRequireDefault(__webpack_require__(22));
12846
12847var _defineProperty = _interopRequireDefault(__webpack_require__(92));
12848
12849var AV = __webpack_require__(69);
12850
12851var AppRouter = __webpack_require__(427);
12852
12853var _require = __webpack_require__(30),
12854 isNullOrUndefined = _require.isNullOrUndefined;
12855
12856var _require2 = __webpack_require__(3),
12857 extend = _require2.extend,
12858 isObject = _require2.isObject,
12859 isEmpty = _require2.isEmpty;
12860
12861var isCNApp = function isCNApp(appId) {
12862 return (0, _slice.default)(appId).call(appId, -9) !== '-MdYXbMMI';
12863};
12864
12865var fillServerURLs = function fillServerURLs(url) {
12866 return {
12867 push: url,
12868 stats: url,
12869 engine: url,
12870 api: url,
12871 rtm: url
12872 };
12873};
12874
12875function getDefaultServerURLs(appId) {
12876 var _context, _context2, _context3, _context4, _context5;
12877
12878 if (isCNApp(appId)) {
12879 return {};
12880 }
12881
12882 var id = (0, _slice.default)(appId).call(appId, 0, 8).toLowerCase();
12883 var domain = 'lncldglobal.com';
12884 return {
12885 push: (0, _concat.default)(_context = "https://".concat(id, ".push.")).call(_context, domain),
12886 stats: (0, _concat.default)(_context2 = "https://".concat(id, ".stats.")).call(_context2, domain),
12887 engine: (0, _concat.default)(_context3 = "https://".concat(id, ".engine.")).call(_context3, domain),
12888 api: (0, _concat.default)(_context4 = "https://".concat(id, ".api.")).call(_context4, domain),
12889 rtm: (0, _concat.default)(_context5 = "https://".concat(id, ".rtm.")).call(_context5, domain)
12890 };
12891}
12892
12893var _disableAppRouter = false;
12894var _initialized = false;
12895/**
12896 * URLs for services
12897 * @typedef {Object} ServerURLs
12898 * @property {String} [api] serverURL for API service
12899 * @property {String} [engine] serverURL for engine service
12900 * @property {String} [stats] serverURL for stats service
12901 * @property {String} [push] serverURL for push service
12902 * @property {String} [rtm] serverURL for LiveQuery service
12903 */
12904
12905/**
12906 * Call this method first to set up your authentication tokens for AV.
12907 * You can get your app keys from the LeanCloud dashboard on http://leancloud.cn .
12908 * @function AV.init
12909 * @param {Object} options
12910 * @param {String} options.appId application id
12911 * @param {String} options.appKey application key
12912 * @param {String} [options.masterKey] application master key
12913 * @param {Boolean} [options.production]
12914 * @param {String|ServerURLs} [options.serverURL] URLs for services. if a string was given, it will be applied for all services.
12915 * @param {Boolean} [options.disableCurrentUser]
12916 */
12917
12918AV.init = function init(options) {
12919 if (!isObject(options)) {
12920 return AV.init({
12921 appId: options,
12922 appKey: arguments.length <= 1 ? undefined : arguments[1],
12923 masterKey: arguments.length <= 2 ? undefined : arguments[2]
12924 });
12925 }
12926
12927 var appId = options.appId,
12928 appKey = options.appKey,
12929 masterKey = options.masterKey,
12930 hookKey = options.hookKey,
12931 serverURL = options.serverURL,
12932 _options$serverURLs = options.serverURLs,
12933 serverURLs = _options$serverURLs === void 0 ? serverURL : _options$serverURLs,
12934 disableCurrentUser = options.disableCurrentUser,
12935 production = options.production,
12936 realtime = options.realtime;
12937 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.');
12938 if (!appId) throw new TypeError('appId must be a string');
12939 if (!appKey) throw new TypeError('appKey must be a string');
12940 if ("Weapp" !== 'NODE_JS' && masterKey) console.warn('MasterKey is not supposed to be used at client side.');
12941
12942 if (isCNApp(appId)) {
12943 if (!serverURLs && isEmpty(AV._config.serverURLs)) {
12944 throw new TypeError("serverURL option is required for apps from CN region");
12945 }
12946 }
12947
12948 if (appId !== AV._config.applicationId) {
12949 // overwrite all keys when reinitializing as a new app
12950 AV._config.masterKey = masterKey;
12951 AV._config.hookKey = hookKey;
12952 } else {
12953 if (masterKey) AV._config.masterKey = masterKey;
12954 if (hookKey) AV._config.hookKey = hookKey;
12955 }
12956
12957 AV._config.applicationId = appId;
12958 AV._config.applicationKey = appKey;
12959
12960 if (!isNullOrUndefined(production)) {
12961 AV.setProduction(production);
12962 }
12963
12964 if (typeof disableCurrentUser !== 'undefined') AV._config.disableCurrentUser = disableCurrentUser;
12965 var disableAppRouter = _disableAppRouter || typeof serverURLs !== 'undefined';
12966
12967 if (!disableAppRouter) {
12968 AV._appRouter = new AppRouter(AV);
12969 }
12970
12971 AV._setServerURLs(extend({}, getDefaultServerURLs(appId), AV._config.serverURLs, typeof serverURLs === 'string' ? fillServerURLs(serverURLs) : serverURLs), disableAppRouter);
12972
12973 if (realtime) {
12974 AV._config.realtime = realtime;
12975 } else if (AV._sharedConfig.liveQueryRealtime) {
12976 var _AV$_config$serverURL = AV._config.serverURLs,
12977 api = _AV$_config$serverURL.api,
12978 rtm = _AV$_config$serverURL.rtm;
12979 AV._config.realtime = new AV._sharedConfig.liveQueryRealtime({
12980 appId: appId,
12981 appKey: appKey,
12982 server: {
12983 api: api,
12984 RTMRouter: rtm
12985 }
12986 });
12987 }
12988
12989 _initialized = true;
12990}; // If we're running in node.js, allow using the master key.
12991
12992
12993if (false) {
12994 AV.Cloud = AV.Cloud || {};
12995 /**
12996 * Switches the LeanCloud SDK to using the Master key. The Master key grants
12997 * priveleged access to the data in LeanCloud and can be used to bypass ACLs and
12998 * other restrictions that are applied to the client SDKs.
12999 * <p><strong><em>Available in Cloud Code and Node.js only.</em></strong>
13000 * </p>
13001 */
13002
13003 AV.Cloud.useMasterKey = function () {
13004 AV._config.useMasterKey = true;
13005 };
13006}
13007/**
13008 * Call this method to set production environment variable.
13009 * @function AV.setProduction
13010 * @param {Boolean} production True is production environment,and
13011 * it's true by default.
13012 */
13013
13014
13015AV.setProduction = function (production) {
13016 if (!isNullOrUndefined(production)) {
13017 AV._config.production = production ? 1 : 0;
13018 } else {
13019 // change to default value
13020 AV._config.production = null;
13021 }
13022};
13023
13024AV._setServerURLs = function (urls) {
13025 var disableAppRouter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
13026
13027 if (typeof urls !== 'string') {
13028 extend(AV._config.serverURLs, urls);
13029 } else {
13030 AV._config.serverURLs = fillServerURLs(urls);
13031 }
13032
13033 if (disableAppRouter) {
13034 if (AV._appRouter) {
13035 AV._appRouter.disable();
13036 } else {
13037 _disableAppRouter = true;
13038 }
13039 }
13040};
13041/**
13042 * Set server URLs for services.
13043 * @function AV.setServerURL
13044 * @since 4.3.0
13045 * @param {String|ServerURLs} urls URLs for services. if a string was given, it will be applied for all services.
13046 * You can also set them when initializing SDK with `options.serverURL`
13047 */
13048
13049
13050AV.setServerURL = function (urls) {
13051 return AV._setServerURLs(urls);
13052};
13053
13054AV.setServerURLs = AV.setServerURL;
13055
13056AV.keepErrorRawMessage = function (value) {
13057 AV._sharedConfig.keepErrorRawMessage = value;
13058};
13059/**
13060 * Set a deadline for requests to complete.
13061 * Note that file upload requests are not affected.
13062 * @function AV.setRequestTimeout
13063 * @since 3.6.0
13064 * @param {number} ms
13065 */
13066
13067
13068AV.setRequestTimeout = function (ms) {
13069 AV._config.requestTimeout = ms;
13070}; // backword compatible
13071
13072
13073AV.initialize = AV.init;
13074
13075var defineConfig = function defineConfig(property) {
13076 return (0, _defineProperty.default)(AV, property, {
13077 get: function get() {
13078 return AV._config[property];
13079 },
13080 set: function set(value) {
13081 AV._config[property] = value;
13082 }
13083 });
13084};
13085
13086['applicationId', 'applicationKey', 'masterKey', 'hookKey'].forEach(defineConfig);
13087
13088/***/ }),
13089/* 422 */
13090/***/ (function(module, exports, __webpack_require__) {
13091
13092var isPrototypeOf = __webpack_require__(19);
13093var method = __webpack_require__(423);
13094
13095var ArrayPrototype = Array.prototype;
13096
13097module.exports = function (it) {
13098 var own = it.slice;
13099 return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.slice) ? method : own;
13100};
13101
13102
13103/***/ }),
13104/* 423 */
13105/***/ (function(module, exports, __webpack_require__) {
13106
13107__webpack_require__(424);
13108var entryVirtual = __webpack_require__(40);
13109
13110module.exports = entryVirtual('Array').slice;
13111
13112
13113/***/ }),
13114/* 424 */
13115/***/ (function(module, exports, __webpack_require__) {
13116
13117"use strict";
13118
13119var $ = __webpack_require__(0);
13120var isArray = __webpack_require__(90);
13121var isConstructor = __webpack_require__(109);
13122var isObject = __webpack_require__(11);
13123var toAbsoluteIndex = __webpack_require__(126);
13124var lengthOfArrayLike = __webpack_require__(41);
13125var toIndexedObject = __webpack_require__(32);
13126var createProperty = __webpack_require__(91);
13127var wellKnownSymbol = __webpack_require__(9);
13128var arrayMethodHasSpeciesSupport = __webpack_require__(114);
13129var un$Slice = __webpack_require__(110);
13130
13131var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('slice');
13132
13133var SPECIES = wellKnownSymbol('species');
13134var $Array = Array;
13135var max = Math.max;
13136
13137// `Array.prototype.slice` method
13138// https://tc39.es/ecma262/#sec-array.prototype.slice
13139// fallback for not array-like ES3 strings and DOM objects
13140$({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT }, {
13141 slice: function slice(start, end) {
13142 var O = toIndexedObject(this);
13143 var length = lengthOfArrayLike(O);
13144 var k = toAbsoluteIndex(start, length);
13145 var fin = toAbsoluteIndex(end === undefined ? length : end, length);
13146 // inline `ArraySpeciesCreate` for usage native `Array#slice` where it's possible
13147 var Constructor, result, n;
13148 if (isArray(O)) {
13149 Constructor = O.constructor;
13150 // cross-realm fallback
13151 if (isConstructor(Constructor) && (Constructor === $Array || isArray(Constructor.prototype))) {
13152 Constructor = undefined;
13153 } else if (isObject(Constructor)) {
13154 Constructor = Constructor[SPECIES];
13155 if (Constructor === null) Constructor = undefined;
13156 }
13157 if (Constructor === $Array || Constructor === undefined) {
13158 return un$Slice(O, k, fin);
13159 }
13160 }
13161 result = new (Constructor === undefined ? $Array : Constructor)(max(fin - k, 0));
13162 for (n = 0; k < fin; k++, n++) if (k in O) createProperty(result, n, O[k]);
13163 result.length = n;
13164 return result;
13165 }
13166});
13167
13168
13169/***/ }),
13170/* 425 */
13171/***/ (function(module, exports, __webpack_require__) {
13172
13173__webpack_require__(426);
13174var path = __webpack_require__(5);
13175
13176var Object = path.Object;
13177
13178var defineProperty = module.exports = function defineProperty(it, key, desc) {
13179 return Object.defineProperty(it, key, desc);
13180};
13181
13182if (Object.defineProperty.sham) defineProperty.sham = true;
13183
13184
13185/***/ }),
13186/* 426 */
13187/***/ (function(module, exports, __webpack_require__) {
13188
13189var $ = __webpack_require__(0);
13190var DESCRIPTORS = __webpack_require__(14);
13191var defineProperty = __webpack_require__(23).f;
13192
13193// `Object.defineProperty` method
13194// https://tc39.es/ecma262/#sec-object.defineproperty
13195// eslint-disable-next-line es-x/no-object-defineproperty -- safe
13196$({ target: 'Object', stat: true, forced: Object.defineProperty !== defineProperty, sham: !DESCRIPTORS }, {
13197 defineProperty: defineProperty
13198});
13199
13200
13201/***/ }),
13202/* 427 */
13203/***/ (function(module, exports, __webpack_require__) {
13204
13205"use strict";
13206
13207
13208var ajax = __webpack_require__(116);
13209
13210var Cache = __webpack_require__(238);
13211
13212function AppRouter(AV) {
13213 var _this = this;
13214
13215 this.AV = AV;
13216 this.lockedUntil = 0;
13217 Cache.getAsync('serverURLs').then(function (data) {
13218 if (_this.disabled) return;
13219 if (!data) return _this.lock(0);
13220 var serverURLs = data.serverURLs,
13221 lockedUntil = data.lockedUntil;
13222
13223 _this.AV._setServerURLs(serverURLs, false);
13224
13225 _this.lockedUntil = lockedUntil;
13226 }).catch(function () {
13227 return _this.lock(0);
13228 });
13229}
13230
13231AppRouter.prototype.disable = function disable() {
13232 this.disabled = true;
13233};
13234
13235AppRouter.prototype.lock = function lock(ttl) {
13236 this.lockedUntil = Date.now() + ttl;
13237};
13238
13239AppRouter.prototype.refresh = function refresh() {
13240 var _this2 = this;
13241
13242 if (this.disabled) return;
13243 if (Date.now() < this.lockedUntil) return;
13244 this.lock(10);
13245 var url = 'https://app-router.com/2/route';
13246 return ajax({
13247 method: 'get',
13248 url: url,
13249 query: {
13250 appId: this.AV.applicationId
13251 }
13252 }).then(function (servers) {
13253 if (_this2.disabled) return;
13254 var ttl = servers.ttl;
13255 if (!ttl) throw new Error('missing ttl');
13256 ttl = ttl * 1000;
13257 var protocal = 'https://';
13258 var serverURLs = {
13259 push: protocal + servers.push_server,
13260 stats: protocal + servers.stats_server,
13261 engine: protocal + servers.engine_server,
13262 api: protocal + servers.api_server
13263 };
13264
13265 _this2.AV._setServerURLs(serverURLs, false);
13266
13267 _this2.lock(ttl);
13268
13269 return Cache.setAsync('serverURLs', {
13270 serverURLs: serverURLs,
13271 lockedUntil: _this2.lockedUntil
13272 }, ttl);
13273 }).catch(function (error) {
13274 // bypass all errors
13275 console.warn("refresh server URLs failed: ".concat(error.message));
13276
13277 _this2.lock(600);
13278 });
13279};
13280
13281module.exports = AppRouter;
13282
13283/***/ }),
13284/* 428 */
13285/***/ (function(module, exports, __webpack_require__) {
13286
13287module.exports = __webpack_require__(429);
13288
13289
13290/***/ }),
13291/* 429 */
13292/***/ (function(module, exports, __webpack_require__) {
13293
13294var parent = __webpack_require__(430);
13295__webpack_require__(453);
13296__webpack_require__(454);
13297__webpack_require__(455);
13298__webpack_require__(456);
13299__webpack_require__(457);
13300// TODO: Remove from `core-js@4`
13301__webpack_require__(458);
13302__webpack_require__(459);
13303__webpack_require__(460);
13304
13305module.exports = parent;
13306
13307
13308/***/ }),
13309/* 430 */
13310/***/ (function(module, exports, __webpack_require__) {
13311
13312var parent = __webpack_require__(244);
13313
13314module.exports = parent;
13315
13316
13317/***/ }),
13318/* 431 */
13319/***/ (function(module, exports, __webpack_require__) {
13320
13321__webpack_require__(229);
13322__webpack_require__(53);
13323__webpack_require__(245);
13324__webpack_require__(437);
13325__webpack_require__(438);
13326__webpack_require__(439);
13327__webpack_require__(440);
13328__webpack_require__(249);
13329__webpack_require__(441);
13330__webpack_require__(442);
13331__webpack_require__(443);
13332__webpack_require__(444);
13333__webpack_require__(445);
13334__webpack_require__(446);
13335__webpack_require__(447);
13336__webpack_require__(448);
13337__webpack_require__(449);
13338__webpack_require__(450);
13339__webpack_require__(451);
13340__webpack_require__(452);
13341var path = __webpack_require__(5);
13342
13343module.exports = path.Symbol;
13344
13345
13346/***/ }),
13347/* 432 */
13348/***/ (function(module, exports, __webpack_require__) {
13349
13350"use strict";
13351
13352var $ = __webpack_require__(0);
13353var global = __webpack_require__(7);
13354var call = __webpack_require__(15);
13355var uncurryThis = __webpack_require__(4);
13356var IS_PURE = __webpack_require__(33);
13357var DESCRIPTORS = __webpack_require__(14);
13358var NATIVE_SYMBOL = __webpack_require__(64);
13359var fails = __webpack_require__(2);
13360var hasOwn = __webpack_require__(13);
13361var isPrototypeOf = __webpack_require__(19);
13362var anObject = __webpack_require__(20);
13363var toIndexedObject = __webpack_require__(32);
13364var toPropertyKey = __webpack_require__(96);
13365var $toString = __webpack_require__(81);
13366var createPropertyDescriptor = __webpack_require__(47);
13367var nativeObjectCreate = __webpack_require__(49);
13368var objectKeys = __webpack_require__(105);
13369var getOwnPropertyNamesModule = __webpack_require__(103);
13370var getOwnPropertyNamesExternal = __webpack_require__(246);
13371var getOwnPropertySymbolsModule = __webpack_require__(104);
13372var getOwnPropertyDescriptorModule = __webpack_require__(62);
13373var definePropertyModule = __webpack_require__(23);
13374var definePropertiesModule = __webpack_require__(129);
13375var propertyIsEnumerableModule = __webpack_require__(121);
13376var defineBuiltIn = __webpack_require__(44);
13377var shared = __webpack_require__(79);
13378var sharedKey = __webpack_require__(101);
13379var hiddenKeys = __webpack_require__(80);
13380var uid = __webpack_require__(99);
13381var wellKnownSymbol = __webpack_require__(9);
13382var wrappedWellKnownSymbolModule = __webpack_require__(149);
13383var defineWellKnownSymbol = __webpack_require__(10);
13384var defineSymbolToPrimitive = __webpack_require__(247);
13385var setToStringTag = __webpack_require__(52);
13386var InternalStateModule = __webpack_require__(43);
13387var $forEach = __webpack_require__(70).forEach;
13388
13389var HIDDEN = sharedKey('hidden');
13390var SYMBOL = 'Symbol';
13391var PROTOTYPE = 'prototype';
13392
13393var setInternalState = InternalStateModule.set;
13394var getInternalState = InternalStateModule.getterFor(SYMBOL);
13395
13396var ObjectPrototype = Object[PROTOTYPE];
13397var $Symbol = global.Symbol;
13398var SymbolPrototype = $Symbol && $Symbol[PROTOTYPE];
13399var TypeError = global.TypeError;
13400var QObject = global.QObject;
13401var nativeGetOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
13402var nativeDefineProperty = definePropertyModule.f;
13403var nativeGetOwnPropertyNames = getOwnPropertyNamesExternal.f;
13404var nativePropertyIsEnumerable = propertyIsEnumerableModule.f;
13405var push = uncurryThis([].push);
13406
13407var AllSymbols = shared('symbols');
13408var ObjectPrototypeSymbols = shared('op-symbols');
13409var WellKnownSymbolsStore = shared('wks');
13410
13411// Don't use setters in Qt Script, https://github.com/zloirock/core-js/issues/173
13412var USE_SETTER = !QObject || !QObject[PROTOTYPE] || !QObject[PROTOTYPE].findChild;
13413
13414// fallback for old Android, https://code.google.com/p/v8/issues/detail?id=687
13415var setSymbolDescriptor = DESCRIPTORS && fails(function () {
13416 return nativeObjectCreate(nativeDefineProperty({}, 'a', {
13417 get: function () { return nativeDefineProperty(this, 'a', { value: 7 }).a; }
13418 })).a != 7;
13419}) ? function (O, P, Attributes) {
13420 var ObjectPrototypeDescriptor = nativeGetOwnPropertyDescriptor(ObjectPrototype, P);
13421 if (ObjectPrototypeDescriptor) delete ObjectPrototype[P];
13422 nativeDefineProperty(O, P, Attributes);
13423 if (ObjectPrototypeDescriptor && O !== ObjectPrototype) {
13424 nativeDefineProperty(ObjectPrototype, P, ObjectPrototypeDescriptor);
13425 }
13426} : nativeDefineProperty;
13427
13428var wrap = function (tag, description) {
13429 var symbol = AllSymbols[tag] = nativeObjectCreate(SymbolPrototype);
13430 setInternalState(symbol, {
13431 type: SYMBOL,
13432 tag: tag,
13433 description: description
13434 });
13435 if (!DESCRIPTORS) symbol.description = description;
13436 return symbol;
13437};
13438
13439var $defineProperty = function defineProperty(O, P, Attributes) {
13440 if (O === ObjectPrototype) $defineProperty(ObjectPrototypeSymbols, P, Attributes);
13441 anObject(O);
13442 var key = toPropertyKey(P);
13443 anObject(Attributes);
13444 if (hasOwn(AllSymbols, key)) {
13445 if (!Attributes.enumerable) {
13446 if (!hasOwn(O, HIDDEN)) nativeDefineProperty(O, HIDDEN, createPropertyDescriptor(1, {}));
13447 O[HIDDEN][key] = true;
13448 } else {
13449 if (hasOwn(O, HIDDEN) && O[HIDDEN][key]) O[HIDDEN][key] = false;
13450 Attributes = nativeObjectCreate(Attributes, { enumerable: createPropertyDescriptor(0, false) });
13451 } return setSymbolDescriptor(O, key, Attributes);
13452 } return nativeDefineProperty(O, key, Attributes);
13453};
13454
13455var $defineProperties = function defineProperties(O, Properties) {
13456 anObject(O);
13457 var properties = toIndexedObject(Properties);
13458 var keys = objectKeys(properties).concat($getOwnPropertySymbols(properties));
13459 $forEach(keys, function (key) {
13460 if (!DESCRIPTORS || call($propertyIsEnumerable, properties, key)) $defineProperty(O, key, properties[key]);
13461 });
13462 return O;
13463};
13464
13465var $create = function create(O, Properties) {
13466 return Properties === undefined ? nativeObjectCreate(O) : $defineProperties(nativeObjectCreate(O), Properties);
13467};
13468
13469var $propertyIsEnumerable = function propertyIsEnumerable(V) {
13470 var P = toPropertyKey(V);
13471 var enumerable = call(nativePropertyIsEnumerable, this, P);
13472 if (this === ObjectPrototype && hasOwn(AllSymbols, P) && !hasOwn(ObjectPrototypeSymbols, P)) return false;
13473 return enumerable || !hasOwn(this, P) || !hasOwn(AllSymbols, P) || hasOwn(this, HIDDEN) && this[HIDDEN][P]
13474 ? enumerable : true;
13475};
13476
13477var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(O, P) {
13478 var it = toIndexedObject(O);
13479 var key = toPropertyKey(P);
13480 if (it === ObjectPrototype && hasOwn(AllSymbols, key) && !hasOwn(ObjectPrototypeSymbols, key)) return;
13481 var descriptor = nativeGetOwnPropertyDescriptor(it, key);
13482 if (descriptor && hasOwn(AllSymbols, key) && !(hasOwn(it, HIDDEN) && it[HIDDEN][key])) {
13483 descriptor.enumerable = true;
13484 }
13485 return descriptor;
13486};
13487
13488var $getOwnPropertyNames = function getOwnPropertyNames(O) {
13489 var names = nativeGetOwnPropertyNames(toIndexedObject(O));
13490 var result = [];
13491 $forEach(names, function (key) {
13492 if (!hasOwn(AllSymbols, key) && !hasOwn(hiddenKeys, key)) push(result, key);
13493 });
13494 return result;
13495};
13496
13497var $getOwnPropertySymbols = function (O) {
13498 var IS_OBJECT_PROTOTYPE = O === ObjectPrototype;
13499 var names = nativeGetOwnPropertyNames(IS_OBJECT_PROTOTYPE ? ObjectPrototypeSymbols : toIndexedObject(O));
13500 var result = [];
13501 $forEach(names, function (key) {
13502 if (hasOwn(AllSymbols, key) && (!IS_OBJECT_PROTOTYPE || hasOwn(ObjectPrototype, key))) {
13503 push(result, AllSymbols[key]);
13504 }
13505 });
13506 return result;
13507};
13508
13509// `Symbol` constructor
13510// https://tc39.es/ecma262/#sec-symbol-constructor
13511if (!NATIVE_SYMBOL) {
13512 $Symbol = function Symbol() {
13513 if (isPrototypeOf(SymbolPrototype, this)) throw TypeError('Symbol is not a constructor');
13514 var description = !arguments.length || arguments[0] === undefined ? undefined : $toString(arguments[0]);
13515 var tag = uid(description);
13516 var setter = function (value) {
13517 if (this === ObjectPrototype) call(setter, ObjectPrototypeSymbols, value);
13518 if (hasOwn(this, HIDDEN) && hasOwn(this[HIDDEN], tag)) this[HIDDEN][tag] = false;
13519 setSymbolDescriptor(this, tag, createPropertyDescriptor(1, value));
13520 };
13521 if (DESCRIPTORS && USE_SETTER) setSymbolDescriptor(ObjectPrototype, tag, { configurable: true, set: setter });
13522 return wrap(tag, description);
13523 };
13524
13525 SymbolPrototype = $Symbol[PROTOTYPE];
13526
13527 defineBuiltIn(SymbolPrototype, 'toString', function toString() {
13528 return getInternalState(this).tag;
13529 });
13530
13531 defineBuiltIn($Symbol, 'withoutSetter', function (description) {
13532 return wrap(uid(description), description);
13533 });
13534
13535 propertyIsEnumerableModule.f = $propertyIsEnumerable;
13536 definePropertyModule.f = $defineProperty;
13537 definePropertiesModule.f = $defineProperties;
13538 getOwnPropertyDescriptorModule.f = $getOwnPropertyDescriptor;
13539 getOwnPropertyNamesModule.f = getOwnPropertyNamesExternal.f = $getOwnPropertyNames;
13540 getOwnPropertySymbolsModule.f = $getOwnPropertySymbols;
13541
13542 wrappedWellKnownSymbolModule.f = function (name) {
13543 return wrap(wellKnownSymbol(name), name);
13544 };
13545
13546 if (DESCRIPTORS) {
13547 // https://github.com/tc39/proposal-Symbol-description
13548 nativeDefineProperty(SymbolPrototype, 'description', {
13549 configurable: true,
13550 get: function description() {
13551 return getInternalState(this).description;
13552 }
13553 });
13554 if (!IS_PURE) {
13555 defineBuiltIn(ObjectPrototype, 'propertyIsEnumerable', $propertyIsEnumerable, { unsafe: true });
13556 }
13557 }
13558}
13559
13560$({ global: true, constructor: true, wrap: true, forced: !NATIVE_SYMBOL, sham: !NATIVE_SYMBOL }, {
13561 Symbol: $Symbol
13562});
13563
13564$forEach(objectKeys(WellKnownSymbolsStore), function (name) {
13565 defineWellKnownSymbol(name);
13566});
13567
13568$({ target: SYMBOL, stat: true, forced: !NATIVE_SYMBOL }, {
13569 useSetter: function () { USE_SETTER = true; },
13570 useSimple: function () { USE_SETTER = false; }
13571});
13572
13573$({ target: 'Object', stat: true, forced: !NATIVE_SYMBOL, sham: !DESCRIPTORS }, {
13574 // `Object.create` method
13575 // https://tc39.es/ecma262/#sec-object.create
13576 create: $create,
13577 // `Object.defineProperty` method
13578 // https://tc39.es/ecma262/#sec-object.defineproperty
13579 defineProperty: $defineProperty,
13580 // `Object.defineProperties` method
13581 // https://tc39.es/ecma262/#sec-object.defineproperties
13582 defineProperties: $defineProperties,
13583 // `Object.getOwnPropertyDescriptor` method
13584 // https://tc39.es/ecma262/#sec-object.getownpropertydescriptors
13585 getOwnPropertyDescriptor: $getOwnPropertyDescriptor
13586});
13587
13588$({ target: 'Object', stat: true, forced: !NATIVE_SYMBOL }, {
13589 // `Object.getOwnPropertyNames` method
13590 // https://tc39.es/ecma262/#sec-object.getownpropertynames
13591 getOwnPropertyNames: $getOwnPropertyNames
13592});
13593
13594// `Symbol.prototype[@@toPrimitive]` method
13595// https://tc39.es/ecma262/#sec-symbol.prototype-@@toprimitive
13596defineSymbolToPrimitive();
13597
13598// `Symbol.prototype[@@toStringTag]` property
13599// https://tc39.es/ecma262/#sec-symbol.prototype-@@tostringtag
13600setToStringTag($Symbol, SYMBOL);
13601
13602hiddenKeys[HIDDEN] = true;
13603
13604
13605/***/ }),
13606/* 433 */
13607/***/ (function(module, exports, __webpack_require__) {
13608
13609var toAbsoluteIndex = __webpack_require__(126);
13610var lengthOfArrayLike = __webpack_require__(41);
13611var createProperty = __webpack_require__(91);
13612
13613var $Array = Array;
13614var max = Math.max;
13615
13616module.exports = function (O, start, end) {
13617 var length = lengthOfArrayLike(O);
13618 var k = toAbsoluteIndex(start, length);
13619 var fin = toAbsoluteIndex(end === undefined ? length : end, length);
13620 var result = $Array(max(fin - k, 0));
13621 for (var n = 0; k < fin; k++, n++) createProperty(result, n, O[k]);
13622 result.length = n;
13623 return result;
13624};
13625
13626
13627/***/ }),
13628/* 434 */
13629/***/ (function(module, exports, __webpack_require__) {
13630
13631var $ = __webpack_require__(0);
13632var getBuiltIn = __webpack_require__(18);
13633var hasOwn = __webpack_require__(13);
13634var toString = __webpack_require__(81);
13635var shared = __webpack_require__(79);
13636var NATIVE_SYMBOL_REGISTRY = __webpack_require__(248);
13637
13638var StringToSymbolRegistry = shared('string-to-symbol-registry');
13639var SymbolToStringRegistry = shared('symbol-to-string-registry');
13640
13641// `Symbol.for` method
13642// https://tc39.es/ecma262/#sec-symbol.for
13643$({ target: 'Symbol', stat: true, forced: !NATIVE_SYMBOL_REGISTRY }, {
13644 'for': function (key) {
13645 var string = toString(key);
13646 if (hasOwn(StringToSymbolRegistry, string)) return StringToSymbolRegistry[string];
13647 var symbol = getBuiltIn('Symbol')(string);
13648 StringToSymbolRegistry[string] = symbol;
13649 SymbolToStringRegistry[symbol] = string;
13650 return symbol;
13651 }
13652});
13653
13654
13655/***/ }),
13656/* 435 */
13657/***/ (function(module, exports, __webpack_require__) {
13658
13659var $ = __webpack_require__(0);
13660var hasOwn = __webpack_require__(13);
13661var isSymbol = __webpack_require__(97);
13662var tryToString = __webpack_require__(78);
13663var shared = __webpack_require__(79);
13664var NATIVE_SYMBOL_REGISTRY = __webpack_require__(248);
13665
13666var SymbolToStringRegistry = shared('symbol-to-string-registry');
13667
13668// `Symbol.keyFor` method
13669// https://tc39.es/ecma262/#sec-symbol.keyfor
13670$({ target: 'Symbol', stat: true, forced: !NATIVE_SYMBOL_REGISTRY }, {
13671 keyFor: function keyFor(sym) {
13672 if (!isSymbol(sym)) throw TypeError(tryToString(sym) + ' is not a symbol');
13673 if (hasOwn(SymbolToStringRegistry, sym)) return SymbolToStringRegistry[sym];
13674 }
13675});
13676
13677
13678/***/ }),
13679/* 436 */
13680/***/ (function(module, exports, __webpack_require__) {
13681
13682var $ = __webpack_require__(0);
13683var NATIVE_SYMBOL = __webpack_require__(64);
13684var fails = __webpack_require__(2);
13685var getOwnPropertySymbolsModule = __webpack_require__(104);
13686var toObject = __webpack_require__(34);
13687
13688// V8 ~ Chrome 38 and 39 `Object.getOwnPropertySymbols` fails on primitives
13689// https://bugs.chromium.org/p/v8/issues/detail?id=3443
13690var FORCED = !NATIVE_SYMBOL || fails(function () { getOwnPropertySymbolsModule.f(1); });
13691
13692// `Object.getOwnPropertySymbols` method
13693// https://tc39.es/ecma262/#sec-object.getownpropertysymbols
13694$({ target: 'Object', stat: true, forced: FORCED }, {
13695 getOwnPropertySymbols: function getOwnPropertySymbols(it) {
13696 var $getOwnPropertySymbols = getOwnPropertySymbolsModule.f;
13697 return $getOwnPropertySymbols ? $getOwnPropertySymbols(toObject(it)) : [];
13698 }
13699});
13700
13701
13702/***/ }),
13703/* 437 */
13704/***/ (function(module, exports, __webpack_require__) {
13705
13706var defineWellKnownSymbol = __webpack_require__(10);
13707
13708// `Symbol.asyncIterator` well-known symbol
13709// https://tc39.es/ecma262/#sec-symbol.asynciterator
13710defineWellKnownSymbol('asyncIterator');
13711
13712
13713/***/ }),
13714/* 438 */
13715/***/ (function(module, exports) {
13716
13717// empty
13718
13719
13720/***/ }),
13721/* 439 */
13722/***/ (function(module, exports, __webpack_require__) {
13723
13724var defineWellKnownSymbol = __webpack_require__(10);
13725
13726// `Symbol.hasInstance` well-known symbol
13727// https://tc39.es/ecma262/#sec-symbol.hasinstance
13728defineWellKnownSymbol('hasInstance');
13729
13730
13731/***/ }),
13732/* 440 */
13733/***/ (function(module, exports, __webpack_require__) {
13734
13735var defineWellKnownSymbol = __webpack_require__(10);
13736
13737// `Symbol.isConcatSpreadable` well-known symbol
13738// https://tc39.es/ecma262/#sec-symbol.isconcatspreadable
13739defineWellKnownSymbol('isConcatSpreadable');
13740
13741
13742/***/ }),
13743/* 441 */
13744/***/ (function(module, exports, __webpack_require__) {
13745
13746var defineWellKnownSymbol = __webpack_require__(10);
13747
13748// `Symbol.match` well-known symbol
13749// https://tc39.es/ecma262/#sec-symbol.match
13750defineWellKnownSymbol('match');
13751
13752
13753/***/ }),
13754/* 442 */
13755/***/ (function(module, exports, __webpack_require__) {
13756
13757var defineWellKnownSymbol = __webpack_require__(10);
13758
13759// `Symbol.matchAll` well-known symbol
13760// https://tc39.es/ecma262/#sec-symbol.matchall
13761defineWellKnownSymbol('matchAll');
13762
13763
13764/***/ }),
13765/* 443 */
13766/***/ (function(module, exports, __webpack_require__) {
13767
13768var defineWellKnownSymbol = __webpack_require__(10);
13769
13770// `Symbol.replace` well-known symbol
13771// https://tc39.es/ecma262/#sec-symbol.replace
13772defineWellKnownSymbol('replace');
13773
13774
13775/***/ }),
13776/* 444 */
13777/***/ (function(module, exports, __webpack_require__) {
13778
13779var defineWellKnownSymbol = __webpack_require__(10);
13780
13781// `Symbol.search` well-known symbol
13782// https://tc39.es/ecma262/#sec-symbol.search
13783defineWellKnownSymbol('search');
13784
13785
13786/***/ }),
13787/* 445 */
13788/***/ (function(module, exports, __webpack_require__) {
13789
13790var defineWellKnownSymbol = __webpack_require__(10);
13791
13792// `Symbol.species` well-known symbol
13793// https://tc39.es/ecma262/#sec-symbol.species
13794defineWellKnownSymbol('species');
13795
13796
13797/***/ }),
13798/* 446 */
13799/***/ (function(module, exports, __webpack_require__) {
13800
13801var defineWellKnownSymbol = __webpack_require__(10);
13802
13803// `Symbol.split` well-known symbol
13804// https://tc39.es/ecma262/#sec-symbol.split
13805defineWellKnownSymbol('split');
13806
13807
13808/***/ }),
13809/* 447 */
13810/***/ (function(module, exports, __webpack_require__) {
13811
13812var defineWellKnownSymbol = __webpack_require__(10);
13813var defineSymbolToPrimitive = __webpack_require__(247);
13814
13815// `Symbol.toPrimitive` well-known symbol
13816// https://tc39.es/ecma262/#sec-symbol.toprimitive
13817defineWellKnownSymbol('toPrimitive');
13818
13819// `Symbol.prototype[@@toPrimitive]` method
13820// https://tc39.es/ecma262/#sec-symbol.prototype-@@toprimitive
13821defineSymbolToPrimitive();
13822
13823
13824/***/ }),
13825/* 448 */
13826/***/ (function(module, exports, __webpack_require__) {
13827
13828var getBuiltIn = __webpack_require__(18);
13829var defineWellKnownSymbol = __webpack_require__(10);
13830var setToStringTag = __webpack_require__(52);
13831
13832// `Symbol.toStringTag` well-known symbol
13833// https://tc39.es/ecma262/#sec-symbol.tostringtag
13834defineWellKnownSymbol('toStringTag');
13835
13836// `Symbol.prototype[@@toStringTag]` property
13837// https://tc39.es/ecma262/#sec-symbol.prototype-@@tostringtag
13838setToStringTag(getBuiltIn('Symbol'), 'Symbol');
13839
13840
13841/***/ }),
13842/* 449 */
13843/***/ (function(module, exports, __webpack_require__) {
13844
13845var defineWellKnownSymbol = __webpack_require__(10);
13846
13847// `Symbol.unscopables` well-known symbol
13848// https://tc39.es/ecma262/#sec-symbol.unscopables
13849defineWellKnownSymbol('unscopables');
13850
13851
13852/***/ }),
13853/* 450 */
13854/***/ (function(module, exports, __webpack_require__) {
13855
13856var global = __webpack_require__(7);
13857var setToStringTag = __webpack_require__(52);
13858
13859// JSON[@@toStringTag] property
13860// https://tc39.es/ecma262/#sec-json-@@tostringtag
13861setToStringTag(global.JSON, 'JSON', true);
13862
13863
13864/***/ }),
13865/* 451 */
13866/***/ (function(module, exports) {
13867
13868// empty
13869
13870
13871/***/ }),
13872/* 452 */
13873/***/ (function(module, exports) {
13874
13875// empty
13876
13877
13878/***/ }),
13879/* 453 */
13880/***/ (function(module, exports, __webpack_require__) {
13881
13882var defineWellKnownSymbol = __webpack_require__(10);
13883
13884// `Symbol.asyncDispose` well-known symbol
13885// https://github.com/tc39/proposal-using-statement
13886defineWellKnownSymbol('asyncDispose');
13887
13888
13889/***/ }),
13890/* 454 */
13891/***/ (function(module, exports, __webpack_require__) {
13892
13893var defineWellKnownSymbol = __webpack_require__(10);
13894
13895// `Symbol.dispose` well-known symbol
13896// https://github.com/tc39/proposal-using-statement
13897defineWellKnownSymbol('dispose');
13898
13899
13900/***/ }),
13901/* 455 */
13902/***/ (function(module, exports, __webpack_require__) {
13903
13904var defineWellKnownSymbol = __webpack_require__(10);
13905
13906// `Symbol.matcher` well-known symbol
13907// https://github.com/tc39/proposal-pattern-matching
13908defineWellKnownSymbol('matcher');
13909
13910
13911/***/ }),
13912/* 456 */
13913/***/ (function(module, exports, __webpack_require__) {
13914
13915var defineWellKnownSymbol = __webpack_require__(10);
13916
13917// `Symbol.metadataKey` well-known symbol
13918// https://github.com/tc39/proposal-decorator-metadata
13919defineWellKnownSymbol('metadataKey');
13920
13921
13922/***/ }),
13923/* 457 */
13924/***/ (function(module, exports, __webpack_require__) {
13925
13926var defineWellKnownSymbol = __webpack_require__(10);
13927
13928// `Symbol.observable` well-known symbol
13929// https://github.com/tc39/proposal-observable
13930defineWellKnownSymbol('observable');
13931
13932
13933/***/ }),
13934/* 458 */
13935/***/ (function(module, exports, __webpack_require__) {
13936
13937// TODO: Remove from `core-js@4`
13938var defineWellKnownSymbol = __webpack_require__(10);
13939
13940// `Symbol.metadata` well-known symbol
13941// https://github.com/tc39/proposal-decorators
13942defineWellKnownSymbol('metadata');
13943
13944
13945/***/ }),
13946/* 459 */
13947/***/ (function(module, exports, __webpack_require__) {
13948
13949// TODO: remove from `core-js@4`
13950var defineWellKnownSymbol = __webpack_require__(10);
13951
13952// `Symbol.patternMatch` well-known symbol
13953// https://github.com/tc39/proposal-pattern-matching
13954defineWellKnownSymbol('patternMatch');
13955
13956
13957/***/ }),
13958/* 460 */
13959/***/ (function(module, exports, __webpack_require__) {
13960
13961// TODO: remove from `core-js@4`
13962var defineWellKnownSymbol = __webpack_require__(10);
13963
13964defineWellKnownSymbol('replaceAll');
13965
13966
13967/***/ }),
13968/* 461 */
13969/***/ (function(module, exports, __webpack_require__) {
13970
13971module.exports = __webpack_require__(462);
13972
13973/***/ }),
13974/* 462 */
13975/***/ (function(module, exports, __webpack_require__) {
13976
13977module.exports = __webpack_require__(463);
13978
13979
13980/***/ }),
13981/* 463 */
13982/***/ (function(module, exports, __webpack_require__) {
13983
13984var parent = __webpack_require__(464);
13985
13986module.exports = parent;
13987
13988
13989/***/ }),
13990/* 464 */
13991/***/ (function(module, exports, __webpack_require__) {
13992
13993var parent = __webpack_require__(250);
13994
13995module.exports = parent;
13996
13997
13998/***/ }),
13999/* 465 */
14000/***/ (function(module, exports, __webpack_require__) {
14001
14002__webpack_require__(38);
14003__webpack_require__(53);
14004__webpack_require__(55);
14005__webpack_require__(249);
14006var WrappedWellKnownSymbolModule = __webpack_require__(149);
14007
14008module.exports = WrappedWellKnownSymbolModule.f('iterator');
14009
14010
14011/***/ }),
14012/* 466 */
14013/***/ (function(module, exports, __webpack_require__) {
14014
14015var parent = __webpack_require__(467);
14016
14017module.exports = parent;
14018
14019
14020/***/ }),
14021/* 467 */
14022/***/ (function(module, exports, __webpack_require__) {
14023
14024var isPrototypeOf = __webpack_require__(19);
14025var method = __webpack_require__(468);
14026
14027var ArrayPrototype = Array.prototype;
14028
14029module.exports = function (it) {
14030 var own = it.filter;
14031 return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.filter) ? method : own;
14032};
14033
14034
14035/***/ }),
14036/* 468 */
14037/***/ (function(module, exports, __webpack_require__) {
14038
14039__webpack_require__(469);
14040var entryVirtual = __webpack_require__(40);
14041
14042module.exports = entryVirtual('Array').filter;
14043
14044
14045/***/ }),
14046/* 469 */
14047/***/ (function(module, exports, __webpack_require__) {
14048
14049"use strict";
14050
14051var $ = __webpack_require__(0);
14052var $filter = __webpack_require__(70).filter;
14053var arrayMethodHasSpeciesSupport = __webpack_require__(114);
14054
14055var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('filter');
14056
14057// `Array.prototype.filter` method
14058// https://tc39.es/ecma262/#sec-array.prototype.filter
14059// with adding support of @@species
14060$({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT }, {
14061 filter: function filter(callbackfn /* , thisArg */) {
14062 return $filter(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
14063 }
14064});
14065
14066
14067/***/ }),
14068/* 470 */
14069/***/ (function(module, exports, __webpack_require__) {
14070
14071"use strict";
14072
14073
14074var _interopRequireDefault = __webpack_require__(1);
14075
14076var _slice = _interopRequireDefault(__webpack_require__(61));
14077
14078var _keys = _interopRequireDefault(__webpack_require__(59));
14079
14080var _concat = _interopRequireDefault(__webpack_require__(22));
14081
14082var _ = __webpack_require__(3);
14083
14084module.exports = function (AV) {
14085 var eventSplitter = /\s+/;
14086 var slice = (0, _slice.default)(Array.prototype);
14087 /**
14088 * @class
14089 *
14090 * <p>AV.Events is a fork of Backbone's Events module, provided for your
14091 * convenience.</p>
14092 *
14093 * <p>A module that can be mixed in to any object in order to provide
14094 * it with custom events. You may bind callback functions to an event
14095 * with `on`, or remove these functions with `off`.
14096 * Triggering an event fires all callbacks in the order that `on` was
14097 * called.
14098 *
14099 * @private
14100 * @example
14101 * var object = {};
14102 * _.extend(object, AV.Events);
14103 * object.on('expand', function(){ alert('expanded'); });
14104 * object.trigger('expand');</pre></p>
14105 *
14106 */
14107
14108 AV.Events = {
14109 /**
14110 * Bind one or more space separated events, `events`, to a `callback`
14111 * function. Passing `"all"` will bind the callback to all events fired.
14112 */
14113 on: function on(events, callback, context) {
14114 var calls, event, node, tail, list;
14115
14116 if (!callback) {
14117 return this;
14118 }
14119
14120 events = events.split(eventSplitter);
14121 calls = this._callbacks || (this._callbacks = {}); // Create an immutable callback list, allowing traversal during
14122 // modification. The tail is an empty object that will always be used
14123 // as the next node.
14124
14125 event = events.shift();
14126
14127 while (event) {
14128 list = calls[event];
14129 node = list ? list.tail : {};
14130 node.next = tail = {};
14131 node.context = context;
14132 node.callback = callback;
14133 calls[event] = {
14134 tail: tail,
14135 next: list ? list.next : node
14136 };
14137 event = events.shift();
14138 }
14139
14140 return this;
14141 },
14142
14143 /**
14144 * Remove one or many callbacks. If `context` is null, removes all callbacks
14145 * with that function. If `callback` is null, removes all callbacks for the
14146 * event. If `events` is null, removes all bound callbacks for all events.
14147 */
14148 off: function off(events, callback, context) {
14149 var event, calls, node, tail, cb, ctx; // No events, or removing *all* events.
14150
14151 if (!(calls = this._callbacks)) {
14152 return;
14153 }
14154
14155 if (!(events || callback || context)) {
14156 delete this._callbacks;
14157 return this;
14158 } // Loop through the listed events and contexts, splicing them out of the
14159 // linked list of callbacks if appropriate.
14160
14161
14162 events = events ? events.split(eventSplitter) : (0, _keys.default)(_).call(_, calls);
14163 event = events.shift();
14164
14165 while (event) {
14166 node = calls[event];
14167 delete calls[event];
14168
14169 if (!node || !(callback || context)) {
14170 continue;
14171 } // Create a new list, omitting the indicated callbacks.
14172
14173
14174 tail = node.tail;
14175 node = node.next;
14176
14177 while (node !== tail) {
14178 cb = node.callback;
14179 ctx = node.context;
14180
14181 if (callback && cb !== callback || context && ctx !== context) {
14182 this.on(event, cb, ctx);
14183 }
14184
14185 node = node.next;
14186 }
14187
14188 event = events.shift();
14189 }
14190
14191 return this;
14192 },
14193
14194 /**
14195 * Trigger one or many events, firing all bound callbacks. Callbacks are
14196 * passed the same arguments as `trigger` is, apart from the event name
14197 * (unless you're listening on `"all"`, which will cause your callback to
14198 * receive the true name of the event as the first argument).
14199 */
14200 trigger: function trigger(events) {
14201 var event, node, calls, tail, args, all, rest;
14202
14203 if (!(calls = this._callbacks)) {
14204 return this;
14205 }
14206
14207 all = calls.all;
14208 events = events.split(eventSplitter);
14209 rest = slice.call(arguments, 1); // For each event, walk through the linked list of callbacks twice,
14210 // first to trigger the event, then to trigger any `"all"` callbacks.
14211
14212 event = events.shift();
14213
14214 while (event) {
14215 node = calls[event];
14216
14217 if (node) {
14218 tail = node.tail;
14219
14220 while ((node = node.next) !== tail) {
14221 node.callback.apply(node.context || this, rest);
14222 }
14223 }
14224
14225 node = all;
14226
14227 if (node) {
14228 var _context;
14229
14230 tail = node.tail;
14231 args = (0, _concat.default)(_context = [event]).call(_context, rest);
14232
14233 while ((node = node.next) !== tail) {
14234 node.callback.apply(node.context || this, args);
14235 }
14236 }
14237
14238 event = events.shift();
14239 }
14240
14241 return this;
14242 }
14243 };
14244 /**
14245 * @function
14246 */
14247
14248 AV.Events.bind = AV.Events.on;
14249 /**
14250 * @function
14251 */
14252
14253 AV.Events.unbind = AV.Events.off;
14254};
14255
14256/***/ }),
14257/* 471 */
14258/***/ (function(module, exports, __webpack_require__) {
14259
14260"use strict";
14261
14262
14263var _interopRequireDefault = __webpack_require__(1);
14264
14265var _promise = _interopRequireDefault(__webpack_require__(12));
14266
14267var _ = __webpack_require__(3);
14268/*global navigator: false */
14269
14270
14271module.exports = function (AV) {
14272 /**
14273 * Creates a new GeoPoint with any of the following forms:<br>
14274 * @example
14275 * new GeoPoint(otherGeoPoint)
14276 * new GeoPoint(30, 30)
14277 * new GeoPoint([30, 30])
14278 * new GeoPoint({latitude: 30, longitude: 30})
14279 * new GeoPoint() // defaults to (0, 0)
14280 * @class
14281 *
14282 * <p>Represents a latitude / longitude point that may be associated
14283 * with a key in a AVObject or used as a reference point for geo queries.
14284 * This allows proximity-based queries on the key.</p>
14285 *
14286 * <p>Only one key in a class may contain a GeoPoint.</p>
14287 *
14288 * <p>Example:<pre>
14289 * var point = new AV.GeoPoint(30.0, -20.0);
14290 * var object = new AV.Object("PlaceObject");
14291 * object.set("location", point);
14292 * object.save();</pre></p>
14293 */
14294 AV.GeoPoint = function (arg1, arg2) {
14295 if (_.isArray(arg1)) {
14296 AV.GeoPoint._validate(arg1[0], arg1[1]);
14297
14298 this.latitude = arg1[0];
14299 this.longitude = arg1[1];
14300 } else if (_.isObject(arg1)) {
14301 AV.GeoPoint._validate(arg1.latitude, arg1.longitude);
14302
14303 this.latitude = arg1.latitude;
14304 this.longitude = arg1.longitude;
14305 } else if (_.isNumber(arg1) && _.isNumber(arg2)) {
14306 AV.GeoPoint._validate(arg1, arg2);
14307
14308 this.latitude = arg1;
14309 this.longitude = arg2;
14310 } else {
14311 this.latitude = 0;
14312 this.longitude = 0;
14313 } // Add properties so that anyone using Webkit or Mozilla will get an error
14314 // if they try to set values that are out of bounds.
14315
14316
14317 var self = this;
14318
14319 if (this.__defineGetter__ && this.__defineSetter__) {
14320 // Use _latitude and _longitude to actually store the values, and add
14321 // getters and setters for latitude and longitude.
14322 this._latitude = this.latitude;
14323 this._longitude = this.longitude;
14324
14325 this.__defineGetter__('latitude', function () {
14326 return self._latitude;
14327 });
14328
14329 this.__defineGetter__('longitude', function () {
14330 return self._longitude;
14331 });
14332
14333 this.__defineSetter__('latitude', function (val) {
14334 AV.GeoPoint._validate(val, self.longitude);
14335
14336 self._latitude = val;
14337 });
14338
14339 this.__defineSetter__('longitude', function (val) {
14340 AV.GeoPoint._validate(self.latitude, val);
14341
14342 self._longitude = val;
14343 });
14344 }
14345 };
14346 /**
14347 * @lends AV.GeoPoint.prototype
14348 * @property {float} latitude North-south portion of the coordinate, in range
14349 * [-90, 90]. Throws an exception if set out of range in a modern browser.
14350 * @property {float} longitude East-west portion of the coordinate, in range
14351 * [-180, 180]. Throws if set out of range in a modern browser.
14352 */
14353
14354 /**
14355 * Throws an exception if the given lat-long is out of bounds.
14356 * @private
14357 */
14358
14359
14360 AV.GeoPoint._validate = function (latitude, longitude) {
14361 if (latitude < -90.0) {
14362 throw new Error('AV.GeoPoint latitude ' + latitude + ' < -90.0.');
14363 }
14364
14365 if (latitude > 90.0) {
14366 throw new Error('AV.GeoPoint latitude ' + latitude + ' > 90.0.');
14367 }
14368
14369 if (longitude < -180.0) {
14370 throw new Error('AV.GeoPoint longitude ' + longitude + ' < -180.0.');
14371 }
14372
14373 if (longitude > 180.0) {
14374 throw new Error('AV.GeoPoint longitude ' + longitude + ' > 180.0.');
14375 }
14376 };
14377 /**
14378 * Creates a GeoPoint with the user's current location, if available.
14379 * @return {Promise.<AV.GeoPoint>}
14380 */
14381
14382
14383 AV.GeoPoint.current = function () {
14384 return new _promise.default(function (resolve, reject) {
14385 navigator.geolocation.getCurrentPosition(function (location) {
14386 resolve(new AV.GeoPoint({
14387 latitude: location.coords.latitude,
14388 longitude: location.coords.longitude
14389 }));
14390 }, reject);
14391 });
14392 };
14393
14394 _.extend(AV.GeoPoint.prototype,
14395 /** @lends AV.GeoPoint.prototype */
14396 {
14397 /**
14398 * Returns a JSON representation of the GeoPoint, suitable for AV.
14399 * @return {Object}
14400 */
14401 toJSON: function toJSON() {
14402 AV.GeoPoint._validate(this.latitude, this.longitude);
14403
14404 return {
14405 __type: 'GeoPoint',
14406 latitude: this.latitude,
14407 longitude: this.longitude
14408 };
14409 },
14410
14411 /**
14412 * Returns the distance from this GeoPoint to another in radians.
14413 * @param {AV.GeoPoint} point the other AV.GeoPoint.
14414 * @return {Number}
14415 */
14416 radiansTo: function radiansTo(point) {
14417 var d2r = Math.PI / 180.0;
14418 var lat1rad = this.latitude * d2r;
14419 var long1rad = this.longitude * d2r;
14420 var lat2rad = point.latitude * d2r;
14421 var long2rad = point.longitude * d2r;
14422 var deltaLat = lat1rad - lat2rad;
14423 var deltaLong = long1rad - long2rad;
14424 var sinDeltaLatDiv2 = Math.sin(deltaLat / 2);
14425 var sinDeltaLongDiv2 = Math.sin(deltaLong / 2); // Square of half the straight line chord distance between both points.
14426
14427 var a = sinDeltaLatDiv2 * sinDeltaLatDiv2 + Math.cos(lat1rad) * Math.cos(lat2rad) * sinDeltaLongDiv2 * sinDeltaLongDiv2;
14428 a = Math.min(1.0, a);
14429 return 2 * Math.asin(Math.sqrt(a));
14430 },
14431
14432 /**
14433 * Returns the distance from this GeoPoint to another in kilometers.
14434 * @param {AV.GeoPoint} point the other AV.GeoPoint.
14435 * @return {Number}
14436 */
14437 kilometersTo: function kilometersTo(point) {
14438 return this.radiansTo(point) * 6371.0;
14439 },
14440
14441 /**
14442 * Returns the distance from this GeoPoint to another in miles.
14443 * @param {AV.GeoPoint} point the other AV.GeoPoint.
14444 * @return {Number}
14445 */
14446 milesTo: function milesTo(point) {
14447 return this.radiansTo(point) * 3958.8;
14448 }
14449 });
14450};
14451
14452/***/ }),
14453/* 472 */
14454/***/ (function(module, exports, __webpack_require__) {
14455
14456"use strict";
14457
14458
14459var _ = __webpack_require__(3);
14460
14461module.exports = function (AV) {
14462 var PUBLIC_KEY = '*';
14463 /**
14464 * Creates a new ACL.
14465 * If no argument is given, the ACL has no permissions for anyone.
14466 * If the argument is a AV.User, the ACL will have read and write
14467 * permission for only that user.
14468 * If the argument is any other JSON object, that object will be interpretted
14469 * as a serialized ACL created with toJSON().
14470 * @see AV.Object#setACL
14471 * @class
14472 *
14473 * <p>An ACL, or Access Control List can be added to any
14474 * <code>AV.Object</code> to restrict access to only a subset of users
14475 * of your application.</p>
14476 */
14477
14478 AV.ACL = function (arg1) {
14479 var self = this;
14480 self.permissionsById = {};
14481
14482 if (_.isObject(arg1)) {
14483 if (arg1 instanceof AV.User) {
14484 self.setReadAccess(arg1, true);
14485 self.setWriteAccess(arg1, true);
14486 } else {
14487 if (_.isFunction(arg1)) {
14488 throw new Error('AV.ACL() called with a function. Did you forget ()?');
14489 }
14490
14491 AV._objectEach(arg1, function (accessList, userId) {
14492 if (!_.isString(userId)) {
14493 throw new Error('Tried to create an ACL with an invalid userId.');
14494 }
14495
14496 self.permissionsById[userId] = {};
14497
14498 AV._objectEach(accessList, function (allowed, permission) {
14499 if (permission !== 'read' && permission !== 'write') {
14500 throw new Error('Tried to create an ACL with an invalid permission type.');
14501 }
14502
14503 if (!_.isBoolean(allowed)) {
14504 throw new Error('Tried to create an ACL with an invalid permission value.');
14505 }
14506
14507 self.permissionsById[userId][permission] = allowed;
14508 });
14509 });
14510 }
14511 }
14512 };
14513 /**
14514 * Returns a JSON-encoded version of the ACL.
14515 * @return {Object}
14516 */
14517
14518
14519 AV.ACL.prototype.toJSON = function () {
14520 return _.clone(this.permissionsById);
14521 };
14522
14523 AV.ACL.prototype._setAccess = function (accessType, userId, allowed) {
14524 if (userId instanceof AV.User) {
14525 userId = userId.id;
14526 } else if (userId instanceof AV.Role) {
14527 userId = 'role:' + userId.getName();
14528 }
14529
14530 if (!_.isString(userId)) {
14531 throw new Error('userId must be a string.');
14532 }
14533
14534 if (!_.isBoolean(allowed)) {
14535 throw new Error('allowed must be either true or false.');
14536 }
14537
14538 var permissions = this.permissionsById[userId];
14539
14540 if (!permissions) {
14541 if (!allowed) {
14542 // The user already doesn't have this permission, so no action needed.
14543 return;
14544 } else {
14545 permissions = {};
14546 this.permissionsById[userId] = permissions;
14547 }
14548 }
14549
14550 if (allowed) {
14551 this.permissionsById[userId][accessType] = true;
14552 } else {
14553 delete permissions[accessType];
14554
14555 if (_.isEmpty(permissions)) {
14556 delete this.permissionsById[userId];
14557 }
14558 }
14559 };
14560
14561 AV.ACL.prototype._getAccess = function (accessType, userId) {
14562 if (userId instanceof AV.User) {
14563 userId = userId.id;
14564 } else if (userId instanceof AV.Role) {
14565 userId = 'role:' + userId.getName();
14566 }
14567
14568 var permissions = this.permissionsById[userId];
14569
14570 if (!permissions) {
14571 return false;
14572 }
14573
14574 return permissions[accessType] ? true : false;
14575 };
14576 /**
14577 * Set whether the given user is allowed to read this object.
14578 * @param userId An instance of AV.User or its objectId.
14579 * @param {Boolean} allowed Whether that user should have read access.
14580 */
14581
14582
14583 AV.ACL.prototype.setReadAccess = function (userId, allowed) {
14584 this._setAccess('read', userId, allowed);
14585 };
14586 /**
14587 * Get whether the given user id is *explicitly* allowed to read this object.
14588 * Even if this returns false, the user may still be able to access it if
14589 * getPublicReadAccess returns true or a role that the user belongs to has
14590 * write access.
14591 * @param userId An instance of AV.User or its objectId, or a AV.Role.
14592 * @return {Boolean}
14593 */
14594
14595
14596 AV.ACL.prototype.getReadAccess = function (userId) {
14597 return this._getAccess('read', userId);
14598 };
14599 /**
14600 * Set whether the given user id is allowed to write this object.
14601 * @param userId An instance of AV.User or its objectId, or a AV.Role..
14602 * @param {Boolean} allowed Whether that user should have write access.
14603 */
14604
14605
14606 AV.ACL.prototype.setWriteAccess = function (userId, allowed) {
14607 this._setAccess('write', userId, allowed);
14608 };
14609 /**
14610 * Get whether the given user id is *explicitly* allowed to write this object.
14611 * Even if this returns false, the user may still be able to write it if
14612 * getPublicWriteAccess returns true or a role that the user belongs to has
14613 * write access.
14614 * @param userId An instance of AV.User or its objectId, or a AV.Role.
14615 * @return {Boolean}
14616 */
14617
14618
14619 AV.ACL.prototype.getWriteAccess = function (userId) {
14620 return this._getAccess('write', userId);
14621 };
14622 /**
14623 * Set whether the public is allowed to read this object.
14624 * @param {Boolean} allowed
14625 */
14626
14627
14628 AV.ACL.prototype.setPublicReadAccess = function (allowed) {
14629 this.setReadAccess(PUBLIC_KEY, allowed);
14630 };
14631 /**
14632 * Get whether the public is allowed to read this object.
14633 * @return {Boolean}
14634 */
14635
14636
14637 AV.ACL.prototype.getPublicReadAccess = function () {
14638 return this.getReadAccess(PUBLIC_KEY);
14639 };
14640 /**
14641 * Set whether the public is allowed to write this object.
14642 * @param {Boolean} allowed
14643 */
14644
14645
14646 AV.ACL.prototype.setPublicWriteAccess = function (allowed) {
14647 this.setWriteAccess(PUBLIC_KEY, allowed);
14648 };
14649 /**
14650 * Get whether the public is allowed to write this object.
14651 * @return {Boolean}
14652 */
14653
14654
14655 AV.ACL.prototype.getPublicWriteAccess = function () {
14656 return this.getWriteAccess(PUBLIC_KEY);
14657 };
14658 /**
14659 * Get whether users belonging to the given role are allowed
14660 * to read this object. Even if this returns false, the role may
14661 * still be able to write it if a parent role has read access.
14662 *
14663 * @param role The name of the role, or a AV.Role object.
14664 * @return {Boolean} true if the role has read access. false otherwise.
14665 * @throws {String} If role is neither a AV.Role nor a String.
14666 */
14667
14668
14669 AV.ACL.prototype.getRoleReadAccess = function (role) {
14670 if (role instanceof AV.Role) {
14671 // Normalize to the String name
14672 role = role.getName();
14673 }
14674
14675 if (_.isString(role)) {
14676 return this.getReadAccess('role:' + role);
14677 }
14678
14679 throw new Error('role must be a AV.Role or a String');
14680 };
14681 /**
14682 * Get whether users belonging to the given role are allowed
14683 * to write this object. Even if this returns false, the role may
14684 * still be able to write it if a parent role has write access.
14685 *
14686 * @param role The name of the role, or a AV.Role object.
14687 * @return {Boolean} true if the role has write access. false otherwise.
14688 * @throws {String} If role is neither a AV.Role nor a String.
14689 */
14690
14691
14692 AV.ACL.prototype.getRoleWriteAccess = function (role) {
14693 if (role instanceof AV.Role) {
14694 // Normalize to the String name
14695 role = role.getName();
14696 }
14697
14698 if (_.isString(role)) {
14699 return this.getWriteAccess('role:' + role);
14700 }
14701
14702 throw new Error('role must be a AV.Role or a String');
14703 };
14704 /**
14705 * Set whether users belonging to the given role are allowed
14706 * to read this object.
14707 *
14708 * @param role The name of the role, or a AV.Role object.
14709 * @param {Boolean} allowed Whether the given role can read this object.
14710 * @throws {String} If role is neither a AV.Role nor a String.
14711 */
14712
14713
14714 AV.ACL.prototype.setRoleReadAccess = function (role, allowed) {
14715 if (role instanceof AV.Role) {
14716 // Normalize to the String name
14717 role = role.getName();
14718 }
14719
14720 if (_.isString(role)) {
14721 this.setReadAccess('role:' + role, allowed);
14722 return;
14723 }
14724
14725 throw new Error('role must be a AV.Role or a String');
14726 };
14727 /**
14728 * Set whether users belonging to the given role are allowed
14729 * to write this object.
14730 *
14731 * @param role The name of the role, or a AV.Role object.
14732 * @param {Boolean} allowed Whether the given role can write this object.
14733 * @throws {String} If role is neither a AV.Role nor a String.
14734 */
14735
14736
14737 AV.ACL.prototype.setRoleWriteAccess = function (role, allowed) {
14738 if (role instanceof AV.Role) {
14739 // Normalize to the String name
14740 role = role.getName();
14741 }
14742
14743 if (_.isString(role)) {
14744 this.setWriteAccess('role:' + role, allowed);
14745 return;
14746 }
14747
14748 throw new Error('role must be a AV.Role or a String');
14749 };
14750};
14751
14752/***/ }),
14753/* 473 */
14754/***/ (function(module, exports, __webpack_require__) {
14755
14756"use strict";
14757
14758
14759var _interopRequireDefault = __webpack_require__(1);
14760
14761var _concat = _interopRequireDefault(__webpack_require__(22));
14762
14763var _find = _interopRequireDefault(__webpack_require__(93));
14764
14765var _indexOf = _interopRequireDefault(__webpack_require__(71));
14766
14767var _map = _interopRequireDefault(__webpack_require__(35));
14768
14769var _ = __webpack_require__(3);
14770
14771module.exports = function (AV) {
14772 /**
14773 * @private
14774 * @class
14775 * A AV.Op is an atomic operation that can be applied to a field in a
14776 * AV.Object. For example, calling <code>object.set("foo", "bar")</code>
14777 * is an example of a AV.Op.Set. Calling <code>object.unset("foo")</code>
14778 * is a AV.Op.Unset. These operations are stored in a AV.Object and
14779 * sent to the server as part of <code>object.save()</code> operations.
14780 * Instances of AV.Op should be immutable.
14781 *
14782 * You should not create subclasses of AV.Op or instantiate AV.Op
14783 * directly.
14784 */
14785 AV.Op = function () {
14786 this._initialize.apply(this, arguments);
14787 };
14788
14789 _.extend(AV.Op.prototype,
14790 /** @lends AV.Op.prototype */
14791 {
14792 _initialize: function _initialize() {}
14793 });
14794
14795 _.extend(AV.Op, {
14796 /**
14797 * To create a new Op, call AV.Op._extend();
14798 * @private
14799 */
14800 _extend: AV._extend,
14801 // A map of __op string to decoder function.
14802 _opDecoderMap: {},
14803
14804 /**
14805 * Registers a function to convert a json object with an __op field into an
14806 * instance of a subclass of AV.Op.
14807 * @private
14808 */
14809 _registerDecoder: function _registerDecoder(opName, decoder) {
14810 AV.Op._opDecoderMap[opName] = decoder;
14811 },
14812
14813 /**
14814 * Converts a json object into an instance of a subclass of AV.Op.
14815 * @private
14816 */
14817 _decode: function _decode(json) {
14818 var decoder = AV.Op._opDecoderMap[json.__op];
14819
14820 if (decoder) {
14821 return decoder(json);
14822 } else {
14823 return undefined;
14824 }
14825 }
14826 });
14827 /*
14828 * Add a handler for Batch ops.
14829 */
14830
14831
14832 AV.Op._registerDecoder('Batch', function (json) {
14833 var op = null;
14834
14835 AV._arrayEach(json.ops, function (nextOp) {
14836 nextOp = AV.Op._decode(nextOp);
14837 op = nextOp._mergeWithPrevious(op);
14838 });
14839
14840 return op;
14841 });
14842 /**
14843 * @private
14844 * @class
14845 * A Set operation indicates that either the field was changed using
14846 * AV.Object.set, or it is a mutable container that was detected as being
14847 * changed.
14848 */
14849
14850
14851 AV.Op.Set = AV.Op._extend(
14852 /** @lends AV.Op.Set.prototype */
14853 {
14854 _initialize: function _initialize(value) {
14855 this._value = value;
14856 },
14857
14858 /**
14859 * Returns the new value of this field after the set.
14860 */
14861 value: function value() {
14862 return this._value;
14863 },
14864
14865 /**
14866 * Returns a JSON version of the operation suitable for sending to AV.
14867 * @return {Object}
14868 */
14869 toJSON: function toJSON() {
14870 return AV._encode(this.value());
14871 },
14872 _mergeWithPrevious: function _mergeWithPrevious(previous) {
14873 return this;
14874 },
14875 _estimate: function _estimate(oldValue) {
14876 return this.value();
14877 }
14878 });
14879 /**
14880 * A sentinel value that is returned by AV.Op.Unset._estimate to
14881 * indicate the field should be deleted. Basically, if you find _UNSET as a
14882 * value in your object, you should remove that key.
14883 */
14884
14885 AV.Op._UNSET = {};
14886 /**
14887 * @private
14888 * @class
14889 * An Unset operation indicates that this field has been deleted from the
14890 * object.
14891 */
14892
14893 AV.Op.Unset = AV.Op._extend(
14894 /** @lends AV.Op.Unset.prototype */
14895 {
14896 /**
14897 * Returns a JSON version of the operation suitable for sending to AV.
14898 * @return {Object}
14899 */
14900 toJSON: function toJSON() {
14901 return {
14902 __op: 'Delete'
14903 };
14904 },
14905 _mergeWithPrevious: function _mergeWithPrevious(previous) {
14906 return this;
14907 },
14908 _estimate: function _estimate(oldValue) {
14909 return AV.Op._UNSET;
14910 }
14911 });
14912
14913 AV.Op._registerDecoder('Delete', function (json) {
14914 return new AV.Op.Unset();
14915 });
14916 /**
14917 * @private
14918 * @class
14919 * An Increment is an atomic operation where the numeric value for the field
14920 * will be increased by a given amount.
14921 */
14922
14923
14924 AV.Op.Increment = AV.Op._extend(
14925 /** @lends AV.Op.Increment.prototype */
14926 {
14927 _initialize: function _initialize(amount) {
14928 this._amount = amount;
14929 },
14930
14931 /**
14932 * Returns the amount to increment by.
14933 * @return {Number} the amount to increment by.
14934 */
14935 amount: function amount() {
14936 return this._amount;
14937 },
14938
14939 /**
14940 * Returns a JSON version of the operation suitable for sending to AV.
14941 * @return {Object}
14942 */
14943 toJSON: function toJSON() {
14944 return {
14945 __op: 'Increment',
14946 amount: this._amount
14947 };
14948 },
14949 _mergeWithPrevious: function _mergeWithPrevious(previous) {
14950 if (!previous) {
14951 return this;
14952 } else if (previous instanceof AV.Op.Unset) {
14953 return new AV.Op.Set(this.amount());
14954 } else if (previous instanceof AV.Op.Set) {
14955 return new AV.Op.Set(previous.value() + this.amount());
14956 } else if (previous instanceof AV.Op.Increment) {
14957 return new AV.Op.Increment(this.amount() + previous.amount());
14958 } else {
14959 throw new Error('Op is invalid after previous op.');
14960 }
14961 },
14962 _estimate: function _estimate(oldValue) {
14963 if (!oldValue) {
14964 return this.amount();
14965 }
14966
14967 return oldValue + this.amount();
14968 }
14969 });
14970
14971 AV.Op._registerDecoder('Increment', function (json) {
14972 return new AV.Op.Increment(json.amount);
14973 });
14974 /**
14975 * @private
14976 * @class
14977 * BitAnd is an atomic operation where the given value will be bit and to the
14978 * value than is stored in this field.
14979 */
14980
14981
14982 AV.Op.BitAnd = AV.Op._extend(
14983 /** @lends AV.Op.BitAnd.prototype */
14984 {
14985 _initialize: function _initialize(value) {
14986 this._value = value;
14987 },
14988 value: function value() {
14989 return this._value;
14990 },
14991
14992 /**
14993 * Returns a JSON version of the operation suitable for sending to AV.
14994 * @return {Object}
14995 */
14996 toJSON: function toJSON() {
14997 return {
14998 __op: 'BitAnd',
14999 value: this.value()
15000 };
15001 },
15002 _mergeWithPrevious: function _mergeWithPrevious(previous) {
15003 if (!previous) {
15004 return this;
15005 } else if (previous instanceof AV.Op.Unset) {
15006 return new AV.Op.Set(0);
15007 } else if (previous instanceof AV.Op.Set) {
15008 return new AV.Op.Set(previous.value() & this.value());
15009 } else {
15010 throw new Error('Op is invalid after previous op.');
15011 }
15012 },
15013 _estimate: function _estimate(oldValue) {
15014 return oldValue & this.value();
15015 }
15016 });
15017
15018 AV.Op._registerDecoder('BitAnd', function (json) {
15019 return new AV.Op.BitAnd(json.value);
15020 });
15021 /**
15022 * @private
15023 * @class
15024 * BitOr is an atomic operation where the given value will be bit and to the
15025 * value than is stored in this field.
15026 */
15027
15028
15029 AV.Op.BitOr = AV.Op._extend(
15030 /** @lends AV.Op.BitOr.prototype */
15031 {
15032 _initialize: function _initialize(value) {
15033 this._value = value;
15034 },
15035 value: function value() {
15036 return this._value;
15037 },
15038
15039 /**
15040 * Returns a JSON version of the operation suitable for sending to AV.
15041 * @return {Object}
15042 */
15043 toJSON: function toJSON() {
15044 return {
15045 __op: 'BitOr',
15046 value: this.value()
15047 };
15048 },
15049 _mergeWithPrevious: function _mergeWithPrevious(previous) {
15050 if (!previous) {
15051 return this;
15052 } else if (previous instanceof AV.Op.Unset) {
15053 return new AV.Op.Set(this.value());
15054 } else if (previous instanceof AV.Op.Set) {
15055 return new AV.Op.Set(previous.value() | this.value());
15056 } else {
15057 throw new Error('Op is invalid after previous op.');
15058 }
15059 },
15060 _estimate: function _estimate(oldValue) {
15061 return oldValue | this.value();
15062 }
15063 });
15064
15065 AV.Op._registerDecoder('BitOr', function (json) {
15066 return new AV.Op.BitOr(json.value);
15067 });
15068 /**
15069 * @private
15070 * @class
15071 * BitXor is an atomic operation where the given value will be bit and to the
15072 * value than is stored in this field.
15073 */
15074
15075
15076 AV.Op.BitXor = AV.Op._extend(
15077 /** @lends AV.Op.BitXor.prototype */
15078 {
15079 _initialize: function _initialize(value) {
15080 this._value = value;
15081 },
15082 value: function value() {
15083 return this._value;
15084 },
15085
15086 /**
15087 * Returns a JSON version of the operation suitable for sending to AV.
15088 * @return {Object}
15089 */
15090 toJSON: function toJSON() {
15091 return {
15092 __op: 'BitXor',
15093 value: this.value()
15094 };
15095 },
15096 _mergeWithPrevious: function _mergeWithPrevious(previous) {
15097 if (!previous) {
15098 return this;
15099 } else if (previous instanceof AV.Op.Unset) {
15100 return new AV.Op.Set(this.value());
15101 } else if (previous instanceof AV.Op.Set) {
15102 return new AV.Op.Set(previous.value() ^ this.value());
15103 } else {
15104 throw new Error('Op is invalid after previous op.');
15105 }
15106 },
15107 _estimate: function _estimate(oldValue) {
15108 return oldValue ^ this.value();
15109 }
15110 });
15111
15112 AV.Op._registerDecoder('BitXor', function (json) {
15113 return new AV.Op.BitXor(json.value);
15114 });
15115 /**
15116 * @private
15117 * @class
15118 * Add is an atomic operation where the given objects will be appended to the
15119 * array that is stored in this field.
15120 */
15121
15122
15123 AV.Op.Add = AV.Op._extend(
15124 /** @lends AV.Op.Add.prototype */
15125 {
15126 _initialize: function _initialize(objects) {
15127 this._objects = objects;
15128 },
15129
15130 /**
15131 * Returns the objects to be added to the array.
15132 * @return {Array} The objects to be added to the array.
15133 */
15134 objects: function objects() {
15135 return this._objects;
15136 },
15137
15138 /**
15139 * Returns a JSON version of the operation suitable for sending to AV.
15140 * @return {Object}
15141 */
15142 toJSON: function toJSON() {
15143 return {
15144 __op: 'Add',
15145 objects: AV._encode(this.objects())
15146 };
15147 },
15148 _mergeWithPrevious: function _mergeWithPrevious(previous) {
15149 if (!previous) {
15150 return this;
15151 } else if (previous instanceof AV.Op.Unset) {
15152 return new AV.Op.Set(this.objects());
15153 } else if (previous instanceof AV.Op.Set) {
15154 return new AV.Op.Set(this._estimate(previous.value()));
15155 } else if (previous instanceof AV.Op.Add) {
15156 var _context;
15157
15158 return new AV.Op.Add((0, _concat.default)(_context = previous.objects()).call(_context, this.objects()));
15159 } else {
15160 throw new Error('Op is invalid after previous op.');
15161 }
15162 },
15163 _estimate: function _estimate(oldValue) {
15164 if (!oldValue) {
15165 return _.clone(this.objects());
15166 } else {
15167 return (0, _concat.default)(oldValue).call(oldValue, this.objects());
15168 }
15169 }
15170 });
15171
15172 AV.Op._registerDecoder('Add', function (json) {
15173 return new AV.Op.Add(AV._decode(json.objects));
15174 });
15175 /**
15176 * @private
15177 * @class
15178 * AddUnique is an atomic operation where the given items will be appended to
15179 * the array that is stored in this field only if they were not already
15180 * present in the array.
15181 */
15182
15183
15184 AV.Op.AddUnique = AV.Op._extend(
15185 /** @lends AV.Op.AddUnique.prototype */
15186 {
15187 _initialize: function _initialize(objects) {
15188 this._objects = _.uniq(objects);
15189 },
15190
15191 /**
15192 * Returns the objects to be added to the array.
15193 * @return {Array} The objects to be added to the array.
15194 */
15195 objects: function objects() {
15196 return this._objects;
15197 },
15198
15199 /**
15200 * Returns a JSON version of the operation suitable for sending to AV.
15201 * @return {Object}
15202 */
15203 toJSON: function toJSON() {
15204 return {
15205 __op: 'AddUnique',
15206 objects: AV._encode(this.objects())
15207 };
15208 },
15209 _mergeWithPrevious: function _mergeWithPrevious(previous) {
15210 if (!previous) {
15211 return this;
15212 } else if (previous instanceof AV.Op.Unset) {
15213 return new AV.Op.Set(this.objects());
15214 } else if (previous instanceof AV.Op.Set) {
15215 return new AV.Op.Set(this._estimate(previous.value()));
15216 } else if (previous instanceof AV.Op.AddUnique) {
15217 return new AV.Op.AddUnique(this._estimate(previous.objects()));
15218 } else {
15219 throw new Error('Op is invalid after previous op.');
15220 }
15221 },
15222 _estimate: function _estimate(oldValue) {
15223 if (!oldValue) {
15224 return _.clone(this.objects());
15225 } else {
15226 // We can't just take the _.uniq(_.union(...)) of oldValue and
15227 // this.objects, because the uniqueness may not apply to oldValue
15228 // (especially if the oldValue was set via .set())
15229 var newValue = _.clone(oldValue);
15230
15231 AV._arrayEach(this.objects(), function (obj) {
15232 if (obj instanceof AV.Object && obj.id) {
15233 var matchingObj = (0, _find.default)(_).call(_, newValue, function (anObj) {
15234 return anObj instanceof AV.Object && anObj.id === obj.id;
15235 });
15236
15237 if (!matchingObj) {
15238 newValue.push(obj);
15239 } else {
15240 var index = (0, _indexOf.default)(_).call(_, newValue, matchingObj);
15241 newValue[index] = obj;
15242 }
15243 } else if (!_.contains(newValue, obj)) {
15244 newValue.push(obj);
15245 }
15246 });
15247
15248 return newValue;
15249 }
15250 }
15251 });
15252
15253 AV.Op._registerDecoder('AddUnique', function (json) {
15254 return new AV.Op.AddUnique(AV._decode(json.objects));
15255 });
15256 /**
15257 * @private
15258 * @class
15259 * Remove is an atomic operation where the given objects will be removed from
15260 * the array that is stored in this field.
15261 */
15262
15263
15264 AV.Op.Remove = AV.Op._extend(
15265 /** @lends AV.Op.Remove.prototype */
15266 {
15267 _initialize: function _initialize(objects) {
15268 this._objects = _.uniq(objects);
15269 },
15270
15271 /**
15272 * Returns the objects to be removed from the array.
15273 * @return {Array} The objects to be removed from the array.
15274 */
15275 objects: function objects() {
15276 return this._objects;
15277 },
15278
15279 /**
15280 * Returns a JSON version of the operation suitable for sending to AV.
15281 * @return {Object}
15282 */
15283 toJSON: function toJSON() {
15284 return {
15285 __op: 'Remove',
15286 objects: AV._encode(this.objects())
15287 };
15288 },
15289 _mergeWithPrevious: function _mergeWithPrevious(previous) {
15290 if (!previous) {
15291 return this;
15292 } else if (previous instanceof AV.Op.Unset) {
15293 return previous;
15294 } else if (previous instanceof AV.Op.Set) {
15295 return new AV.Op.Set(this._estimate(previous.value()));
15296 } else if (previous instanceof AV.Op.Remove) {
15297 return new AV.Op.Remove(_.union(previous.objects(), this.objects()));
15298 } else {
15299 throw new Error('Op is invalid after previous op.');
15300 }
15301 },
15302 _estimate: function _estimate(oldValue) {
15303 if (!oldValue) {
15304 return [];
15305 } else {
15306 var newValue = _.difference(oldValue, this.objects()); // If there are saved AV Objects being removed, also remove them.
15307
15308
15309 AV._arrayEach(this.objects(), function (obj) {
15310 if (obj instanceof AV.Object && obj.id) {
15311 newValue = _.reject(newValue, function (other) {
15312 return other instanceof AV.Object && other.id === obj.id;
15313 });
15314 }
15315 });
15316
15317 return newValue;
15318 }
15319 }
15320 });
15321
15322 AV.Op._registerDecoder('Remove', function (json) {
15323 return new AV.Op.Remove(AV._decode(json.objects));
15324 });
15325 /**
15326 * @private
15327 * @class
15328 * A Relation operation indicates that the field is an instance of
15329 * AV.Relation, and objects are being added to, or removed from, that
15330 * relation.
15331 */
15332
15333
15334 AV.Op.Relation = AV.Op._extend(
15335 /** @lends AV.Op.Relation.prototype */
15336 {
15337 _initialize: function _initialize(adds, removes) {
15338 this._targetClassName = null;
15339 var self = this;
15340
15341 var pointerToId = function pointerToId(object) {
15342 if (object instanceof AV.Object) {
15343 if (!object.id) {
15344 throw new Error("You can't add an unsaved AV.Object to a relation.");
15345 }
15346
15347 if (!self._targetClassName) {
15348 self._targetClassName = object.className;
15349 }
15350
15351 if (self._targetClassName !== object.className) {
15352 throw new Error('Tried to create a AV.Relation with 2 different types: ' + self._targetClassName + ' and ' + object.className + '.');
15353 }
15354
15355 return object.id;
15356 }
15357
15358 return object;
15359 };
15360
15361 this.relationsToAdd = _.uniq((0, _map.default)(_).call(_, adds, pointerToId));
15362 this.relationsToRemove = _.uniq((0, _map.default)(_).call(_, removes, pointerToId));
15363 },
15364
15365 /**
15366 * Returns an array of unfetched AV.Object that are being added to the
15367 * relation.
15368 * @return {Array}
15369 */
15370 added: function added() {
15371 var self = this;
15372 return (0, _map.default)(_).call(_, this.relationsToAdd, function (objectId) {
15373 var object = AV.Object._create(self._targetClassName);
15374
15375 object.id = objectId;
15376 return object;
15377 });
15378 },
15379
15380 /**
15381 * Returns an array of unfetched AV.Object that are being removed from
15382 * the relation.
15383 * @return {Array}
15384 */
15385 removed: function removed() {
15386 var self = this;
15387 return (0, _map.default)(_).call(_, this.relationsToRemove, function (objectId) {
15388 var object = AV.Object._create(self._targetClassName);
15389
15390 object.id = objectId;
15391 return object;
15392 });
15393 },
15394
15395 /**
15396 * Returns a JSON version of the operation suitable for sending to AV.
15397 * @return {Object}
15398 */
15399 toJSON: function toJSON() {
15400 var adds = null;
15401 var removes = null;
15402 var self = this;
15403
15404 var idToPointer = function idToPointer(id) {
15405 return {
15406 __type: 'Pointer',
15407 className: self._targetClassName,
15408 objectId: id
15409 };
15410 };
15411
15412 var pointers = null;
15413
15414 if (this.relationsToAdd.length > 0) {
15415 pointers = (0, _map.default)(_).call(_, this.relationsToAdd, idToPointer);
15416 adds = {
15417 __op: 'AddRelation',
15418 objects: pointers
15419 };
15420 }
15421
15422 if (this.relationsToRemove.length > 0) {
15423 pointers = (0, _map.default)(_).call(_, this.relationsToRemove, idToPointer);
15424 removes = {
15425 __op: 'RemoveRelation',
15426 objects: pointers
15427 };
15428 }
15429
15430 if (adds && removes) {
15431 return {
15432 __op: 'Batch',
15433 ops: [adds, removes]
15434 };
15435 }
15436
15437 return adds || removes || {};
15438 },
15439 _mergeWithPrevious: function _mergeWithPrevious(previous) {
15440 if (!previous) {
15441 return this;
15442 } else if (previous instanceof AV.Op.Unset) {
15443 throw new Error("You can't modify a relation after deleting it.");
15444 } else if (previous instanceof AV.Op.Relation) {
15445 if (previous._targetClassName && previous._targetClassName !== this._targetClassName) {
15446 throw new Error('Related object must be of class ' + previous._targetClassName + ', but ' + this._targetClassName + ' was passed in.');
15447 }
15448
15449 var newAdd = _.union(_.difference(previous.relationsToAdd, this.relationsToRemove), this.relationsToAdd);
15450
15451 var newRemove = _.union(_.difference(previous.relationsToRemove, this.relationsToAdd), this.relationsToRemove);
15452
15453 var newRelation = new AV.Op.Relation(newAdd, newRemove);
15454 newRelation._targetClassName = this._targetClassName;
15455 return newRelation;
15456 } else {
15457 throw new Error('Op is invalid after previous op.');
15458 }
15459 },
15460 _estimate: function _estimate(oldValue, object, key) {
15461 if (!oldValue) {
15462 var relation = new AV.Relation(object, key);
15463 relation.targetClassName = this._targetClassName;
15464 } else if (oldValue instanceof AV.Relation) {
15465 if (this._targetClassName) {
15466 if (oldValue.targetClassName) {
15467 if (oldValue.targetClassName !== this._targetClassName) {
15468 throw new Error('Related object must be a ' + oldValue.targetClassName + ', but a ' + this._targetClassName + ' was passed in.');
15469 }
15470 } else {
15471 oldValue.targetClassName = this._targetClassName;
15472 }
15473 }
15474
15475 return oldValue;
15476 } else {
15477 throw new Error('Op is invalid after previous op.');
15478 }
15479 }
15480 });
15481
15482 AV.Op._registerDecoder('AddRelation', function (json) {
15483 return new AV.Op.Relation(AV._decode(json.objects), []);
15484 });
15485
15486 AV.Op._registerDecoder('RemoveRelation', function (json) {
15487 return new AV.Op.Relation([], AV._decode(json.objects));
15488 });
15489};
15490
15491/***/ }),
15492/* 474 */
15493/***/ (function(module, exports, __webpack_require__) {
15494
15495var parent = __webpack_require__(475);
15496
15497module.exports = parent;
15498
15499
15500/***/ }),
15501/* 475 */
15502/***/ (function(module, exports, __webpack_require__) {
15503
15504var isPrototypeOf = __webpack_require__(19);
15505var method = __webpack_require__(476);
15506
15507var ArrayPrototype = Array.prototype;
15508
15509module.exports = function (it) {
15510 var own = it.find;
15511 return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.find) ? method : own;
15512};
15513
15514
15515/***/ }),
15516/* 476 */
15517/***/ (function(module, exports, __webpack_require__) {
15518
15519__webpack_require__(477);
15520var entryVirtual = __webpack_require__(40);
15521
15522module.exports = entryVirtual('Array').find;
15523
15524
15525/***/ }),
15526/* 477 */
15527/***/ (function(module, exports, __webpack_require__) {
15528
15529"use strict";
15530
15531var $ = __webpack_require__(0);
15532var $find = __webpack_require__(70).find;
15533var addToUnscopables = __webpack_require__(170);
15534
15535var FIND = 'find';
15536var SKIPS_HOLES = true;
15537
15538// Shouldn't skip holes
15539if (FIND in []) Array(1)[FIND](function () { SKIPS_HOLES = false; });
15540
15541// `Array.prototype.find` method
15542// https://tc39.es/ecma262/#sec-array.prototype.find
15543$({ target: 'Array', proto: true, forced: SKIPS_HOLES }, {
15544 find: function find(callbackfn /* , that = undefined */) {
15545 return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
15546 }
15547});
15548
15549// https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
15550addToUnscopables(FIND);
15551
15552
15553/***/ }),
15554/* 478 */
15555/***/ (function(module, exports, __webpack_require__) {
15556
15557"use strict";
15558
15559
15560var _ = __webpack_require__(3);
15561
15562module.exports = function (AV) {
15563 /**
15564 * Creates a new Relation for the given parent object and key. This
15565 * constructor should rarely be used directly, but rather created by
15566 * {@link AV.Object#relation}.
15567 * @param {AV.Object} parent The parent of this relation.
15568 * @param {String} key The key for this relation on the parent.
15569 * @see AV.Object#relation
15570 * @class
15571 *
15572 * <p>
15573 * A class that is used to access all of the children of a many-to-many
15574 * relationship. Each instance of AV.Relation is associated with a
15575 * particular parent object and key.
15576 * </p>
15577 */
15578 AV.Relation = function (parent, key) {
15579 if (!_.isString(key)) {
15580 throw new TypeError('key must be a string');
15581 }
15582
15583 this.parent = parent;
15584 this.key = key;
15585 this.targetClassName = null;
15586 };
15587 /**
15588 * Creates a query that can be used to query the parent objects in this relation.
15589 * @param {String} parentClass The parent class or name.
15590 * @param {String} relationKey The relation field key in parent.
15591 * @param {AV.Object} child The child object.
15592 * @return {AV.Query}
15593 */
15594
15595
15596 AV.Relation.reverseQuery = function (parentClass, relationKey, child) {
15597 var query = new AV.Query(parentClass);
15598 query.equalTo(relationKey, child._toPointer());
15599 return query;
15600 };
15601
15602 _.extend(AV.Relation.prototype,
15603 /** @lends AV.Relation.prototype */
15604 {
15605 /**
15606 * Makes sure that this relation has the right parent and key.
15607 * @private
15608 */
15609 _ensureParentAndKey: function _ensureParentAndKey(parent, key) {
15610 this.parent = this.parent || parent;
15611 this.key = this.key || key;
15612
15613 if (this.parent !== parent) {
15614 throw new Error('Internal Error. Relation retrieved from two different Objects.');
15615 }
15616
15617 if (this.key !== key) {
15618 throw new Error('Internal Error. Relation retrieved from two different keys.');
15619 }
15620 },
15621
15622 /**
15623 * Adds a AV.Object or an array of AV.Objects to the relation.
15624 * @param {AV.Object|AV.Object[]} objects The item or items to add.
15625 */
15626 add: function add(objects) {
15627 if (!_.isArray(objects)) {
15628 objects = [objects];
15629 }
15630
15631 var change = new AV.Op.Relation(objects, []);
15632 this.parent.set(this.key, change);
15633 this.targetClassName = change._targetClassName;
15634 },
15635
15636 /**
15637 * Removes a AV.Object or an array of AV.Objects from this relation.
15638 * @param {AV.Object|AV.Object[]} objects The item or items to remove.
15639 */
15640 remove: function remove(objects) {
15641 if (!_.isArray(objects)) {
15642 objects = [objects];
15643 }
15644
15645 var change = new AV.Op.Relation([], objects);
15646 this.parent.set(this.key, change);
15647 this.targetClassName = change._targetClassName;
15648 },
15649
15650 /**
15651 * Returns a JSON version of the object suitable for saving to disk.
15652 * @return {Object}
15653 */
15654 toJSON: function toJSON() {
15655 return {
15656 __type: 'Relation',
15657 className: this.targetClassName
15658 };
15659 },
15660
15661 /**
15662 * Returns a AV.Query that is limited to objects in this
15663 * relation.
15664 * @return {AV.Query}
15665 */
15666 query: function query() {
15667 var targetClass;
15668 var query;
15669
15670 if (!this.targetClassName) {
15671 targetClass = AV.Object._getSubclass(this.parent.className);
15672 query = new AV.Query(targetClass);
15673 query._defaultParams.redirectClassNameForKey = this.key;
15674 } else {
15675 targetClass = AV.Object._getSubclass(this.targetClassName);
15676 query = new AV.Query(targetClass);
15677 }
15678
15679 query._addCondition('$relatedTo', 'object', this.parent._toPointer());
15680
15681 query._addCondition('$relatedTo', 'key', this.key);
15682
15683 return query;
15684 }
15685 });
15686};
15687
15688/***/ }),
15689/* 479 */
15690/***/ (function(module, exports, __webpack_require__) {
15691
15692"use strict";
15693
15694
15695var _interopRequireDefault = __webpack_require__(1);
15696
15697var _promise = _interopRequireDefault(__webpack_require__(12));
15698
15699var _ = __webpack_require__(3);
15700
15701var cos = __webpack_require__(480);
15702
15703var qiniu = __webpack_require__(481);
15704
15705var s3 = __webpack_require__(527);
15706
15707var AVError = __webpack_require__(46);
15708
15709var _require = __webpack_require__(27),
15710 request = _require.request,
15711 AVRequest = _require._request;
15712
15713var _require2 = __webpack_require__(30),
15714 tap = _require2.tap,
15715 transformFetchOptions = _require2.transformFetchOptions;
15716
15717var debug = __webpack_require__(60)('leancloud:file');
15718
15719var parseBase64 = __webpack_require__(531);
15720
15721module.exports = function (AV) {
15722 // port from browserify path module
15723 // since react-native packager won't shim node modules.
15724 var extname = function extname(path) {
15725 if (!_.isString(path)) return '';
15726 return path.match(/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/)[4];
15727 };
15728
15729 var b64Digit = function b64Digit(number) {
15730 if (number < 26) {
15731 return String.fromCharCode(65 + number);
15732 }
15733
15734 if (number < 52) {
15735 return String.fromCharCode(97 + (number - 26));
15736 }
15737
15738 if (number < 62) {
15739 return String.fromCharCode(48 + (number - 52));
15740 }
15741
15742 if (number === 62) {
15743 return '+';
15744 }
15745
15746 if (number === 63) {
15747 return '/';
15748 }
15749
15750 throw new Error('Tried to encode large digit ' + number + ' in base64.');
15751 };
15752
15753 var encodeBase64 = function encodeBase64(array) {
15754 var chunks = [];
15755 chunks.length = Math.ceil(array.length / 3);
15756
15757 _.times(chunks.length, function (i) {
15758 var b1 = array[i * 3];
15759 var b2 = array[i * 3 + 1] || 0;
15760 var b3 = array[i * 3 + 2] || 0;
15761 var has2 = i * 3 + 1 < array.length;
15762 var has3 = i * 3 + 2 < array.length;
15763 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('');
15764 });
15765
15766 return chunks.join('');
15767 };
15768 /**
15769 * An AV.File is a local representation of a file that is saved to the AV
15770 * cloud.
15771 * @param name {String} The file's name. This will change to a unique value
15772 * once the file has finished saving.
15773 * @param data {Array} The data for the file, as either:
15774 * 1. an Array of byte value Numbers, or
15775 * 2. an Object like { base64: "..." } with a base64-encoded String.
15776 * 3. a Blob(File) selected with a file upload control in a browser.
15777 * 4. an Object like { blob: {uri: "..."} } that mimics Blob
15778 * in some non-browser environments such as React Native.
15779 * 5. a Buffer in Node.js runtime.
15780 * 6. a Stream in Node.js runtime.
15781 *
15782 * For example:<pre>
15783 * var fileUploadControl = $("#profilePhotoFileUpload")[0];
15784 * if (fileUploadControl.files.length > 0) {
15785 * var file = fileUploadControl.files[0];
15786 * var name = "photo.jpg";
15787 * var file = new AV.File(name, file);
15788 * file.save().then(function() {
15789 * // The file has been saved to AV.
15790 * }, function(error) {
15791 * // The file either could not be read, or could not be saved to AV.
15792 * });
15793 * }</pre>
15794 *
15795 * @class
15796 * @param [mimeType] {String} Content-Type header to use for the file. If
15797 * this is omitted, the content type will be inferred from the name's
15798 * extension.
15799 */
15800
15801
15802 AV.File = function (name, data, mimeType) {
15803 this.attributes = {
15804 name: name,
15805 url: '',
15806 metaData: {},
15807 // 用来存储转换后要上传的 base64 String
15808 base64: ''
15809 };
15810
15811 if (_.isString(data)) {
15812 throw new TypeError('Creating an AV.File from a String is not yet supported.');
15813 }
15814
15815 if (_.isArray(data)) {
15816 this.attributes.metaData.size = data.length;
15817 data = {
15818 base64: encodeBase64(data)
15819 };
15820 }
15821
15822 this._extName = '';
15823 this._data = data;
15824 this._uploadHeaders = {};
15825
15826 if (data && data.blob && typeof data.blob.uri === 'string') {
15827 this._extName = extname(data.blob.uri);
15828 }
15829
15830 if (typeof Blob !== 'undefined' && data instanceof Blob) {
15831 if (data.size) {
15832 this.attributes.metaData.size = data.size;
15833 }
15834
15835 if (data.name) {
15836 this._extName = extname(data.name);
15837 }
15838 }
15839
15840 var owner;
15841
15842 if (data && data.owner) {
15843 owner = data.owner;
15844 } else if (!AV._config.disableCurrentUser) {
15845 try {
15846 owner = AV.User.current();
15847 } catch (error) {
15848 if ('SYNC_API_NOT_AVAILABLE' !== error.code) {
15849 throw error;
15850 }
15851 }
15852 }
15853
15854 this.attributes.metaData.owner = owner ? owner.id : 'unknown';
15855 this.set('mime_type', mimeType);
15856 };
15857 /**
15858 * Creates a fresh AV.File object with exists url for saving to AVOS Cloud.
15859 * @param {String} name the file name
15860 * @param {String} url the file url.
15861 * @param {Object} [metaData] the file metadata object.
15862 * @param {String} [type] Content-Type header to use for the file. If
15863 * this is omitted, the content type will be inferred from the name's
15864 * extension.
15865 * @return {AV.File} the file object
15866 */
15867
15868
15869 AV.File.withURL = function (name, url, metaData, type) {
15870 if (!name || !url) {
15871 throw new Error('Please provide file name and url');
15872 }
15873
15874 var file = new AV.File(name, null, type); //copy metaData properties to file.
15875
15876 if (metaData) {
15877 for (var prop in metaData) {
15878 if (!file.attributes.metaData[prop]) file.attributes.metaData[prop] = metaData[prop];
15879 }
15880 }
15881
15882 file.attributes.url = url; //Mark the file is from external source.
15883
15884 file.attributes.metaData.__source = 'external';
15885 file.attributes.metaData.size = 0;
15886 return file;
15887 };
15888 /**
15889 * Creates a file object with exists objectId.
15890 * @param {String} objectId The objectId string
15891 * @return {AV.File} the file object
15892 */
15893
15894
15895 AV.File.createWithoutData = function (objectId) {
15896 if (!objectId) {
15897 throw new TypeError('The objectId must be provided');
15898 }
15899
15900 var file = new AV.File();
15901 file.id = objectId;
15902 return file;
15903 };
15904 /**
15905 * Request file censor.
15906 * @since 4.13.0
15907 * @param {String} objectId
15908 * @return {Promise.<string>}
15909 */
15910
15911
15912 AV.File.censor = function (objectId) {
15913 if (!AV._config.masterKey) {
15914 throw new Error('Cannot censor a file without masterKey');
15915 }
15916
15917 return request({
15918 method: 'POST',
15919 path: "/files/".concat(objectId, "/censor"),
15920 authOptions: {
15921 useMasterKey: true
15922 }
15923 }).then(function (res) {
15924 return res.censorResult;
15925 });
15926 };
15927
15928 _.extend(AV.File.prototype,
15929 /** @lends AV.File.prototype */
15930 {
15931 className: '_File',
15932 _toFullJSON: function _toFullJSON(seenObjects) {
15933 var _this = this;
15934
15935 var full = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
15936
15937 var json = _.clone(this.attributes);
15938
15939 AV._objectEach(json, function (val, key) {
15940 json[key] = AV._encode(val, seenObjects, undefined, full);
15941 });
15942
15943 AV._objectEach(this._operations, function (val, key) {
15944 json[key] = val;
15945 });
15946
15947 if (_.has(this, 'id')) {
15948 json.objectId = this.id;
15949 }
15950
15951 ['createdAt', 'updatedAt'].forEach(function (key) {
15952 if (_.has(_this, key)) {
15953 var val = _this[key];
15954 json[key] = _.isDate(val) ? val.toJSON() : val;
15955 }
15956 });
15957
15958 if (full) {
15959 json.__type = 'File';
15960 }
15961
15962 return json;
15963 },
15964
15965 /**
15966 * Returns a JSON version of the file with meta data.
15967 * Inverse to {@link AV.parseJSON}
15968 * @since 3.0.0
15969 * @return {Object}
15970 */
15971 toFullJSON: function toFullJSON() {
15972 var seenObjects = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
15973 return this._toFullJSON(seenObjects);
15974 },
15975
15976 /**
15977 * Returns a JSON version of the object.
15978 * @return {Object}
15979 */
15980 toJSON: function toJSON(key, holder) {
15981 var seenObjects = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [this];
15982 return this._toFullJSON(seenObjects, false);
15983 },
15984
15985 /**
15986 * Gets a Pointer referencing this file.
15987 * @private
15988 */
15989 _toPointer: function _toPointer() {
15990 return {
15991 __type: 'Pointer',
15992 className: this.className,
15993 objectId: this.id
15994 };
15995 },
15996
15997 /**
15998 * Returns the ACL for this file.
15999 * @returns {AV.ACL} An instance of AV.ACL.
16000 */
16001 getACL: function getACL() {
16002 return this._acl;
16003 },
16004
16005 /**
16006 * Sets the ACL to be used for this file.
16007 * @param {AV.ACL} acl An instance of AV.ACL.
16008 */
16009 setACL: function setACL(acl) {
16010 if (!(acl instanceof AV.ACL)) {
16011 return new AVError(AVError.OTHER_CAUSE, 'ACL must be a AV.ACL.');
16012 }
16013
16014 this._acl = acl;
16015 return this;
16016 },
16017
16018 /**
16019 * Gets the name of the file. Before save is called, this is the filename
16020 * given by the user. After save is called, that name gets prefixed with a
16021 * unique identifier.
16022 */
16023 name: function name() {
16024 return this.get('name');
16025 },
16026
16027 /**
16028 * Gets the url of the file. It is only available after you save the file or
16029 * after you get the file from a AV.Object.
16030 * @return {String}
16031 */
16032 url: function url() {
16033 return this.get('url');
16034 },
16035
16036 /**
16037 * Gets the attributs of the file object.
16038 * @param {String} The attribute name which want to get.
16039 * @returns {Any}
16040 */
16041 get: function get(attrName) {
16042 switch (attrName) {
16043 case 'objectId':
16044 return this.id;
16045
16046 case 'url':
16047 case 'name':
16048 case 'mime_type':
16049 case 'metaData':
16050 case 'createdAt':
16051 case 'updatedAt':
16052 return this.attributes[attrName];
16053
16054 default:
16055 return this.attributes.metaData[attrName];
16056 }
16057 },
16058
16059 /**
16060 * Set the metaData of the file object.
16061 * @param {Object} Object is an key value Object for setting metaData.
16062 * @param {String} attr is an optional metadata key.
16063 * @param {Object} value is an optional metadata value.
16064 * @returns {String|Number|Array|Object}
16065 */
16066 set: function set() {
16067 var _this2 = this;
16068
16069 var set = function set(attrName, value) {
16070 switch (attrName) {
16071 case 'name':
16072 case 'url':
16073 case 'mime_type':
16074 case 'base64':
16075 case 'metaData':
16076 _this2.attributes[attrName] = value;
16077 break;
16078
16079 default:
16080 // File 并非一个 AVObject,不能完全自定义其他属性,所以只能都放在 metaData 上面
16081 _this2.attributes.metaData[attrName] = value;
16082 break;
16083 }
16084 };
16085
16086 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
16087 args[_key] = arguments[_key];
16088 }
16089
16090 switch (args.length) {
16091 case 1:
16092 // 传入一个 Object
16093 for (var k in args[0]) {
16094 set(k, args[0][k]);
16095 }
16096
16097 break;
16098
16099 case 2:
16100 set(args[0], args[1]);
16101 break;
16102 }
16103
16104 return this;
16105 },
16106
16107 /**
16108 * Set a header for the upload request.
16109 * For more infomation, go to https://url.leanapp.cn/avfile-upload-headers
16110 *
16111 * @param {String} key header key
16112 * @param {String} value header value
16113 * @return {AV.File} this
16114 */
16115 setUploadHeader: function setUploadHeader(key, value) {
16116 this._uploadHeaders[key] = value;
16117 return this;
16118 },
16119
16120 /**
16121 * <p>Returns the file's metadata JSON object if no arguments is given.Returns the
16122 * metadata value if a key is given.Set metadata value if key and value are both given.</p>
16123 * <p><pre>
16124 * var metadata = file.metaData(); //Get metadata JSON object.
16125 * var size = file.metaData('size'); // Get the size metadata value.
16126 * file.metaData('format', 'jpeg'); //set metadata attribute and value.
16127 *</pre></p>
16128 * @return {Object} The file's metadata JSON object.
16129 * @param {String} attr an optional metadata key.
16130 * @param {Object} value an optional metadata value.
16131 **/
16132 metaData: function metaData(attr, value) {
16133 if (attr && value) {
16134 this.attributes.metaData[attr] = value;
16135 return this;
16136 } else if (attr && !value) {
16137 return this.attributes.metaData[attr];
16138 } else {
16139 return this.attributes.metaData;
16140 }
16141 },
16142
16143 /**
16144 * 如果文件是图片,获取图片的缩略图URL。可以传入宽度、高度、质量、格式等参数。
16145 * @return {String} 缩略图URL
16146 * @param {Number} width 宽度,单位:像素
16147 * @param {Number} heigth 高度,单位:像素
16148 * @param {Number} quality 质量,1-100的数字,默认100
16149 * @param {Number} scaleToFit 是否将图片自适应大小。默认为true。
16150 * @param {String} fmt 格式,默认为png,也可以为jpeg,gif等格式。
16151 */
16152 thumbnailURL: function thumbnailURL(width, height) {
16153 var quality = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 100;
16154 var scaleToFit = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
16155 var fmt = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 'png';
16156 var url = this.attributes.url;
16157
16158 if (!url) {
16159 throw new Error('Invalid url.');
16160 }
16161
16162 if (!width || !height || width <= 0 || height <= 0) {
16163 throw new Error('Invalid width or height value.');
16164 }
16165
16166 if (quality <= 0 || quality > 100) {
16167 throw new Error('Invalid quality value.');
16168 }
16169
16170 var mode = scaleToFit ? 2 : 1;
16171 return url + '?imageView/' + mode + '/w/' + width + '/h/' + height + '/q/' + quality + '/format/' + fmt;
16172 },
16173
16174 /**
16175 * Returns the file's size.
16176 * @return {Number} The file's size in bytes.
16177 **/
16178 size: function size() {
16179 return this.metaData().size;
16180 },
16181
16182 /**
16183 * Returns the file's owner.
16184 * @return {String} The file's owner id.
16185 */
16186 ownerId: function ownerId() {
16187 return this.metaData().owner;
16188 },
16189
16190 /**
16191 * Destroy the file.
16192 * @param {AuthOptions} options
16193 * @return {Promise} A promise that is fulfilled when the destroy
16194 * completes.
16195 */
16196 destroy: function destroy(options) {
16197 if (!this.id) {
16198 return _promise.default.reject(new Error('The file id does not eixst.'));
16199 }
16200
16201 var request = AVRequest('files', null, this.id, 'DELETE', null, options);
16202 return request;
16203 },
16204
16205 /**
16206 * Request Qiniu upload token
16207 * @param {string} type
16208 * @return {Promise} Resolved with the response
16209 * @private
16210 */
16211 _fileToken: function _fileToken(type, authOptions) {
16212 var name = this.attributes.name;
16213 var extName = extname(name);
16214
16215 if (!extName && this._extName) {
16216 name += this._extName;
16217 extName = this._extName;
16218 }
16219
16220 var data = {
16221 name: name,
16222 keep_file_name: authOptions.keepFileName,
16223 key: authOptions.key,
16224 ACL: this._acl,
16225 mime_type: type,
16226 metaData: this.attributes.metaData
16227 };
16228 return AVRequest('fileTokens', null, null, 'POST', data, authOptions);
16229 },
16230
16231 /**
16232 * @callback UploadProgressCallback
16233 * @param {XMLHttpRequestProgressEvent} event - The progress event with 'loaded' and 'total' attributes
16234 */
16235
16236 /**
16237 * Saves the file to the AV cloud.
16238 * @param {AuthOptions} [options] AuthOptions plus:
16239 * @param {UploadProgressCallback} [options.onprogress] 文件上传进度,在 Node.js 中无效,回调参数说明详见 {@link UploadProgressCallback}。
16240 * @param {boolean} [options.keepFileName = false] 保留下载文件的文件名。
16241 * @param {string} [options.key] 指定文件的 key。设置该选项需要使用 masterKey
16242 * @return {Promise} Promise that is resolved when the save finishes.
16243 */
16244 save: function save() {
16245 var _this3 = this;
16246
16247 var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
16248
16249 if (this.id) {
16250 throw new Error('File is already saved.');
16251 }
16252
16253 if (!this._previousSave) {
16254 if (this._data) {
16255 var mimeType = this.get('mime_type');
16256 this._previousSave = this._fileToken(mimeType, options).then(function (uploadInfo) {
16257 if (uploadInfo.mime_type) {
16258 mimeType = uploadInfo.mime_type;
16259
16260 _this3.set('mime_type', mimeType);
16261 }
16262
16263 _this3._token = uploadInfo.token;
16264 return _promise.default.resolve().then(function () {
16265 var data = _this3._data;
16266
16267 if (data && data.base64) {
16268 return parseBase64(data.base64, mimeType);
16269 }
16270
16271 if (data && data.blob) {
16272 if (!data.blob.type && mimeType) {
16273 data.blob.type = mimeType;
16274 }
16275
16276 if (!data.blob.name) {
16277 data.blob.name = _this3.get('name');
16278 }
16279
16280 return data.blob;
16281 }
16282
16283 if (typeof Blob !== 'undefined' && data instanceof Blob) {
16284 return data;
16285 }
16286
16287 throw new TypeError('malformed file data');
16288 }).then(function (data) {
16289 var _options = _.extend({}, options); // filter out download progress events
16290
16291
16292 if (options.onprogress) {
16293 _options.onprogress = function (event) {
16294 if (event.direction === 'download') return;
16295 return options.onprogress(event);
16296 };
16297 }
16298
16299 switch (uploadInfo.provider) {
16300 case 's3':
16301 return s3(uploadInfo, data, _this3, _options);
16302
16303 case 'qcloud':
16304 return cos(uploadInfo, data, _this3, _options);
16305
16306 case 'qiniu':
16307 default:
16308 return qiniu(uploadInfo, data, _this3, _options);
16309 }
16310 }).then(tap(function () {
16311 return _this3._callback(true);
16312 }), function (error) {
16313 _this3._callback(false);
16314
16315 throw error;
16316 });
16317 });
16318 } else if (this.attributes.url && this.attributes.metaData.__source === 'external') {
16319 // external link file.
16320 var data = {
16321 name: this.attributes.name,
16322 ACL: this._acl,
16323 metaData: this.attributes.metaData,
16324 mime_type: this.mimeType,
16325 url: this.attributes.url
16326 };
16327 this._previousSave = AVRequest('files', null, null, 'post', data, options).then(function (response) {
16328 _this3.id = response.objectId;
16329 return _this3;
16330 });
16331 }
16332 }
16333
16334 return this._previousSave;
16335 },
16336 _callback: function _callback(success) {
16337 AVRequest('fileCallback', null, null, 'post', {
16338 token: this._token,
16339 result: success
16340 }).catch(debug);
16341 delete this._token;
16342 delete this._data;
16343 },
16344
16345 /**
16346 * fetch the file from server. If the server's representation of the
16347 * model differs from its current attributes, they will be overriden,
16348 * @param {Object} fetchOptions Optional options to set 'keys',
16349 * 'include' and 'includeACL' option.
16350 * @param {AuthOptions} options
16351 * @return {Promise} A promise that is fulfilled when the fetch
16352 * completes.
16353 */
16354 fetch: function fetch(fetchOptions, options) {
16355 if (!this.id) {
16356 throw new Error('Cannot fetch unsaved file');
16357 }
16358
16359 var request = AVRequest('files', null, this.id, 'GET', transformFetchOptions(fetchOptions), options);
16360 return request.then(this._finishFetch.bind(this));
16361 },
16362 _finishFetch: function _finishFetch(response) {
16363 var value = AV.Object.prototype.parse(response);
16364 value.attributes = {
16365 name: value.name,
16366 url: value.url,
16367 mime_type: value.mime_type,
16368 bucket: value.bucket
16369 };
16370 value.attributes.metaData = value.metaData || {};
16371 value.id = value.objectId; // clean
16372
16373 delete value.objectId;
16374 delete value.metaData;
16375 delete value.url;
16376 delete value.name;
16377 delete value.mime_type;
16378 delete value.bucket;
16379
16380 _.extend(this, value);
16381
16382 return this;
16383 },
16384
16385 /**
16386 * Request file censor
16387 * @since 4.13.0
16388 * @return {Promise.<string>}
16389 */
16390 censor: function censor() {
16391 if (!this.id) {
16392 throw new Error('Cannot censor an unsaved file');
16393 }
16394
16395 return AV.File.censor(this.id);
16396 }
16397 });
16398};
16399
16400/***/ }),
16401/* 480 */
16402/***/ (function(module, exports, __webpack_require__) {
16403
16404"use strict";
16405
16406
16407var _require = __webpack_require__(72),
16408 getAdapter = _require.getAdapter;
16409
16410var debug = __webpack_require__(60)('cos');
16411
16412module.exports = function (uploadInfo, data, file) {
16413 var saveOptions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
16414 var url = uploadInfo.upload_url + '?sign=' + encodeURIComponent(uploadInfo.token);
16415 var fileFormData = {
16416 field: 'fileContent',
16417 data: data,
16418 name: file.attributes.name
16419 };
16420 var options = {
16421 headers: file._uploadHeaders,
16422 data: {
16423 op: 'upload'
16424 },
16425 onprogress: saveOptions.onprogress
16426 };
16427 debug('url: %s, file: %o, options: %o', url, fileFormData, options);
16428 var upload = getAdapter('upload');
16429 return upload(url, fileFormData, options).then(function (response) {
16430 debug(response.status, response.data);
16431
16432 if (response.ok === false) {
16433 var error = new Error(response.status);
16434 error.response = response;
16435 throw error;
16436 }
16437
16438 file.attributes.url = uploadInfo.url;
16439 file._bucket = uploadInfo.bucket;
16440 file.id = uploadInfo.objectId;
16441 return file;
16442 }, function (error) {
16443 var response = error.response;
16444
16445 if (response) {
16446 debug(response.status, response.data);
16447 error.statusCode = response.status;
16448 error.response = response.data;
16449 }
16450
16451 throw error;
16452 });
16453};
16454
16455/***/ }),
16456/* 481 */
16457/***/ (function(module, exports, __webpack_require__) {
16458
16459"use strict";
16460
16461
16462var _sliceInstanceProperty2 = __webpack_require__(61);
16463
16464var _Array$from = __webpack_require__(253);
16465
16466var _Symbol = __webpack_require__(150);
16467
16468var _getIteratorMethod = __webpack_require__(255);
16469
16470var _Reflect$construct = __webpack_require__(491);
16471
16472var _interopRequireDefault = __webpack_require__(1);
16473
16474var _inherits2 = _interopRequireDefault(__webpack_require__(495));
16475
16476var _possibleConstructorReturn2 = _interopRequireDefault(__webpack_require__(517));
16477
16478var _getPrototypeOf2 = _interopRequireDefault(__webpack_require__(519));
16479
16480var _classCallCheck2 = _interopRequireDefault(__webpack_require__(524));
16481
16482var _createClass2 = _interopRequireDefault(__webpack_require__(525));
16483
16484var _stringify = _interopRequireDefault(__webpack_require__(36));
16485
16486var _concat = _interopRequireDefault(__webpack_require__(22));
16487
16488var _promise = _interopRequireDefault(__webpack_require__(12));
16489
16490var _slice = _interopRequireDefault(__webpack_require__(61));
16491
16492function _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); }; }
16493
16494function _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; } }
16495
16496function _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; } } }; }
16497
16498function _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); }
16499
16500function _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; }
16501
16502var _require = __webpack_require__(72),
16503 getAdapter = _require.getAdapter;
16504
16505var debug = __webpack_require__(60)('leancloud:qiniu');
16506
16507var ajax = __webpack_require__(116);
16508
16509var btoa = __webpack_require__(526);
16510
16511var SHARD_THRESHOLD = 1024 * 1024 * 64;
16512var CHUNK_SIZE = 1024 * 1024 * 16;
16513
16514function upload(uploadInfo, data, file) {
16515 var saveOptions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
16516 // Get the uptoken to upload files to qiniu.
16517 var uptoken = uploadInfo.token;
16518 var url = uploadInfo.upload_url || 'https://upload.qiniup.com';
16519 var fileFormData = {
16520 field: 'file',
16521 data: data,
16522 name: file.attributes.name
16523 };
16524 var options = {
16525 headers: file._uploadHeaders,
16526 data: {
16527 name: file.attributes.name,
16528 key: uploadInfo.key,
16529 token: uptoken
16530 },
16531 onprogress: saveOptions.onprogress
16532 };
16533 debug('url: %s, file: %o, options: %o', url, fileFormData, options);
16534 var upload = getAdapter('upload');
16535 return upload(url, fileFormData, options).then(function (response) {
16536 debug(response.status, response.data);
16537
16538 if (response.ok === false) {
16539 var message = response.status;
16540
16541 if (response.data) {
16542 if (response.data.error) {
16543 message = response.data.error;
16544 } else {
16545 message = (0, _stringify.default)(response.data);
16546 }
16547 }
16548
16549 var error = new Error(message);
16550 error.response = response;
16551 throw error;
16552 }
16553
16554 file.attributes.url = uploadInfo.url;
16555 file._bucket = uploadInfo.bucket;
16556 file.id = uploadInfo.objectId;
16557 return file;
16558 }, function (error) {
16559 var response = error.response;
16560
16561 if (response) {
16562 debug(response.status, response.data);
16563 error.statusCode = response.status;
16564 error.response = response.data;
16565 }
16566
16567 throw error;
16568 });
16569}
16570
16571function urlSafeBase64(string) {
16572 var base64 = btoa(unescape(encodeURIComponent(string)));
16573 var result = '';
16574
16575 var _iterator = _createForOfIteratorHelper(base64),
16576 _step;
16577
16578 try {
16579 for (_iterator.s(); !(_step = _iterator.n()).done;) {
16580 var ch = _step.value;
16581
16582 switch (ch) {
16583 case '+':
16584 result += '-';
16585 break;
16586
16587 case '/':
16588 result += '_';
16589 break;
16590
16591 default:
16592 result += ch;
16593 }
16594 }
16595 } catch (err) {
16596 _iterator.e(err);
16597 } finally {
16598 _iterator.f();
16599 }
16600
16601 return result;
16602}
16603
16604var ShardUploader = /*#__PURE__*/function () {
16605 function ShardUploader(uploadInfo, data, file, saveOptions) {
16606 var _context,
16607 _context2,
16608 _this = this;
16609
16610 (0, _classCallCheck2.default)(this, ShardUploader);
16611 this.uploadInfo = uploadInfo;
16612 this.data = data;
16613 this.file = file;
16614 this.size = undefined;
16615 this.offset = 0;
16616 this.uploadedChunks = 0;
16617 var key = urlSafeBase64(uploadInfo.key);
16618 var uploadURL = uploadInfo.upload_url || 'https://upload.qiniup.com';
16619 this.baseURL = (0, _concat.default)(_context = (0, _concat.default)(_context2 = "".concat(uploadURL, "/buckets/")).call(_context2, uploadInfo.bucket, "/objects/")).call(_context, key, "/uploads");
16620 this.upToken = 'UpToken ' + uploadInfo.token;
16621 this.uploaded = 0;
16622
16623 if (saveOptions && saveOptions.onprogress) {
16624 this.onProgress = function (_ref) {
16625 var loaded = _ref.loaded;
16626 loaded += _this.uploadedChunks * CHUNK_SIZE;
16627
16628 if (loaded <= _this.uploaded) {
16629 return;
16630 }
16631
16632 if (_this.size) {
16633 saveOptions.onprogress({
16634 loaded: loaded,
16635 total: _this.size,
16636 percent: loaded / _this.size * 100
16637 });
16638 } else {
16639 saveOptions.onprogress({
16640 loaded: loaded
16641 });
16642 }
16643
16644 _this.uploaded = loaded;
16645 };
16646 }
16647 }
16648 /**
16649 * @returns {Promise<string>}
16650 */
16651
16652
16653 (0, _createClass2.default)(ShardUploader, [{
16654 key: "getUploadId",
16655 value: function getUploadId() {
16656 return ajax({
16657 method: 'POST',
16658 url: this.baseURL,
16659 headers: {
16660 Authorization: this.upToken
16661 }
16662 }).then(function (res) {
16663 return res.uploadId;
16664 });
16665 }
16666 }, {
16667 key: "getChunk",
16668 value: function getChunk() {
16669 throw new Error('Not implemented');
16670 }
16671 /**
16672 * @param {string} uploadId
16673 * @param {number} partNumber
16674 * @param {any} data
16675 * @returns {Promise<{ partNumber: number, etag: string }>}
16676 */
16677
16678 }, {
16679 key: "uploadPart",
16680 value: function uploadPart(uploadId, partNumber, data) {
16681 var _context3, _context4;
16682
16683 return ajax({
16684 method: 'PUT',
16685 url: (0, _concat.default)(_context3 = (0, _concat.default)(_context4 = "".concat(this.baseURL, "/")).call(_context4, uploadId, "/")).call(_context3, partNumber),
16686 headers: {
16687 Authorization: this.upToken
16688 },
16689 data: data,
16690 onprogress: this.onProgress
16691 }).then(function (_ref2) {
16692 var etag = _ref2.etag;
16693 return {
16694 partNumber: partNumber,
16695 etag: etag
16696 };
16697 });
16698 }
16699 }, {
16700 key: "stopUpload",
16701 value: function stopUpload(uploadId) {
16702 var _context5;
16703
16704 return ajax({
16705 method: 'DELETE',
16706 url: (0, _concat.default)(_context5 = "".concat(this.baseURL, "/")).call(_context5, uploadId),
16707 headers: {
16708 Authorization: this.upToken
16709 }
16710 });
16711 }
16712 }, {
16713 key: "upload",
16714 value: function upload() {
16715 var _this2 = this;
16716
16717 var parts = [];
16718 return this.getUploadId().then(function (uploadId) {
16719 var uploadPart = function uploadPart() {
16720 return _promise.default.resolve(_this2.getChunk()).then(function (chunk) {
16721 if (!chunk) {
16722 return;
16723 }
16724
16725 var partNumber = parts.length + 1;
16726 return _this2.uploadPart(uploadId, partNumber, chunk).then(function (part) {
16727 parts.push(part);
16728 _this2.uploadedChunks++;
16729 return uploadPart();
16730 });
16731 }).catch(function (error) {
16732 return _this2.stopUpload(uploadId).then(function () {
16733 return _promise.default.reject(error);
16734 });
16735 });
16736 };
16737
16738 return uploadPart().then(function () {
16739 var _context6;
16740
16741 return ajax({
16742 method: 'POST',
16743 url: (0, _concat.default)(_context6 = "".concat(_this2.baseURL, "/")).call(_context6, uploadId),
16744 headers: {
16745 Authorization: _this2.upToken
16746 },
16747 data: {
16748 parts: parts,
16749 fname: _this2.file.attributes.name,
16750 mimeType: _this2.file.attributes.mime_type
16751 }
16752 });
16753 });
16754 }).then(function () {
16755 _this2.file.attributes.url = _this2.uploadInfo.url;
16756 _this2.file._bucket = _this2.uploadInfo.bucket;
16757 _this2.file.id = _this2.uploadInfo.objectId;
16758 return _this2.file;
16759 });
16760 }
16761 }]);
16762 return ShardUploader;
16763}();
16764
16765var BlobUploader = /*#__PURE__*/function (_ShardUploader) {
16766 (0, _inherits2.default)(BlobUploader, _ShardUploader);
16767
16768 var _super = _createSuper(BlobUploader);
16769
16770 function BlobUploader(uploadInfo, data, file, saveOptions) {
16771 var _this3;
16772
16773 (0, _classCallCheck2.default)(this, BlobUploader);
16774 _this3 = _super.call(this, uploadInfo, data, file, saveOptions);
16775 _this3.size = data.size;
16776 return _this3;
16777 }
16778 /**
16779 * @returns {Blob | null}
16780 */
16781
16782
16783 (0, _createClass2.default)(BlobUploader, [{
16784 key: "getChunk",
16785 value: function getChunk() {
16786 var _context7;
16787
16788 if (this.offset >= this.size) {
16789 return null;
16790 }
16791
16792 var chunk = (0, _slice.default)(_context7 = this.data).call(_context7, this.offset, this.offset + CHUNK_SIZE);
16793 this.offset += chunk.size;
16794 return chunk;
16795 }
16796 }]);
16797 return BlobUploader;
16798}(ShardUploader);
16799
16800function isBlob(data) {
16801 return typeof Blob !== 'undefined' && data instanceof Blob;
16802}
16803
16804module.exports = function (uploadInfo, data, file) {
16805 var saveOptions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
16806
16807 if (isBlob(data) && data.size >= SHARD_THRESHOLD) {
16808 return new BlobUploader(uploadInfo, data, file, saveOptions).upload();
16809 }
16810
16811 return upload(uploadInfo, data, file, saveOptions);
16812};
16813
16814/***/ }),
16815/* 482 */
16816/***/ (function(module, exports, __webpack_require__) {
16817
16818__webpack_require__(55);
16819__webpack_require__(483);
16820var path = __webpack_require__(5);
16821
16822module.exports = path.Array.from;
16823
16824
16825/***/ }),
16826/* 483 */
16827/***/ (function(module, exports, __webpack_require__) {
16828
16829var $ = __webpack_require__(0);
16830var from = __webpack_require__(484);
16831var checkCorrectnessOfIteration = __webpack_require__(179);
16832
16833var INCORRECT_ITERATION = !checkCorrectnessOfIteration(function (iterable) {
16834 // eslint-disable-next-line es-x/no-array-from -- required for testing
16835 Array.from(iterable);
16836});
16837
16838// `Array.from` method
16839// https://tc39.es/ecma262/#sec-array.from
16840$({ target: 'Array', stat: true, forced: INCORRECT_ITERATION }, {
16841 from: from
16842});
16843
16844
16845/***/ }),
16846/* 484 */
16847/***/ (function(module, exports, __webpack_require__) {
16848
16849"use strict";
16850
16851var bind = __webpack_require__(48);
16852var call = __webpack_require__(15);
16853var toObject = __webpack_require__(34);
16854var callWithSafeIterationClosing = __webpack_require__(485);
16855var isArrayIteratorMethod = __webpack_require__(167);
16856var isConstructor = __webpack_require__(109);
16857var lengthOfArrayLike = __webpack_require__(41);
16858var createProperty = __webpack_require__(91);
16859var getIterator = __webpack_require__(168);
16860var getIteratorMethod = __webpack_require__(106);
16861
16862var $Array = Array;
16863
16864// `Array.from` method implementation
16865// https://tc39.es/ecma262/#sec-array.from
16866module.exports = function from(arrayLike /* , mapfn = undefined, thisArg = undefined */) {
16867 var O = toObject(arrayLike);
16868 var IS_CONSTRUCTOR = isConstructor(this);
16869 var argumentsLength = arguments.length;
16870 var mapfn = argumentsLength > 1 ? arguments[1] : undefined;
16871 var mapping = mapfn !== undefined;
16872 if (mapping) mapfn = bind(mapfn, argumentsLength > 2 ? arguments[2] : undefined);
16873 var iteratorMethod = getIteratorMethod(O);
16874 var index = 0;
16875 var length, result, step, iterator, next, value;
16876 // if the target is not iterable or it's an array with the default iterator - use a simple case
16877 if (iteratorMethod && !(this === $Array && isArrayIteratorMethod(iteratorMethod))) {
16878 iterator = getIterator(O, iteratorMethod);
16879 next = iterator.next;
16880 result = IS_CONSTRUCTOR ? new this() : [];
16881 for (;!(step = call(next, iterator)).done; index++) {
16882 value = mapping ? callWithSafeIterationClosing(iterator, mapfn, [step.value, index], true) : step.value;
16883 createProperty(result, index, value);
16884 }
16885 } else {
16886 length = lengthOfArrayLike(O);
16887 result = IS_CONSTRUCTOR ? new this(length) : $Array(length);
16888 for (;length > index; index++) {
16889 value = mapping ? mapfn(O[index], index) : O[index];
16890 createProperty(result, index, value);
16891 }
16892 }
16893 result.length = index;
16894 return result;
16895};
16896
16897
16898/***/ }),
16899/* 485 */
16900/***/ (function(module, exports, __webpack_require__) {
16901
16902var anObject = __webpack_require__(20);
16903var iteratorClose = __webpack_require__(169);
16904
16905// call something on iterator step with safe closing on error
16906module.exports = function (iterator, fn, value, ENTRIES) {
16907 try {
16908 return ENTRIES ? fn(anObject(value)[0], value[1]) : fn(value);
16909 } catch (error) {
16910 iteratorClose(iterator, 'throw', error);
16911 }
16912};
16913
16914
16915/***/ }),
16916/* 486 */
16917/***/ (function(module, exports, __webpack_require__) {
16918
16919module.exports = __webpack_require__(487);
16920
16921
16922/***/ }),
16923/* 487 */
16924/***/ (function(module, exports, __webpack_require__) {
16925
16926var parent = __webpack_require__(488);
16927
16928module.exports = parent;
16929
16930
16931/***/ }),
16932/* 488 */
16933/***/ (function(module, exports, __webpack_require__) {
16934
16935var parent = __webpack_require__(489);
16936
16937module.exports = parent;
16938
16939
16940/***/ }),
16941/* 489 */
16942/***/ (function(module, exports, __webpack_require__) {
16943
16944var parent = __webpack_require__(490);
16945__webpack_require__(39);
16946
16947module.exports = parent;
16948
16949
16950/***/ }),
16951/* 490 */
16952/***/ (function(module, exports, __webpack_require__) {
16953
16954__webpack_require__(38);
16955__webpack_require__(55);
16956var getIteratorMethod = __webpack_require__(106);
16957
16958module.exports = getIteratorMethod;
16959
16960
16961/***/ }),
16962/* 491 */
16963/***/ (function(module, exports, __webpack_require__) {
16964
16965module.exports = __webpack_require__(492);
16966
16967/***/ }),
16968/* 492 */
16969/***/ (function(module, exports, __webpack_require__) {
16970
16971var parent = __webpack_require__(493);
16972
16973module.exports = parent;
16974
16975
16976/***/ }),
16977/* 493 */
16978/***/ (function(module, exports, __webpack_require__) {
16979
16980__webpack_require__(494);
16981var path = __webpack_require__(5);
16982
16983module.exports = path.Reflect.construct;
16984
16985
16986/***/ }),
16987/* 494 */
16988/***/ (function(module, exports, __webpack_require__) {
16989
16990var $ = __webpack_require__(0);
16991var getBuiltIn = __webpack_require__(18);
16992var apply = __webpack_require__(75);
16993var bind = __webpack_require__(256);
16994var aConstructor = __webpack_require__(175);
16995var anObject = __webpack_require__(20);
16996var isObject = __webpack_require__(11);
16997var create = __webpack_require__(49);
16998var fails = __webpack_require__(2);
16999
17000var nativeConstruct = getBuiltIn('Reflect', 'construct');
17001var ObjectPrototype = Object.prototype;
17002var push = [].push;
17003
17004// `Reflect.construct` method
17005// https://tc39.es/ecma262/#sec-reflect.construct
17006// MS Edge supports only 2 arguments and argumentsList argument is optional
17007// FF Nightly sets third argument as `new.target`, but does not create `this` from it
17008var NEW_TARGET_BUG = fails(function () {
17009 function F() { /* empty */ }
17010 return !(nativeConstruct(function () { /* empty */ }, [], F) instanceof F);
17011});
17012
17013var ARGS_BUG = !fails(function () {
17014 nativeConstruct(function () { /* empty */ });
17015});
17016
17017var FORCED = NEW_TARGET_BUG || ARGS_BUG;
17018
17019$({ target: 'Reflect', stat: true, forced: FORCED, sham: FORCED }, {
17020 construct: function construct(Target, args /* , newTarget */) {
17021 aConstructor(Target);
17022 anObject(args);
17023 var newTarget = arguments.length < 3 ? Target : aConstructor(arguments[2]);
17024 if (ARGS_BUG && !NEW_TARGET_BUG) return nativeConstruct(Target, args, newTarget);
17025 if (Target == newTarget) {
17026 // w/o altered newTarget, optimization for 0-4 arguments
17027 switch (args.length) {
17028 case 0: return new Target();
17029 case 1: return new Target(args[0]);
17030 case 2: return new Target(args[0], args[1]);
17031 case 3: return new Target(args[0], args[1], args[2]);
17032 case 4: return new Target(args[0], args[1], args[2], args[3]);
17033 }
17034 // w/o altered newTarget, lot of arguments case
17035 var $args = [null];
17036 apply(push, $args, args);
17037 return new (apply(bind, Target, $args))();
17038 }
17039 // with altered newTarget, not support built-in constructors
17040 var proto = newTarget.prototype;
17041 var instance = create(isObject(proto) ? proto : ObjectPrototype);
17042 var result = apply(Target, instance, args);
17043 return isObject(result) ? result : instance;
17044 }
17045});
17046
17047
17048/***/ }),
17049/* 495 */
17050/***/ (function(module, exports, __webpack_require__) {
17051
17052var _Object$create = __webpack_require__(496);
17053
17054var _Object$defineProperty = __webpack_require__(151);
17055
17056var setPrototypeOf = __webpack_require__(506);
17057
17058function _inherits(subClass, superClass) {
17059 if (typeof superClass !== "function" && superClass !== null) {
17060 throw new TypeError("Super expression must either be null or a function");
17061 }
17062
17063 subClass.prototype = _Object$create(superClass && superClass.prototype, {
17064 constructor: {
17065 value: subClass,
17066 writable: true,
17067 configurable: true
17068 }
17069 });
17070
17071 _Object$defineProperty(subClass, "prototype", {
17072 writable: false
17073 });
17074
17075 if (superClass) setPrototypeOf(subClass, superClass);
17076}
17077
17078module.exports = _inherits, module.exports.__esModule = true, module.exports["default"] = module.exports;
17079
17080/***/ }),
17081/* 496 */
17082/***/ (function(module, exports, __webpack_require__) {
17083
17084module.exports = __webpack_require__(497);
17085
17086/***/ }),
17087/* 497 */
17088/***/ (function(module, exports, __webpack_require__) {
17089
17090module.exports = __webpack_require__(498);
17091
17092
17093/***/ }),
17094/* 498 */
17095/***/ (function(module, exports, __webpack_require__) {
17096
17097var parent = __webpack_require__(499);
17098
17099module.exports = parent;
17100
17101
17102/***/ }),
17103/* 499 */
17104/***/ (function(module, exports, __webpack_require__) {
17105
17106var parent = __webpack_require__(500);
17107
17108module.exports = parent;
17109
17110
17111/***/ }),
17112/* 500 */
17113/***/ (function(module, exports, __webpack_require__) {
17114
17115var parent = __webpack_require__(501);
17116
17117module.exports = parent;
17118
17119
17120/***/ }),
17121/* 501 */
17122/***/ (function(module, exports, __webpack_require__) {
17123
17124__webpack_require__(502);
17125var path = __webpack_require__(5);
17126
17127var Object = path.Object;
17128
17129module.exports = function create(P, D) {
17130 return Object.create(P, D);
17131};
17132
17133
17134/***/ }),
17135/* 502 */
17136/***/ (function(module, exports, __webpack_require__) {
17137
17138// TODO: Remove from `core-js@4`
17139var $ = __webpack_require__(0);
17140var DESCRIPTORS = __webpack_require__(14);
17141var create = __webpack_require__(49);
17142
17143// `Object.create` method
17144// https://tc39.es/ecma262/#sec-object.create
17145$({ target: 'Object', stat: true, sham: !DESCRIPTORS }, {
17146 create: create
17147});
17148
17149
17150/***/ }),
17151/* 503 */
17152/***/ (function(module, exports, __webpack_require__) {
17153
17154module.exports = __webpack_require__(504);
17155
17156
17157/***/ }),
17158/* 504 */
17159/***/ (function(module, exports, __webpack_require__) {
17160
17161var parent = __webpack_require__(505);
17162
17163module.exports = parent;
17164
17165
17166/***/ }),
17167/* 505 */
17168/***/ (function(module, exports, __webpack_require__) {
17169
17170var parent = __webpack_require__(242);
17171
17172module.exports = parent;
17173
17174
17175/***/ }),
17176/* 506 */
17177/***/ (function(module, exports, __webpack_require__) {
17178
17179var _Object$setPrototypeOf = __webpack_require__(257);
17180
17181var _bindInstanceProperty = __webpack_require__(258);
17182
17183function _setPrototypeOf(o, p) {
17184 var _context;
17185
17186 module.exports = _setPrototypeOf = _Object$setPrototypeOf ? _bindInstanceProperty(_context = _Object$setPrototypeOf).call(_context) : function _setPrototypeOf(o, p) {
17187 o.__proto__ = p;
17188 return o;
17189 }, module.exports.__esModule = true, module.exports["default"] = module.exports;
17190 return _setPrototypeOf(o, p);
17191}
17192
17193module.exports = _setPrototypeOf, module.exports.__esModule = true, module.exports["default"] = module.exports;
17194
17195/***/ }),
17196/* 507 */
17197/***/ (function(module, exports, __webpack_require__) {
17198
17199module.exports = __webpack_require__(508);
17200
17201
17202/***/ }),
17203/* 508 */
17204/***/ (function(module, exports, __webpack_require__) {
17205
17206var parent = __webpack_require__(509);
17207
17208module.exports = parent;
17209
17210
17211/***/ }),
17212/* 509 */
17213/***/ (function(module, exports, __webpack_require__) {
17214
17215var parent = __webpack_require__(240);
17216
17217module.exports = parent;
17218
17219
17220/***/ }),
17221/* 510 */
17222/***/ (function(module, exports, __webpack_require__) {
17223
17224module.exports = __webpack_require__(511);
17225
17226
17227/***/ }),
17228/* 511 */
17229/***/ (function(module, exports, __webpack_require__) {
17230
17231var parent = __webpack_require__(512);
17232
17233module.exports = parent;
17234
17235
17236/***/ }),
17237/* 512 */
17238/***/ (function(module, exports, __webpack_require__) {
17239
17240var parent = __webpack_require__(513);
17241
17242module.exports = parent;
17243
17244
17245/***/ }),
17246/* 513 */
17247/***/ (function(module, exports, __webpack_require__) {
17248
17249var parent = __webpack_require__(514);
17250
17251module.exports = parent;
17252
17253
17254/***/ }),
17255/* 514 */
17256/***/ (function(module, exports, __webpack_require__) {
17257
17258var isPrototypeOf = __webpack_require__(19);
17259var method = __webpack_require__(515);
17260
17261var FunctionPrototype = Function.prototype;
17262
17263module.exports = function (it) {
17264 var own = it.bind;
17265 return it === FunctionPrototype || (isPrototypeOf(FunctionPrototype, it) && own === FunctionPrototype.bind) ? method : own;
17266};
17267
17268
17269/***/ }),
17270/* 515 */
17271/***/ (function(module, exports, __webpack_require__) {
17272
17273__webpack_require__(516);
17274var entryVirtual = __webpack_require__(40);
17275
17276module.exports = entryVirtual('Function').bind;
17277
17278
17279/***/ }),
17280/* 516 */
17281/***/ (function(module, exports, __webpack_require__) {
17282
17283// TODO: Remove from `core-js@4`
17284var $ = __webpack_require__(0);
17285var bind = __webpack_require__(256);
17286
17287// `Function.prototype.bind` method
17288// https://tc39.es/ecma262/#sec-function.prototype.bind
17289$({ target: 'Function', proto: true, forced: Function.bind !== bind }, {
17290 bind: bind
17291});
17292
17293
17294/***/ }),
17295/* 517 */
17296/***/ (function(module, exports, __webpack_require__) {
17297
17298var _typeof = __webpack_require__(73)["default"];
17299
17300var assertThisInitialized = __webpack_require__(518);
17301
17302function _possibleConstructorReturn(self, call) {
17303 if (call && (_typeof(call) === "object" || typeof call === "function")) {
17304 return call;
17305 } else if (call !== void 0) {
17306 throw new TypeError("Derived constructors may only return object or undefined");
17307 }
17308
17309 return assertThisInitialized(self);
17310}
17311
17312module.exports = _possibleConstructorReturn, module.exports.__esModule = true, module.exports["default"] = module.exports;
17313
17314/***/ }),
17315/* 518 */
17316/***/ (function(module, exports) {
17317
17318function _assertThisInitialized(self) {
17319 if (self === void 0) {
17320 throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
17321 }
17322
17323 return self;
17324}
17325
17326module.exports = _assertThisInitialized, module.exports.__esModule = true, module.exports["default"] = module.exports;
17327
17328/***/ }),
17329/* 519 */
17330/***/ (function(module, exports, __webpack_require__) {
17331
17332var _Object$setPrototypeOf = __webpack_require__(257);
17333
17334var _bindInstanceProperty = __webpack_require__(258);
17335
17336var _Object$getPrototypeOf = __webpack_require__(520);
17337
17338function _getPrototypeOf(o) {
17339 var _context;
17340
17341 module.exports = _getPrototypeOf = _Object$setPrototypeOf ? _bindInstanceProperty(_context = _Object$getPrototypeOf).call(_context) : function _getPrototypeOf(o) {
17342 return o.__proto__ || _Object$getPrototypeOf(o);
17343 }, module.exports.__esModule = true, module.exports["default"] = module.exports;
17344 return _getPrototypeOf(o);
17345}
17346
17347module.exports = _getPrototypeOf, module.exports.__esModule = true, module.exports["default"] = module.exports;
17348
17349/***/ }),
17350/* 520 */
17351/***/ (function(module, exports, __webpack_require__) {
17352
17353module.exports = __webpack_require__(521);
17354
17355/***/ }),
17356/* 521 */
17357/***/ (function(module, exports, __webpack_require__) {
17358
17359module.exports = __webpack_require__(522);
17360
17361
17362/***/ }),
17363/* 522 */
17364/***/ (function(module, exports, __webpack_require__) {
17365
17366var parent = __webpack_require__(523);
17367
17368module.exports = parent;
17369
17370
17371/***/ }),
17372/* 523 */
17373/***/ (function(module, exports, __webpack_require__) {
17374
17375var parent = __webpack_require__(234);
17376
17377module.exports = parent;
17378
17379
17380/***/ }),
17381/* 524 */
17382/***/ (function(module, exports) {
17383
17384function _classCallCheck(instance, Constructor) {
17385 if (!(instance instanceof Constructor)) {
17386 throw new TypeError("Cannot call a class as a function");
17387 }
17388}
17389
17390module.exports = _classCallCheck, module.exports.__esModule = true, module.exports["default"] = module.exports;
17391
17392/***/ }),
17393/* 525 */
17394/***/ (function(module, exports, __webpack_require__) {
17395
17396var _Object$defineProperty = __webpack_require__(151);
17397
17398function _defineProperties(target, props) {
17399 for (var i = 0; i < props.length; i++) {
17400 var descriptor = props[i];
17401 descriptor.enumerable = descriptor.enumerable || false;
17402 descriptor.configurable = true;
17403 if ("value" in descriptor) descriptor.writable = true;
17404
17405 _Object$defineProperty(target, descriptor.key, descriptor);
17406 }
17407}
17408
17409function _createClass(Constructor, protoProps, staticProps) {
17410 if (protoProps) _defineProperties(Constructor.prototype, protoProps);
17411 if (staticProps) _defineProperties(Constructor, staticProps);
17412
17413 _Object$defineProperty(Constructor, "prototype", {
17414 writable: false
17415 });
17416
17417 return Constructor;
17418}
17419
17420module.exports = _createClass, module.exports.__esModule = true, module.exports["default"] = module.exports;
17421
17422/***/ }),
17423/* 526 */
17424/***/ (function(module, exports, __webpack_require__) {
17425
17426"use strict";
17427
17428
17429var _interopRequireDefault = __webpack_require__(1);
17430
17431var _slice = _interopRequireDefault(__webpack_require__(61));
17432
17433// base64 character set, plus padding character (=)
17434var b64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
17435
17436module.exports = function (string) {
17437 var result = '';
17438
17439 for (var i = 0; i < string.length;) {
17440 var a = string.charCodeAt(i++);
17441 var b = string.charCodeAt(i++);
17442 var c = string.charCodeAt(i++);
17443
17444 if (a > 255 || b > 255 || c > 255) {
17445 throw new TypeError('Failed to encode base64: The string to be encoded contains characters outside of the Latin1 range.');
17446 }
17447
17448 var bitmap = a << 16 | b << 8 | c;
17449 result += b64.charAt(bitmap >> 18 & 63) + b64.charAt(bitmap >> 12 & 63) + b64.charAt(bitmap >> 6 & 63) + b64.charAt(bitmap & 63);
17450 } // To determine the final padding
17451
17452
17453 var rest = string.length % 3; // If there's need of padding, replace the last 'A's with equal signs
17454
17455 return rest ? (0, _slice.default)(result).call(result, 0, rest - 3) + '==='.substring(rest) : result;
17456};
17457
17458/***/ }),
17459/* 527 */
17460/***/ (function(module, exports, __webpack_require__) {
17461
17462"use strict";
17463
17464
17465var _ = __webpack_require__(3);
17466
17467var ajax = __webpack_require__(116);
17468
17469module.exports = function upload(uploadInfo, data, file) {
17470 var saveOptions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
17471 return ajax({
17472 url: uploadInfo.upload_url,
17473 method: 'PUT',
17474 data: data,
17475 headers: _.extend({
17476 'Content-Type': file.get('mime_type'),
17477 'Cache-Control': 'public, max-age=31536000'
17478 }, file._uploadHeaders),
17479 onprogress: saveOptions.onprogress
17480 }).then(function () {
17481 file.attributes.url = uploadInfo.url;
17482 file._bucket = uploadInfo.bucket;
17483 file.id = uploadInfo.objectId;
17484 return file;
17485 });
17486};
17487
17488/***/ }),
17489/* 528 */
17490/***/ (function(module, exports, __webpack_require__) {
17491
17492(function(){
17493 var crypt = __webpack_require__(529),
17494 utf8 = __webpack_require__(259).utf8,
17495 isBuffer = __webpack_require__(530),
17496 bin = __webpack_require__(259).bin,
17497
17498 // The core
17499 md5 = function (message, options) {
17500 // Convert to byte array
17501 if (message.constructor == String)
17502 if (options && options.encoding === 'binary')
17503 message = bin.stringToBytes(message);
17504 else
17505 message = utf8.stringToBytes(message);
17506 else if (isBuffer(message))
17507 message = Array.prototype.slice.call(message, 0);
17508 else if (!Array.isArray(message))
17509 message = message.toString();
17510 // else, assume byte array already
17511
17512 var m = crypt.bytesToWords(message),
17513 l = message.length * 8,
17514 a = 1732584193,
17515 b = -271733879,
17516 c = -1732584194,
17517 d = 271733878;
17518
17519 // Swap endian
17520 for (var i = 0; i < m.length; i++) {
17521 m[i] = ((m[i] << 8) | (m[i] >>> 24)) & 0x00FF00FF |
17522 ((m[i] << 24) | (m[i] >>> 8)) & 0xFF00FF00;
17523 }
17524
17525 // Padding
17526 m[l >>> 5] |= 0x80 << (l % 32);
17527 m[(((l + 64) >>> 9) << 4) + 14] = l;
17528
17529 // Method shortcuts
17530 var FF = md5._ff,
17531 GG = md5._gg,
17532 HH = md5._hh,
17533 II = md5._ii;
17534
17535 for (var i = 0; i < m.length; i += 16) {
17536
17537 var aa = a,
17538 bb = b,
17539 cc = c,
17540 dd = d;
17541
17542 a = FF(a, b, c, d, m[i+ 0], 7, -680876936);
17543 d = FF(d, a, b, c, m[i+ 1], 12, -389564586);
17544 c = FF(c, d, a, b, m[i+ 2], 17, 606105819);
17545 b = FF(b, c, d, a, m[i+ 3], 22, -1044525330);
17546 a = FF(a, b, c, d, m[i+ 4], 7, -176418897);
17547 d = FF(d, a, b, c, m[i+ 5], 12, 1200080426);
17548 c = FF(c, d, a, b, m[i+ 6], 17, -1473231341);
17549 b = FF(b, c, d, a, m[i+ 7], 22, -45705983);
17550 a = FF(a, b, c, d, m[i+ 8], 7, 1770035416);
17551 d = FF(d, a, b, c, m[i+ 9], 12, -1958414417);
17552 c = FF(c, d, a, b, m[i+10], 17, -42063);
17553 b = FF(b, c, d, a, m[i+11], 22, -1990404162);
17554 a = FF(a, b, c, d, m[i+12], 7, 1804603682);
17555 d = FF(d, a, b, c, m[i+13], 12, -40341101);
17556 c = FF(c, d, a, b, m[i+14], 17, -1502002290);
17557 b = FF(b, c, d, a, m[i+15], 22, 1236535329);
17558
17559 a = GG(a, b, c, d, m[i+ 1], 5, -165796510);
17560 d = GG(d, a, b, c, m[i+ 6], 9, -1069501632);
17561 c = GG(c, d, a, b, m[i+11], 14, 643717713);
17562 b = GG(b, c, d, a, m[i+ 0], 20, -373897302);
17563 a = GG(a, b, c, d, m[i+ 5], 5, -701558691);
17564 d = GG(d, a, b, c, m[i+10], 9, 38016083);
17565 c = GG(c, d, a, b, m[i+15], 14, -660478335);
17566 b = GG(b, c, d, a, m[i+ 4], 20, -405537848);
17567 a = GG(a, b, c, d, m[i+ 9], 5, 568446438);
17568 d = GG(d, a, b, c, m[i+14], 9, -1019803690);
17569 c = GG(c, d, a, b, m[i+ 3], 14, -187363961);
17570 b = GG(b, c, d, a, m[i+ 8], 20, 1163531501);
17571 a = GG(a, b, c, d, m[i+13], 5, -1444681467);
17572 d = GG(d, a, b, c, m[i+ 2], 9, -51403784);
17573 c = GG(c, d, a, b, m[i+ 7], 14, 1735328473);
17574 b = GG(b, c, d, a, m[i+12], 20, -1926607734);
17575
17576 a = HH(a, b, c, d, m[i+ 5], 4, -378558);
17577 d = HH(d, a, b, c, m[i+ 8], 11, -2022574463);
17578 c = HH(c, d, a, b, m[i+11], 16, 1839030562);
17579 b = HH(b, c, d, a, m[i+14], 23, -35309556);
17580 a = HH(a, b, c, d, m[i+ 1], 4, -1530992060);
17581 d = HH(d, a, b, c, m[i+ 4], 11, 1272893353);
17582 c = HH(c, d, a, b, m[i+ 7], 16, -155497632);
17583 b = HH(b, c, d, a, m[i+10], 23, -1094730640);
17584 a = HH(a, b, c, d, m[i+13], 4, 681279174);
17585 d = HH(d, a, b, c, m[i+ 0], 11, -358537222);
17586 c = HH(c, d, a, b, m[i+ 3], 16, -722521979);
17587 b = HH(b, c, d, a, m[i+ 6], 23, 76029189);
17588 a = HH(a, b, c, d, m[i+ 9], 4, -640364487);
17589 d = HH(d, a, b, c, m[i+12], 11, -421815835);
17590 c = HH(c, d, a, b, m[i+15], 16, 530742520);
17591 b = HH(b, c, d, a, m[i+ 2], 23, -995338651);
17592
17593 a = II(a, b, c, d, m[i+ 0], 6, -198630844);
17594 d = II(d, a, b, c, m[i+ 7], 10, 1126891415);
17595 c = II(c, d, a, b, m[i+14], 15, -1416354905);
17596 b = II(b, c, d, a, m[i+ 5], 21, -57434055);
17597 a = II(a, b, c, d, m[i+12], 6, 1700485571);
17598 d = II(d, a, b, c, m[i+ 3], 10, -1894986606);
17599 c = II(c, d, a, b, m[i+10], 15, -1051523);
17600 b = II(b, c, d, a, m[i+ 1], 21, -2054922799);
17601 a = II(a, b, c, d, m[i+ 8], 6, 1873313359);
17602 d = II(d, a, b, c, m[i+15], 10, -30611744);
17603 c = II(c, d, a, b, m[i+ 6], 15, -1560198380);
17604 b = II(b, c, d, a, m[i+13], 21, 1309151649);
17605 a = II(a, b, c, d, m[i+ 4], 6, -145523070);
17606 d = II(d, a, b, c, m[i+11], 10, -1120210379);
17607 c = II(c, d, a, b, m[i+ 2], 15, 718787259);
17608 b = II(b, c, d, a, m[i+ 9], 21, -343485551);
17609
17610 a = (a + aa) >>> 0;
17611 b = (b + bb) >>> 0;
17612 c = (c + cc) >>> 0;
17613 d = (d + dd) >>> 0;
17614 }
17615
17616 return crypt.endian([a, b, c, d]);
17617 };
17618
17619 // Auxiliary functions
17620 md5._ff = function (a, b, c, d, x, s, t) {
17621 var n = a + (b & c | ~b & d) + (x >>> 0) + t;
17622 return ((n << s) | (n >>> (32 - s))) + b;
17623 };
17624 md5._gg = function (a, b, c, d, x, s, t) {
17625 var n = a + (b & d | c & ~d) + (x >>> 0) + t;
17626 return ((n << s) | (n >>> (32 - s))) + b;
17627 };
17628 md5._hh = function (a, b, c, d, x, s, t) {
17629 var n = a + (b ^ c ^ d) + (x >>> 0) + t;
17630 return ((n << s) | (n >>> (32 - s))) + b;
17631 };
17632 md5._ii = function (a, b, c, d, x, s, t) {
17633 var n = a + (c ^ (b | ~d)) + (x >>> 0) + t;
17634 return ((n << s) | (n >>> (32 - s))) + b;
17635 };
17636
17637 // Package private blocksize
17638 md5._blocksize = 16;
17639 md5._digestsize = 16;
17640
17641 module.exports = function (message, options) {
17642 if (message === undefined || message === null)
17643 throw new Error('Illegal argument ' + message);
17644
17645 var digestbytes = crypt.wordsToBytes(md5(message, options));
17646 return options && options.asBytes ? digestbytes :
17647 options && options.asString ? bin.bytesToString(digestbytes) :
17648 crypt.bytesToHex(digestbytes);
17649 };
17650
17651})();
17652
17653
17654/***/ }),
17655/* 529 */
17656/***/ (function(module, exports) {
17657
17658(function() {
17659 var base64map
17660 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/',
17661
17662 crypt = {
17663 // Bit-wise rotation left
17664 rotl: function(n, b) {
17665 return (n << b) | (n >>> (32 - b));
17666 },
17667
17668 // Bit-wise rotation right
17669 rotr: function(n, b) {
17670 return (n << (32 - b)) | (n >>> b);
17671 },
17672
17673 // Swap big-endian to little-endian and vice versa
17674 endian: function(n) {
17675 // If number given, swap endian
17676 if (n.constructor == Number) {
17677 return crypt.rotl(n, 8) & 0x00FF00FF | crypt.rotl(n, 24) & 0xFF00FF00;
17678 }
17679
17680 // Else, assume array and swap all items
17681 for (var i = 0; i < n.length; i++)
17682 n[i] = crypt.endian(n[i]);
17683 return n;
17684 },
17685
17686 // Generate an array of any length of random bytes
17687 randomBytes: function(n) {
17688 for (var bytes = []; n > 0; n--)
17689 bytes.push(Math.floor(Math.random() * 256));
17690 return bytes;
17691 },
17692
17693 // Convert a byte array to big-endian 32-bit words
17694 bytesToWords: function(bytes) {
17695 for (var words = [], i = 0, b = 0; i < bytes.length; i++, b += 8)
17696 words[b >>> 5] |= bytes[i] << (24 - b % 32);
17697 return words;
17698 },
17699
17700 // Convert big-endian 32-bit words to a byte array
17701 wordsToBytes: function(words) {
17702 for (var bytes = [], b = 0; b < words.length * 32; b += 8)
17703 bytes.push((words[b >>> 5] >>> (24 - b % 32)) & 0xFF);
17704 return bytes;
17705 },
17706
17707 // Convert a byte array to a hex string
17708 bytesToHex: function(bytes) {
17709 for (var hex = [], i = 0; i < bytes.length; i++) {
17710 hex.push((bytes[i] >>> 4).toString(16));
17711 hex.push((bytes[i] & 0xF).toString(16));
17712 }
17713 return hex.join('');
17714 },
17715
17716 // Convert a hex string to a byte array
17717 hexToBytes: function(hex) {
17718 for (var bytes = [], c = 0; c < hex.length; c += 2)
17719 bytes.push(parseInt(hex.substr(c, 2), 16));
17720 return bytes;
17721 },
17722
17723 // Convert a byte array to a base-64 string
17724 bytesToBase64: function(bytes) {
17725 for (var base64 = [], i = 0; i < bytes.length; i += 3) {
17726 var triplet = (bytes[i] << 16) | (bytes[i + 1] << 8) | bytes[i + 2];
17727 for (var j = 0; j < 4; j++)
17728 if (i * 8 + j * 6 <= bytes.length * 8)
17729 base64.push(base64map.charAt((triplet >>> 6 * (3 - j)) & 0x3F));
17730 else
17731 base64.push('=');
17732 }
17733 return base64.join('');
17734 },
17735
17736 // Convert a base-64 string to a byte array
17737 base64ToBytes: function(base64) {
17738 // Remove non-base-64 characters
17739 base64 = base64.replace(/[^A-Z0-9+\/]/ig, '');
17740
17741 for (var bytes = [], i = 0, imod4 = 0; i < base64.length;
17742 imod4 = ++i % 4) {
17743 if (imod4 == 0) continue;
17744 bytes.push(((base64map.indexOf(base64.charAt(i - 1))
17745 & (Math.pow(2, -2 * imod4 + 8) - 1)) << (imod4 * 2))
17746 | (base64map.indexOf(base64.charAt(i)) >>> (6 - imod4 * 2)));
17747 }
17748 return bytes;
17749 }
17750 };
17751
17752 module.exports = crypt;
17753})();
17754
17755
17756/***/ }),
17757/* 530 */
17758/***/ (function(module, exports) {
17759
17760/*!
17761 * Determine if an object is a Buffer
17762 *
17763 * @author Feross Aboukhadijeh <https://feross.org>
17764 * @license MIT
17765 */
17766
17767// The _isBuffer check is for Safari 5-7 support, because it's missing
17768// Object.prototype.constructor. Remove this eventually
17769module.exports = function (obj) {
17770 return obj != null && (isBuffer(obj) || isSlowBuffer(obj) || !!obj._isBuffer)
17771}
17772
17773function isBuffer (obj) {
17774 return !!obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj)
17775}
17776
17777// For Node v0.10 support. Remove this eventually.
17778function isSlowBuffer (obj) {
17779 return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isBuffer(obj.slice(0, 0))
17780}
17781
17782
17783/***/ }),
17784/* 531 */
17785/***/ (function(module, exports, __webpack_require__) {
17786
17787"use strict";
17788
17789
17790var _interopRequireDefault = __webpack_require__(1);
17791
17792var _indexOf = _interopRequireDefault(__webpack_require__(71));
17793
17794var dataURItoBlob = function dataURItoBlob(dataURI, type) {
17795 var _context;
17796
17797 var byteString; // 传入的 base64,不是 dataURL
17798
17799 if ((0, _indexOf.default)(dataURI).call(dataURI, 'base64') < 0) {
17800 byteString = atob(dataURI);
17801 } else if ((0, _indexOf.default)(_context = dataURI.split(',')[0]).call(_context, 'base64') >= 0) {
17802 type = type || dataURI.split(',')[0].split(':')[1].split(';')[0];
17803 byteString = atob(dataURI.split(',')[1]);
17804 } else {
17805 byteString = unescape(dataURI.split(',')[1]);
17806 }
17807
17808 var ia = new Uint8Array(byteString.length);
17809
17810 for (var i = 0; i < byteString.length; i++) {
17811 ia[i] = byteString.charCodeAt(i);
17812 }
17813
17814 return new Blob([ia], {
17815 type: type
17816 });
17817};
17818
17819module.exports = dataURItoBlob;
17820
17821/***/ }),
17822/* 532 */
17823/***/ (function(module, exports, __webpack_require__) {
17824
17825"use strict";
17826
17827
17828var _interopRequireDefault = __webpack_require__(1);
17829
17830var _slicedToArray2 = _interopRequireDefault(__webpack_require__(533));
17831
17832var _map = _interopRequireDefault(__webpack_require__(35));
17833
17834var _indexOf = _interopRequireDefault(__webpack_require__(71));
17835
17836var _find = _interopRequireDefault(__webpack_require__(93));
17837
17838var _promise = _interopRequireDefault(__webpack_require__(12));
17839
17840var _concat = _interopRequireDefault(__webpack_require__(22));
17841
17842var _keys2 = _interopRequireDefault(__webpack_require__(59));
17843
17844var _stringify = _interopRequireDefault(__webpack_require__(36));
17845
17846var _defineProperty = _interopRequireDefault(__webpack_require__(92));
17847
17848var _getOwnPropertyDescriptor = _interopRequireDefault(__webpack_require__(152));
17849
17850var _ = __webpack_require__(3);
17851
17852var AVError = __webpack_require__(46);
17853
17854var _require = __webpack_require__(27),
17855 _request = _require._request;
17856
17857var _require2 = __webpack_require__(30),
17858 isNullOrUndefined = _require2.isNullOrUndefined,
17859 ensureArray = _require2.ensureArray,
17860 transformFetchOptions = _require2.transformFetchOptions,
17861 setValue = _require2.setValue,
17862 findValue = _require2.findValue,
17863 isPlainObject = _require2.isPlainObject,
17864 continueWhile = _require2.continueWhile;
17865
17866var recursiveToPointer = function recursiveToPointer(value) {
17867 if (_.isArray(value)) return (0, _map.default)(value).call(value, recursiveToPointer);
17868 if (isPlainObject(value)) return _.mapObject(value, recursiveToPointer);
17869 if (_.isObject(value) && value._toPointer) return value._toPointer();
17870 return value;
17871};
17872
17873var RESERVED_KEYS = ['objectId', 'createdAt', 'updatedAt'];
17874
17875var checkReservedKey = function checkReservedKey(key) {
17876 if ((0, _indexOf.default)(RESERVED_KEYS).call(RESERVED_KEYS, key) !== -1) {
17877 throw new Error("key[".concat(key, "] is reserved"));
17878 }
17879};
17880
17881var handleBatchResults = function handleBatchResults(results) {
17882 var firstError = (0, _find.default)(_).call(_, results, function (result) {
17883 return result instanceof Error;
17884 });
17885
17886 if (!firstError) {
17887 return results;
17888 }
17889
17890 var error = new AVError(firstError.code, firstError.message);
17891 error.results = results;
17892 throw error;
17893}; // Helper function to get a value from a Backbone object as a property
17894// or as a function.
17895
17896
17897function getValue(object, prop) {
17898 if (!(object && object[prop])) {
17899 return null;
17900 }
17901
17902 return _.isFunction(object[prop]) ? object[prop]() : object[prop];
17903} // AV.Object is analogous to the Java AVObject.
17904// It also implements the same interface as a Backbone model.
17905
17906
17907module.exports = function (AV) {
17908 /**
17909 * Creates a new model with defined attributes. A client id (cid) is
17910 * automatically generated and assigned for you.
17911 *
17912 * <p>You won't normally call this method directly. It is recommended that
17913 * you use a subclass of <code>AV.Object</code> instead, created by calling
17914 * <code>extend</code>.</p>
17915 *
17916 * <p>However, if you don't want to use a subclass, or aren't sure which
17917 * subclass is appropriate, you can use this form:<pre>
17918 * var object = new AV.Object("ClassName");
17919 * </pre>
17920 * That is basically equivalent to:<pre>
17921 * var MyClass = AV.Object.extend("ClassName");
17922 * var object = new MyClass();
17923 * </pre></p>
17924 *
17925 * @param {Object} attributes The initial set of data to store in the object.
17926 * @param {Object} options A set of Backbone-like options for creating the
17927 * object. The only option currently supported is "collection".
17928 * @see AV.Object.extend
17929 *
17930 * @class
17931 *
17932 * <p>The fundamental unit of AV data, which implements the Backbone Model
17933 * interface.</p>
17934 */
17935 AV.Object = function (attributes, options) {
17936 // Allow new AV.Object("ClassName") as a shortcut to _create.
17937 if (_.isString(attributes)) {
17938 return AV.Object._create.apply(this, arguments);
17939 }
17940
17941 attributes = attributes || {};
17942
17943 if (options && options.parse) {
17944 attributes = this.parse(attributes);
17945 attributes = this._mergeMagicFields(attributes);
17946 }
17947
17948 var defaults = getValue(this, 'defaults');
17949
17950 if (defaults) {
17951 attributes = _.extend({}, defaults, attributes);
17952 }
17953
17954 if (options && options.collection) {
17955 this.collection = options.collection;
17956 }
17957
17958 this._serverData = {}; // The last known data for this object from cloud.
17959
17960 this._opSetQueue = [{}]; // List of sets of changes to the data.
17961
17962 this._flags = {};
17963 this.attributes = {}; // The best estimate of this's current data.
17964
17965 this._hashedJSON = {}; // Hash of values of containers at last save.
17966
17967 this._escapedAttributes = {};
17968 this.cid = _.uniqueId('c');
17969 this.changed = {};
17970 this._silent = {};
17971 this._pending = {};
17972 this.set(attributes, {
17973 silent: true
17974 });
17975 this.changed = {};
17976 this._silent = {};
17977 this._pending = {};
17978 this._hasData = true;
17979 this._previousAttributes = _.clone(this.attributes);
17980 this.initialize.apply(this, arguments);
17981 };
17982 /**
17983 * @lends AV.Object.prototype
17984 * @property {String} id The objectId of the AV Object.
17985 */
17986
17987 /**
17988 * Saves the given list of AV.Object.
17989 * If any error is encountered, stops and calls the error handler.
17990 *
17991 * @example
17992 * AV.Object.saveAll([object1, object2, ...]).then(function(list) {
17993 * // All the objects were saved.
17994 * }, function(error) {
17995 * // An error occurred while saving one of the objects.
17996 * });
17997 *
17998 * @param {Array} list A list of <code>AV.Object</code>.
17999 */
18000
18001
18002 AV.Object.saveAll = function (list, options) {
18003 return AV.Object._deepSaveAsync(list, null, options);
18004 };
18005 /**
18006 * Fetch the given list of AV.Object.
18007 *
18008 * @param {AV.Object[]} objects A list of <code>AV.Object</code>
18009 * @param {AuthOptions} options
18010 * @return {Promise.<AV.Object[]>} The given list of <code>AV.Object</code>, updated
18011 */
18012
18013
18014 AV.Object.fetchAll = function (objects, options) {
18015 return _promise.default.resolve().then(function () {
18016 return _request('batch', null, null, 'POST', {
18017 requests: (0, _map.default)(_).call(_, objects, function (object) {
18018 var _context;
18019
18020 if (!object.className) throw new Error('object must have className to fetch');
18021 if (!object.id) throw new Error('object must have id to fetch');
18022 if (object.dirty()) throw new Error('object is modified but not saved');
18023 return {
18024 method: 'GET',
18025 path: (0, _concat.default)(_context = "/1.1/classes/".concat(object.className, "/")).call(_context, object.id)
18026 };
18027 })
18028 }, options);
18029 }).then(function (response) {
18030 var results = (0, _map.default)(_).call(_, objects, function (object, i) {
18031 if (response[i].success) {
18032 var fetchedAttrs = object.parse(response[i].success);
18033
18034 object._cleanupUnsetKeys(fetchedAttrs);
18035
18036 object._finishFetch(fetchedAttrs);
18037
18038 return object;
18039 }
18040
18041 if (response[i].success === null) {
18042 return new AVError(AVError.OBJECT_NOT_FOUND, 'Object not found.');
18043 }
18044
18045 return new AVError(response[i].error.code, response[i].error.error);
18046 });
18047 return handleBatchResults(results);
18048 });
18049 }; // Attach all inheritable methods to the AV.Object prototype.
18050
18051
18052 _.extend(AV.Object.prototype, AV.Events,
18053 /** @lends AV.Object.prototype */
18054 {
18055 _fetchWhenSave: false,
18056
18057 /**
18058 * Initialize is an empty function by default. Override it with your own
18059 * initialization logic.
18060 */
18061 initialize: function initialize() {},
18062
18063 /**
18064 * Set whether to enable fetchWhenSave option when updating object.
18065 * When set true, SDK would fetch the latest object after saving.
18066 * Default is false.
18067 *
18068 * @deprecated use AV.Object#save with options.fetchWhenSave instead
18069 * @param {boolean} enable true to enable fetchWhenSave option.
18070 */
18071 fetchWhenSave: function fetchWhenSave(enable) {
18072 console.warn('AV.Object#fetchWhenSave is deprecated, use AV.Object#save with options.fetchWhenSave instead.');
18073
18074 if (!_.isBoolean(enable)) {
18075 throw new Error('Expect boolean value for fetchWhenSave');
18076 }
18077
18078 this._fetchWhenSave = enable;
18079 },
18080
18081 /**
18082 * Returns the object's objectId.
18083 * @return {String} the objectId.
18084 */
18085 getObjectId: function getObjectId() {
18086 return this.id;
18087 },
18088
18089 /**
18090 * Returns the object's createdAt attribute.
18091 * @return {Date}
18092 */
18093 getCreatedAt: function getCreatedAt() {
18094 return this.createdAt;
18095 },
18096
18097 /**
18098 * Returns the object's updatedAt attribute.
18099 * @return {Date}
18100 */
18101 getUpdatedAt: function getUpdatedAt() {
18102 return this.updatedAt;
18103 },
18104
18105 /**
18106 * Returns a JSON version of the object.
18107 * @return {Object}
18108 */
18109 toJSON: function toJSON(key, holder) {
18110 var seenObjects = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
18111 return this._toFullJSON(seenObjects, false);
18112 },
18113
18114 /**
18115 * Returns a JSON version of the object with meta data.
18116 * Inverse to {@link AV.parseJSON}
18117 * @since 3.0.0
18118 * @return {Object}
18119 */
18120 toFullJSON: function toFullJSON() {
18121 var seenObjects = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
18122 return this._toFullJSON(seenObjects);
18123 },
18124 _toFullJSON: function _toFullJSON(seenObjects) {
18125 var _this = this;
18126
18127 var full = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
18128
18129 var json = _.clone(this.attributes);
18130
18131 if (_.isArray(seenObjects)) {
18132 var newSeenObjects = (0, _concat.default)(seenObjects).call(seenObjects, this);
18133 }
18134
18135 AV._objectEach(json, function (val, key) {
18136 json[key] = AV._encode(val, newSeenObjects, undefined, full);
18137 });
18138
18139 AV._objectEach(this._operations, function (val, key) {
18140 json[key] = val;
18141 });
18142
18143 if (_.has(this, 'id')) {
18144 json.objectId = this.id;
18145 }
18146
18147 ['createdAt', 'updatedAt'].forEach(function (key) {
18148 if (_.has(_this, key)) {
18149 var val = _this[key];
18150 json[key] = _.isDate(val) ? val.toJSON() : val;
18151 }
18152 });
18153
18154 if (full) {
18155 json.__type = 'Object';
18156 if (_.isArray(seenObjects) && seenObjects.length) json.__type = 'Pointer';
18157 json.className = this.className;
18158 }
18159
18160 return json;
18161 },
18162
18163 /**
18164 * Updates _hashedJSON to reflect the current state of this object.
18165 * Adds any changed hash values to the set of pending changes.
18166 * @private
18167 */
18168 _refreshCache: function _refreshCache() {
18169 var self = this;
18170
18171 if (self._refreshingCache) {
18172 return;
18173 }
18174
18175 self._refreshingCache = true;
18176
18177 AV._objectEach(this.attributes, function (value, key) {
18178 if (value instanceof AV.Object) {
18179 value._refreshCache();
18180 } else if (_.isObject(value)) {
18181 if (self._resetCacheForKey(key)) {
18182 self.set(key, new AV.Op.Set(value), {
18183 silent: true
18184 });
18185 }
18186 }
18187 });
18188
18189 delete self._refreshingCache;
18190 },
18191
18192 /**
18193 * Returns true if this object has been modified since its last
18194 * save/refresh. If an attribute is specified, it returns true only if that
18195 * particular attribute has been modified since the last save/refresh.
18196 * @param {String} attr An attribute name (optional).
18197 * @return {Boolean}
18198 */
18199 dirty: function dirty(attr) {
18200 this._refreshCache();
18201
18202 var currentChanges = _.last(this._opSetQueue);
18203
18204 if (attr) {
18205 return currentChanges[attr] ? true : false;
18206 }
18207
18208 if (!this.id) {
18209 return true;
18210 }
18211
18212 if ((0, _keys2.default)(_).call(_, currentChanges).length > 0) {
18213 return true;
18214 }
18215
18216 return false;
18217 },
18218
18219 /**
18220 * Returns the keys of the modified attribute since its last save/refresh.
18221 * @return {String[]}
18222 */
18223 dirtyKeys: function dirtyKeys() {
18224 this._refreshCache();
18225
18226 var currentChanges = _.last(this._opSetQueue);
18227
18228 return (0, _keys2.default)(_).call(_, currentChanges);
18229 },
18230
18231 /**
18232 * Gets a Pointer referencing this Object.
18233 * @private
18234 */
18235 _toPointer: function _toPointer() {
18236 // if (!this.id) {
18237 // throw new Error("Can't serialize an unsaved AV.Object");
18238 // }
18239 return {
18240 __type: 'Pointer',
18241 className: this.className,
18242 objectId: this.id
18243 };
18244 },
18245
18246 /**
18247 * Gets the value of an attribute.
18248 * @param {String} attr The string name of an attribute.
18249 */
18250 get: function get(attr) {
18251 switch (attr) {
18252 case 'objectId':
18253 return this.id;
18254
18255 case 'createdAt':
18256 case 'updatedAt':
18257 return this[attr];
18258
18259 default:
18260 return this.attributes[attr];
18261 }
18262 },
18263
18264 /**
18265 * Gets a relation on the given class for the attribute.
18266 * @param {String} attr The attribute to get the relation for.
18267 * @return {AV.Relation}
18268 */
18269 relation: function relation(attr) {
18270 var value = this.get(attr);
18271
18272 if (value) {
18273 if (!(value instanceof AV.Relation)) {
18274 throw new Error('Called relation() on non-relation field ' + attr);
18275 }
18276
18277 value._ensureParentAndKey(this, attr);
18278
18279 return value;
18280 } else {
18281 return new AV.Relation(this, attr);
18282 }
18283 },
18284
18285 /**
18286 * Gets the HTML-escaped value of an attribute.
18287 */
18288 escape: function escape(attr) {
18289 var html = this._escapedAttributes[attr];
18290
18291 if (html) {
18292 return html;
18293 }
18294
18295 var val = this.attributes[attr];
18296 var escaped;
18297
18298 if (isNullOrUndefined(val)) {
18299 escaped = '';
18300 } else {
18301 escaped = _.escape(val.toString());
18302 }
18303
18304 this._escapedAttributes[attr] = escaped;
18305 return escaped;
18306 },
18307
18308 /**
18309 * Returns <code>true</code> if the attribute contains a value that is not
18310 * null or undefined.
18311 * @param {String} attr The string name of the attribute.
18312 * @return {Boolean}
18313 */
18314 has: function has(attr) {
18315 return !isNullOrUndefined(this.attributes[attr]);
18316 },
18317
18318 /**
18319 * Pulls "special" fields like objectId, createdAt, etc. out of attrs
18320 * and puts them on "this" directly. Removes them from attrs.
18321 * @param attrs - A dictionary with the data for this AV.Object.
18322 * @private
18323 */
18324 _mergeMagicFields: function _mergeMagicFields(attrs) {
18325 // Check for changes of magic fields.
18326 var model = this;
18327 var specialFields = ['objectId', 'createdAt', 'updatedAt'];
18328
18329 AV._arrayEach(specialFields, function (attr) {
18330 if (attrs[attr]) {
18331 if (attr === 'objectId') {
18332 model.id = attrs[attr];
18333 } else if ((attr === 'createdAt' || attr === 'updatedAt') && !_.isDate(attrs[attr])) {
18334 model[attr] = AV._parseDate(attrs[attr]);
18335 } else {
18336 model[attr] = attrs[attr];
18337 }
18338
18339 delete attrs[attr];
18340 }
18341 });
18342
18343 return attrs;
18344 },
18345
18346 /**
18347 * Returns the json to be sent to the server.
18348 * @private
18349 */
18350 _startSave: function _startSave() {
18351 this._opSetQueue.push({});
18352 },
18353
18354 /**
18355 * Called when a save fails because of an error. Any changes that were part
18356 * of the save need to be merged with changes made after the save. This
18357 * might throw an exception is you do conflicting operations. For example,
18358 * if you do:
18359 * object.set("foo", "bar");
18360 * object.set("invalid field name", "baz");
18361 * object.save();
18362 * object.increment("foo");
18363 * then this will throw when the save fails and the client tries to merge
18364 * "bar" with the +1.
18365 * @private
18366 */
18367 _cancelSave: function _cancelSave() {
18368 var failedChanges = _.first(this._opSetQueue);
18369
18370 this._opSetQueue = _.rest(this._opSetQueue);
18371
18372 var nextChanges = _.first(this._opSetQueue);
18373
18374 AV._objectEach(failedChanges, function (op, key) {
18375 var op1 = failedChanges[key];
18376 var op2 = nextChanges[key];
18377
18378 if (op1 && op2) {
18379 nextChanges[key] = op2._mergeWithPrevious(op1);
18380 } else if (op1) {
18381 nextChanges[key] = op1;
18382 }
18383 });
18384
18385 this._saving = this._saving - 1;
18386 },
18387
18388 /**
18389 * Called when a save completes successfully. This merges the changes that
18390 * were saved into the known server data, and overrides it with any data
18391 * sent directly from the server.
18392 * @private
18393 */
18394 _finishSave: function _finishSave(serverData) {
18395 var _context2;
18396
18397 // Grab a copy of any object referenced by this object. These instances
18398 // may have already been fetched, and we don't want to lose their data.
18399 // Note that doing it like this means we will unify separate copies of the
18400 // same object, but that's a risk we have to take.
18401 var fetchedObjects = {};
18402
18403 AV._traverse(this.attributes, function (object) {
18404 if (object instanceof AV.Object && object.id && object._hasData) {
18405 fetchedObjects[object.id] = object;
18406 }
18407 });
18408
18409 var savedChanges = _.first(this._opSetQueue);
18410
18411 this._opSetQueue = _.rest(this._opSetQueue);
18412
18413 this._applyOpSet(savedChanges, this._serverData);
18414
18415 this._mergeMagicFields(serverData);
18416
18417 var self = this;
18418
18419 AV._objectEach(serverData, function (value, key) {
18420 self._serverData[key] = AV._decode(value, key); // Look for any objects that might have become unfetched and fix them
18421 // by replacing their values with the previously observed values.
18422
18423 var fetched = AV._traverse(self._serverData[key], function (object) {
18424 if (object instanceof AV.Object && fetchedObjects[object.id]) {
18425 return fetchedObjects[object.id];
18426 }
18427 });
18428
18429 if (fetched) {
18430 self._serverData[key] = fetched;
18431 }
18432 });
18433
18434 this._rebuildAllEstimatedData();
18435
18436 var opSetQueue = (0, _map.default)(_context2 = this._opSetQueue).call(_context2, _.clone);
18437
18438 this._refreshCache();
18439
18440 this._opSetQueue = opSetQueue;
18441 this._saving = this._saving - 1;
18442 },
18443
18444 /**
18445 * Called when a fetch or login is complete to set the known server data to
18446 * the given object.
18447 * @private
18448 */
18449 _finishFetch: function _finishFetch(serverData, hasData) {
18450 // Clear out any changes the user might have made previously.
18451 this._opSetQueue = [{}]; // Bring in all the new server data.
18452
18453 this._mergeMagicFields(serverData);
18454
18455 var self = this;
18456
18457 AV._objectEach(serverData, function (value, key) {
18458 self._serverData[key] = AV._decode(value, key);
18459 }); // Refresh the attributes.
18460
18461
18462 this._rebuildAllEstimatedData(); // Clear out the cache of mutable containers.
18463
18464
18465 this._refreshCache();
18466
18467 this._opSetQueue = [{}];
18468 this._hasData = hasData;
18469 },
18470
18471 /**
18472 * Applies the set of AV.Op in opSet to the object target.
18473 * @private
18474 */
18475 _applyOpSet: function _applyOpSet(opSet, target) {
18476 var self = this;
18477
18478 AV._objectEach(opSet, function (change, key) {
18479 var _findValue = findValue(target, key),
18480 _findValue2 = (0, _slicedToArray2.default)(_findValue, 3),
18481 value = _findValue2[0],
18482 actualTarget = _findValue2[1],
18483 actualKey = _findValue2[2];
18484
18485 setValue(target, key, change._estimate(value, self, key));
18486
18487 if (actualTarget && actualTarget[actualKey] === AV.Op._UNSET) {
18488 delete actualTarget[actualKey];
18489 }
18490 });
18491 },
18492
18493 /**
18494 * Replaces the cached value for key with the current value.
18495 * Returns true if the new value is different than the old value.
18496 * @private
18497 */
18498 _resetCacheForKey: function _resetCacheForKey(key) {
18499 var value = this.attributes[key];
18500
18501 if (_.isObject(value) && !(value instanceof AV.Object) && !(value instanceof AV.File)) {
18502 var json = (0, _stringify.default)(recursiveToPointer(value));
18503
18504 if (this._hashedJSON[key] !== json) {
18505 var wasSet = !!this._hashedJSON[key];
18506 this._hashedJSON[key] = json;
18507 return wasSet;
18508 }
18509 }
18510
18511 return false;
18512 },
18513
18514 /**
18515 * Populates attributes[key] by starting with the last known data from the
18516 * server, and applying all of the local changes that have been made to that
18517 * key since then.
18518 * @private
18519 */
18520 _rebuildEstimatedDataForKey: function _rebuildEstimatedDataForKey(key) {
18521 var self = this;
18522 delete this.attributes[key];
18523
18524 if (this._serverData[key]) {
18525 this.attributes[key] = this._serverData[key];
18526 }
18527
18528 AV._arrayEach(this._opSetQueue, function (opSet) {
18529 var op = opSet[key];
18530
18531 if (op) {
18532 var _findValue3 = findValue(self.attributes, key),
18533 _findValue4 = (0, _slicedToArray2.default)(_findValue3, 4),
18534 value = _findValue4[0],
18535 actualTarget = _findValue4[1],
18536 actualKey = _findValue4[2],
18537 firstKey = _findValue4[3];
18538
18539 setValue(self.attributes, key, op._estimate(value, self, key));
18540
18541 if (actualTarget && actualTarget[actualKey] === AV.Op._UNSET) {
18542 delete actualTarget[actualKey];
18543 }
18544
18545 self._resetCacheForKey(firstKey);
18546 }
18547 });
18548 },
18549
18550 /**
18551 * Populates attributes by starting with the last known data from the
18552 * server, and applying all of the local changes that have been made since
18553 * then.
18554 * @private
18555 */
18556 _rebuildAllEstimatedData: function _rebuildAllEstimatedData() {
18557 var self = this;
18558
18559 var previousAttributes = _.clone(this.attributes);
18560
18561 this.attributes = _.clone(this._serverData);
18562
18563 AV._arrayEach(this._opSetQueue, function (opSet) {
18564 self._applyOpSet(opSet, self.attributes);
18565
18566 AV._objectEach(opSet, function (op, key) {
18567 self._resetCacheForKey(key);
18568 });
18569 }); // Trigger change events for anything that changed because of the fetch.
18570
18571
18572 AV._objectEach(previousAttributes, function (oldValue, key) {
18573 if (self.attributes[key] !== oldValue) {
18574 self.trigger('change:' + key, self, self.attributes[key], {});
18575 }
18576 });
18577
18578 AV._objectEach(this.attributes, function (newValue, key) {
18579 if (!_.has(previousAttributes, key)) {
18580 self.trigger('change:' + key, self, newValue, {});
18581 }
18582 });
18583 },
18584
18585 /**
18586 * Sets a hash of model attributes on the object, firing
18587 * <code>"change"</code> unless you choose to silence it.
18588 *
18589 * <p>You can call it with an object containing keys and values, or with one
18590 * key and value. For example:</p>
18591 *
18592 * @example
18593 * gameTurn.set({
18594 * player: player1,
18595 * diceRoll: 2
18596 * });
18597 *
18598 * game.set("currentPlayer", player2);
18599 *
18600 * game.set("finished", true);
18601 *
18602 * @param {String} key The key to set.
18603 * @param {Any} value The value to give it.
18604 * @param {Object} [options]
18605 * @param {Boolean} [options.silent]
18606 * @return {AV.Object} self if succeeded, throws if the value is not valid.
18607 * @see AV.Object#validate
18608 */
18609 set: function set(key, value, options) {
18610 var attrs;
18611
18612 if (_.isObject(key) || isNullOrUndefined(key)) {
18613 attrs = _.mapObject(key, function (v, k) {
18614 checkReservedKey(k);
18615 return AV._decode(v, k);
18616 });
18617 options = value;
18618 } else {
18619 attrs = {};
18620 checkReservedKey(key);
18621 attrs[key] = AV._decode(value, key);
18622 } // Extract attributes and options.
18623
18624
18625 options = options || {};
18626
18627 if (!attrs) {
18628 return this;
18629 }
18630
18631 if (attrs instanceof AV.Object) {
18632 attrs = attrs.attributes;
18633 } // If the unset option is used, every attribute should be a Unset.
18634
18635
18636 if (options.unset) {
18637 AV._objectEach(attrs, function (unused_value, key) {
18638 attrs[key] = new AV.Op.Unset();
18639 });
18640 } // Apply all the attributes to get the estimated values.
18641
18642
18643 var dataToValidate = _.clone(attrs);
18644
18645 var self = this;
18646
18647 AV._objectEach(dataToValidate, function (value, key) {
18648 if (value instanceof AV.Op) {
18649 dataToValidate[key] = value._estimate(self.attributes[key], self, key);
18650
18651 if (dataToValidate[key] === AV.Op._UNSET) {
18652 delete dataToValidate[key];
18653 }
18654 }
18655 }); // Run validation.
18656
18657
18658 this._validate(attrs, options);
18659
18660 options.changes = {};
18661 var escaped = this._escapedAttributes; // Update attributes.
18662
18663 AV._arrayEach((0, _keys2.default)(_).call(_, attrs), function (attr) {
18664 var val = attrs[attr]; // If this is a relation object we need to set the parent correctly,
18665 // since the location where it was parsed does not have access to
18666 // this object.
18667
18668 if (val instanceof AV.Relation) {
18669 val.parent = self;
18670 }
18671
18672 if (!(val instanceof AV.Op)) {
18673 val = new AV.Op.Set(val);
18674 } // See if this change will actually have any effect.
18675
18676
18677 var isRealChange = true;
18678
18679 if (val instanceof AV.Op.Set && _.isEqual(self.attributes[attr], val.value)) {
18680 isRealChange = false;
18681 }
18682
18683 if (isRealChange) {
18684 delete escaped[attr];
18685
18686 if (options.silent) {
18687 self._silent[attr] = true;
18688 } else {
18689 options.changes[attr] = true;
18690 }
18691 }
18692
18693 var currentChanges = _.last(self._opSetQueue);
18694
18695 currentChanges[attr] = val._mergeWithPrevious(currentChanges[attr]);
18696
18697 self._rebuildEstimatedDataForKey(attr);
18698
18699 if (isRealChange) {
18700 self.changed[attr] = self.attributes[attr];
18701
18702 if (!options.silent) {
18703 self._pending[attr] = true;
18704 }
18705 } else {
18706 delete self.changed[attr];
18707 delete self._pending[attr];
18708 }
18709 });
18710
18711 if (!options.silent) {
18712 this.change(options);
18713 }
18714
18715 return this;
18716 },
18717
18718 /**
18719 * Remove an attribute from the model, firing <code>"change"</code> unless
18720 * you choose to silence it. This is a noop if the attribute doesn't
18721 * exist.
18722 * @param key {String} The key.
18723 */
18724 unset: function unset(attr, options) {
18725 options = options || {};
18726 options.unset = true;
18727 return this.set(attr, null, options);
18728 },
18729
18730 /**
18731 * Atomically increments the value of the given attribute the next time the
18732 * object is saved. If no amount is specified, 1 is used by default.
18733 *
18734 * @param key {String} The key.
18735 * @param amount {Number} The amount to increment by.
18736 */
18737 increment: function increment(attr, amount) {
18738 if (_.isUndefined(amount) || _.isNull(amount)) {
18739 amount = 1;
18740 }
18741
18742 return this.set(attr, new AV.Op.Increment(amount));
18743 },
18744
18745 /**
18746 * Atomically add an object to the end of the array associated with a given
18747 * key.
18748 * @param key {String} The key.
18749 * @param item {} The item to add.
18750 */
18751 add: function add(attr, item) {
18752 return this.set(attr, new AV.Op.Add(ensureArray(item)));
18753 },
18754
18755 /**
18756 * Atomically add an object to the array associated with a given key, only
18757 * if it is not already present in the array. The position of the insert is
18758 * not guaranteed.
18759 *
18760 * @param key {String} The key.
18761 * @param item {} The object to add.
18762 */
18763 addUnique: function addUnique(attr, item) {
18764 return this.set(attr, new AV.Op.AddUnique(ensureArray(item)));
18765 },
18766
18767 /**
18768 * Atomically remove all instances of an object from the array associated
18769 * with a given key.
18770 *
18771 * @param key {String} The key.
18772 * @param item {} The object to remove.
18773 */
18774 remove: function remove(attr, item) {
18775 return this.set(attr, new AV.Op.Remove(ensureArray(item)));
18776 },
18777
18778 /**
18779 * Atomically apply a "bit and" operation on the value associated with a
18780 * given key.
18781 *
18782 * @param key {String} The key.
18783 * @param value {Number} The value to apply.
18784 */
18785 bitAnd: function bitAnd(attr, value) {
18786 return this.set(attr, new AV.Op.BitAnd(value));
18787 },
18788
18789 /**
18790 * Atomically apply a "bit or" operation on the value associated with a
18791 * given key.
18792 *
18793 * @param key {String} The key.
18794 * @param value {Number} The value to apply.
18795 */
18796 bitOr: function bitOr(attr, value) {
18797 return this.set(attr, new AV.Op.BitOr(value));
18798 },
18799
18800 /**
18801 * Atomically apply a "bit xor" operation on the value associated with a
18802 * given key.
18803 *
18804 * @param key {String} The key.
18805 * @param value {Number} The value to apply.
18806 */
18807 bitXor: function bitXor(attr, value) {
18808 return this.set(attr, new AV.Op.BitXor(value));
18809 },
18810
18811 /**
18812 * Returns an instance of a subclass of AV.Op describing what kind of
18813 * modification has been performed on this field since the last time it was
18814 * saved. For example, after calling object.increment("x"), calling
18815 * object.op("x") would return an instance of AV.Op.Increment.
18816 *
18817 * @param key {String} The key.
18818 * @returns {AV.Op} The operation, or undefined if none.
18819 */
18820 op: function op(attr) {
18821 return _.last(this._opSetQueue)[attr];
18822 },
18823
18824 /**
18825 * Clear all attributes on the model, firing <code>"change"</code> unless
18826 * you choose to silence it.
18827 */
18828 clear: function clear(options) {
18829 options = options || {};
18830 options.unset = true;
18831
18832 var keysToClear = _.extend(this.attributes, this._operations);
18833
18834 return this.set(keysToClear, options);
18835 },
18836
18837 /**
18838 * Clears any (or specific) changes to the model made since the last save.
18839 * @param {string|string[]} [keys] specify keys to revert.
18840 */
18841 revert: function revert(keys) {
18842 var lastOp = _.last(this._opSetQueue);
18843
18844 var _keys = ensureArray(keys || (0, _keys2.default)(_).call(_, lastOp));
18845
18846 _keys.forEach(function (key) {
18847 delete lastOp[key];
18848 });
18849
18850 this._rebuildAllEstimatedData();
18851
18852 return this;
18853 },
18854
18855 /**
18856 * Returns a JSON-encoded set of operations to be sent with the next save
18857 * request.
18858 * @private
18859 */
18860 _getSaveJSON: function _getSaveJSON() {
18861 var json = _.clone(_.first(this._opSetQueue));
18862
18863 AV._objectEach(json, function (op, key) {
18864 json[key] = op.toJSON();
18865 });
18866
18867 return json;
18868 },
18869
18870 /**
18871 * Returns true if this object can be serialized for saving.
18872 * @private
18873 */
18874 _canBeSerialized: function _canBeSerialized() {
18875 return AV.Object._canBeSerializedAsValue(this.attributes);
18876 },
18877
18878 /**
18879 * Fetch the model from the server. If the server's representation of the
18880 * model differs from its current attributes, they will be overriden,
18881 * triggering a <code>"change"</code> event.
18882 * @param {Object} fetchOptions Optional options to set 'keys',
18883 * 'include' and 'includeACL' option.
18884 * @param {AuthOptions} options
18885 * @return {Promise} A promise that is fulfilled when the fetch
18886 * completes.
18887 */
18888 fetch: function fetch() {
18889 var fetchOptions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
18890 var options = arguments.length > 1 ? arguments[1] : undefined;
18891
18892 if (!this.id) {
18893 throw new Error('Cannot fetch unsaved object');
18894 }
18895
18896 var self = this;
18897
18898 var request = _request('classes', this.className, this.id, 'GET', transformFetchOptions(fetchOptions), options);
18899
18900 return request.then(function (response) {
18901 var fetchedAttrs = self.parse(response);
18902
18903 self._cleanupUnsetKeys(fetchedAttrs, (0, _keys2.default)(fetchOptions) ? ensureArray((0, _keys2.default)(fetchOptions)).join(',').split(',') : undefined);
18904
18905 self._finishFetch(fetchedAttrs, true);
18906
18907 return self;
18908 });
18909 },
18910 _cleanupUnsetKeys: function _cleanupUnsetKeys(fetchedAttrs) {
18911 var _this2 = this;
18912
18913 var fetchedKeys = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : (0, _keys2.default)(_).call(_, this._serverData);
18914
18915 _.forEach(fetchedKeys, function (key) {
18916 if (fetchedAttrs[key] === undefined) delete _this2._serverData[key];
18917 });
18918 },
18919
18920 /**
18921 * Set a hash of model attributes, and save the model to the server.
18922 * updatedAt will be updated when the request returns.
18923 * You can either call it as:<pre>
18924 * object.save();</pre>
18925 * or<pre>
18926 * object.save(null, options);</pre>
18927 * or<pre>
18928 * object.save(attrs, options);</pre>
18929 * or<pre>
18930 * object.save(key, value, options);</pre>
18931 *
18932 * @example
18933 * gameTurn.save({
18934 * player: "Jake Cutter",
18935 * diceRoll: 2
18936 * }).then(function(gameTurnAgain) {
18937 * // The save was successful.
18938 * }, function(error) {
18939 * // The save failed. Error is an instance of AVError.
18940 * });
18941 *
18942 * @param {AuthOptions} options AuthOptions plus:
18943 * @param {Boolean} options.fetchWhenSave fetch and update object after save succeeded
18944 * @param {AV.Query} options.query Save object only when it matches the query
18945 * @return {Promise} A promise that is fulfilled when the save
18946 * completes.
18947 * @see AVError
18948 */
18949 save: function save(arg1, arg2, arg3) {
18950 var attrs, current, options;
18951
18952 if (_.isObject(arg1) || isNullOrUndefined(arg1)) {
18953 attrs = arg1;
18954 options = arg2;
18955 } else {
18956 attrs = {};
18957 attrs[arg1] = arg2;
18958 options = arg3;
18959 }
18960
18961 options = _.clone(options) || {};
18962
18963 if (options.wait) {
18964 current = _.clone(this.attributes);
18965 }
18966
18967 var setOptions = _.clone(options) || {};
18968
18969 if (setOptions.wait) {
18970 setOptions.silent = true;
18971 }
18972
18973 if (attrs) {
18974 this.set(attrs, setOptions);
18975 }
18976
18977 var model = this;
18978 var unsavedChildren = [];
18979 var unsavedFiles = [];
18980
18981 AV.Object._findUnsavedChildren(model, unsavedChildren, unsavedFiles);
18982
18983 if (unsavedChildren.length + unsavedFiles.length > 1) {
18984 return AV.Object._deepSaveAsync(this, model, options);
18985 }
18986
18987 this._startSave();
18988
18989 this._saving = (this._saving || 0) + 1;
18990 this._allPreviousSaves = this._allPreviousSaves || _promise.default.resolve();
18991 this._allPreviousSaves = this._allPreviousSaves.catch(function (e) {}).then(function () {
18992 var method = model.id ? 'PUT' : 'POST';
18993
18994 var json = model._getSaveJSON();
18995
18996 var query = {};
18997
18998 if (model._fetchWhenSave || options.fetchWhenSave) {
18999 query['new'] = 'true';
19000 } // user login option
19001
19002
19003 if (options._failOnNotExist) {
19004 query.failOnNotExist = 'true';
19005 }
19006
19007 if (options.query) {
19008 var queryParams;
19009
19010 if (typeof options.query._getParams === 'function') {
19011 queryParams = options.query._getParams();
19012
19013 if (queryParams) {
19014 query.where = queryParams.where;
19015 }
19016 }
19017
19018 if (!query.where) {
19019 var error = new Error('options.query is not an AV.Query');
19020 throw error;
19021 }
19022 }
19023
19024 _.extend(json, model._flags);
19025
19026 var route = 'classes';
19027 var className = model.className;
19028
19029 if (model.className === '_User' && !model.id) {
19030 // Special-case user sign-up.
19031 route = 'users';
19032 className = null;
19033 } //hook makeRequest in options.
19034
19035
19036 var makeRequest = options._makeRequest || _request;
19037 var requestPromise = makeRequest(route, className, model.id, method, json, options, query);
19038 requestPromise = requestPromise.then(function (resp) {
19039 var serverAttrs = model.parse(resp);
19040
19041 if (options.wait) {
19042 serverAttrs = _.extend(attrs || {}, serverAttrs);
19043 }
19044
19045 model._finishSave(serverAttrs);
19046
19047 if (options.wait) {
19048 model.set(current, setOptions);
19049 }
19050
19051 return model;
19052 }, function (error) {
19053 model._cancelSave();
19054
19055 throw error;
19056 });
19057 return requestPromise;
19058 });
19059 return this._allPreviousSaves;
19060 },
19061
19062 /**
19063 * Destroy this model on the server if it was already persisted.
19064 * Optimistically removes the model from its collection, if it has one.
19065 * @param {AuthOptions} options AuthOptions plus:
19066 * @param {Boolean} [options.wait] wait for the server to respond
19067 * before removal.
19068 *
19069 * @return {Promise} A promise that is fulfilled when the destroy
19070 * completes.
19071 */
19072 destroy: function destroy(options) {
19073 options = options || {};
19074 var model = this;
19075
19076 var triggerDestroy = function triggerDestroy() {
19077 model.trigger('destroy', model, model.collection, options);
19078 };
19079
19080 if (!this.id) {
19081 return triggerDestroy();
19082 }
19083
19084 if (!options.wait) {
19085 triggerDestroy();
19086 }
19087
19088 var request = _request('classes', this.className, this.id, 'DELETE', this._flags, options);
19089
19090 return request.then(function () {
19091 if (options.wait) {
19092 triggerDestroy();
19093 }
19094
19095 return model;
19096 });
19097 },
19098
19099 /**
19100 * Converts a response into the hash of attributes to be set on the model.
19101 * @ignore
19102 */
19103 parse: function parse(resp) {
19104 var output = _.clone(resp);
19105
19106 ['createdAt', 'updatedAt'].forEach(function (key) {
19107 if (output[key]) {
19108 output[key] = AV._parseDate(output[key]);
19109 }
19110 });
19111
19112 if (output.createdAt && !output.updatedAt) {
19113 output.updatedAt = output.createdAt;
19114 }
19115
19116 return output;
19117 },
19118
19119 /**
19120 * Creates a new model with identical attributes to this one.
19121 * @return {AV.Object}
19122 */
19123 clone: function clone() {
19124 return new this.constructor(this.attributes);
19125 },
19126
19127 /**
19128 * Returns true if this object has never been saved to AV.
19129 * @return {Boolean}
19130 */
19131 isNew: function isNew() {
19132 return !this.id;
19133 },
19134
19135 /**
19136 * Call this method to manually fire a `"change"` event for this model and
19137 * a `"change:attribute"` event for each changed attribute.
19138 * Calling this will cause all objects observing the model to update.
19139 */
19140 change: function change(options) {
19141 options = options || {};
19142 var changing = this._changing;
19143 this._changing = true; // Silent changes become pending changes.
19144
19145 var self = this;
19146
19147 AV._objectEach(this._silent, function (attr) {
19148 self._pending[attr] = true;
19149 }); // Silent changes are triggered.
19150
19151
19152 var changes = _.extend({}, options.changes, this._silent);
19153
19154 this._silent = {};
19155
19156 AV._objectEach(changes, function (unused_value, attr) {
19157 self.trigger('change:' + attr, self, self.get(attr), options);
19158 });
19159
19160 if (changing) {
19161 return this;
19162 } // This is to get around lint not letting us make a function in a loop.
19163
19164
19165 var deleteChanged = function deleteChanged(value, attr) {
19166 if (!self._pending[attr] && !self._silent[attr]) {
19167 delete self.changed[attr];
19168 }
19169 }; // Continue firing `"change"` events while there are pending changes.
19170
19171
19172 while (!_.isEmpty(this._pending)) {
19173 this._pending = {};
19174 this.trigger('change', this, options); // Pending and silent changes still remain.
19175
19176 AV._objectEach(this.changed, deleteChanged);
19177
19178 self._previousAttributes = _.clone(this.attributes);
19179 }
19180
19181 this._changing = false;
19182 return this;
19183 },
19184
19185 /**
19186 * Gets the previous value of an attribute, recorded at the time the last
19187 * <code>"change"</code> event was fired.
19188 * @param {String} attr Name of the attribute to get.
19189 */
19190 previous: function previous(attr) {
19191 if (!arguments.length || !this._previousAttributes) {
19192 return null;
19193 }
19194
19195 return this._previousAttributes[attr];
19196 },
19197
19198 /**
19199 * Gets all of the attributes of the model at the time of the previous
19200 * <code>"change"</code> event.
19201 * @return {Object}
19202 */
19203 previousAttributes: function previousAttributes() {
19204 return _.clone(this._previousAttributes);
19205 },
19206
19207 /**
19208 * Checks if the model is currently in a valid state. It's only possible to
19209 * get into an *invalid* state if you're using silent changes.
19210 * @return {Boolean}
19211 */
19212 isValid: function isValid() {
19213 try {
19214 this.validate(this.attributes);
19215 } catch (error) {
19216 return false;
19217 }
19218
19219 return true;
19220 },
19221
19222 /**
19223 * You should not call this function directly unless you subclass
19224 * <code>AV.Object</code>, in which case you can override this method
19225 * to provide additional validation on <code>set</code> and
19226 * <code>save</code>. Your implementation should throw an Error if
19227 * the attrs is invalid
19228 *
19229 * @param {Object} attrs The current data to validate.
19230 * @see AV.Object#set
19231 */
19232 validate: function validate(attrs) {
19233 if (_.has(attrs, 'ACL') && !(attrs.ACL instanceof AV.ACL)) {
19234 throw new AVError(AVError.OTHER_CAUSE, 'ACL must be a AV.ACL.');
19235 }
19236 },
19237
19238 /**
19239 * Run validation against a set of incoming attributes, returning `true`
19240 * if all is well. If a specific `error` callback has been passed,
19241 * call that instead of firing the general `"error"` event.
19242 * @private
19243 */
19244 _validate: function _validate(attrs, options) {
19245 if (options.silent || !this.validate) {
19246 return;
19247 }
19248
19249 attrs = _.extend({}, this.attributes, attrs);
19250 this.validate(attrs);
19251 },
19252
19253 /**
19254 * Returns the ACL for this object.
19255 * @returns {AV.ACL} An instance of AV.ACL.
19256 * @see AV.Object#get
19257 */
19258 getACL: function getACL() {
19259 return this.get('ACL');
19260 },
19261
19262 /**
19263 * Sets the ACL to be used for this object.
19264 * @param {AV.ACL} acl An instance of AV.ACL.
19265 * @param {Object} options Optional Backbone-like options object to be
19266 * passed in to set.
19267 * @return {AV.Object} self
19268 * @see AV.Object#set
19269 */
19270 setACL: function setACL(acl, options) {
19271 return this.set('ACL', acl, options);
19272 },
19273 disableBeforeHook: function disableBeforeHook() {
19274 this.ignoreHook('beforeSave');
19275 this.ignoreHook('beforeUpdate');
19276 this.ignoreHook('beforeDelete');
19277 },
19278 disableAfterHook: function disableAfterHook() {
19279 this.ignoreHook('afterSave');
19280 this.ignoreHook('afterUpdate');
19281 this.ignoreHook('afterDelete');
19282 },
19283 ignoreHook: function ignoreHook(hookName) {
19284 if (!_.contains(['beforeSave', 'afterSave', 'beforeUpdate', 'afterUpdate', 'beforeDelete', 'afterDelete'], hookName)) {
19285 throw new Error('Unsupported hookName: ' + hookName);
19286 }
19287
19288 if (!AV.hookKey) {
19289 throw new Error('ignoreHook required hookKey');
19290 }
19291
19292 if (!this._flags.__ignore_hooks) {
19293 this._flags.__ignore_hooks = [];
19294 }
19295
19296 this._flags.__ignore_hooks.push(hookName);
19297 }
19298 });
19299 /**
19300 * Creates an instance of a subclass of AV.Object for the give classname
19301 * and id.
19302 * @param {String|Function} class the className or a subclass of AV.Object.
19303 * @param {String} id The object id of this model.
19304 * @return {AV.Object} A new subclass instance of AV.Object.
19305 */
19306
19307
19308 AV.Object.createWithoutData = function (klass, id, hasData) {
19309 var _klass;
19310
19311 if (_.isString(klass)) {
19312 _klass = AV.Object._getSubclass(klass);
19313 } else if (klass.prototype && klass.prototype instanceof AV.Object) {
19314 _klass = klass;
19315 } else {
19316 throw new Error('class must be a string or a subclass of AV.Object.');
19317 }
19318
19319 if (!id) {
19320 throw new TypeError('The objectId must be provided');
19321 }
19322
19323 var object = new _klass();
19324 object.id = id;
19325 object._hasData = hasData;
19326 return object;
19327 };
19328 /**
19329 * Delete objects in batch.
19330 * @param {AV.Object[]} objects The <code>AV.Object</code> array to be deleted.
19331 * @param {AuthOptions} options
19332 * @return {Promise} A promise that is fulfilled when the save
19333 * completes.
19334 */
19335
19336
19337 AV.Object.destroyAll = function (objects) {
19338 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
19339
19340 if (!objects || objects.length === 0) {
19341 return _promise.default.resolve();
19342 }
19343
19344 var objectsByClassNameAndFlags = _.groupBy(objects, function (object) {
19345 return (0, _stringify.default)({
19346 className: object.className,
19347 flags: object._flags
19348 });
19349 });
19350
19351 var body = {
19352 requests: (0, _map.default)(_).call(_, objectsByClassNameAndFlags, function (objects) {
19353 var _context3;
19354
19355 var ids = (0, _map.default)(_).call(_, objects, 'id').join(',');
19356 return {
19357 method: 'DELETE',
19358 path: (0, _concat.default)(_context3 = "/1.1/classes/".concat(objects[0].className, "/")).call(_context3, ids),
19359 body: objects[0]._flags
19360 };
19361 })
19362 };
19363 return _request('batch', null, null, 'POST', body, options).then(function (response) {
19364 var firstError = (0, _find.default)(_).call(_, response, function (result) {
19365 return !result.success;
19366 });
19367 if (firstError) throw new AVError(firstError.error.code, firstError.error.error);
19368 return undefined;
19369 });
19370 };
19371 /**
19372 * Returns the appropriate subclass for making new instances of the given
19373 * className string.
19374 * @private
19375 */
19376
19377
19378 AV.Object._getSubclass = function (className) {
19379 if (!_.isString(className)) {
19380 throw new Error('AV.Object._getSubclass requires a string argument.');
19381 }
19382
19383 var ObjectClass = AV.Object._classMap[className];
19384
19385 if (!ObjectClass) {
19386 ObjectClass = AV.Object.extend(className);
19387 AV.Object._classMap[className] = ObjectClass;
19388 }
19389
19390 return ObjectClass;
19391 };
19392 /**
19393 * Creates an instance of a subclass of AV.Object for the given classname.
19394 * @private
19395 */
19396
19397
19398 AV.Object._create = function (className, attributes, options) {
19399 var ObjectClass = AV.Object._getSubclass(className);
19400
19401 return new ObjectClass(attributes, options);
19402 }; // Set up a map of className to class so that we can create new instances of
19403 // AV Objects from JSON automatically.
19404
19405
19406 AV.Object._classMap = {};
19407 AV.Object._extend = AV._extend;
19408 /**
19409 * Creates a new model with defined attributes,
19410 * It's the same with
19411 * <pre>
19412 * new AV.Object(attributes, options);
19413 * </pre>
19414 * @param {Object} attributes The initial set of data to store in the object.
19415 * @param {Object} options A set of Backbone-like options for creating the
19416 * object. The only option currently supported is "collection".
19417 * @return {AV.Object}
19418 * @since v0.4.4
19419 * @see AV.Object
19420 * @see AV.Object.extend
19421 */
19422
19423 AV.Object['new'] = function (attributes, options) {
19424 return new AV.Object(attributes, options);
19425 };
19426 /**
19427 * Creates a new subclass of AV.Object for the given AV class name.
19428 *
19429 * <p>Every extension of a AV class will inherit from the most recent
19430 * previous extension of that class. When a AV.Object is automatically
19431 * created by parsing JSON, it will use the most recent extension of that
19432 * class.</p>
19433 *
19434 * @example
19435 * var MyClass = AV.Object.extend("MyClass", {
19436 * // Instance properties
19437 * }, {
19438 * // Class properties
19439 * });
19440 *
19441 * @param {String} className The name of the AV class backing this model.
19442 * @param {Object} protoProps Instance properties to add to instances of the
19443 * class returned from this method.
19444 * @param {Object} classProps Class properties to add the class returned from
19445 * this method.
19446 * @return {Class} A new subclass of AV.Object.
19447 */
19448
19449
19450 AV.Object.extend = function (className, protoProps, classProps) {
19451 // Handle the case with only two args.
19452 if (!_.isString(className)) {
19453 if (className && _.has(className, 'className')) {
19454 return AV.Object.extend(className.className, className, protoProps);
19455 } else {
19456 throw new Error("AV.Object.extend's first argument should be the className.");
19457 }
19458 } // If someone tries to subclass "User", coerce it to the right type.
19459
19460
19461 if (className === 'User') {
19462 className = '_User';
19463 }
19464
19465 var NewClassObject = null;
19466
19467 if (_.has(AV.Object._classMap, className)) {
19468 var OldClassObject = AV.Object._classMap[className]; // This new subclass has been told to extend both from "this" and from
19469 // OldClassObject. This is multiple inheritance, which isn't supported.
19470 // For now, let's just pick one.
19471
19472 if (protoProps || classProps) {
19473 NewClassObject = OldClassObject._extend(protoProps, classProps);
19474 } else {
19475 return OldClassObject;
19476 }
19477 } else {
19478 protoProps = protoProps || {};
19479 protoProps._className = className;
19480 NewClassObject = this._extend(protoProps, classProps);
19481 } // Extending a subclass should reuse the classname automatically.
19482
19483
19484 NewClassObject.extend = function (arg0) {
19485 var _context4;
19486
19487 if (_.isString(arg0) || arg0 && _.has(arg0, 'className')) {
19488 return AV.Object.extend.apply(NewClassObject, arguments);
19489 }
19490
19491 var newArguments = (0, _concat.default)(_context4 = [className]).call(_context4, _.toArray(arguments));
19492 return AV.Object.extend.apply(NewClassObject, newArguments);
19493 }; // Add the query property descriptor.
19494
19495
19496 (0, _defineProperty.default)(NewClassObject, 'query', (0, _getOwnPropertyDescriptor.default)(AV.Object, 'query'));
19497
19498 NewClassObject['new'] = function (attributes, options) {
19499 return new NewClassObject(attributes, options);
19500 };
19501
19502 AV.Object._classMap[className] = NewClassObject;
19503 return NewClassObject;
19504 }; // ES6 class syntax support
19505
19506
19507 (0, _defineProperty.default)(AV.Object.prototype, 'className', {
19508 get: function get() {
19509 var className = this._className || this.constructor._LCClassName || this.constructor.name; // If someone tries to subclass "User", coerce it to the right type.
19510
19511 if (className === 'User') {
19512 return '_User';
19513 }
19514
19515 return className;
19516 }
19517 });
19518 /**
19519 * Register a class.
19520 * If a subclass of <code>AV.Object</code> is defined with your own implement
19521 * rather then <code>AV.Object.extend</code>, the subclass must be registered.
19522 * @param {Function} klass A subclass of <code>AV.Object</code>
19523 * @param {String} [name] Specify the name of the class. Useful when the class might be uglified.
19524 * @example
19525 * class Person extend AV.Object {}
19526 * AV.Object.register(Person);
19527 */
19528
19529 AV.Object.register = function (klass, name) {
19530 if (!(klass.prototype instanceof AV.Object)) {
19531 throw new Error('registered class is not a subclass of AV.Object');
19532 }
19533
19534 var className = name || klass.name;
19535
19536 if (!className.length) {
19537 throw new Error('registered class must be named');
19538 }
19539
19540 if (name) {
19541 klass._LCClassName = name;
19542 }
19543
19544 AV.Object._classMap[className] = klass;
19545 };
19546 /**
19547 * Get a new Query of the current class
19548 * @name query
19549 * @memberof AV.Object
19550 * @type AV.Query
19551 * @readonly
19552 * @since v3.1.0
19553 * @example
19554 * const Post = AV.Object.extend('Post');
19555 * Post.query.equalTo('author', 'leancloud').find().then();
19556 */
19557
19558
19559 (0, _defineProperty.default)(AV.Object, 'query', {
19560 get: function get() {
19561 return new AV.Query(this.prototype.className);
19562 }
19563 });
19564
19565 AV.Object._findUnsavedChildren = function (objects, children, files) {
19566 AV._traverse(objects, function (object) {
19567 if (object instanceof AV.Object) {
19568 if (object.dirty()) {
19569 children.push(object);
19570 }
19571
19572 return;
19573 }
19574
19575 if (object instanceof AV.File) {
19576 if (!object.id) {
19577 files.push(object);
19578 }
19579
19580 return;
19581 }
19582 });
19583 };
19584
19585 AV.Object._canBeSerializedAsValue = function (object) {
19586 var canBeSerializedAsValue = true;
19587
19588 if (object instanceof AV.Object || object instanceof AV.File) {
19589 canBeSerializedAsValue = !!object.id;
19590 } else if (_.isArray(object)) {
19591 AV._arrayEach(object, function (child) {
19592 if (!AV.Object._canBeSerializedAsValue(child)) {
19593 canBeSerializedAsValue = false;
19594 }
19595 });
19596 } else if (_.isObject(object)) {
19597 AV._objectEach(object, function (child) {
19598 if (!AV.Object._canBeSerializedAsValue(child)) {
19599 canBeSerializedAsValue = false;
19600 }
19601 });
19602 }
19603
19604 return canBeSerializedAsValue;
19605 };
19606
19607 AV.Object._deepSaveAsync = function (object, model, options) {
19608 var unsavedChildren = [];
19609 var unsavedFiles = [];
19610
19611 AV.Object._findUnsavedChildren(object, unsavedChildren, unsavedFiles);
19612
19613 unsavedFiles = _.uniq(unsavedFiles);
19614
19615 var promise = _promise.default.resolve();
19616
19617 _.each(unsavedFiles, function (file) {
19618 promise = promise.then(function () {
19619 return file.save();
19620 });
19621 });
19622
19623 var objects = _.uniq(unsavedChildren);
19624
19625 var remaining = _.uniq(objects);
19626
19627 return promise.then(function () {
19628 return continueWhile(function () {
19629 return remaining.length > 0;
19630 }, function () {
19631 // Gather up all the objects that can be saved in this batch.
19632 var batch = [];
19633 var newRemaining = [];
19634
19635 AV._arrayEach(remaining, function (object) {
19636 if (object._canBeSerialized()) {
19637 batch.push(object);
19638 } else {
19639 newRemaining.push(object);
19640 }
19641 });
19642
19643 remaining = newRemaining; // If we can't save any objects, there must be a circular reference.
19644
19645 if (batch.length === 0) {
19646 return _promise.default.reject(new AVError(AVError.OTHER_CAUSE, 'Tried to save a batch with a cycle.'));
19647 } // Reserve a spot in every object's save queue.
19648
19649
19650 var readyToStart = _promise.default.resolve((0, _map.default)(_).call(_, batch, function (object) {
19651 return object._allPreviousSaves || _promise.default.resolve();
19652 })); // Save a single batch, whether previous saves succeeded or failed.
19653
19654
19655 var bathSavePromise = readyToStart.then(function () {
19656 return _request('batch', null, null, 'POST', {
19657 requests: (0, _map.default)(_).call(_, batch, function (object) {
19658 var method = object.id ? 'PUT' : 'POST';
19659
19660 var json = object._getSaveJSON();
19661
19662 _.extend(json, object._flags);
19663
19664 var route = 'classes';
19665 var className = object.className;
19666 var path = "/".concat(route, "/").concat(className);
19667
19668 if (object.className === '_User' && !object.id) {
19669 // Special-case user sign-up.
19670 path = '/users';
19671 }
19672
19673 var path = "/1.1".concat(path);
19674
19675 if (object.id) {
19676 path = path + '/' + object.id;
19677 }
19678
19679 object._startSave();
19680
19681 return {
19682 method: method,
19683 path: path,
19684 body: json,
19685 params: options && options.fetchWhenSave ? {
19686 fetchWhenSave: true
19687 } : undefined
19688 };
19689 })
19690 }, options).then(function (response) {
19691 var results = (0, _map.default)(_).call(_, batch, function (object, i) {
19692 if (response[i].success) {
19693 object._finishSave(object.parse(response[i].success));
19694
19695 return object;
19696 }
19697
19698 object._cancelSave();
19699
19700 return new AVError(response[i].error.code, response[i].error.error);
19701 });
19702 return handleBatchResults(results);
19703 });
19704 });
19705
19706 AV._arrayEach(batch, function (object) {
19707 object._allPreviousSaves = bathSavePromise;
19708 });
19709
19710 return bathSavePromise;
19711 });
19712 }).then(function () {
19713 return object;
19714 });
19715 };
19716};
19717
19718/***/ }),
19719/* 533 */
19720/***/ (function(module, exports, __webpack_require__) {
19721
19722var arrayWithHoles = __webpack_require__(534);
19723
19724var iterableToArrayLimit = __webpack_require__(542);
19725
19726var unsupportedIterableToArray = __webpack_require__(543);
19727
19728var nonIterableRest = __webpack_require__(553);
19729
19730function _slicedToArray(arr, i) {
19731 return arrayWithHoles(arr) || iterableToArrayLimit(arr, i) || unsupportedIterableToArray(arr, i) || nonIterableRest();
19732}
19733
19734module.exports = _slicedToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
19735
19736/***/ }),
19737/* 534 */
19738/***/ (function(module, exports, __webpack_require__) {
19739
19740var _Array$isArray = __webpack_require__(535);
19741
19742function _arrayWithHoles(arr) {
19743 if (_Array$isArray(arr)) return arr;
19744}
19745
19746module.exports = _arrayWithHoles, module.exports.__esModule = true, module.exports["default"] = module.exports;
19747
19748/***/ }),
19749/* 535 */
19750/***/ (function(module, exports, __webpack_require__) {
19751
19752module.exports = __webpack_require__(536);
19753
19754/***/ }),
19755/* 536 */
19756/***/ (function(module, exports, __webpack_require__) {
19757
19758module.exports = __webpack_require__(537);
19759
19760
19761/***/ }),
19762/* 537 */
19763/***/ (function(module, exports, __webpack_require__) {
19764
19765var parent = __webpack_require__(538);
19766
19767module.exports = parent;
19768
19769
19770/***/ }),
19771/* 538 */
19772/***/ (function(module, exports, __webpack_require__) {
19773
19774var parent = __webpack_require__(539);
19775
19776module.exports = parent;
19777
19778
19779/***/ }),
19780/* 539 */
19781/***/ (function(module, exports, __webpack_require__) {
19782
19783var parent = __webpack_require__(540);
19784
19785module.exports = parent;
19786
19787
19788/***/ }),
19789/* 540 */
19790/***/ (function(module, exports, __webpack_require__) {
19791
19792__webpack_require__(541);
19793var path = __webpack_require__(5);
19794
19795module.exports = path.Array.isArray;
19796
19797
19798/***/ }),
19799/* 541 */
19800/***/ (function(module, exports, __webpack_require__) {
19801
19802var $ = __webpack_require__(0);
19803var isArray = __webpack_require__(90);
19804
19805// `Array.isArray` method
19806// https://tc39.es/ecma262/#sec-array.isarray
19807$({ target: 'Array', stat: true }, {
19808 isArray: isArray
19809});
19810
19811
19812/***/ }),
19813/* 542 */
19814/***/ (function(module, exports, __webpack_require__) {
19815
19816var _Symbol = __webpack_require__(243);
19817
19818var _getIteratorMethod = __webpack_require__(255);
19819
19820function _iterableToArrayLimit(arr, i) {
19821 var _i = arr == null ? null : typeof _Symbol !== "undefined" && _getIteratorMethod(arr) || arr["@@iterator"];
19822
19823 if (_i == null) return;
19824 var _arr = [];
19825 var _n = true;
19826 var _d = false;
19827
19828 var _s, _e;
19829
19830 try {
19831 for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
19832 _arr.push(_s.value);
19833
19834 if (i && _arr.length === i) break;
19835 }
19836 } catch (err) {
19837 _d = true;
19838 _e = err;
19839 } finally {
19840 try {
19841 if (!_n && _i["return"] != null) _i["return"]();
19842 } finally {
19843 if (_d) throw _e;
19844 }
19845 }
19846
19847 return _arr;
19848}
19849
19850module.exports = _iterableToArrayLimit, module.exports.__esModule = true, module.exports["default"] = module.exports;
19851
19852/***/ }),
19853/* 543 */
19854/***/ (function(module, exports, __webpack_require__) {
19855
19856var _sliceInstanceProperty = __webpack_require__(544);
19857
19858var _Array$from = __webpack_require__(548);
19859
19860var arrayLikeToArray = __webpack_require__(552);
19861
19862function _unsupportedIterableToArray(o, minLen) {
19863 var _context;
19864
19865 if (!o) return;
19866 if (typeof o === "string") return arrayLikeToArray(o, minLen);
19867
19868 var n = _sliceInstanceProperty(_context = Object.prototype.toString.call(o)).call(_context, 8, -1);
19869
19870 if (n === "Object" && o.constructor) n = o.constructor.name;
19871 if (n === "Map" || n === "Set") return _Array$from(o);
19872 if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return arrayLikeToArray(o, minLen);
19873}
19874
19875module.exports = _unsupportedIterableToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
19876
19877/***/ }),
19878/* 544 */
19879/***/ (function(module, exports, __webpack_require__) {
19880
19881module.exports = __webpack_require__(545);
19882
19883/***/ }),
19884/* 545 */
19885/***/ (function(module, exports, __webpack_require__) {
19886
19887module.exports = __webpack_require__(546);
19888
19889
19890/***/ }),
19891/* 546 */
19892/***/ (function(module, exports, __webpack_require__) {
19893
19894var parent = __webpack_require__(547);
19895
19896module.exports = parent;
19897
19898
19899/***/ }),
19900/* 547 */
19901/***/ (function(module, exports, __webpack_require__) {
19902
19903var parent = __webpack_require__(241);
19904
19905module.exports = parent;
19906
19907
19908/***/ }),
19909/* 548 */
19910/***/ (function(module, exports, __webpack_require__) {
19911
19912module.exports = __webpack_require__(549);
19913
19914/***/ }),
19915/* 549 */
19916/***/ (function(module, exports, __webpack_require__) {
19917
19918module.exports = __webpack_require__(550);
19919
19920
19921/***/ }),
19922/* 550 */
19923/***/ (function(module, exports, __webpack_require__) {
19924
19925var parent = __webpack_require__(551);
19926
19927module.exports = parent;
19928
19929
19930/***/ }),
19931/* 551 */
19932/***/ (function(module, exports, __webpack_require__) {
19933
19934var parent = __webpack_require__(254);
19935
19936module.exports = parent;
19937
19938
19939/***/ }),
19940/* 552 */
19941/***/ (function(module, exports) {
19942
19943function _arrayLikeToArray(arr, len) {
19944 if (len == null || len > arr.length) len = arr.length;
19945
19946 for (var i = 0, arr2 = new Array(len); i < len; i++) {
19947 arr2[i] = arr[i];
19948 }
19949
19950 return arr2;
19951}
19952
19953module.exports = _arrayLikeToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
19954
19955/***/ }),
19956/* 553 */
19957/***/ (function(module, exports) {
19958
19959function _nonIterableRest() {
19960 throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
19961}
19962
19963module.exports = _nonIterableRest, module.exports.__esModule = true, module.exports["default"] = module.exports;
19964
19965/***/ }),
19966/* 554 */
19967/***/ (function(module, exports, __webpack_require__) {
19968
19969var parent = __webpack_require__(555);
19970
19971module.exports = parent;
19972
19973
19974/***/ }),
19975/* 555 */
19976/***/ (function(module, exports, __webpack_require__) {
19977
19978__webpack_require__(556);
19979var path = __webpack_require__(5);
19980
19981var Object = path.Object;
19982
19983var getOwnPropertyDescriptor = module.exports = function getOwnPropertyDescriptor(it, key) {
19984 return Object.getOwnPropertyDescriptor(it, key);
19985};
19986
19987if (Object.getOwnPropertyDescriptor.sham) getOwnPropertyDescriptor.sham = true;
19988
19989
19990/***/ }),
19991/* 556 */
19992/***/ (function(module, exports, __webpack_require__) {
19993
19994var $ = __webpack_require__(0);
19995var fails = __webpack_require__(2);
19996var toIndexedObject = __webpack_require__(32);
19997var nativeGetOwnPropertyDescriptor = __webpack_require__(62).f;
19998var DESCRIPTORS = __webpack_require__(14);
19999
20000var FAILS_ON_PRIMITIVES = fails(function () { nativeGetOwnPropertyDescriptor(1); });
20001var FORCED = !DESCRIPTORS || FAILS_ON_PRIMITIVES;
20002
20003// `Object.getOwnPropertyDescriptor` method
20004// https://tc39.es/ecma262/#sec-object.getownpropertydescriptor
20005$({ target: 'Object', stat: true, forced: FORCED, sham: !DESCRIPTORS }, {
20006 getOwnPropertyDescriptor: function getOwnPropertyDescriptor(it, key) {
20007 return nativeGetOwnPropertyDescriptor(toIndexedObject(it), key);
20008 }
20009});
20010
20011
20012/***/ }),
20013/* 557 */
20014/***/ (function(module, exports, __webpack_require__) {
20015
20016"use strict";
20017
20018
20019var _ = __webpack_require__(3);
20020
20021var AVError = __webpack_require__(46);
20022
20023module.exports = function (AV) {
20024 AV.Role = AV.Object.extend('_Role',
20025 /** @lends AV.Role.prototype */
20026 {
20027 // Instance Methods
20028
20029 /**
20030 * Represents a Role on the AV server. Roles represent groupings of
20031 * Users for the purposes of granting permissions (e.g. specifying an ACL
20032 * for an Object). Roles are specified by their sets of child users and
20033 * child roles, all of which are granted any permissions that the parent
20034 * role has.
20035 *
20036 * <p>Roles must have a name (which cannot be changed after creation of the
20037 * role), and must specify an ACL.</p>
20038 * An AV.Role is a local representation of a role persisted to the AV
20039 * cloud.
20040 * @class AV.Role
20041 * @param {String} name The name of the Role to create.
20042 * @param {AV.ACL} acl The ACL for this role.
20043 */
20044 constructor: function constructor(name, acl) {
20045 if (_.isString(name)) {
20046 AV.Object.prototype.constructor.call(this, null, null);
20047 this.setName(name);
20048 } else {
20049 AV.Object.prototype.constructor.call(this, name, acl);
20050 }
20051
20052 if (acl) {
20053 if (!(acl instanceof AV.ACL)) {
20054 throw new TypeError('acl must be an instance of AV.ACL');
20055 } else {
20056 this.setACL(acl);
20057 }
20058 }
20059 },
20060
20061 /**
20062 * Gets the name of the role. You can alternatively call role.get("name")
20063 *
20064 * @return {String} the name of the role.
20065 */
20066 getName: function getName() {
20067 return this.get('name');
20068 },
20069
20070 /**
20071 * Sets the name for a role. This value must be set before the role has
20072 * been saved to the server, and cannot be set once the role has been
20073 * saved.
20074 *
20075 * <p>
20076 * A role's name can only contain alphanumeric characters, _, -, and
20077 * spaces.
20078 * </p>
20079 *
20080 * <p>This is equivalent to calling role.set("name", name)</p>
20081 *
20082 * @param {String} name The name of the role.
20083 */
20084 setName: function setName(name, options) {
20085 return this.set('name', name, options);
20086 },
20087
20088 /**
20089 * Gets the AV.Relation for the AV.Users that are direct
20090 * children of this role. These users are granted any privileges that this
20091 * role has been granted (e.g. read or write access through ACLs). You can
20092 * add or remove users from the role through this relation.
20093 *
20094 * <p>This is equivalent to calling role.relation("users")</p>
20095 *
20096 * @return {AV.Relation} the relation for the users belonging to this
20097 * role.
20098 */
20099 getUsers: function getUsers() {
20100 return this.relation('users');
20101 },
20102
20103 /**
20104 * Gets the AV.Relation for the AV.Roles that are direct
20105 * children of this role. These roles' users are granted any privileges that
20106 * this role has been granted (e.g. read or write access through ACLs). You
20107 * can add or remove child roles from this role through this relation.
20108 *
20109 * <p>This is equivalent to calling role.relation("roles")</p>
20110 *
20111 * @return {AV.Relation} the relation for the roles belonging to this
20112 * role.
20113 */
20114 getRoles: function getRoles() {
20115 return this.relation('roles');
20116 },
20117
20118 /**
20119 * @ignore
20120 */
20121 validate: function validate(attrs, options) {
20122 if ('name' in attrs && attrs.name !== this.getName()) {
20123 var newName = attrs.name;
20124
20125 if (this.id && this.id !== attrs.objectId) {
20126 // Check to see if the objectId being set matches this.id.
20127 // This happens during a fetch -- the id is set before calling fetch.
20128 // Let the name be set in this case.
20129 return new AVError(AVError.OTHER_CAUSE, "A role's name can only be set before it has been saved.");
20130 }
20131
20132 if (!_.isString(newName)) {
20133 return new AVError(AVError.OTHER_CAUSE, "A role's name must be a String.");
20134 }
20135
20136 if (!/^[0-9a-zA-Z\-_ ]+$/.test(newName)) {
20137 return new AVError(AVError.OTHER_CAUSE, "A role's name can only contain alphanumeric characters, _," + ' -, and spaces.');
20138 }
20139 }
20140
20141 if (AV.Object.prototype.validate) {
20142 return AV.Object.prototype.validate.call(this, attrs, options);
20143 }
20144
20145 return false;
20146 }
20147 });
20148};
20149
20150/***/ }),
20151/* 558 */
20152/***/ (function(module, exports, __webpack_require__) {
20153
20154"use strict";
20155
20156
20157var _interopRequireDefault = __webpack_require__(1);
20158
20159var _defineProperty2 = _interopRequireDefault(__webpack_require__(559));
20160
20161var _promise = _interopRequireDefault(__webpack_require__(12));
20162
20163var _map = _interopRequireDefault(__webpack_require__(35));
20164
20165var _find = _interopRequireDefault(__webpack_require__(93));
20166
20167var _stringify = _interopRequireDefault(__webpack_require__(36));
20168
20169var _ = __webpack_require__(3);
20170
20171var uuid = __webpack_require__(233);
20172
20173var AVError = __webpack_require__(46);
20174
20175var _require = __webpack_require__(27),
20176 AVRequest = _require._request,
20177 request = _require.request;
20178
20179var _require2 = __webpack_require__(72),
20180 getAdapter = _require2.getAdapter;
20181
20182var PLATFORM_ANONYMOUS = 'anonymous';
20183var PLATFORM_QQAPP = 'lc_qqapp';
20184
20185var mergeUnionDataIntoAuthData = function mergeUnionDataIntoAuthData() {
20186 var defaultUnionIdPlatform = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'weixin';
20187 return function (authData, unionId) {
20188 var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
20189 _ref$unionIdPlatform = _ref.unionIdPlatform,
20190 unionIdPlatform = _ref$unionIdPlatform === void 0 ? defaultUnionIdPlatform : _ref$unionIdPlatform,
20191 _ref$asMainAccount = _ref.asMainAccount,
20192 asMainAccount = _ref$asMainAccount === void 0 ? false : _ref$asMainAccount;
20193
20194 if (typeof unionId !== 'string') throw new AVError(AVError.OTHER_CAUSE, 'unionId is not a string');
20195 if (typeof unionIdPlatform !== 'string') throw new AVError(AVError.OTHER_CAUSE, 'unionIdPlatform is not a string');
20196 return _.extend({}, authData, {
20197 platform: unionIdPlatform,
20198 unionid: unionId,
20199 main_account: Boolean(asMainAccount)
20200 });
20201 };
20202};
20203
20204module.exports = function (AV) {
20205 /**
20206 * @class
20207 *
20208 * <p>An AV.User object is a local representation of a user persisted to the
20209 * LeanCloud server. This class is a subclass of an AV.Object, and retains the
20210 * same functionality of an AV.Object, but also extends it with various
20211 * user specific methods, like authentication, signing up, and validation of
20212 * uniqueness.</p>
20213 */
20214 AV.User = AV.Object.extend('_User',
20215 /** @lends AV.User.prototype */
20216 {
20217 // Instance Variables
20218 _isCurrentUser: false,
20219 // Instance Methods
20220
20221 /**
20222 * Internal method to handle special fields in a _User response.
20223 * @private
20224 */
20225 _mergeMagicFields: function _mergeMagicFields(attrs) {
20226 if (attrs.sessionToken) {
20227 this._sessionToken = attrs.sessionToken;
20228 delete attrs.sessionToken;
20229 }
20230
20231 return AV.User.__super__._mergeMagicFields.call(this, attrs);
20232 },
20233
20234 /**
20235 * Removes null values from authData (which exist temporarily for
20236 * unlinking)
20237 * @private
20238 */
20239 _cleanupAuthData: function _cleanupAuthData() {
20240 if (!this.isCurrent()) {
20241 return;
20242 }
20243
20244 var authData = this.get('authData');
20245
20246 if (!authData) {
20247 return;
20248 }
20249
20250 AV._objectEach(this.get('authData'), function (value, key) {
20251 if (!authData[key]) {
20252 delete authData[key];
20253 }
20254 });
20255 },
20256
20257 /**
20258 * Synchronizes authData for all providers.
20259 * @private
20260 */
20261 _synchronizeAllAuthData: function _synchronizeAllAuthData() {
20262 var authData = this.get('authData');
20263
20264 if (!authData) {
20265 return;
20266 }
20267
20268 var self = this;
20269
20270 AV._objectEach(this.get('authData'), function (value, key) {
20271 self._synchronizeAuthData(key);
20272 });
20273 },
20274
20275 /**
20276 * Synchronizes auth data for a provider (e.g. puts the access token in the
20277 * right place to be used by the Facebook SDK).
20278 * @private
20279 */
20280 _synchronizeAuthData: function _synchronizeAuthData(provider) {
20281 if (!this.isCurrent()) {
20282 return;
20283 }
20284
20285 var authType;
20286
20287 if (_.isString(provider)) {
20288 authType = provider;
20289 provider = AV.User._authProviders[authType];
20290 } else {
20291 authType = provider.getAuthType();
20292 }
20293
20294 var authData = this.get('authData');
20295
20296 if (!authData || !provider) {
20297 return;
20298 }
20299
20300 var success = provider.restoreAuthentication(authData[authType]);
20301
20302 if (!success) {
20303 this.dissociateAuthData(provider);
20304 }
20305 },
20306 _handleSaveResult: function _handleSaveResult(makeCurrent) {
20307 // Clean up and synchronize the authData object, removing any unset values
20308 if (makeCurrent && !AV._config.disableCurrentUser) {
20309 this._isCurrentUser = true;
20310 }
20311
20312 this._cleanupAuthData();
20313
20314 this._synchronizeAllAuthData(); // Don't keep the password around.
20315
20316
20317 delete this._serverData.password;
20318
20319 this._rebuildEstimatedDataForKey('password');
20320
20321 this._refreshCache();
20322
20323 if ((makeCurrent || this.isCurrent()) && !AV._config.disableCurrentUser) {
20324 // Some old version of leanengine-node-sdk will overwrite
20325 // AV.User._saveCurrentUser which returns no Promise.
20326 // So we need a Promise wrapper.
20327 return _promise.default.resolve(AV.User._saveCurrentUser(this));
20328 } else {
20329 return _promise.default.resolve();
20330 }
20331 },
20332
20333 /**
20334 * Unlike in the Android/iOS SDKs, logInWith is unnecessary, since you can
20335 * call linkWith on the user (even if it doesn't exist yet on the server).
20336 * @private
20337 */
20338 _linkWith: function _linkWith(provider, data) {
20339 var _this = this;
20340
20341 var _ref2 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
20342 _ref2$failOnNotExist = _ref2.failOnNotExist,
20343 failOnNotExist = _ref2$failOnNotExist === void 0 ? false : _ref2$failOnNotExist,
20344 useMasterKey = _ref2.useMasterKey,
20345 sessionToken = _ref2.sessionToken,
20346 user = _ref2.user;
20347
20348 var authType;
20349
20350 if (_.isString(provider)) {
20351 authType = provider;
20352 provider = AV.User._authProviders[provider];
20353 } else {
20354 authType = provider.getAuthType();
20355 }
20356
20357 if (data) {
20358 return this.save({
20359 authData: (0, _defineProperty2.default)({}, authType, data)
20360 }, {
20361 useMasterKey: useMasterKey,
20362 sessionToken: sessionToken,
20363 user: user,
20364 fetchWhenSave: !!this.get('authData'),
20365 _failOnNotExist: failOnNotExist
20366 }).then(function (model) {
20367 return model._handleSaveResult(true).then(function () {
20368 return model;
20369 });
20370 });
20371 } else {
20372 return provider.authenticate().then(function (result) {
20373 return _this._linkWith(provider, result);
20374 });
20375 }
20376 },
20377
20378 /**
20379 * Associate the user with a third party authData.
20380 * @since 3.3.0
20381 * @param {Object} authData The response json data returned from third party token, maybe like { openid: 'abc123', access_token: '123abc', expires_in: 1382686496 }
20382 * @param {string} platform Available platform for sign up.
20383 * @return {Promise<AV.User>} A promise that is fulfilled with the user when completed.
20384 * @example user.associateWithAuthData({
20385 * openid: 'abc123',
20386 * access_token: '123abc',
20387 * expires_in: 1382686496
20388 * }, 'weixin').then(function(user) {
20389 * //Access user here
20390 * }).catch(function(error) {
20391 * //console.error("error: ", error);
20392 * });
20393 */
20394 associateWithAuthData: function associateWithAuthData(authData, platform) {
20395 return this._linkWith(platform, authData);
20396 },
20397
20398 /**
20399 * Associate the user with a third party authData and unionId.
20400 * @since 3.5.0
20401 * @param {Object} authData The response json data returned from third party token, maybe like { openid: 'abc123', access_token: '123abc', expires_in: 1382686496 }
20402 * @param {string} platform Available platform for sign up.
20403 * @param {string} unionId
20404 * @param {Object} [unionLoginOptions]
20405 * @param {string} [unionLoginOptions.unionIdPlatform = 'weixin'] unionId platform
20406 * @param {boolean} [unionLoginOptions.asMainAccount = false] If true, the unionId will be associated with the user.
20407 * @return {Promise<AV.User>} A promise that is fulfilled with the user when completed.
20408 * @example user.associateWithAuthDataAndUnionId({
20409 * openid: 'abc123',
20410 * access_token: '123abc',
20411 * expires_in: 1382686496
20412 * }, 'weixin', 'union123', {
20413 * unionIdPlatform: 'weixin',
20414 * asMainAccount: true,
20415 * }).then(function(user) {
20416 * //Access user here
20417 * }).catch(function(error) {
20418 * //console.error("error: ", error);
20419 * });
20420 */
20421 associateWithAuthDataAndUnionId: function associateWithAuthDataAndUnionId(authData, platform, unionId, unionOptions) {
20422 return this._linkWith(platform, mergeUnionDataIntoAuthData()(authData, unionId, unionOptions));
20423 },
20424
20425 /**
20426 * Associate the user with the identity of the current mini-app.
20427 * @since 4.6.0
20428 * @param {Object} [authInfo]
20429 * @param {Object} [option]
20430 * @param {Boolean} [option.failOnNotExist] If true, the login request will fail when no user matches this authInfo.authData exists.
20431 * @return {Promise<AV.User>}
20432 */
20433 associateWithMiniApp: function associateWithMiniApp(authInfo, option) {
20434 var _this2 = this;
20435
20436 if (authInfo === undefined) {
20437 var getAuthInfo = getAdapter('getAuthInfo');
20438 return getAuthInfo().then(function (authInfo) {
20439 return _this2._linkWith(authInfo.provider, authInfo.authData, option);
20440 });
20441 }
20442
20443 return this._linkWith(authInfo.provider, authInfo.authData, option);
20444 },
20445
20446 /**
20447 * 将用户与 QQ 小程序用户进行关联。适用于为已经在用户系统中存在的用户关联当前使用 QQ 小程序的微信帐号。
20448 * 仅在 QQ 小程序中可用。
20449 *
20450 * @deprecated Please use {@link AV.User#associateWithMiniApp}
20451 * @since 4.2.0
20452 * @param {Object} [options]
20453 * @param {boolean} [options.preferUnionId = false] 如果服务端在登录时获取到了用户的 UnionId,是否将 UnionId 保存在用户账号中。
20454 * @param {string} [options.unionIdPlatform = 'qq'] (only take effect when preferUnionId) unionId platform
20455 * @param {boolean} [options.asMainAccount = true] (only take effect when preferUnionId) If true, the unionId will be associated with the user.
20456 * @return {Promise<AV.User>}
20457 */
20458 associateWithQQApp: function associateWithQQApp() {
20459 var _this3 = this;
20460
20461 var _ref3 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
20462 _ref3$preferUnionId = _ref3.preferUnionId,
20463 preferUnionId = _ref3$preferUnionId === void 0 ? false : _ref3$preferUnionId,
20464 _ref3$unionIdPlatform = _ref3.unionIdPlatform,
20465 unionIdPlatform = _ref3$unionIdPlatform === void 0 ? 'qq' : _ref3$unionIdPlatform,
20466 _ref3$asMainAccount = _ref3.asMainAccount,
20467 asMainAccount = _ref3$asMainAccount === void 0 ? true : _ref3$asMainAccount;
20468
20469 var getAuthInfo = getAdapter('getAuthInfo');
20470 return getAuthInfo({
20471 preferUnionId: preferUnionId,
20472 asMainAccount: asMainAccount,
20473 platform: unionIdPlatform
20474 }).then(function (authInfo) {
20475 authInfo.provider = PLATFORM_QQAPP;
20476 return _this3.associateWithMiniApp(authInfo);
20477 });
20478 },
20479
20480 /**
20481 * 将用户与微信小程序用户进行关联。适用于为已经在用户系统中存在的用户关联当前使用微信小程序的微信帐号。
20482 * 仅在微信小程序中可用。
20483 *
20484 * @deprecated Please use {@link AV.User#associateWithMiniApp}
20485 * @since 3.13.0
20486 * @param {Object} [options]
20487 * @param {boolean} [options.preferUnionId = false] 当用户满足 {@link https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/union-id.html 获取 UnionId 的条件} 时,是否将 UnionId 保存在用户账号中。
20488 * @param {string} [options.unionIdPlatform = 'weixin'] (only take effect when preferUnionId) unionId platform
20489 * @param {boolean} [options.asMainAccount = true] (only take effect when preferUnionId) If true, the unionId will be associated with the user.
20490 * @return {Promise<AV.User>}
20491 */
20492 associateWithWeapp: function associateWithWeapp() {
20493 var _this4 = this;
20494
20495 var _ref4 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
20496 _ref4$preferUnionId = _ref4.preferUnionId,
20497 preferUnionId = _ref4$preferUnionId === void 0 ? false : _ref4$preferUnionId,
20498 _ref4$unionIdPlatform = _ref4.unionIdPlatform,
20499 unionIdPlatform = _ref4$unionIdPlatform === void 0 ? 'weixin' : _ref4$unionIdPlatform,
20500 _ref4$asMainAccount = _ref4.asMainAccount,
20501 asMainAccount = _ref4$asMainAccount === void 0 ? true : _ref4$asMainAccount;
20502
20503 var getAuthInfo = getAdapter('getAuthInfo');
20504 return getAuthInfo({
20505 preferUnionId: preferUnionId,
20506 asMainAccount: asMainAccount,
20507 platform: unionIdPlatform
20508 }).then(function (authInfo) {
20509 return _this4.associateWithMiniApp(authInfo);
20510 });
20511 },
20512
20513 /**
20514 * @deprecated renamed to {@link AV.User#associateWithWeapp}
20515 * @return {Promise<AV.User>}
20516 */
20517 linkWithWeapp: function linkWithWeapp(options) {
20518 console.warn('DEPRECATED: User#linkWithWeapp 已废弃,请使用 User#associateWithWeapp 代替');
20519 return this.associateWithWeapp(options);
20520 },
20521
20522 /**
20523 * 将用户与 QQ 小程序用户进行关联。适用于为已经在用户系统中存在的用户关联当前使用 QQ 小程序的 QQ 帐号。
20524 * 仅在 QQ 小程序中可用。
20525 *
20526 * @deprecated Please use {@link AV.User#associateWithMiniApp}
20527 * @since 4.2.0
20528 * @param {string} unionId
20529 * @param {Object} [unionOptions]
20530 * @param {string} [unionOptions.unionIdPlatform = 'qq'] unionId platform
20531 * @param {boolean} [unionOptions.asMainAccount = false] If true, the unionId will be associated with the user.
20532 * @return {Promise<AV.User>}
20533 */
20534 associateWithQQAppWithUnionId: function associateWithQQAppWithUnionId(unionId) {
20535 var _this5 = this;
20536
20537 var _ref5 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
20538 _ref5$unionIdPlatform = _ref5.unionIdPlatform,
20539 unionIdPlatform = _ref5$unionIdPlatform === void 0 ? 'qq' : _ref5$unionIdPlatform,
20540 _ref5$asMainAccount = _ref5.asMainAccount,
20541 asMainAccount = _ref5$asMainAccount === void 0 ? false : _ref5$asMainAccount;
20542
20543 var getAuthInfo = getAdapter('getAuthInfo');
20544 return getAuthInfo({
20545 platform: unionIdPlatform
20546 }).then(function (authInfo) {
20547 authInfo = AV.User.mergeUnionId(authInfo, unionId, {
20548 asMainAccount: asMainAccount
20549 });
20550 authInfo.provider = PLATFORM_QQAPP;
20551 return _this5.associateWithMiniApp(authInfo);
20552 });
20553 },
20554
20555 /**
20556 * 将用户与微信小程序用户进行关联。适用于为已经在用户系统中存在的用户关联当前使用微信小程序的微信帐号。
20557 * 仅在微信小程序中可用。
20558 *
20559 * @deprecated Please use {@link AV.User#associateWithMiniApp}
20560 * @since 3.13.0
20561 * @param {string} unionId
20562 * @param {Object} [unionOptions]
20563 * @param {string} [unionOptions.unionIdPlatform = 'weixin'] unionId platform
20564 * @param {boolean} [unionOptions.asMainAccount = false] If true, the unionId will be associated with the user.
20565 * @return {Promise<AV.User>}
20566 */
20567 associateWithWeappWithUnionId: function associateWithWeappWithUnionId(unionId) {
20568 var _this6 = this;
20569
20570 var _ref6 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
20571 _ref6$unionIdPlatform = _ref6.unionIdPlatform,
20572 unionIdPlatform = _ref6$unionIdPlatform === void 0 ? 'weixin' : _ref6$unionIdPlatform,
20573 _ref6$asMainAccount = _ref6.asMainAccount,
20574 asMainAccount = _ref6$asMainAccount === void 0 ? false : _ref6$asMainAccount;
20575
20576 var getAuthInfo = getAdapter('getAuthInfo');
20577 return getAuthInfo({
20578 platform: unionIdPlatform
20579 }).then(function (authInfo) {
20580 authInfo = AV.User.mergeUnionId(authInfo, unionId, {
20581 asMainAccount: asMainAccount
20582 });
20583 return _this6.associateWithMiniApp(authInfo);
20584 });
20585 },
20586
20587 /**
20588 * Unlinks a user from a service.
20589 * @param {string} platform
20590 * @return {Promise<AV.User>}
20591 * @since 3.3.0
20592 */
20593 dissociateAuthData: function dissociateAuthData(provider) {
20594 this.unset("authData.".concat(provider));
20595 return this.save().then(function (model) {
20596 return model._handleSaveResult(true).then(function () {
20597 return model;
20598 });
20599 });
20600 },
20601
20602 /**
20603 * @private
20604 * @deprecated
20605 */
20606 _unlinkFrom: function _unlinkFrom(provider) {
20607 console.warn('DEPRECATED: User#_unlinkFrom 已废弃,请使用 User#dissociateAuthData 代替');
20608 return this.dissociateAuthData(provider);
20609 },
20610
20611 /**
20612 * Checks whether a user is linked to a service.
20613 * @private
20614 */
20615 _isLinked: function _isLinked(provider) {
20616 var authType;
20617
20618 if (_.isString(provider)) {
20619 authType = provider;
20620 } else {
20621 authType = provider.getAuthType();
20622 }
20623
20624 var authData = this.get('authData') || {};
20625 return !!authData[authType];
20626 },
20627
20628 /**
20629 * Checks whether a user is anonymous.
20630 * @since 3.9.0
20631 * @return {boolean}
20632 */
20633 isAnonymous: function isAnonymous() {
20634 return this._isLinked(PLATFORM_ANONYMOUS);
20635 },
20636 logOut: function logOut() {
20637 this._logOutWithAll();
20638
20639 this._isCurrentUser = false;
20640 },
20641
20642 /**
20643 * Deauthenticates all providers.
20644 * @private
20645 */
20646 _logOutWithAll: function _logOutWithAll() {
20647 var authData = this.get('authData');
20648
20649 if (!authData) {
20650 return;
20651 }
20652
20653 var self = this;
20654
20655 AV._objectEach(this.get('authData'), function (value, key) {
20656 self._logOutWith(key);
20657 });
20658 },
20659
20660 /**
20661 * Deauthenticates a single provider (e.g. removing access tokens from the
20662 * Facebook SDK).
20663 * @private
20664 */
20665 _logOutWith: function _logOutWith(provider) {
20666 if (!this.isCurrent()) {
20667 return;
20668 }
20669
20670 if (_.isString(provider)) {
20671 provider = AV.User._authProviders[provider];
20672 }
20673
20674 if (provider && provider.deauthenticate) {
20675 provider.deauthenticate();
20676 }
20677 },
20678
20679 /**
20680 * Signs up a new user. You should call this instead of save for
20681 * new AV.Users. This will create a new AV.User on the server, and
20682 * also persist the session on disk so that you can access the user using
20683 * <code>current</code>.
20684 *
20685 * <p>A username and password must be set before calling signUp.</p>
20686 *
20687 * @param {Object} attrs Extra fields to set on the new user, or null.
20688 * @param {AuthOptions} options
20689 * @return {Promise} A promise that is fulfilled when the signup
20690 * finishes.
20691 * @see AV.User.signUp
20692 */
20693 signUp: function signUp(attrs, options) {
20694 var error;
20695 var username = attrs && attrs.username || this.get('username');
20696
20697 if (!username || username === '') {
20698 error = new AVError(AVError.OTHER_CAUSE, 'Cannot sign up user with an empty name.');
20699 throw error;
20700 }
20701
20702 var password = attrs && attrs.password || this.get('password');
20703
20704 if (!password || password === '') {
20705 error = new AVError(AVError.OTHER_CAUSE, 'Cannot sign up user with an empty password.');
20706 throw error;
20707 }
20708
20709 return this.save(attrs, options).then(function (model) {
20710 if (model.isAnonymous()) {
20711 model.unset("authData.".concat(PLATFORM_ANONYMOUS));
20712 model._opSetQueue = [{}];
20713 }
20714
20715 return model._handleSaveResult(true).then(function () {
20716 return model;
20717 });
20718 });
20719 },
20720
20721 /**
20722 * Signs up a new user with mobile phone and sms code.
20723 * You should call this instead of save for
20724 * new AV.Users. This will create a new AV.User on the server, and
20725 * also persist the session on disk so that you can access the user using
20726 * <code>current</code>.
20727 *
20728 * <p>A username and password must be set before calling signUp.</p>
20729 *
20730 * @param {Object} attrs Extra fields to set on the new user, or null.
20731 * @param {AuthOptions} options
20732 * @return {Promise} A promise that is fulfilled when the signup
20733 * finishes.
20734 * @see AV.User.signUpOrlogInWithMobilePhone
20735 * @see AV.Cloud.requestSmsCode
20736 */
20737 signUpOrlogInWithMobilePhone: function signUpOrlogInWithMobilePhone(attrs) {
20738 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
20739 var error;
20740 var mobilePhoneNumber = attrs && attrs.mobilePhoneNumber || this.get('mobilePhoneNumber');
20741
20742 if (!mobilePhoneNumber || mobilePhoneNumber === '') {
20743 error = new AVError(AVError.OTHER_CAUSE, 'Cannot sign up or login user by mobilePhoneNumber ' + 'with an empty mobilePhoneNumber.');
20744 throw error;
20745 }
20746
20747 var smsCode = attrs && attrs.smsCode || this.get('smsCode');
20748
20749 if (!smsCode || smsCode === '') {
20750 error = new AVError(AVError.OTHER_CAUSE, 'Cannot sign up or login user by mobilePhoneNumber ' + 'with an empty smsCode.');
20751 throw error;
20752 }
20753
20754 options._makeRequest = function (route, className, id, method, json) {
20755 return AVRequest('usersByMobilePhone', null, null, 'POST', json);
20756 };
20757
20758 return this.save(attrs, options).then(function (model) {
20759 delete model.attributes.smsCode;
20760 delete model._serverData.smsCode;
20761 return model._handleSaveResult(true).then(function () {
20762 return model;
20763 });
20764 });
20765 },
20766
20767 /**
20768 * The same with {@link AV.User.loginWithAuthData}, except that you can set attributes before login.
20769 * @since 3.7.0
20770 */
20771 loginWithAuthData: function loginWithAuthData(authData, platform, options) {
20772 return this._linkWith(platform, authData, options);
20773 },
20774
20775 /**
20776 * The same with {@link AV.User.loginWithAuthDataAndUnionId}, except that you can set attributes before login.
20777 * @since 3.7.0
20778 */
20779 loginWithAuthDataAndUnionId: function loginWithAuthDataAndUnionId(authData, platform, unionId, unionLoginOptions) {
20780 return this.loginWithAuthData(mergeUnionDataIntoAuthData()(authData, unionId, unionLoginOptions), platform, unionLoginOptions);
20781 },
20782
20783 /**
20784 * The same with {@link AV.User.loginWithWeapp}, except that you can set attributes before login.
20785 * @deprecated please use {@link AV.User#loginWithMiniApp}
20786 * @since 3.7.0
20787 * @param {Object} [options]
20788 * @param {boolean} [options.failOnNotExist] If true, the login request will fail when no user matches this authData exists.
20789 * @param {boolean} [options.preferUnionId] 当用户满足 {@link https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/union-id.html 获取 UnionId 的条件} 时,是否使用 UnionId 登录。(since 3.13.0)
20790 * @param {string} [options.unionIdPlatform = 'weixin'] (only take effect when preferUnionId) unionId platform
20791 * @param {boolean} [options.asMainAccount = true] (only take effect when preferUnionId) If true, the unionId will be associated with the user.
20792 * @return {Promise<AV.User>}
20793 */
20794 loginWithWeapp: function loginWithWeapp() {
20795 var _this7 = this;
20796
20797 var _ref7 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
20798 _ref7$preferUnionId = _ref7.preferUnionId,
20799 preferUnionId = _ref7$preferUnionId === void 0 ? false : _ref7$preferUnionId,
20800 _ref7$unionIdPlatform = _ref7.unionIdPlatform,
20801 unionIdPlatform = _ref7$unionIdPlatform === void 0 ? 'weixin' : _ref7$unionIdPlatform,
20802 _ref7$asMainAccount = _ref7.asMainAccount,
20803 asMainAccount = _ref7$asMainAccount === void 0 ? true : _ref7$asMainAccount,
20804 _ref7$failOnNotExist = _ref7.failOnNotExist,
20805 failOnNotExist = _ref7$failOnNotExist === void 0 ? false : _ref7$failOnNotExist,
20806 useMasterKey = _ref7.useMasterKey,
20807 sessionToken = _ref7.sessionToken,
20808 user = _ref7.user;
20809
20810 var getAuthInfo = getAdapter('getAuthInfo');
20811 return getAuthInfo({
20812 preferUnionId: preferUnionId,
20813 asMainAccount: asMainAccount,
20814 platform: unionIdPlatform
20815 }).then(function (authInfo) {
20816 return _this7.loginWithMiniApp(authInfo, {
20817 failOnNotExist: failOnNotExist,
20818 useMasterKey: useMasterKey,
20819 sessionToken: sessionToken,
20820 user: user
20821 });
20822 });
20823 },
20824
20825 /**
20826 * The same with {@link AV.User.loginWithWeappWithUnionId}, except that you can set attributes before login.
20827 * @deprecated please use {@link AV.User#loginWithMiniApp}
20828 * @since 3.13.0
20829 */
20830 loginWithWeappWithUnionId: function loginWithWeappWithUnionId(unionId) {
20831 var _this8 = this;
20832
20833 var _ref8 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
20834 _ref8$unionIdPlatform = _ref8.unionIdPlatform,
20835 unionIdPlatform = _ref8$unionIdPlatform === void 0 ? 'weixin' : _ref8$unionIdPlatform,
20836 _ref8$asMainAccount = _ref8.asMainAccount,
20837 asMainAccount = _ref8$asMainAccount === void 0 ? false : _ref8$asMainAccount,
20838 _ref8$failOnNotExist = _ref8.failOnNotExist,
20839 failOnNotExist = _ref8$failOnNotExist === void 0 ? false : _ref8$failOnNotExist,
20840 useMasterKey = _ref8.useMasterKey,
20841 sessionToken = _ref8.sessionToken,
20842 user = _ref8.user;
20843
20844 var getAuthInfo = getAdapter('getAuthInfo');
20845 return getAuthInfo({
20846 platform: unionIdPlatform
20847 }).then(function (authInfo) {
20848 authInfo = AV.User.mergeUnionId(authInfo, unionId, {
20849 asMainAccount: asMainAccount
20850 });
20851 return _this8.loginWithMiniApp(authInfo, {
20852 failOnNotExist: failOnNotExist,
20853 useMasterKey: useMasterKey,
20854 sessionToken: sessionToken,
20855 user: user
20856 });
20857 });
20858 },
20859
20860 /**
20861 * The same with {@link AV.User.loginWithQQApp}, except that you can set attributes before login.
20862 * @deprecated please use {@link AV.User#loginWithMiniApp}
20863 * @since 4.2.0
20864 * @param {Object} [options]
20865 * @param {boolean} [options.failOnNotExist] If true, the login request will fail when no user matches this authData exists.
20866 * @param {boolean} [options.preferUnionId] 如果服务端在登录时获取到了用户的 UnionId,是否将 UnionId 保存在用户账号中。
20867 * @param {string} [options.unionIdPlatform = 'qq'] (only take effect when preferUnionId) unionId platform
20868 * @param {boolean} [options.asMainAccount = true] (only take effect when preferUnionId) If true, the unionId will be associated with the user.
20869 */
20870 loginWithQQApp: function loginWithQQApp() {
20871 var _this9 = this;
20872
20873 var _ref9 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
20874 _ref9$preferUnionId = _ref9.preferUnionId,
20875 preferUnionId = _ref9$preferUnionId === void 0 ? false : _ref9$preferUnionId,
20876 _ref9$unionIdPlatform = _ref9.unionIdPlatform,
20877 unionIdPlatform = _ref9$unionIdPlatform === void 0 ? 'qq' : _ref9$unionIdPlatform,
20878 _ref9$asMainAccount = _ref9.asMainAccount,
20879 asMainAccount = _ref9$asMainAccount === void 0 ? true : _ref9$asMainAccount,
20880 _ref9$failOnNotExist = _ref9.failOnNotExist,
20881 failOnNotExist = _ref9$failOnNotExist === void 0 ? false : _ref9$failOnNotExist,
20882 useMasterKey = _ref9.useMasterKey,
20883 sessionToken = _ref9.sessionToken,
20884 user = _ref9.user;
20885
20886 var getAuthInfo = getAdapter('getAuthInfo');
20887 return getAuthInfo({
20888 preferUnionId: preferUnionId,
20889 asMainAccount: asMainAccount,
20890 platform: unionIdPlatform
20891 }).then(function (authInfo) {
20892 authInfo.provider = PLATFORM_QQAPP;
20893 return _this9.loginWithMiniApp(authInfo, {
20894 failOnNotExist: failOnNotExist,
20895 useMasterKey: useMasterKey,
20896 sessionToken: sessionToken,
20897 user: user
20898 });
20899 });
20900 },
20901
20902 /**
20903 * The same with {@link AV.User.loginWithQQAppWithUnionId}, except that you can set attributes before login.
20904 * @deprecated please use {@link AV.User#loginWithMiniApp}
20905 * @since 4.2.0
20906 */
20907 loginWithQQAppWithUnionId: function loginWithQQAppWithUnionId(unionId) {
20908 var _this10 = this;
20909
20910 var _ref10 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
20911 _ref10$unionIdPlatfor = _ref10.unionIdPlatform,
20912 unionIdPlatform = _ref10$unionIdPlatfor === void 0 ? 'qq' : _ref10$unionIdPlatfor,
20913 _ref10$asMainAccount = _ref10.asMainAccount,
20914 asMainAccount = _ref10$asMainAccount === void 0 ? false : _ref10$asMainAccount,
20915 _ref10$failOnNotExist = _ref10.failOnNotExist,
20916 failOnNotExist = _ref10$failOnNotExist === void 0 ? false : _ref10$failOnNotExist,
20917 useMasterKey = _ref10.useMasterKey,
20918 sessionToken = _ref10.sessionToken,
20919 user = _ref10.user;
20920
20921 var getAuthInfo = getAdapter('getAuthInfo');
20922 return getAuthInfo({
20923 platform: unionIdPlatform
20924 }).then(function (authInfo) {
20925 authInfo = AV.User.mergeUnionId(authInfo, unionId, {
20926 asMainAccount: asMainAccount
20927 });
20928 authInfo.provider = PLATFORM_QQAPP;
20929 return _this10.loginWithMiniApp(authInfo, {
20930 failOnNotExist: failOnNotExist,
20931 useMasterKey: useMasterKey,
20932 sessionToken: sessionToken,
20933 user: user
20934 });
20935 });
20936 },
20937
20938 /**
20939 * The same with {@link AV.User.loginWithMiniApp}, except that you can set attributes before login.
20940 * @since 4.6.0
20941 */
20942 loginWithMiniApp: function loginWithMiniApp(authInfo, option) {
20943 var _this11 = this;
20944
20945 if (authInfo === undefined) {
20946 var getAuthInfo = getAdapter('getAuthInfo');
20947 return getAuthInfo().then(function (authInfo) {
20948 return _this11.loginWithAuthData(authInfo.authData, authInfo.provider, option);
20949 });
20950 }
20951
20952 return this.loginWithAuthData(authInfo.authData, authInfo.provider, option);
20953 },
20954
20955 /**
20956 * Logs in a AV.User. On success, this saves the session to localStorage,
20957 * so you can retrieve the currently logged in user using
20958 * <code>current</code>.
20959 *
20960 * <p>A username and password must be set before calling logIn.</p>
20961 *
20962 * @see AV.User.logIn
20963 * @return {Promise} A promise that is fulfilled with the user when
20964 * the login is complete.
20965 */
20966 logIn: function logIn() {
20967 var model = this;
20968 var request = AVRequest('login', null, null, 'POST', this.toJSON());
20969 return request.then(function (resp) {
20970 var serverAttrs = model.parse(resp);
20971
20972 model._finishFetch(serverAttrs);
20973
20974 return model._handleSaveResult(true).then(function () {
20975 if (!serverAttrs.smsCode) delete model.attributes['smsCode'];
20976 return model;
20977 });
20978 });
20979 },
20980
20981 /**
20982 * @see AV.Object#save
20983 */
20984 save: function save(arg1, arg2, arg3) {
20985 var attrs, options;
20986
20987 if (_.isObject(arg1) || _.isNull(arg1) || _.isUndefined(arg1)) {
20988 attrs = arg1;
20989 options = arg2;
20990 } else {
20991 attrs = {};
20992 attrs[arg1] = arg2;
20993 options = arg3;
20994 }
20995
20996 options = options || {};
20997 return AV.Object.prototype.save.call(this, attrs, options).then(function (model) {
20998 return model._handleSaveResult(false).then(function () {
20999 return model;
21000 });
21001 });
21002 },
21003
21004 /**
21005 * Follow a user
21006 * @since 0.3.0
21007 * @param {Object | AV.User | String} options if an AV.User or string is given, it will be used as the target user.
21008 * @param {AV.User | String} options.user The target user or user's objectId to follow.
21009 * @param {Object} [options.attributes] key-value attributes dictionary to be used as
21010 * conditions of followerQuery/followeeQuery.
21011 * @param {AuthOptions} [authOptions]
21012 */
21013 follow: function follow(options, authOptions) {
21014 if (!this.id) {
21015 throw new Error('Please signin.');
21016 }
21017
21018 var user;
21019 var attributes;
21020
21021 if (options.user) {
21022 user = options.user;
21023 attributes = options.attributes;
21024 } else {
21025 user = options;
21026 }
21027
21028 var userObjectId = _.isString(user) ? user : user.id;
21029
21030 if (!userObjectId) {
21031 throw new Error('Invalid target user.');
21032 }
21033
21034 var route = 'users/' + this.id + '/friendship/' + userObjectId;
21035 var request = AVRequest(route, null, null, 'POST', AV._encode(attributes), authOptions);
21036 return request;
21037 },
21038
21039 /**
21040 * Unfollow a user.
21041 * @since 0.3.0
21042 * @param {Object | AV.User | String} options if an AV.User or string is given, it will be used as the target user.
21043 * @param {AV.User | String} options.user The target user or user's objectId to unfollow.
21044 * @param {AuthOptions} [authOptions]
21045 */
21046 unfollow: function unfollow(options, authOptions) {
21047 if (!this.id) {
21048 throw new Error('Please signin.');
21049 }
21050
21051 var user;
21052
21053 if (options.user) {
21054 user = options.user;
21055 } else {
21056 user = options;
21057 }
21058
21059 var userObjectId = _.isString(user) ? user : user.id;
21060
21061 if (!userObjectId) {
21062 throw new Error('Invalid target user.');
21063 }
21064
21065 var route = 'users/' + this.id + '/friendship/' + userObjectId;
21066 var request = AVRequest(route, null, null, 'DELETE', null, authOptions);
21067 return request;
21068 },
21069
21070 /**
21071 * Get the user's followers and followees.
21072 * @since 4.8.0
21073 * @param {Object} [options]
21074 * @param {Number} [options.skip]
21075 * @param {Number} [options.limit]
21076 * @param {AuthOptions} [authOptions]
21077 */
21078 getFollowersAndFollowees: function getFollowersAndFollowees(options, authOptions) {
21079 if (!this.id) {
21080 throw new Error('Please signin.');
21081 }
21082
21083 return request({
21084 method: 'GET',
21085 path: "/users/".concat(this.id, "/followersAndFollowees"),
21086 query: {
21087 skip: options && options.skip,
21088 limit: options && options.limit,
21089 include: 'follower,followee',
21090 keys: 'follower,followee'
21091 },
21092 authOptions: authOptions
21093 }).then(function (_ref11) {
21094 var followers = _ref11.followers,
21095 followees = _ref11.followees;
21096 return {
21097 followers: (0, _map.default)(followers).call(followers, function (_ref12) {
21098 var follower = _ref12.follower;
21099 return AV._decode(follower);
21100 }),
21101 followees: (0, _map.default)(followees).call(followees, function (_ref13) {
21102 var followee = _ref13.followee;
21103 return AV._decode(followee);
21104 })
21105 };
21106 });
21107 },
21108
21109 /**
21110 *Create a follower query to query the user's followers.
21111 * @since 0.3.0
21112 * @see AV.User#followerQuery
21113 */
21114 followerQuery: function followerQuery() {
21115 return AV.User.followerQuery(this.id);
21116 },
21117
21118 /**
21119 *Create a followee query to query the user's followees.
21120 * @since 0.3.0
21121 * @see AV.User#followeeQuery
21122 */
21123 followeeQuery: function followeeQuery() {
21124 return AV.User.followeeQuery(this.id);
21125 },
21126
21127 /**
21128 * @see AV.Object#fetch
21129 */
21130 fetch: function fetch(fetchOptions, options) {
21131 return AV.Object.prototype.fetch.call(this, fetchOptions, options).then(function (model) {
21132 return model._handleSaveResult(false).then(function () {
21133 return model;
21134 });
21135 });
21136 },
21137
21138 /**
21139 * Update user's new password safely based on old password.
21140 * @param {String} oldPassword the old password.
21141 * @param {String} newPassword the new password.
21142 * @param {AuthOptions} options
21143 */
21144 updatePassword: function updatePassword(oldPassword, newPassword, options) {
21145 var _this12 = this;
21146
21147 var route = 'users/' + this.id + '/updatePassword';
21148 var params = {
21149 old_password: oldPassword,
21150 new_password: newPassword
21151 };
21152 var request = AVRequest(route, null, null, 'PUT', params, options);
21153 return request.then(function (resp) {
21154 _this12._finishFetch(_this12.parse(resp));
21155
21156 return _this12._handleSaveResult(true).then(function () {
21157 return resp;
21158 });
21159 });
21160 },
21161
21162 /**
21163 * Returns true if <code>current</code> would return this user.
21164 * @see AV.User#current
21165 */
21166 isCurrent: function isCurrent() {
21167 return this._isCurrentUser;
21168 },
21169
21170 /**
21171 * Returns get("username").
21172 * @return {String}
21173 * @see AV.Object#get
21174 */
21175 getUsername: function getUsername() {
21176 return this.get('username');
21177 },
21178
21179 /**
21180 * Returns get("mobilePhoneNumber").
21181 * @return {String}
21182 * @see AV.Object#get
21183 */
21184 getMobilePhoneNumber: function getMobilePhoneNumber() {
21185 return this.get('mobilePhoneNumber');
21186 },
21187
21188 /**
21189 * Calls set("mobilePhoneNumber", phoneNumber, options) and returns the result.
21190 * @param {String} mobilePhoneNumber
21191 * @return {Boolean}
21192 * @see AV.Object#set
21193 */
21194 setMobilePhoneNumber: function setMobilePhoneNumber(phone, options) {
21195 return this.set('mobilePhoneNumber', phone, options);
21196 },
21197
21198 /**
21199 * Calls set("username", username, options) and returns the result.
21200 * @param {String} username
21201 * @return {Boolean}
21202 * @see AV.Object#set
21203 */
21204 setUsername: function setUsername(username, options) {
21205 return this.set('username', username, options);
21206 },
21207
21208 /**
21209 * Calls set("password", password, options) and returns the result.
21210 * @param {String} password
21211 * @return {Boolean}
21212 * @see AV.Object#set
21213 */
21214 setPassword: function setPassword(password, options) {
21215 return this.set('password', password, options);
21216 },
21217
21218 /**
21219 * Returns get("email").
21220 * @return {String}
21221 * @see AV.Object#get
21222 */
21223 getEmail: function getEmail() {
21224 return this.get('email');
21225 },
21226
21227 /**
21228 * Calls set("email", email, options) and returns the result.
21229 * @param {String} email
21230 * @param {AuthOptions} options
21231 * @return {Boolean}
21232 * @see AV.Object#set
21233 */
21234 setEmail: function setEmail(email, options) {
21235 return this.set('email', email, options);
21236 },
21237
21238 /**
21239 * Checks whether this user is the current user and has been authenticated.
21240 * @deprecated 如果要判断当前用户的登录状态是否有效,请使用 currentUser.isAuthenticated().then(),
21241 * 如果要判断该用户是否是当前登录用户,请使用 user.id === currentUser.id
21242 * @return (Boolean) whether this user is the current user and is logged in.
21243 */
21244 authenticated: function authenticated() {
21245 console.warn('DEPRECATED: 如果要判断当前用户的登录状态是否有效,请使用 currentUser.isAuthenticated().then(),如果要判断该用户是否是当前登录用户,请使用 user.id === currentUser.id。');
21246 return !!this._sessionToken && !AV._config.disableCurrentUser && AV.User.current() && AV.User.current().id === this.id;
21247 },
21248
21249 /**
21250 * Detects if current sessionToken is valid.
21251 *
21252 * @since 2.0.0
21253 * @return Promise.<Boolean>
21254 */
21255 isAuthenticated: function isAuthenticated() {
21256 var _this13 = this;
21257
21258 return _promise.default.resolve().then(function () {
21259 return !!_this13._sessionToken && AV.User._fetchUserBySessionToken(_this13._sessionToken).then(function () {
21260 return true;
21261 }, function (error) {
21262 if (error.code === 211) {
21263 return false;
21264 }
21265
21266 throw error;
21267 });
21268 });
21269 },
21270
21271 /**
21272 * Get sessionToken of current user.
21273 * @return {String} sessionToken
21274 */
21275 getSessionToken: function getSessionToken() {
21276 return this._sessionToken;
21277 },
21278
21279 /**
21280 * Refresh sessionToken of current user.
21281 * @since 2.1.0
21282 * @param {AuthOptions} [options]
21283 * @return {Promise.<AV.User>} user with refreshed sessionToken
21284 */
21285 refreshSessionToken: function refreshSessionToken(options) {
21286 var _this14 = this;
21287
21288 return AVRequest("users/".concat(this.id, "/refreshSessionToken"), null, null, 'PUT', null, options).then(function (response) {
21289 _this14._finishFetch(response);
21290
21291 return _this14._handleSaveResult(true).then(function () {
21292 return _this14;
21293 });
21294 });
21295 },
21296
21297 /**
21298 * Get this user's Roles.
21299 * @param {AuthOptions} [options]
21300 * @return {Promise.<AV.Role[]>} A promise that is fulfilled with the roles when
21301 * the query is complete.
21302 */
21303 getRoles: function getRoles(options) {
21304 var _context;
21305
21306 return (0, _find.default)(_context = AV.Relation.reverseQuery('_Role', 'users', this)).call(_context, options);
21307 }
21308 },
21309 /** @lends AV.User */
21310 {
21311 // Class Variables
21312 // The currently logged-in user.
21313 _currentUser: null,
21314 // Whether currentUser is known to match the serialized version on disk.
21315 // This is useful for saving a localstorage check if you try to load
21316 // _currentUser frequently while there is none stored.
21317 _currentUserMatchesDisk: false,
21318 // The localStorage key suffix that the current user is stored under.
21319 _CURRENT_USER_KEY: 'currentUser',
21320 // The mapping of auth provider names to actual providers
21321 _authProviders: {},
21322 // Class Methods
21323
21324 /**
21325 * Signs up a new user with a username (or email) and password.
21326 * This will create a new AV.User on the server, and also persist the
21327 * session in localStorage so that you can access the user using
21328 * {@link #current}.
21329 *
21330 * @param {String} username The username (or email) to sign up with.
21331 * @param {String} password The password to sign up with.
21332 * @param {Object} [attrs] Extra fields to set on the new user.
21333 * @param {AuthOptions} [options]
21334 * @return {Promise} A promise that is fulfilled with the user when
21335 * the signup completes.
21336 * @see AV.User#signUp
21337 */
21338 signUp: function signUp(username, password, attrs, options) {
21339 attrs = attrs || {};
21340 attrs.username = username;
21341 attrs.password = password;
21342
21343 var user = AV.Object._create('_User');
21344
21345 return user.signUp(attrs, options);
21346 },
21347
21348 /**
21349 * Logs in a user with a username (or email) and password. On success, this
21350 * saves the session to disk, so you can retrieve the currently logged in
21351 * user using <code>current</code>.
21352 *
21353 * @param {String} username The username (or email) to log in with.
21354 * @param {String} password The password to log in with.
21355 * @return {Promise} A promise that is fulfilled with the user when
21356 * the login completes.
21357 * @see AV.User#logIn
21358 */
21359 logIn: function logIn(username, password) {
21360 var user = AV.Object._create('_User');
21361
21362 user._finishFetch({
21363 username: username,
21364 password: password
21365 });
21366
21367 return user.logIn();
21368 },
21369
21370 /**
21371 * Logs in a user with a session token. On success, this saves the session
21372 * to disk, so you can retrieve the currently logged in user using
21373 * <code>current</code>.
21374 *
21375 * @param {String} sessionToken The sessionToken to log in with.
21376 * @return {Promise} A promise that is fulfilled with the user when
21377 * the login completes.
21378 */
21379 become: function become(sessionToken) {
21380 return this._fetchUserBySessionToken(sessionToken).then(function (user) {
21381 return user._handleSaveResult(true).then(function () {
21382 return user;
21383 });
21384 });
21385 },
21386 _fetchUserBySessionToken: function _fetchUserBySessionToken(sessionToken) {
21387 if (sessionToken === undefined) {
21388 return _promise.default.reject(new Error('The sessionToken cannot be undefined'));
21389 }
21390
21391 var user = AV.Object._create('_User');
21392
21393 return request({
21394 method: 'GET',
21395 path: '/users/me',
21396 authOptions: {
21397 sessionToken: sessionToken
21398 }
21399 }).then(function (resp) {
21400 var serverAttrs = user.parse(resp);
21401
21402 user._finishFetch(serverAttrs);
21403
21404 return user;
21405 });
21406 },
21407
21408 /**
21409 * Logs in a user with a mobile phone number and sms code sent by
21410 * AV.User.requestLoginSmsCode.On success, this
21411 * saves the session to disk, so you can retrieve the currently logged in
21412 * user using <code>current</code>.
21413 *
21414 * @param {String} mobilePhone The user's mobilePhoneNumber
21415 * @param {String} smsCode The sms code sent by AV.User.requestLoginSmsCode
21416 * @return {Promise} A promise that is fulfilled with the user when
21417 * the login completes.
21418 * @see AV.User#logIn
21419 */
21420 logInWithMobilePhoneSmsCode: function logInWithMobilePhoneSmsCode(mobilePhone, smsCode) {
21421 var user = AV.Object._create('_User');
21422
21423 user._finishFetch({
21424 mobilePhoneNumber: mobilePhone,
21425 smsCode: smsCode
21426 });
21427
21428 return user.logIn();
21429 },
21430
21431 /**
21432 * Signs up or logs in a user with a mobilePhoneNumber and smsCode.
21433 * On success, this saves the session to disk, so you can retrieve the currently
21434 * logged in user using <code>current</code>.
21435 *
21436 * @param {String} mobilePhoneNumber The user's mobilePhoneNumber.
21437 * @param {String} smsCode The sms code sent by AV.Cloud.requestSmsCode
21438 * @param {Object} attributes The user's other attributes such as username etc.
21439 * @param {AuthOptions} options
21440 * @return {Promise} A promise that is fulfilled with the user when
21441 * the login completes.
21442 * @see AV.User#signUpOrlogInWithMobilePhone
21443 * @see AV.Cloud.requestSmsCode
21444 */
21445 signUpOrlogInWithMobilePhone: function signUpOrlogInWithMobilePhone(mobilePhoneNumber, smsCode, attrs, options) {
21446 attrs = attrs || {};
21447 attrs.mobilePhoneNumber = mobilePhoneNumber;
21448 attrs.smsCode = smsCode;
21449
21450 var user = AV.Object._create('_User');
21451
21452 return user.signUpOrlogInWithMobilePhone(attrs, options);
21453 },
21454
21455 /**
21456 * Logs in a user with a mobile phone number and password. On success, this
21457 * saves the session to disk, so you can retrieve the currently logged in
21458 * user using <code>current</code>.
21459 *
21460 * @param {String} mobilePhone The user's mobilePhoneNumber
21461 * @param {String} password The password to log in with.
21462 * @return {Promise} A promise that is fulfilled with the user when
21463 * the login completes.
21464 * @see AV.User#logIn
21465 */
21466 logInWithMobilePhone: function logInWithMobilePhone(mobilePhone, password) {
21467 var user = AV.Object._create('_User');
21468
21469 user._finishFetch({
21470 mobilePhoneNumber: mobilePhone,
21471 password: password
21472 });
21473
21474 return user.logIn();
21475 },
21476
21477 /**
21478 * Logs in a user with email and password.
21479 *
21480 * @since 3.13.0
21481 * @param {String} email The user's email.
21482 * @param {String} password The password to log in with.
21483 * @return {Promise} A promise that is fulfilled with the user when
21484 * the login completes.
21485 */
21486 loginWithEmail: function loginWithEmail(email, password) {
21487 var user = AV.Object._create('_User');
21488
21489 user._finishFetch({
21490 email: email,
21491 password: password
21492 });
21493
21494 return user.logIn();
21495 },
21496
21497 /**
21498 * Signs up or logs in a user with a third party auth data(AccessToken).
21499 * On success, this saves the session to disk, so you can retrieve the currently
21500 * logged in user using <code>current</code>.
21501 *
21502 * @since 3.7.0
21503 * @param {Object} authData The response json data returned from third party token, maybe like { openid: 'abc123', access_token: '123abc', expires_in: 1382686496 }
21504 * @param {string} platform Available platform for sign up.
21505 * @param {Object} [options]
21506 * @param {boolean} [options.failOnNotExist] If true, the login request will fail when no user matches this authData exists.
21507 * @return {Promise} A promise that is fulfilled with the user when
21508 * the login completes.
21509 * @example AV.User.loginWithAuthData({
21510 * openid: 'abc123',
21511 * access_token: '123abc',
21512 * expires_in: 1382686496
21513 * }, 'weixin').then(function(user) {
21514 * //Access user here
21515 * }).catch(function(error) {
21516 * //console.error("error: ", error);
21517 * });
21518 * @see {@link https://leancloud.cn/docs/js_guide.html#绑定第三方平台账户}
21519 */
21520 loginWithAuthData: function loginWithAuthData(authData, platform, options) {
21521 return AV.User._logInWith(platform, authData, options);
21522 },
21523
21524 /**
21525 * @deprecated renamed to {@link AV.User.loginWithAuthData}
21526 */
21527 signUpOrlogInWithAuthData: function signUpOrlogInWithAuthData() {
21528 console.warn('DEPRECATED: User.signUpOrlogInWithAuthData 已废弃,请使用 User#loginWithAuthData 代替');
21529 return this.loginWithAuthData.apply(this, arguments);
21530 },
21531
21532 /**
21533 * Signs up or logs in a user with a third party authData and unionId.
21534 * @since 3.7.0
21535 * @param {Object} authData The response json data returned from third party token, maybe like { openid: 'abc123', access_token: '123abc', expires_in: 1382686496 }
21536 * @param {string} platform Available platform for sign up.
21537 * @param {string} unionId
21538 * @param {Object} [unionLoginOptions]
21539 * @param {string} [unionLoginOptions.unionIdPlatform = 'weixin'] unionId platform
21540 * @param {boolean} [unionLoginOptions.asMainAccount = false] If true, the unionId will be associated with the user.
21541 * @param {boolean} [unionLoginOptions.failOnNotExist] If true, the login request will fail when no user matches this authData exists.
21542 * @return {Promise<AV.User>} A promise that is fulfilled with the user when completed.
21543 * @example AV.User.loginWithAuthDataAndUnionId({
21544 * openid: 'abc123',
21545 * access_token: '123abc',
21546 * expires_in: 1382686496
21547 * }, 'weixin', 'union123', {
21548 * unionIdPlatform: 'weixin',
21549 * asMainAccount: true,
21550 * }).then(function(user) {
21551 * //Access user here
21552 * }).catch(function(error) {
21553 * //console.error("error: ", error);
21554 * });
21555 */
21556 loginWithAuthDataAndUnionId: function loginWithAuthDataAndUnionId(authData, platform, unionId, unionLoginOptions) {
21557 return this.loginWithAuthData(mergeUnionDataIntoAuthData()(authData, unionId, unionLoginOptions), platform, unionLoginOptions);
21558 },
21559
21560 /**
21561 * @deprecated renamed to {@link AV.User.loginWithAuthDataAndUnionId}
21562 * @since 3.5.0
21563 */
21564 signUpOrlogInWithAuthDataAndUnionId: function signUpOrlogInWithAuthDataAndUnionId() {
21565 console.warn('DEPRECATED: User.signUpOrlogInWithAuthDataAndUnionId 已废弃,请使用 User#loginWithAuthDataAndUnionId 代替');
21566 return this.loginWithAuthDataAndUnionId.apply(this, arguments);
21567 },
21568
21569 /**
21570 * Merge unionId into authInfo.
21571 * @since 4.6.0
21572 * @param {Object} authInfo
21573 * @param {String} unionId
21574 * @param {Object} [unionIdOption]
21575 * @param {Boolean} [unionIdOption.asMainAccount] If true, the unionId will be associated with the user.
21576 */
21577 mergeUnionId: function mergeUnionId(authInfo, unionId) {
21578 var _ref14 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
21579 _ref14$asMainAccount = _ref14.asMainAccount,
21580 asMainAccount = _ref14$asMainAccount === void 0 ? false : _ref14$asMainAccount;
21581
21582 authInfo = JSON.parse((0, _stringify.default)(authInfo));
21583 var _authInfo = authInfo,
21584 authData = _authInfo.authData,
21585 platform = _authInfo.platform;
21586 authData.platform = platform;
21587 authData.main_account = asMainAccount;
21588 authData.unionid = unionId;
21589 return authInfo;
21590 },
21591
21592 /**
21593 * 使用当前使用微信小程序的微信用户身份注册或登录,成功后用户的 session 会在设备上持久化保存,之后可以使用 AV.User.current() 获取当前登录用户。
21594 * 仅在微信小程序中可用。
21595 *
21596 * @deprecated please use {@link AV.User.loginWithMiniApp}
21597 * @since 2.0.0
21598 * @param {Object} [options]
21599 * @param {boolean} [options.preferUnionId] 当用户满足 {@link https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/union-id.html 获取 UnionId 的条件} 时,是否使用 UnionId 登录。(since 3.13.0)
21600 * @param {string} [options.unionIdPlatform = 'weixin'] (only take effect when preferUnionId) unionId platform
21601 * @param {boolean} [options.asMainAccount = true] (only take effect when preferUnionId) If true, the unionId will be associated with the user.
21602 * @param {boolean} [options.failOnNotExist] If true, the login request will fail when no user matches this authData exists. (since v3.7.0)
21603 * @return {Promise.<AV.User>}
21604 */
21605 loginWithWeapp: function loginWithWeapp() {
21606 var _this15 = this;
21607
21608 var _ref15 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
21609 _ref15$preferUnionId = _ref15.preferUnionId,
21610 preferUnionId = _ref15$preferUnionId === void 0 ? false : _ref15$preferUnionId,
21611 _ref15$unionIdPlatfor = _ref15.unionIdPlatform,
21612 unionIdPlatform = _ref15$unionIdPlatfor === void 0 ? 'weixin' : _ref15$unionIdPlatfor,
21613 _ref15$asMainAccount = _ref15.asMainAccount,
21614 asMainAccount = _ref15$asMainAccount === void 0 ? true : _ref15$asMainAccount,
21615 _ref15$failOnNotExist = _ref15.failOnNotExist,
21616 failOnNotExist = _ref15$failOnNotExist === void 0 ? false : _ref15$failOnNotExist,
21617 useMasterKey = _ref15.useMasterKey,
21618 sessionToken = _ref15.sessionToken,
21619 user = _ref15.user;
21620
21621 var getAuthInfo = getAdapter('getAuthInfo');
21622 return getAuthInfo({
21623 preferUnionId: preferUnionId,
21624 asMainAccount: asMainAccount,
21625 platform: unionIdPlatform
21626 }).then(function (authInfo) {
21627 return _this15.loginWithMiniApp(authInfo, {
21628 failOnNotExist: failOnNotExist,
21629 useMasterKey: useMasterKey,
21630 sessionToken: sessionToken,
21631 user: user
21632 });
21633 });
21634 },
21635
21636 /**
21637 * 使用当前使用微信小程序的微信用户身份注册或登录,
21638 * 仅在微信小程序中可用。
21639 *
21640 * @deprecated please use {@link AV.User.loginWithMiniApp}
21641 * @since 3.13.0
21642 * @param {Object} [unionLoginOptions]
21643 * @param {string} [unionLoginOptions.unionIdPlatform = 'weixin'] unionId platform
21644 * @param {boolean} [unionLoginOptions.asMainAccount = false] If true, the unionId will be associated with the user.
21645 * @param {boolean} [unionLoginOptions.failOnNotExist] If true, the login request will fail when no user matches this authData exists. * @return {Promise.<AV.User>}
21646 */
21647 loginWithWeappWithUnionId: function loginWithWeappWithUnionId(unionId) {
21648 var _this16 = this;
21649
21650 var _ref16 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
21651 _ref16$unionIdPlatfor = _ref16.unionIdPlatform,
21652 unionIdPlatform = _ref16$unionIdPlatfor === void 0 ? 'weixin' : _ref16$unionIdPlatfor,
21653 _ref16$asMainAccount = _ref16.asMainAccount,
21654 asMainAccount = _ref16$asMainAccount === void 0 ? false : _ref16$asMainAccount,
21655 _ref16$failOnNotExist = _ref16.failOnNotExist,
21656 failOnNotExist = _ref16$failOnNotExist === void 0 ? false : _ref16$failOnNotExist,
21657 useMasterKey = _ref16.useMasterKey,
21658 sessionToken = _ref16.sessionToken,
21659 user = _ref16.user;
21660
21661 var getAuthInfo = getAdapter('getAuthInfo');
21662 return getAuthInfo({
21663 platform: unionIdPlatform
21664 }).then(function (authInfo) {
21665 authInfo = AV.User.mergeUnionId(authInfo, unionId, {
21666 asMainAccount: asMainAccount
21667 });
21668 return _this16.loginWithMiniApp(authInfo, {
21669 failOnNotExist: failOnNotExist,
21670 useMasterKey: useMasterKey,
21671 sessionToken: sessionToken,
21672 user: user
21673 });
21674 });
21675 },
21676
21677 /**
21678 * 使用当前使用 QQ 小程序的 QQ 用户身份注册或登录,成功后用户的 session 会在设备上持久化保存,之后可以使用 AV.User.current() 获取当前登录用户。
21679 * 仅在 QQ 小程序中可用。
21680 *
21681 * @deprecated please use {@link AV.User.loginWithMiniApp}
21682 * @since 4.2.0
21683 * @param {Object} [options]
21684 * @param {boolean} [options.preferUnionId] 如果服务端在登录时获取到了用户的 UnionId,是否将 UnionId 保存在用户账号中。
21685 * @param {string} [options.unionIdPlatform = 'qq'] (only take effect when preferUnionId) unionId platform
21686 * @param {boolean} [options.asMainAccount = true] (only take effect when preferUnionId) If true, the unionId will be associated with the user.
21687 * @param {boolean} [options.failOnNotExist] If true, the login request will fail when no user matches this authData exists. (since v3.7.0)
21688 * @return {Promise.<AV.User>}
21689 */
21690 loginWithQQApp: function loginWithQQApp() {
21691 var _this17 = this;
21692
21693 var _ref17 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
21694 _ref17$preferUnionId = _ref17.preferUnionId,
21695 preferUnionId = _ref17$preferUnionId === void 0 ? false : _ref17$preferUnionId,
21696 _ref17$unionIdPlatfor = _ref17.unionIdPlatform,
21697 unionIdPlatform = _ref17$unionIdPlatfor === void 0 ? 'qq' : _ref17$unionIdPlatfor,
21698 _ref17$asMainAccount = _ref17.asMainAccount,
21699 asMainAccount = _ref17$asMainAccount === void 0 ? true : _ref17$asMainAccount,
21700 _ref17$failOnNotExist = _ref17.failOnNotExist,
21701 failOnNotExist = _ref17$failOnNotExist === void 0 ? false : _ref17$failOnNotExist,
21702 useMasterKey = _ref17.useMasterKey,
21703 sessionToken = _ref17.sessionToken,
21704 user = _ref17.user;
21705
21706 var getAuthInfo = getAdapter('getAuthInfo');
21707 return getAuthInfo({
21708 preferUnionId: preferUnionId,
21709 asMainAccount: asMainAccount,
21710 platform: unionIdPlatform
21711 }).then(function (authInfo) {
21712 authInfo.provider = PLATFORM_QQAPP;
21713 return _this17.loginWithMiniApp(authInfo, {
21714 failOnNotExist: failOnNotExist,
21715 useMasterKey: useMasterKey,
21716 sessionToken: sessionToken,
21717 user: user
21718 });
21719 });
21720 },
21721
21722 /**
21723 * 使用当前使用 QQ 小程序的 QQ 用户身份注册或登录,
21724 * 仅在 QQ 小程序中可用。
21725 *
21726 * @deprecated please use {@link AV.User.loginWithMiniApp}
21727 * @since 4.2.0
21728 * @param {Object} [unionLoginOptions]
21729 * @param {string} [unionLoginOptions.unionIdPlatform = 'qq'] unionId platform
21730 * @param {boolean} [unionLoginOptions.asMainAccount = false] If true, the unionId will be associated with the user.
21731 * @param {boolean} [unionLoginOptions.failOnNotExist] If true, the login request will fail when no user matches this authData exists.
21732 * @return {Promise.<AV.User>}
21733 */
21734 loginWithQQAppWithUnionId: function loginWithQQAppWithUnionId(unionId) {
21735 var _this18 = this;
21736
21737 var _ref18 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
21738 _ref18$unionIdPlatfor = _ref18.unionIdPlatform,
21739 unionIdPlatform = _ref18$unionIdPlatfor === void 0 ? 'qq' : _ref18$unionIdPlatfor,
21740 _ref18$asMainAccount = _ref18.asMainAccount,
21741 asMainAccount = _ref18$asMainAccount === void 0 ? false : _ref18$asMainAccount,
21742 _ref18$failOnNotExist = _ref18.failOnNotExist,
21743 failOnNotExist = _ref18$failOnNotExist === void 0 ? false : _ref18$failOnNotExist,
21744 useMasterKey = _ref18.useMasterKey,
21745 sessionToken = _ref18.sessionToken,
21746 user = _ref18.user;
21747
21748 var getAuthInfo = getAdapter('getAuthInfo');
21749 return getAuthInfo({
21750 platform: unionIdPlatform
21751 }).then(function (authInfo) {
21752 authInfo = AV.User.mergeUnionId(authInfo, unionId, {
21753 asMainAccount: asMainAccount
21754 });
21755 authInfo.provider = PLATFORM_QQAPP;
21756 return _this18.loginWithMiniApp(authInfo, {
21757 failOnNotExist: failOnNotExist,
21758 useMasterKey: useMasterKey,
21759 sessionToken: sessionToken,
21760 user: user
21761 });
21762 });
21763 },
21764
21765 /**
21766 * Register or login using the identity of the current mini-app.
21767 * @param {Object} authInfo
21768 * @param {Object} [option]
21769 * @param {Boolean} [option.failOnNotExist] If true, the login request will fail when no user matches this authInfo.authData exists.
21770 */
21771 loginWithMiniApp: function loginWithMiniApp(authInfo, option) {
21772 var _this19 = this;
21773
21774 if (authInfo === undefined) {
21775 var getAuthInfo = getAdapter('getAuthInfo');
21776 return getAuthInfo().then(function (authInfo) {
21777 return _this19.loginWithAuthData(authInfo.authData, authInfo.provider, option);
21778 });
21779 }
21780
21781 return this.loginWithAuthData(authInfo.authData, authInfo.provider, option);
21782 },
21783
21784 /**
21785 * Only use for DI in tests to produce deterministic IDs.
21786 */
21787 _genId: function _genId() {
21788 return uuid();
21789 },
21790
21791 /**
21792 * Creates an anonymous user.
21793 *
21794 * @since 3.9.0
21795 * @return {Promise.<AV.User>}
21796 */
21797 loginAnonymously: function loginAnonymously() {
21798 return this.loginWithAuthData({
21799 id: AV.User._genId()
21800 }, 'anonymous');
21801 },
21802 associateWithAuthData: function associateWithAuthData(userObj, platform, authData) {
21803 console.warn('DEPRECATED: User.associateWithAuthData 已废弃,请使用 User#associateWithAuthData 代替');
21804 return userObj._linkWith(platform, authData);
21805 },
21806
21807 /**
21808 * Logs out the currently logged in user session. This will remove the
21809 * session from disk, log out of linked services, and future calls to
21810 * <code>current</code> will return <code>null</code>.
21811 * @return {Promise}
21812 */
21813 logOut: function logOut() {
21814 if (AV._config.disableCurrentUser) {
21815 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');
21816 return _promise.default.resolve(null);
21817 }
21818
21819 if (AV.User._currentUser !== null) {
21820 AV.User._currentUser._logOutWithAll();
21821
21822 AV.User._currentUser._isCurrentUser = false;
21823 }
21824
21825 AV.User._currentUserMatchesDisk = true;
21826 AV.User._currentUser = null;
21827 return AV.localStorage.removeItemAsync(AV._getAVPath(AV.User._CURRENT_USER_KEY)).then(function () {
21828 return AV._refreshSubscriptionId();
21829 });
21830 },
21831
21832 /**
21833 *Create a follower query for special user to query the user's followers.
21834 * @param {String} userObjectId The user object id.
21835 * @return {AV.FriendShipQuery}
21836 * @since 0.3.0
21837 */
21838 followerQuery: function followerQuery(userObjectId) {
21839 if (!userObjectId || !_.isString(userObjectId)) {
21840 throw new Error('Invalid user object id.');
21841 }
21842
21843 var query = new AV.FriendShipQuery('_Follower');
21844 query._friendshipTag = 'follower';
21845 query.equalTo('user', AV.Object.createWithoutData('_User', userObjectId));
21846 return query;
21847 },
21848
21849 /**
21850 *Create a followee query for special user to query the user's followees.
21851 * @param {String} userObjectId The user object id.
21852 * @return {AV.FriendShipQuery}
21853 * @since 0.3.0
21854 */
21855 followeeQuery: function followeeQuery(userObjectId) {
21856 if (!userObjectId || !_.isString(userObjectId)) {
21857 throw new Error('Invalid user object id.');
21858 }
21859
21860 var query = new AV.FriendShipQuery('_Followee');
21861 query._friendshipTag = 'followee';
21862 query.equalTo('user', AV.Object.createWithoutData('_User', userObjectId));
21863 return query;
21864 },
21865
21866 /**
21867 * Requests a password reset email to be sent to the specified email address
21868 * associated with the user account. This email allows the user to securely
21869 * reset their password on the AV site.
21870 *
21871 * @param {String} email The email address associated with the user that
21872 * forgot their password.
21873 * @return {Promise}
21874 */
21875 requestPasswordReset: function requestPasswordReset(email) {
21876 var json = {
21877 email: email
21878 };
21879 var request = AVRequest('requestPasswordReset', null, null, 'POST', json);
21880 return request;
21881 },
21882
21883 /**
21884 * Requests a verify email to be sent to the specified email address
21885 * associated with the user account. This email allows the user to securely
21886 * verify their email address on the AV site.
21887 *
21888 * @param {String} email The email address associated with the user that
21889 * doesn't verify their email address.
21890 * @return {Promise}
21891 */
21892 requestEmailVerify: function requestEmailVerify(email) {
21893 var json = {
21894 email: email
21895 };
21896 var request = AVRequest('requestEmailVerify', null, null, 'POST', json);
21897 return request;
21898 },
21899
21900 /**
21901 * Requests a verify sms code to be sent to the specified mobile phone
21902 * number associated with the user account. This sms code allows the user to
21903 * verify their mobile phone number by calling AV.User.verifyMobilePhone
21904 *
21905 * @param {String} mobilePhoneNumber The mobile phone number associated with the
21906 * user that doesn't verify their mobile phone number.
21907 * @param {SMSAuthOptions} [options]
21908 * @return {Promise}
21909 */
21910 requestMobilePhoneVerify: function requestMobilePhoneVerify(mobilePhoneNumber) {
21911 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
21912 var data = {
21913 mobilePhoneNumber: mobilePhoneNumber
21914 };
21915
21916 if (options.validateToken) {
21917 data.validate_token = options.validateToken;
21918 }
21919
21920 var request = AVRequest('requestMobilePhoneVerify', null, null, 'POST', data, options);
21921 return request;
21922 },
21923
21924 /**
21925 * Requests a reset password sms code to be sent to the specified mobile phone
21926 * number associated with the user account. This sms code allows the user to
21927 * reset their account's password by calling AV.User.resetPasswordBySmsCode
21928 *
21929 * @param {String} mobilePhoneNumber The mobile phone number associated with the
21930 * user that doesn't verify their mobile phone number.
21931 * @param {SMSAuthOptions} [options]
21932 * @return {Promise}
21933 */
21934 requestPasswordResetBySmsCode: function requestPasswordResetBySmsCode(mobilePhoneNumber) {
21935 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
21936 var data = {
21937 mobilePhoneNumber: mobilePhoneNumber
21938 };
21939
21940 if (options.validateToken) {
21941 data.validate_token = options.validateToken;
21942 }
21943
21944 var request = AVRequest('requestPasswordResetBySmsCode', null, null, 'POST', data, options);
21945 return request;
21946 },
21947
21948 /**
21949 * Requests a change mobile phone number sms code to be sent to the mobilePhoneNumber.
21950 * This sms code allows current user to reset it's mobilePhoneNumber by
21951 * calling {@link AV.User.changePhoneNumber}
21952 * @since 4.7.0
21953 * @param {String} mobilePhoneNumber
21954 * @param {Number} [ttl] ttl of sms code (default is 6 minutes)
21955 * @param {SMSAuthOptions} [options]
21956 * @return {Promise}
21957 */
21958 requestChangePhoneNumber: function requestChangePhoneNumber(mobilePhoneNumber, ttl, options) {
21959 var data = {
21960 mobilePhoneNumber: mobilePhoneNumber
21961 };
21962
21963 if (ttl) {
21964 data.ttl = options.ttl;
21965 }
21966
21967 if (options && options.validateToken) {
21968 data.validate_token = options.validateToken;
21969 }
21970
21971 return AVRequest('requestChangePhoneNumber', null, null, 'POST', data, options);
21972 },
21973
21974 /**
21975 * Makes a call to reset user's account mobilePhoneNumber by sms code.
21976 * The sms code is sent by {@link AV.User.requestChangePhoneNumber}
21977 * @since 4.7.0
21978 * @param {String} mobilePhoneNumber
21979 * @param {String} code The sms code.
21980 * @return {Promise}
21981 */
21982 changePhoneNumber: function changePhoneNumber(mobilePhoneNumber, code) {
21983 var data = {
21984 mobilePhoneNumber: mobilePhoneNumber,
21985 code: code
21986 };
21987 return AVRequest('changePhoneNumber', null, null, 'POST', data);
21988 },
21989
21990 /**
21991 * Makes a call to reset user's account password by sms code and new password.
21992 * The sms code is sent by AV.User.requestPasswordResetBySmsCode.
21993 * @param {String} code The sms code sent by AV.User.Cloud.requestSmsCode
21994 * @param {String} password The new password.
21995 * @return {Promise} A promise that will be resolved with the result
21996 * of the function.
21997 */
21998 resetPasswordBySmsCode: function resetPasswordBySmsCode(code, password) {
21999 var json = {
22000 password: password
22001 };
22002 var request = AVRequest('resetPasswordBySmsCode', null, code, 'PUT', json);
22003 return request;
22004 },
22005
22006 /**
22007 * Makes a call to verify sms code that sent by AV.User.Cloud.requestSmsCode
22008 * If verify successfully,the user mobilePhoneVerified attribute will be true.
22009 * @param {String} code The sms code sent by AV.User.Cloud.requestSmsCode
22010 * @return {Promise} A promise that will be resolved with the result
22011 * of the function.
22012 */
22013 verifyMobilePhone: function verifyMobilePhone(code) {
22014 var request = AVRequest('verifyMobilePhone', null, code, 'POST', null);
22015 return request;
22016 },
22017
22018 /**
22019 * Requests a logIn sms code to be sent to the specified mobile phone
22020 * number associated with the user account. This sms code allows the user to
22021 * login by AV.User.logInWithMobilePhoneSmsCode function.
22022 *
22023 * @param {String} mobilePhoneNumber The mobile phone number associated with the
22024 * user that want to login by AV.User.logInWithMobilePhoneSmsCode
22025 * @param {SMSAuthOptions} [options]
22026 * @return {Promise}
22027 */
22028 requestLoginSmsCode: function requestLoginSmsCode(mobilePhoneNumber) {
22029 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
22030 var data = {
22031 mobilePhoneNumber: mobilePhoneNumber
22032 };
22033
22034 if (options.validateToken) {
22035 data.validate_token = options.validateToken;
22036 }
22037
22038 var request = AVRequest('requestLoginSmsCode', null, null, 'POST', data, options);
22039 return request;
22040 },
22041
22042 /**
22043 * Retrieves the currently logged in AVUser with a valid session,
22044 * either from memory or localStorage, if necessary.
22045 * @return {Promise.<AV.User>} resolved with the currently logged in AV.User.
22046 */
22047 currentAsync: function currentAsync() {
22048 if (AV._config.disableCurrentUser) {
22049 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');
22050 return _promise.default.resolve(null);
22051 }
22052
22053 if (AV.User._currentUser) {
22054 return _promise.default.resolve(AV.User._currentUser);
22055 }
22056
22057 if (AV.User._currentUserMatchesDisk) {
22058 return _promise.default.resolve(AV.User._currentUser);
22059 }
22060
22061 return AV.localStorage.getItemAsync(AV._getAVPath(AV.User._CURRENT_USER_KEY)).then(function (userData) {
22062 if (!userData) {
22063 return null;
22064 } // Load the user from local storage.
22065
22066
22067 AV.User._currentUserMatchesDisk = true;
22068 AV.User._currentUser = AV.Object._create('_User');
22069 AV.User._currentUser._isCurrentUser = true;
22070 var json = JSON.parse(userData);
22071 AV.User._currentUser.id = json._id;
22072 delete json._id;
22073 AV.User._currentUser._sessionToken = json._sessionToken;
22074 delete json._sessionToken;
22075
22076 AV.User._currentUser._finishFetch(json); //AV.User._currentUser.set(json);
22077
22078
22079 AV.User._currentUser._synchronizeAllAuthData();
22080
22081 AV.User._currentUser._refreshCache();
22082
22083 AV.User._currentUser._opSetQueue = [{}];
22084 return AV.User._currentUser;
22085 });
22086 },
22087
22088 /**
22089 * Retrieves the currently logged in AVUser with a valid session,
22090 * either from memory or localStorage, if necessary.
22091 * @return {AV.User} The currently logged in AV.User.
22092 */
22093 current: function current() {
22094 if (AV._config.disableCurrentUser) {
22095 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');
22096 return null;
22097 }
22098
22099 if (AV.localStorage.async) {
22100 var error = new Error('Synchronous API User.current() is not available in this runtime. Use User.currentAsync() instead.');
22101 error.code = 'SYNC_API_NOT_AVAILABLE';
22102 throw error;
22103 }
22104
22105 if (AV.User._currentUser) {
22106 return AV.User._currentUser;
22107 }
22108
22109 if (AV.User._currentUserMatchesDisk) {
22110 return AV.User._currentUser;
22111 } // Load the user from local storage.
22112
22113
22114 AV.User._currentUserMatchesDisk = true;
22115 var userData = AV.localStorage.getItem(AV._getAVPath(AV.User._CURRENT_USER_KEY));
22116
22117 if (!userData) {
22118 return null;
22119 }
22120
22121 AV.User._currentUser = AV.Object._create('_User');
22122 AV.User._currentUser._isCurrentUser = true;
22123 var json = JSON.parse(userData);
22124 AV.User._currentUser.id = json._id;
22125 delete json._id;
22126 AV.User._currentUser._sessionToken = json._sessionToken;
22127 delete json._sessionToken;
22128
22129 AV.User._currentUser._finishFetch(json); //AV.User._currentUser.set(json);
22130
22131
22132 AV.User._currentUser._synchronizeAllAuthData();
22133
22134 AV.User._currentUser._refreshCache();
22135
22136 AV.User._currentUser._opSetQueue = [{}];
22137 return AV.User._currentUser;
22138 },
22139
22140 /**
22141 * Persists a user as currentUser to localStorage, and into the singleton.
22142 * @private
22143 */
22144 _saveCurrentUser: function _saveCurrentUser(user) {
22145 var promise;
22146
22147 if (AV.User._currentUser !== user) {
22148 promise = AV.User.logOut();
22149 } else {
22150 promise = _promise.default.resolve();
22151 }
22152
22153 return promise.then(function () {
22154 user._isCurrentUser = true;
22155 AV.User._currentUser = user;
22156
22157 var json = user._toFullJSON();
22158
22159 json._id = user.id;
22160 json._sessionToken = user._sessionToken;
22161 return AV.localStorage.setItemAsync(AV._getAVPath(AV.User._CURRENT_USER_KEY), (0, _stringify.default)(json)).then(function () {
22162 AV.User._currentUserMatchesDisk = true;
22163 return AV._refreshSubscriptionId();
22164 });
22165 });
22166 },
22167 _registerAuthenticationProvider: function _registerAuthenticationProvider(provider) {
22168 AV.User._authProviders[provider.getAuthType()] = provider; // Synchronize the current user with the auth provider.
22169
22170 if (!AV._config.disableCurrentUser && AV.User.current()) {
22171 AV.User.current()._synchronizeAuthData(provider.getAuthType());
22172 }
22173 },
22174 _logInWith: function _logInWith(provider, authData, options) {
22175 var user = AV.Object._create('_User');
22176
22177 return user._linkWith(provider, authData, options);
22178 }
22179 });
22180};
22181
22182/***/ }),
22183/* 559 */
22184/***/ (function(module, exports, __webpack_require__) {
22185
22186var _Object$defineProperty = __webpack_require__(151);
22187
22188function _defineProperty(obj, key, value) {
22189 if (key in obj) {
22190 _Object$defineProperty(obj, key, {
22191 value: value,
22192 enumerable: true,
22193 configurable: true,
22194 writable: true
22195 });
22196 } else {
22197 obj[key] = value;
22198 }
22199
22200 return obj;
22201}
22202
22203module.exports = _defineProperty, module.exports.__esModule = true, module.exports["default"] = module.exports;
22204
22205/***/ }),
22206/* 560 */
22207/***/ (function(module, exports, __webpack_require__) {
22208
22209"use strict";
22210
22211
22212var _interopRequireDefault = __webpack_require__(1);
22213
22214var _map = _interopRequireDefault(__webpack_require__(35));
22215
22216var _promise = _interopRequireDefault(__webpack_require__(12));
22217
22218var _keys = _interopRequireDefault(__webpack_require__(59));
22219
22220var _stringify = _interopRequireDefault(__webpack_require__(36));
22221
22222var _find = _interopRequireDefault(__webpack_require__(93));
22223
22224var _concat = _interopRequireDefault(__webpack_require__(22));
22225
22226var _ = __webpack_require__(3);
22227
22228var debug = __webpack_require__(60)('leancloud:query');
22229
22230var AVError = __webpack_require__(46);
22231
22232var _require = __webpack_require__(27),
22233 _request = _require._request,
22234 request = _require.request;
22235
22236var _require2 = __webpack_require__(30),
22237 ensureArray = _require2.ensureArray,
22238 transformFetchOptions = _require2.transformFetchOptions,
22239 continueWhile = _require2.continueWhile;
22240
22241var requires = function requires(value, message) {
22242 if (value === undefined) {
22243 throw new Error(message);
22244 }
22245}; // AV.Query is a way to create a list of AV.Objects.
22246
22247
22248module.exports = function (AV) {
22249 /**
22250 * Creates a new AV.Query for the given AV.Object subclass.
22251 * @param {Class|String} objectClass An instance of a subclass of AV.Object, or a AV className string.
22252 * @class
22253 *
22254 * <p>AV.Query defines a query that is used to fetch AV.Objects. The
22255 * most common use case is finding all objects that match a query through the
22256 * <code>find</code> method. For example, this sample code fetches all objects
22257 * of class <code>MyClass</code>. It calls a different function depending on
22258 * whether the fetch succeeded or not.
22259 *
22260 * <pre>
22261 * var query = new AV.Query(MyClass);
22262 * query.find().then(function(results) {
22263 * // results is an array of AV.Object.
22264 * }, function(error) {
22265 * // error is an instance of AVError.
22266 * });</pre></p>
22267 *
22268 * <p>An AV.Query can also be used to retrieve a single object whose id is
22269 * known, through the get method. For example, this sample code fetches an
22270 * object of class <code>MyClass</code> and id <code>myId</code>. It calls a
22271 * different function depending on whether the fetch succeeded or not.
22272 *
22273 * <pre>
22274 * var query = new AV.Query(MyClass);
22275 * query.get(myId).then(function(object) {
22276 * // object is an instance of AV.Object.
22277 * }, function(error) {
22278 * // error is an instance of AVError.
22279 * });</pre></p>
22280 *
22281 * <p>An AV.Query can also be used to count the number of objects that match
22282 * the query without retrieving all of those objects. For example, this
22283 * sample code counts the number of objects of the class <code>MyClass</code>
22284 * <pre>
22285 * var query = new AV.Query(MyClass);
22286 * query.count().then(function(number) {
22287 * // There are number instances of MyClass.
22288 * }, function(error) {
22289 * // error is an instance of AVError.
22290 * });</pre></p>
22291 */
22292 AV.Query = function (objectClass) {
22293 if (_.isString(objectClass)) {
22294 objectClass = AV.Object._getSubclass(objectClass);
22295 }
22296
22297 this.objectClass = objectClass;
22298 this.className = objectClass.prototype.className;
22299 this._where = {};
22300 this._include = [];
22301 this._select = [];
22302 this._limit = -1; // negative limit means, do not send a limit
22303
22304 this._skip = 0;
22305 this._defaultParams = {};
22306 };
22307 /**
22308 * Constructs a AV.Query that is the OR of the passed in queries. For
22309 * example:
22310 * <pre>var compoundQuery = AV.Query.or(query1, query2, query3);</pre>
22311 *
22312 * will create a compoundQuery that is an or of the query1, query2, and
22313 * query3.
22314 * @param {...AV.Query} var_args The list of queries to OR.
22315 * @return {AV.Query} The query that is the OR of the passed in queries.
22316 */
22317
22318
22319 AV.Query.or = function () {
22320 var queries = _.toArray(arguments);
22321
22322 var className = null;
22323
22324 AV._arrayEach(queries, function (q) {
22325 if (_.isNull(className)) {
22326 className = q.className;
22327 }
22328
22329 if (className !== q.className) {
22330 throw new Error('All queries must be for the same class');
22331 }
22332 });
22333
22334 var query = new AV.Query(className);
22335
22336 query._orQuery(queries);
22337
22338 return query;
22339 };
22340 /**
22341 * Constructs a AV.Query that is the AND of the passed in queries. For
22342 * example:
22343 * <pre>var compoundQuery = AV.Query.and(query1, query2, query3);</pre>
22344 *
22345 * will create a compoundQuery that is an 'and' of the query1, query2, and
22346 * query3.
22347 * @param {...AV.Query} var_args The list of queries to AND.
22348 * @return {AV.Query} The query that is the AND of the passed in queries.
22349 */
22350
22351
22352 AV.Query.and = function () {
22353 var queries = _.toArray(arguments);
22354
22355 var className = null;
22356
22357 AV._arrayEach(queries, function (q) {
22358 if (_.isNull(className)) {
22359 className = q.className;
22360 }
22361
22362 if (className !== q.className) {
22363 throw new Error('All queries must be for the same class');
22364 }
22365 });
22366
22367 var query = new AV.Query(className);
22368
22369 query._andQuery(queries);
22370
22371 return query;
22372 };
22373 /**
22374 * Retrieves a list of AVObjects that satisfy the CQL.
22375 * CQL syntax please see {@link https://leancloud.cn/docs/cql_guide.html CQL Guide}.
22376 *
22377 * @param {String} cql A CQL string, see {@link https://leancloud.cn/docs/cql_guide.html CQL Guide}.
22378 * @param {Array} pvalues An array contains placeholder values.
22379 * @param {AuthOptions} options
22380 * @return {Promise} A promise that is resolved with the results when
22381 * the query completes.
22382 */
22383
22384
22385 AV.Query.doCloudQuery = function (cql, pvalues, options) {
22386 var params = {
22387 cql: cql
22388 };
22389
22390 if (_.isArray(pvalues)) {
22391 params.pvalues = pvalues;
22392 } else {
22393 options = pvalues;
22394 }
22395
22396 var request = _request('cloudQuery', null, null, 'GET', params, options);
22397
22398 return request.then(function (response) {
22399 //query to process results.
22400 var query = new AV.Query(response.className);
22401 var results = (0, _map.default)(_).call(_, response.results, function (json) {
22402 var obj = query._newObject(response);
22403
22404 if (obj._finishFetch) {
22405 obj._finishFetch(query._processResult(json), true);
22406 }
22407
22408 return obj;
22409 });
22410 return {
22411 results: results,
22412 count: response.count,
22413 className: response.className
22414 };
22415 });
22416 };
22417 /**
22418 * Return a query with conditions from json.
22419 * This can be useful to send a query from server side to client side.
22420 * @since 4.0.0
22421 * @param {Object} json from {@link AV.Query#toJSON}
22422 * @return {AV.Query}
22423 */
22424
22425
22426 AV.Query.fromJSON = function (_ref) {
22427 var className = _ref.className,
22428 where = _ref.where,
22429 include = _ref.include,
22430 select = _ref.select,
22431 includeACL = _ref.includeACL,
22432 limit = _ref.limit,
22433 skip = _ref.skip,
22434 order = _ref.order;
22435
22436 if (typeof className !== 'string') {
22437 throw new TypeError('Invalid Query JSON, className must be a String.');
22438 }
22439
22440 var query = new AV.Query(className);
22441
22442 _.extend(query, {
22443 _where: where,
22444 _include: include,
22445 _select: select,
22446 _includeACL: includeACL,
22447 _limit: limit,
22448 _skip: skip,
22449 _order: order
22450 });
22451
22452 return query;
22453 };
22454
22455 AV.Query._extend = AV._extend;
22456
22457 _.extend(AV.Query.prototype,
22458 /** @lends AV.Query.prototype */
22459 {
22460 //hook to iterate result. Added by dennis<xzhuang@avoscloud.com>.
22461 _processResult: function _processResult(obj) {
22462 return obj;
22463 },
22464
22465 /**
22466 * Constructs an AV.Object whose id is already known by fetching data from
22467 * the server.
22468 *
22469 * @param {String} objectId The id of the object to be fetched.
22470 * @param {AuthOptions} options
22471 * @return {Promise.<AV.Object>}
22472 */
22473 get: function get(objectId, options) {
22474 if (!_.isString(objectId)) {
22475 throw new Error('objectId must be a string');
22476 }
22477
22478 if (objectId === '') {
22479 return _promise.default.reject(new AVError(AVError.OBJECT_NOT_FOUND, 'Object not found.'));
22480 }
22481
22482 var obj = this._newObject();
22483
22484 obj.id = objectId;
22485
22486 var queryJSON = this._getParams();
22487
22488 var fetchOptions = {};
22489 if ((0, _keys.default)(queryJSON)) fetchOptions.keys = (0, _keys.default)(queryJSON);
22490 if (queryJSON.include) fetchOptions.include = queryJSON.include;
22491 if (queryJSON.includeACL) fetchOptions.includeACL = queryJSON.includeACL;
22492 return _request('classes', this.className, objectId, 'GET', transformFetchOptions(fetchOptions), options).then(function (response) {
22493 if (_.isEmpty(response)) throw new AVError(AVError.OBJECT_NOT_FOUND, 'Object not found.');
22494
22495 obj._finishFetch(obj.parse(response), true);
22496
22497 return obj;
22498 });
22499 },
22500
22501 /**
22502 * Returns a JSON representation of this query.
22503 * @return {Object}
22504 */
22505 toJSON: function toJSON() {
22506 var className = this.className,
22507 where = this._where,
22508 include = this._include,
22509 select = this._select,
22510 includeACL = this._includeACL,
22511 limit = this._limit,
22512 skip = this._skip,
22513 order = this._order;
22514 return {
22515 className: className,
22516 where: where,
22517 include: include,
22518 select: select,
22519 includeACL: includeACL,
22520 limit: limit,
22521 skip: skip,
22522 order: order
22523 };
22524 },
22525 _getParams: function _getParams() {
22526 var params = _.extend({}, this._defaultParams, {
22527 where: this._where
22528 });
22529
22530 if (this._include.length > 0) {
22531 params.include = this._include.join(',');
22532 }
22533
22534 if (this._select.length > 0) {
22535 params.keys = this._select.join(',');
22536 }
22537
22538 if (this._includeACL !== undefined) {
22539 params.returnACL = this._includeACL;
22540 }
22541
22542 if (this._limit >= 0) {
22543 params.limit = this._limit;
22544 }
22545
22546 if (this._skip > 0) {
22547 params.skip = this._skip;
22548 }
22549
22550 if (this._order !== undefined) {
22551 params.order = this._order;
22552 }
22553
22554 return params;
22555 },
22556 _newObject: function _newObject(response) {
22557 var obj;
22558
22559 if (response && response.className) {
22560 obj = new AV.Object(response.className);
22561 } else {
22562 obj = new this.objectClass();
22563 }
22564
22565 return obj;
22566 },
22567 _createRequest: function _createRequest() {
22568 var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this._getParams();
22569 var options = arguments.length > 1 ? arguments[1] : undefined;
22570 var path = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "/classes/".concat(this.className);
22571
22572 if (encodeURIComponent((0, _stringify.default)(params)).length > 2000) {
22573 var body = {
22574 requests: [{
22575 method: 'GET',
22576 path: "/1.1".concat(path),
22577 params: params
22578 }]
22579 };
22580 return request({
22581 path: '/batch',
22582 method: 'POST',
22583 data: body,
22584 authOptions: options
22585 }).then(function (response) {
22586 var result = response[0];
22587
22588 if (result.success) {
22589 return result.success;
22590 }
22591
22592 var error = new AVError(result.error.code, result.error.error || 'Unknown batch error');
22593 throw error;
22594 });
22595 }
22596
22597 return request({
22598 method: 'GET',
22599 path: path,
22600 query: params,
22601 authOptions: options
22602 });
22603 },
22604 _parseResponse: function _parseResponse(response) {
22605 var _this = this;
22606
22607 return (0, _map.default)(_).call(_, response.results, function (json) {
22608 var obj = _this._newObject(response);
22609
22610 if (obj._finishFetch) {
22611 obj._finishFetch(_this._processResult(json), true);
22612 }
22613
22614 return obj;
22615 });
22616 },
22617
22618 /**
22619 * Retrieves a list of AVObjects that satisfy this query.
22620 *
22621 * @param {AuthOptions} options
22622 * @return {Promise} A promise that is resolved with the results when
22623 * the query completes.
22624 */
22625 find: function find(options) {
22626 var request = this._createRequest(undefined, options);
22627
22628 return request.then(this._parseResponse.bind(this));
22629 },
22630
22631 /**
22632 * Retrieves both AVObjects and total count.
22633 *
22634 * @since 4.12.0
22635 * @param {AuthOptions} options
22636 * @return {Promise} A tuple contains results and count.
22637 */
22638 findAndCount: function findAndCount(options) {
22639 var _this2 = this;
22640
22641 var params = this._getParams();
22642
22643 params.count = 1;
22644
22645 var request = this._createRequest(params, options);
22646
22647 return request.then(function (response) {
22648 return [_this2._parseResponse(response), response.count];
22649 });
22650 },
22651
22652 /**
22653 * scan a Query. masterKey required.
22654 *
22655 * @since 2.1.0
22656 * @param {object} [options]
22657 * @param {string} [options.orderedBy] specify the key to sort
22658 * @param {number} [options.batchSize] specify the batch size for each request
22659 * @param {AuthOptions} [authOptions]
22660 * @return {AsyncIterator.<AV.Object>}
22661 * @example const testIterator = {
22662 * [Symbol.asyncIterator]() {
22663 * return new Query('Test').scan(undefined, { useMasterKey: true });
22664 * },
22665 * };
22666 * for await (const test of testIterator) {
22667 * console.log(test.id);
22668 * }
22669 */
22670 scan: function scan() {
22671 var _this3 = this;
22672
22673 var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
22674 orderedBy = _ref2.orderedBy,
22675 batchSize = _ref2.batchSize;
22676
22677 var authOptions = arguments.length > 1 ? arguments[1] : undefined;
22678
22679 var condition = this._getParams();
22680
22681 debug('scan %O', condition);
22682
22683 if (condition.order) {
22684 console.warn('The order of the query is ignored for Query#scan. Checkout the orderedBy option of Query#scan.');
22685 delete condition.order;
22686 }
22687
22688 if (condition.skip) {
22689 console.warn('The skip option of the query is ignored for Query#scan.');
22690 delete condition.skip;
22691 }
22692
22693 if (condition.limit) {
22694 console.warn('The limit option of the query is ignored for Query#scan.');
22695 delete condition.limit;
22696 }
22697
22698 if (orderedBy) condition.scan_key = orderedBy;
22699 if (batchSize) condition.limit = batchSize;
22700 var cursor;
22701 var remainResults = [];
22702 return {
22703 next: function next() {
22704 if (remainResults.length) {
22705 return _promise.default.resolve({
22706 done: false,
22707 value: remainResults.shift()
22708 });
22709 }
22710
22711 if (cursor === null) {
22712 return _promise.default.resolve({
22713 done: true
22714 });
22715 }
22716
22717 return _request('scan/classes', _this3.className, null, 'GET', cursor ? _.extend({}, condition, {
22718 cursor: cursor
22719 }) : condition, authOptions).then(function (response) {
22720 cursor = response.cursor;
22721
22722 if (response.results.length) {
22723 var results = _this3._parseResponse(response);
22724
22725 results.forEach(function (result) {
22726 return remainResults.push(result);
22727 });
22728 }
22729
22730 if (cursor === null && remainResults.length === 0) {
22731 return {
22732 done: true
22733 };
22734 }
22735
22736 return {
22737 done: false,
22738 value: remainResults.shift()
22739 };
22740 });
22741 }
22742 };
22743 },
22744
22745 /**
22746 * Delete objects retrieved by this query.
22747 * @param {AuthOptions} options
22748 * @return {Promise} A promise that is fulfilled when the save
22749 * completes.
22750 */
22751 destroyAll: function destroyAll(options) {
22752 var self = this;
22753 return (0, _find.default)(self).call(self, options).then(function (objects) {
22754 return AV.Object.destroyAll(objects, options);
22755 });
22756 },
22757
22758 /**
22759 * Counts the number of objects that match this query.
22760 *
22761 * @param {AuthOptions} options
22762 * @return {Promise} A promise that is resolved with the count when
22763 * the query completes.
22764 */
22765 count: function count(options) {
22766 var params = this._getParams();
22767
22768 params.limit = 0;
22769 params.count = 1;
22770
22771 var request = this._createRequest(params, options);
22772
22773 return request.then(function (response) {
22774 return response.count;
22775 });
22776 },
22777
22778 /**
22779 * Retrieves at most one AV.Object that satisfies this query.
22780 *
22781 * @param {AuthOptions} options
22782 * @return {Promise} A promise that is resolved with the object when
22783 * the query completes.
22784 */
22785 first: function first(options) {
22786 var self = this;
22787
22788 var params = this._getParams();
22789
22790 params.limit = 1;
22791
22792 var request = this._createRequest(params, options);
22793
22794 return request.then(function (response) {
22795 return (0, _map.default)(_).call(_, response.results, function (json) {
22796 var obj = self._newObject();
22797
22798 if (obj._finishFetch) {
22799 obj._finishFetch(self._processResult(json), true);
22800 }
22801
22802 return obj;
22803 })[0];
22804 });
22805 },
22806
22807 /**
22808 * Sets the number of results to skip before returning any results.
22809 * This is useful for pagination.
22810 * Default is to skip zero results.
22811 * @param {Number} n the number of results to skip.
22812 * @return {AV.Query} Returns the query, so you can chain this call.
22813 */
22814 skip: function skip(n) {
22815 requires(n, 'undefined is not a valid skip value');
22816 this._skip = n;
22817 return this;
22818 },
22819
22820 /**
22821 * Sets the limit of the number of results to return. The default limit is
22822 * 100, with a maximum of 1000 results being returned at a time.
22823 * @param {Number} n the number of results to limit to.
22824 * @return {AV.Query} Returns the query, so you can chain this call.
22825 */
22826 limit: function limit(n) {
22827 requires(n, 'undefined is not a valid limit value');
22828 this._limit = n;
22829 return this;
22830 },
22831
22832 /**
22833 * Add a constraint to the query that requires a particular key's value to
22834 * be equal to the provided value.
22835 * @param {String} key The key to check.
22836 * @param value The value that the AV.Object must contain.
22837 * @return {AV.Query} Returns the query, so you can chain this call.
22838 */
22839 equalTo: function equalTo(key, value) {
22840 requires(key, 'undefined is not a valid key');
22841 requires(value, 'undefined is not a valid value');
22842 this._where[key] = AV._encode(value);
22843 return this;
22844 },
22845
22846 /**
22847 * Helper for condition queries
22848 * @private
22849 */
22850 _addCondition: function _addCondition(key, condition, value) {
22851 requires(key, 'undefined is not a valid condition key');
22852 requires(condition, 'undefined is not a valid condition');
22853 requires(value, 'undefined is not a valid condition value'); // Check if we already have a condition
22854
22855 if (!this._where[key]) {
22856 this._where[key] = {};
22857 }
22858
22859 this._where[key][condition] = AV._encode(value);
22860 return this;
22861 },
22862
22863 /**
22864 * Add a constraint to the query that requires a particular
22865 * <strong>array</strong> key's length to be equal to the provided value.
22866 * @param {String} key The array key to check.
22867 * @param {number} value The length value.
22868 * @return {AV.Query} Returns the query, so you can chain this call.
22869 */
22870 sizeEqualTo: function sizeEqualTo(key, value) {
22871 this._addCondition(key, '$size', value);
22872
22873 return this;
22874 },
22875
22876 /**
22877 * Add a constraint to the query that requires a particular key's value to
22878 * be not equal to the provided value.
22879 * @param {String} key The key to check.
22880 * @param value The value that must not be equalled.
22881 * @return {AV.Query} Returns the query, so you can chain this call.
22882 */
22883 notEqualTo: function notEqualTo(key, value) {
22884 this._addCondition(key, '$ne', value);
22885
22886 return this;
22887 },
22888
22889 /**
22890 * Add a constraint to the query that requires a particular key's value to
22891 * be less than the provided value.
22892 * @param {String} key The key to check.
22893 * @param value The value that provides an upper bound.
22894 * @return {AV.Query} Returns the query, so you can chain this call.
22895 */
22896 lessThan: function lessThan(key, value) {
22897 this._addCondition(key, '$lt', value);
22898
22899 return this;
22900 },
22901
22902 /**
22903 * Add a constraint to the query that requires a particular key's value to
22904 * be greater than the provided value.
22905 * @param {String} key The key to check.
22906 * @param value The value that provides an lower bound.
22907 * @return {AV.Query} Returns the query, so you can chain this call.
22908 */
22909 greaterThan: function greaterThan(key, value) {
22910 this._addCondition(key, '$gt', value);
22911
22912 return this;
22913 },
22914
22915 /**
22916 * Add a constraint to the query that requires a particular key's value to
22917 * be less than or equal to the provided value.
22918 * @param {String} key The key to check.
22919 * @param value The value that provides an upper bound.
22920 * @return {AV.Query} Returns the query, so you can chain this call.
22921 */
22922 lessThanOrEqualTo: function lessThanOrEqualTo(key, value) {
22923 this._addCondition(key, '$lte', value);
22924
22925 return this;
22926 },
22927
22928 /**
22929 * Add a constraint to the query that requires a particular key's value to
22930 * be greater than or equal to the provided value.
22931 * @param {String} key The key to check.
22932 * @param value The value that provides an lower bound.
22933 * @return {AV.Query} Returns the query, so you can chain this call.
22934 */
22935 greaterThanOrEqualTo: function greaterThanOrEqualTo(key, value) {
22936 this._addCondition(key, '$gte', value);
22937
22938 return this;
22939 },
22940
22941 /**
22942 * Add a constraint to the query that requires a particular key's value to
22943 * be contained in the provided list of values.
22944 * @param {String} key The key to check.
22945 * @param {Array} values The values that will match.
22946 * @return {AV.Query} Returns the query, so you can chain this call.
22947 */
22948 containedIn: function containedIn(key, values) {
22949 this._addCondition(key, '$in', values);
22950
22951 return this;
22952 },
22953
22954 /**
22955 * Add a constraint to the query that requires a particular key's value to
22956 * not be contained in the provided list of values.
22957 * @param {String} key The key to check.
22958 * @param {Array} values The values that will not match.
22959 * @return {AV.Query} Returns the query, so you can chain this call.
22960 */
22961 notContainedIn: function notContainedIn(key, values) {
22962 this._addCondition(key, '$nin', values);
22963
22964 return this;
22965 },
22966
22967 /**
22968 * Add a constraint to the query that requires a particular key's value to
22969 * contain each one of the provided list of values.
22970 * @param {String} key The key to check. This key's value must be an array.
22971 * @param {Array} values The values that will match.
22972 * @return {AV.Query} Returns the query, so you can chain this call.
22973 */
22974 containsAll: function containsAll(key, values) {
22975 this._addCondition(key, '$all', values);
22976
22977 return this;
22978 },
22979
22980 /**
22981 * Add a constraint for finding objects that contain the given key.
22982 * @param {String} key The key that should exist.
22983 * @return {AV.Query} Returns the query, so you can chain this call.
22984 */
22985 exists: function exists(key) {
22986 this._addCondition(key, '$exists', true);
22987
22988 return this;
22989 },
22990
22991 /**
22992 * Add a constraint for finding objects that do not contain a given key.
22993 * @param {String} key The key that should not exist
22994 * @return {AV.Query} Returns the query, so you can chain this call.
22995 */
22996 doesNotExist: function doesNotExist(key) {
22997 this._addCondition(key, '$exists', false);
22998
22999 return this;
23000 },
23001
23002 /**
23003 * Add a regular expression constraint for finding string values that match
23004 * the provided regular expression.
23005 * This may be slow for large datasets.
23006 * @param {String} key The key that the string to match is stored in.
23007 * @param {RegExp} regex The regular expression pattern to match.
23008 * @return {AV.Query} Returns the query, so you can chain this call.
23009 */
23010 matches: function matches(key, regex, modifiers) {
23011 this._addCondition(key, '$regex', regex);
23012
23013 if (!modifiers) {
23014 modifiers = '';
23015 } // Javascript regex options support mig as inline options but store them
23016 // as properties of the object. We support mi & should migrate them to
23017 // modifiers
23018
23019
23020 if (regex.ignoreCase) {
23021 modifiers += 'i';
23022 }
23023
23024 if (regex.multiline) {
23025 modifiers += 'm';
23026 }
23027
23028 if (modifiers && modifiers.length) {
23029 this._addCondition(key, '$options', modifiers);
23030 }
23031
23032 return this;
23033 },
23034
23035 /**
23036 * Add a constraint that requires that a key's value matches a AV.Query
23037 * constraint.
23038 * @param {String} key The key that the contains the object to match the
23039 * query.
23040 * @param {AV.Query} query The query that should match.
23041 * @return {AV.Query} Returns the query, so you can chain this call.
23042 */
23043 matchesQuery: function matchesQuery(key, query) {
23044 var queryJSON = query._getParams();
23045
23046 queryJSON.className = query.className;
23047
23048 this._addCondition(key, '$inQuery', queryJSON);
23049
23050 return this;
23051 },
23052
23053 /**
23054 * Add a constraint that requires that a key's value not matches a
23055 * AV.Query constraint.
23056 * @param {String} key The key that the contains the object to match the
23057 * query.
23058 * @param {AV.Query} query The query that should not match.
23059 * @return {AV.Query} Returns the query, so you can chain this call.
23060 */
23061 doesNotMatchQuery: function doesNotMatchQuery(key, query) {
23062 var queryJSON = query._getParams();
23063
23064 queryJSON.className = query.className;
23065
23066 this._addCondition(key, '$notInQuery', queryJSON);
23067
23068 return this;
23069 },
23070
23071 /**
23072 * Add a constraint that requires that a key's value matches a value in
23073 * an object returned by a different AV.Query.
23074 * @param {String} key The key that contains the value that is being
23075 * matched.
23076 * @param {String} queryKey The key in the objects returned by the query to
23077 * match against.
23078 * @param {AV.Query} query The query to run.
23079 * @return {AV.Query} Returns the query, so you can chain this call.
23080 */
23081 matchesKeyInQuery: function matchesKeyInQuery(key, queryKey, query) {
23082 var queryJSON = query._getParams();
23083
23084 queryJSON.className = query.className;
23085
23086 this._addCondition(key, '$select', {
23087 key: queryKey,
23088 query: queryJSON
23089 });
23090
23091 return this;
23092 },
23093
23094 /**
23095 * Add a constraint that requires that a key's value not match a value in
23096 * an object returned by a different AV.Query.
23097 * @param {String} key The key that contains the value that is being
23098 * excluded.
23099 * @param {String} queryKey The key in the objects returned by the query to
23100 * match against.
23101 * @param {AV.Query} query The query to run.
23102 * @return {AV.Query} Returns the query, so you can chain this call.
23103 */
23104 doesNotMatchKeyInQuery: function doesNotMatchKeyInQuery(key, queryKey, query) {
23105 var queryJSON = query._getParams();
23106
23107 queryJSON.className = query.className;
23108
23109 this._addCondition(key, '$dontSelect', {
23110 key: queryKey,
23111 query: queryJSON
23112 });
23113
23114 return this;
23115 },
23116
23117 /**
23118 * Add constraint that at least one of the passed in queries matches.
23119 * @param {Array} queries
23120 * @return {AV.Query} Returns the query, so you can chain this call.
23121 * @private
23122 */
23123 _orQuery: function _orQuery(queries) {
23124 var queryJSON = (0, _map.default)(_).call(_, queries, function (q) {
23125 return q._getParams().where;
23126 });
23127 this._where.$or = queryJSON;
23128 return this;
23129 },
23130
23131 /**
23132 * Add constraint that both of the passed in queries matches.
23133 * @param {Array} queries
23134 * @return {AV.Query} Returns the query, so you can chain this call.
23135 * @private
23136 */
23137 _andQuery: function _andQuery(queries) {
23138 var queryJSON = (0, _map.default)(_).call(_, queries, function (q) {
23139 return q._getParams().where;
23140 });
23141 this._where.$and = queryJSON;
23142 return this;
23143 },
23144
23145 /**
23146 * Converts a string into a regex that matches it.
23147 * Surrounding with \Q .. \E does this, we just need to escape \E's in
23148 * the text separately.
23149 * @private
23150 */
23151 _quote: function _quote(s) {
23152 return '\\Q' + s.replace('\\E', '\\E\\\\E\\Q') + '\\E';
23153 },
23154
23155 /**
23156 * Add a constraint for finding string values that contain a provided
23157 * string. This may be slow for large datasets.
23158 * @param {String} key The key that the string to match is stored in.
23159 * @param {String} substring The substring that the value must contain.
23160 * @return {AV.Query} Returns the query, so you can chain this call.
23161 */
23162 contains: function contains(key, value) {
23163 this._addCondition(key, '$regex', this._quote(value));
23164
23165 return this;
23166 },
23167
23168 /**
23169 * Add a constraint for finding string values that start with a provided
23170 * string. This query will use the backend index, so it will be fast even
23171 * for large datasets.
23172 * @param {String} key The key that the string to match is stored in.
23173 * @param {String} prefix The substring that the value must start with.
23174 * @return {AV.Query} Returns the query, so you can chain this call.
23175 */
23176 startsWith: function startsWith(key, value) {
23177 this._addCondition(key, '$regex', '^' + this._quote(value));
23178
23179 return this;
23180 },
23181
23182 /**
23183 * Add a constraint for finding string values that end with a provided
23184 * string. This will be slow for large datasets.
23185 * @param {String} key The key that the string to match is stored in.
23186 * @param {String} suffix The substring that the value must end with.
23187 * @return {AV.Query} Returns the query, so you can chain this call.
23188 */
23189 endsWith: function endsWith(key, value) {
23190 this._addCondition(key, '$regex', this._quote(value) + '$');
23191
23192 return this;
23193 },
23194
23195 /**
23196 * Sorts the results in ascending order by the given key.
23197 *
23198 * @param {String} key The key to order by.
23199 * @return {AV.Query} Returns the query, so you can chain this call.
23200 */
23201 ascending: function ascending(key) {
23202 requires(key, 'undefined is not a valid key');
23203 this._order = key;
23204 return this;
23205 },
23206
23207 /**
23208 * Also sorts the results in ascending order by the given key. The previous sort keys have
23209 * precedence over this key.
23210 *
23211 * @param {String} key The key to order by
23212 * @return {AV.Query} Returns the query so you can chain this call.
23213 */
23214 addAscending: function addAscending(key) {
23215 requires(key, 'undefined is not a valid key');
23216 if (this._order) this._order += ',' + key;else this._order = key;
23217 return this;
23218 },
23219
23220 /**
23221 * Sorts the results in descending order by the given key.
23222 *
23223 * @param {String} key The key to order by.
23224 * @return {AV.Query} Returns the query, so you can chain this call.
23225 */
23226 descending: function descending(key) {
23227 requires(key, 'undefined is not a valid key');
23228 this._order = '-' + key;
23229 return this;
23230 },
23231
23232 /**
23233 * Also sorts the results in descending order by the given key. The previous sort keys have
23234 * precedence over this key.
23235 *
23236 * @param {String} key The key to order by
23237 * @return {AV.Query} Returns the query so you can chain this call.
23238 */
23239 addDescending: function addDescending(key) {
23240 requires(key, 'undefined is not a valid key');
23241 if (this._order) this._order += ',-' + key;else this._order = '-' + key;
23242 return this;
23243 },
23244
23245 /**
23246 * Add a proximity based constraint for finding objects with key point
23247 * values near the point given.
23248 * @param {String} key The key that the AV.GeoPoint is stored in.
23249 * @param {AV.GeoPoint} point The reference AV.GeoPoint that is used.
23250 * @return {AV.Query} Returns the query, so you can chain this call.
23251 */
23252 near: function near(key, point) {
23253 if (!(point instanceof AV.GeoPoint)) {
23254 // Try to cast it to a GeoPoint, so that near("loc", [20,30]) works.
23255 point = new AV.GeoPoint(point);
23256 }
23257
23258 this._addCondition(key, '$nearSphere', point);
23259
23260 return this;
23261 },
23262
23263 /**
23264 * Add a proximity based constraint for finding objects with key point
23265 * values near the point given and within the maximum distance given.
23266 * @param {String} key The key that the AV.GeoPoint is stored in.
23267 * @param {AV.GeoPoint} point The reference AV.GeoPoint that is used.
23268 * @param maxDistance Maximum distance (in radians) of results to return.
23269 * @return {AV.Query} Returns the query, so you can chain this call.
23270 */
23271 withinRadians: function withinRadians(key, point, distance) {
23272 this.near(key, point);
23273
23274 this._addCondition(key, '$maxDistance', distance);
23275
23276 return this;
23277 },
23278
23279 /**
23280 * Add a proximity based constraint for finding objects with key point
23281 * values near the point given and within the maximum distance given.
23282 * Radius of earth used is 3958.8 miles.
23283 * @param {String} key The key that the AV.GeoPoint is stored in.
23284 * @param {AV.GeoPoint} point The reference AV.GeoPoint that is used.
23285 * @param {Number} maxDistance Maximum distance (in miles) of results to
23286 * return.
23287 * @return {AV.Query} Returns the query, so you can chain this call.
23288 */
23289 withinMiles: function withinMiles(key, point, distance) {
23290 return this.withinRadians(key, point, distance / 3958.8);
23291 },
23292
23293 /**
23294 * Add a proximity based constraint for finding objects with key point
23295 * values near the point given and within the maximum distance given.
23296 * Radius of earth used is 6371.0 kilometers.
23297 * @param {String} key The key that the AV.GeoPoint is stored in.
23298 * @param {AV.GeoPoint} point The reference AV.GeoPoint that is used.
23299 * @param {Number} maxDistance Maximum distance (in kilometers) of results
23300 * to return.
23301 * @return {AV.Query} Returns the query, so you can chain this call.
23302 */
23303 withinKilometers: function withinKilometers(key, point, distance) {
23304 return this.withinRadians(key, point, distance / 6371.0);
23305 },
23306
23307 /**
23308 * Add a constraint to the query that requires a particular key's
23309 * coordinates be contained within a given rectangular geographic bounding
23310 * box.
23311 * @param {String} key The key to be constrained.
23312 * @param {AV.GeoPoint} southwest
23313 * The lower-left inclusive corner of the box.
23314 * @param {AV.GeoPoint} northeast
23315 * The upper-right inclusive corner of the box.
23316 * @return {AV.Query} Returns the query, so you can chain this call.
23317 */
23318 withinGeoBox: function withinGeoBox(key, southwest, northeast) {
23319 if (!(southwest instanceof AV.GeoPoint)) {
23320 southwest = new AV.GeoPoint(southwest);
23321 }
23322
23323 if (!(northeast instanceof AV.GeoPoint)) {
23324 northeast = new AV.GeoPoint(northeast);
23325 }
23326
23327 this._addCondition(key, '$within', {
23328 $box: [southwest, northeast]
23329 });
23330
23331 return this;
23332 },
23333
23334 /**
23335 * Include nested AV.Objects for the provided key. You can use dot
23336 * notation to specify which fields in the included object are also fetch.
23337 * @param {String[]} keys The name of the key to include.
23338 * @return {AV.Query} Returns the query, so you can chain this call.
23339 */
23340 include: function include(keys) {
23341 var _this4 = this;
23342
23343 requires(keys, 'undefined is not a valid key');
23344
23345 _.forEach(arguments, function (keys) {
23346 var _context;
23347
23348 _this4._include = (0, _concat.default)(_context = _this4._include).call(_context, ensureArray(keys));
23349 });
23350
23351 return this;
23352 },
23353
23354 /**
23355 * Include the ACL.
23356 * @param {Boolean} [value=true] Whether to include the ACL
23357 * @return {AV.Query} Returns the query, so you can chain this call.
23358 */
23359 includeACL: function includeACL() {
23360 var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
23361 this._includeACL = value;
23362 return this;
23363 },
23364
23365 /**
23366 * Restrict the fields of the returned AV.Objects to include only the
23367 * provided keys. If this is called multiple times, then all of the keys
23368 * specified in each of the calls will be included.
23369 * @param {String[]} keys The names of the keys to include.
23370 * @return {AV.Query} Returns the query, so you can chain this call.
23371 */
23372 select: function select(keys) {
23373 var _this5 = this;
23374
23375 requires(keys, 'undefined is not a valid key');
23376
23377 _.forEach(arguments, function (keys) {
23378 var _context2;
23379
23380 _this5._select = (0, _concat.default)(_context2 = _this5._select).call(_context2, ensureArray(keys));
23381 });
23382
23383 return this;
23384 },
23385
23386 /**
23387 * Iterates over each result of a query, calling a callback for each one. If
23388 * the callback returns a promise, the iteration will not continue until
23389 * that promise has been fulfilled. If the callback returns a rejected
23390 * promise, then iteration will stop with that error. The items are
23391 * processed in an unspecified order. The query may not have any sort order,
23392 * and may not use limit or skip.
23393 * @param callback {Function} Callback that will be called with each result
23394 * of the query.
23395 * @return {Promise} A promise that will be fulfilled once the
23396 * iteration has completed.
23397 */
23398 each: function each(callback) {
23399 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
23400
23401 if (this._order || this._skip || this._limit >= 0) {
23402 var error = new Error('Cannot iterate on a query with sort, skip, or limit.');
23403 return _promise.default.reject(error);
23404 }
23405
23406 var query = new AV.Query(this.objectClass); // We can override the batch size from the options.
23407 // This is undocumented, but useful for testing.
23408
23409 query._limit = options.batchSize || 100;
23410 query._where = _.clone(this._where);
23411 query._include = _.clone(this._include);
23412 query.ascending('objectId');
23413 var finished = false;
23414 return continueWhile(function () {
23415 return !finished;
23416 }, function () {
23417 return (0, _find.default)(query).call(query, options).then(function (results) {
23418 var callbacksDone = _promise.default.resolve();
23419
23420 _.each(results, function (result) {
23421 callbacksDone = callbacksDone.then(function () {
23422 return callback(result);
23423 });
23424 });
23425
23426 return callbacksDone.then(function () {
23427 if (results.length >= query._limit) {
23428 query.greaterThan('objectId', results[results.length - 1].id);
23429 } else {
23430 finished = true;
23431 }
23432 });
23433 });
23434 });
23435 },
23436
23437 /**
23438 * Subscribe the changes of this query.
23439 *
23440 * LiveQuery is not included in the default bundle: {@link https://url.leanapp.cn/enable-live-query}.
23441 *
23442 * @since 3.0.0
23443 * @return {AV.LiveQuery} An eventemitter which can be used to get LiveQuery updates;
23444 */
23445 subscribe: function subscribe(options) {
23446 return AV.LiveQuery.init(this, options);
23447 }
23448 });
23449
23450 AV.FriendShipQuery = AV.Query._extend({
23451 _newObject: function _newObject() {
23452 var UserClass = AV.Object._getSubclass('_User');
23453
23454 return new UserClass();
23455 },
23456 _processResult: function _processResult(json) {
23457 if (json && json[this._friendshipTag]) {
23458 var user = json[this._friendshipTag];
23459
23460 if (user.__type === 'Pointer' && user.className === '_User') {
23461 delete user.__type;
23462 delete user.className;
23463 }
23464
23465 return user;
23466 } else {
23467 return null;
23468 }
23469 }
23470 });
23471};
23472
23473/***/ }),
23474/* 561 */
23475/***/ (function(module, exports, __webpack_require__) {
23476
23477"use strict";
23478
23479
23480var _interopRequireDefault = __webpack_require__(1);
23481
23482var _promise = _interopRequireDefault(__webpack_require__(12));
23483
23484var _keys = _interopRequireDefault(__webpack_require__(59));
23485
23486var _ = __webpack_require__(3);
23487
23488var EventEmitter = __webpack_require__(236);
23489
23490var _require = __webpack_require__(30),
23491 inherits = _require.inherits;
23492
23493var _require2 = __webpack_require__(27),
23494 request = _require2.request;
23495
23496var subscribe = function subscribe(queryJSON, subscriptionId) {
23497 return request({
23498 method: 'POST',
23499 path: '/LiveQuery/subscribe',
23500 data: {
23501 query: queryJSON,
23502 id: subscriptionId
23503 }
23504 });
23505};
23506
23507module.exports = function (AV) {
23508 var requireRealtime = function requireRealtime() {
23509 if (!AV._config.realtime) {
23510 throw new Error('LiveQuery not supported. Please use the LiveQuery bundle. https://url.leanapp.cn/enable-live-query');
23511 }
23512 };
23513 /**
23514 * @class
23515 * A LiveQuery, created by {@link AV.Query#subscribe} is an EventEmitter notifies changes of the Query.
23516 * @since 3.0.0
23517 */
23518
23519
23520 AV.LiveQuery = inherits(EventEmitter,
23521 /** @lends AV.LiveQuery.prototype */
23522 {
23523 constructor: function constructor(id, client, queryJSON, subscriptionId) {
23524 var _this = this;
23525
23526 EventEmitter.apply(this);
23527 this.id = id;
23528 this._client = client;
23529
23530 this._client.register(this);
23531
23532 this._queryJSON = queryJSON;
23533 this._subscriptionId = subscriptionId;
23534 this._onMessage = this._dispatch.bind(this);
23535
23536 this._onReconnect = function () {
23537 subscribe(_this._queryJSON, _this._subscriptionId).catch(function (error) {
23538 return console.error("LiveQuery resubscribe error: ".concat(error.message));
23539 });
23540 };
23541
23542 client.on('message', this._onMessage);
23543 client.on('reconnect', this._onReconnect);
23544 },
23545 _dispatch: function _dispatch(message) {
23546 var _this2 = this;
23547
23548 message.forEach(function (_ref) {
23549 var op = _ref.op,
23550 object = _ref.object,
23551 queryId = _ref.query_id,
23552 updatedKeys = _ref.updatedKeys;
23553 if (queryId !== _this2.id) return;
23554 var target = AV.parseJSON(_.extend({
23555 __type: object.className === '_File' ? 'File' : 'Object'
23556 }, object));
23557
23558 if (updatedKeys) {
23559 /**
23560 * An existing AV.Object which fulfills the Query you subscribe is updated.
23561 * @event AV.LiveQuery#update
23562 * @param {AV.Object|AV.File} target updated object
23563 * @param {String[]} updatedKeys updated keys
23564 */
23565
23566 /**
23567 * An existing AV.Object which doesn't fulfill the Query is updated and now it fulfills the Query.
23568 * @event AV.LiveQuery#enter
23569 * @param {AV.Object|AV.File} target updated object
23570 * @param {String[]} updatedKeys updated keys
23571 */
23572
23573 /**
23574 * An existing AV.Object which fulfills the Query is updated and now it doesn't fulfill the Query.
23575 * @event AV.LiveQuery#leave
23576 * @param {AV.Object|AV.File} target updated object
23577 * @param {String[]} updatedKeys updated keys
23578 */
23579 _this2.emit(op, target, updatedKeys);
23580 } else {
23581 /**
23582 * A new AV.Object which fulfills the Query you subscribe is created.
23583 * @event AV.LiveQuery#create
23584 * @param {AV.Object|AV.File} target updated object
23585 */
23586
23587 /**
23588 * An existing AV.Object which fulfills the Query you subscribe is deleted.
23589 * @event AV.LiveQuery#delete
23590 * @param {AV.Object|AV.File} target updated object
23591 */
23592 _this2.emit(op, target);
23593 }
23594 });
23595 },
23596
23597 /**
23598 * unsubscribe the query
23599 *
23600 * @return {Promise}
23601 */
23602 unsubscribe: function unsubscribe() {
23603 var client = this._client;
23604 client.off('message', this._onMessage);
23605 client.off('reconnect', this._onReconnect);
23606 client.deregister(this);
23607 return request({
23608 method: 'POST',
23609 path: '/LiveQuery/unsubscribe',
23610 data: {
23611 id: client.id,
23612 query_id: this.id
23613 }
23614 });
23615 }
23616 },
23617 /** @lends AV.LiveQuery */
23618 {
23619 init: function init(query) {
23620 var _ref2 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
23621 _ref2$subscriptionId = _ref2.subscriptionId,
23622 userDefinedSubscriptionId = _ref2$subscriptionId === void 0 ? AV._getSubscriptionId() : _ref2$subscriptionId;
23623
23624 requireRealtime();
23625 if (!(query instanceof AV.Query)) throw new TypeError('LiveQuery must be inited with a Query');
23626 return _promise.default.resolve(userDefinedSubscriptionId).then(function (subscriptionId) {
23627 return AV._config.realtime.createLiveQueryClient(subscriptionId).then(function (liveQueryClient) {
23628 var _query$_getParams = query._getParams(),
23629 where = _query$_getParams.where,
23630 keys = (0, _keys.default)(_query$_getParams),
23631 returnACL = _query$_getParams.returnACL;
23632
23633 var queryJSON = {
23634 where: where,
23635 keys: keys,
23636 returnACL: returnACL,
23637 className: query.className
23638 };
23639 var promise = subscribe(queryJSON, subscriptionId).then(function (_ref3) {
23640 var queryId = _ref3.query_id;
23641 return new AV.LiveQuery(queryId, liveQueryClient, queryJSON, subscriptionId);
23642 }).finally(function () {
23643 liveQueryClient.deregister(promise);
23644 });
23645 liveQueryClient.register(promise);
23646 return promise;
23647 });
23648 });
23649 },
23650
23651 /**
23652 * Pause the LiveQuery connection. This is useful to deactivate the SDK when the app is swtiched to background.
23653 * @static
23654 * @return void
23655 */
23656 pause: function pause() {
23657 requireRealtime();
23658 return AV._config.realtime.pause();
23659 },
23660
23661 /**
23662 * Resume the LiveQuery connection. All subscriptions will be restored after reconnection.
23663 * @static
23664 * @return void
23665 */
23666 resume: function resume() {
23667 requireRealtime();
23668 return AV._config.realtime.resume();
23669 }
23670 });
23671};
23672
23673/***/ }),
23674/* 562 */
23675/***/ (function(module, exports, __webpack_require__) {
23676
23677"use strict";
23678
23679
23680var _ = __webpack_require__(3);
23681
23682var _require = __webpack_require__(30),
23683 tap = _require.tap;
23684
23685module.exports = function (AV) {
23686 /**
23687 * @class
23688 * @example
23689 * AV.Captcha.request().then(captcha => {
23690 * captcha.bind({
23691 * textInput: 'code', // the id for textInput
23692 * image: 'captcha',
23693 * verifyButton: 'verify',
23694 * }, {
23695 * success: (validateCode) => {}, // next step
23696 * error: (error) => {}, // present error.message to user
23697 * });
23698 * });
23699 */
23700 AV.Captcha = function Captcha(options, authOptions) {
23701 this._options = options;
23702 this._authOptions = authOptions;
23703 /**
23704 * The image url of the captcha
23705 * @type string
23706 */
23707
23708 this.url = undefined;
23709 /**
23710 * The captchaToken of the captcha.
23711 * @type string
23712 */
23713
23714 this.captchaToken = undefined;
23715 /**
23716 * The validateToken of the captcha.
23717 * @type string
23718 */
23719
23720 this.validateToken = undefined;
23721 };
23722 /**
23723 * Refresh the captcha
23724 * @return {Promise.<string>} a new capcha url
23725 */
23726
23727
23728 AV.Captcha.prototype.refresh = function refresh() {
23729 var _this = this;
23730
23731 return AV.Cloud._requestCaptcha(this._options, this._authOptions).then(function (_ref) {
23732 var captchaToken = _ref.captchaToken,
23733 url = _ref.url;
23734
23735 _.extend(_this, {
23736 captchaToken: captchaToken,
23737 url: url
23738 });
23739
23740 return url;
23741 });
23742 };
23743 /**
23744 * Verify the captcha
23745 * @param {String} code The code from user input
23746 * @return {Promise.<string>} validateToken if the code is valid
23747 */
23748
23749
23750 AV.Captcha.prototype.verify = function verify(code) {
23751 var _this2 = this;
23752
23753 return AV.Cloud.verifyCaptcha(code, this.captchaToken).then(tap(function (validateToken) {
23754 return _this2.validateToken = validateToken;
23755 }));
23756 };
23757
23758 if (false) {
23759 /**
23760 * Bind the captcha to HTMLElements. <b>ONLY AVAILABLE in browsers</b>.
23761 * @param [elements]
23762 * @param {String|HTMLInputElement} [elements.textInput] An input element typed text, or the id for the element.
23763 * @param {String|HTMLImageElement} [elements.image] An image element, or the id for the element.
23764 * @param {String|HTMLElement} [elements.verifyButton] A button element, or the id for the element.
23765 * @param [callbacks]
23766 * @param {Function} [callbacks.success] Success callback will be called if the code is verified. The param `validateCode` can be used for further SMS request.
23767 * @param {Function} [callbacks.error] Error callback will be called if something goes wrong, detailed in param `error.message`.
23768 */
23769 AV.Captcha.prototype.bind = function bind(_ref2, _ref3) {
23770 var _this3 = this;
23771
23772 var textInput = _ref2.textInput,
23773 image = _ref2.image,
23774 verifyButton = _ref2.verifyButton;
23775 var success = _ref3.success,
23776 error = _ref3.error;
23777
23778 if (typeof textInput === 'string') {
23779 textInput = document.getElementById(textInput);
23780 if (!textInput) throw new Error("textInput with id ".concat(textInput, " not found"));
23781 }
23782
23783 if (typeof image === 'string') {
23784 image = document.getElementById(image);
23785 if (!image) throw new Error("image with id ".concat(image, " not found"));
23786 }
23787
23788 if (typeof verifyButton === 'string') {
23789 verifyButton = document.getElementById(verifyButton);
23790 if (!verifyButton) throw new Error("verifyButton with id ".concat(verifyButton, " not found"));
23791 }
23792
23793 this.__refresh = function () {
23794 return _this3.refresh().then(function (url) {
23795 image.src = url;
23796
23797 if (textInput) {
23798 textInput.value = '';
23799 textInput.focus();
23800 }
23801 }).catch(function (err) {
23802 return console.warn("refresh captcha fail: ".concat(err.message));
23803 });
23804 };
23805
23806 if (image) {
23807 this.__image = image;
23808 image.src = this.url;
23809 image.addEventListener('click', this.__refresh);
23810 }
23811
23812 this.__verify = function () {
23813 var code = textInput.value;
23814
23815 _this3.verify(code).catch(function (err) {
23816 _this3.__refresh();
23817
23818 throw err;
23819 }).then(success, error).catch(function (err) {
23820 return console.warn("verify captcha fail: ".concat(err.message));
23821 });
23822 };
23823
23824 if (textInput && verifyButton) {
23825 this.__verifyButton = verifyButton;
23826 verifyButton.addEventListener('click', this.__verify);
23827 }
23828 };
23829 /**
23830 * unbind the captcha from HTMLElements. <b>ONLY AVAILABLE in browsers</b>.
23831 */
23832
23833
23834 AV.Captcha.prototype.unbind = function unbind() {
23835 if (this.__image) this.__image.removeEventListener('click', this.__refresh);
23836 if (this.__verifyButton) this.__verifyButton.removeEventListener('click', this.__verify);
23837 };
23838 }
23839 /**
23840 * Request a captcha
23841 * @param [options]
23842 * @param {Number} [options.width] width(px) of the captcha, ranged 60-200
23843 * @param {Number} [options.height] height(px) of the captcha, ranged 30-100
23844 * @param {Number} [options.size=4] length of the captcha, ranged 3-6. MasterKey required.
23845 * @param {Number} [options.ttl=60] time to live(s), ranged 10-180. MasterKey required.
23846 * @return {Promise.<AV.Captcha>}
23847 */
23848
23849
23850 AV.Captcha.request = function (options, authOptions) {
23851 var captcha = new AV.Captcha(options, authOptions);
23852 return captcha.refresh().then(function () {
23853 return captcha;
23854 });
23855 };
23856};
23857
23858/***/ }),
23859/* 563 */
23860/***/ (function(module, exports, __webpack_require__) {
23861
23862"use strict";
23863
23864
23865var _interopRequireDefault = __webpack_require__(1);
23866
23867var _promise = _interopRequireDefault(__webpack_require__(12));
23868
23869var _ = __webpack_require__(3);
23870
23871var _require = __webpack_require__(27),
23872 _request = _require._request,
23873 request = _require.request;
23874
23875module.exports = function (AV) {
23876 /**
23877 * Contains functions for calling and declaring
23878 * <p><strong><em>
23879 * Some functions are only available from Cloud Code.
23880 * </em></strong></p>
23881 *
23882 * @namespace
23883 * @borrows AV.Captcha.request as requestCaptcha
23884 */
23885 AV.Cloud = AV.Cloud || {};
23886
23887 _.extend(AV.Cloud,
23888 /** @lends AV.Cloud */
23889 {
23890 /**
23891 * Makes a call to a cloud function.
23892 * @param {String} name The function name.
23893 * @param {Object} [data] The parameters to send to the cloud function.
23894 * @param {AuthOptions} [options]
23895 * @return {Promise} A promise that will be resolved with the result
23896 * of the function.
23897 */
23898 run: function run(name, data, options) {
23899 return request({
23900 service: 'engine',
23901 method: 'POST',
23902 path: "/functions/".concat(name),
23903 data: AV._encode(data, null, true),
23904 authOptions: options
23905 }).then(function (resp) {
23906 return AV._decode(resp).result;
23907 });
23908 },
23909
23910 /**
23911 * Makes a call to a cloud function, you can send {AV.Object} as param or a field of param; the response
23912 * from server will also be parsed as an {AV.Object}, array of {AV.Object}, or object includes {AV.Object}
23913 * @param {String} name The function name.
23914 * @param {Object} [data] The parameters to send to the cloud function.
23915 * @param {AuthOptions} [options]
23916 * @return {Promise} A promise that will be resolved with the result of the function.
23917 */
23918 rpc: function rpc(name, data, options) {
23919 if (_.isArray(data)) {
23920 return _promise.default.reject(new Error("Can't pass Array as the param of rpc function in JavaScript SDK."));
23921 }
23922
23923 return request({
23924 service: 'engine',
23925 method: 'POST',
23926 path: "/call/".concat(name),
23927 data: AV._encodeObjectOrArray(data),
23928 authOptions: options
23929 }).then(function (resp) {
23930 return AV._decode(resp).result;
23931 });
23932 },
23933
23934 /**
23935 * Make a call to request server date time.
23936 * @return {Promise.<Date>} A promise that will be resolved with the result
23937 * of the function.
23938 * @since 0.5.9
23939 */
23940 getServerDate: function getServerDate() {
23941 return _request('date', null, null, 'GET').then(function (resp) {
23942 return AV._decode(resp);
23943 });
23944 },
23945
23946 /**
23947 * Makes a call to request an sms code for operation verification.
23948 * @param {String|Object} data The mobile phone number string or a JSON
23949 * object that contains mobilePhoneNumber,template,sign,op,ttl,name etc.
23950 * @param {String} data.mobilePhoneNumber
23951 * @param {String} [data.template] sms template name
23952 * @param {String} [data.sign] sms signature name
23953 * @param {String} [data.smsType] sending code by `sms` (default) or `voice` call
23954 * @param {SMSAuthOptions} [options]
23955 * @return {Promise} A promise that will be resolved if the request succeed
23956 */
23957 requestSmsCode: function requestSmsCode(data) {
23958 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
23959
23960 if (_.isString(data)) {
23961 data = {
23962 mobilePhoneNumber: data
23963 };
23964 }
23965
23966 if (!data.mobilePhoneNumber) {
23967 throw new Error('Missing mobilePhoneNumber.');
23968 }
23969
23970 if (options.validateToken) {
23971 data = _.extend({}, data, {
23972 validate_token: options.validateToken
23973 });
23974 }
23975
23976 return _request('requestSmsCode', null, null, 'POST', data, options);
23977 },
23978
23979 /**
23980 * Makes a call to verify sms code that sent by AV.Cloud.requestSmsCode
23981 * @param {String} code The sms code sent by AV.Cloud.requestSmsCode
23982 * @param {phone} phone The mobile phoner number.
23983 * @return {Promise} A promise that will be resolved with the result
23984 * of the function.
23985 */
23986 verifySmsCode: function verifySmsCode(code, phone) {
23987 if (!code) throw new Error('Missing sms code.');
23988 var params = {};
23989
23990 if (_.isString(phone)) {
23991 params['mobilePhoneNumber'] = phone;
23992 }
23993
23994 return _request('verifySmsCode', code, null, 'POST', params);
23995 },
23996 _requestCaptcha: function _requestCaptcha(options, authOptions) {
23997 return _request('requestCaptcha', null, null, 'GET', options, authOptions).then(function (_ref) {
23998 var url = _ref.captcha_url,
23999 captchaToken = _ref.captcha_token;
24000 return {
24001 captchaToken: captchaToken,
24002 url: url
24003 };
24004 });
24005 },
24006
24007 /**
24008 * Request a captcha.
24009 */
24010 requestCaptcha: AV.Captcha.request,
24011
24012 /**
24013 * Verify captcha code. This is the low-level API for captcha.
24014 * Checkout {@link AV.Captcha} for high abstract APIs.
24015 * @param {String} code the code from user input
24016 * @param {String} captchaToken captchaToken returned by {@link AV.Cloud.requestCaptcha}
24017 * @return {Promise.<String>} validateToken if the code is valid
24018 */
24019 verifyCaptcha: function verifyCaptcha(code, captchaToken) {
24020 return _request('verifyCaptcha', null, null, 'POST', {
24021 captcha_code: code,
24022 captcha_token: captchaToken
24023 }).then(function (_ref2) {
24024 var validateToken = _ref2.validate_token;
24025 return validateToken;
24026 });
24027 }
24028 });
24029};
24030
24031/***/ }),
24032/* 564 */
24033/***/ (function(module, exports, __webpack_require__) {
24034
24035"use strict";
24036
24037
24038var request = __webpack_require__(27).request;
24039
24040module.exports = function (AV) {
24041 AV.Installation = AV.Object.extend('_Installation');
24042 /**
24043 * @namespace
24044 */
24045
24046 AV.Push = AV.Push || {};
24047 /**
24048 * Sends a push notification.
24049 * @param {Object} data The data of the push notification.
24050 * @param {String[]} [data.channels] An Array of channels to push to.
24051 * @param {Date} [data.push_time] A Date object for when to send the push.
24052 * @param {Date} [data.expiration_time] A Date object for when to expire
24053 * the push.
24054 * @param {Number} [data.expiration_interval] The seconds from now to expire the push.
24055 * @param {Number} [data.flow_control] The clients to notify per second
24056 * @param {AV.Query} [data.where] An AV.Query over AV.Installation that is used to match
24057 * a set of installations to push to.
24058 * @param {String} [data.cql] A CQL statement over AV.Installation that is used to match
24059 * a set of installations to push to.
24060 * @param {Object} data.data The data to send as part of the push.
24061 More details: https://url.leanapp.cn/pushData
24062 * @param {AuthOptions} [options]
24063 * @return {Promise}
24064 */
24065
24066 AV.Push.send = function (data, options) {
24067 if (data.where) {
24068 data.where = data.where._getParams().where;
24069 }
24070
24071 if (data.where && data.cql) {
24072 throw new Error("Both where and cql can't be set");
24073 }
24074
24075 if (data.push_time) {
24076 data.push_time = data.push_time.toJSON();
24077 }
24078
24079 if (data.expiration_time) {
24080 data.expiration_time = data.expiration_time.toJSON();
24081 }
24082
24083 if (data.expiration_time && data.expiration_interval) {
24084 throw new Error("Both expiration_time and expiration_interval can't be set");
24085 }
24086
24087 return request({
24088 service: 'push',
24089 method: 'POST',
24090 path: '/push',
24091 data: data,
24092 authOptions: options
24093 });
24094 };
24095};
24096
24097/***/ }),
24098/* 565 */
24099/***/ (function(module, exports, __webpack_require__) {
24100
24101"use strict";
24102
24103
24104var _interopRequireDefault = __webpack_require__(1);
24105
24106var _promise = _interopRequireDefault(__webpack_require__(12));
24107
24108var _typeof2 = _interopRequireDefault(__webpack_require__(73));
24109
24110var _ = __webpack_require__(3);
24111
24112var AVRequest = __webpack_require__(27)._request;
24113
24114var _require = __webpack_require__(30),
24115 getSessionToken = _require.getSessionToken;
24116
24117module.exports = function (AV) {
24118 var getUser = function getUser() {
24119 var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
24120 var sessionToken = getSessionToken(options);
24121
24122 if (sessionToken) {
24123 return AV.User._fetchUserBySessionToken(getSessionToken(options));
24124 }
24125
24126 return AV.User.currentAsync();
24127 };
24128
24129 var getUserPointer = function getUserPointer(options) {
24130 return getUser(options).then(function (currUser) {
24131 return AV.Object.createWithoutData('_User', currUser.id)._toPointer();
24132 });
24133 };
24134 /**
24135 * Contains functions to deal with Status in LeanCloud.
24136 * @class
24137 */
24138
24139
24140 AV.Status = function (imageUrl, message) {
24141 this.data = {};
24142 this.inboxType = 'default';
24143 this.query = null;
24144
24145 if (imageUrl && (0, _typeof2.default)(imageUrl) === 'object') {
24146 this.data = imageUrl;
24147 } else {
24148 if (imageUrl) {
24149 this.data.image = imageUrl;
24150 }
24151
24152 if (message) {
24153 this.data.message = message;
24154 }
24155 }
24156
24157 return this;
24158 };
24159
24160 _.extend(AV.Status.prototype,
24161 /** @lends AV.Status.prototype */
24162 {
24163 /**
24164 * Gets the value of an attribute in status data.
24165 * @param {String} attr The string name of an attribute.
24166 */
24167 get: function get(attr) {
24168 return this.data[attr];
24169 },
24170
24171 /**
24172 * Sets a hash of model attributes on the status data.
24173 * @param {String} key The key to set.
24174 * @param {any} value The value to give it.
24175 */
24176 set: function set(key, value) {
24177 this.data[key] = value;
24178 return this;
24179 },
24180
24181 /**
24182 * Destroy this status,then it will not be avaiable in other user's inboxes.
24183 * @param {AuthOptions} options
24184 * @return {Promise} A promise that is fulfilled when the destroy
24185 * completes.
24186 */
24187 destroy: function destroy(options) {
24188 if (!this.id) return _promise.default.reject(new Error('The status id is not exists.'));
24189 var request = AVRequest('statuses', null, this.id, 'DELETE', options);
24190 return request;
24191 },
24192
24193 /**
24194 * Cast the AV.Status object to an AV.Object pointer.
24195 * @return {AV.Object} A AV.Object pointer.
24196 */
24197 toObject: function toObject() {
24198 if (!this.id) return null;
24199 return AV.Object.createWithoutData('_Status', this.id);
24200 },
24201 _getDataJSON: function _getDataJSON() {
24202 var json = _.clone(this.data);
24203
24204 return AV._encode(json);
24205 },
24206
24207 /**
24208 * Send a status by a AV.Query object.
24209 * @since 0.3.0
24210 * @param {AuthOptions} options
24211 * @return {Promise} A promise that is fulfilled when the send
24212 * completes.
24213 * @example
24214 * // send a status to male users
24215 * var status = new AVStatus('image url', 'a message');
24216 * status.query = new AV.Query('_User');
24217 * status.query.equalTo('gender', 'male');
24218 * status.send().then(function(){
24219 * //send status successfully.
24220 * }, function(err){
24221 * //an error threw.
24222 * console.dir(err);
24223 * });
24224 */
24225 send: function send() {
24226 var _this = this;
24227
24228 var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
24229
24230 if (!getSessionToken(options) && !AV.User.current()) {
24231 throw new Error('Please signin an user.');
24232 }
24233
24234 if (!this.query) {
24235 return AV.Status.sendStatusToFollowers(this, options);
24236 }
24237
24238 return getUserPointer(options).then(function (currUser) {
24239 var query = _this.query._getParams();
24240
24241 query.className = _this.query.className;
24242 var data = {};
24243 data.query = query;
24244 _this.data = _this.data || {};
24245 _this.data.source = _this.data.source || currUser;
24246 data.data = _this._getDataJSON();
24247 data.inboxType = _this.inboxType || 'default';
24248 return AVRequest('statuses', null, null, 'POST', data, options);
24249 }).then(function (response) {
24250 _this.id = response.objectId;
24251 _this.createdAt = AV._parseDate(response.createdAt);
24252 return _this;
24253 });
24254 },
24255 _finishFetch: function _finishFetch(serverData) {
24256 this.id = serverData.objectId;
24257 this.createdAt = AV._parseDate(serverData.createdAt);
24258 this.updatedAt = AV._parseDate(serverData.updatedAt);
24259 this.messageId = serverData.messageId;
24260 delete serverData.messageId;
24261 delete serverData.objectId;
24262 delete serverData.createdAt;
24263 delete serverData.updatedAt;
24264 this.data = AV._decode(serverData);
24265 }
24266 });
24267 /**
24268 * Send a status to current signined user's followers.
24269 * @since 0.3.0
24270 * @param {AV.Status} status A status object to be send to followers.
24271 * @param {AuthOptions} options
24272 * @return {Promise} A promise that is fulfilled when the send
24273 * completes.
24274 * @example
24275 * var status = new AVStatus('image url', 'a message');
24276 * AV.Status.sendStatusToFollowers(status).then(function(){
24277 * //send status successfully.
24278 * }, function(err){
24279 * //an error threw.
24280 * console.dir(err);
24281 * });
24282 */
24283
24284
24285 AV.Status.sendStatusToFollowers = function (status) {
24286 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
24287
24288 if (!getSessionToken(options) && !AV.User.current()) {
24289 throw new Error('Please signin an user.');
24290 }
24291
24292 return getUserPointer(options).then(function (currUser) {
24293 var query = {};
24294 query.className = '_Follower';
24295 query.keys = 'follower';
24296 query.where = {
24297 user: currUser
24298 };
24299 var data = {};
24300 data.query = query;
24301 status.data = status.data || {};
24302 status.data.source = status.data.source || currUser;
24303 data.data = status._getDataJSON();
24304 data.inboxType = status.inboxType || 'default';
24305 var request = AVRequest('statuses', null, null, 'POST', data, options);
24306 return request.then(function (response) {
24307 status.id = response.objectId;
24308 status.createdAt = AV._parseDate(response.createdAt);
24309 return status;
24310 });
24311 });
24312 };
24313 /**
24314 * <p>Send a status from current signined user to other user's private status inbox.</p>
24315 * @since 0.3.0
24316 * @param {AV.Status} status A status object to be send to followers.
24317 * @param {String} target The target user or user's objectId.
24318 * @param {AuthOptions} options
24319 * @return {Promise} A promise that is fulfilled when the send
24320 * completes.
24321 * @example
24322 * // send a private status to user '52e84e47e4b0f8de283b079b'
24323 * var status = new AVStatus('image url', 'a message');
24324 * AV.Status.sendPrivateStatus(status, '52e84e47e4b0f8de283b079b').then(function(){
24325 * //send status successfully.
24326 * }, function(err){
24327 * //an error threw.
24328 * console.dir(err);
24329 * });
24330 */
24331
24332
24333 AV.Status.sendPrivateStatus = function (status, target) {
24334 var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
24335
24336 if (!getSessionToken(options) && !AV.User.current()) {
24337 throw new Error('Please signin an user.');
24338 }
24339
24340 if (!target) {
24341 throw new Error('Invalid target user.');
24342 }
24343
24344 var userObjectId = _.isString(target) ? target : target.id;
24345
24346 if (!userObjectId) {
24347 throw new Error('Invalid target user.');
24348 }
24349
24350 return getUserPointer(options).then(function (currUser) {
24351 var query = {};
24352 query.className = '_User';
24353 query.where = {
24354 objectId: userObjectId
24355 };
24356 var data = {};
24357 data.query = query;
24358 status.data = status.data || {};
24359 status.data.source = status.data.source || currUser;
24360 data.data = status._getDataJSON();
24361 data.inboxType = 'private';
24362 status.inboxType = 'private';
24363 var request = AVRequest('statuses', null, null, 'POST', data, options);
24364 return request.then(function (response) {
24365 status.id = response.objectId;
24366 status.createdAt = AV._parseDate(response.createdAt);
24367 return status;
24368 });
24369 });
24370 };
24371 /**
24372 * Count unread statuses in someone's inbox.
24373 * @since 0.3.0
24374 * @param {AV.User} owner The status owner.
24375 * @param {String} inboxType The inbox type, 'default' by default.
24376 * @param {AuthOptions} options
24377 * @return {Promise} A promise that is fulfilled when the count
24378 * completes.
24379 * @example
24380 * AV.Status.countUnreadStatuses(AV.User.current()).then(function(response){
24381 * console.log(response.unread); //unread statuses number.
24382 * console.log(response.total); //total statuses number.
24383 * });
24384 */
24385
24386
24387 AV.Status.countUnreadStatuses = function (owner) {
24388 var inboxType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'default';
24389 var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
24390 if (!_.isString(inboxType)) options = inboxType;
24391
24392 if (!getSessionToken(options) && owner == null && !AV.User.current()) {
24393 throw new Error('Please signin an user or pass the owner objectId.');
24394 }
24395
24396 return _promise.default.resolve(owner || getUser(options)).then(function (owner) {
24397 var params = {};
24398 params.inboxType = AV._encode(inboxType);
24399 params.owner = AV._encode(owner);
24400 return AVRequest('subscribe/statuses/count', null, null, 'GET', params, options);
24401 });
24402 };
24403 /**
24404 * reset unread statuses count in someone's inbox.
24405 * @since 2.1.0
24406 * @param {AV.User} owner The status owner.
24407 * @param {String} inboxType The inbox type, 'default' by default.
24408 * @param {AuthOptions} options
24409 * @return {Promise} A promise that is fulfilled when the reset
24410 * completes.
24411 * @example
24412 * AV.Status.resetUnreadCount(AV.User.current()).then(function(response){
24413 * console.log(response.unread); //unread statuses number.
24414 * console.log(response.total); //total statuses number.
24415 * });
24416 */
24417
24418
24419 AV.Status.resetUnreadCount = function (owner) {
24420 var inboxType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'default';
24421 var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
24422 if (!_.isString(inboxType)) options = inboxType;
24423
24424 if (!getSessionToken(options) && owner == null && !AV.User.current()) {
24425 throw new Error('Please signin an user or pass the owner objectId.');
24426 }
24427
24428 return _promise.default.resolve(owner || getUser(options)).then(function (owner) {
24429 var params = {};
24430 params.inboxType = AV._encode(inboxType);
24431 params.owner = AV._encode(owner);
24432 return AVRequest('subscribe/statuses/resetUnreadCount', null, null, 'POST', params, options);
24433 });
24434 };
24435 /**
24436 * Create a status query to find someone's published statuses.
24437 * @since 0.3.0
24438 * @param {AV.User} source The status source, typically the publisher.
24439 * @return {AV.Query} The query object for status.
24440 * @example
24441 * //Find current user's published statuses.
24442 * var query = AV.Status.statusQuery(AV.User.current());
24443 * query.find().then(function(statuses){
24444 * //process statuses
24445 * });
24446 */
24447
24448
24449 AV.Status.statusQuery = function (source) {
24450 var query = new AV.Query('_Status');
24451
24452 if (source) {
24453 query.equalTo('source', source);
24454 }
24455
24456 return query;
24457 };
24458 /**
24459 * <p>AV.InboxQuery defines a query that is used to fetch somebody's inbox statuses.</p>
24460 * @class
24461 */
24462
24463
24464 AV.InboxQuery = AV.Query._extend(
24465 /** @lends AV.InboxQuery.prototype */
24466 {
24467 _objectClass: AV.Status,
24468 _sinceId: 0,
24469 _maxId: 0,
24470 _inboxType: 'default',
24471 _owner: null,
24472 _newObject: function _newObject() {
24473 return new AV.Status();
24474 },
24475 _createRequest: function _createRequest(params, options) {
24476 return AV.InboxQuery.__super__._createRequest.call(this, params, options, '/subscribe/statuses');
24477 },
24478
24479 /**
24480 * Sets the messageId of results to skip before returning any results.
24481 * This is useful for pagination.
24482 * Default is zero.
24483 * @param {Number} n the mesage id.
24484 * @return {AV.InboxQuery} Returns the query, so you can chain this call.
24485 */
24486 sinceId: function sinceId(id) {
24487 this._sinceId = id;
24488 return this;
24489 },
24490
24491 /**
24492 * Sets the maximal messageId of results。
24493 * This is useful for pagination.
24494 * Default is zero that is no limition.
24495 * @param {Number} n the mesage id.
24496 * @return {AV.InboxQuery} Returns the query, so you can chain this call.
24497 */
24498 maxId: function maxId(id) {
24499 this._maxId = id;
24500 return this;
24501 },
24502
24503 /**
24504 * Sets the owner of the querying inbox.
24505 * @param {AV.User} owner The inbox owner.
24506 * @return {AV.InboxQuery} Returns the query, so you can chain this call.
24507 */
24508 owner: function owner(_owner) {
24509 this._owner = _owner;
24510 return this;
24511 },
24512
24513 /**
24514 * Sets the querying inbox type.default is 'default'.
24515 * @param {String} type The inbox type.
24516 * @return {AV.InboxQuery} Returns the query, so you can chain this call.
24517 */
24518 inboxType: function inboxType(type) {
24519 this._inboxType = type;
24520 return this;
24521 },
24522 _getParams: function _getParams() {
24523 var params = AV.InboxQuery.__super__._getParams.call(this);
24524
24525 params.owner = AV._encode(this._owner);
24526 params.inboxType = AV._encode(this._inboxType);
24527 params.sinceId = AV._encode(this._sinceId);
24528 params.maxId = AV._encode(this._maxId);
24529 return params;
24530 }
24531 });
24532 /**
24533 * Create a inbox status query to find someone's inbox statuses.
24534 * @since 0.3.0
24535 * @param {AV.User} owner The inbox's owner
24536 * @param {String} inboxType The inbox type,'default' by default.
24537 * @return {AV.InboxQuery} The inbox query object.
24538 * @see AV.InboxQuery
24539 * @example
24540 * //Find current user's default inbox statuses.
24541 * var query = AV.Status.inboxQuery(AV.User.current());
24542 * //find the statuses after the last message id
24543 * query.sinceId(lastMessageId);
24544 * query.find().then(function(statuses){
24545 * //process statuses
24546 * });
24547 */
24548
24549 AV.Status.inboxQuery = function (owner, inboxType) {
24550 var query = new AV.InboxQuery(AV.Status);
24551
24552 if (owner) {
24553 query._owner = owner;
24554 }
24555
24556 if (inboxType) {
24557 query._inboxType = inboxType;
24558 }
24559
24560 return query;
24561 };
24562};
24563
24564/***/ }),
24565/* 566 */
24566/***/ (function(module, exports, __webpack_require__) {
24567
24568"use strict";
24569
24570
24571var _interopRequireDefault = __webpack_require__(1);
24572
24573var _stringify = _interopRequireDefault(__webpack_require__(36));
24574
24575var _map = _interopRequireDefault(__webpack_require__(35));
24576
24577var _ = __webpack_require__(3);
24578
24579var AVRequest = __webpack_require__(27)._request;
24580
24581module.exports = function (AV) {
24582 /**
24583 * A builder to generate sort string for app searching.For example:
24584 * @class
24585 * @since 0.5.1
24586 * @example
24587 * var builder = new AV.SearchSortBuilder();
24588 * builder.ascending('key1').descending('key2','max');
24589 * var query = new AV.SearchQuery('Player');
24590 * query.sortBy(builder);
24591 * query.find().then();
24592 */
24593 AV.SearchSortBuilder = function () {
24594 this._sortFields = [];
24595 };
24596
24597 _.extend(AV.SearchSortBuilder.prototype,
24598 /** @lends AV.SearchSortBuilder.prototype */
24599 {
24600 _addField: function _addField(key, order, mode, missing) {
24601 var field = {};
24602 field[key] = {
24603 order: order || 'asc',
24604 mode: mode || 'avg',
24605 missing: '_' + (missing || 'last')
24606 };
24607
24608 this._sortFields.push(field);
24609
24610 return this;
24611 },
24612
24613 /**
24614 * Sorts the results in ascending order by the given key and options.
24615 *
24616 * @param {String} key The key to order by.
24617 * @param {String} mode The sort mode, default is 'avg', you can choose
24618 * 'max' or 'min' too.
24619 * @param {String} missing The missing key behaviour, default is 'last',
24620 * you can choose 'first' too.
24621 * @return {AV.SearchSortBuilder} Returns the builder, so you can chain this call.
24622 */
24623 ascending: function ascending(key, mode, missing) {
24624 return this._addField(key, 'asc', mode, missing);
24625 },
24626
24627 /**
24628 * Sorts the results in descending order by the given key and options.
24629 *
24630 * @param {String} key The key to order by.
24631 * @param {String} mode The sort mode, default is 'avg', you can choose
24632 * 'max' or 'min' too.
24633 * @param {String} missing The missing key behaviour, default is 'last',
24634 * you can choose 'first' too.
24635 * @return {AV.SearchSortBuilder} Returns the builder, so you can chain this call.
24636 */
24637 descending: function descending(key, mode, missing) {
24638 return this._addField(key, 'desc', mode, missing);
24639 },
24640
24641 /**
24642 * Add a proximity based constraint for finding objects with key point
24643 * values near the point given.
24644 * @param {String} key The key that the AV.GeoPoint is stored in.
24645 * @param {AV.GeoPoint} point The reference AV.GeoPoint that is used.
24646 * @param {Object} options The other options such as mode,order, unit etc.
24647 * @return {AV.SearchSortBuilder} Returns the builder, so you can chain this call.
24648 */
24649 whereNear: function whereNear(key, point, options) {
24650 options = options || {};
24651 var field = {};
24652 var geo = {
24653 lat: point.latitude,
24654 lon: point.longitude
24655 };
24656 var m = {
24657 order: options.order || 'asc',
24658 mode: options.mode || 'avg',
24659 unit: options.unit || 'km'
24660 };
24661 m[key] = geo;
24662 field['_geo_distance'] = m;
24663
24664 this._sortFields.push(field);
24665
24666 return this;
24667 },
24668
24669 /**
24670 * Build a sort string by configuration.
24671 * @return {String} the sort string.
24672 */
24673 build: function build() {
24674 return (0, _stringify.default)(AV._encode(this._sortFields));
24675 }
24676 });
24677 /**
24678 * App searching query.Use just like AV.Query:
24679 *
24680 * Visit <a href='https://leancloud.cn/docs/app_search_guide.html'>App Searching Guide</a>
24681 * for more details.
24682 * @class
24683 * @since 0.5.1
24684 * @example
24685 * var query = new AV.SearchQuery('Player');
24686 * query.queryString('*');
24687 * query.find().then(function(results) {
24688 * console.log('Found %d objects', query.hits());
24689 * //Process results
24690 * });
24691 */
24692
24693
24694 AV.SearchQuery = AV.Query._extend(
24695 /** @lends AV.SearchQuery.prototype */
24696 {
24697 _sid: null,
24698 _hits: 0,
24699 _queryString: null,
24700 _highlights: null,
24701 _sortBuilder: null,
24702 _clazz: null,
24703 constructor: function constructor(className) {
24704 if (className) {
24705 this._clazz = className;
24706 } else {
24707 className = '__INVALID_CLASS';
24708 }
24709
24710 AV.Query.call(this, className);
24711 },
24712 _createRequest: function _createRequest(params, options) {
24713 return AVRequest('search/select', null, null, 'GET', params || this._getParams(), options);
24714 },
24715
24716 /**
24717 * Sets the sid of app searching query.Default is null.
24718 * @param {String} sid Scroll id for searching.
24719 * @return {AV.SearchQuery} Returns the query, so you can chain this call.
24720 */
24721 sid: function sid(_sid) {
24722 this._sid = _sid;
24723 return this;
24724 },
24725
24726 /**
24727 * Sets the query string of app searching.
24728 * @param {String} q The query string.
24729 * @return {AV.SearchQuery} Returns the query, so you can chain this call.
24730 */
24731 queryString: function queryString(q) {
24732 this._queryString = q;
24733 return this;
24734 },
24735
24736 /**
24737 * Sets the highlight fields. Such as
24738 * <pre><code>
24739 * query.highlights('title');
24740 * //or pass an array.
24741 * query.highlights(['title', 'content'])
24742 * </code></pre>
24743 * @param {String|String[]} highlights a list of fields.
24744 * @return {AV.SearchQuery} Returns the query, so you can chain this call.
24745 */
24746 highlights: function highlights(_highlights) {
24747 var objects;
24748
24749 if (_highlights && _.isString(_highlights)) {
24750 objects = _.toArray(arguments);
24751 } else {
24752 objects = _highlights;
24753 }
24754
24755 this._highlights = objects;
24756 return this;
24757 },
24758
24759 /**
24760 * Sets the sort builder for this query.
24761 * @see AV.SearchSortBuilder
24762 * @param { AV.SearchSortBuilder} builder The sort builder.
24763 * @return {AV.SearchQuery} Returns the query, so you can chain this call.
24764 *
24765 */
24766 sortBy: function sortBy(builder) {
24767 this._sortBuilder = builder;
24768 return this;
24769 },
24770
24771 /**
24772 * Returns the number of objects that match this query.
24773 * @return {Number}
24774 */
24775 hits: function hits() {
24776 if (!this._hits) {
24777 this._hits = 0;
24778 }
24779
24780 return this._hits;
24781 },
24782 _processResult: function _processResult(json) {
24783 delete json['className'];
24784 delete json['_app_url'];
24785 delete json['_deeplink'];
24786 return json;
24787 },
24788
24789 /**
24790 * Returns true when there are more documents can be retrieved by this
24791 * query instance, you can call find function to get more results.
24792 * @see AV.SearchQuery#find
24793 * @return {Boolean}
24794 */
24795 hasMore: function hasMore() {
24796 return !this._hitEnd;
24797 },
24798
24799 /**
24800 * Reset current query instance state(such as sid, hits etc) except params
24801 * for a new searching. After resetting, hasMore() will return true.
24802 */
24803 reset: function reset() {
24804 this._hitEnd = false;
24805 this._sid = null;
24806 this._hits = 0;
24807 },
24808
24809 /**
24810 * Retrieves a list of AVObjects that satisfy this query.
24811 * Either options.success or options.error is called when the find
24812 * completes.
24813 *
24814 * @see AV.Query#find
24815 * @param {AuthOptions} options
24816 * @return {Promise} A promise that is resolved with the results when
24817 * the query completes.
24818 */
24819 find: function find(options) {
24820 var self = this;
24821
24822 var request = this._createRequest(undefined, options);
24823
24824 return request.then(function (response) {
24825 //update sid for next querying.
24826 if (response.sid) {
24827 self._oldSid = self._sid;
24828 self._sid = response.sid;
24829 } else {
24830 self._sid = null;
24831 self._hitEnd = true;
24832 }
24833
24834 self._hits = response.hits || 0;
24835 return (0, _map.default)(_).call(_, response.results, function (json) {
24836 if (json.className) {
24837 response.className = json.className;
24838 }
24839
24840 var obj = self._newObject(response);
24841
24842 obj.appURL = json['_app_url'];
24843
24844 obj._finishFetch(self._processResult(json), true);
24845
24846 return obj;
24847 });
24848 });
24849 },
24850 _getParams: function _getParams() {
24851 var params = AV.SearchQuery.__super__._getParams.call(this);
24852
24853 delete params.where;
24854
24855 if (this._clazz) {
24856 params.clazz = this.className;
24857 }
24858
24859 if (this._sid) {
24860 params.sid = this._sid;
24861 }
24862
24863 if (!this._queryString) {
24864 throw new Error('Please set query string.');
24865 } else {
24866 params.q = this._queryString;
24867 }
24868
24869 if (this._highlights) {
24870 params.highlights = this._highlights.join(',');
24871 }
24872
24873 if (this._sortBuilder && params.order) {
24874 throw new Error('sort and order can not be set at same time.');
24875 }
24876
24877 if (this._sortBuilder) {
24878 params.sort = this._sortBuilder.build();
24879 }
24880
24881 return params;
24882 }
24883 });
24884};
24885/**
24886 * Sorts the results in ascending order by the given key.
24887 *
24888 * @method AV.SearchQuery#ascending
24889 * @param {String} key The key to order by.
24890 * @return {AV.SearchQuery} Returns the query, so you can chain this call.
24891 */
24892
24893/**
24894 * Also sorts the results in ascending order by the given key. The previous sort keys have
24895 * precedence over this key.
24896 *
24897 * @method AV.SearchQuery#addAscending
24898 * @param {String} key The key to order by
24899 * @return {AV.SearchQuery} Returns the query so you can chain this call.
24900 */
24901
24902/**
24903 * Sorts the results in descending order by the given key.
24904 *
24905 * @method AV.SearchQuery#descending
24906 * @param {String} key The key to order by.
24907 * @return {AV.SearchQuery} Returns the query, so you can chain this call.
24908 */
24909
24910/**
24911 * Also sorts the results in descending order by the given key. The previous sort keys have
24912 * precedence over this key.
24913 *
24914 * @method AV.SearchQuery#addDescending
24915 * @param {String} key The key to order by
24916 * @return {AV.SearchQuery} Returns the query so you can chain this call.
24917 */
24918
24919/**
24920 * Include nested AV.Objects for the provided key. You can use dot
24921 * notation to specify which fields in the included object are also fetch.
24922 * @method AV.SearchQuery#include
24923 * @param {String[]} keys The name of the key to include.
24924 * @return {AV.SearchQuery} Returns the query, so you can chain this call.
24925 */
24926
24927/**
24928 * Sets the number of results to skip before returning any results.
24929 * This is useful for pagination.
24930 * Default is to skip zero results.
24931 * @method AV.SearchQuery#skip
24932 * @param {Number} n the number of results to skip.
24933 * @return {AV.SearchQuery} Returns the query, so you can chain this call.
24934 */
24935
24936/**
24937 * Sets the limit of the number of results to return. The default limit is
24938 * 100, with a maximum of 1000 results being returned at a time.
24939 * @method AV.SearchQuery#limit
24940 * @param {Number} n the number of results to limit to.
24941 * @return {AV.SearchQuery} Returns the query, so you can chain this call.
24942 */
24943
24944/***/ }),
24945/* 567 */
24946/***/ (function(module, exports, __webpack_require__) {
24947
24948"use strict";
24949
24950
24951var _interopRequireDefault = __webpack_require__(1);
24952
24953var _promise = _interopRequireDefault(__webpack_require__(12));
24954
24955var _ = __webpack_require__(3);
24956
24957var AVError = __webpack_require__(46);
24958
24959var _require = __webpack_require__(27),
24960 request = _require.request;
24961
24962module.exports = function (AV) {
24963 /**
24964 * 包含了使用了 LeanCloud
24965 * <a href='/docs/leaninsight_guide.html'>离线数据分析功能</a>的函数。
24966 * <p><strong><em>
24967 * 仅在云引擎运行环境下有效。
24968 * </em></strong></p>
24969 * @namespace
24970 */
24971 AV.Insight = AV.Insight || {};
24972
24973 _.extend(AV.Insight,
24974 /** @lends AV.Insight */
24975 {
24976 /**
24977 * 开始一个 Insight 任务。结果里将返回 Job id,你可以拿得到的 id 使用
24978 * AV.Insight.JobQuery 查询任务状态和结果。
24979 * @param {Object} jobConfig 任务配置的 JSON 对象,例如:<code><pre>
24980 * { "sql" : "select count(*) as c,gender from _User group by gender",
24981 * "saveAs": {
24982 * "className" : "UserGender",
24983 * "limit": 1
24984 * }
24985 * }
24986 * </pre></code>
24987 * sql 指定任务执行的 SQL 语句, saveAs(可选) 指定将结果保存在哪张表里,limit 最大 1000。
24988 * @param {AuthOptions} [options]
24989 * @return {Promise} A promise that will be resolved with the result
24990 * of the function.
24991 */
24992 startJob: function startJob(jobConfig, options) {
24993 if (!jobConfig || !jobConfig.sql) {
24994 throw new Error('Please provide the sql to run the job.');
24995 }
24996
24997 var data = {
24998 jobConfig: jobConfig,
24999 appId: AV.applicationId
25000 };
25001 return request({
25002 path: '/bigquery/jobs',
25003 method: 'POST',
25004 data: AV._encode(data, null, true),
25005 authOptions: options,
25006 signKey: false
25007 }).then(function (resp) {
25008 return AV._decode(resp).id;
25009 });
25010 },
25011
25012 /**
25013 * 监听 Insight 任务事件(未来推出独立部署的离线分析服务后开放)
25014 * <p><strong><em>
25015 * 仅在云引擎运行环境下有效。
25016 * </em></strong></p>
25017 * @param {String} event 监听的事件,目前尚不支持。
25018 * @param {Function} 监听回调函数,接收 (err, id) 两个参数,err 表示错误信息,
25019 * id 表示任务 id。接下来你可以拿这个 id 使用AV.Insight.JobQuery 查询任务状态和结果。
25020 *
25021 */
25022 on: function on(event, cb) {}
25023 });
25024 /**
25025 * 创建一个对象,用于查询 Insight 任务状态和结果。
25026 * @class
25027 * @param {String} id 任务 id
25028 * @since 0.5.5
25029 */
25030
25031
25032 AV.Insight.JobQuery = function (id, className) {
25033 if (!id) {
25034 throw new Error('Please provide the job id.');
25035 }
25036
25037 this.id = id;
25038 this.className = className;
25039 this._skip = 0;
25040 this._limit = 100;
25041 };
25042
25043 _.extend(AV.Insight.JobQuery.prototype,
25044 /** @lends AV.Insight.JobQuery.prototype */
25045 {
25046 /**
25047 * Sets the number of results to skip before returning any results.
25048 * This is useful for pagination.
25049 * Default is to skip zero results.
25050 * @param {Number} n the number of results to skip.
25051 * @return {AV.Query} Returns the query, so you can chain this call.
25052 */
25053 skip: function skip(n) {
25054 this._skip = n;
25055 return this;
25056 },
25057
25058 /**
25059 * Sets the limit of the number of results to return. The default limit is
25060 * 100, with a maximum of 1000 results being returned at a time.
25061 * @param {Number} n the number of results to limit to.
25062 * @return {AV.Query} Returns the query, so you can chain this call.
25063 */
25064 limit: function limit(n) {
25065 this._limit = n;
25066 return this;
25067 },
25068
25069 /**
25070 * 查询任务状态和结果,任务结果为一个 JSON 对象,包括 status 表示任务状态, totalCount 表示总数,
25071 * results 数组表示任务结果数组,previewCount 表示可以返回的结果总数,任务的开始和截止时间
25072 * startTime、endTime 等信息。
25073 *
25074 * @param {AuthOptions} [options]
25075 * @return {Promise} A promise that will be resolved with the result
25076 * of the function.
25077 *
25078 */
25079 find: function find(options) {
25080 var params = {
25081 skip: this._skip,
25082 limit: this._limit
25083 };
25084 return request({
25085 path: "/bigquery/jobs/".concat(this.id),
25086 method: 'GET',
25087 query: params,
25088 authOptions: options,
25089 signKey: false
25090 }).then(function (response) {
25091 if (response.error) {
25092 return _promise.default.reject(new AVError(response.code, response.error));
25093 }
25094
25095 return _promise.default.resolve(response);
25096 });
25097 }
25098 });
25099};
25100
25101/***/ }),
25102/* 568 */
25103/***/ (function(module, exports, __webpack_require__) {
25104
25105"use strict";
25106
25107
25108var _interopRequireDefault = __webpack_require__(1);
25109
25110var _promise = _interopRequireDefault(__webpack_require__(12));
25111
25112var _ = __webpack_require__(3);
25113
25114var _require = __webpack_require__(27),
25115 LCRequest = _require.request;
25116
25117var _require2 = __webpack_require__(30),
25118 getSessionToken = _require2.getSessionToken;
25119
25120module.exports = function (AV) {
25121 var getUserWithSessionToken = function getUserWithSessionToken(authOptions) {
25122 if (authOptions.user) {
25123 if (!authOptions.user._sessionToken) {
25124 throw new Error('authOptions.user is not signed in.');
25125 }
25126
25127 return _promise.default.resolve(authOptions.user);
25128 }
25129
25130 if (authOptions.sessionToken) {
25131 return AV.User._fetchUserBySessionToken(authOptions.sessionToken);
25132 }
25133
25134 return AV.User.currentAsync();
25135 };
25136
25137 var getSessionTokenAsync = function getSessionTokenAsync(authOptions) {
25138 var sessionToken = getSessionToken(authOptions);
25139
25140 if (sessionToken) {
25141 return _promise.default.resolve(sessionToken);
25142 }
25143
25144 return AV.User.currentAsync().then(function (user) {
25145 if (user) {
25146 return user.getSessionToken();
25147 }
25148 });
25149 };
25150 /**
25151 * Contains functions to deal with Friendship in LeanCloud.
25152 * @class
25153 */
25154
25155
25156 AV.Friendship = {
25157 /**
25158 * Request friendship.
25159 * @since 4.8.0
25160 * @param {String | AV.User | Object} options if an AV.User or string is given, it will be used as the friend.
25161 * @param {AV.User | string} options.friend The friend (or friend's objectId) to follow.
25162 * @param {Object} [options.attributes] key-value attributes dictionary to be used as conditions of followeeQuery.
25163 * @param {AuthOptions} [authOptions]
25164 * @return {Promise<void>}
25165 */
25166 request: function request(options) {
25167 var authOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
25168 var friend;
25169 var attributes;
25170
25171 if (options.friend) {
25172 friend = options.friend;
25173 attributes = options.attributes;
25174 } else {
25175 friend = options;
25176 }
25177
25178 var friendObj = _.isString(friend) ? AV.Object.createWithoutData('_User', friend) : friend;
25179 return getUserWithSessionToken(authOptions).then(function (userObj) {
25180 if (!userObj) {
25181 throw new Error('Please signin an user.');
25182 }
25183
25184 return LCRequest({
25185 method: 'POST',
25186 path: '/users/friendshipRequests',
25187 data: {
25188 user: userObj._toPointer(),
25189 friend: friendObj._toPointer(),
25190 friendship: attributes
25191 },
25192 authOptions: authOptions
25193 });
25194 });
25195 },
25196
25197 /**
25198 * Accept a friendship request.
25199 * @since 4.8.0
25200 * @param {AV.Object | string | Object} options if an AV.Object or string is given, it will be used as the request in _FriendshipRequest.
25201 * @param {AV.Object} options.request The request (or it's objectId) to be accepted.
25202 * @param {Object} [options.attributes] key-value attributes dictionary to be used as conditions of {@link AV#followeeQuery}.
25203 * @param {AuthOptions} [authOptions]
25204 * @return {Promise<void>}
25205 */
25206 acceptRequest: function acceptRequest(options) {
25207 var authOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
25208 var request;
25209 var attributes;
25210
25211 if (options.request) {
25212 request = options.request;
25213 attributes = options.attributes;
25214 } else {
25215 request = options;
25216 }
25217
25218 var requestId = _.isString(request) ? request : request.id;
25219 return getSessionTokenAsync(authOptions).then(function (sessionToken) {
25220 if (!sessionToken) {
25221 throw new Error('Please signin an user.');
25222 }
25223
25224 return LCRequest({
25225 method: 'PUT',
25226 path: '/users/friendshipRequests/' + requestId + '/accept',
25227 data: {
25228 friendship: AV._encode(attributes)
25229 },
25230 authOptions: authOptions
25231 });
25232 });
25233 },
25234
25235 /**
25236 * Decline a friendship request.
25237 * @param {AV.Object | string} request The request (or it's objectId) to be declined.
25238 * @param {AuthOptions} [authOptions]
25239 * @return {Promise<void>}
25240 */
25241 declineRequest: function declineRequest(request) {
25242 var authOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
25243 var requestId = _.isString(request) ? request : request.id;
25244 return getSessionTokenAsync(authOptions).then(function (sessionToken) {
25245 if (!sessionToken) {
25246 throw new Error('Please signin an user.');
25247 }
25248
25249 return LCRequest({
25250 method: 'PUT',
25251 path: '/users/friendshipRequests/' + requestId + '/decline',
25252 authOptions: authOptions
25253 });
25254 });
25255 }
25256 };
25257};
25258
25259/***/ }),
25260/* 569 */
25261/***/ (function(module, exports, __webpack_require__) {
25262
25263"use strict";
25264
25265
25266var _interopRequireDefault = __webpack_require__(1);
25267
25268var _stringify = _interopRequireDefault(__webpack_require__(36));
25269
25270var _ = __webpack_require__(3);
25271
25272var _require = __webpack_require__(27),
25273 _request = _require._request;
25274
25275var AV = __webpack_require__(69);
25276
25277var serializeMessage = function serializeMessage(message) {
25278 if (typeof message === 'string') {
25279 return message;
25280 }
25281
25282 if (typeof message.getPayload === 'function') {
25283 return (0, _stringify.default)(message.getPayload());
25284 }
25285
25286 return (0, _stringify.default)(message);
25287};
25288/**
25289 * <p>An AV.Conversation is a local representation of a LeanCloud realtime's
25290 * conversation. This class is a subclass of AV.Object, and retains the
25291 * same functionality of an AV.Object, but also extends it with various
25292 * conversation specific methods, like get members, creators of this conversation.
25293 * </p>
25294 *
25295 * @class AV.Conversation
25296 * @param {String} name The name of the Role to create.
25297 * @param {Object} [options]
25298 * @param {Boolean} [options.isSystem] Set this conversation as system conversation.
25299 * @param {Boolean} [options.isTransient] Set this conversation as transient conversation.
25300 */
25301
25302
25303module.exports = AV.Object.extend('_Conversation',
25304/** @lends AV.Conversation.prototype */
25305{
25306 constructor: function constructor(name) {
25307 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
25308 AV.Object.prototype.constructor.call(this, null, null);
25309 this.set('name', name);
25310
25311 if (options.isSystem !== undefined) {
25312 this.set('sys', options.isSystem ? true : false);
25313 }
25314
25315 if (options.isTransient !== undefined) {
25316 this.set('tr', options.isTransient ? true : false);
25317 }
25318 },
25319
25320 /**
25321 * Get current conversation's creator.
25322 *
25323 * @return {String}
25324 */
25325 getCreator: function getCreator() {
25326 return this.get('c');
25327 },
25328
25329 /**
25330 * Get the last message's time.
25331 *
25332 * @return {Date}
25333 */
25334 getLastMessageAt: function getLastMessageAt() {
25335 return this.get('lm');
25336 },
25337
25338 /**
25339 * Get this conversation's members
25340 *
25341 * @return {String[]}
25342 */
25343 getMembers: function getMembers() {
25344 return this.get('m');
25345 },
25346
25347 /**
25348 * Add a member to this conversation
25349 *
25350 * @param {String} member
25351 */
25352 addMember: function addMember(member) {
25353 return this.add('m', member);
25354 },
25355
25356 /**
25357 * Get this conversation's members who set this conversation as muted.
25358 *
25359 * @return {String[]}
25360 */
25361 getMutedMembers: function getMutedMembers() {
25362 return this.get('mu');
25363 },
25364
25365 /**
25366 * Get this conversation's name field.
25367 *
25368 * @return String
25369 */
25370 getName: function getName() {
25371 return this.get('name');
25372 },
25373
25374 /**
25375 * Returns true if this conversation is transient conversation.
25376 *
25377 * @return {Boolean}
25378 */
25379 isTransient: function isTransient() {
25380 return this.get('tr');
25381 },
25382
25383 /**
25384 * Returns true if this conversation is system conversation.
25385 *
25386 * @return {Boolean}
25387 */
25388 isSystem: function isSystem() {
25389 return this.get('sys');
25390 },
25391
25392 /**
25393 * Send realtime message to this conversation, using HTTP request.
25394 *
25395 * @param {String} fromClient Sender's client id.
25396 * @param {String|Object} message The message which will send to conversation.
25397 * It could be a raw string, or an object with a `toJSON` method, like a
25398 * realtime SDK's Message object. See more: {@link https://leancloud.cn/docs/realtime_guide-js.html#消息}
25399 * @param {Object} [options]
25400 * @param {Boolean} [options.transient] Whether send this message as transient message or not.
25401 * @param {String[]} [options.toClients] Ids of clients to send to. This option can be used only in system conversation.
25402 * @param {Object} [options.pushData] Push data to this message. See more: {@link https://url.leanapp.cn/pushData 推送消息内容}
25403 * @param {AuthOptions} [authOptions]
25404 * @return {Promise}
25405 */
25406 send: function send(fromClient, message) {
25407 var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
25408 var authOptions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
25409 var data = {
25410 from_peer: fromClient,
25411 conv_id: this.id,
25412 transient: false,
25413 message: serializeMessage(message)
25414 };
25415
25416 if (options.toClients !== undefined) {
25417 data.to_peers = options.toClients;
25418 }
25419
25420 if (options.transient !== undefined) {
25421 data.transient = options.transient ? true : false;
25422 }
25423
25424 if (options.pushData !== undefined) {
25425 data.push_data = options.pushData;
25426 }
25427
25428 return _request('rtm', 'messages', null, 'POST', data, authOptions);
25429 },
25430
25431 /**
25432 * Send realtime broadcast message to all clients, via this conversation, using HTTP request.
25433 *
25434 * @param {String} fromClient Sender's client id.
25435 * @param {String|Object} message The message which will send to conversation.
25436 * It could be a raw string, or an object with a `toJSON` method, like a
25437 * realtime SDK's Message object. See more: {@link https://leancloud.cn/docs/realtime_guide-js.html#消息}.
25438 * @param {Object} [options]
25439 * @param {Object} [options.pushData] Push data to this message. See more: {@link https://url.leanapp.cn/pushData 推送消息内容}.
25440 * @param {Object} [options.validTill] The message will valid till this time.
25441 * @param {AuthOptions} [authOptions]
25442 * @return {Promise}
25443 */
25444 broadcast: function broadcast(fromClient, message) {
25445 var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
25446 var authOptions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
25447 var data = {
25448 from_peer: fromClient,
25449 conv_id: this.id,
25450 message: serializeMessage(message)
25451 };
25452
25453 if (options.pushData !== undefined) {
25454 data.push = options.pushData;
25455 }
25456
25457 if (options.validTill !== undefined) {
25458 var ts = options.validTill;
25459
25460 if (_.isDate(ts)) {
25461 ts = ts.getTime();
25462 }
25463
25464 options.valid_till = ts;
25465 }
25466
25467 return _request('rtm', 'broadcast', null, 'POST', data, authOptions);
25468 }
25469});
25470
25471/***/ }),
25472/* 570 */
25473/***/ (function(module, exports, __webpack_require__) {
25474
25475"use strict";
25476
25477
25478var _interopRequireDefault = __webpack_require__(1);
25479
25480var _promise = _interopRequireDefault(__webpack_require__(12));
25481
25482var _map = _interopRequireDefault(__webpack_require__(35));
25483
25484var _concat = _interopRequireDefault(__webpack_require__(22));
25485
25486var _ = __webpack_require__(3);
25487
25488var _require = __webpack_require__(27),
25489 request = _require.request;
25490
25491var _require2 = __webpack_require__(30),
25492 ensureArray = _require2.ensureArray,
25493 parseDate = _require2.parseDate;
25494
25495var AV = __webpack_require__(69);
25496/**
25497 * The version change interval for Leaderboard
25498 * @enum
25499 */
25500
25501
25502AV.LeaderboardVersionChangeInterval = {
25503 NEVER: 'never',
25504 DAY: 'day',
25505 WEEK: 'week',
25506 MONTH: 'month'
25507};
25508/**
25509 * The order of the leaderboard results
25510 * @enum
25511 */
25512
25513AV.LeaderboardOrder = {
25514 ASCENDING: 'ascending',
25515 DESCENDING: 'descending'
25516};
25517/**
25518 * The update strategy for Leaderboard
25519 * @enum
25520 */
25521
25522AV.LeaderboardUpdateStrategy = {
25523 /** Only keep the best statistic. If the leaderboard is in descending order, the best statistic is the highest one. */
25524 BETTER: 'better',
25525
25526 /** Keep the last updated statistic */
25527 LAST: 'last',
25528
25529 /** Keep the sum of all updated statistics */
25530 SUM: 'sum'
25531};
25532/**
25533 * @typedef {Object} Ranking
25534 * @property {number} rank Starts at 0
25535 * @property {number} value the statistic value of this ranking
25536 * @property {AV.User} user The user of this ranking
25537 * @property {Statistic[]} [includedStatistics] Other statistics of the user, specified by the `includeStatistic` option of `AV.Leaderboard.getResults()`
25538 */
25539
25540/**
25541 * @typedef {Object} LeaderboardArchive
25542 * @property {string} statisticName
25543 * @property {number} version version of the leaderboard
25544 * @property {string} status
25545 * @property {string} url URL for the downloadable archive
25546 * @property {Date} activatedAt time when this version became active
25547 * @property {Date} deactivatedAt time when this version was deactivated by a version incrementing
25548 */
25549
25550/**
25551 * @class
25552 */
25553
25554function Statistic(_ref) {
25555 var name = _ref.name,
25556 value = _ref.value,
25557 version = _ref.version;
25558
25559 /**
25560 * @type {string}
25561 */
25562 this.name = name;
25563 /**
25564 * @type {number}
25565 */
25566
25567 this.value = value;
25568 /**
25569 * @type {number?}
25570 */
25571
25572 this.version = version;
25573}
25574
25575var parseStatisticData = function parseStatisticData(statisticData) {
25576 var _AV$_decode = AV._decode(statisticData),
25577 name = _AV$_decode.statisticName,
25578 value = _AV$_decode.statisticValue,
25579 version = _AV$_decode.version;
25580
25581 return new Statistic({
25582 name: name,
25583 value: value,
25584 version: version
25585 });
25586};
25587/**
25588 * @class
25589 */
25590
25591
25592AV.Leaderboard = function Leaderboard(statisticName) {
25593 /**
25594 * @type {string}
25595 */
25596 this.statisticName = statisticName;
25597 /**
25598 * @type {AV.LeaderboardOrder}
25599 */
25600
25601 this.order = undefined;
25602 /**
25603 * @type {AV.LeaderboardUpdateStrategy}
25604 */
25605
25606 this.updateStrategy = undefined;
25607 /**
25608 * @type {AV.LeaderboardVersionChangeInterval}
25609 */
25610
25611 this.versionChangeInterval = undefined;
25612 /**
25613 * @type {number}
25614 */
25615
25616 this.version = undefined;
25617 /**
25618 * @type {Date?}
25619 */
25620
25621 this.nextResetAt = undefined;
25622 /**
25623 * @type {Date?}
25624 */
25625
25626 this.createdAt = undefined;
25627};
25628
25629var Leaderboard = AV.Leaderboard;
25630/**
25631 * Create an instance of Leaderboard for the give statistic name.
25632 * @param {string} statisticName
25633 * @return {AV.Leaderboard}
25634 */
25635
25636AV.Leaderboard.createWithoutData = function (statisticName) {
25637 return new Leaderboard(statisticName);
25638};
25639/**
25640 * (masterKey required) Create a new Leaderboard.
25641 * @param {Object} options
25642 * @param {string} options.statisticName
25643 * @param {AV.LeaderboardOrder} options.order
25644 * @param {AV.LeaderboardVersionChangeInterval} [options.versionChangeInterval] default to WEEK
25645 * @param {AV.LeaderboardUpdateStrategy} [options.updateStrategy] default to BETTER
25646 * @param {AuthOptions} [authOptions]
25647 * @return {Promise<AV.Leaderboard>}
25648 */
25649
25650
25651AV.Leaderboard.createLeaderboard = function (_ref2, authOptions) {
25652 var statisticName = _ref2.statisticName,
25653 order = _ref2.order,
25654 versionChangeInterval = _ref2.versionChangeInterval,
25655 updateStrategy = _ref2.updateStrategy;
25656 return request({
25657 method: 'POST',
25658 path: '/leaderboard/leaderboards',
25659 data: {
25660 statisticName: statisticName,
25661 order: order,
25662 versionChangeInterval: versionChangeInterval,
25663 updateStrategy: updateStrategy
25664 },
25665 authOptions: authOptions
25666 }).then(function (data) {
25667 var leaderboard = new Leaderboard(statisticName);
25668 return leaderboard._finishFetch(data);
25669 });
25670};
25671/**
25672 * Get the Leaderboard with the specified statistic name.
25673 * @param {string} statisticName
25674 * @param {AuthOptions} [authOptions]
25675 * @return {Promise<AV.Leaderboard>}
25676 */
25677
25678
25679AV.Leaderboard.getLeaderboard = function (statisticName, authOptions) {
25680 return Leaderboard.createWithoutData(statisticName).fetch(authOptions);
25681};
25682/**
25683 * Get Statistics for the specified user.
25684 * @param {AV.User} user The specified AV.User pointer.
25685 * @param {Object} [options]
25686 * @param {string[]} [options.statisticNames] Specify the statisticNames. If not set, all statistics of the user will be fetched.
25687 * @param {AuthOptions} [authOptions]
25688 * @return {Promise<Statistic[]>}
25689 */
25690
25691
25692AV.Leaderboard.getStatistics = function (user) {
25693 var _ref3 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
25694 statisticNames = _ref3.statisticNames;
25695
25696 var authOptions = arguments.length > 2 ? arguments[2] : undefined;
25697 return _promise.default.resolve().then(function () {
25698 if (!(user && user.id)) throw new Error('user must be an AV.User');
25699 return request({
25700 method: 'GET',
25701 path: "/leaderboard/users/".concat(user.id, "/statistics"),
25702 query: {
25703 statistics: statisticNames ? ensureArray(statisticNames).join(',') : undefined
25704 },
25705 authOptions: authOptions
25706 }).then(function (_ref4) {
25707 var results = _ref4.results;
25708 return (0, _map.default)(results).call(results, parseStatisticData);
25709 });
25710 });
25711};
25712/**
25713 * Update Statistics for the specified user.
25714 * @param {AV.User} user The specified AV.User pointer.
25715 * @param {Object} statistics A name-value pair representing the statistics to update.
25716 * @param {AuthOptions} [options] AuthOptions plus:
25717 * @param {boolean} [options.overwrite] Wethere to overwrite these statistics disregarding the updateStrategy of there leaderboards
25718 * @return {Promise<Statistic[]>}
25719 */
25720
25721
25722AV.Leaderboard.updateStatistics = function (user, statistics) {
25723 var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
25724 return _promise.default.resolve().then(function () {
25725 if (!(user && user.id)) throw new Error('user must be an AV.User');
25726 var data = (0, _map.default)(_).call(_, statistics, function (value, key) {
25727 return {
25728 statisticName: key,
25729 statisticValue: value
25730 };
25731 });
25732 var overwrite = options.overwrite;
25733 return request({
25734 method: 'POST',
25735 path: "/leaderboard/users/".concat(user.id, "/statistics"),
25736 query: {
25737 overwrite: overwrite ? 1 : undefined
25738 },
25739 data: data,
25740 authOptions: options
25741 }).then(function (_ref5) {
25742 var results = _ref5.results;
25743 return (0, _map.default)(results).call(results, parseStatisticData);
25744 });
25745 });
25746};
25747/**
25748 * Delete Statistics for the specified user.
25749 * @param {AV.User} user The specified AV.User pointer.
25750 * @param {Object} statistics A name-value pair representing the statistics to delete.
25751 * @param {AuthOptions} [options]
25752 * @return {Promise<void>}
25753 */
25754
25755
25756AV.Leaderboard.deleteStatistics = function (user, statisticNames, authOptions) {
25757 return _promise.default.resolve().then(function () {
25758 if (!(user && user.id)) throw new Error('user must be an AV.User');
25759 return request({
25760 method: 'DELETE',
25761 path: "/leaderboard/users/".concat(user.id, "/statistics"),
25762 query: {
25763 statistics: ensureArray(statisticNames).join(',')
25764 },
25765 authOptions: authOptions
25766 }).then(function () {
25767 return undefined;
25768 });
25769 });
25770};
25771
25772_.extend(Leaderboard.prototype,
25773/** @lends AV.Leaderboard.prototype */
25774{
25775 _finishFetch: function _finishFetch(data) {
25776 var _this = this;
25777
25778 _.forEach(data, function (value, key) {
25779 if (key === 'updatedAt' || key === 'objectId') return;
25780
25781 if (key === 'expiredAt') {
25782 key = 'nextResetAt';
25783 }
25784
25785 if (key === 'createdAt') {
25786 value = parseDate(value);
25787 }
25788
25789 if (value && value.__type === 'Date') {
25790 value = parseDate(value.iso);
25791 }
25792
25793 _this[key] = value;
25794 });
25795
25796 return this;
25797 },
25798
25799 /**
25800 * Fetch data from the srever.
25801 * @param {AuthOptions} [authOptions]
25802 * @return {Promise<AV.Leaderboard>}
25803 */
25804 fetch: function fetch(authOptions) {
25805 var _this2 = this;
25806
25807 return request({
25808 method: 'GET',
25809 path: "/leaderboard/leaderboards/".concat(this.statisticName),
25810 authOptions: authOptions
25811 }).then(function (data) {
25812 return _this2._finishFetch(data);
25813 });
25814 },
25815
25816 /**
25817 * Counts the number of users participated in this leaderboard
25818 * @param {Object} [options]
25819 * @param {number} [options.version] Specify the version of the leaderboard
25820 * @param {AuthOptions} [authOptions]
25821 * @return {Promise<number>}
25822 */
25823 count: function count() {
25824 var _ref6 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
25825 version = _ref6.version;
25826
25827 var authOptions = arguments.length > 1 ? arguments[1] : undefined;
25828 return request({
25829 method: 'GET',
25830 path: "/leaderboard/leaderboards/".concat(this.statisticName, "/ranks"),
25831 query: {
25832 count: 1,
25833 limit: 0,
25834 version: version
25835 },
25836 authOptions: authOptions
25837 }).then(function (_ref7) {
25838 var count = _ref7.count;
25839 return count;
25840 });
25841 },
25842 _getResults: function _getResults(_ref8, authOptions, userId) {
25843 var _context;
25844
25845 var skip = _ref8.skip,
25846 limit = _ref8.limit,
25847 selectUserKeys = _ref8.selectUserKeys,
25848 includeUserKeys = _ref8.includeUserKeys,
25849 includeStatistics = _ref8.includeStatistics,
25850 version = _ref8.version;
25851 return request({
25852 method: 'GET',
25853 path: (0, _concat.default)(_context = "/leaderboard/leaderboards/".concat(this.statisticName, "/ranks")).call(_context, userId ? "/".concat(userId) : ''),
25854 query: {
25855 skip: skip,
25856 limit: limit,
25857 selectUserKeys: _.union(ensureArray(selectUserKeys), ensureArray(includeUserKeys)).join(',') || undefined,
25858 includeUser: includeUserKeys ? ensureArray(includeUserKeys).join(',') : undefined,
25859 includeStatistics: includeStatistics ? ensureArray(includeStatistics).join(',') : undefined,
25860 version: version
25861 },
25862 authOptions: authOptions
25863 }).then(function (_ref9) {
25864 var rankings = _ref9.results;
25865 return (0, _map.default)(rankings).call(rankings, function (rankingData) {
25866 var _AV$_decode2 = AV._decode(rankingData),
25867 user = _AV$_decode2.user,
25868 value = _AV$_decode2.statisticValue,
25869 rank = _AV$_decode2.rank,
25870 _AV$_decode2$statisti = _AV$_decode2.statistics,
25871 statistics = _AV$_decode2$statisti === void 0 ? [] : _AV$_decode2$statisti;
25872
25873 return {
25874 user: user,
25875 value: value,
25876 rank: rank,
25877 includedStatistics: (0, _map.default)(statistics).call(statistics, parseStatisticData)
25878 };
25879 });
25880 });
25881 },
25882
25883 /**
25884 * Retrieve a list of ranked users for this Leaderboard.
25885 * @param {Object} [options]
25886 * @param {number} [options.skip] The number of results to skip. This is useful for pagination.
25887 * @param {number} [options.limit] The limit of the number of results.
25888 * @param {string[]} [options.selectUserKeys] Specify keys of the users to include in the Rankings
25889 * @param {string[]} [options.includeUserKeys] If the value of a selected user keys is a Pointer, use this options to include its value.
25890 * @param {string[]} [options.includeStatistics] Specify other statistics to include in the Rankings
25891 * @param {number} [options.version] Specify the version of the leaderboard
25892 * @param {AuthOptions} [authOptions]
25893 * @return {Promise<Ranking[]>}
25894 */
25895 getResults: function getResults() {
25896 var _ref10 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
25897 skip = _ref10.skip,
25898 limit = _ref10.limit,
25899 selectUserKeys = _ref10.selectUserKeys,
25900 includeUserKeys = _ref10.includeUserKeys,
25901 includeStatistics = _ref10.includeStatistics,
25902 version = _ref10.version;
25903
25904 var authOptions = arguments.length > 1 ? arguments[1] : undefined;
25905 return this._getResults({
25906 skip: skip,
25907 limit: limit,
25908 selectUserKeys: selectUserKeys,
25909 includeUserKeys: includeUserKeys,
25910 includeStatistics: includeStatistics,
25911 version: version
25912 }, authOptions);
25913 },
25914
25915 /**
25916 * Retrieve a list of ranked users for this Leaderboard, centered on the specified user.
25917 * @param {AV.User} user The specified AV.User pointer.
25918 * @param {Object} [options]
25919 * @param {number} [options.limit] The limit of the number of results.
25920 * @param {string[]} [options.selectUserKeys] Specify keys of the users to include in the Rankings
25921 * @param {string[]} [options.includeUserKeys] If the value of a selected user keys is a Pointer, use this options to include its value.
25922 * @param {string[]} [options.includeStatistics] Specify other statistics to include in the Rankings
25923 * @param {number} [options.version] Specify the version of the leaderboard
25924 * @param {AuthOptions} [authOptions]
25925 * @return {Promise<Ranking[]>}
25926 */
25927 getResultsAroundUser: function getResultsAroundUser(user) {
25928 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
25929 var authOptions = arguments.length > 2 ? arguments[2] : undefined;
25930
25931 // getResultsAroundUser(options, authOptions)
25932 if (user && typeof user.id !== 'string') {
25933 return this.getResultsAroundUser(undefined, user, options);
25934 }
25935
25936 var limit = options.limit,
25937 selectUserKeys = options.selectUserKeys,
25938 includeUserKeys = options.includeUserKeys,
25939 includeStatistics = options.includeStatistics,
25940 version = options.version;
25941 return this._getResults({
25942 limit: limit,
25943 selectUserKeys: selectUserKeys,
25944 includeUserKeys: includeUserKeys,
25945 includeStatistics: includeStatistics,
25946 version: version
25947 }, authOptions, user ? user.id : 'self');
25948 },
25949 _update: function _update(data, authOptions) {
25950 var _this3 = this;
25951
25952 return request({
25953 method: 'PUT',
25954 path: "/leaderboard/leaderboards/".concat(this.statisticName),
25955 data: data,
25956 authOptions: authOptions
25957 }).then(function (result) {
25958 return _this3._finishFetch(result);
25959 });
25960 },
25961
25962 /**
25963 * (masterKey required) Update the version change interval of the Leaderboard.
25964 * @param {AV.LeaderboardVersionChangeInterval} versionChangeInterval
25965 * @param {AuthOptions} [authOptions]
25966 * @return {Promise<AV.Leaderboard>}
25967 */
25968 updateVersionChangeInterval: function updateVersionChangeInterval(versionChangeInterval, authOptions) {
25969 return this._update({
25970 versionChangeInterval: versionChangeInterval
25971 }, authOptions);
25972 },
25973
25974 /**
25975 * (masterKey required) Update the version change interval of the Leaderboard.
25976 * @param {AV.LeaderboardUpdateStrategy} updateStrategy
25977 * @param {AuthOptions} [authOptions]
25978 * @return {Promise<AV.Leaderboard>}
25979 */
25980 updateUpdateStrategy: function updateUpdateStrategy(updateStrategy, authOptions) {
25981 return this._update({
25982 updateStrategy: updateStrategy
25983 }, authOptions);
25984 },
25985
25986 /**
25987 * (masterKey required) Reset the Leaderboard. The version of the Leaderboard will be incremented by 1.
25988 * @param {AuthOptions} [authOptions]
25989 * @return {Promise<AV.Leaderboard>}
25990 */
25991 reset: function reset(authOptions) {
25992 var _this4 = this;
25993
25994 return request({
25995 method: 'PUT',
25996 path: "/leaderboard/leaderboards/".concat(this.statisticName, "/incrementVersion"),
25997 authOptions: authOptions
25998 }).then(function (data) {
25999 return _this4._finishFetch(data);
26000 });
26001 },
26002
26003 /**
26004 * (masterKey required) Delete the Leaderboard and its all archived versions.
26005 * @param {AuthOptions} [authOptions]
26006 * @return {void}
26007 */
26008 destroy: function destroy(authOptions) {
26009 return AV.request({
26010 method: 'DELETE',
26011 path: "/leaderboard/leaderboards/".concat(this.statisticName),
26012 authOptions: authOptions
26013 }).then(function () {
26014 return undefined;
26015 });
26016 },
26017
26018 /**
26019 * (masterKey required) Get archived versions.
26020 * @param {Object} [options]
26021 * @param {number} [options.skip] The number of results to skip. This is useful for pagination.
26022 * @param {number} [options.limit] The limit of the number of results.
26023 * @param {AuthOptions} [authOptions]
26024 * @return {Promise<LeaderboardArchive[]>}
26025 */
26026 getArchives: function getArchives() {
26027 var _this5 = this;
26028
26029 var _ref11 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
26030 skip = _ref11.skip,
26031 limit = _ref11.limit;
26032
26033 var authOptions = arguments.length > 1 ? arguments[1] : undefined;
26034 return request({
26035 method: 'GET',
26036 path: "/leaderboard/leaderboards/".concat(this.statisticName, "/archives"),
26037 query: {
26038 skip: skip,
26039 limit: limit
26040 },
26041 authOptions: authOptions
26042 }).then(function (_ref12) {
26043 var results = _ref12.results;
26044 return (0, _map.default)(results).call(results, function (_ref13) {
26045 var version = _ref13.version,
26046 status = _ref13.status,
26047 url = _ref13.url,
26048 activatedAt = _ref13.activatedAt,
26049 deactivatedAt = _ref13.deactivatedAt;
26050 return {
26051 statisticName: _this5.statisticName,
26052 version: version,
26053 status: status,
26054 url: url,
26055 activatedAt: parseDate(activatedAt.iso),
26056 deactivatedAt: parseDate(deactivatedAt.iso)
26057 };
26058 });
26059 });
26060 }
26061});
26062
26063/***/ }),
26064/* 571 */
26065/***/ (function(module, exports, __webpack_require__) {
26066
26067"use strict";
26068
26069
26070var _interopRequireDefault = __webpack_require__(1);
26071
26072var _typeof2 = _interopRequireDefault(__webpack_require__(73));
26073
26074var _defineProperty = _interopRequireDefault(__webpack_require__(92));
26075
26076var _setPrototypeOf = _interopRequireDefault(__webpack_require__(239));
26077
26078var _assign2 = _interopRequireDefault(__webpack_require__(153));
26079
26080var _indexOf = _interopRequireDefault(__webpack_require__(71));
26081
26082var _getOwnPropertySymbols = _interopRequireDefault(__webpack_require__(154));
26083
26084var _promise = _interopRequireDefault(__webpack_require__(12));
26085
26086var _symbol = _interopRequireDefault(__webpack_require__(150));
26087
26088var _iterator = _interopRequireDefault(__webpack_require__(578));
26089
26090var _weakMap = _interopRequireDefault(__webpack_require__(261));
26091
26092var _keys = _interopRequireDefault(__webpack_require__(115));
26093
26094var _getOwnPropertyDescriptor = _interopRequireDefault(__webpack_require__(152));
26095
26096var _getPrototypeOf = _interopRequireDefault(__webpack_require__(148));
26097
26098var _map = _interopRequireDefault(__webpack_require__(585));
26099
26100(0, _defineProperty.default)(exports, '__esModule', {
26101 value: true
26102});
26103/******************************************************************************
26104Copyright (c) Microsoft Corporation.
26105
26106Permission to use, copy, modify, and/or distribute this software for any
26107purpose with or without fee is hereby granted.
26108
26109THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
26110REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
26111AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
26112INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
26113LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
26114OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
26115PERFORMANCE OF THIS SOFTWARE.
26116***************************************************************************** */
26117
26118/* global Reflect, Promise */
26119
26120var _extendStatics$ = function extendStatics$1(d, b) {
26121 _extendStatics$ = _setPrototypeOf.default || {
26122 __proto__: []
26123 } instanceof Array && function (d, b) {
26124 d.__proto__ = b;
26125 } || function (d, b) {
26126 for (var p in b) {
26127 if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
26128 }
26129 };
26130
26131 return _extendStatics$(d, b);
26132};
26133
26134function __extends$1(d, b) {
26135 if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
26136
26137 _extendStatics$(d, b);
26138
26139 function __() {
26140 this.constructor = d;
26141 }
26142
26143 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
26144}
26145
26146var _assign = function __assign() {
26147 _assign = _assign2.default || function __assign(t) {
26148 for (var s, i = 1, n = arguments.length; i < n; i++) {
26149 s = arguments[i];
26150
26151 for (var p in s) {
26152 if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
26153 }
26154 }
26155
26156 return t;
26157 };
26158
26159 return _assign.apply(this, arguments);
26160};
26161
26162function __rest(s, e) {
26163 var t = {};
26164
26165 for (var p in s) {
26166 if (Object.prototype.hasOwnProperty.call(s, p) && (0, _indexOf.default)(e).call(e, p) < 0) t[p] = s[p];
26167 }
26168
26169 if (s != null && typeof _getOwnPropertySymbols.default === "function") for (var i = 0, p = (0, _getOwnPropertySymbols.default)(s); i < p.length; i++) {
26170 if ((0, _indexOf.default)(e).call(e, p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
26171 }
26172 return t;
26173}
26174
26175function __awaiter(thisArg, _arguments, P, generator) {
26176 function adopt(value) {
26177 return value instanceof P ? value : new P(function (resolve) {
26178 resolve(value);
26179 });
26180 }
26181
26182 return new (P || (P = _promise.default))(function (resolve, reject) {
26183 function fulfilled(value) {
26184 try {
26185 step(generator.next(value));
26186 } catch (e) {
26187 reject(e);
26188 }
26189 }
26190
26191 function rejected(value) {
26192 try {
26193 step(generator["throw"](value));
26194 } catch (e) {
26195 reject(e);
26196 }
26197 }
26198
26199 function step(result) {
26200 result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
26201 }
26202
26203 step((generator = generator.apply(thisArg, _arguments || [])).next());
26204 });
26205}
26206
26207function __generator(thisArg, body) {
26208 var _ = {
26209 label: 0,
26210 sent: function sent() {
26211 if (t[0] & 1) throw t[1];
26212 return t[1];
26213 },
26214 trys: [],
26215 ops: []
26216 },
26217 f,
26218 y,
26219 t,
26220 g;
26221 return g = {
26222 next: verb(0),
26223 "throw": verb(1),
26224 "return": verb(2)
26225 }, typeof _symbol.default === "function" && (g[_iterator.default] = function () {
26226 return this;
26227 }), g;
26228
26229 function verb(n) {
26230 return function (v) {
26231 return step([n, v]);
26232 };
26233 }
26234
26235 function step(op) {
26236 if (f) throw new TypeError("Generator is already executing.");
26237
26238 while (_) {
26239 try {
26240 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;
26241 if (y = 0, t) op = [op[0] & 2, t.value];
26242
26243 switch (op[0]) {
26244 case 0:
26245 case 1:
26246 t = op;
26247 break;
26248
26249 case 4:
26250 _.label++;
26251 return {
26252 value: op[1],
26253 done: false
26254 };
26255
26256 case 5:
26257 _.label++;
26258 y = op[1];
26259 op = [0];
26260 continue;
26261
26262 case 7:
26263 op = _.ops.pop();
26264
26265 _.trys.pop();
26266
26267 continue;
26268
26269 default:
26270 if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
26271 _ = 0;
26272 continue;
26273 }
26274
26275 if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
26276 _.label = op[1];
26277 break;
26278 }
26279
26280 if (op[0] === 6 && _.label < t[1]) {
26281 _.label = t[1];
26282 t = op;
26283 break;
26284 }
26285
26286 if (t && _.label < t[2]) {
26287 _.label = t[2];
26288
26289 _.ops.push(op);
26290
26291 break;
26292 }
26293
26294 if (t[2]) _.ops.pop();
26295
26296 _.trys.pop();
26297
26298 continue;
26299 }
26300
26301 op = body.call(thisArg, _);
26302 } catch (e) {
26303 op = [6, e];
26304 y = 0;
26305 } finally {
26306 f = t = 0;
26307 }
26308 }
26309
26310 if (op[0] & 5) throw op[1];
26311 return {
26312 value: op[0] ? op[1] : void 0,
26313 done: true
26314 };
26315 }
26316}
26317
26318var PROVIDER = "lc_weapp";
26319var PLATFORM = "weixin";
26320
26321function getLoginCode() {
26322 return new _promise.default(function (resolve, reject) {
26323 wx.login({
26324 success: function success(res) {
26325 return res.code ? resolve(res.code) : reject(new Error(res.errMsg));
26326 },
26327 fail: function fail(_a) {
26328 var errMsg = _a.errMsg;
26329 return reject(new Error(errMsg));
26330 }
26331 });
26332 });
26333}
26334
26335var getAuthInfo = function getAuthInfo(_a) {
26336 var _b = _a === void 0 ? {} : _a,
26337 _c = _b.platform,
26338 platform = _c === void 0 ? PLATFORM : _c,
26339 _d = _b.preferUnionId,
26340 preferUnionId = _d === void 0 ? false : _d,
26341 _e = _b.asMainAccount,
26342 asMainAccount = _e === void 0 ? false : _e;
26343
26344 return __awaiter(this, void 0, void 0, function () {
26345 var code, authData;
26346 return __generator(this, function (_f) {
26347 switch (_f.label) {
26348 case 0:
26349 return [4
26350 /*yield*/
26351 , getLoginCode()];
26352
26353 case 1:
26354 code = _f.sent();
26355 authData = {
26356 code: code
26357 };
26358
26359 if (preferUnionId) {
26360 authData.platform = platform;
26361 authData.main_account = asMainAccount;
26362 }
26363
26364 return [2
26365 /*return*/
26366 , {
26367 authData: authData,
26368 platform: platform,
26369 provider: PROVIDER
26370 }];
26371 }
26372 });
26373 });
26374};
26375
26376var storage = {
26377 getItem: function getItem(key) {
26378 return wx.getStorageSync(key);
26379 },
26380 setItem: function setItem(key, value) {
26381 return wx.setStorageSync(key, value);
26382 },
26383 removeItem: function removeItem(key) {
26384 return wx.removeStorageSync(key);
26385 },
26386 clear: function clear() {
26387 return wx.clearStorageSync();
26388 }
26389};
26390/******************************************************************************
26391Copyright (c) Microsoft Corporation.
26392
26393Permission to use, copy, modify, and/or distribute this software for any
26394purpose with or without fee is hereby granted.
26395
26396THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
26397REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
26398AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
26399INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
26400LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
26401OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
26402PERFORMANCE OF THIS SOFTWARE.
26403***************************************************************************** */
26404
26405/* global Reflect, Promise */
26406
26407var _extendStatics = function extendStatics(d, b) {
26408 _extendStatics = _setPrototypeOf.default || {
26409 __proto__: []
26410 } instanceof Array && function (d, b) {
26411 d.__proto__ = b;
26412 } || function (d, b) {
26413 for (var p in b) {
26414 if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
26415 }
26416 };
26417
26418 return _extendStatics(d, b);
26419};
26420
26421function __extends(d, b) {
26422 if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
26423
26424 _extendStatics(d, b);
26425
26426 function __() {
26427 this.constructor = d;
26428 }
26429
26430 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
26431}
26432
26433var AbortError =
26434/** @class */
26435function (_super) {
26436 __extends(AbortError, _super);
26437
26438 function AbortError() {
26439 var _this = _super !== null && _super.apply(this, arguments) || this;
26440
26441 _this.name = "AbortError";
26442 return _this;
26443 }
26444
26445 return AbortError;
26446}(Error);
26447
26448var request = function request(url, options) {
26449 if (options === void 0) {
26450 options = {};
26451 }
26452
26453 var method = options.method,
26454 data = options.data,
26455 headers = options.headers,
26456 signal = options.signal;
26457
26458 if (signal === null || signal === void 0 ? void 0 : signal.aborted) {
26459 return _promise.default.reject(new AbortError("Request aborted"));
26460 }
26461
26462 return new _promise.default(function (resolve, reject) {
26463 var task = wx.request({
26464 url: url,
26465 method: method,
26466 data: data,
26467 header: headers,
26468 complete: function complete(res) {
26469 signal === null || signal === void 0 ? void 0 : signal.removeEventListener("abort", abortListener);
26470
26471 if (!res.statusCode) {
26472 reject(new Error(res.errMsg));
26473 return;
26474 }
26475
26476 resolve({
26477 ok: !(res.statusCode >= 400),
26478 status: res.statusCode,
26479 headers: res.header,
26480 data: res.data
26481 });
26482 }
26483 });
26484
26485 var abortListener = function abortListener() {
26486 reject(new AbortError("Request aborted"));
26487 task.abort();
26488 };
26489
26490 signal === null || signal === void 0 ? void 0 : signal.addEventListener("abort", abortListener);
26491 });
26492};
26493
26494var upload = function upload(url, file, options) {
26495 if (options === void 0) {
26496 options = {};
26497 }
26498
26499 var headers = options.headers,
26500 data = options.data,
26501 onprogress = options.onprogress,
26502 signal = options.signal;
26503
26504 if (signal === null || signal === void 0 ? void 0 : signal.aborted) {
26505 return _promise.default.reject(new AbortError("Request aborted"));
26506 }
26507
26508 if (!(file && file.data && file.data.uri)) {
26509 return _promise.default.reject(new TypeError("File data must be an object like { uri: localPath }."));
26510 }
26511
26512 return new _promise.default(function (resolve, reject) {
26513 var task = wx.uploadFile({
26514 url: url,
26515 header: headers,
26516 filePath: file.data.uri,
26517 name: file.field,
26518 formData: data,
26519 success: function success(response) {
26520 var status = response.statusCode,
26521 data = response.data,
26522 rest = __rest(response, ["statusCode", "data"]);
26523
26524 resolve(_assign(_assign({}, rest), {
26525 data: typeof data === "string" ? JSON.parse(data) : data,
26526 status: status,
26527 ok: !(status >= 400)
26528 }));
26529 },
26530 fail: function fail(response) {
26531 reject(new Error(response.errMsg));
26532 },
26533 complete: function complete() {
26534 signal === null || signal === void 0 ? void 0 : signal.removeEventListener("abort", abortListener);
26535 }
26536 });
26537
26538 var abortListener = function abortListener() {
26539 reject(new AbortError("Request aborted"));
26540 task.abort();
26541 };
26542
26543 signal === null || signal === void 0 ? void 0 : signal.addEventListener("abort", abortListener);
26544
26545 if (onprogress) {
26546 task.onProgressUpdate(function (event) {
26547 return onprogress({
26548 loaded: event.totalBytesSent,
26549 total: event.totalBytesExpectedToSend,
26550 percent: event.progress
26551 });
26552 });
26553 }
26554 });
26555};
26556/**
26557 * @author Toru Nagashima <https://github.com/mysticatea>
26558 * @copyright 2015 Toru Nagashima. All rights reserved.
26559 * See LICENSE file in root directory for full license.
26560 */
26561
26562/**
26563 * @typedef {object} PrivateData
26564 * @property {EventTarget} eventTarget The event target.
26565 * @property {{type:string}} event The original event object.
26566 * @property {number} eventPhase The current event phase.
26567 * @property {EventTarget|null} currentTarget The current event target.
26568 * @property {boolean} canceled The flag to prevent default.
26569 * @property {boolean} stopped The flag to stop propagation.
26570 * @property {boolean} immediateStopped The flag to stop propagation immediately.
26571 * @property {Function|null} passiveListener The listener if the current listener is passive. Otherwise this is null.
26572 * @property {number} timeStamp The unix time.
26573 * @private
26574 */
26575
26576/**
26577 * Private data for event wrappers.
26578 * @type {WeakMap<Event, PrivateData>}
26579 * @private
26580 */
26581
26582
26583var privateData = new _weakMap.default();
26584/**
26585 * Cache for wrapper classes.
26586 * @type {WeakMap<Object, Function>}
26587 * @private
26588 */
26589
26590var wrappers = new _weakMap.default();
26591/**
26592 * Get private data.
26593 * @param {Event} event The event object to get private data.
26594 * @returns {PrivateData} The private data of the event.
26595 * @private
26596 */
26597
26598function pd(event) {
26599 var retv = privateData.get(event);
26600 return retv;
26601}
26602/**
26603 * https://dom.spec.whatwg.org/#set-the-canceled-flag
26604 * @param data {PrivateData} private data.
26605 */
26606
26607
26608function setCancelFlag(data) {
26609 if (data.passiveListener != null) {
26610 if (typeof console !== "undefined" && typeof console.error === "function") {
26611 console.error("Unable to preventDefault inside passive event listener invocation.", data.passiveListener);
26612 }
26613
26614 return;
26615 }
26616
26617 if (!data.event.cancelable) {
26618 return;
26619 }
26620
26621 data.canceled = true;
26622
26623 if (typeof data.event.preventDefault === "function") {
26624 data.event.preventDefault();
26625 }
26626}
26627/**
26628 * @see https://dom.spec.whatwg.org/#interface-event
26629 * @private
26630 */
26631
26632/**
26633 * The event wrapper.
26634 * @constructor
26635 * @param {EventTarget} eventTarget The event target of this dispatching.
26636 * @param {Event|{type:string}} event The original event to wrap.
26637 */
26638
26639
26640function Event(eventTarget, event) {
26641 privateData.set(this, {
26642 eventTarget: eventTarget,
26643 event: event,
26644 eventPhase: 2,
26645 currentTarget: eventTarget,
26646 canceled: false,
26647 stopped: false,
26648 immediateStopped: false,
26649 passiveListener: null,
26650 timeStamp: event.timeStamp || Date.now()
26651 }); // https://heycam.github.io/webidl/#Unforgeable
26652
26653 (0, _defineProperty.default)(this, "isTrusted", {
26654 value: false,
26655 enumerable: true
26656 }); // Define accessors
26657
26658 var keys = (0, _keys.default)(event);
26659
26660 for (var i = 0; i < keys.length; ++i) {
26661 var key = keys[i];
26662
26663 if (!(key in this)) {
26664 (0, _defineProperty.default)(this, key, defineRedirectDescriptor(key));
26665 }
26666 }
26667} // Should be enumerable, but class methods are not enumerable.
26668
26669
26670Event.prototype = {
26671 /**
26672 * The type of this event.
26673 * @type {string}
26674 */
26675 get type() {
26676 return pd(this).event.type;
26677 },
26678
26679 /**
26680 * The target of this event.
26681 * @type {EventTarget}
26682 */
26683 get target() {
26684 return pd(this).eventTarget;
26685 },
26686
26687 /**
26688 * The target of this event.
26689 * @type {EventTarget}
26690 */
26691 get currentTarget() {
26692 return pd(this).currentTarget;
26693 },
26694
26695 /**
26696 * @returns {EventTarget[]} The composed path of this event.
26697 */
26698 composedPath: function composedPath() {
26699 var currentTarget = pd(this).currentTarget;
26700
26701 if (currentTarget == null) {
26702 return [];
26703 }
26704
26705 return [currentTarget];
26706 },
26707
26708 /**
26709 * Constant of NONE.
26710 * @type {number}
26711 */
26712 get NONE() {
26713 return 0;
26714 },
26715
26716 /**
26717 * Constant of CAPTURING_PHASE.
26718 * @type {number}
26719 */
26720 get CAPTURING_PHASE() {
26721 return 1;
26722 },
26723
26724 /**
26725 * Constant of AT_TARGET.
26726 * @type {number}
26727 */
26728 get AT_TARGET() {
26729 return 2;
26730 },
26731
26732 /**
26733 * Constant of BUBBLING_PHASE.
26734 * @type {number}
26735 */
26736 get BUBBLING_PHASE() {
26737 return 3;
26738 },
26739
26740 /**
26741 * The target of this event.
26742 * @type {number}
26743 */
26744 get eventPhase() {
26745 return pd(this).eventPhase;
26746 },
26747
26748 /**
26749 * Stop event bubbling.
26750 * @returns {void}
26751 */
26752 stopPropagation: function stopPropagation() {
26753 var data = pd(this);
26754 data.stopped = true;
26755
26756 if (typeof data.event.stopPropagation === "function") {
26757 data.event.stopPropagation();
26758 }
26759 },
26760
26761 /**
26762 * Stop event bubbling.
26763 * @returns {void}
26764 */
26765 stopImmediatePropagation: function stopImmediatePropagation() {
26766 var data = pd(this);
26767 data.stopped = true;
26768 data.immediateStopped = true;
26769
26770 if (typeof data.event.stopImmediatePropagation === "function") {
26771 data.event.stopImmediatePropagation();
26772 }
26773 },
26774
26775 /**
26776 * The flag to be bubbling.
26777 * @type {boolean}
26778 */
26779 get bubbles() {
26780 return Boolean(pd(this).event.bubbles);
26781 },
26782
26783 /**
26784 * The flag to be cancelable.
26785 * @type {boolean}
26786 */
26787 get cancelable() {
26788 return Boolean(pd(this).event.cancelable);
26789 },
26790
26791 /**
26792 * Cancel this event.
26793 * @returns {void}
26794 */
26795 preventDefault: function preventDefault() {
26796 setCancelFlag(pd(this));
26797 },
26798
26799 /**
26800 * The flag to indicate cancellation state.
26801 * @type {boolean}
26802 */
26803 get defaultPrevented() {
26804 return pd(this).canceled;
26805 },
26806
26807 /**
26808 * The flag to be composed.
26809 * @type {boolean}
26810 */
26811 get composed() {
26812 return Boolean(pd(this).event.composed);
26813 },
26814
26815 /**
26816 * The unix time of this event.
26817 * @type {number}
26818 */
26819 get timeStamp() {
26820 return pd(this).timeStamp;
26821 },
26822
26823 /**
26824 * The target of this event.
26825 * @type {EventTarget}
26826 * @deprecated
26827 */
26828 get srcElement() {
26829 return pd(this).eventTarget;
26830 },
26831
26832 /**
26833 * The flag to stop event bubbling.
26834 * @type {boolean}
26835 * @deprecated
26836 */
26837 get cancelBubble() {
26838 return pd(this).stopped;
26839 },
26840
26841 set cancelBubble(value) {
26842 if (!value) {
26843 return;
26844 }
26845
26846 var data = pd(this);
26847 data.stopped = true;
26848
26849 if (typeof data.event.cancelBubble === "boolean") {
26850 data.event.cancelBubble = true;
26851 }
26852 },
26853
26854 /**
26855 * The flag to indicate cancellation state.
26856 * @type {boolean}
26857 * @deprecated
26858 */
26859 get returnValue() {
26860 return !pd(this).canceled;
26861 },
26862
26863 set returnValue(value) {
26864 if (!value) {
26865 setCancelFlag(pd(this));
26866 }
26867 },
26868
26869 /**
26870 * Initialize this event object. But do nothing under event dispatching.
26871 * @param {string} type The event type.
26872 * @param {boolean} [bubbles=false] The flag to be possible to bubble up.
26873 * @param {boolean} [cancelable=false] The flag to be possible to cancel.
26874 * @deprecated
26875 */
26876 initEvent: function initEvent() {// Do nothing.
26877 }
26878}; // `constructor` is not enumerable.
26879
26880(0, _defineProperty.default)(Event.prototype, "constructor", {
26881 value: Event,
26882 configurable: true,
26883 writable: true
26884}); // Ensure `event instanceof window.Event` is `true`.
26885
26886if (typeof window !== "undefined" && typeof window.Event !== "undefined") {
26887 (0, _setPrototypeOf.default)(Event.prototype, window.Event.prototype); // Make association for wrappers.
26888
26889 wrappers.set(window.Event.prototype, Event);
26890}
26891/**
26892 * Get the property descriptor to redirect a given property.
26893 * @param {string} key Property name to define property descriptor.
26894 * @returns {PropertyDescriptor} The property descriptor to redirect the property.
26895 * @private
26896 */
26897
26898
26899function defineRedirectDescriptor(key) {
26900 return {
26901 get: function get() {
26902 return pd(this).event[key];
26903 },
26904 set: function set(value) {
26905 pd(this).event[key] = value;
26906 },
26907 configurable: true,
26908 enumerable: true
26909 };
26910}
26911/**
26912 * Get the property descriptor to call a given method property.
26913 * @param {string} key Property name to define property descriptor.
26914 * @returns {PropertyDescriptor} The property descriptor to call the method property.
26915 * @private
26916 */
26917
26918
26919function defineCallDescriptor(key) {
26920 return {
26921 value: function value() {
26922 var event = pd(this).event;
26923 return event[key].apply(event, arguments);
26924 },
26925 configurable: true,
26926 enumerable: true
26927 };
26928}
26929/**
26930 * Define new wrapper class.
26931 * @param {Function} BaseEvent The base wrapper class.
26932 * @param {Object} proto The prototype of the original event.
26933 * @returns {Function} The defined wrapper class.
26934 * @private
26935 */
26936
26937
26938function defineWrapper(BaseEvent, proto) {
26939 var keys = (0, _keys.default)(proto);
26940
26941 if (keys.length === 0) {
26942 return BaseEvent;
26943 }
26944 /** CustomEvent */
26945
26946
26947 function CustomEvent(eventTarget, event) {
26948 BaseEvent.call(this, eventTarget, event);
26949 }
26950
26951 CustomEvent.prototype = Object.create(BaseEvent.prototype, {
26952 constructor: {
26953 value: CustomEvent,
26954 configurable: true,
26955 writable: true
26956 }
26957 }); // Define accessors.
26958
26959 for (var i = 0; i < keys.length; ++i) {
26960 var key = keys[i];
26961
26962 if (!(key in BaseEvent.prototype)) {
26963 var descriptor = (0, _getOwnPropertyDescriptor.default)(proto, key);
26964 var isFunc = typeof descriptor.value === "function";
26965 (0, _defineProperty.default)(CustomEvent.prototype, key, isFunc ? defineCallDescriptor(key) : defineRedirectDescriptor(key));
26966 }
26967 }
26968
26969 return CustomEvent;
26970}
26971/**
26972 * Get the wrapper class of a given prototype.
26973 * @param {Object} proto The prototype of the original event to get its wrapper.
26974 * @returns {Function} The wrapper class.
26975 * @private
26976 */
26977
26978
26979function getWrapper(proto) {
26980 if (proto == null || proto === Object.prototype) {
26981 return Event;
26982 }
26983
26984 var wrapper = wrappers.get(proto);
26985
26986 if (wrapper == null) {
26987 wrapper = defineWrapper(getWrapper((0, _getPrototypeOf.default)(proto)), proto);
26988 wrappers.set(proto, wrapper);
26989 }
26990
26991 return wrapper;
26992}
26993/**
26994 * Wrap a given event to management a dispatching.
26995 * @param {EventTarget} eventTarget The event target of this dispatching.
26996 * @param {Object} event The event to wrap.
26997 * @returns {Event} The wrapper instance.
26998 * @private
26999 */
27000
27001
27002function wrapEvent(eventTarget, event) {
27003 var Wrapper = getWrapper((0, _getPrototypeOf.default)(event));
27004 return new Wrapper(eventTarget, event);
27005}
27006/**
27007 * Get the immediateStopped flag of a given event.
27008 * @param {Event} event The event to get.
27009 * @returns {boolean} The flag to stop propagation immediately.
27010 * @private
27011 */
27012
27013
27014function isStopped(event) {
27015 return pd(event).immediateStopped;
27016}
27017/**
27018 * Set the current event phase of a given event.
27019 * @param {Event} event The event to set current target.
27020 * @param {number} eventPhase New event phase.
27021 * @returns {void}
27022 * @private
27023 */
27024
27025
27026function setEventPhase(event, eventPhase) {
27027 pd(event).eventPhase = eventPhase;
27028}
27029/**
27030 * Set the current target of a given event.
27031 * @param {Event} event The event to set current target.
27032 * @param {EventTarget|null} currentTarget New current target.
27033 * @returns {void}
27034 * @private
27035 */
27036
27037
27038function setCurrentTarget(event, currentTarget) {
27039 pd(event).currentTarget = currentTarget;
27040}
27041/**
27042 * Set a passive listener of a given event.
27043 * @param {Event} event The event to set current target.
27044 * @param {Function|null} passiveListener New passive listener.
27045 * @returns {void}
27046 * @private
27047 */
27048
27049
27050function setPassiveListener(event, passiveListener) {
27051 pd(event).passiveListener = passiveListener;
27052}
27053/**
27054 * @typedef {object} ListenerNode
27055 * @property {Function} listener
27056 * @property {1|2|3} listenerType
27057 * @property {boolean} passive
27058 * @property {boolean} once
27059 * @property {ListenerNode|null} next
27060 * @private
27061 */
27062
27063/**
27064 * @type {WeakMap<object, Map<string, ListenerNode>>}
27065 * @private
27066 */
27067
27068
27069var listenersMap = new _weakMap.default(); // Listener types
27070
27071var CAPTURE = 1;
27072var BUBBLE = 2;
27073var ATTRIBUTE = 3;
27074/**
27075 * Check whether a given value is an object or not.
27076 * @param {any} x The value to check.
27077 * @returns {boolean} `true` if the value is an object.
27078 */
27079
27080function isObject(x) {
27081 return x !== null && (0, _typeof2.default)(x) === "object"; //eslint-disable-line no-restricted-syntax
27082}
27083/**
27084 * Get listeners.
27085 * @param {EventTarget} eventTarget The event target to get.
27086 * @returns {Map<string, ListenerNode>} The listeners.
27087 * @private
27088 */
27089
27090
27091function getListeners(eventTarget) {
27092 var listeners = listenersMap.get(eventTarget);
27093
27094 if (listeners == null) {
27095 throw new TypeError("'this' is expected an EventTarget object, but got another value.");
27096 }
27097
27098 return listeners;
27099}
27100/**
27101 * Get the property descriptor for the event attribute of a given event.
27102 * @param {string} eventName The event name to get property descriptor.
27103 * @returns {PropertyDescriptor} The property descriptor.
27104 * @private
27105 */
27106
27107
27108function defineEventAttributeDescriptor(eventName) {
27109 return {
27110 get: function get() {
27111 var listeners = getListeners(this);
27112 var node = listeners.get(eventName);
27113
27114 while (node != null) {
27115 if (node.listenerType === ATTRIBUTE) {
27116 return node.listener;
27117 }
27118
27119 node = node.next;
27120 }
27121
27122 return null;
27123 },
27124 set: function set(listener) {
27125 if (typeof listener !== "function" && !isObject(listener)) {
27126 listener = null; // eslint-disable-line no-param-reassign
27127 }
27128
27129 var listeners = getListeners(this); // Traverse to the tail while removing old value.
27130
27131 var prev = null;
27132 var node = listeners.get(eventName);
27133
27134 while (node != null) {
27135 if (node.listenerType === ATTRIBUTE) {
27136 // Remove old value.
27137 if (prev !== null) {
27138 prev.next = node.next;
27139 } else if (node.next !== null) {
27140 listeners.set(eventName, node.next);
27141 } else {
27142 listeners.delete(eventName);
27143 }
27144 } else {
27145 prev = node;
27146 }
27147
27148 node = node.next;
27149 } // Add new value.
27150
27151
27152 if (listener !== null) {
27153 var newNode = {
27154 listener: listener,
27155 listenerType: ATTRIBUTE,
27156 passive: false,
27157 once: false,
27158 next: null
27159 };
27160
27161 if (prev === null) {
27162 listeners.set(eventName, newNode);
27163 } else {
27164 prev.next = newNode;
27165 }
27166 }
27167 },
27168 configurable: true,
27169 enumerable: true
27170 };
27171}
27172/**
27173 * Define an event attribute (e.g. `eventTarget.onclick`).
27174 * @param {Object} eventTargetPrototype The event target prototype to define an event attrbite.
27175 * @param {string} eventName The event name to define.
27176 * @returns {void}
27177 */
27178
27179
27180function defineEventAttribute(eventTargetPrototype, eventName) {
27181 (0, _defineProperty.default)(eventTargetPrototype, "on".concat(eventName), defineEventAttributeDescriptor(eventName));
27182}
27183/**
27184 * Define a custom EventTarget with event attributes.
27185 * @param {string[]} eventNames Event names for event attributes.
27186 * @returns {EventTarget} The custom EventTarget.
27187 * @private
27188 */
27189
27190
27191function defineCustomEventTarget(eventNames) {
27192 /** CustomEventTarget */
27193 function CustomEventTarget() {
27194 EventTarget.call(this);
27195 }
27196
27197 CustomEventTarget.prototype = Object.create(EventTarget.prototype, {
27198 constructor: {
27199 value: CustomEventTarget,
27200 configurable: true,
27201 writable: true
27202 }
27203 });
27204
27205 for (var i = 0; i < eventNames.length; ++i) {
27206 defineEventAttribute(CustomEventTarget.prototype, eventNames[i]);
27207 }
27208
27209 return CustomEventTarget;
27210}
27211/**
27212 * EventTarget.
27213 *
27214 * - This is constructor if no arguments.
27215 * - This is a function which returns a CustomEventTarget constructor if there are arguments.
27216 *
27217 * For example:
27218 *
27219 * class A extends EventTarget {}
27220 * class B extends EventTarget("message") {}
27221 * class C extends EventTarget("message", "error") {}
27222 * class D extends EventTarget(["message", "error"]) {}
27223 */
27224
27225
27226function EventTarget() {
27227 /*eslint-disable consistent-return */
27228 if (this instanceof EventTarget) {
27229 listenersMap.set(this, new _map.default());
27230 return;
27231 }
27232
27233 if (arguments.length === 1 && Array.isArray(arguments[0])) {
27234 return defineCustomEventTarget(arguments[0]);
27235 }
27236
27237 if (arguments.length > 0) {
27238 var types = new Array(arguments.length);
27239
27240 for (var i = 0; i < arguments.length; ++i) {
27241 types[i] = arguments[i];
27242 }
27243
27244 return defineCustomEventTarget(types);
27245 }
27246
27247 throw new TypeError("Cannot call a class as a function");
27248 /*eslint-enable consistent-return */
27249} // Should be enumerable, but class methods are not enumerable.
27250
27251
27252EventTarget.prototype = {
27253 /**
27254 * Add a given listener to this event target.
27255 * @param {string} eventName The event name to add.
27256 * @param {Function} listener The listener to add.
27257 * @param {boolean|{capture?:boolean,passive?:boolean,once?:boolean}} [options] The options for this listener.
27258 * @returns {void}
27259 */
27260 addEventListener: function addEventListener(eventName, listener, options) {
27261 if (listener == null) {
27262 return;
27263 }
27264
27265 if (typeof listener !== "function" && !isObject(listener)) {
27266 throw new TypeError("'listener' should be a function or an object.");
27267 }
27268
27269 var listeners = getListeners(this);
27270 var optionsIsObj = isObject(options);
27271 var capture = optionsIsObj ? Boolean(options.capture) : Boolean(options);
27272 var listenerType = capture ? CAPTURE : BUBBLE;
27273 var newNode = {
27274 listener: listener,
27275 listenerType: listenerType,
27276 passive: optionsIsObj && Boolean(options.passive),
27277 once: optionsIsObj && Boolean(options.once),
27278 next: null
27279 }; // Set it as the first node if the first node is null.
27280
27281 var node = listeners.get(eventName);
27282
27283 if (node === undefined) {
27284 listeners.set(eventName, newNode);
27285 return;
27286 } // Traverse to the tail while checking duplication..
27287
27288
27289 var prev = null;
27290
27291 while (node != null) {
27292 if (node.listener === listener && node.listenerType === listenerType) {
27293 // Should ignore duplication.
27294 return;
27295 }
27296
27297 prev = node;
27298 node = node.next;
27299 } // Add it.
27300
27301
27302 prev.next = newNode;
27303 },
27304
27305 /**
27306 * Remove a given listener from this event target.
27307 * @param {string} eventName The event name to remove.
27308 * @param {Function} listener The listener to remove.
27309 * @param {boolean|{capture?:boolean,passive?:boolean,once?:boolean}} [options] The options for this listener.
27310 * @returns {void}
27311 */
27312 removeEventListener: function removeEventListener(eventName, listener, options) {
27313 if (listener == null) {
27314 return;
27315 }
27316
27317 var listeners = getListeners(this);
27318 var capture = isObject(options) ? Boolean(options.capture) : Boolean(options);
27319 var listenerType = capture ? CAPTURE : BUBBLE;
27320 var prev = null;
27321 var node = listeners.get(eventName);
27322
27323 while (node != null) {
27324 if (node.listener === listener && node.listenerType === listenerType) {
27325 if (prev !== null) {
27326 prev.next = node.next;
27327 } else if (node.next !== null) {
27328 listeners.set(eventName, node.next);
27329 } else {
27330 listeners.delete(eventName);
27331 }
27332
27333 return;
27334 }
27335
27336 prev = node;
27337 node = node.next;
27338 }
27339 },
27340
27341 /**
27342 * Dispatch a given event.
27343 * @param {Event|{type:string}} event The event to dispatch.
27344 * @returns {boolean} `false` if canceled.
27345 */
27346 dispatchEvent: function dispatchEvent(event) {
27347 if (event == null || typeof event.type !== "string") {
27348 throw new TypeError('"event.type" should be a string.');
27349 } // If listeners aren't registered, terminate.
27350
27351
27352 var listeners = getListeners(this);
27353 var eventName = event.type;
27354 var node = listeners.get(eventName);
27355
27356 if (node == null) {
27357 return true;
27358 } // Since we cannot rewrite several properties, so wrap object.
27359
27360
27361 var wrappedEvent = wrapEvent(this, event); // This doesn't process capturing phase and bubbling phase.
27362 // This isn't participating in a tree.
27363
27364 var prev = null;
27365
27366 while (node != null) {
27367 // Remove this listener if it's once
27368 if (node.once) {
27369 if (prev !== null) {
27370 prev.next = node.next;
27371 } else if (node.next !== null) {
27372 listeners.set(eventName, node.next);
27373 } else {
27374 listeners.delete(eventName);
27375 }
27376 } else {
27377 prev = node;
27378 } // Call this listener
27379
27380
27381 setPassiveListener(wrappedEvent, node.passive ? node.listener : null);
27382
27383 if (typeof node.listener === "function") {
27384 try {
27385 node.listener.call(this, wrappedEvent);
27386 } catch (err) {
27387 if (typeof console !== "undefined" && typeof console.error === "function") {
27388 console.error(err);
27389 }
27390 }
27391 } else if (node.listenerType !== ATTRIBUTE && typeof node.listener.handleEvent === "function") {
27392 node.listener.handleEvent(wrappedEvent);
27393 } // Break if `event.stopImmediatePropagation` was called.
27394
27395
27396 if (isStopped(wrappedEvent)) {
27397 break;
27398 }
27399
27400 node = node.next;
27401 }
27402
27403 setPassiveListener(wrappedEvent, null);
27404 setEventPhase(wrappedEvent, 0);
27405 setCurrentTarget(wrappedEvent, null);
27406 return !wrappedEvent.defaultPrevented;
27407 }
27408}; // `constructor` is not enumerable.
27409
27410(0, _defineProperty.default)(EventTarget.prototype, "constructor", {
27411 value: EventTarget,
27412 configurable: true,
27413 writable: true
27414}); // Ensure `eventTarget instanceof window.EventTarget` is `true`.
27415
27416if (typeof window !== "undefined" && typeof window.EventTarget !== "undefined") {
27417 (0, _setPrototypeOf.default)(EventTarget.prototype, window.EventTarget.prototype);
27418}
27419
27420var WS =
27421/** @class */
27422function (_super) {
27423 __extends$1(WS, _super);
27424
27425 function WS(url, protocol) {
27426 var _this = _super.call(this) || this;
27427
27428 _this._readyState = WS.CLOSED;
27429
27430 if (!url) {
27431 throw new TypeError("Failed to construct 'WebSocket': url required");
27432 }
27433
27434 _this._url = url;
27435 _this._protocol = protocol;
27436 return _this;
27437 }
27438
27439 (0, _defineProperty.default)(WS.prototype, "url", {
27440 get: function get() {
27441 return this._url;
27442 },
27443 enumerable: false,
27444 configurable: true
27445 });
27446 (0, _defineProperty.default)(WS.prototype, "protocol", {
27447 get: function get() {
27448 return this._protocol;
27449 },
27450 enumerable: false,
27451 configurable: true
27452 });
27453 (0, _defineProperty.default)(WS.prototype, "readyState", {
27454 get: function get() {
27455 return this._readyState;
27456 },
27457 enumerable: false,
27458 configurable: true
27459 });
27460 WS.CONNECTING = 0;
27461 WS.OPEN = 1;
27462 WS.CLOSING = 2;
27463 WS.CLOSED = 3;
27464 return WS;
27465}(EventTarget("open", "error", "message", "close"));
27466
27467var WechatWS =
27468/** @class */
27469function (_super) {
27470 __extends$1(WechatWS, _super);
27471
27472 function WechatWS(url, protocol) {
27473 var _this = _super.call(this, url, protocol) || this;
27474
27475 if (protocol && !(wx.canIUse && wx.canIUse("connectSocket.object.protocols"))) {
27476 throw new Error("subprotocol not supported in weapp");
27477 }
27478
27479 _this._readyState = WS.CONNECTING;
27480
27481 var errorHandler = function errorHandler(event) {
27482 _this._readyState = WS.CLOSED;
27483
27484 _this.dispatchEvent({
27485 type: "error",
27486 message: event.errMsg
27487 });
27488 };
27489
27490 var socketTask = wx.connectSocket({
27491 url: url,
27492 protocols: _this._protocol === undefined || Array.isArray(_this._protocol) ? _this._protocol : [_this._protocol],
27493 fail: function fail(error) {
27494 return setTimeout(function () {
27495 return errorHandler(error);
27496 }, 0);
27497 }
27498 });
27499 _this._socketTask = socketTask;
27500 socketTask.onOpen(function () {
27501 _this._readyState = WS.OPEN;
27502
27503 _this.dispatchEvent({
27504 type: "open"
27505 });
27506 });
27507 socketTask.onError(errorHandler);
27508 socketTask.onMessage(function (event) {
27509 var data = event.data;
27510
27511 _this.dispatchEvent({
27512 data: data,
27513 type: "message"
27514 });
27515 });
27516 socketTask.onClose(function (event) {
27517 _this._readyState = WS.CLOSED;
27518 var code = event.code,
27519 reason = event.reason;
27520
27521 _this.dispatchEvent({
27522 code: code,
27523 reason: reason,
27524 type: "close"
27525 });
27526 });
27527 return _this;
27528 }
27529
27530 WechatWS.prototype.close = function () {
27531 if (this.readyState === WS.CLOSED) return;
27532
27533 if (this.readyState === WS.CONNECTING) {
27534 console.warn("close WebSocket which is connecting might not work");
27535 }
27536
27537 this._socketTask.close({});
27538 };
27539
27540 WechatWS.prototype.send = function (data) {
27541 if (this.readyState !== WS.OPEN) {
27542 throw new Error("INVALID_STATE_ERR");
27543 }
27544
27545 if (!(typeof data === "string" || data instanceof ArrayBuffer)) {
27546 throw new TypeError("only String/ArrayBuffer supported");
27547 }
27548
27549 this._socketTask.send({
27550 data: data
27551 });
27552 };
27553
27554 return WechatWS;
27555}(WS);
27556
27557var WebSocket = WechatWS;
27558var platformInfo = {
27559 name: "Weapp"
27560};
27561exports.WebSocket = WebSocket;
27562exports.getAuthInfo = getAuthInfo;
27563exports.platformInfo = platformInfo;
27564exports.request = request;
27565exports.storage = storage;
27566exports.upload = upload;
27567
27568/***/ }),
27569/* 572 */
27570/***/ (function(module, exports, __webpack_require__) {
27571
27572var parent = __webpack_require__(573);
27573
27574module.exports = parent;
27575
27576
27577/***/ }),
27578/* 573 */
27579/***/ (function(module, exports, __webpack_require__) {
27580
27581__webpack_require__(574);
27582var path = __webpack_require__(5);
27583
27584module.exports = path.Object.assign;
27585
27586
27587/***/ }),
27588/* 574 */
27589/***/ (function(module, exports, __webpack_require__) {
27590
27591var $ = __webpack_require__(0);
27592var assign = __webpack_require__(575);
27593
27594// `Object.assign` method
27595// https://tc39.es/ecma262/#sec-object.assign
27596// eslint-disable-next-line es-x/no-object-assign -- required for testing
27597$({ target: 'Object', stat: true, arity: 2, forced: Object.assign !== assign }, {
27598 assign: assign
27599});
27600
27601
27602/***/ }),
27603/* 575 */
27604/***/ (function(module, exports, __webpack_require__) {
27605
27606"use strict";
27607
27608var DESCRIPTORS = __webpack_require__(14);
27609var uncurryThis = __webpack_require__(4);
27610var call = __webpack_require__(15);
27611var fails = __webpack_require__(2);
27612var objectKeys = __webpack_require__(105);
27613var getOwnPropertySymbolsModule = __webpack_require__(104);
27614var propertyIsEnumerableModule = __webpack_require__(121);
27615var toObject = __webpack_require__(34);
27616var IndexedObject = __webpack_require__(95);
27617
27618// eslint-disable-next-line es-x/no-object-assign -- safe
27619var $assign = Object.assign;
27620// eslint-disable-next-line es-x/no-object-defineproperty -- required for testing
27621var defineProperty = Object.defineProperty;
27622var concat = uncurryThis([].concat);
27623
27624// `Object.assign` method
27625// https://tc39.es/ecma262/#sec-object.assign
27626module.exports = !$assign || fails(function () {
27627 // should have correct order of operations (Edge bug)
27628 if (DESCRIPTORS && $assign({ b: 1 }, $assign(defineProperty({}, 'a', {
27629 enumerable: true,
27630 get: function () {
27631 defineProperty(this, 'b', {
27632 value: 3,
27633 enumerable: false
27634 });
27635 }
27636 }), { b: 2 })).b !== 1) return true;
27637 // should work with symbols and should have deterministic property order (V8 bug)
27638 var A = {};
27639 var B = {};
27640 // eslint-disable-next-line es-x/no-symbol -- safe
27641 var symbol = Symbol();
27642 var alphabet = 'abcdefghijklmnopqrst';
27643 A[symbol] = 7;
27644 alphabet.split('').forEach(function (chr) { B[chr] = chr; });
27645 return $assign({}, A)[symbol] != 7 || objectKeys($assign({}, B)).join('') != alphabet;
27646}) ? function assign(target, source) { // eslint-disable-line no-unused-vars -- required for `.length`
27647 var T = toObject(target);
27648 var argumentsLength = arguments.length;
27649 var index = 1;
27650 var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;
27651 var propertyIsEnumerable = propertyIsEnumerableModule.f;
27652 while (argumentsLength > index) {
27653 var S = IndexedObject(arguments[index++]);
27654 var keys = getOwnPropertySymbols ? concat(objectKeys(S), getOwnPropertySymbols(S)) : objectKeys(S);
27655 var length = keys.length;
27656 var j = 0;
27657 var key;
27658 while (length > j) {
27659 key = keys[j++];
27660 if (!DESCRIPTORS || call(propertyIsEnumerable, S, key)) T[key] = S[key];
27661 }
27662 } return T;
27663} : $assign;
27664
27665
27666/***/ }),
27667/* 576 */
27668/***/ (function(module, exports, __webpack_require__) {
27669
27670var parent = __webpack_require__(577);
27671
27672module.exports = parent;
27673
27674
27675/***/ }),
27676/* 577 */
27677/***/ (function(module, exports, __webpack_require__) {
27678
27679__webpack_require__(245);
27680var path = __webpack_require__(5);
27681
27682module.exports = path.Object.getOwnPropertySymbols;
27683
27684
27685/***/ }),
27686/* 578 */
27687/***/ (function(module, exports, __webpack_require__) {
27688
27689module.exports = __webpack_require__(250);
27690
27691/***/ }),
27692/* 579 */
27693/***/ (function(module, exports, __webpack_require__) {
27694
27695var parent = __webpack_require__(580);
27696__webpack_require__(39);
27697
27698module.exports = parent;
27699
27700
27701/***/ }),
27702/* 580 */
27703/***/ (function(module, exports, __webpack_require__) {
27704
27705__webpack_require__(38);
27706__webpack_require__(53);
27707__webpack_require__(581);
27708var path = __webpack_require__(5);
27709
27710module.exports = path.WeakMap;
27711
27712
27713/***/ }),
27714/* 581 */
27715/***/ (function(module, exports, __webpack_require__) {
27716
27717// TODO: Remove this module from `core-js@4` since it's replaced to module below
27718__webpack_require__(582);
27719
27720
27721/***/ }),
27722/* 582 */
27723/***/ (function(module, exports, __webpack_require__) {
27724
27725"use strict";
27726
27727var global = __webpack_require__(7);
27728var uncurryThis = __webpack_require__(4);
27729var defineBuiltIns = __webpack_require__(155);
27730var InternalMetadataModule = __webpack_require__(94);
27731var collection = __webpack_require__(156);
27732var collectionWeak = __webpack_require__(584);
27733var isObject = __webpack_require__(11);
27734var isExtensible = __webpack_require__(262);
27735var enforceInternalState = __webpack_require__(43).enforce;
27736var NATIVE_WEAK_MAP = __webpack_require__(171);
27737
27738var IS_IE11 = !global.ActiveXObject && 'ActiveXObject' in global;
27739var InternalWeakMap;
27740
27741var wrapper = function (init) {
27742 return function WeakMap() {
27743 return init(this, arguments.length ? arguments[0] : undefined);
27744 };
27745};
27746
27747// `WeakMap` constructor
27748// https://tc39.es/ecma262/#sec-weakmap-constructor
27749var $WeakMap = collection('WeakMap', wrapper, collectionWeak);
27750
27751// IE11 WeakMap frozen keys fix
27752// We can't use feature detection because it crash some old IE builds
27753// https://github.com/zloirock/core-js/issues/485
27754if (NATIVE_WEAK_MAP && IS_IE11) {
27755 InternalWeakMap = collectionWeak.getConstructor(wrapper, 'WeakMap', true);
27756 InternalMetadataModule.enable();
27757 var WeakMapPrototype = $WeakMap.prototype;
27758 var nativeDelete = uncurryThis(WeakMapPrototype['delete']);
27759 var nativeHas = uncurryThis(WeakMapPrototype.has);
27760 var nativeGet = uncurryThis(WeakMapPrototype.get);
27761 var nativeSet = uncurryThis(WeakMapPrototype.set);
27762 defineBuiltIns(WeakMapPrototype, {
27763 'delete': function (key) {
27764 if (isObject(key) && !isExtensible(key)) {
27765 var state = enforceInternalState(this);
27766 if (!state.frozen) state.frozen = new InternalWeakMap();
27767 return nativeDelete(this, key) || state.frozen['delete'](key);
27768 } return nativeDelete(this, key);
27769 },
27770 has: function has(key) {
27771 if (isObject(key) && !isExtensible(key)) {
27772 var state = enforceInternalState(this);
27773 if (!state.frozen) state.frozen = new InternalWeakMap();
27774 return nativeHas(this, key) || state.frozen.has(key);
27775 } return nativeHas(this, key);
27776 },
27777 get: function get(key) {
27778 if (isObject(key) && !isExtensible(key)) {
27779 var state = enforceInternalState(this);
27780 if (!state.frozen) state.frozen = new InternalWeakMap();
27781 return nativeHas(this, key) ? nativeGet(this, key) : state.frozen.get(key);
27782 } return nativeGet(this, key);
27783 },
27784 set: function set(key, value) {
27785 if (isObject(key) && !isExtensible(key)) {
27786 var state = enforceInternalState(this);
27787 if (!state.frozen) state.frozen = new InternalWeakMap();
27788 nativeHas(this, key) ? nativeSet(this, key, value) : state.frozen.set(key, value);
27789 } else nativeSet(this, key, value);
27790 return this;
27791 }
27792 });
27793}
27794
27795
27796/***/ }),
27797/* 583 */
27798/***/ (function(module, exports, __webpack_require__) {
27799
27800// FF26- bug: ArrayBuffers are non-extensible, but Object.isExtensible does not report it
27801var fails = __webpack_require__(2);
27802
27803module.exports = fails(function () {
27804 if (typeof ArrayBuffer == 'function') {
27805 var buffer = new ArrayBuffer(8);
27806 // eslint-disable-next-line es-x/no-object-isextensible, es-x/no-object-defineproperty -- safe
27807 if (Object.isExtensible(buffer)) Object.defineProperty(buffer, 'a', { value: 8 });
27808 }
27809});
27810
27811
27812/***/ }),
27813/* 584 */
27814/***/ (function(module, exports, __webpack_require__) {
27815
27816"use strict";
27817
27818var uncurryThis = __webpack_require__(4);
27819var defineBuiltIns = __webpack_require__(155);
27820var getWeakData = __webpack_require__(94).getWeakData;
27821var anObject = __webpack_require__(20);
27822var isObject = __webpack_require__(11);
27823var anInstance = __webpack_require__(108);
27824var iterate = __webpack_require__(42);
27825var ArrayIterationModule = __webpack_require__(70);
27826var hasOwn = __webpack_require__(13);
27827var InternalStateModule = __webpack_require__(43);
27828
27829var setInternalState = InternalStateModule.set;
27830var internalStateGetterFor = InternalStateModule.getterFor;
27831var find = ArrayIterationModule.find;
27832var findIndex = ArrayIterationModule.findIndex;
27833var splice = uncurryThis([].splice);
27834var id = 0;
27835
27836// fallback for uncaught frozen keys
27837var uncaughtFrozenStore = function (store) {
27838 return store.frozen || (store.frozen = new UncaughtFrozenStore());
27839};
27840
27841var UncaughtFrozenStore = function () {
27842 this.entries = [];
27843};
27844
27845var findUncaughtFrozen = function (store, key) {
27846 return find(store.entries, function (it) {
27847 return it[0] === key;
27848 });
27849};
27850
27851UncaughtFrozenStore.prototype = {
27852 get: function (key) {
27853 var entry = findUncaughtFrozen(this, key);
27854 if (entry) return entry[1];
27855 },
27856 has: function (key) {
27857 return !!findUncaughtFrozen(this, key);
27858 },
27859 set: function (key, value) {
27860 var entry = findUncaughtFrozen(this, key);
27861 if (entry) entry[1] = value;
27862 else this.entries.push([key, value]);
27863 },
27864 'delete': function (key) {
27865 var index = findIndex(this.entries, function (it) {
27866 return it[0] === key;
27867 });
27868 if (~index) splice(this.entries, index, 1);
27869 return !!~index;
27870 }
27871};
27872
27873module.exports = {
27874 getConstructor: function (wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER) {
27875 var Constructor = wrapper(function (that, iterable) {
27876 anInstance(that, Prototype);
27877 setInternalState(that, {
27878 type: CONSTRUCTOR_NAME,
27879 id: id++,
27880 frozen: undefined
27881 });
27882 if (iterable != undefined) iterate(iterable, that[ADDER], { that: that, AS_ENTRIES: IS_MAP });
27883 });
27884
27885 var Prototype = Constructor.prototype;
27886
27887 var getInternalState = internalStateGetterFor(CONSTRUCTOR_NAME);
27888
27889 var define = function (that, key, value) {
27890 var state = getInternalState(that);
27891 var data = getWeakData(anObject(key), true);
27892 if (data === true) uncaughtFrozenStore(state).set(key, value);
27893 else data[state.id] = value;
27894 return that;
27895 };
27896
27897 defineBuiltIns(Prototype, {
27898 // `{ WeakMap, WeakSet }.prototype.delete(key)` methods
27899 // https://tc39.es/ecma262/#sec-weakmap.prototype.delete
27900 // https://tc39.es/ecma262/#sec-weakset.prototype.delete
27901 'delete': function (key) {
27902 var state = getInternalState(this);
27903 if (!isObject(key)) return false;
27904 var data = getWeakData(key);
27905 if (data === true) return uncaughtFrozenStore(state)['delete'](key);
27906 return data && hasOwn(data, state.id) && delete data[state.id];
27907 },
27908 // `{ WeakMap, WeakSet }.prototype.has(key)` methods
27909 // https://tc39.es/ecma262/#sec-weakmap.prototype.has
27910 // https://tc39.es/ecma262/#sec-weakset.prototype.has
27911 has: function has(key) {
27912 var state = getInternalState(this);
27913 if (!isObject(key)) return false;
27914 var data = getWeakData(key);
27915 if (data === true) return uncaughtFrozenStore(state).has(key);
27916 return data && hasOwn(data, state.id);
27917 }
27918 });
27919
27920 defineBuiltIns(Prototype, IS_MAP ? {
27921 // `WeakMap.prototype.get(key)` method
27922 // https://tc39.es/ecma262/#sec-weakmap.prototype.get
27923 get: function get(key) {
27924 var state = getInternalState(this);
27925 if (isObject(key)) {
27926 var data = getWeakData(key);
27927 if (data === true) return uncaughtFrozenStore(state).get(key);
27928 return data ? data[state.id] : undefined;
27929 }
27930 },
27931 // `WeakMap.prototype.set(key, value)` method
27932 // https://tc39.es/ecma262/#sec-weakmap.prototype.set
27933 set: function set(key, value) {
27934 return define(this, key, value);
27935 }
27936 } : {
27937 // `WeakSet.prototype.add(value)` method
27938 // https://tc39.es/ecma262/#sec-weakset.prototype.add
27939 add: function add(value) {
27940 return define(this, value, true);
27941 }
27942 });
27943
27944 return Constructor;
27945 }
27946};
27947
27948
27949/***/ }),
27950/* 585 */
27951/***/ (function(module, exports, __webpack_require__) {
27952
27953module.exports = __webpack_require__(586);
27954
27955/***/ }),
27956/* 586 */
27957/***/ (function(module, exports, __webpack_require__) {
27958
27959var parent = __webpack_require__(587);
27960__webpack_require__(39);
27961
27962module.exports = parent;
27963
27964
27965/***/ }),
27966/* 587 */
27967/***/ (function(module, exports, __webpack_require__) {
27968
27969__webpack_require__(38);
27970__webpack_require__(588);
27971__webpack_require__(53);
27972__webpack_require__(55);
27973var path = __webpack_require__(5);
27974
27975module.exports = path.Map;
27976
27977
27978/***/ }),
27979/* 588 */
27980/***/ (function(module, exports, __webpack_require__) {
27981
27982// TODO: Remove this module from `core-js@4` since it's replaced to module below
27983__webpack_require__(589);
27984
27985
27986/***/ }),
27987/* 589 */
27988/***/ (function(module, exports, __webpack_require__) {
27989
27990"use strict";
27991
27992var collection = __webpack_require__(156);
27993var collectionStrong = __webpack_require__(264);
27994
27995// `Map` constructor
27996// https://tc39.es/ecma262/#sec-map-objects
27997collection('Map', function (init) {
27998 return function Map() { return init(this, arguments.length ? arguments[0] : undefined); };
27999}, collectionStrong);
28000
28001
28002/***/ }),
28003/* 590 */
28004/***/ (function(module, exports, __webpack_require__) {
28005
28006"use strict";
28007
28008
28009var _require = __webpack_require__(157),
28010 Realtime = _require.Realtime,
28011 setRTMAdapters = _require.setAdapters;
28012
28013var _require2 = __webpack_require__(667),
28014 LiveQueryPlugin = _require2.LiveQueryPlugin;
28015
28016Realtime.__preRegisteredPlugins = [LiveQueryPlugin];
28017
28018module.exports = function (AV) {
28019 AV._sharedConfig.liveQueryRealtime = Realtime;
28020 var setAdapters = AV.setAdapters;
28021
28022 AV.setAdapters = function (adapters) {
28023 setAdapters(adapters);
28024 setRTMAdapters(adapters);
28025 };
28026
28027 return AV;
28028};
28029
28030/***/ }),
28031/* 591 */
28032/***/ (function(module, exports, __webpack_require__) {
28033
28034"use strict";
28035/* WEBPACK VAR INJECTION */(function(global) {
28036
28037var _interopRequireDefault = __webpack_require__(1);
28038
28039var _typeof3 = _interopRequireDefault(__webpack_require__(73));
28040
28041var _defineProperty2 = _interopRequireDefault(__webpack_require__(92));
28042
28043var _freeze = _interopRequireDefault(__webpack_require__(592));
28044
28045var _assign = _interopRequireDefault(__webpack_require__(153));
28046
28047var _symbol = _interopRequireDefault(__webpack_require__(150));
28048
28049var _concat = _interopRequireDefault(__webpack_require__(22));
28050
28051var _keys = _interopRequireDefault(__webpack_require__(115));
28052
28053var _getOwnPropertySymbols = _interopRequireDefault(__webpack_require__(154));
28054
28055var _filter = _interopRequireDefault(__webpack_require__(251));
28056
28057var _getOwnPropertyDescriptor = _interopRequireDefault(__webpack_require__(152));
28058
28059var _getOwnPropertyDescriptors = _interopRequireDefault(__webpack_require__(596));
28060
28061var _defineProperties = _interopRequireDefault(__webpack_require__(600));
28062
28063var _promise = _interopRequireDefault(__webpack_require__(12));
28064
28065var _slice = _interopRequireDefault(__webpack_require__(61));
28066
28067var _indexOf = _interopRequireDefault(__webpack_require__(71));
28068
28069var _weakMap = _interopRequireDefault(__webpack_require__(261));
28070
28071var _stringify = _interopRequireDefault(__webpack_require__(36));
28072
28073var _map = _interopRequireDefault(__webpack_require__(35));
28074
28075var _reduce = _interopRequireDefault(__webpack_require__(604));
28076
28077var _find = _interopRequireDefault(__webpack_require__(93));
28078
28079var _set = _interopRequireDefault(__webpack_require__(265));
28080
28081var _context6, _context15;
28082
28083(0, _defineProperty2.default)(exports, '__esModule', {
28084 value: true
28085});
28086
28087function _interopDefault(ex) {
28088 return ex && (0, _typeof3.default)(ex) === 'object' && 'default' in ex ? ex['default'] : ex;
28089}
28090
28091var protobufLight = _interopDefault(__webpack_require__(614));
28092
28093var EventEmitter = _interopDefault(__webpack_require__(618));
28094
28095var _asyncToGenerator = _interopDefault(__webpack_require__(619));
28096
28097var _toConsumableArray = _interopDefault(__webpack_require__(620));
28098
28099var _defineProperty = _interopDefault(__webpack_require__(623));
28100
28101var _objectWithoutProperties = _interopDefault(__webpack_require__(625));
28102
28103var _assertThisInitialized = _interopDefault(__webpack_require__(627));
28104
28105var _inheritsLoose = _interopDefault(__webpack_require__(628));
28106
28107var _regeneratorRuntime = _interopDefault(__webpack_require__(630));
28108
28109var d = _interopDefault(__webpack_require__(60));
28110
28111var shuffle = _interopDefault(__webpack_require__(632));
28112
28113var values = _interopDefault(__webpack_require__(271));
28114
28115var _toArray = _interopDefault(__webpack_require__(659));
28116
28117var _createClass = _interopDefault(__webpack_require__(662));
28118
28119var _applyDecoratedDescriptor = _interopDefault(__webpack_require__(663));
28120
28121var StateMachine = _interopDefault(__webpack_require__(664));
28122
28123var _typeof = _interopDefault(__webpack_require__(118));
28124
28125var isPlainObject = _interopDefault(__webpack_require__(665));
28126
28127var promiseTimeout = __webpack_require__(252);
28128
28129var messageCompiled = protobufLight.newBuilder({})['import']({
28130 "package": 'push_server.messages2',
28131 syntax: 'proto2',
28132 options: {
28133 objc_class_prefix: 'AVIM'
28134 },
28135 messages: [{
28136 name: 'JsonObjectMessage',
28137 syntax: 'proto2',
28138 fields: [{
28139 rule: 'required',
28140 type: 'string',
28141 name: 'data',
28142 id: 1
28143 }]
28144 }, {
28145 name: 'UnreadTuple',
28146 syntax: 'proto2',
28147 fields: [{
28148 rule: 'required',
28149 type: 'string',
28150 name: 'cid',
28151 id: 1
28152 }, {
28153 rule: 'required',
28154 type: 'int32',
28155 name: 'unread',
28156 id: 2
28157 }, {
28158 rule: 'optional',
28159 type: 'string',
28160 name: 'mid',
28161 id: 3
28162 }, {
28163 rule: 'optional',
28164 type: 'int64',
28165 name: 'timestamp',
28166 id: 4
28167 }, {
28168 rule: 'optional',
28169 type: 'string',
28170 name: 'from',
28171 id: 5
28172 }, {
28173 rule: 'optional',
28174 type: 'string',
28175 name: 'data',
28176 id: 6
28177 }, {
28178 rule: 'optional',
28179 type: 'int64',
28180 name: 'patchTimestamp',
28181 id: 7
28182 }, {
28183 rule: 'optional',
28184 type: 'bool',
28185 name: 'mentioned',
28186 id: 8
28187 }, {
28188 rule: 'optional',
28189 type: 'bytes',
28190 name: 'binaryMsg',
28191 id: 9
28192 }, {
28193 rule: 'optional',
28194 type: 'int32',
28195 name: 'convType',
28196 id: 10
28197 }]
28198 }, {
28199 name: 'LogItem',
28200 syntax: 'proto2',
28201 fields: [{
28202 rule: 'optional',
28203 type: 'string',
28204 name: 'from',
28205 id: 1
28206 }, {
28207 rule: 'optional',
28208 type: 'string',
28209 name: 'data',
28210 id: 2
28211 }, {
28212 rule: 'optional',
28213 type: 'int64',
28214 name: 'timestamp',
28215 id: 3
28216 }, {
28217 rule: 'optional',
28218 type: 'string',
28219 name: 'msgId',
28220 id: 4
28221 }, {
28222 rule: 'optional',
28223 type: 'int64',
28224 name: 'ackAt',
28225 id: 5
28226 }, {
28227 rule: 'optional',
28228 type: 'int64',
28229 name: 'readAt',
28230 id: 6
28231 }, {
28232 rule: 'optional',
28233 type: 'int64',
28234 name: 'patchTimestamp',
28235 id: 7
28236 }, {
28237 rule: 'optional',
28238 type: 'bool',
28239 name: 'mentionAll',
28240 id: 8
28241 }, {
28242 rule: 'repeated',
28243 type: 'string',
28244 name: 'mentionPids',
28245 id: 9
28246 }, {
28247 rule: 'optional',
28248 type: 'bool',
28249 name: 'bin',
28250 id: 10
28251 }, {
28252 rule: 'optional',
28253 type: 'int32',
28254 name: 'convType',
28255 id: 11
28256 }]
28257 }, {
28258 name: 'ConvMemberInfo',
28259 syntax: 'proto2',
28260 fields: [{
28261 rule: 'optional',
28262 type: 'string',
28263 name: 'pid',
28264 id: 1
28265 }, {
28266 rule: 'optional',
28267 type: 'string',
28268 name: 'role',
28269 id: 2
28270 }, {
28271 rule: 'optional',
28272 type: 'string',
28273 name: 'infoId',
28274 id: 3
28275 }]
28276 }, {
28277 name: 'DataCommand',
28278 syntax: 'proto2',
28279 fields: [{
28280 rule: 'repeated',
28281 type: 'string',
28282 name: 'ids',
28283 id: 1
28284 }, {
28285 rule: 'repeated',
28286 type: 'JsonObjectMessage',
28287 name: 'msg',
28288 id: 2
28289 }, {
28290 rule: 'optional',
28291 type: 'bool',
28292 name: 'offline',
28293 id: 3
28294 }]
28295 }, {
28296 name: 'SessionCommand',
28297 syntax: 'proto2',
28298 fields: [{
28299 rule: 'optional',
28300 type: 'int64',
28301 name: 't',
28302 id: 1
28303 }, {
28304 rule: 'optional',
28305 type: 'string',
28306 name: 'n',
28307 id: 2
28308 }, {
28309 rule: 'optional',
28310 type: 'string',
28311 name: 's',
28312 id: 3
28313 }, {
28314 rule: 'optional',
28315 type: 'string',
28316 name: 'ua',
28317 id: 4
28318 }, {
28319 rule: 'optional',
28320 type: 'bool',
28321 name: 'r',
28322 id: 5
28323 }, {
28324 rule: 'optional',
28325 type: 'string',
28326 name: 'tag',
28327 id: 6
28328 }, {
28329 rule: 'optional',
28330 type: 'string',
28331 name: 'deviceId',
28332 id: 7
28333 }, {
28334 rule: 'repeated',
28335 type: 'string',
28336 name: 'sessionPeerIds',
28337 id: 8
28338 }, {
28339 rule: 'repeated',
28340 type: 'string',
28341 name: 'onlineSessionPeerIds',
28342 id: 9
28343 }, {
28344 rule: 'optional',
28345 type: 'string',
28346 name: 'st',
28347 id: 10
28348 }, {
28349 rule: 'optional',
28350 type: 'int32',
28351 name: 'stTtl',
28352 id: 11
28353 }, {
28354 rule: 'optional',
28355 type: 'int32',
28356 name: 'code',
28357 id: 12
28358 }, {
28359 rule: 'optional',
28360 type: 'string',
28361 name: 'reason',
28362 id: 13
28363 }, {
28364 rule: 'optional',
28365 type: 'string',
28366 name: 'deviceToken',
28367 id: 14
28368 }, {
28369 rule: 'optional',
28370 type: 'bool',
28371 name: 'sp',
28372 id: 15
28373 }, {
28374 rule: 'optional',
28375 type: 'string',
28376 name: 'detail',
28377 id: 16
28378 }, {
28379 rule: 'optional',
28380 type: 'int64',
28381 name: 'lastUnreadNotifTime',
28382 id: 17
28383 }, {
28384 rule: 'optional',
28385 type: 'int64',
28386 name: 'lastPatchTime',
28387 id: 18
28388 }, {
28389 rule: 'optional',
28390 type: 'int64',
28391 name: 'configBitmap',
28392 id: 19
28393 }]
28394 }, {
28395 name: 'ErrorCommand',
28396 syntax: 'proto2',
28397 fields: [{
28398 rule: 'required',
28399 type: 'int32',
28400 name: 'code',
28401 id: 1
28402 }, {
28403 rule: 'required',
28404 type: 'string',
28405 name: 'reason',
28406 id: 2
28407 }, {
28408 rule: 'optional',
28409 type: 'int32',
28410 name: 'appCode',
28411 id: 3
28412 }, {
28413 rule: 'optional',
28414 type: 'string',
28415 name: 'detail',
28416 id: 4
28417 }, {
28418 rule: 'repeated',
28419 type: 'string',
28420 name: 'pids',
28421 id: 5
28422 }, {
28423 rule: 'optional',
28424 type: 'string',
28425 name: 'appMsg',
28426 id: 6
28427 }]
28428 }, {
28429 name: 'DirectCommand',
28430 syntax: 'proto2',
28431 fields: [{
28432 rule: 'optional',
28433 type: 'string',
28434 name: 'msg',
28435 id: 1
28436 }, {
28437 rule: 'optional',
28438 type: 'string',
28439 name: 'uid',
28440 id: 2
28441 }, {
28442 rule: 'optional',
28443 type: 'string',
28444 name: 'fromPeerId',
28445 id: 3
28446 }, {
28447 rule: 'optional',
28448 type: 'int64',
28449 name: 'timestamp',
28450 id: 4
28451 }, {
28452 rule: 'optional',
28453 type: 'bool',
28454 name: 'offline',
28455 id: 5
28456 }, {
28457 rule: 'optional',
28458 type: 'bool',
28459 name: 'hasMore',
28460 id: 6
28461 }, {
28462 rule: 'repeated',
28463 type: 'string',
28464 name: 'toPeerIds',
28465 id: 7
28466 }, {
28467 rule: 'optional',
28468 type: 'bool',
28469 name: 'r',
28470 id: 10
28471 }, {
28472 rule: 'optional',
28473 type: 'string',
28474 name: 'cid',
28475 id: 11
28476 }, {
28477 rule: 'optional',
28478 type: 'string',
28479 name: 'id',
28480 id: 12
28481 }, {
28482 rule: 'optional',
28483 type: 'bool',
28484 name: 'transient',
28485 id: 13
28486 }, {
28487 rule: 'optional',
28488 type: 'string',
28489 name: 'dt',
28490 id: 14
28491 }, {
28492 rule: 'optional',
28493 type: 'string',
28494 name: 'roomId',
28495 id: 15
28496 }, {
28497 rule: 'optional',
28498 type: 'string',
28499 name: 'pushData',
28500 id: 16
28501 }, {
28502 rule: 'optional',
28503 type: 'bool',
28504 name: 'will',
28505 id: 17
28506 }, {
28507 rule: 'optional',
28508 type: 'int64',
28509 name: 'patchTimestamp',
28510 id: 18
28511 }, {
28512 rule: 'optional',
28513 type: 'bytes',
28514 name: 'binaryMsg',
28515 id: 19
28516 }, {
28517 rule: 'repeated',
28518 type: 'string',
28519 name: 'mentionPids',
28520 id: 20
28521 }, {
28522 rule: 'optional',
28523 type: 'bool',
28524 name: 'mentionAll',
28525 id: 21
28526 }, {
28527 rule: 'optional',
28528 type: 'int32',
28529 name: 'convType',
28530 id: 22
28531 }]
28532 }, {
28533 name: 'AckCommand',
28534 syntax: 'proto2',
28535 fields: [{
28536 rule: 'optional',
28537 type: 'int32',
28538 name: 'code',
28539 id: 1
28540 }, {
28541 rule: 'optional',
28542 type: 'string',
28543 name: 'reason',
28544 id: 2
28545 }, {
28546 rule: 'optional',
28547 type: 'string',
28548 name: 'mid',
28549 id: 3
28550 }, {
28551 rule: 'optional',
28552 type: 'string',
28553 name: 'cid',
28554 id: 4
28555 }, {
28556 rule: 'optional',
28557 type: 'int64',
28558 name: 't',
28559 id: 5
28560 }, {
28561 rule: 'optional',
28562 type: 'string',
28563 name: 'uid',
28564 id: 6
28565 }, {
28566 rule: 'optional',
28567 type: 'int64',
28568 name: 'fromts',
28569 id: 7
28570 }, {
28571 rule: 'optional',
28572 type: 'int64',
28573 name: 'tots',
28574 id: 8
28575 }, {
28576 rule: 'optional',
28577 type: 'string',
28578 name: 'type',
28579 id: 9
28580 }, {
28581 rule: 'repeated',
28582 type: 'string',
28583 name: 'ids',
28584 id: 10
28585 }, {
28586 rule: 'optional',
28587 type: 'int32',
28588 name: 'appCode',
28589 id: 11
28590 }, {
28591 rule: 'optional',
28592 type: 'string',
28593 name: 'appMsg',
28594 id: 12
28595 }]
28596 }, {
28597 name: 'UnreadCommand',
28598 syntax: 'proto2',
28599 fields: [{
28600 rule: 'repeated',
28601 type: 'UnreadTuple',
28602 name: 'convs',
28603 id: 1
28604 }, {
28605 rule: 'optional',
28606 type: 'int64',
28607 name: 'notifTime',
28608 id: 2
28609 }]
28610 }, {
28611 name: 'ConvCommand',
28612 syntax: 'proto2',
28613 fields: [{
28614 rule: 'repeated',
28615 type: 'string',
28616 name: 'm',
28617 id: 1
28618 }, {
28619 rule: 'optional',
28620 type: 'bool',
28621 name: 'transient',
28622 id: 2
28623 }, {
28624 rule: 'optional',
28625 type: 'bool',
28626 name: 'unique',
28627 id: 3
28628 }, {
28629 rule: 'optional',
28630 type: 'string',
28631 name: 'cid',
28632 id: 4
28633 }, {
28634 rule: 'optional',
28635 type: 'string',
28636 name: 'cdate',
28637 id: 5
28638 }, {
28639 rule: 'optional',
28640 type: 'string',
28641 name: 'initBy',
28642 id: 6
28643 }, {
28644 rule: 'optional',
28645 type: 'string',
28646 name: 'sort',
28647 id: 7
28648 }, {
28649 rule: 'optional',
28650 type: 'int32',
28651 name: 'limit',
28652 id: 8
28653 }, {
28654 rule: 'optional',
28655 type: 'int32',
28656 name: 'skip',
28657 id: 9
28658 }, {
28659 rule: 'optional',
28660 type: 'int32',
28661 name: 'flag',
28662 id: 10
28663 }, {
28664 rule: 'optional',
28665 type: 'int32',
28666 name: 'count',
28667 id: 11
28668 }, {
28669 rule: 'optional',
28670 type: 'string',
28671 name: 'udate',
28672 id: 12
28673 }, {
28674 rule: 'optional',
28675 type: 'int64',
28676 name: 't',
28677 id: 13
28678 }, {
28679 rule: 'optional',
28680 type: 'string',
28681 name: 'n',
28682 id: 14
28683 }, {
28684 rule: 'optional',
28685 type: 'string',
28686 name: 's',
28687 id: 15
28688 }, {
28689 rule: 'optional',
28690 type: 'bool',
28691 name: 'statusSub',
28692 id: 16
28693 }, {
28694 rule: 'optional',
28695 type: 'bool',
28696 name: 'statusPub',
28697 id: 17
28698 }, {
28699 rule: 'optional',
28700 type: 'int32',
28701 name: 'statusTTL',
28702 id: 18
28703 }, {
28704 rule: 'optional',
28705 type: 'string',
28706 name: 'uniqueId',
28707 id: 19
28708 }, {
28709 rule: 'optional',
28710 type: 'string',
28711 name: 'targetClientId',
28712 id: 20
28713 }, {
28714 rule: 'optional',
28715 type: 'int64',
28716 name: 'maxReadTimestamp',
28717 id: 21
28718 }, {
28719 rule: 'optional',
28720 type: 'int64',
28721 name: 'maxAckTimestamp',
28722 id: 22
28723 }, {
28724 rule: 'optional',
28725 type: 'bool',
28726 name: 'queryAllMembers',
28727 id: 23
28728 }, {
28729 rule: 'repeated',
28730 type: 'MaxReadTuple',
28731 name: 'maxReadTuples',
28732 id: 24
28733 }, {
28734 rule: 'repeated',
28735 type: 'string',
28736 name: 'cids',
28737 id: 25
28738 }, {
28739 rule: 'optional',
28740 type: 'ConvMemberInfo',
28741 name: 'info',
28742 id: 26
28743 }, {
28744 rule: 'optional',
28745 type: 'bool',
28746 name: 'tempConv',
28747 id: 27
28748 }, {
28749 rule: 'optional',
28750 type: 'int32',
28751 name: 'tempConvTTL',
28752 id: 28
28753 }, {
28754 rule: 'repeated',
28755 type: 'string',
28756 name: 'tempConvIds',
28757 id: 29
28758 }, {
28759 rule: 'repeated',
28760 type: 'string',
28761 name: 'allowedPids',
28762 id: 30
28763 }, {
28764 rule: 'repeated',
28765 type: 'ErrorCommand',
28766 name: 'failedPids',
28767 id: 31
28768 }, {
28769 rule: 'optional',
28770 type: 'string',
28771 name: 'next',
28772 id: 40
28773 }, {
28774 rule: 'optional',
28775 type: 'JsonObjectMessage',
28776 name: 'results',
28777 id: 100
28778 }, {
28779 rule: 'optional',
28780 type: 'JsonObjectMessage',
28781 name: 'where',
28782 id: 101
28783 }, {
28784 rule: 'optional',
28785 type: 'JsonObjectMessage',
28786 name: 'attr',
28787 id: 103
28788 }, {
28789 rule: 'optional',
28790 type: 'JsonObjectMessage',
28791 name: 'attrModified',
28792 id: 104
28793 }]
28794 }, {
28795 name: 'RoomCommand',
28796 syntax: 'proto2',
28797 fields: [{
28798 rule: 'optional',
28799 type: 'string',
28800 name: 'roomId',
28801 id: 1
28802 }, {
28803 rule: 'optional',
28804 type: 'string',
28805 name: 's',
28806 id: 2
28807 }, {
28808 rule: 'optional',
28809 type: 'int64',
28810 name: 't',
28811 id: 3
28812 }, {
28813 rule: 'optional',
28814 type: 'string',
28815 name: 'n',
28816 id: 4
28817 }, {
28818 rule: 'optional',
28819 type: 'bool',
28820 name: 'transient',
28821 id: 5
28822 }, {
28823 rule: 'repeated',
28824 type: 'string',
28825 name: 'roomPeerIds',
28826 id: 6
28827 }, {
28828 rule: 'optional',
28829 type: 'string',
28830 name: 'byPeerId',
28831 id: 7
28832 }]
28833 }, {
28834 name: 'LogsCommand',
28835 syntax: 'proto2',
28836 fields: [{
28837 rule: 'optional',
28838 type: 'string',
28839 name: 'cid',
28840 id: 1
28841 }, {
28842 rule: 'optional',
28843 type: 'int32',
28844 name: 'l',
28845 id: 2
28846 }, {
28847 rule: 'optional',
28848 type: 'int32',
28849 name: 'limit',
28850 id: 3
28851 }, {
28852 rule: 'optional',
28853 type: 'int64',
28854 name: 't',
28855 id: 4
28856 }, {
28857 rule: 'optional',
28858 type: 'int64',
28859 name: 'tt',
28860 id: 5
28861 }, {
28862 rule: 'optional',
28863 type: 'string',
28864 name: 'tmid',
28865 id: 6
28866 }, {
28867 rule: 'optional',
28868 type: 'string',
28869 name: 'mid',
28870 id: 7
28871 }, {
28872 rule: 'optional',
28873 type: 'string',
28874 name: 'checksum',
28875 id: 8
28876 }, {
28877 rule: 'optional',
28878 type: 'bool',
28879 name: 'stored',
28880 id: 9
28881 }, {
28882 rule: 'optional',
28883 type: 'QueryDirection',
28884 name: 'direction',
28885 id: 10,
28886 options: {
28887 "default": 'OLD'
28888 }
28889 }, {
28890 rule: 'optional',
28891 type: 'bool',
28892 name: 'tIncluded',
28893 id: 11
28894 }, {
28895 rule: 'optional',
28896 type: 'bool',
28897 name: 'ttIncluded',
28898 id: 12
28899 }, {
28900 rule: 'optional',
28901 type: 'int32',
28902 name: 'lctype',
28903 id: 13
28904 }, {
28905 rule: 'repeated',
28906 type: 'LogItem',
28907 name: 'logs',
28908 id: 105
28909 }],
28910 enums: [{
28911 name: 'QueryDirection',
28912 syntax: 'proto2',
28913 values: [{
28914 name: 'OLD',
28915 id: 1
28916 }, {
28917 name: 'NEW',
28918 id: 2
28919 }]
28920 }]
28921 }, {
28922 name: 'RcpCommand',
28923 syntax: 'proto2',
28924 fields: [{
28925 rule: 'optional',
28926 type: 'string',
28927 name: 'id',
28928 id: 1
28929 }, {
28930 rule: 'optional',
28931 type: 'string',
28932 name: 'cid',
28933 id: 2
28934 }, {
28935 rule: 'optional',
28936 type: 'int64',
28937 name: 't',
28938 id: 3
28939 }, {
28940 rule: 'optional',
28941 type: 'bool',
28942 name: 'read',
28943 id: 4
28944 }, {
28945 rule: 'optional',
28946 type: 'string',
28947 name: 'from',
28948 id: 5
28949 }]
28950 }, {
28951 name: 'ReadTuple',
28952 syntax: 'proto2',
28953 fields: [{
28954 rule: 'required',
28955 type: 'string',
28956 name: 'cid',
28957 id: 1
28958 }, {
28959 rule: 'optional',
28960 type: 'int64',
28961 name: 'timestamp',
28962 id: 2
28963 }, {
28964 rule: 'optional',
28965 type: 'string',
28966 name: 'mid',
28967 id: 3
28968 }]
28969 }, {
28970 name: 'MaxReadTuple',
28971 syntax: 'proto2',
28972 fields: [{
28973 rule: 'optional',
28974 type: 'string',
28975 name: 'pid',
28976 id: 1
28977 }, {
28978 rule: 'optional',
28979 type: 'int64',
28980 name: 'maxAckTimestamp',
28981 id: 2
28982 }, {
28983 rule: 'optional',
28984 type: 'int64',
28985 name: 'maxReadTimestamp',
28986 id: 3
28987 }]
28988 }, {
28989 name: 'ReadCommand',
28990 syntax: 'proto2',
28991 fields: [{
28992 rule: 'optional',
28993 type: 'string',
28994 name: 'cid',
28995 id: 1
28996 }, {
28997 rule: 'repeated',
28998 type: 'string',
28999 name: 'cids',
29000 id: 2
29001 }, {
29002 rule: 'repeated',
29003 type: 'ReadTuple',
29004 name: 'convs',
29005 id: 3
29006 }]
29007 }, {
29008 name: 'PresenceCommand',
29009 syntax: 'proto2',
29010 fields: [{
29011 rule: 'optional',
29012 type: 'StatusType',
29013 name: 'status',
29014 id: 1
29015 }, {
29016 rule: 'repeated',
29017 type: 'string',
29018 name: 'sessionPeerIds',
29019 id: 2
29020 }, {
29021 rule: 'optional',
29022 type: 'string',
29023 name: 'cid',
29024 id: 3
29025 }]
29026 }, {
29027 name: 'ReportCommand',
29028 syntax: 'proto2',
29029 fields: [{
29030 rule: 'optional',
29031 type: 'bool',
29032 name: 'initiative',
29033 id: 1
29034 }, {
29035 rule: 'optional',
29036 type: 'string',
29037 name: 'type',
29038 id: 2
29039 }, {
29040 rule: 'optional',
29041 type: 'string',
29042 name: 'data',
29043 id: 3
29044 }]
29045 }, {
29046 name: 'PatchItem',
29047 syntax: 'proto2',
29048 fields: [{
29049 rule: 'optional',
29050 type: 'string',
29051 name: 'cid',
29052 id: 1
29053 }, {
29054 rule: 'optional',
29055 type: 'string',
29056 name: 'mid',
29057 id: 2
29058 }, {
29059 rule: 'optional',
29060 type: 'int64',
29061 name: 'timestamp',
29062 id: 3
29063 }, {
29064 rule: 'optional',
29065 type: 'bool',
29066 name: 'recall',
29067 id: 4
29068 }, {
29069 rule: 'optional',
29070 type: 'string',
29071 name: 'data',
29072 id: 5
29073 }, {
29074 rule: 'optional',
29075 type: 'int64',
29076 name: 'patchTimestamp',
29077 id: 6
29078 }, {
29079 rule: 'optional',
29080 type: 'string',
29081 name: 'from',
29082 id: 7
29083 }, {
29084 rule: 'optional',
29085 type: 'bytes',
29086 name: 'binaryMsg',
29087 id: 8
29088 }, {
29089 rule: 'optional',
29090 type: 'bool',
29091 name: 'mentionAll',
29092 id: 9
29093 }, {
29094 rule: 'repeated',
29095 type: 'string',
29096 name: 'mentionPids',
29097 id: 10
29098 }, {
29099 rule: 'optional',
29100 type: 'int64',
29101 name: 'patchCode',
29102 id: 11
29103 }, {
29104 rule: 'optional',
29105 type: 'string',
29106 name: 'patchReason',
29107 id: 12
29108 }]
29109 }, {
29110 name: 'PatchCommand',
29111 syntax: 'proto2',
29112 fields: [{
29113 rule: 'repeated',
29114 type: 'PatchItem',
29115 name: 'patches',
29116 id: 1
29117 }, {
29118 rule: 'optional',
29119 type: 'int64',
29120 name: 'lastPatchTime',
29121 id: 2
29122 }]
29123 }, {
29124 name: 'PubsubCommand',
29125 syntax: 'proto2',
29126 fields: [{
29127 rule: 'optional',
29128 type: 'string',
29129 name: 'cid',
29130 id: 1
29131 }, {
29132 rule: 'repeated',
29133 type: 'string',
29134 name: 'cids',
29135 id: 2
29136 }, {
29137 rule: 'optional',
29138 type: 'string',
29139 name: 'topic',
29140 id: 3
29141 }, {
29142 rule: 'optional',
29143 type: 'string',
29144 name: 'subtopic',
29145 id: 4
29146 }, {
29147 rule: 'repeated',
29148 type: 'string',
29149 name: 'topics',
29150 id: 5
29151 }, {
29152 rule: 'repeated',
29153 type: 'string',
29154 name: 'subtopics',
29155 id: 6
29156 }, {
29157 rule: 'optional',
29158 type: 'JsonObjectMessage',
29159 name: 'results',
29160 id: 7
29161 }]
29162 }, {
29163 name: 'BlacklistCommand',
29164 syntax: 'proto2',
29165 fields: [{
29166 rule: 'optional',
29167 type: 'string',
29168 name: 'srcCid',
29169 id: 1
29170 }, {
29171 rule: 'repeated',
29172 type: 'string',
29173 name: 'toPids',
29174 id: 2
29175 }, {
29176 rule: 'optional',
29177 type: 'string',
29178 name: 'srcPid',
29179 id: 3
29180 }, {
29181 rule: 'repeated',
29182 type: 'string',
29183 name: 'toCids',
29184 id: 4
29185 }, {
29186 rule: 'optional',
29187 type: 'int32',
29188 name: 'limit',
29189 id: 5
29190 }, {
29191 rule: 'optional',
29192 type: 'string',
29193 name: 'next',
29194 id: 6
29195 }, {
29196 rule: 'repeated',
29197 type: 'string',
29198 name: 'blockedPids',
29199 id: 8
29200 }, {
29201 rule: 'repeated',
29202 type: 'string',
29203 name: 'blockedCids',
29204 id: 9
29205 }, {
29206 rule: 'repeated',
29207 type: 'string',
29208 name: 'allowedPids',
29209 id: 10
29210 }, {
29211 rule: 'repeated',
29212 type: 'ErrorCommand',
29213 name: 'failedPids',
29214 id: 11
29215 }, {
29216 rule: 'optional',
29217 type: 'int64',
29218 name: 't',
29219 id: 12
29220 }, {
29221 rule: 'optional',
29222 type: 'string',
29223 name: 'n',
29224 id: 13
29225 }, {
29226 rule: 'optional',
29227 type: 'string',
29228 name: 's',
29229 id: 14
29230 }]
29231 }, {
29232 name: 'GenericCommand',
29233 syntax: 'proto2',
29234 fields: [{
29235 rule: 'optional',
29236 type: 'CommandType',
29237 name: 'cmd',
29238 id: 1
29239 }, {
29240 rule: 'optional',
29241 type: 'OpType',
29242 name: 'op',
29243 id: 2
29244 }, {
29245 rule: 'optional',
29246 type: 'string',
29247 name: 'appId',
29248 id: 3
29249 }, {
29250 rule: 'optional',
29251 type: 'string',
29252 name: 'peerId',
29253 id: 4
29254 }, {
29255 rule: 'optional',
29256 type: 'int32',
29257 name: 'i',
29258 id: 5
29259 }, {
29260 rule: 'optional',
29261 type: 'string',
29262 name: 'installationId',
29263 id: 6
29264 }, {
29265 rule: 'optional',
29266 type: 'int32',
29267 name: 'priority',
29268 id: 7
29269 }, {
29270 rule: 'optional',
29271 type: 'int32',
29272 name: 'service',
29273 id: 8
29274 }, {
29275 rule: 'optional',
29276 type: 'int64',
29277 name: 'serverTs',
29278 id: 9
29279 }, {
29280 rule: 'optional',
29281 type: 'int64',
29282 name: 'clientTs',
29283 id: 10
29284 }, {
29285 rule: 'optional',
29286 type: 'int32',
29287 name: 'notificationType',
29288 id: 11
29289 }, {
29290 rule: 'optional',
29291 type: 'DataCommand',
29292 name: 'dataMessage',
29293 id: 101
29294 }, {
29295 rule: 'optional',
29296 type: 'SessionCommand',
29297 name: 'sessionMessage',
29298 id: 102
29299 }, {
29300 rule: 'optional',
29301 type: 'ErrorCommand',
29302 name: 'errorMessage',
29303 id: 103
29304 }, {
29305 rule: 'optional',
29306 type: 'DirectCommand',
29307 name: 'directMessage',
29308 id: 104
29309 }, {
29310 rule: 'optional',
29311 type: 'AckCommand',
29312 name: 'ackMessage',
29313 id: 105
29314 }, {
29315 rule: 'optional',
29316 type: 'UnreadCommand',
29317 name: 'unreadMessage',
29318 id: 106
29319 }, {
29320 rule: 'optional',
29321 type: 'ReadCommand',
29322 name: 'readMessage',
29323 id: 107
29324 }, {
29325 rule: 'optional',
29326 type: 'RcpCommand',
29327 name: 'rcpMessage',
29328 id: 108
29329 }, {
29330 rule: 'optional',
29331 type: 'LogsCommand',
29332 name: 'logsMessage',
29333 id: 109
29334 }, {
29335 rule: 'optional',
29336 type: 'ConvCommand',
29337 name: 'convMessage',
29338 id: 110
29339 }, {
29340 rule: 'optional',
29341 type: 'RoomCommand',
29342 name: 'roomMessage',
29343 id: 111
29344 }, {
29345 rule: 'optional',
29346 type: 'PresenceCommand',
29347 name: 'presenceMessage',
29348 id: 112
29349 }, {
29350 rule: 'optional',
29351 type: 'ReportCommand',
29352 name: 'reportMessage',
29353 id: 113
29354 }, {
29355 rule: 'optional',
29356 type: 'PatchCommand',
29357 name: 'patchMessage',
29358 id: 114
29359 }, {
29360 rule: 'optional',
29361 type: 'PubsubCommand',
29362 name: 'pubsubMessage',
29363 id: 115
29364 }, {
29365 rule: 'optional',
29366 type: 'BlacklistCommand',
29367 name: 'blacklistMessage',
29368 id: 116
29369 }]
29370 }],
29371 enums: [{
29372 name: 'CommandType',
29373 syntax: 'proto2',
29374 values: [{
29375 name: 'session',
29376 id: 0
29377 }, {
29378 name: 'conv',
29379 id: 1
29380 }, {
29381 name: 'direct',
29382 id: 2
29383 }, {
29384 name: 'ack',
29385 id: 3
29386 }, {
29387 name: 'rcp',
29388 id: 4
29389 }, {
29390 name: 'unread',
29391 id: 5
29392 }, {
29393 name: 'logs',
29394 id: 6
29395 }, {
29396 name: 'error',
29397 id: 7
29398 }, {
29399 name: 'login',
29400 id: 8
29401 }, {
29402 name: 'data',
29403 id: 9
29404 }, {
29405 name: 'room',
29406 id: 10
29407 }, {
29408 name: 'read',
29409 id: 11
29410 }, {
29411 name: 'presence',
29412 id: 12
29413 }, {
29414 name: 'report',
29415 id: 13
29416 }, {
29417 name: 'echo',
29418 id: 14
29419 }, {
29420 name: 'loggedin',
29421 id: 15
29422 }, {
29423 name: 'logout',
29424 id: 16
29425 }, {
29426 name: 'loggedout',
29427 id: 17
29428 }, {
29429 name: 'patch',
29430 id: 18
29431 }, {
29432 name: 'pubsub',
29433 id: 19
29434 }, {
29435 name: 'blacklist',
29436 id: 20
29437 }, {
29438 name: 'goaway',
29439 id: 21
29440 }]
29441 }, {
29442 name: 'OpType',
29443 syntax: 'proto2',
29444 values: [{
29445 name: 'open',
29446 id: 1
29447 }, {
29448 name: 'add',
29449 id: 2
29450 }, {
29451 name: 'remove',
29452 id: 3
29453 }, {
29454 name: 'close',
29455 id: 4
29456 }, {
29457 name: 'opened',
29458 id: 5
29459 }, {
29460 name: 'closed',
29461 id: 6
29462 }, {
29463 name: 'query',
29464 id: 7
29465 }, {
29466 name: 'query_result',
29467 id: 8
29468 }, {
29469 name: 'conflict',
29470 id: 9
29471 }, {
29472 name: 'added',
29473 id: 10
29474 }, {
29475 name: 'removed',
29476 id: 11
29477 }, {
29478 name: 'refresh',
29479 id: 12
29480 }, {
29481 name: 'refreshed',
29482 id: 13
29483 }, {
29484 name: 'start',
29485 id: 30
29486 }, {
29487 name: 'started',
29488 id: 31
29489 }, {
29490 name: 'joined',
29491 id: 32
29492 }, {
29493 name: 'members_joined',
29494 id: 33
29495 }, {
29496 name: 'left',
29497 id: 39
29498 }, {
29499 name: 'members_left',
29500 id: 40
29501 }, {
29502 name: 'results',
29503 id: 42
29504 }, {
29505 name: 'count',
29506 id: 43
29507 }, {
29508 name: 'result',
29509 id: 44
29510 }, {
29511 name: 'update',
29512 id: 45
29513 }, {
29514 name: 'updated',
29515 id: 46
29516 }, {
29517 name: 'mute',
29518 id: 47
29519 }, {
29520 name: 'unmute',
29521 id: 48
29522 }, {
29523 name: 'status',
29524 id: 49
29525 }, {
29526 name: 'members',
29527 id: 50
29528 }, {
29529 name: 'max_read',
29530 id: 51
29531 }, {
29532 name: 'is_member',
29533 id: 52
29534 }, {
29535 name: 'member_info_update',
29536 id: 53
29537 }, {
29538 name: 'member_info_updated',
29539 id: 54
29540 }, {
29541 name: 'member_info_changed',
29542 id: 55
29543 }, {
29544 name: 'join',
29545 id: 80
29546 }, {
29547 name: 'invite',
29548 id: 81
29549 }, {
29550 name: 'leave',
29551 id: 82
29552 }, {
29553 name: 'kick',
29554 id: 83
29555 }, {
29556 name: 'reject',
29557 id: 84
29558 }, {
29559 name: 'invited',
29560 id: 85
29561 }, {
29562 name: 'kicked',
29563 id: 86
29564 }, {
29565 name: 'upload',
29566 id: 100
29567 }, {
29568 name: 'uploaded',
29569 id: 101
29570 }, {
29571 name: 'subscribe',
29572 id: 120
29573 }, {
29574 name: 'subscribed',
29575 id: 121
29576 }, {
29577 name: 'unsubscribe',
29578 id: 122
29579 }, {
29580 name: 'unsubscribed',
29581 id: 123
29582 }, {
29583 name: 'is_subscribed',
29584 id: 124
29585 }, {
29586 name: 'modify',
29587 id: 150
29588 }, {
29589 name: 'modified',
29590 id: 151
29591 }, {
29592 name: 'block',
29593 id: 170
29594 }, {
29595 name: 'unblock',
29596 id: 171
29597 }, {
29598 name: 'blocked',
29599 id: 172
29600 }, {
29601 name: 'unblocked',
29602 id: 173
29603 }, {
29604 name: 'members_blocked',
29605 id: 174
29606 }, {
29607 name: 'members_unblocked',
29608 id: 175
29609 }, {
29610 name: 'check_block',
29611 id: 176
29612 }, {
29613 name: 'check_result',
29614 id: 177
29615 }, {
29616 name: 'add_shutup',
29617 id: 180
29618 }, {
29619 name: 'remove_shutup',
29620 id: 181
29621 }, {
29622 name: 'query_shutup',
29623 id: 182
29624 }, {
29625 name: 'shutup_added',
29626 id: 183
29627 }, {
29628 name: 'shutup_removed',
29629 id: 184
29630 }, {
29631 name: 'shutup_result',
29632 id: 185
29633 }, {
29634 name: 'shutuped',
29635 id: 186
29636 }, {
29637 name: 'unshutuped',
29638 id: 187
29639 }, {
29640 name: 'members_shutuped',
29641 id: 188
29642 }, {
29643 name: 'members_unshutuped',
29644 id: 189
29645 }, {
29646 name: 'check_shutup',
29647 id: 190
29648 }]
29649 }, {
29650 name: 'StatusType',
29651 syntax: 'proto2',
29652 values: [{
29653 name: 'on',
29654 id: 1
29655 }, {
29656 name: 'off',
29657 id: 2
29658 }]
29659 }],
29660 isNamespace: true
29661}).build();
29662var _messages$push_server = messageCompiled.push_server.messages2,
29663 JsonObjectMessage = _messages$push_server.JsonObjectMessage,
29664 UnreadTuple = _messages$push_server.UnreadTuple,
29665 LogItem = _messages$push_server.LogItem,
29666 DataCommand = _messages$push_server.DataCommand,
29667 SessionCommand = _messages$push_server.SessionCommand,
29668 ErrorCommand = _messages$push_server.ErrorCommand,
29669 DirectCommand = _messages$push_server.DirectCommand,
29670 AckCommand = _messages$push_server.AckCommand,
29671 UnreadCommand = _messages$push_server.UnreadCommand,
29672 ConvCommand = _messages$push_server.ConvCommand,
29673 RoomCommand = _messages$push_server.RoomCommand,
29674 LogsCommand = _messages$push_server.LogsCommand,
29675 RcpCommand = _messages$push_server.RcpCommand,
29676 ReadTuple = _messages$push_server.ReadTuple,
29677 MaxReadTuple = _messages$push_server.MaxReadTuple,
29678 ReadCommand = _messages$push_server.ReadCommand,
29679 PresenceCommand = _messages$push_server.PresenceCommand,
29680 ReportCommand = _messages$push_server.ReportCommand,
29681 GenericCommand = _messages$push_server.GenericCommand,
29682 BlacklistCommand = _messages$push_server.BlacklistCommand,
29683 PatchCommand = _messages$push_server.PatchCommand,
29684 PatchItem = _messages$push_server.PatchItem,
29685 ConvMemberInfo = _messages$push_server.ConvMemberInfo,
29686 CommandType = _messages$push_server.CommandType,
29687 OpType = _messages$push_server.OpType,
29688 StatusType = _messages$push_server.StatusType;
29689var message = /*#__PURE__*/(0, _freeze.default)({
29690 __proto__: null,
29691 JsonObjectMessage: JsonObjectMessage,
29692 UnreadTuple: UnreadTuple,
29693 LogItem: LogItem,
29694 DataCommand: DataCommand,
29695 SessionCommand: SessionCommand,
29696 ErrorCommand: ErrorCommand,
29697 DirectCommand: DirectCommand,
29698 AckCommand: AckCommand,
29699 UnreadCommand: UnreadCommand,
29700 ConvCommand: ConvCommand,
29701 RoomCommand: RoomCommand,
29702 LogsCommand: LogsCommand,
29703 RcpCommand: RcpCommand,
29704 ReadTuple: ReadTuple,
29705 MaxReadTuple: MaxReadTuple,
29706 ReadCommand: ReadCommand,
29707 PresenceCommand: PresenceCommand,
29708 ReportCommand: ReportCommand,
29709 GenericCommand: GenericCommand,
29710 BlacklistCommand: BlacklistCommand,
29711 PatchCommand: PatchCommand,
29712 PatchItem: PatchItem,
29713 ConvMemberInfo: ConvMemberInfo,
29714 CommandType: CommandType,
29715 OpType: OpType,
29716 StatusType: StatusType
29717});
29718var adapters = {};
29719
29720var getAdapter = function getAdapter(name) {
29721 var adapter = adapters[name];
29722
29723 if (adapter === undefined) {
29724 throw new Error("".concat(name, " adapter is not configured"));
29725 }
29726
29727 return adapter;
29728};
29729/**
29730 * 指定 Adapters
29731 * @function
29732 * @memberof module:leancloud-realtime
29733 * @param {Adapters} newAdapters Adapters 的类型请参考 {@link https://url.leanapp.cn/adapter-type-definitions @leancloud/adapter-types} 中的定义
29734 */
29735
29736
29737var setAdapters = function setAdapters(newAdapters) {
29738 (0, _assign.default)(adapters, newAdapters);
29739};
29740/* eslint-disable */
29741
29742
29743var global$1 = typeof global !== 'undefined' ? global : typeof window !== 'undefined' ? window : {};
29744var EXPIRED = (0, _symbol.default)('expired');
29745var debug = d('LC:Expirable');
29746
29747var Expirable = /*#__PURE__*/function () {
29748 function Expirable(value, ttl) {
29749 this.originalValue = value;
29750
29751 if (typeof ttl === 'number') {
29752 this.expiredAt = Date.now() + ttl;
29753 }
29754 }
29755
29756 _createClass(Expirable, [{
29757 key: "value",
29758 get: function get() {
29759 var expired = this.expiredAt && this.expiredAt <= Date.now();
29760 if (expired) debug("expired: ".concat(this.originalValue));
29761 return expired ? EXPIRED : this.originalValue;
29762 }
29763 }]);
29764
29765 return Expirable;
29766}();
29767
29768Expirable.EXPIRED = EXPIRED;
29769var debug$1 = d('LC:Cache');
29770
29771var Cache = /*#__PURE__*/function () {
29772 function Cache() {
29773 var name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'anonymous';
29774 this.name = name;
29775 this._map = {};
29776 }
29777
29778 var _proto = Cache.prototype;
29779
29780 _proto.get = function get(key) {
29781 var _context5;
29782
29783 var cache = this._map[key];
29784
29785 if (cache) {
29786 var value = cache.value;
29787
29788 if (value !== Expirable.EXPIRED) {
29789 debug$1('[%s] hit: %s', this.name, key);
29790 return value;
29791 }
29792
29793 delete this._map[key];
29794 }
29795
29796 debug$1((0, _concat.default)(_context5 = "[".concat(this.name, "] missed: ")).call(_context5, key));
29797 return null;
29798 };
29799
29800 _proto.set = function set(key, value, ttl) {
29801 debug$1('[%s] set: %s %d', this.name, key, ttl);
29802 this._map[key] = new Expirable(value, ttl);
29803 };
29804
29805 return Cache;
29806}();
29807
29808function ownKeys(object, enumerableOnly) {
29809 var keys = (0, _keys.default)(object);
29810
29811 if (_getOwnPropertySymbols.default) {
29812 var symbols = (0, _getOwnPropertySymbols.default)(object);
29813 enumerableOnly && (symbols = (0, _filter.default)(symbols).call(symbols, function (sym) {
29814 return (0, _getOwnPropertyDescriptor.default)(object, sym).enumerable;
29815 })), keys.push.apply(keys, symbols);
29816 }
29817
29818 return keys;
29819}
29820
29821function _objectSpread(target) {
29822 for (var i = 1; i < arguments.length; i++) {
29823 var source = null != arguments[i] ? arguments[i] : {};
29824 i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
29825 _defineProperty(target, key, source[key]);
29826 }) : _getOwnPropertyDescriptors.default ? (0, _defineProperties.default)(target, (0, _getOwnPropertyDescriptors.default)(source)) : ownKeys(Object(source)).forEach(function (key) {
29827 (0, _defineProperty2.default)(target, key, (0, _getOwnPropertyDescriptor.default)(source, key));
29828 });
29829 }
29830
29831 return target;
29832}
29833/**
29834 * 调试日志控制器
29835 * @const
29836 * @memberof module:leancloud-realtime
29837 * @example
29838 * debug.enable(); // 启用调试日志
29839 * debug.disable(); // 关闭调试日志
29840 */
29841
29842
29843var debug$2 = {
29844 enable: function enable() {
29845 var namespaces = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'LC*';
29846 return d.enable(namespaces);
29847 },
29848 disable: d.disable
29849};
29850
29851var tryAll = function tryAll(promiseConstructors) {
29852 var promise = new _promise.default(promiseConstructors[0]);
29853
29854 if (promiseConstructors.length === 1) {
29855 return promise;
29856 }
29857
29858 return promise["catch"](function () {
29859 return tryAll((0, _slice.default)(promiseConstructors).call(promiseConstructors, 1));
29860 });
29861}; // eslint-disable-next-line no-sequences
29862
29863
29864var tap = function tap(interceptor) {
29865 return function (value) {
29866 return interceptor(value), value;
29867 };
29868};
29869
29870var isIE10 = global$1.navigator && global$1.navigator.userAgent && (0, _indexOf.default)(_context6 = global$1.navigator.userAgent).call(_context6, 'MSIE 10.') !== -1;
29871var map = new _weakMap.default(); // protected property helper
29872
29873var internal = function internal(object) {
29874 if (!map.has(object)) {
29875 map.set(object, {});
29876 }
29877
29878 return map.get(object);
29879};
29880
29881var compact = function compact(obj, filter) {
29882 if (!isPlainObject(obj)) return obj;
29883
29884 var object = _objectSpread({}, obj);
29885
29886 (0, _keys.default)(object).forEach(function (prop) {
29887 var value = object[prop];
29888
29889 if (value === filter) {
29890 delete object[prop];
29891 } else {
29892 object[prop] = compact(value, filter);
29893 }
29894 });
29895 return object;
29896}; // debug utility
29897
29898
29899var removeNull = function removeNull(obj) {
29900 return compact(obj, null);
29901};
29902
29903var trim = function trim(message) {
29904 return removeNull(JSON.parse((0, _stringify.default)(message)));
29905};
29906
29907var ensureArray = function ensureArray(target) {
29908 if (Array.isArray(target)) {
29909 return target;
29910 }
29911
29912 if (target === undefined || target === null) {
29913 return [];
29914 }
29915
29916 return [target];
29917};
29918
29919var isWeapp = // eslint-disable-next-line no-undef
29920(typeof wx === "undefined" ? "undefined" : _typeof(wx)) === 'object' && typeof wx.connectSocket === 'function';
29921
29922var isCNApp = function isCNApp(appId) {
29923 return (0, _slice.default)(appId).call(appId, -9) !== '-MdYXbMMI';
29924};
29925
29926var equalBuffer = function equalBuffer(buffer1, buffer2) {
29927 if (!buffer1 || !buffer2) return false;
29928 if (buffer1.byteLength !== buffer2.byteLength) return false;
29929 var a = new Uint8Array(buffer1);
29930 var b = new Uint8Array(buffer2);
29931 return !a.some(function (value, index) {
29932 return value !== b[index];
29933 });
29934};
29935
29936var _class;
29937
29938function ownKeys$1(object, enumerableOnly) {
29939 var keys = (0, _keys.default)(object);
29940
29941 if (_getOwnPropertySymbols.default) {
29942 var symbols = (0, _getOwnPropertySymbols.default)(object);
29943 enumerableOnly && (symbols = (0, _filter.default)(symbols).call(symbols, function (sym) {
29944 return (0, _getOwnPropertyDescriptor.default)(object, sym).enumerable;
29945 })), keys.push.apply(keys, symbols);
29946 }
29947
29948 return keys;
29949}
29950
29951function _objectSpread$1(target) {
29952 for (var i = 1; i < arguments.length; i++) {
29953 var source = null != arguments[i] ? arguments[i] : {};
29954 i % 2 ? ownKeys$1(Object(source), !0).forEach(function (key) {
29955 _defineProperty(target, key, source[key]);
29956 }) : _getOwnPropertyDescriptors.default ? (0, _defineProperties.default)(target, (0, _getOwnPropertyDescriptors.default)(source)) : ownKeys$1(Object(source)).forEach(function (key) {
29957 (0, _defineProperty2.default)(target, key, (0, _getOwnPropertyDescriptor.default)(source, key));
29958 });
29959 }
29960
29961 return target;
29962}
29963
29964var debug$3 = d('LC:WebSocketPlus');
29965var OPEN = 'open';
29966var DISCONNECT = 'disconnect';
29967var RECONNECT = 'reconnect';
29968var RETRY = 'retry';
29969var SCHEDULE = 'schedule';
29970var OFFLINE = 'offline';
29971var ONLINE = 'online';
29972var ERROR = 'error';
29973var MESSAGE = 'message';
29974var HEARTBEAT_TIME = 180000;
29975var TIMEOUT_TIME = 380000;
29976
29977var DEFAULT_RETRY_STRATEGY = function DEFAULT_RETRY_STRATEGY(attempt) {
29978 return Math.min(1000 * Math.pow(2, attempt), 300000);
29979};
29980
29981var requireConnected = function requireConnected(target, name, descriptor) {
29982 return _objectSpread$1(_objectSpread$1({}, descriptor), {}, {
29983 value: function requireConnectedWrapper() {
29984 var _context7;
29985
29986 var _descriptor$value;
29987
29988 this.checkConnectionAvailability(name);
29989
29990 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
29991 args[_key] = arguments[_key];
29992 }
29993
29994 return (_descriptor$value = descriptor.value).call.apply(_descriptor$value, (0, _concat.default)(_context7 = [this]).call(_context7, args));
29995 }
29996 });
29997};
29998
29999var WebSocketPlus = (_class = /*#__PURE__*/function (_EventEmitter) {
30000 _inheritsLoose(WebSocketPlus, _EventEmitter);
30001
30002 function WebSocketPlus(getUrls, protocol) {
30003 var _this;
30004
30005 _this = _EventEmitter.call(this) || this;
30006
30007 _this.init();
30008
30009 _this._protocol = protocol;
30010
30011 _promise.default.resolve(typeof getUrls === 'function' ? getUrls() : getUrls).then(ensureArray).then(function (urls) {
30012 _this._urls = urls;
30013 return _this._open();
30014 }).then(function () {
30015 _this.__postponeTimeoutTimer = _this._postponeTimeoutTimer.bind(_assertThisInitialized(_this));
30016
30017 if (global$1.addEventListener) {
30018 _this.__pause = function () {
30019 if (_this.can('pause')) _this.pause();
30020 };
30021
30022 _this.__resume = function () {
30023 if (_this.can('resume')) _this.resume();
30024 };
30025
30026 global$1.addEventListener('offline', _this.__pause);
30027 global$1.addEventListener('online', _this.__resume);
30028 }
30029
30030 _this.open();
30031 })["catch"](_this["throw"].bind(_assertThisInitialized(_this)));
30032
30033 return _this;
30034 }
30035
30036 var _proto = WebSocketPlus.prototype;
30037
30038 _proto._open = function _open() {
30039 var _this2 = this;
30040
30041 return this._createWs(this._urls, this._protocol).then(function (ws) {
30042 var _context8;
30043
30044 var _this2$_urls = _toArray(_this2._urls),
30045 first = _this2$_urls[0],
30046 reset = (0, _slice.default)(_this2$_urls).call(_this2$_urls, 1);
30047
30048 _this2._urls = (0, _concat.default)(_context8 = []).call(_context8, _toConsumableArray(reset), [first]);
30049 return ws;
30050 });
30051 };
30052
30053 _proto._createWs = function _createWs(urls, protocol) {
30054 var _this3 = this;
30055
30056 return tryAll((0, _map.default)(urls).call(urls, function (url) {
30057 return function (resolve, reject) {
30058 var _context9;
30059
30060 debug$3((0, _concat.default)(_context9 = "connect [".concat(url, "] ")).call(_context9, protocol));
30061 var WebSocket = getAdapter('WebSocket');
30062 var ws = protocol ? new WebSocket(url, protocol) : new WebSocket(url);
30063 ws.binaryType = _this3.binaryType || 'arraybuffer';
30064
30065 ws.onopen = function () {
30066 return resolve(ws);
30067 };
30068
30069 ws.onclose = function (error) {
30070 if (error instanceof Error) {
30071 return reject(error);
30072 } // in browser, error event is useless
30073
30074
30075 return reject(new Error("Failed to connect [".concat(url, "]")));
30076 };
30077
30078 ws.onerror = ws.onclose;
30079 };
30080 })).then(function (ws) {
30081 _this3._ws = ws;
30082 _this3._ws.onclose = _this3._handleClose.bind(_this3);
30083 _this3._ws.onmessage = _this3._handleMessage.bind(_this3);
30084 return ws;
30085 });
30086 };
30087
30088 _proto._destroyWs = function _destroyWs() {
30089 var ws = this._ws;
30090 if (!ws) return;
30091 ws.onopen = null;
30092 ws.onclose = null;
30093 ws.onerror = null;
30094 ws.onmessage = null;
30095 this._ws = null;
30096 ws.close();
30097 } // eslint-disable-next-line class-methods-use-this
30098 ;
30099
30100 _proto.onbeforeevent = function onbeforeevent(event, from, to) {
30101 var _context10, _context11;
30102
30103 for (var _len2 = arguments.length, payload = new Array(_len2 > 3 ? _len2 - 3 : 0), _key2 = 3; _key2 < _len2; _key2++) {
30104 payload[_key2 - 3] = arguments[_key2];
30105 }
30106
30107 debug$3((0, _concat.default)(_context10 = (0, _concat.default)(_context11 = "".concat(event, ": ")).call(_context11, from, " -> ")).call(_context10, to, " %o"), payload);
30108 };
30109
30110 _proto.onopen = function onopen() {
30111 this.emit(OPEN);
30112 };
30113
30114 _proto.onconnected = function onconnected() {
30115 this._startConnectionKeeper();
30116 };
30117
30118 _proto.onleaveconnected = function onleaveconnected(event, from, to) {
30119 this._stopConnectionKeeper();
30120
30121 this._destroyWs();
30122
30123 if (to === 'offline' || to === 'disconnected') {
30124 this.emit(DISCONNECT);
30125 }
30126 };
30127
30128 _proto.onpause = function onpause() {
30129 this.emit(OFFLINE);
30130 };
30131
30132 _proto.onbeforeresume = function onbeforeresume() {
30133 this.emit(ONLINE);
30134 };
30135
30136 _proto.onreconnect = function onreconnect() {
30137 this.emit(RECONNECT);
30138 };
30139
30140 _proto.ondisconnected = function ondisconnected(event, from, to) {
30141 var _context12;
30142
30143 var _this4 = this;
30144
30145 var attempt = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
30146 var delay = from === OFFLINE ? 0 : DEFAULT_RETRY_STRATEGY.call(null, attempt);
30147 debug$3((0, _concat.default)(_context12 = "schedule attempt=".concat(attempt, " delay=")).call(_context12, delay));
30148 this.emit(SCHEDULE, attempt, delay);
30149
30150 if (this.__scheduledRetry) {
30151 clearTimeout(this.__scheduledRetry);
30152 }
30153
30154 this.__scheduledRetry = setTimeout(function () {
30155 if (_this4.is('disconnected')) {
30156 _this4.retry(attempt);
30157 }
30158 }, delay);
30159 };
30160
30161 _proto.onretry = function onretry(event, from, to) {
30162 var _this5 = this;
30163
30164 var attempt = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
30165 this.emit(RETRY, attempt);
30166
30167 this._open().then(function () {
30168 return _this5.can('reconnect') && _this5.reconnect();
30169 }, function () {
30170 return _this5.can('fail') && _this5.fail(attempt + 1);
30171 });
30172 };
30173
30174 _proto.onerror = function onerror(event, from, to, error) {
30175 this.emit(ERROR, error);
30176 };
30177
30178 _proto.onclose = function onclose() {
30179 if (global$1.removeEventListener) {
30180 if (this.__pause) global$1.removeEventListener('offline', this.__pause);
30181 if (this.__resume) global$1.removeEventListener('online', this.__resume);
30182 }
30183 };
30184
30185 _proto.checkConnectionAvailability = function checkConnectionAvailability() {
30186 var name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'API';
30187
30188 if (!this.is('connected')) {
30189 var _context13;
30190
30191 var currentState = this.current;
30192 console.warn((0, _concat.default)(_context13 = "".concat(name, " should not be called when the connection is ")).call(_context13, currentState));
30193
30194 if (this.is('disconnected') || this.is('reconnecting')) {
30195 console.warn('disconnect and reconnect event should be handled to avoid such calls.');
30196 }
30197
30198 throw new Error('Connection unavailable');
30199 }
30200 } // jsdoc-ignore-start
30201 ;
30202
30203 _proto. // jsdoc-ignore-end
30204 _ping = function _ping() {
30205 debug$3('ping');
30206
30207 try {
30208 this.ping();
30209 } catch (error) {
30210 console.warn("websocket ping error: ".concat(error.message));
30211 }
30212 };
30213
30214 _proto.ping = function ping() {
30215 if (this._ws.ping) {
30216 this._ws.ping();
30217 } else {
30218 console.warn("The WebSocket implement does not support sending ping frame.\n Override ping method to use application defined ping/pong mechanism.");
30219 }
30220 };
30221
30222 _proto._postponeTimeoutTimer = function _postponeTimeoutTimer() {
30223 var _this6 = this;
30224
30225 debug$3('_postponeTimeoutTimer');
30226
30227 this._clearTimeoutTimers();
30228
30229 this._timeoutTimer = setTimeout(function () {
30230 debug$3('timeout');
30231
30232 _this6.disconnect();
30233 }, TIMEOUT_TIME);
30234 };
30235
30236 _proto._clearTimeoutTimers = function _clearTimeoutTimers() {
30237 if (this._timeoutTimer) {
30238 clearTimeout(this._timeoutTimer);
30239 }
30240 };
30241
30242 _proto._startConnectionKeeper = function _startConnectionKeeper() {
30243 debug$3('start connection keeper');
30244 this._heartbeatTimer = setInterval(this._ping.bind(this), HEARTBEAT_TIME);
30245 var addListener = this._ws.addListener || this._ws.addEventListener;
30246
30247 if (!addListener) {
30248 debug$3('connection keeper disabled due to the lack of #addEventListener.');
30249 return;
30250 }
30251
30252 addListener.call(this._ws, 'message', this.__postponeTimeoutTimer);
30253 addListener.call(this._ws, 'pong', this.__postponeTimeoutTimer);
30254
30255 this._postponeTimeoutTimer();
30256 };
30257
30258 _proto._stopConnectionKeeper = function _stopConnectionKeeper() {
30259 debug$3('stop connection keeper'); // websockets/ws#489
30260
30261 var removeListener = this._ws.removeListener || this._ws.removeEventListener;
30262
30263 if (removeListener) {
30264 removeListener.call(this._ws, 'message', this.__postponeTimeoutTimer);
30265 removeListener.call(this._ws, 'pong', this.__postponeTimeoutTimer);
30266
30267 this._clearTimeoutTimers();
30268 }
30269
30270 if (this._heartbeatTimer) {
30271 clearInterval(this._heartbeatTimer);
30272 }
30273 };
30274
30275 _proto._handleClose = function _handleClose(event) {
30276 var _context14;
30277
30278 debug$3((0, _concat.default)(_context14 = "ws closed [".concat(event.code, "] ")).call(_context14, event.reason)); // socket closed manually, ignore close event.
30279
30280 if (this.isFinished()) return;
30281 this.handleClose(event);
30282 };
30283
30284 _proto.handleClose = function handleClose() {
30285 // reconnect
30286 this.disconnect();
30287 } // jsdoc-ignore-start
30288 ;
30289
30290 _proto. // jsdoc-ignore-end
30291 send = function send(data) {
30292 debug$3('send', data);
30293
30294 this._ws.send(data);
30295 };
30296
30297 _proto._handleMessage = function _handleMessage(event) {
30298 debug$3('message', event.data);
30299 this.handleMessage(event.data);
30300 };
30301
30302 _proto.handleMessage = function handleMessage(message) {
30303 this.emit(MESSAGE, message);
30304 };
30305
30306 _createClass(WebSocketPlus, [{
30307 key: "urls",
30308 get: function get() {
30309 return this._urls;
30310 },
30311 set: function set(urls) {
30312 this._urls = ensureArray(urls);
30313 }
30314 }]);
30315
30316 return WebSocketPlus;
30317}(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);
30318StateMachine.create({
30319 target: WebSocketPlus.prototype,
30320 initial: {
30321 state: 'initialized',
30322 event: 'init',
30323 defer: true
30324 },
30325 terminal: 'closed',
30326 events: [{
30327 name: 'open',
30328 from: 'initialized',
30329 to: 'connected'
30330 }, {
30331 name: 'disconnect',
30332 from: 'connected',
30333 to: 'disconnected'
30334 }, {
30335 name: 'retry',
30336 from: 'disconnected',
30337 to: 'reconnecting'
30338 }, {
30339 name: 'fail',
30340 from: 'reconnecting',
30341 to: 'disconnected'
30342 }, {
30343 name: 'reconnect',
30344 from: 'reconnecting',
30345 to: 'connected'
30346 }, {
30347 name: 'pause',
30348 from: ['connected', 'disconnected', 'reconnecting'],
30349 to: 'offline'
30350 }, {}, {
30351 name: 'resume',
30352 from: 'offline',
30353 to: 'disconnected'
30354 }, {
30355 name: 'close',
30356 from: ['connected', 'disconnected', 'reconnecting', 'offline'],
30357 to: 'closed'
30358 }, {
30359 name: 'throw',
30360 from: '*',
30361 to: 'error'
30362 }]
30363});
30364var error = (0, _freeze.default)({
30365 1000: {
30366 name: 'CLOSE_NORMAL'
30367 },
30368 1006: {
30369 name: 'CLOSE_ABNORMAL'
30370 },
30371 4100: {
30372 name: 'APP_NOT_AVAILABLE',
30373 message: 'App not exists or realtime message service is disabled.'
30374 },
30375 4102: {
30376 name: 'SIGNATURE_FAILED',
30377 message: 'Login signature mismatch.'
30378 },
30379 4103: {
30380 name: 'INVALID_LOGIN',
30381 message: 'Malformed clientId.'
30382 },
30383 4105: {
30384 name: 'SESSION_REQUIRED',
30385 message: 'Message sent before session opened.'
30386 },
30387 4107: {
30388 name: 'READ_TIMEOUT'
30389 },
30390 4108: {
30391 name: 'LOGIN_TIMEOUT'
30392 },
30393 4109: {
30394 name: 'FRAME_TOO_LONG'
30395 },
30396 4110: {
30397 name: 'INVALID_ORIGIN',
30398 message: 'Access denied by domain whitelist.'
30399 },
30400 4111: {
30401 name: 'SESSION_CONFLICT'
30402 },
30403 4112: {
30404 name: 'SESSION_TOKEN_EXPIRED'
30405 },
30406 4113: {
30407 name: 'APP_QUOTA_EXCEEDED',
30408 message: 'The daily active users limit exceeded.'
30409 },
30410 4116: {
30411 name: 'MESSAGE_SENT_QUOTA_EXCEEDED',
30412 message: 'Command sent too fast.'
30413 },
30414 4200: {
30415 name: 'INTERNAL_ERROR',
30416 message: 'Internal error, please contact LeanCloud for support.'
30417 },
30418 4301: {
30419 name: 'CONVERSATION_API_FAILED',
30420 message: 'Upstream Conversatoin API failed, see error.detail for details.'
30421 },
30422 4302: {
30423 name: 'CONVERSATION_SIGNATURE_FAILED',
30424 message: 'Conversation action signature mismatch.'
30425 },
30426 4303: {
30427 name: 'CONVERSATION_NOT_FOUND'
30428 },
30429 4304: {
30430 name: 'CONVERSATION_FULL'
30431 },
30432 4305: {
30433 name: 'CONVERSATION_REJECTED_BY_APP',
30434 message: 'Conversation action rejected by hook.'
30435 },
30436 4306: {
30437 name: 'CONVERSATION_UPDATE_FAILED'
30438 },
30439 4307: {
30440 name: 'CONVERSATION_READ_ONLY'
30441 },
30442 4308: {
30443 name: 'CONVERSATION_NOT_ALLOWED'
30444 },
30445 4309: {
30446 name: 'CONVERSATION_UPDATE_REJECTED',
30447 message: 'Conversation update rejected because the client is not a member.'
30448 },
30449 4310: {
30450 name: 'CONVERSATION_QUERY_FAILED',
30451 message: 'Conversation query failed because it is too expansive.'
30452 },
30453 4311: {
30454 name: 'CONVERSATION_LOG_FAILED'
30455 },
30456 4312: {
30457 name: 'CONVERSATION_LOG_REJECTED',
30458 message: 'Message query rejected because the client is not a member of the conversation.'
30459 },
30460 4313: {
30461 name: 'SYSTEM_CONVERSATION_REQUIRED'
30462 },
30463 4314: {
30464 name: 'NORMAL_CONVERSATION_REQUIRED'
30465 },
30466 4315: {
30467 name: 'CONVERSATION_BLACKLISTED',
30468 message: 'Blacklisted in the conversation.'
30469 },
30470 4316: {
30471 name: 'TRANSIENT_CONVERSATION_REQUIRED'
30472 },
30473 4317: {
30474 name: 'CONVERSATION_MEMBERSHIP_REQUIRED'
30475 },
30476 4318: {
30477 name: 'CONVERSATION_API_QUOTA_EXCEEDED',
30478 message: 'LeanCloud API quota exceeded. You may upgrade your plan.'
30479 },
30480 4323: {
30481 name: 'TEMPORARY_CONVERSATION_EXPIRED',
30482 message: 'Temporary conversation expired or does not exist.'
30483 },
30484 4401: {
30485 name: 'INVALID_MESSAGING_TARGET',
30486 message: 'Conversation does not exist or client is not a member.'
30487 },
30488 4402: {
30489 name: 'MESSAGE_REJECTED_BY_APP',
30490 message: 'Message rejected by hook.'
30491 },
30492 4403: {
30493 name: 'MESSAGE_OWNERSHIP_REQUIRED'
30494 },
30495 4404: {
30496 name: 'MESSAGE_NOT_FOUND'
30497 },
30498 4405: {
30499 name: 'MESSAGE_UPDATE_REJECTED_BY_APP',
30500 message: 'Message update rejected by hook.'
30501 },
30502 4406: {
30503 name: 'MESSAGE_EDIT_DISABLED'
30504 },
30505 4407: {
30506 name: 'MESSAGE_RECALL_DISABLED'
30507 },
30508 5130: {
30509 name: 'OWNER_PROMOTION_NOT_ALLOWED',
30510 message: "Updating a member's role to owner is not allowed."
30511 }
30512});
30513var ErrorCode = (0, _freeze.default)((0, _reduce.default)(_context15 = (0, _keys.default)(error)).call(_context15, function (result, code) {
30514 return (0, _assign.default)(result, _defineProperty({}, error[code].name, Number(code)));
30515}, {}));
30516
30517var createError = function createError(_ref) {
30518 var code = _ref.code,
30519 reason = _ref.reason,
30520 appCode = _ref.appCode,
30521 detail = _ref.detail,
30522 errorMessage = _ref.error;
30523 var message = reason || detail || errorMessage;
30524 var name = reason;
30525
30526 if (!message && error[code]) {
30527 name = error[code].name;
30528 message = error[code].message || name;
30529 }
30530
30531 if (!message) {
30532 message = "Unknow Error: ".concat(code);
30533 }
30534
30535 var err = new Error(message);
30536 return (0, _assign.default)(err, {
30537 code: code,
30538 appCode: appCode,
30539 detail: detail,
30540 name: name
30541 });
30542};
30543
30544var debug$4 = d('LC:Connection');
30545var COMMAND_TIMEOUT = 20000;
30546var EXPIRE = (0, _symbol.default)('expire');
30547
30548var isIdempotentCommand = function isIdempotentCommand(command) {
30549 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));
30550};
30551
30552var Connection = /*#__PURE__*/function (_WebSocketPlus) {
30553 _inheritsLoose(Connection, _WebSocketPlus);
30554
30555 function Connection(getUrl, _ref) {
30556 var _context16;
30557
30558 var _this;
30559
30560 var format = _ref.format,
30561 version = _ref.version;
30562 debug$4('initializing Connection');
30563 var protocolString = (0, _concat.default)(_context16 = "lc.".concat(format, ".")).call(_context16, version);
30564 _this = _WebSocketPlus.call(this, getUrl, protocolString) || this;
30565 _this._protocolFormat = format;
30566 _this._commands = {};
30567 _this._serialId = 0;
30568 return _this;
30569 }
30570
30571 var _proto = Connection.prototype;
30572
30573 _proto.send = /*#__PURE__*/function () {
30574 var _send = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(command) {
30575 var _this2 = this;
30576
30577 var waitingForRespond,
30578 buffer,
30579 serialId,
30580 duplicatedCommand,
30581 message,
30582 promise,
30583 _args = arguments;
30584 return _regeneratorRuntime.wrap(function _callee$(_context) {
30585 var _context17, _context18;
30586
30587 while (1) {
30588 switch (_context.prev = _context.next) {
30589 case 0:
30590 waitingForRespond = _args.length > 1 && _args[1] !== undefined ? _args[1] : true;
30591
30592 if (!waitingForRespond) {
30593 _context.next = 11;
30594 break;
30595 }
30596
30597 if (!isIdempotentCommand(command)) {
30598 _context.next = 8;
30599 break;
30600 }
30601
30602 buffer = command.toArrayBuffer();
30603 duplicatedCommand = (0, _find.default)(_context17 = values(this._commands)).call(_context17, function (_ref2) {
30604 var targetBuffer = _ref2.buffer,
30605 targetCommand = _ref2.command;
30606 return targetCommand.cmd === command.cmd && targetCommand.op === command.op && equalBuffer(targetBuffer, buffer);
30607 });
30608
30609 if (!duplicatedCommand) {
30610 _context.next = 8;
30611 break;
30612 }
30613
30614 console.warn((0, _concat.default)(_context18 = "Duplicated command [cmd:".concat(command.cmd, " op:")).call(_context18, command.op, "] is throttled."));
30615 return _context.abrupt("return", duplicatedCommand.promise);
30616
30617 case 8:
30618 this._serialId += 1;
30619 serialId = this._serialId;
30620 command.i = serialId;
30621 // eslint-disable-line no-param-reassign
30622
30623 case 11:
30624 if (debug$4.enabled) debug$4('↑ %O sent', trim(command));
30625
30626 if (this._protocolFormat === 'proto2base64') {
30627 message = command.toBase64();
30628 } else if (command.toArrayBuffer) {
30629 message = command.toArrayBuffer();
30630 }
30631
30632 if (message) {
30633 _context.next = 15;
30634 break;
30635 }
30636
30637 throw new TypeError("".concat(command, " is not a GenericCommand"));
30638
30639 case 15:
30640 _WebSocketPlus.prototype.send.call(this, message);
30641
30642 if (waitingForRespond) {
30643 _context.next = 18;
30644 break;
30645 }
30646
30647 return _context.abrupt("return", undefined);
30648
30649 case 18:
30650 promise = new _promise.default(function (resolve, reject) {
30651 _this2._commands[serialId] = {
30652 command: command,
30653 buffer: buffer,
30654 resolve: resolve,
30655 reject: reject,
30656 timeout: setTimeout(function () {
30657 if (_this2._commands[serialId]) {
30658 var _context19;
30659
30660 if (debug$4.enabled) debug$4('✗ %O timeout', trim(command));
30661 reject(createError({
30662 error: (0, _concat.default)(_context19 = "Command Timeout [cmd:".concat(command.cmd, " op:")).call(_context19, command.op, "]"),
30663 name: 'COMMAND_TIMEOUT'
30664 }));
30665 delete _this2._commands[serialId];
30666 }
30667 }, COMMAND_TIMEOUT)
30668 };
30669 });
30670 this._commands[serialId].promise = promise;
30671 return _context.abrupt("return", promise);
30672
30673 case 21:
30674 case "end":
30675 return _context.stop();
30676 }
30677 }
30678 }, _callee, this);
30679 }));
30680
30681 function send(_x) {
30682 return _send.apply(this, arguments);
30683 }
30684
30685 return send;
30686 }();
30687
30688 _proto.handleMessage = function handleMessage(msg) {
30689 var message;
30690
30691 try {
30692 message = GenericCommand.decode(msg);
30693 if (debug$4.enabled) debug$4('↓ %O received', trim(message));
30694 } catch (e) {
30695 console.warn('Decode message failed:', e.message, msg);
30696 return;
30697 }
30698
30699 var serialId = message.i;
30700
30701 if (serialId) {
30702 if (this._commands[serialId]) {
30703 clearTimeout(this._commands[serialId].timeout);
30704
30705 if (message.cmd === CommandType.error) {
30706 this._commands[serialId].reject(createError(message.errorMessage));
30707 } else {
30708 this._commands[serialId].resolve(message);
30709 }
30710
30711 delete this._commands[serialId];
30712 } else {
30713 console.warn("Unexpected command received with serialId [".concat(serialId, "],\n which have timed out or never been requested."));
30714 }
30715 } else {
30716 switch (message.cmd) {
30717 case CommandType.error:
30718 {
30719 this.emit(ERROR, createError(message.errorMessage));
30720 return;
30721 }
30722
30723 case CommandType.goaway:
30724 {
30725 this.emit(EXPIRE);
30726 return;
30727 }
30728
30729 default:
30730 {
30731 this.emit(MESSAGE, message);
30732 }
30733 }
30734 }
30735 };
30736
30737 _proto.ping = function ping() {
30738 return this.send(new GenericCommand({
30739 cmd: CommandType.echo
30740 }))["catch"](function (error) {
30741 return debug$4('ping failed:', error);
30742 });
30743 };
30744
30745 return Connection;
30746}(WebSocketPlus);
30747
30748var debug$5 = d('LC:request');
30749
30750var request = function request(_ref) {
30751 var _ref$method = _ref.method,
30752 method = _ref$method === void 0 ? 'GET' : _ref$method,
30753 _url = _ref.url,
30754 query = _ref.query,
30755 headers = _ref.headers,
30756 data = _ref.data,
30757 time = _ref.timeout;
30758 var url = _url;
30759
30760 if (query) {
30761 var _context20, _context21, _context23;
30762
30763 var queryString = (0, _filter.default)(_context20 = (0, _map.default)(_context21 = (0, _keys.default)(query)).call(_context21, function (key) {
30764 var _context22;
30765
30766 var value = query[key];
30767 if (value === undefined) return undefined;
30768 var v = isPlainObject(value) ? (0, _stringify.default)(value) : value;
30769 return (0, _concat.default)(_context22 = "".concat(encodeURIComponent(key), "=")).call(_context22, encodeURIComponent(v));
30770 })).call(_context20, function (qs) {
30771 return qs;
30772 }).join('&');
30773 url = (0, _concat.default)(_context23 = "".concat(url, "?")).call(_context23, queryString);
30774 }
30775
30776 debug$5('Req: %O %O %O', method, url, {
30777 headers: headers,
30778 data: data
30779 });
30780 var request = getAdapter('request');
30781 var promise = request(url, {
30782 method: method,
30783 headers: headers,
30784 data: data
30785 }).then(function (response) {
30786 if (response.ok === false) {
30787 var error = createError(response.data);
30788 error.response = response;
30789 throw error;
30790 }
30791
30792 debug$5('Res: %O %O %O', url, response.status, response.data);
30793 return response.data;
30794 })["catch"](function (error) {
30795 if (error.response) {
30796 debug$5('Error: %O %O %O', url, error.response.status, error.response.data);
30797 }
30798
30799 throw error;
30800 });
30801 return time ? promiseTimeout.timeout(promise, time) : promise;
30802};
30803
30804var applyDecorators = function applyDecorators(decorators, target) {
30805 if (decorators) {
30806 decorators.forEach(function (decorator) {
30807 try {
30808 decorator(target);
30809 } catch (error) {
30810 if (decorator._pluginName) {
30811 error.message += "[".concat(decorator._pluginName, "]");
30812 }
30813
30814 throw error;
30815 }
30816 });
30817 }
30818};
30819
30820var applyDispatcher = function applyDispatcher(dispatchers, payload) {
30821 var _context24;
30822
30823 return (0, _reduce.default)(_context24 = ensureArray(dispatchers)).call(_context24, function (resultPromise, dispatcher) {
30824 return resultPromise.then(function (shouldDispatch) {
30825 return shouldDispatch === false ? false : dispatcher.apply(void 0, _toConsumableArray(payload));
30826 })["catch"](function (error) {
30827 if (dispatcher._pluginName) {
30828 // eslint-disable-next-line no-param-reassign
30829 error.message += "[".concat(dispatcher._pluginName, "]");
30830 }
30831
30832 throw error;
30833 });
30834 }, _promise.default.resolve(true));
30835};
30836
30837var version = "5.0.0-rc.8";
30838var _excluded = ["plugins"];
30839
30840function ownKeys$2(object, enumerableOnly) {
30841 var keys = (0, _keys.default)(object);
30842
30843 if (_getOwnPropertySymbols.default) {
30844 var symbols = (0, _getOwnPropertySymbols.default)(object);
30845 enumerableOnly && (symbols = (0, _filter.default)(symbols).call(symbols, function (sym) {
30846 return (0, _getOwnPropertyDescriptor.default)(object, sym).enumerable;
30847 })), keys.push.apply(keys, symbols);
30848 }
30849
30850 return keys;
30851}
30852
30853function _objectSpread$2(target) {
30854 for (var i = 1; i < arguments.length; i++) {
30855 var source = null != arguments[i] ? arguments[i] : {};
30856 i % 2 ? ownKeys$2(Object(source), !0).forEach(function (key) {
30857 _defineProperty(target, key, source[key]);
30858 }) : _getOwnPropertyDescriptors.default ? (0, _defineProperties.default)(target, (0, _getOwnPropertyDescriptors.default)(source)) : ownKeys$2(Object(source)).forEach(function (key) {
30859 (0, _defineProperty2.default)(target, key, (0, _getOwnPropertyDescriptor.default)(source, key));
30860 });
30861 }
30862
30863 return target;
30864}
30865
30866var debug$6 = d('LC:Realtime');
30867var routerCache = new Cache('push-router');
30868var initializedApp = {};
30869
30870var Realtime = /*#__PURE__*/function (_EventEmitter) {
30871 _inheritsLoose(Realtime, _EventEmitter);
30872 /**
30873 * @extends EventEmitter
30874 * @param {Object} options
30875 * @param {String} options.appId
30876 * @param {String} options.appKey (since 4.0.0)
30877 * @param {String|Object} [options.server] 指定服务器域名,中国节点应用此参数必填(since 4.0.0)
30878 * @param {Boolean} [options.noBinary=false] 设置 WebSocket 使用字符串格式收发消息(默认为二进制格式)。
30879 * 适用于 WebSocket 实现不支持二进制数据格式的情况
30880 * @param {Boolean} [options.ssl=true] 使用 wss 进行连接
30881 * @param {String|String[]} [options.RTMServers] 指定私有部署的 RTM 服务器地址(since 4.0.0)
30882 * @param {Plugin[]} [options.plugins] 加载插件(since 3.1.0)
30883 */
30884
30885
30886 function Realtime(_ref) {
30887 var _context25;
30888
30889 var _this2;
30890
30891 var plugins = _ref.plugins,
30892 options = _objectWithoutProperties(_ref, _excluded);
30893
30894 debug$6('initializing Realtime %s %O', version, options);
30895 _this2 = _EventEmitter.call(this) || this;
30896 var appId = options.appId;
30897
30898 if (typeof appId !== 'string') {
30899 throw new TypeError("appId [".concat(appId, "] is not a string"));
30900 }
30901
30902 if (initializedApp[appId]) {
30903 throw new Error("App [".concat(appId, "] is already initialized."));
30904 }
30905
30906 initializedApp[appId] = true;
30907
30908 if (typeof options.appKey !== 'string') {
30909 throw new TypeError("appKey [".concat(options.appKey, "] is not a string"));
30910 }
30911
30912 if (isCNApp(appId)) {
30913 if (!options.server) {
30914 throw new TypeError("server option is required for apps from CN region");
30915 }
30916 }
30917
30918 _this2._options = _objectSpread$2({
30919 appId: undefined,
30920 appKey: undefined,
30921 noBinary: false,
30922 ssl: true,
30923 RTMServerName: typeof process !== 'undefined' ? process.env.RTM_SERVER_NAME : undefined
30924 }, options);
30925 _this2._cache = new Cache('endpoints');
30926
30927 var _this = internal(_assertThisInitialized(_this2));
30928
30929 _this.clients = new _set.default();
30930 _this.pendingClients = new _set.default();
30931 var mergedPlugins = (0, _concat.default)(_context25 = []).call(_context25, _toConsumableArray(ensureArray(Realtime.__preRegisteredPlugins)), _toConsumableArray(ensureArray(plugins)));
30932 debug$6('Using plugins %o', (0, _map.default)(mergedPlugins).call(mergedPlugins, function (plugin) {
30933 return plugin.name;
30934 }));
30935 _this2._plugins = (0, _reduce.default)(mergedPlugins).call(mergedPlugins, function (result, plugin) {
30936 (0, _keys.default)(plugin).forEach(function (hook) {
30937 if ({}.hasOwnProperty.call(plugin, hook) && hook !== 'name') {
30938 var _context26;
30939
30940 if (plugin.name) {
30941 ensureArray(plugin[hook]).forEach(function (value) {
30942 // eslint-disable-next-line no-param-reassign
30943 value._pluginName = plugin.name;
30944 });
30945 } // eslint-disable-next-line no-param-reassign
30946
30947
30948 result[hook] = (0, _concat.default)(_context26 = ensureArray(result[hook])).call(_context26, plugin[hook]);
30949 }
30950 });
30951 return result;
30952 }, {}); // onRealtimeCreate hook
30953
30954 applyDecorators(_this2._plugins.onRealtimeCreate, _assertThisInitialized(_this2));
30955 return _this2;
30956 }
30957
30958 var _proto = Realtime.prototype;
30959
30960 _proto._request = /*#__PURE__*/function () {
30961 var _request2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(_ref2) {
30962 var method, _url, _ref2$version, version, path, query, headers, data, url, _this$_options, appId, server, _yield$this$construct, api;
30963
30964 return _regeneratorRuntime.wrap(function _callee$(_context) {
30965 var _context27, _context28;
30966
30967 while (1) {
30968 switch (_context.prev = _context.next) {
30969 case 0:
30970 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;
30971 url = _url;
30972
30973 if (url) {
30974 _context.next = 9;
30975 break;
30976 }
30977
30978 _this$_options = this._options, appId = _this$_options.appId, server = _this$_options.server;
30979 _context.next = 6;
30980 return this.constructor._getServerUrls({
30981 appId: appId,
30982 server: server
30983 });
30984
30985 case 6:
30986 _yield$this$construct = _context.sent;
30987 api = _yield$this$construct.api;
30988 url = (0, _concat.default)(_context27 = (0, _concat.default)(_context28 = "".concat(api, "/")).call(_context28, version)).call(_context27, path);
30989
30990 case 9:
30991 return _context.abrupt("return", request({
30992 url: url,
30993 method: method,
30994 query: query,
30995 headers: _objectSpread$2({
30996 'X-LC-Id': this._options.appId,
30997 'X-LC-Key': this._options.appKey
30998 }, headers),
30999 data: data
31000 }));
31001
31002 case 10:
31003 case "end":
31004 return _context.stop();
31005 }
31006 }
31007 }, _callee, this);
31008 }));
31009
31010 function _request(_x) {
31011 return _request2.apply(this, arguments);
31012 }
31013
31014 return _request;
31015 }();
31016
31017 _proto._open = function _open() {
31018 var _this3 = this;
31019
31020 if (this._openPromise) return this._openPromise;
31021 var format = 'protobuf2';
31022
31023 if (this._options.noBinary) {
31024 // 不发送 binary data,fallback to base64 string
31025 format = 'proto2base64';
31026 }
31027
31028 var version = 3;
31029 var protocol = {
31030 format: format,
31031 version: version
31032 };
31033 this._openPromise = new _promise.default(function (resolve, reject) {
31034 debug$6('No connection established, create a new one.');
31035 var connection = new Connection(function () {
31036 return _this3._getRTMServers(_this3._options);
31037 }, protocol);
31038 connection.on(OPEN, function () {
31039 return resolve(connection);
31040 }).on(ERROR, function (error) {
31041 delete _this3._openPromise;
31042 reject(error);
31043 }).on(EXPIRE, /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
31044 return _regeneratorRuntime.wrap(function _callee2$(_context2) {
31045 while (1) {
31046 switch (_context2.prev = _context2.next) {
31047 case 0:
31048 debug$6('Connection expired. Refresh endpoints.');
31049
31050 _this3._cache.set('endpoints', null, 0);
31051
31052 _context2.next = 4;
31053 return _this3._getRTMServers(_this3._options);
31054
31055 case 4:
31056 connection.urls = _context2.sent;
31057 connection.disconnect();
31058
31059 case 6:
31060 case "end":
31061 return _context2.stop();
31062 }
31063 }
31064 }, _callee2);
31065 }))).on(MESSAGE, _this3._dispatchCommand.bind(_this3));
31066 /**
31067 * 连接断开。
31068 * 连接断开可能是因为 SDK 进入了离线状态(see {@link Realtime#event:OFFLINE}),或长时间没有收到服务器心跳。
31069 * 连接断开后所有的网络操作都会失败,请在连接断开后禁用相关的 UI 元素。
31070 * @event Realtime#DISCONNECT
31071 */
31072
31073 /**
31074 * 计划在一段时间后尝试重新连接
31075 * @event Realtime#SCHEDULE
31076 * @param {Number} attempt 尝试重连的次数
31077 * @param {Number} delay 延迟的毫秒数
31078 */
31079
31080 /**
31081 * 正在尝试重新连接
31082 * @event Realtime#RETRY
31083 * @param {Number} attempt 尝试重连的次数
31084 */
31085
31086 /**
31087 * 连接恢复正常。
31088 * 请重新启用在 {@link Realtime#event:DISCONNECT} 事件中禁用的相关 UI 元素
31089 * @event Realtime#RECONNECT
31090 */
31091
31092 /**
31093 * 客户端连接断开
31094 * @event IMClient#DISCONNECT
31095 * @see Realtime#event:DISCONNECT
31096 * @since 3.2.0
31097 */
31098
31099 /**
31100 * 计划在一段时间后尝试重新连接
31101 * @event IMClient#SCHEDULE
31102 * @param {Number} attempt 尝试重连的次数
31103 * @param {Number} delay 延迟的毫秒数
31104 * @since 3.2.0
31105 */
31106
31107 /**
31108 * 正在尝试重新连接
31109 * @event IMClient#RETRY
31110 * @param {Number} attempt 尝试重连的次数
31111 * @since 3.2.0
31112 */
31113
31114 /**
31115 * 客户端进入离线状态。
31116 * 这通常意味着网络已断开,或者 {@link Realtime#pause} 被调用
31117 * @event Realtime#OFFLINE
31118 * @since 3.4.0
31119 */
31120
31121 /**
31122 * 客户端恢复在线状态
31123 * 这通常意味着网络已恢复,或者 {@link Realtime#resume} 被调用
31124 * @event Realtime#ONLINE
31125 * @since 3.4.0
31126 */
31127
31128 /**
31129 * 进入离线状态。
31130 * 这通常意味着网络已断开,或者 {@link Realtime#pause} 被调用
31131 * @event IMClient#OFFLINE
31132 * @since 3.4.0
31133 */
31134
31135 /**
31136 * 恢复在线状态
31137 * 这通常意味着网络已恢复,或者 {@link Realtime#resume} 被调用
31138 * @event IMClient#ONLINE
31139 * @since 3.4.0
31140 */
31141 // event proxy
31142
31143 [DISCONNECT, RECONNECT, RETRY, SCHEDULE, OFFLINE, ONLINE].forEach(function (event) {
31144 return connection.on(event, function () {
31145 var _context29;
31146
31147 for (var _len = arguments.length, payload = new Array(_len), _key = 0; _key < _len; _key++) {
31148 payload[_key] = arguments[_key];
31149 }
31150
31151 debug$6("".concat(event, " event emitted. %o"), payload);
31152
31153 _this3.emit.apply(_this3, (0, _concat.default)(_context29 = [event]).call(_context29, payload));
31154
31155 if (event !== RECONNECT) {
31156 internal(_this3).clients.forEach(function (client) {
31157 var _context30;
31158
31159 client.emit.apply(client, (0, _concat.default)(_context30 = [event]).call(_context30, payload));
31160 });
31161 }
31162 });
31163 }); // override handleClose
31164
31165 connection.handleClose = function handleClose(event) {
31166 var isFatal = [ErrorCode.APP_NOT_AVAILABLE, ErrorCode.INVALID_LOGIN, ErrorCode.INVALID_ORIGIN].some(function (errorCode) {
31167 return errorCode === event.code;
31168 });
31169
31170 if (isFatal) {
31171 // in these cases, SDK should throw.
31172 this["throw"](createError(event));
31173 } else {
31174 // reconnect
31175 this.disconnect();
31176 }
31177 };
31178
31179 internal(_this3).connection = connection;
31180 });
31181 return this._openPromise;
31182 };
31183
31184 _proto._getRTMServers = /*#__PURE__*/function () {
31185 var _getRTMServers2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(options) {
31186 var info, cachedEndPoints, _info, server, secondary, ttl;
31187
31188 return _regeneratorRuntime.wrap(function _callee3$(_context3) {
31189 while (1) {
31190 switch (_context3.prev = _context3.next) {
31191 case 0:
31192 if (!options.RTMServers) {
31193 _context3.next = 2;
31194 break;
31195 }
31196
31197 return _context3.abrupt("return", shuffle(ensureArray(options.RTMServers)));
31198
31199 case 2:
31200 cachedEndPoints = this._cache.get('endpoints');
31201
31202 if (!cachedEndPoints) {
31203 _context3.next = 7;
31204 break;
31205 }
31206
31207 info = cachedEndPoints;
31208 _context3.next = 14;
31209 break;
31210
31211 case 7:
31212 _context3.next = 9;
31213 return this.constructor._fetchRTMServers(options);
31214
31215 case 9:
31216 info = _context3.sent;
31217 _info = info, server = _info.server, secondary = _info.secondary, ttl = _info.ttl;
31218
31219 if (!(typeof server !== 'string' && typeof secondary !== 'string' && typeof ttl !== 'number')) {
31220 _context3.next = 13;
31221 break;
31222 }
31223
31224 throw new Error("malformed RTM route response: ".concat((0, _stringify.default)(info)));
31225
31226 case 13:
31227 this._cache.set('endpoints', info, info.ttl * 1000);
31228
31229 case 14:
31230 debug$6('endpoint info: %O', info);
31231 return _context3.abrupt("return", [info.server, info.secondary]);
31232
31233 case 16:
31234 case "end":
31235 return _context3.stop();
31236 }
31237 }
31238 }, _callee3, this);
31239 }));
31240
31241 function _getRTMServers(_x2) {
31242 return _getRTMServers2.apply(this, arguments);
31243 }
31244
31245 return _getRTMServers;
31246 }();
31247
31248 Realtime._getServerUrls = /*#__PURE__*/function () {
31249 var _getServerUrls2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(_ref4) {
31250 var appId, server, cachedRouter, defaultProtocol;
31251 return _regeneratorRuntime.wrap(function _callee4$(_context4) {
31252 while (1) {
31253 switch (_context4.prev = _context4.next) {
31254 case 0:
31255 appId = _ref4.appId, server = _ref4.server;
31256 debug$6('fetch server urls');
31257
31258 if (!server) {
31259 _context4.next = 6;
31260 break;
31261 }
31262
31263 if (!(typeof server !== 'string')) {
31264 _context4.next = 5;
31265 break;
31266 }
31267
31268 return _context4.abrupt("return", server);
31269
31270 case 5:
31271 return _context4.abrupt("return", {
31272 RTMRouter: server,
31273 api: server
31274 });
31275
31276 case 6:
31277 cachedRouter = routerCache.get(appId);
31278
31279 if (!cachedRouter) {
31280 _context4.next = 9;
31281 break;
31282 }
31283
31284 return _context4.abrupt("return", cachedRouter);
31285
31286 case 9:
31287 defaultProtocol = 'https://';
31288 return _context4.abrupt("return", request({
31289 url: 'https://app-router.com/2/route',
31290 query: {
31291 appId: appId
31292 },
31293 timeout: 20000
31294 }).then(tap(debug$6)).then(function (_ref5) {
31295 var _context31, _context32;
31296
31297 var RTMRouterServer = _ref5.rtm_router_server,
31298 APIServer = _ref5.api_server,
31299 _ref5$ttl = _ref5.ttl,
31300 ttl = _ref5$ttl === void 0 ? 3600 : _ref5$ttl;
31301
31302 if (!RTMRouterServer) {
31303 throw new Error('rtm router not exists');
31304 }
31305
31306 var serverUrls = {
31307 RTMRouter: (0, _concat.default)(_context31 = "".concat(defaultProtocol)).call(_context31, RTMRouterServer),
31308 api: (0, _concat.default)(_context32 = "".concat(defaultProtocol)).call(_context32, APIServer)
31309 };
31310 routerCache.set(appId, serverUrls, ttl * 1000);
31311 return serverUrls;
31312 })["catch"](function () {
31313 var _context33, _context34, _context35, _context36;
31314
31315 var id = (0, _slice.default)(appId).call(appId, 0, 8).toLowerCase();
31316 var domain = 'lncldglobal.com';
31317 return {
31318 RTMRouter: (0, _concat.default)(_context33 = (0, _concat.default)(_context34 = "".concat(defaultProtocol)).call(_context34, id, ".rtm.")).call(_context33, domain),
31319 api: (0, _concat.default)(_context35 = (0, _concat.default)(_context36 = "".concat(defaultProtocol)).call(_context36, id, ".api.")).call(_context35, domain)
31320 };
31321 }));
31322
31323 case 11:
31324 case "end":
31325 return _context4.stop();
31326 }
31327 }
31328 }, _callee4);
31329 }));
31330
31331 function _getServerUrls(_x3) {
31332 return _getServerUrls2.apply(this, arguments);
31333 }
31334
31335 return _getServerUrls;
31336 }();
31337
31338 Realtime._fetchRTMServers = function _fetchRTMServers(_ref6) {
31339 var appId = _ref6.appId,
31340 ssl = _ref6.ssl,
31341 server = _ref6.server,
31342 RTMServerName = _ref6.RTMServerName;
31343 debug$6('fetch endpoint info');
31344 return this._getServerUrls({
31345 appId: appId,
31346 server: server
31347 }).then(tap(debug$6)).then(function (_ref7) {
31348 var RTMRouter = _ref7.RTMRouter;
31349 return request({
31350 url: "".concat(RTMRouter, "/v1/route"),
31351 query: {
31352 appId: appId,
31353 secure: ssl,
31354 features: isWeapp ? 'wechat' : undefined,
31355 server: RTMServerName,
31356 _t: Date.now()
31357 },
31358 timeout: 20000
31359 }).then(tap(debug$6));
31360 });
31361 };
31362
31363 _proto._close = function _close() {
31364 if (this._openPromise) {
31365 this._openPromise.then(function (connection) {
31366 return connection.close();
31367 });
31368 }
31369
31370 delete this._openPromise;
31371 }
31372 /**
31373 * 手动进行重连。
31374 * SDK 在网络出现异常时会自动按照一定的时间间隔尝试重连,调用该方法会立即尝试重连并重置重连尝试计数器。
31375 * 只能在 `SCHEDULE` 事件之后,`RETRY` 事件之前调用,如果当前网络正常或者正在进行重连,调用该方法会抛异常。
31376 */
31377 ;
31378
31379 _proto.retry = function retry() {
31380 var _internal = internal(this),
31381 connection = _internal.connection;
31382
31383 if (!connection) {
31384 throw new Error('no connection established');
31385 }
31386
31387 if (connection.cannot('retry')) {
31388 throw new Error("retrying not allowed when not disconnected. the connection is now ".concat(connection.current));
31389 }
31390
31391 return connection.retry();
31392 }
31393 /**
31394 * 暂停,使 SDK 进入离线状态。
31395 * 你可以在网络断开、应用进入后台等时刻调用该方法让 SDK 进入离线状态,离线状态下不会尝试重连。
31396 * 在浏览器中 SDK 会自动监听网络变化,因此无需手动调用该方法。
31397 *
31398 * @since 3.4.0
31399 * @see Realtime#event:OFFLINE
31400 */
31401 ;
31402
31403 _proto.pause = function pause() {
31404 // 这个方法常常在网络断开、进入后台时被调用,此时 connection 可能没有建立或者已经 close。
31405 // 因此不像 retry,这个方法应该尽可能 loose
31406 var _internal2 = internal(this),
31407 connection = _internal2.connection;
31408
31409 if (!connection) return;
31410 if (connection.can('pause')) connection.pause();
31411 }
31412 /**
31413 * 恢复在线状态。
31414 * 你可以在网络恢复、应用回到前台等时刻调用该方法让 SDK 恢复在线状态,恢复在线状态后 SDK 会开始尝试重连。
31415 *
31416 * @since 3.4.0
31417 * @see Realtime#event:ONLINE
31418 */
31419 ;
31420
31421 _proto.resume = function resume() {
31422 // 与 pause 一样,这个方法应该尽可能 loose
31423 var _internal3 = internal(this),
31424 connection = _internal3.connection;
31425
31426 if (!connection) return;
31427 if (connection.can('resume')) connection.resume();
31428 };
31429
31430 _proto._registerPending = function _registerPending(value) {
31431 internal(this).pendingClients.add(value);
31432 };
31433
31434 _proto._deregisterPending = function _deregisterPending(client) {
31435 internal(this).pendingClients["delete"](client);
31436 };
31437
31438 _proto._register = function _register(client) {
31439 internal(this).clients.add(client);
31440 };
31441
31442 _proto._deregister = function _deregister(client) {
31443 var _this = internal(this);
31444
31445 _this.clients["delete"](client);
31446
31447 if (_this.clients.size + _this.pendingClients.size === 0) {
31448 this._close();
31449 }
31450 };
31451
31452 _proto._dispatchCommand = function _dispatchCommand(command) {
31453 return applyDispatcher(this._plugins.beforeCommandDispatch, [command, this]).then(function (shouldDispatch) {
31454 // no plugin handled this command
31455 if (shouldDispatch) return debug$6('[WARN] Unexpected message received: %O', trim(command));
31456 return false;
31457 });
31458 };
31459
31460 return Realtime;
31461}(EventEmitter); // For test purpose only
31462
31463
31464var polyfilledPromise = _promise.default;
31465exports.EventEmitter = EventEmitter;
31466exports.Promise = polyfilledPromise;
31467exports.Protocals = message;
31468exports.Protocols = message;
31469exports.Realtime = Realtime;
31470exports.debug = debug$2;
31471exports.getAdapter = getAdapter;
31472exports.setAdapters = setAdapters;
31473/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(74)))
31474
31475/***/ }),
31476/* 592 */
31477/***/ (function(module, exports, __webpack_require__) {
31478
31479module.exports = __webpack_require__(593);
31480
31481/***/ }),
31482/* 593 */
31483/***/ (function(module, exports, __webpack_require__) {
31484
31485var parent = __webpack_require__(594);
31486
31487module.exports = parent;
31488
31489
31490/***/ }),
31491/* 594 */
31492/***/ (function(module, exports, __webpack_require__) {
31493
31494__webpack_require__(595);
31495var path = __webpack_require__(5);
31496
31497module.exports = path.Object.freeze;
31498
31499
31500/***/ }),
31501/* 595 */
31502/***/ (function(module, exports, __webpack_require__) {
31503
31504var $ = __webpack_require__(0);
31505var FREEZING = __webpack_require__(263);
31506var fails = __webpack_require__(2);
31507var isObject = __webpack_require__(11);
31508var onFreeze = __webpack_require__(94).onFreeze;
31509
31510// eslint-disable-next-line es-x/no-object-freeze -- safe
31511var $freeze = Object.freeze;
31512var FAILS_ON_PRIMITIVES = fails(function () { $freeze(1); });
31513
31514// `Object.freeze` method
31515// https://tc39.es/ecma262/#sec-object.freeze
31516$({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES, sham: !FREEZING }, {
31517 freeze: function freeze(it) {
31518 return $freeze && isObject(it) ? $freeze(onFreeze(it)) : it;
31519 }
31520});
31521
31522
31523/***/ }),
31524/* 596 */
31525/***/ (function(module, exports, __webpack_require__) {
31526
31527module.exports = __webpack_require__(597);
31528
31529/***/ }),
31530/* 597 */
31531/***/ (function(module, exports, __webpack_require__) {
31532
31533var parent = __webpack_require__(598);
31534
31535module.exports = parent;
31536
31537
31538/***/ }),
31539/* 598 */
31540/***/ (function(module, exports, __webpack_require__) {
31541
31542__webpack_require__(599);
31543var path = __webpack_require__(5);
31544
31545module.exports = path.Object.getOwnPropertyDescriptors;
31546
31547
31548/***/ }),
31549/* 599 */
31550/***/ (function(module, exports, __webpack_require__) {
31551
31552var $ = __webpack_require__(0);
31553var DESCRIPTORS = __webpack_require__(14);
31554var ownKeys = __webpack_require__(163);
31555var toIndexedObject = __webpack_require__(32);
31556var getOwnPropertyDescriptorModule = __webpack_require__(62);
31557var createProperty = __webpack_require__(91);
31558
31559// `Object.getOwnPropertyDescriptors` method
31560// https://tc39.es/ecma262/#sec-object.getownpropertydescriptors
31561$({ target: 'Object', stat: true, sham: !DESCRIPTORS }, {
31562 getOwnPropertyDescriptors: function getOwnPropertyDescriptors(object) {
31563 var O = toIndexedObject(object);
31564 var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
31565 var keys = ownKeys(O);
31566 var result = {};
31567 var index = 0;
31568 var key, descriptor;
31569 while (keys.length > index) {
31570 descriptor = getOwnPropertyDescriptor(O, key = keys[index++]);
31571 if (descriptor !== undefined) createProperty(result, key, descriptor);
31572 }
31573 return result;
31574 }
31575});
31576
31577
31578/***/ }),
31579/* 600 */
31580/***/ (function(module, exports, __webpack_require__) {
31581
31582module.exports = __webpack_require__(601);
31583
31584/***/ }),
31585/* 601 */
31586/***/ (function(module, exports, __webpack_require__) {
31587
31588var parent = __webpack_require__(602);
31589
31590module.exports = parent;
31591
31592
31593/***/ }),
31594/* 602 */
31595/***/ (function(module, exports, __webpack_require__) {
31596
31597__webpack_require__(603);
31598var path = __webpack_require__(5);
31599
31600var Object = path.Object;
31601
31602var defineProperties = module.exports = function defineProperties(T, D) {
31603 return Object.defineProperties(T, D);
31604};
31605
31606if (Object.defineProperties.sham) defineProperties.sham = true;
31607
31608
31609/***/ }),
31610/* 603 */
31611/***/ (function(module, exports, __webpack_require__) {
31612
31613var $ = __webpack_require__(0);
31614var DESCRIPTORS = __webpack_require__(14);
31615var defineProperties = __webpack_require__(129).f;
31616
31617// `Object.defineProperties` method
31618// https://tc39.es/ecma262/#sec-object.defineproperties
31619// eslint-disable-next-line es-x/no-object-defineproperties -- safe
31620$({ target: 'Object', stat: true, forced: Object.defineProperties !== defineProperties, sham: !DESCRIPTORS }, {
31621 defineProperties: defineProperties
31622});
31623
31624
31625/***/ }),
31626/* 604 */
31627/***/ (function(module, exports, __webpack_require__) {
31628
31629module.exports = __webpack_require__(605);
31630
31631/***/ }),
31632/* 605 */
31633/***/ (function(module, exports, __webpack_require__) {
31634
31635var parent = __webpack_require__(606);
31636
31637module.exports = parent;
31638
31639
31640/***/ }),
31641/* 606 */
31642/***/ (function(module, exports, __webpack_require__) {
31643
31644var isPrototypeOf = __webpack_require__(19);
31645var method = __webpack_require__(607);
31646
31647var ArrayPrototype = Array.prototype;
31648
31649module.exports = function (it) {
31650 var own = it.reduce;
31651 return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.reduce) ? method : own;
31652};
31653
31654
31655/***/ }),
31656/* 607 */
31657/***/ (function(module, exports, __webpack_require__) {
31658
31659__webpack_require__(608);
31660var entryVirtual = __webpack_require__(40);
31661
31662module.exports = entryVirtual('Array').reduce;
31663
31664
31665/***/ }),
31666/* 608 */
31667/***/ (function(module, exports, __webpack_require__) {
31668
31669"use strict";
31670
31671var $ = __webpack_require__(0);
31672var $reduce = __webpack_require__(609).left;
31673var arrayMethodIsStrict = __webpack_require__(232);
31674var CHROME_VERSION = __webpack_require__(77);
31675var IS_NODE = __webpack_require__(107);
31676
31677var STRICT_METHOD = arrayMethodIsStrict('reduce');
31678// Chrome 80-82 has a critical bug
31679// https://bugs.chromium.org/p/chromium/issues/detail?id=1049982
31680var CHROME_BUG = !IS_NODE && CHROME_VERSION > 79 && CHROME_VERSION < 83;
31681
31682// `Array.prototype.reduce` method
31683// https://tc39.es/ecma262/#sec-array.prototype.reduce
31684$({ target: 'Array', proto: true, forced: !STRICT_METHOD || CHROME_BUG }, {
31685 reduce: function reduce(callbackfn /* , initialValue */) {
31686 var length = arguments.length;
31687 return $reduce(this, callbackfn, length, length > 1 ? arguments[1] : undefined);
31688 }
31689});
31690
31691
31692/***/ }),
31693/* 609 */
31694/***/ (function(module, exports, __webpack_require__) {
31695
31696var aCallable = __webpack_require__(31);
31697var toObject = __webpack_require__(34);
31698var IndexedObject = __webpack_require__(95);
31699var lengthOfArrayLike = __webpack_require__(41);
31700
31701var $TypeError = TypeError;
31702
31703// `Array.prototype.{ reduce, reduceRight }` methods implementation
31704var createMethod = function (IS_RIGHT) {
31705 return function (that, callbackfn, argumentsLength, memo) {
31706 aCallable(callbackfn);
31707 var O = toObject(that);
31708 var self = IndexedObject(O);
31709 var length = lengthOfArrayLike(O);
31710 var index = IS_RIGHT ? length - 1 : 0;
31711 var i = IS_RIGHT ? -1 : 1;
31712 if (argumentsLength < 2) while (true) {
31713 if (index in self) {
31714 memo = self[index];
31715 index += i;
31716 break;
31717 }
31718 index += i;
31719 if (IS_RIGHT ? index < 0 : length <= index) {
31720 throw $TypeError('Reduce of empty array with no initial value');
31721 }
31722 }
31723 for (;IS_RIGHT ? index >= 0 : length > index; index += i) if (index in self) {
31724 memo = callbackfn(memo, self[index], index, O);
31725 }
31726 return memo;
31727 };
31728};
31729
31730module.exports = {
31731 // `Array.prototype.reduce` method
31732 // https://tc39.es/ecma262/#sec-array.prototype.reduce
31733 left: createMethod(false),
31734 // `Array.prototype.reduceRight` method
31735 // https://tc39.es/ecma262/#sec-array.prototype.reduceright
31736 right: createMethod(true)
31737};
31738
31739
31740/***/ }),
31741/* 610 */
31742/***/ (function(module, exports, __webpack_require__) {
31743
31744var parent = __webpack_require__(611);
31745__webpack_require__(39);
31746
31747module.exports = parent;
31748
31749
31750/***/ }),
31751/* 611 */
31752/***/ (function(module, exports, __webpack_require__) {
31753
31754__webpack_require__(38);
31755__webpack_require__(53);
31756__webpack_require__(612);
31757__webpack_require__(55);
31758var path = __webpack_require__(5);
31759
31760module.exports = path.Set;
31761
31762
31763/***/ }),
31764/* 612 */
31765/***/ (function(module, exports, __webpack_require__) {
31766
31767// TODO: Remove this module from `core-js@4` since it's replaced to module below
31768__webpack_require__(613);
31769
31770
31771/***/ }),
31772/* 613 */
31773/***/ (function(module, exports, __webpack_require__) {
31774
31775"use strict";
31776
31777var collection = __webpack_require__(156);
31778var collectionStrong = __webpack_require__(264);
31779
31780// `Set` constructor
31781// https://tc39.es/ecma262/#sec-set-objects
31782collection('Set', function (init) {
31783 return function Set() { return init(this, arguments.length ? arguments[0] : undefined); };
31784}, collectionStrong);
31785
31786
31787/***/ }),
31788/* 614 */
31789/***/ (function(module, exports, __webpack_require__) {
31790
31791var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*
31792 Copyright 2013 Daniel Wirtz <dcode@dcode.io>
31793
31794 Licensed under the Apache License, Version 2.0 (the "License");
31795 you may not use this file except in compliance with the License.
31796 You may obtain a copy of the License at
31797
31798 http://www.apache.org/licenses/LICENSE-2.0
31799
31800 Unless required by applicable law or agreed to in writing, software
31801 distributed under the License is distributed on an "AS IS" BASIS,
31802 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
31803 See the License for the specific language governing permissions and
31804 limitations under the License.
31805 */
31806
31807/**
31808 * @license protobuf.js (c) 2013 Daniel Wirtz <dcode@dcode.io>
31809 * Released under the Apache License, Version 2.0
31810 * see: https://github.com/dcodeIO/protobuf.js for details
31811 */
31812(function(global, factory) {
31813
31814 /* AMD */ if (true)
31815 !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(615)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
31816 __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
31817 (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
31818 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
31819 /* CommonJS */ else if (typeof require === "function" && typeof module === "object" && module && module["exports"])
31820 module["exports"] = factory(require("bytebuffer"), true);
31821 /* Global */ else
31822 (global["dcodeIO"] = global["dcodeIO"] || {})["ProtoBuf"] = factory(global["dcodeIO"]["ByteBuffer"]);
31823
31824})(this, function(ByteBuffer, isCommonJS) {
31825 "use strict";
31826
31827 /**
31828 * The ProtoBuf namespace.
31829 * @exports ProtoBuf
31830 * @namespace
31831 * @expose
31832 */
31833 var ProtoBuf = {};
31834
31835 /**
31836 * @type {!function(new: ByteBuffer, ...[*])}
31837 * @expose
31838 */
31839 ProtoBuf.ByteBuffer = ByteBuffer;
31840
31841 /**
31842 * @type {?function(new: Long, ...[*])}
31843 * @expose
31844 */
31845 ProtoBuf.Long = ByteBuffer.Long || null;
31846
31847 /**
31848 * ProtoBuf.js version.
31849 * @type {string}
31850 * @const
31851 * @expose
31852 */
31853 ProtoBuf.VERSION = "5.0.3";
31854
31855 /**
31856 * Wire types.
31857 * @type {Object.<string,number>}
31858 * @const
31859 * @expose
31860 */
31861 ProtoBuf.WIRE_TYPES = {};
31862
31863 /**
31864 * Varint wire type.
31865 * @type {number}
31866 * @expose
31867 */
31868 ProtoBuf.WIRE_TYPES.VARINT = 0;
31869
31870 /**
31871 * Fixed 64 bits wire type.
31872 * @type {number}
31873 * @const
31874 * @expose
31875 */
31876 ProtoBuf.WIRE_TYPES.BITS64 = 1;
31877
31878 /**
31879 * Length delimited wire type.
31880 * @type {number}
31881 * @const
31882 * @expose
31883 */
31884 ProtoBuf.WIRE_TYPES.LDELIM = 2;
31885
31886 /**
31887 * Start group wire type.
31888 * @type {number}
31889 * @const
31890 * @expose
31891 */
31892 ProtoBuf.WIRE_TYPES.STARTGROUP = 3;
31893
31894 /**
31895 * End group wire type.
31896 * @type {number}
31897 * @const
31898 * @expose
31899 */
31900 ProtoBuf.WIRE_TYPES.ENDGROUP = 4;
31901
31902 /**
31903 * Fixed 32 bits wire type.
31904 * @type {number}
31905 * @const
31906 * @expose
31907 */
31908 ProtoBuf.WIRE_TYPES.BITS32 = 5;
31909
31910 /**
31911 * Packable wire types.
31912 * @type {!Array.<number>}
31913 * @const
31914 * @expose
31915 */
31916 ProtoBuf.PACKABLE_WIRE_TYPES = [
31917 ProtoBuf.WIRE_TYPES.VARINT,
31918 ProtoBuf.WIRE_TYPES.BITS64,
31919 ProtoBuf.WIRE_TYPES.BITS32
31920 ];
31921
31922 /**
31923 * Types.
31924 * @dict
31925 * @type {!Object.<string,{name: string, wireType: number, defaultValue: *}>}
31926 * @const
31927 * @expose
31928 */
31929 ProtoBuf.TYPES = {
31930 // According to the protobuf spec.
31931 "int32": {
31932 name: "int32",
31933 wireType: ProtoBuf.WIRE_TYPES.VARINT,
31934 defaultValue: 0
31935 },
31936 "uint32": {
31937 name: "uint32",
31938 wireType: ProtoBuf.WIRE_TYPES.VARINT,
31939 defaultValue: 0
31940 },
31941 "sint32": {
31942 name: "sint32",
31943 wireType: ProtoBuf.WIRE_TYPES.VARINT,
31944 defaultValue: 0
31945 },
31946 "int64": {
31947 name: "int64",
31948 wireType: ProtoBuf.WIRE_TYPES.VARINT,
31949 defaultValue: ProtoBuf.Long ? ProtoBuf.Long.ZERO : undefined
31950 },
31951 "uint64": {
31952 name: "uint64",
31953 wireType: ProtoBuf.WIRE_TYPES.VARINT,
31954 defaultValue: ProtoBuf.Long ? ProtoBuf.Long.UZERO : undefined
31955 },
31956 "sint64": {
31957 name: "sint64",
31958 wireType: ProtoBuf.WIRE_TYPES.VARINT,
31959 defaultValue: ProtoBuf.Long ? ProtoBuf.Long.ZERO : undefined
31960 },
31961 "bool": {
31962 name: "bool",
31963 wireType: ProtoBuf.WIRE_TYPES.VARINT,
31964 defaultValue: false
31965 },
31966 "double": {
31967 name: "double",
31968 wireType: ProtoBuf.WIRE_TYPES.BITS64,
31969 defaultValue: 0
31970 },
31971 "string": {
31972 name: "string",
31973 wireType: ProtoBuf.WIRE_TYPES.LDELIM,
31974 defaultValue: ""
31975 },
31976 "bytes": {
31977 name: "bytes",
31978 wireType: ProtoBuf.WIRE_TYPES.LDELIM,
31979 defaultValue: null // overridden in the code, must be a unique instance
31980 },
31981 "fixed32": {
31982 name: "fixed32",
31983 wireType: ProtoBuf.WIRE_TYPES.BITS32,
31984 defaultValue: 0
31985 },
31986 "sfixed32": {
31987 name: "sfixed32",
31988 wireType: ProtoBuf.WIRE_TYPES.BITS32,
31989 defaultValue: 0
31990 },
31991 "fixed64": {
31992 name: "fixed64",
31993 wireType: ProtoBuf.WIRE_TYPES.BITS64,
31994 defaultValue: ProtoBuf.Long ? ProtoBuf.Long.UZERO : undefined
31995 },
31996 "sfixed64": {
31997 name: "sfixed64",
31998 wireType: ProtoBuf.WIRE_TYPES.BITS64,
31999 defaultValue: ProtoBuf.Long ? ProtoBuf.Long.ZERO : undefined
32000 },
32001 "float": {
32002 name: "float",
32003 wireType: ProtoBuf.WIRE_TYPES.BITS32,
32004 defaultValue: 0
32005 },
32006 "enum": {
32007 name: "enum",
32008 wireType: ProtoBuf.WIRE_TYPES.VARINT,
32009 defaultValue: 0
32010 },
32011 "message": {
32012 name: "message",
32013 wireType: ProtoBuf.WIRE_TYPES.LDELIM,
32014 defaultValue: null
32015 },
32016 "group": {
32017 name: "group",
32018 wireType: ProtoBuf.WIRE_TYPES.STARTGROUP,
32019 defaultValue: null
32020 }
32021 };
32022
32023 /**
32024 * Valid map key types.
32025 * @type {!Array.<!Object.<string,{name: string, wireType: number, defaultValue: *}>>}
32026 * @const
32027 * @expose
32028 */
32029 ProtoBuf.MAP_KEY_TYPES = [
32030 ProtoBuf.TYPES["int32"],
32031 ProtoBuf.TYPES["sint32"],
32032 ProtoBuf.TYPES["sfixed32"],
32033 ProtoBuf.TYPES["uint32"],
32034 ProtoBuf.TYPES["fixed32"],
32035 ProtoBuf.TYPES["int64"],
32036 ProtoBuf.TYPES["sint64"],
32037 ProtoBuf.TYPES["sfixed64"],
32038 ProtoBuf.TYPES["uint64"],
32039 ProtoBuf.TYPES["fixed64"],
32040 ProtoBuf.TYPES["bool"],
32041 ProtoBuf.TYPES["string"],
32042 ProtoBuf.TYPES["bytes"]
32043 ];
32044
32045 /**
32046 * Minimum field id.
32047 * @type {number}
32048 * @const
32049 * @expose
32050 */
32051 ProtoBuf.ID_MIN = 1;
32052
32053 /**
32054 * Maximum field id.
32055 * @type {number}
32056 * @const
32057 * @expose
32058 */
32059 ProtoBuf.ID_MAX = 0x1FFFFFFF;
32060
32061 /**
32062 * If set to `true`, field names will be converted from underscore notation to camel case. Defaults to `false`.
32063 * Must be set prior to parsing.
32064 * @type {boolean}
32065 * @expose
32066 */
32067 ProtoBuf.convertFieldsToCamelCase = false;
32068
32069 /**
32070 * By default, messages are populated with (setX, set_x) accessors for each field. This can be disabled by
32071 * setting this to `false` prior to building messages.
32072 * @type {boolean}
32073 * @expose
32074 */
32075 ProtoBuf.populateAccessors = true;
32076
32077 /**
32078 * By default, messages are populated with default values if a field is not present on the wire. To disable
32079 * this behavior, set this setting to `false`.
32080 * @type {boolean}
32081 * @expose
32082 */
32083 ProtoBuf.populateDefaults = true;
32084
32085 /**
32086 * @alias ProtoBuf.Util
32087 * @expose
32088 */
32089 ProtoBuf.Util = (function() {
32090 "use strict";
32091
32092 /**
32093 * ProtoBuf utilities.
32094 * @exports ProtoBuf.Util
32095 * @namespace
32096 */
32097 var Util = {};
32098
32099 /**
32100 * Flag if running in node or not.
32101 * @type {boolean}
32102 * @const
32103 * @expose
32104 */
32105 Util.IS_NODE = !!(
32106 typeof process === 'object' && process+'' === '[object process]' && !process['browser']
32107 );
32108
32109 /**
32110 * Constructs a XMLHttpRequest object.
32111 * @return {XMLHttpRequest}
32112 * @throws {Error} If XMLHttpRequest is not supported
32113 * @expose
32114 */
32115 Util.XHR = function() {
32116 // No dependencies please, ref: http://www.quirksmode.org/js/xmlhttp.html
32117 var XMLHttpFactories = [
32118 function () {return new XMLHttpRequest()},
32119 function () {return new ActiveXObject("Msxml2.XMLHTTP")},
32120 function () {return new ActiveXObject("Msxml3.XMLHTTP")},
32121 function () {return new ActiveXObject("Microsoft.XMLHTTP")}
32122 ];
32123 /** @type {?XMLHttpRequest} */
32124 var xhr = null;
32125 for (var i=0;i<XMLHttpFactories.length;i++) {
32126 try { xhr = XMLHttpFactories[i](); }
32127 catch (e) { continue; }
32128 break;
32129 }
32130 if (!xhr)
32131 throw Error("XMLHttpRequest is not supported");
32132 return xhr;
32133 };
32134
32135 /**
32136 * Fetches a resource.
32137 * @param {string} path Resource path
32138 * @param {function(?string)=} callback Callback receiving the resource's contents. If omitted the resource will
32139 * be fetched synchronously. If the request failed, contents will be null.
32140 * @return {?string|undefined} Resource contents if callback is omitted (null if the request failed), else undefined.
32141 * @expose
32142 */
32143 Util.fetch = function(path, callback) {
32144 if (callback && typeof callback != 'function')
32145 callback = null;
32146 if (Util.IS_NODE) {
32147 var fs = __webpack_require__(617);
32148 if (callback) {
32149 fs.readFile(path, function(err, data) {
32150 if (err)
32151 callback(null);
32152 else
32153 callback(""+data);
32154 });
32155 } else
32156 try {
32157 return fs.readFileSync(path);
32158 } catch (e) {
32159 return null;
32160 }
32161 } else {
32162 var xhr = Util.XHR();
32163 xhr.open('GET', path, callback ? true : false);
32164 // xhr.setRequestHeader('User-Agent', 'XMLHTTP/1.0');
32165 xhr.setRequestHeader('Accept', 'text/plain');
32166 if (typeof xhr.overrideMimeType === 'function') xhr.overrideMimeType('text/plain');
32167 if (callback) {
32168 xhr.onreadystatechange = function() {
32169 if (xhr.readyState != 4) return;
32170 if (/* remote */ xhr.status == 200 || /* local */ (xhr.status == 0 && typeof xhr.responseText === 'string'))
32171 callback(xhr.responseText);
32172 else
32173 callback(null);
32174 };
32175 if (xhr.readyState == 4)
32176 return;
32177 xhr.send(null);
32178 } else {
32179 xhr.send(null);
32180 if (/* remote */ xhr.status == 200 || /* local */ (xhr.status == 0 && typeof xhr.responseText === 'string'))
32181 return xhr.responseText;
32182 return null;
32183 }
32184 }
32185 };
32186
32187 /**
32188 * Converts a string to camel case.
32189 * @param {string} str
32190 * @returns {string}
32191 * @expose
32192 */
32193 Util.toCamelCase = function(str) {
32194 return str.replace(/_([a-zA-Z])/g, function ($0, $1) {
32195 return $1.toUpperCase();
32196 });
32197 };
32198
32199 return Util;
32200 })();
32201
32202 /**
32203 * Language expressions.
32204 * @type {!Object.<string,!RegExp>}
32205 * @expose
32206 */
32207 ProtoBuf.Lang = {
32208
32209 // Characters always ending a statement
32210 DELIM: /[\s\{\}=;:\[\],'"\(\)<>]/g,
32211
32212 // Field rules
32213 RULE: /^(?:required|optional|repeated|map)$/,
32214
32215 // Field types
32216 TYPE: /^(?:double|float|int32|uint32|sint32|int64|uint64|sint64|fixed32|sfixed32|fixed64|sfixed64|bool|string|bytes)$/,
32217
32218 // Names
32219 NAME: /^[a-zA-Z_][a-zA-Z_0-9]*$/,
32220
32221 // Type definitions
32222 TYPEDEF: /^[a-zA-Z][a-zA-Z_0-9]*$/,
32223
32224 // Type references
32225 TYPEREF: /^(?:\.?[a-zA-Z_][a-zA-Z_0-9]*)(?:\.[a-zA-Z_][a-zA-Z_0-9]*)*$/,
32226
32227 // Fully qualified type references
32228 FQTYPEREF: /^(?:\.[a-zA-Z_][a-zA-Z_0-9]*)+$/,
32229
32230 // All numbers
32231 NUMBER: /^-?(?:[1-9][0-9]*|0|0[xX][0-9a-fA-F]+|0[0-7]+|([0-9]*(\.[0-9]*)?([Ee][+-]?[0-9]+)?)|inf|nan)$/,
32232
32233 // Decimal numbers
32234 NUMBER_DEC: /^(?:[1-9][0-9]*|0)$/,
32235
32236 // Hexadecimal numbers
32237 NUMBER_HEX: /^0[xX][0-9a-fA-F]+$/,
32238
32239 // Octal numbers
32240 NUMBER_OCT: /^0[0-7]+$/,
32241
32242 // Floating point numbers
32243 NUMBER_FLT: /^([0-9]*(\.[0-9]*)?([Ee][+-]?[0-9]+)?|inf|nan)$/,
32244
32245 // Booleans
32246 BOOL: /^(?:true|false)$/i,
32247
32248 // Id numbers
32249 ID: /^(?:[1-9][0-9]*|0|0[xX][0-9a-fA-F]+|0[0-7]+)$/,
32250
32251 // Negative id numbers (enum values)
32252 NEGID: /^\-?(?:[1-9][0-9]*|0|0[xX][0-9a-fA-F]+|0[0-7]+)$/,
32253
32254 // Whitespaces
32255 WHITESPACE: /\s/,
32256
32257 // All strings
32258 STRING: /(?:"([^"\\]*(?:\\.[^"\\]*)*)")|(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g,
32259
32260 // Double quoted strings
32261 STRING_DQ: /(?:"([^"\\]*(?:\\.[^"\\]*)*)")/g,
32262
32263 // Single quoted strings
32264 STRING_SQ: /(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g
32265 };
32266
32267
32268 /**
32269 * @alias ProtoBuf.Reflect
32270 * @expose
32271 */
32272 ProtoBuf.Reflect = (function(ProtoBuf) {
32273 "use strict";
32274
32275 /**
32276 * Reflection types.
32277 * @exports ProtoBuf.Reflect
32278 * @namespace
32279 */
32280 var Reflect = {};
32281
32282 /**
32283 * Constructs a Reflect base class.
32284 * @exports ProtoBuf.Reflect.T
32285 * @constructor
32286 * @abstract
32287 * @param {!ProtoBuf.Builder} builder Builder reference
32288 * @param {?ProtoBuf.Reflect.T} parent Parent object
32289 * @param {string} name Object name
32290 */
32291 var T = function(builder, parent, name) {
32292
32293 /**
32294 * Builder reference.
32295 * @type {!ProtoBuf.Builder}
32296 * @expose
32297 */
32298 this.builder = builder;
32299
32300 /**
32301 * Parent object.
32302 * @type {?ProtoBuf.Reflect.T}
32303 * @expose
32304 */
32305 this.parent = parent;
32306
32307 /**
32308 * Object name in namespace.
32309 * @type {string}
32310 * @expose
32311 */
32312 this.name = name;
32313
32314 /**
32315 * Fully qualified class name
32316 * @type {string}
32317 * @expose
32318 */
32319 this.className;
32320 };
32321
32322 /**
32323 * @alias ProtoBuf.Reflect.T.prototype
32324 * @inner
32325 */
32326 var TPrototype = T.prototype;
32327
32328 /**
32329 * Returns the fully qualified name of this object.
32330 * @returns {string} Fully qualified name as of ".PATH.TO.THIS"
32331 * @expose
32332 */
32333 TPrototype.fqn = function() {
32334 var name = this.name,
32335 ptr = this;
32336 do {
32337 ptr = ptr.parent;
32338 if (ptr == null)
32339 break;
32340 name = ptr.name+"."+name;
32341 } while (true);
32342 return name;
32343 };
32344
32345 /**
32346 * Returns a string representation of this Reflect object (its fully qualified name).
32347 * @param {boolean=} includeClass Set to true to include the class name. Defaults to false.
32348 * @return String representation
32349 * @expose
32350 */
32351 TPrototype.toString = function(includeClass) {
32352 return (includeClass ? this.className + " " : "") + this.fqn();
32353 };
32354
32355 /**
32356 * Builds this type.
32357 * @throws {Error} If this type cannot be built directly
32358 * @expose
32359 */
32360 TPrototype.build = function() {
32361 throw Error(this.toString(true)+" cannot be built directly");
32362 };
32363
32364 /**
32365 * @alias ProtoBuf.Reflect.T
32366 * @expose
32367 */
32368 Reflect.T = T;
32369
32370 /**
32371 * Constructs a new Namespace.
32372 * @exports ProtoBuf.Reflect.Namespace
32373 * @param {!ProtoBuf.Builder} builder Builder reference
32374 * @param {?ProtoBuf.Reflect.Namespace} parent Namespace parent
32375 * @param {string} name Namespace name
32376 * @param {Object.<string,*>=} options Namespace options
32377 * @param {string?} syntax The syntax level of this definition (e.g., proto3)
32378 * @constructor
32379 * @extends ProtoBuf.Reflect.T
32380 */
32381 var Namespace = function(builder, parent, name, options, syntax) {
32382 T.call(this, builder, parent, name);
32383
32384 /**
32385 * @override
32386 */
32387 this.className = "Namespace";
32388
32389 /**
32390 * Children inside the namespace.
32391 * @type {!Array.<ProtoBuf.Reflect.T>}
32392 */
32393 this.children = [];
32394
32395 /**
32396 * Options.
32397 * @type {!Object.<string, *>}
32398 */
32399 this.options = options || {};
32400
32401 /**
32402 * Syntax level (e.g., proto2 or proto3).
32403 * @type {!string}
32404 */
32405 this.syntax = syntax || "proto2";
32406 };
32407
32408 /**
32409 * @alias ProtoBuf.Reflect.Namespace.prototype
32410 * @inner
32411 */
32412 var NamespacePrototype = Namespace.prototype = Object.create(T.prototype);
32413
32414 /**
32415 * Returns an array of the namespace's children.
32416 * @param {ProtoBuf.Reflect.T=} type Filter type (returns instances of this type only). Defaults to null (all children).
32417 * @return {Array.<ProtoBuf.Reflect.T>}
32418 * @expose
32419 */
32420 NamespacePrototype.getChildren = function(type) {
32421 type = type || null;
32422 if (type == null)
32423 return this.children.slice();
32424 var children = [];
32425 for (var i=0, k=this.children.length; i<k; ++i)
32426 if (this.children[i] instanceof type)
32427 children.push(this.children[i]);
32428 return children;
32429 };
32430
32431 /**
32432 * Adds a child to the namespace.
32433 * @param {ProtoBuf.Reflect.T} child Child
32434 * @throws {Error} If the child cannot be added (duplicate)
32435 * @expose
32436 */
32437 NamespacePrototype.addChild = function(child) {
32438 var other;
32439 if (other = this.getChild(child.name)) {
32440 // Try to revert camelcase transformation on collision
32441 if (other instanceof Message.Field && other.name !== other.originalName && this.getChild(other.originalName) === null)
32442 other.name = other.originalName; // Revert previous first (effectively keeps both originals)
32443 else if (child instanceof Message.Field && child.name !== child.originalName && this.getChild(child.originalName) === null)
32444 child.name = child.originalName;
32445 else
32446 throw Error("Duplicate name in namespace "+this.toString(true)+": "+child.name);
32447 }
32448 this.children.push(child);
32449 };
32450
32451 /**
32452 * Gets a child by its name or id.
32453 * @param {string|number} nameOrId Child name or id
32454 * @return {?ProtoBuf.Reflect.T} The child or null if not found
32455 * @expose
32456 */
32457 NamespacePrototype.getChild = function(nameOrId) {
32458 var key = typeof nameOrId === 'number' ? 'id' : 'name';
32459 for (var i=0, k=this.children.length; i<k; ++i)
32460 if (this.children[i][key] === nameOrId)
32461 return this.children[i];
32462 return null;
32463 };
32464
32465 /**
32466 * Resolves a reflect object inside of this namespace.
32467 * @param {string|!Array.<string>} qn Qualified name to resolve
32468 * @param {boolean=} excludeNonNamespace Excludes non-namespace types, defaults to `false`
32469 * @return {?ProtoBuf.Reflect.Namespace} The resolved type or null if not found
32470 * @expose
32471 */
32472 NamespacePrototype.resolve = function(qn, excludeNonNamespace) {
32473 var part = typeof qn === 'string' ? qn.split(".") : qn,
32474 ptr = this,
32475 i = 0;
32476 if (part[i] === "") { // Fully qualified name, e.g. ".My.Message'
32477 while (ptr.parent !== null)
32478 ptr = ptr.parent;
32479 i++;
32480 }
32481 var child;
32482 do {
32483 do {
32484 if (!(ptr instanceof Reflect.Namespace)) {
32485 ptr = null;
32486 break;
32487 }
32488 child = ptr.getChild(part[i]);
32489 if (!child || !(child instanceof Reflect.T) || (excludeNonNamespace && !(child instanceof Reflect.Namespace))) {
32490 ptr = null;
32491 break;
32492 }
32493 ptr = child; i++;
32494 } while (i < part.length);
32495 if (ptr != null)
32496 break; // Found
32497 // Else search the parent
32498 if (this.parent !== null)
32499 return this.parent.resolve(qn, excludeNonNamespace);
32500 } while (ptr != null);
32501 return ptr;
32502 };
32503
32504 /**
32505 * Determines the shortest qualified name of the specified type, if any, relative to this namespace.
32506 * @param {!ProtoBuf.Reflect.T} t Reflection type
32507 * @returns {string} The shortest qualified name or, if there is none, the fqn
32508 * @expose
32509 */
32510 NamespacePrototype.qn = function(t) {
32511 var part = [], ptr = t;
32512 do {
32513 part.unshift(ptr.name);
32514 ptr = ptr.parent;
32515 } while (ptr !== null);
32516 for (var len=1; len <= part.length; len++) {
32517 var qn = part.slice(part.length-len);
32518 if (t === this.resolve(qn, t instanceof Reflect.Namespace))
32519 return qn.join(".");
32520 }
32521 return t.fqn();
32522 };
32523
32524 /**
32525 * Builds the namespace and returns the runtime counterpart.
32526 * @return {Object.<string,Function|Object>} Runtime namespace
32527 * @expose
32528 */
32529 NamespacePrototype.build = function() {
32530 /** @dict */
32531 var ns = {};
32532 var children = this.children;
32533 for (var i=0, k=children.length, child; i<k; ++i) {
32534 child = children[i];
32535 if (child instanceof Namespace)
32536 ns[child.name] = child.build();
32537 }
32538 if (Object.defineProperty)
32539 Object.defineProperty(ns, "$options", { "value": this.buildOpt() });
32540 return ns;
32541 };
32542
32543 /**
32544 * Builds the namespace's '$options' property.
32545 * @return {Object.<string,*>}
32546 */
32547 NamespacePrototype.buildOpt = function() {
32548 var opt = {},
32549 keys = Object.keys(this.options);
32550 for (var i=0, k=keys.length; i<k; ++i) {
32551 var key = keys[i],
32552 val = this.options[keys[i]];
32553 // TODO: Options are not resolved, yet.
32554 // if (val instanceof Namespace) {
32555 // opt[key] = val.build();
32556 // } else {
32557 opt[key] = val;
32558 // }
32559 }
32560 return opt;
32561 };
32562
32563 /**
32564 * Gets the value assigned to the option with the specified name.
32565 * @param {string=} name Returns the option value if specified, otherwise all options are returned.
32566 * @return {*|Object.<string,*>}null} Option value or NULL if there is no such option
32567 */
32568 NamespacePrototype.getOption = function(name) {
32569 if (typeof name === 'undefined')
32570 return this.options;
32571 return typeof this.options[name] !== 'undefined' ? this.options[name] : null;
32572 };
32573
32574 /**
32575 * @alias ProtoBuf.Reflect.Namespace
32576 * @expose
32577 */
32578 Reflect.Namespace = Namespace;
32579
32580 /**
32581 * Constructs a new Element implementation that checks and converts values for a
32582 * particular field type, as appropriate.
32583 *
32584 * An Element represents a single value: either the value of a singular field,
32585 * or a value contained in one entry of a repeated field or map field. This
32586 * class does not implement these higher-level concepts; it only encapsulates
32587 * the low-level typechecking and conversion.
32588 *
32589 * @exports ProtoBuf.Reflect.Element
32590 * @param {{name: string, wireType: number}} type Resolved data type
32591 * @param {ProtoBuf.Reflect.T|null} resolvedType Resolved type, if relevant
32592 * (e.g. submessage field).
32593 * @param {boolean} isMapKey Is this element a Map key? The value will be
32594 * converted to string form if so.
32595 * @param {string} syntax Syntax level of defining message type, e.g.,
32596 * proto2 or proto3.
32597 * @param {string} name Name of the field containing this element (for error
32598 * messages)
32599 * @constructor
32600 */
32601 var Element = function(type, resolvedType, isMapKey, syntax, name) {
32602
32603 /**
32604 * Element type, as a string (e.g., int32).
32605 * @type {{name: string, wireType: number}}
32606 */
32607 this.type = type;
32608
32609 /**
32610 * Element type reference to submessage or enum definition, if needed.
32611 * @type {ProtoBuf.Reflect.T|null}
32612 */
32613 this.resolvedType = resolvedType;
32614
32615 /**
32616 * Element is a map key.
32617 * @type {boolean}
32618 */
32619 this.isMapKey = isMapKey;
32620
32621 /**
32622 * Syntax level of defining message type, e.g., proto2 or proto3.
32623 * @type {string}
32624 */
32625 this.syntax = syntax;
32626
32627 /**
32628 * Name of the field containing this element (for error messages)
32629 * @type {string}
32630 */
32631 this.name = name;
32632
32633 if (isMapKey && ProtoBuf.MAP_KEY_TYPES.indexOf(type) < 0)
32634 throw Error("Invalid map key type: " + type.name);
32635 };
32636
32637 var ElementPrototype = Element.prototype;
32638
32639 /**
32640 * Obtains a (new) default value for the specified type.
32641 * @param type {string|{name: string, wireType: number}} Field type
32642 * @returns {*} Default value
32643 * @inner
32644 */
32645 function mkDefault(type) {
32646 if (typeof type === 'string')
32647 type = ProtoBuf.TYPES[type];
32648 if (typeof type.defaultValue === 'undefined')
32649 throw Error("default value for type "+type.name+" is not supported");
32650 if (type == ProtoBuf.TYPES["bytes"])
32651 return new ByteBuffer(0);
32652 return type.defaultValue;
32653 }
32654
32655 /**
32656 * Returns the default value for this field in proto3.
32657 * @function
32658 * @param type {string|{name: string, wireType: number}} the field type
32659 * @returns {*} Default value
32660 */
32661 Element.defaultFieldValue = mkDefault;
32662
32663 /**
32664 * Makes a Long from a value.
32665 * @param {{low: number, high: number, unsigned: boolean}|string|number} value Value
32666 * @param {boolean=} unsigned Whether unsigned or not, defaults to reuse it from Long-like objects or to signed for
32667 * strings and numbers
32668 * @returns {!Long}
32669 * @throws {Error} If the value cannot be converted to a Long
32670 * @inner
32671 */
32672 function mkLong(value, unsigned) {
32673 if (value && typeof value.low === 'number' && typeof value.high === 'number' && typeof value.unsigned === 'boolean'
32674 && value.low === value.low && value.high === value.high)
32675 return new ProtoBuf.Long(value.low, value.high, typeof unsigned === 'undefined' ? value.unsigned : unsigned);
32676 if (typeof value === 'string')
32677 return ProtoBuf.Long.fromString(value, unsigned || false, 10);
32678 if (typeof value === 'number')
32679 return ProtoBuf.Long.fromNumber(value, unsigned || false);
32680 throw Error("not convertible to Long");
32681 }
32682
32683 ElementPrototype.toString = function() {
32684 return (this.name || '') + (this.isMapKey ? 'map' : 'value') + ' element';
32685 }
32686
32687 /**
32688 * Checks if the given value can be set for an element of this type (singular
32689 * field or one element of a repeated field or map).
32690 * @param {*} value Value to check
32691 * @return {*} Verified, maybe adjusted, value
32692 * @throws {Error} If the value cannot be verified for this element slot
32693 * @expose
32694 */
32695 ElementPrototype.verifyValue = function(value) {
32696 var self = this;
32697 function fail(val, msg) {
32698 throw Error("Illegal value for "+self.toString(true)+" of type "+self.type.name+": "+val+" ("+msg+")");
32699 }
32700 switch (this.type) {
32701 // Signed 32bit
32702 case ProtoBuf.TYPES["int32"]:
32703 case ProtoBuf.TYPES["sint32"]:
32704 case ProtoBuf.TYPES["sfixed32"]:
32705 // Account for !NaN: value === value
32706 if (typeof value !== 'number' || (value === value && value % 1 !== 0))
32707 fail(typeof value, "not an integer");
32708 return value > 4294967295 ? value | 0 : value;
32709
32710 // Unsigned 32bit
32711 case ProtoBuf.TYPES["uint32"]:
32712 case ProtoBuf.TYPES["fixed32"]:
32713 if (typeof value !== 'number' || (value === value && value % 1 !== 0))
32714 fail(typeof value, "not an integer");
32715 return value < 0 ? value >>> 0 : value;
32716
32717 // Signed 64bit
32718 case ProtoBuf.TYPES["int64"]:
32719 case ProtoBuf.TYPES["sint64"]:
32720 case ProtoBuf.TYPES["sfixed64"]: {
32721 if (ProtoBuf.Long)
32722 try {
32723 return mkLong(value, false);
32724 } catch (e) {
32725 fail(typeof value, e.message);
32726 }
32727 else
32728 fail(typeof value, "requires Long.js");
32729 }
32730
32731 // Unsigned 64bit
32732 case ProtoBuf.TYPES["uint64"]:
32733 case ProtoBuf.TYPES["fixed64"]: {
32734 if (ProtoBuf.Long)
32735 try {
32736 return mkLong(value, true);
32737 } catch (e) {
32738 fail(typeof value, e.message);
32739 }
32740 else
32741 fail(typeof value, "requires Long.js");
32742 }
32743
32744 // Bool
32745 case ProtoBuf.TYPES["bool"]:
32746 if (typeof value !== 'boolean')
32747 fail(typeof value, "not a boolean");
32748 return value;
32749
32750 // Float
32751 case ProtoBuf.TYPES["float"]:
32752 case ProtoBuf.TYPES["double"]:
32753 if (typeof value !== 'number')
32754 fail(typeof value, "not a number");
32755 return value;
32756
32757 // Length-delimited string
32758 case ProtoBuf.TYPES["string"]:
32759 if (typeof value !== 'string' && !(value && value instanceof String))
32760 fail(typeof value, "not a string");
32761 return ""+value; // Convert String object to string
32762
32763 // Length-delimited bytes
32764 case ProtoBuf.TYPES["bytes"]:
32765 if (ByteBuffer.isByteBuffer(value))
32766 return value;
32767 return ByteBuffer.wrap(value, "base64");
32768
32769 // Constant enum value
32770 case ProtoBuf.TYPES["enum"]: {
32771 var values = this.resolvedType.getChildren(ProtoBuf.Reflect.Enum.Value);
32772 for (i=0; i<values.length; i++)
32773 if (values[i].name == value)
32774 return values[i].id;
32775 else if (values[i].id == value)
32776 return values[i].id;
32777
32778 if (this.syntax === 'proto3') {
32779 // proto3: just make sure it's an integer.
32780 if (typeof value !== 'number' || (value === value && value % 1 !== 0))
32781 fail(typeof value, "not an integer");
32782 if (value > 4294967295 || value < 0)
32783 fail(typeof value, "not in range for uint32")
32784 return value;
32785 } else {
32786 // proto2 requires enum values to be valid.
32787 fail(value, "not a valid enum value");
32788 }
32789 }
32790 // Embedded message
32791 case ProtoBuf.TYPES["group"]:
32792 case ProtoBuf.TYPES["message"]: {
32793 if (!value || typeof value !== 'object')
32794 fail(typeof value, "object expected");
32795 if (value instanceof this.resolvedType.clazz)
32796 return value;
32797 if (value instanceof ProtoBuf.Builder.Message) {
32798 // Mismatched type: Convert to object (see: https://github.com/dcodeIO/ProtoBuf.js/issues/180)
32799 var obj = {};
32800 for (var i in value)
32801 if (value.hasOwnProperty(i))
32802 obj[i] = value[i];
32803 value = obj;
32804 }
32805 // Else let's try to construct one from a key-value object
32806 return new (this.resolvedType.clazz)(value); // May throw for a hundred of reasons
32807 }
32808 }
32809
32810 // We should never end here
32811 throw Error("[INTERNAL] Illegal value for "+this.toString(true)+": "+value+" (undefined type "+this.type+")");
32812 };
32813
32814 /**
32815 * Calculates the byte length of an element on the wire.
32816 * @param {number} id Field number
32817 * @param {*} value Field value
32818 * @returns {number} Byte length
32819 * @throws {Error} If the value cannot be calculated
32820 * @expose
32821 */
32822 ElementPrototype.calculateLength = function(id, value) {
32823 if (value === null) return 0; // Nothing to encode
32824 // Tag has already been written
32825 var n;
32826 switch (this.type) {
32827 case ProtoBuf.TYPES["int32"]:
32828 return value < 0 ? ByteBuffer.calculateVarint64(value) : ByteBuffer.calculateVarint32(value);
32829 case ProtoBuf.TYPES["uint32"]:
32830 return ByteBuffer.calculateVarint32(value);
32831 case ProtoBuf.TYPES["sint32"]:
32832 return ByteBuffer.calculateVarint32(ByteBuffer.zigZagEncode32(value));
32833 case ProtoBuf.TYPES["fixed32"]:
32834 case ProtoBuf.TYPES["sfixed32"]:
32835 case ProtoBuf.TYPES["float"]:
32836 return 4;
32837 case ProtoBuf.TYPES["int64"]:
32838 case ProtoBuf.TYPES["uint64"]:
32839 return ByteBuffer.calculateVarint64(value);
32840 case ProtoBuf.TYPES["sint64"]:
32841 return ByteBuffer.calculateVarint64(ByteBuffer.zigZagEncode64(value));
32842 case ProtoBuf.TYPES["fixed64"]:
32843 case ProtoBuf.TYPES["sfixed64"]:
32844 return 8;
32845 case ProtoBuf.TYPES["bool"]:
32846 return 1;
32847 case ProtoBuf.TYPES["enum"]:
32848 return ByteBuffer.calculateVarint32(value);
32849 case ProtoBuf.TYPES["double"]:
32850 return 8;
32851 case ProtoBuf.TYPES["string"]:
32852 n = ByteBuffer.calculateUTF8Bytes(value);
32853 return ByteBuffer.calculateVarint32(n) + n;
32854 case ProtoBuf.TYPES["bytes"]:
32855 if (value.remaining() < 0)
32856 throw Error("Illegal value for "+this.toString(true)+": "+value.remaining()+" bytes remaining");
32857 return ByteBuffer.calculateVarint32(value.remaining()) + value.remaining();
32858 case ProtoBuf.TYPES["message"]:
32859 n = this.resolvedType.calculate(value);
32860 return ByteBuffer.calculateVarint32(n) + n;
32861 case ProtoBuf.TYPES["group"]:
32862 n = this.resolvedType.calculate(value);
32863 return n + ByteBuffer.calculateVarint32((id << 3) | ProtoBuf.WIRE_TYPES.ENDGROUP);
32864 }
32865 // We should never end here
32866 throw Error("[INTERNAL] Illegal value to encode in "+this.toString(true)+": "+value+" (unknown type)");
32867 };
32868
32869 /**
32870 * Encodes a value to the specified buffer. Does not encode the key.
32871 * @param {number} id Field number
32872 * @param {*} value Field value
32873 * @param {ByteBuffer} buffer ByteBuffer to encode to
32874 * @return {ByteBuffer} The ByteBuffer for chaining
32875 * @throws {Error} If the value cannot be encoded
32876 * @expose
32877 */
32878 ElementPrototype.encodeValue = function(id, value, buffer) {
32879 if (value === null) return buffer; // Nothing to encode
32880 // Tag has already been written
32881
32882 switch (this.type) {
32883 // 32bit signed varint
32884 case ProtoBuf.TYPES["int32"]:
32885 // "If you use int32 or int64 as the type for a negative number, the resulting varint is always ten bytes
32886 // long – it is, effectively, treated like a very large unsigned integer." (see #122)
32887 if (value < 0)
32888 buffer.writeVarint64(value);
32889 else
32890 buffer.writeVarint32(value);
32891 break;
32892
32893 // 32bit unsigned varint
32894 case ProtoBuf.TYPES["uint32"]:
32895 buffer.writeVarint32(value);
32896 break;
32897
32898 // 32bit varint zig-zag
32899 case ProtoBuf.TYPES["sint32"]:
32900 buffer.writeVarint32ZigZag(value);
32901 break;
32902
32903 // Fixed unsigned 32bit
32904 case ProtoBuf.TYPES["fixed32"]:
32905 buffer.writeUint32(value);
32906 break;
32907
32908 // Fixed signed 32bit
32909 case ProtoBuf.TYPES["sfixed32"]:
32910 buffer.writeInt32(value);
32911 break;
32912
32913 // 64bit varint as-is
32914 case ProtoBuf.TYPES["int64"]:
32915 case ProtoBuf.TYPES["uint64"]:
32916 buffer.writeVarint64(value); // throws
32917 break;
32918
32919 // 64bit varint zig-zag
32920 case ProtoBuf.TYPES["sint64"]:
32921 buffer.writeVarint64ZigZag(value); // throws
32922 break;
32923
32924 // Fixed unsigned 64bit
32925 case ProtoBuf.TYPES["fixed64"]:
32926 buffer.writeUint64(value); // throws
32927 break;
32928
32929 // Fixed signed 64bit
32930 case ProtoBuf.TYPES["sfixed64"]:
32931 buffer.writeInt64(value); // throws
32932 break;
32933
32934 // Bool
32935 case ProtoBuf.TYPES["bool"]:
32936 if (typeof value === 'string')
32937 buffer.writeVarint32(value.toLowerCase() === 'false' ? 0 : !!value);
32938 else
32939 buffer.writeVarint32(value ? 1 : 0);
32940 break;
32941
32942 // Constant enum value
32943 case ProtoBuf.TYPES["enum"]:
32944 buffer.writeVarint32(value);
32945 break;
32946
32947 // 32bit float
32948 case ProtoBuf.TYPES["float"]:
32949 buffer.writeFloat32(value);
32950 break;
32951
32952 // 64bit float
32953 case ProtoBuf.TYPES["double"]:
32954 buffer.writeFloat64(value);
32955 break;
32956
32957 // Length-delimited string
32958 case ProtoBuf.TYPES["string"]:
32959 buffer.writeVString(value);
32960 break;
32961
32962 // Length-delimited bytes
32963 case ProtoBuf.TYPES["bytes"]:
32964 if (value.remaining() < 0)
32965 throw Error("Illegal value for "+this.toString(true)+": "+value.remaining()+" bytes remaining");
32966 var prevOffset = value.offset;
32967 buffer.writeVarint32(value.remaining());
32968 buffer.append(value);
32969 value.offset = prevOffset;
32970 break;
32971
32972 // Embedded message
32973 case ProtoBuf.TYPES["message"]:
32974 var bb = new ByteBuffer().LE();
32975 this.resolvedType.encode(value, bb);
32976 buffer.writeVarint32(bb.offset);
32977 buffer.append(bb.flip());
32978 break;
32979
32980 // Legacy group
32981 case ProtoBuf.TYPES["group"]:
32982 this.resolvedType.encode(value, buffer);
32983 buffer.writeVarint32((id << 3) | ProtoBuf.WIRE_TYPES.ENDGROUP);
32984 break;
32985
32986 default:
32987 // We should never end here
32988 throw Error("[INTERNAL] Illegal value to encode in "+this.toString(true)+": "+value+" (unknown type)");
32989 }
32990 return buffer;
32991 };
32992
32993 /**
32994 * Decode one element value from the specified buffer.
32995 * @param {ByteBuffer} buffer ByteBuffer to decode from
32996 * @param {number} wireType The field wire type
32997 * @param {number} id The field number
32998 * @return {*} Decoded value
32999 * @throws {Error} If the field cannot be decoded
33000 * @expose
33001 */
33002 ElementPrototype.decode = function(buffer, wireType, id) {
33003 if (wireType != this.type.wireType)
33004 throw Error("Unexpected wire type for element");
33005
33006 var value, nBytes;
33007 switch (this.type) {
33008 // 32bit signed varint
33009 case ProtoBuf.TYPES["int32"]:
33010 return buffer.readVarint32() | 0;
33011
33012 // 32bit unsigned varint
33013 case ProtoBuf.TYPES["uint32"]:
33014 return buffer.readVarint32() >>> 0;
33015
33016 // 32bit signed varint zig-zag
33017 case ProtoBuf.TYPES["sint32"]:
33018 return buffer.readVarint32ZigZag() | 0;
33019
33020 // Fixed 32bit unsigned
33021 case ProtoBuf.TYPES["fixed32"]:
33022 return buffer.readUint32() >>> 0;
33023
33024 case ProtoBuf.TYPES["sfixed32"]:
33025 return buffer.readInt32() | 0;
33026
33027 // 64bit signed varint
33028 case ProtoBuf.TYPES["int64"]:
33029 return buffer.readVarint64();
33030
33031 // 64bit unsigned varint
33032 case ProtoBuf.TYPES["uint64"]:
33033 return buffer.readVarint64().toUnsigned();
33034
33035 // 64bit signed varint zig-zag
33036 case ProtoBuf.TYPES["sint64"]:
33037 return buffer.readVarint64ZigZag();
33038
33039 // Fixed 64bit unsigned
33040 case ProtoBuf.TYPES["fixed64"]:
33041 return buffer.readUint64();
33042
33043 // Fixed 64bit signed
33044 case ProtoBuf.TYPES["sfixed64"]:
33045 return buffer.readInt64();
33046
33047 // Bool varint
33048 case ProtoBuf.TYPES["bool"]:
33049 return !!buffer.readVarint32();
33050
33051 // Constant enum value (varint)
33052 case ProtoBuf.TYPES["enum"]:
33053 // The following Builder.Message#set will already throw
33054 return buffer.readVarint32();
33055
33056 // 32bit float
33057 case ProtoBuf.TYPES["float"]:
33058 return buffer.readFloat();
33059
33060 // 64bit float
33061 case ProtoBuf.TYPES["double"]:
33062 return buffer.readDouble();
33063
33064 // Length-delimited string
33065 case ProtoBuf.TYPES["string"]:
33066 return buffer.readVString();
33067
33068 // Length-delimited bytes
33069 case ProtoBuf.TYPES["bytes"]: {
33070 nBytes = buffer.readVarint32();
33071 if (buffer.remaining() < nBytes)
33072 throw Error("Illegal number of bytes for "+this.toString(true)+": "+nBytes+" required but got only "+buffer.remaining());
33073 value = buffer.clone(); // Offset already set
33074 value.limit = value.offset+nBytes;
33075 buffer.offset += nBytes;
33076 return value;
33077 }
33078
33079 // Length-delimited embedded message
33080 case ProtoBuf.TYPES["message"]: {
33081 nBytes = buffer.readVarint32();
33082 return this.resolvedType.decode(buffer, nBytes);
33083 }
33084
33085 // Legacy group
33086 case ProtoBuf.TYPES["group"]:
33087 return this.resolvedType.decode(buffer, -1, id);
33088 }
33089
33090 // We should never end here
33091 throw Error("[INTERNAL] Illegal decode type");
33092 };
33093
33094 /**
33095 * Converts a value from a string to the canonical element type.
33096 *
33097 * Legal only when isMapKey is true.
33098 *
33099 * @param {string} str The string value
33100 * @returns {*} The value
33101 */
33102 ElementPrototype.valueFromString = function(str) {
33103 if (!this.isMapKey) {
33104 throw Error("valueFromString() called on non-map-key element");
33105 }
33106
33107 switch (this.type) {
33108 case ProtoBuf.TYPES["int32"]:
33109 case ProtoBuf.TYPES["sint32"]:
33110 case ProtoBuf.TYPES["sfixed32"]:
33111 case ProtoBuf.TYPES["uint32"]:
33112 case ProtoBuf.TYPES["fixed32"]:
33113 return this.verifyValue(parseInt(str));
33114
33115 case ProtoBuf.TYPES["int64"]:
33116 case ProtoBuf.TYPES["sint64"]:
33117 case ProtoBuf.TYPES["sfixed64"]:
33118 case ProtoBuf.TYPES["uint64"]:
33119 case ProtoBuf.TYPES["fixed64"]:
33120 // Long-based fields support conversions from string already.
33121 return this.verifyValue(str);
33122
33123 case ProtoBuf.TYPES["bool"]:
33124 return str === "true";
33125
33126 case ProtoBuf.TYPES["string"]:
33127 return this.verifyValue(str);
33128
33129 case ProtoBuf.TYPES["bytes"]:
33130 return ByteBuffer.fromBinary(str);
33131 }
33132 };
33133
33134 /**
33135 * Converts a value from the canonical element type to a string.
33136 *
33137 * It should be the case that `valueFromString(valueToString(val))` returns
33138 * a value equivalent to `verifyValue(val)` for every legal value of `val`
33139 * according to this element type.
33140 *
33141 * This may be used when the element must be stored or used as a string,
33142 * e.g., as a map key on an Object.
33143 *
33144 * Legal only when isMapKey is true.
33145 *
33146 * @param {*} val The value
33147 * @returns {string} The string form of the value.
33148 */
33149 ElementPrototype.valueToString = function(value) {
33150 if (!this.isMapKey) {
33151 throw Error("valueToString() called on non-map-key element");
33152 }
33153
33154 if (this.type === ProtoBuf.TYPES["bytes"]) {
33155 return value.toString("binary");
33156 } else {
33157 return value.toString();
33158 }
33159 };
33160
33161 /**
33162 * @alias ProtoBuf.Reflect.Element
33163 * @expose
33164 */
33165 Reflect.Element = Element;
33166
33167 /**
33168 * Constructs a new Message.
33169 * @exports ProtoBuf.Reflect.Message
33170 * @param {!ProtoBuf.Builder} builder Builder reference
33171 * @param {!ProtoBuf.Reflect.Namespace} parent Parent message or namespace
33172 * @param {string} name Message name
33173 * @param {Object.<string,*>=} options Message options
33174 * @param {boolean=} isGroup `true` if this is a legacy group
33175 * @param {string?} syntax The syntax level of this definition (e.g., proto3)
33176 * @constructor
33177 * @extends ProtoBuf.Reflect.Namespace
33178 */
33179 var Message = function(builder, parent, name, options, isGroup, syntax) {
33180 Namespace.call(this, builder, parent, name, options, syntax);
33181
33182 /**
33183 * @override
33184 */
33185 this.className = "Message";
33186
33187 /**
33188 * Extensions range.
33189 * @type {!Array.<number>|undefined}
33190 * @expose
33191 */
33192 this.extensions = undefined;
33193
33194 /**
33195 * Runtime message class.
33196 * @type {?function(new:ProtoBuf.Builder.Message)}
33197 * @expose
33198 */
33199 this.clazz = null;
33200
33201 /**
33202 * Whether this is a legacy group or not.
33203 * @type {boolean}
33204 * @expose
33205 */
33206 this.isGroup = !!isGroup;
33207
33208 // The following cached collections are used to efficiently iterate over or look up fields when decoding.
33209
33210 /**
33211 * Cached fields.
33212 * @type {?Array.<!ProtoBuf.Reflect.Message.Field>}
33213 * @private
33214 */
33215 this._fields = null;
33216
33217 /**
33218 * Cached fields by id.
33219 * @type {?Object.<number,!ProtoBuf.Reflect.Message.Field>}
33220 * @private
33221 */
33222 this._fieldsById = null;
33223
33224 /**
33225 * Cached fields by name.
33226 * @type {?Object.<string,!ProtoBuf.Reflect.Message.Field>}
33227 * @private
33228 */
33229 this._fieldsByName = null;
33230 };
33231
33232 /**
33233 * @alias ProtoBuf.Reflect.Message.prototype
33234 * @inner
33235 */
33236 var MessagePrototype = Message.prototype = Object.create(Namespace.prototype);
33237
33238 /**
33239 * Builds the message and returns the runtime counterpart, which is a fully functional class.
33240 * @see ProtoBuf.Builder.Message
33241 * @param {boolean=} rebuild Whether to rebuild or not, defaults to false
33242 * @return {ProtoBuf.Reflect.Message} Message class
33243 * @throws {Error} If the message cannot be built
33244 * @expose
33245 */
33246 MessagePrototype.build = function(rebuild) {
33247 if (this.clazz && !rebuild)
33248 return this.clazz;
33249
33250 // Create the runtime Message class in its own scope
33251 var clazz = (function(ProtoBuf, T) {
33252
33253 var fields = T.getChildren(ProtoBuf.Reflect.Message.Field),
33254 oneofs = T.getChildren(ProtoBuf.Reflect.Message.OneOf);
33255
33256 /**
33257 * Constructs a new runtime Message.
33258 * @name ProtoBuf.Builder.Message
33259 * @class Barebone of all runtime messages.
33260 * @param {!Object.<string,*>|string} values Preset values
33261 * @param {...string} var_args
33262 * @constructor
33263 * @throws {Error} If the message cannot be created
33264 */
33265 var Message = function(values, var_args) {
33266 ProtoBuf.Builder.Message.call(this);
33267
33268 // Create virtual oneof properties
33269 for (var i=0, k=oneofs.length; i<k; ++i)
33270 this[oneofs[i].name] = null;
33271 // Create fields and set default values
33272 for (i=0, k=fields.length; i<k; ++i) {
33273 var field = fields[i];
33274 this[field.name] =
33275 field.repeated ? [] :
33276 (field.map ? new ProtoBuf.Map(field) : null);
33277 if ((field.required || T.syntax === 'proto3') &&
33278 field.defaultValue !== null)
33279 this[field.name] = field.defaultValue;
33280 }
33281
33282 if (arguments.length > 0) {
33283 var value;
33284 // Set field values from a values object
33285 if (arguments.length === 1 && values !== null && typeof values === 'object' &&
33286 /* not _another_ Message */ (typeof values.encode !== 'function' || values instanceof Message) &&
33287 /* not a repeated field */ !Array.isArray(values) &&
33288 /* not a Map */ !(values instanceof ProtoBuf.Map) &&
33289 /* not a ByteBuffer */ !ByteBuffer.isByteBuffer(values) &&
33290 /* not an ArrayBuffer */ !(values instanceof ArrayBuffer) &&
33291 /* not a Long */ !(ProtoBuf.Long && values instanceof ProtoBuf.Long)) {
33292 this.$set(values);
33293 } else // Set field values from arguments, in declaration order
33294 for (i=0, k=arguments.length; i<k; ++i)
33295 if (typeof (value = arguments[i]) !== 'undefined')
33296 this.$set(fields[i].name, value); // May throw
33297 }
33298 };
33299
33300 /**
33301 * @alias ProtoBuf.Builder.Message.prototype
33302 * @inner
33303 */
33304 var MessagePrototype = Message.prototype = Object.create(ProtoBuf.Builder.Message.prototype);
33305
33306 /**
33307 * Adds a value to a repeated field.
33308 * @name ProtoBuf.Builder.Message#add
33309 * @function
33310 * @param {string} key Field name
33311 * @param {*} value Value to add
33312 * @param {boolean=} noAssert Whether to assert the value or not (asserts by default)
33313 * @returns {!ProtoBuf.Builder.Message} this
33314 * @throws {Error} If the value cannot be added
33315 * @expose
33316 */
33317 MessagePrototype.add = function(key, value, noAssert) {
33318 var field = T._fieldsByName[key];
33319 if (!noAssert) {
33320 if (!field)
33321 throw Error(this+"#"+key+" is undefined");
33322 if (!(field instanceof ProtoBuf.Reflect.Message.Field))
33323 throw Error(this+"#"+key+" is not a field: "+field.toString(true)); // May throw if it's an enum or embedded message
33324 if (!field.repeated)
33325 throw Error(this+"#"+key+" is not a repeated field");
33326 value = field.verifyValue(value, true);
33327 }
33328 if (this[key] === null)
33329 this[key] = [];
33330 this[key].push(value);
33331 return this;
33332 };
33333
33334 /**
33335 * Adds a value to a repeated field. This is an alias for {@link ProtoBuf.Builder.Message#add}.
33336 * @name ProtoBuf.Builder.Message#$add
33337 * @function
33338 * @param {string} key Field name
33339 * @param {*} value Value to add
33340 * @param {boolean=} noAssert Whether to assert the value or not (asserts by default)
33341 * @returns {!ProtoBuf.Builder.Message} this
33342 * @throws {Error} If the value cannot be added
33343 * @expose
33344 */
33345 MessagePrototype.$add = MessagePrototype.add;
33346
33347 /**
33348 * Sets a field's value.
33349 * @name ProtoBuf.Builder.Message#set
33350 * @function
33351 * @param {string|!Object.<string,*>} keyOrObj String key or plain object holding multiple values
33352 * @param {(*|boolean)=} value Value to set if key is a string, otherwise omitted
33353 * @param {boolean=} noAssert Whether to not assert for an actual field / proper value type, defaults to `false`
33354 * @returns {!ProtoBuf.Builder.Message} this
33355 * @throws {Error} If the value cannot be set
33356 * @expose
33357 */
33358 MessagePrototype.set = function(keyOrObj, value, noAssert) {
33359 if (keyOrObj && typeof keyOrObj === 'object') {
33360 noAssert = value;
33361 for (var ikey in keyOrObj) {
33362 // Check if virtual oneof field - don't set these
33363 if (keyOrObj.hasOwnProperty(ikey) && typeof (value = keyOrObj[ikey]) !== 'undefined' && T._oneofsByName[ikey] === undefined)
33364 this.$set(ikey, value, noAssert);
33365 }
33366 return this;
33367 }
33368 var field = T._fieldsByName[keyOrObj];
33369 if (!noAssert) {
33370 if (!field)
33371 throw Error(this+"#"+keyOrObj+" is not a field: undefined");
33372 if (!(field instanceof ProtoBuf.Reflect.Message.Field))
33373 throw Error(this+"#"+keyOrObj+" is not a field: "+field.toString(true));
33374 this[field.name] = (value = field.verifyValue(value)); // May throw
33375 } else
33376 this[keyOrObj] = value;
33377 if (field && field.oneof) { // Field is part of an OneOf (not a virtual OneOf field)
33378 var currentField = this[field.oneof.name]; // Virtual field references currently set field
33379 if (value !== null) {
33380 if (currentField !== null && currentField !== field.name)
33381 this[currentField] = null; // Clear currently set field
33382 this[field.oneof.name] = field.name; // Point virtual field at this field
33383 } else if (/* value === null && */currentField === keyOrObj)
33384 this[field.oneof.name] = null; // Clear virtual field (current field explicitly cleared)
33385 }
33386 return this;
33387 };
33388
33389 /**
33390 * Sets a field's value. This is an alias for [@link ProtoBuf.Builder.Message#set}.
33391 * @name ProtoBuf.Builder.Message#$set
33392 * @function
33393 * @param {string|!Object.<string,*>} keyOrObj String key or plain object holding multiple values
33394 * @param {(*|boolean)=} value Value to set if key is a string, otherwise omitted
33395 * @param {boolean=} noAssert Whether to not assert the value, defaults to `false`
33396 * @throws {Error} If the value cannot be set
33397 * @expose
33398 */
33399 MessagePrototype.$set = MessagePrototype.set;
33400
33401 /**
33402 * Gets a field's value.
33403 * @name ProtoBuf.Builder.Message#get
33404 * @function
33405 * @param {string} key Key
33406 * @param {boolean=} noAssert Whether to not assert for an actual field, defaults to `false`
33407 * @return {*} Value
33408 * @throws {Error} If there is no such field
33409 * @expose
33410 */
33411 MessagePrototype.get = function(key, noAssert) {
33412 if (noAssert)
33413 return this[key];
33414 var field = T._fieldsByName[key];
33415 if (!field || !(field instanceof ProtoBuf.Reflect.Message.Field))
33416 throw Error(this+"#"+key+" is not a field: undefined");
33417 if (!(field instanceof ProtoBuf.Reflect.Message.Field))
33418 throw Error(this+"#"+key+" is not a field: "+field.toString(true));
33419 return this[field.name];
33420 };
33421
33422 /**
33423 * Gets a field's value. This is an alias for {@link ProtoBuf.Builder.Message#$get}.
33424 * @name ProtoBuf.Builder.Message#$get
33425 * @function
33426 * @param {string} key Key
33427 * @return {*} Value
33428 * @throws {Error} If there is no such field
33429 * @expose
33430 */
33431 MessagePrototype.$get = MessagePrototype.get;
33432
33433 // Getters and setters
33434
33435 for (var i=0; i<fields.length; i++) {
33436 var field = fields[i];
33437 // no setters for extension fields as these are named by their fqn
33438 if (field instanceof ProtoBuf.Reflect.Message.ExtensionField)
33439 continue;
33440
33441 if (T.builder.options['populateAccessors'])
33442 (function(field) {
33443 // set/get[SomeValue]
33444 var Name = field.originalName.replace(/(_[a-zA-Z])/g, function(match) {
33445 return match.toUpperCase().replace('_','');
33446 });
33447 Name = Name.substring(0,1).toUpperCase() + Name.substring(1);
33448
33449 // set/get_[some_value] FIXME: Do we really need these?
33450 var name = field.originalName.replace(/([A-Z])/g, function(match) {
33451 return "_"+match;
33452 });
33453
33454 /**
33455 * The current field's unbound setter function.
33456 * @function
33457 * @param {*} value
33458 * @param {boolean=} noAssert
33459 * @returns {!ProtoBuf.Builder.Message}
33460 * @inner
33461 */
33462 var setter = function(value, noAssert) {
33463 this[field.name] = noAssert ? value : field.verifyValue(value);
33464 return this;
33465 };
33466
33467 /**
33468 * The current field's unbound getter function.
33469 * @function
33470 * @returns {*}
33471 * @inner
33472 */
33473 var getter = function() {
33474 return this[field.name];
33475 };
33476
33477 if (T.getChild("set"+Name) === null)
33478 /**
33479 * Sets a value. This method is present for each field, but only if there is no name conflict with
33480 * another field.
33481 * @name ProtoBuf.Builder.Message#set[SomeField]
33482 * @function
33483 * @param {*} value Value to set
33484 * @param {boolean=} noAssert Whether to not assert the value, defaults to `false`
33485 * @returns {!ProtoBuf.Builder.Message} this
33486 * @abstract
33487 * @throws {Error} If the value cannot be set
33488 */
33489 MessagePrototype["set"+Name] = setter;
33490
33491 if (T.getChild("set_"+name) === null)
33492 /**
33493 * Sets a value. This method is present for each field, but only if there is no name conflict with
33494 * another field.
33495 * @name ProtoBuf.Builder.Message#set_[some_field]
33496 * @function
33497 * @param {*} value Value to set
33498 * @param {boolean=} noAssert Whether to not assert the value, defaults to `false`
33499 * @returns {!ProtoBuf.Builder.Message} this
33500 * @abstract
33501 * @throws {Error} If the value cannot be set
33502 */
33503 MessagePrototype["set_"+name] = setter;
33504
33505 if (T.getChild("get"+Name) === null)
33506 /**
33507 * Gets a value. This method is present for each field, but only if there is no name conflict with
33508 * another field.
33509 * @name ProtoBuf.Builder.Message#get[SomeField]
33510 * @function
33511 * @abstract
33512 * @return {*} The value
33513 */
33514 MessagePrototype["get"+Name] = getter;
33515
33516 if (T.getChild("get_"+name) === null)
33517 /**
33518 * Gets a value. This method is present for each field, but only if there is no name conflict with
33519 * another field.
33520 * @name ProtoBuf.Builder.Message#get_[some_field]
33521 * @function
33522 * @return {*} The value
33523 * @abstract
33524 */
33525 MessagePrototype["get_"+name] = getter;
33526
33527 })(field);
33528 }
33529
33530 // En-/decoding
33531
33532 /**
33533 * Encodes the message.
33534 * @name ProtoBuf.Builder.Message#$encode
33535 * @function
33536 * @param {(!ByteBuffer|boolean)=} buffer ByteBuffer to encode to. Will create a new one and flip it if omitted.
33537 * @param {boolean=} noVerify Whether to not verify field values, defaults to `false`
33538 * @return {!ByteBuffer} Encoded message as a ByteBuffer
33539 * @throws {Error} If the message cannot be encoded or if required fields are missing. The later still
33540 * returns the encoded ByteBuffer in the `encoded` property on the error.
33541 * @expose
33542 * @see ProtoBuf.Builder.Message#encode64
33543 * @see ProtoBuf.Builder.Message#encodeHex
33544 * @see ProtoBuf.Builder.Message#encodeAB
33545 */
33546 MessagePrototype.encode = function(buffer, noVerify) {
33547 if (typeof buffer === 'boolean')
33548 noVerify = buffer,
33549 buffer = undefined;
33550 var isNew = false;
33551 if (!buffer)
33552 buffer = new ByteBuffer(),
33553 isNew = true;
33554 var le = buffer.littleEndian;
33555 try {
33556 T.encode(this, buffer.LE(), noVerify);
33557 return (isNew ? buffer.flip() : buffer).LE(le);
33558 } catch (e) {
33559 buffer.LE(le);
33560 throw(e);
33561 }
33562 };
33563
33564 /**
33565 * Encodes a message using the specified data payload.
33566 * @param {!Object.<string,*>} data Data payload
33567 * @param {(!ByteBuffer|boolean)=} buffer ByteBuffer to encode to. Will create a new one and flip it if omitted.
33568 * @param {boolean=} noVerify Whether to not verify field values, defaults to `false`
33569 * @return {!ByteBuffer} Encoded message as a ByteBuffer
33570 * @expose
33571 */
33572 Message.encode = function(data, buffer, noVerify) {
33573 return new Message(data).encode(buffer, noVerify);
33574 };
33575
33576 /**
33577 * Calculates the byte length of the message.
33578 * @name ProtoBuf.Builder.Message#calculate
33579 * @function
33580 * @returns {number} Byte length
33581 * @throws {Error} If the message cannot be calculated or if required fields are missing.
33582 * @expose
33583 */
33584 MessagePrototype.calculate = function() {
33585 return T.calculate(this);
33586 };
33587
33588 /**
33589 * Encodes the varint32 length-delimited message.
33590 * @name ProtoBuf.Builder.Message#encodeDelimited
33591 * @function
33592 * @param {(!ByteBuffer|boolean)=} buffer ByteBuffer to encode to. Will create a new one and flip it if omitted.
33593 * @param {boolean=} noVerify Whether to not verify field values, defaults to `false`
33594 * @return {!ByteBuffer} Encoded message as a ByteBuffer
33595 * @throws {Error} If the message cannot be encoded or if required fields are missing. The later still
33596 * returns the encoded ByteBuffer in the `encoded` property on the error.
33597 * @expose
33598 */
33599 MessagePrototype.encodeDelimited = function(buffer, noVerify) {
33600 var isNew = false;
33601 if (!buffer)
33602 buffer = new ByteBuffer(),
33603 isNew = true;
33604 var enc = new ByteBuffer().LE();
33605 T.encode(this, enc, noVerify).flip();
33606 buffer.writeVarint32(enc.remaining());
33607 buffer.append(enc);
33608 return isNew ? buffer.flip() : buffer;
33609 };
33610
33611 /**
33612 * Directly encodes the message to an ArrayBuffer.
33613 * @name ProtoBuf.Builder.Message#encodeAB
33614 * @function
33615 * @return {ArrayBuffer} Encoded message as ArrayBuffer
33616 * @throws {Error} If the message cannot be encoded or if required fields are missing. The later still
33617 * returns the encoded ArrayBuffer in the `encoded` property on the error.
33618 * @expose
33619 */
33620 MessagePrototype.encodeAB = function() {
33621 try {
33622 return this.encode().toArrayBuffer();
33623 } catch (e) {
33624 if (e["encoded"]) e["encoded"] = e["encoded"].toArrayBuffer();
33625 throw(e);
33626 }
33627 };
33628
33629 /**
33630 * Returns the message as an ArrayBuffer. This is an alias for {@link ProtoBuf.Builder.Message#encodeAB}.
33631 * @name ProtoBuf.Builder.Message#toArrayBuffer
33632 * @function
33633 * @return {ArrayBuffer} Encoded message as ArrayBuffer
33634 * @throws {Error} If the message cannot be encoded or if required fields are missing. The later still
33635 * returns the encoded ArrayBuffer in the `encoded` property on the error.
33636 * @expose
33637 */
33638 MessagePrototype.toArrayBuffer = MessagePrototype.encodeAB;
33639
33640 /**
33641 * Directly encodes the message to a node Buffer.
33642 * @name ProtoBuf.Builder.Message#encodeNB
33643 * @function
33644 * @return {!Buffer}
33645 * @throws {Error} If the message cannot be encoded, not running under node.js or if required fields are
33646 * missing. The later still returns the encoded node Buffer in the `encoded` property on the error.
33647 * @expose
33648 */
33649 MessagePrototype.encodeNB = function() {
33650 try {
33651 return this.encode().toBuffer();
33652 } catch (e) {
33653 if (e["encoded"]) e["encoded"] = e["encoded"].toBuffer();
33654 throw(e);
33655 }
33656 };
33657
33658 /**
33659 * Returns the message as a node Buffer. This is an alias for {@link ProtoBuf.Builder.Message#encodeNB}.
33660 * @name ProtoBuf.Builder.Message#toBuffer
33661 * @function
33662 * @return {!Buffer}
33663 * @throws {Error} If the message cannot be encoded or if required fields are missing. The later still
33664 * returns the encoded node Buffer in the `encoded` property on the error.
33665 * @expose
33666 */
33667 MessagePrototype.toBuffer = MessagePrototype.encodeNB;
33668
33669 /**
33670 * Directly encodes the message to a base64 encoded string.
33671 * @name ProtoBuf.Builder.Message#encode64
33672 * @function
33673 * @return {string} Base64 encoded string
33674 * @throws {Error} If the underlying buffer cannot be encoded or if required fields are missing. The later
33675 * still returns the encoded base64 string in the `encoded` property on the error.
33676 * @expose
33677 */
33678 MessagePrototype.encode64 = function() {
33679 try {
33680 return this.encode().toBase64();
33681 } catch (e) {
33682 if (e["encoded"]) e["encoded"] = e["encoded"].toBase64();
33683 throw(e);
33684 }
33685 };
33686
33687 /**
33688 * Returns the message as a base64 encoded string. This is an alias for {@link ProtoBuf.Builder.Message#encode64}.
33689 * @name ProtoBuf.Builder.Message#toBase64
33690 * @function
33691 * @return {string} Base64 encoded string
33692 * @throws {Error} If the message cannot be encoded or if required fields are missing. The later still
33693 * returns the encoded base64 string in the `encoded` property on the error.
33694 * @expose
33695 */
33696 MessagePrototype.toBase64 = MessagePrototype.encode64;
33697
33698 /**
33699 * Directly encodes the message to a hex encoded string.
33700 * @name ProtoBuf.Builder.Message#encodeHex
33701 * @function
33702 * @return {string} Hex encoded string
33703 * @throws {Error} If the underlying buffer cannot be encoded or if required fields are missing. The later
33704 * still returns the encoded hex string in the `encoded` property on the error.
33705 * @expose
33706 */
33707 MessagePrototype.encodeHex = function() {
33708 try {
33709 return this.encode().toHex();
33710 } catch (e) {
33711 if (e["encoded"]) e["encoded"] = e["encoded"].toHex();
33712 throw(e);
33713 }
33714 };
33715
33716 /**
33717 * Returns the message as a hex encoded string. This is an alias for {@link ProtoBuf.Builder.Message#encodeHex}.
33718 * @name ProtoBuf.Builder.Message#toHex
33719 * @function
33720 * @return {string} Hex encoded string
33721 * @throws {Error} If the message cannot be encoded or if required fields are missing. The later still
33722 * returns the encoded hex string in the `encoded` property on the error.
33723 * @expose
33724 */
33725 MessagePrototype.toHex = MessagePrototype.encodeHex;
33726
33727 /**
33728 * Clones a message object or field value to a raw object.
33729 * @param {*} obj Object to clone
33730 * @param {boolean} binaryAsBase64 Whether to include binary data as base64 strings or as a buffer otherwise
33731 * @param {boolean} longsAsStrings Whether to encode longs as strings
33732 * @param {!ProtoBuf.Reflect.T=} resolvedType The resolved field type if a field
33733 * @returns {*} Cloned object
33734 * @inner
33735 */
33736 function cloneRaw(obj, binaryAsBase64, longsAsStrings, resolvedType) {
33737 if (obj === null || typeof obj !== 'object') {
33738 // Convert enum values to their respective names
33739 if (resolvedType && resolvedType instanceof ProtoBuf.Reflect.Enum) {
33740 var name = ProtoBuf.Reflect.Enum.getName(resolvedType.object, obj);
33741 if (name !== null)
33742 return name;
33743 }
33744 // Pass-through string, number, boolean, null...
33745 return obj;
33746 }
33747 // Convert ByteBuffers to raw buffer or strings
33748 if (ByteBuffer.isByteBuffer(obj))
33749 return binaryAsBase64 ? obj.toBase64() : obj.toBuffer();
33750 // Convert Longs to proper objects or strings
33751 if (ProtoBuf.Long.isLong(obj))
33752 return longsAsStrings ? obj.toString() : ProtoBuf.Long.fromValue(obj);
33753 var clone;
33754 // Clone arrays
33755 if (Array.isArray(obj)) {
33756 clone = [];
33757 obj.forEach(function(v, k) {
33758 clone[k] = cloneRaw(v, binaryAsBase64, longsAsStrings, resolvedType);
33759 });
33760 return clone;
33761 }
33762 clone = {};
33763 // Convert maps to objects
33764 if (obj instanceof ProtoBuf.Map) {
33765 var it = obj.entries();
33766 for (var e = it.next(); !e.done; e = it.next())
33767 clone[obj.keyElem.valueToString(e.value[0])] = cloneRaw(e.value[1], binaryAsBase64, longsAsStrings, obj.valueElem.resolvedType);
33768 return clone;
33769 }
33770 // Everything else is a non-null object
33771 var type = obj.$type,
33772 field = undefined;
33773 for (var i in obj)
33774 if (obj.hasOwnProperty(i)) {
33775 if (type && (field = type.getChild(i)))
33776 clone[i] = cloneRaw(obj[i], binaryAsBase64, longsAsStrings, field.resolvedType);
33777 else
33778 clone[i] = cloneRaw(obj[i], binaryAsBase64, longsAsStrings);
33779 }
33780 return clone;
33781 }
33782
33783 /**
33784 * Returns the message's raw payload.
33785 * @param {boolean=} binaryAsBase64 Whether to include binary data as base64 strings instead of Buffers, defaults to `false`
33786 * @param {boolean} longsAsStrings Whether to encode longs as strings
33787 * @returns {Object.<string,*>} Raw payload
33788 * @expose
33789 */
33790 MessagePrototype.toRaw = function(binaryAsBase64, longsAsStrings) {
33791 return cloneRaw(this, !!binaryAsBase64, !!longsAsStrings, this.$type);
33792 };
33793
33794 /**
33795 * Encodes a message to JSON.
33796 * @returns {string} JSON string
33797 * @expose
33798 */
33799 MessagePrototype.encodeJSON = function() {
33800 return JSON.stringify(
33801 cloneRaw(this,
33802 /* binary-as-base64 */ true,
33803 /* longs-as-strings */ true,
33804 this.$type
33805 )
33806 );
33807 };
33808
33809 /**
33810 * Decodes a message from the specified buffer or string.
33811 * @name ProtoBuf.Builder.Message.decode
33812 * @function
33813 * @param {!ByteBuffer|!ArrayBuffer|!Buffer|string} buffer Buffer to decode from
33814 * @param {(number|string)=} length Message length. Defaults to decode all the remainig data.
33815 * @param {string=} enc Encoding if buffer is a string: hex, utf8 (not recommended), defaults to base64
33816 * @return {!ProtoBuf.Builder.Message} Decoded message
33817 * @throws {Error} If the message cannot be decoded or if required fields are missing. The later still
33818 * returns the decoded message with missing fields in the `decoded` property on the error.
33819 * @expose
33820 * @see ProtoBuf.Builder.Message.decode64
33821 * @see ProtoBuf.Builder.Message.decodeHex
33822 */
33823 Message.decode = function(buffer, length, enc) {
33824 if (typeof length === 'string')
33825 enc = length,
33826 length = -1;
33827 if (typeof buffer === 'string')
33828 buffer = ByteBuffer.wrap(buffer, enc ? enc : "base64");
33829 else if (!ByteBuffer.isByteBuffer(buffer))
33830 buffer = ByteBuffer.wrap(buffer); // May throw
33831 var le = buffer.littleEndian;
33832 try {
33833 var msg = T.decode(buffer.LE(), length);
33834 buffer.LE(le);
33835 return msg;
33836 } catch (e) {
33837 buffer.LE(le);
33838 throw(e);
33839 }
33840 };
33841
33842 /**
33843 * Decodes a varint32 length-delimited message from the specified buffer or string.
33844 * @name ProtoBuf.Builder.Message.decodeDelimited
33845 * @function
33846 * @param {!ByteBuffer|!ArrayBuffer|!Buffer|string} buffer Buffer to decode from
33847 * @param {string=} enc Encoding if buffer is a string: hex, utf8 (not recommended), defaults to base64
33848 * @return {ProtoBuf.Builder.Message} Decoded message or `null` if not enough bytes are available yet
33849 * @throws {Error} If the message cannot be decoded or if required fields are missing. The later still
33850 * returns the decoded message with missing fields in the `decoded` property on the error.
33851 * @expose
33852 */
33853 Message.decodeDelimited = function(buffer, enc) {
33854 if (typeof buffer === 'string')
33855 buffer = ByteBuffer.wrap(buffer, enc ? enc : "base64");
33856 else if (!ByteBuffer.isByteBuffer(buffer))
33857 buffer = ByteBuffer.wrap(buffer); // May throw
33858 if (buffer.remaining() < 1)
33859 return null;
33860 var off = buffer.offset,
33861 len = buffer.readVarint32();
33862 if (buffer.remaining() < len) {
33863 buffer.offset = off;
33864 return null;
33865 }
33866 try {
33867 var msg = T.decode(buffer.slice(buffer.offset, buffer.offset + len).LE());
33868 buffer.offset += len;
33869 return msg;
33870 } catch (err) {
33871 buffer.offset += len;
33872 throw err;
33873 }
33874 };
33875
33876 /**
33877 * Decodes the message from the specified base64 encoded string.
33878 * @name ProtoBuf.Builder.Message.decode64
33879 * @function
33880 * @param {string} str String to decode from
33881 * @return {!ProtoBuf.Builder.Message} Decoded message
33882 * @throws {Error} If the message cannot be decoded or if required fields are missing. The later still
33883 * returns the decoded message with missing fields in the `decoded` property on the error.
33884 * @expose
33885 */
33886 Message.decode64 = function(str) {
33887 return Message.decode(str, "base64");
33888 };
33889
33890 /**
33891 * Decodes the message from the specified hex encoded string.
33892 * @name ProtoBuf.Builder.Message.decodeHex
33893 * @function
33894 * @param {string} str String to decode from
33895 * @return {!ProtoBuf.Builder.Message} Decoded message
33896 * @throws {Error} If the message cannot be decoded or if required fields are missing. The later still
33897 * returns the decoded message with missing fields in the `decoded` property on the error.
33898 * @expose
33899 */
33900 Message.decodeHex = function(str) {
33901 return Message.decode(str, "hex");
33902 };
33903
33904 /**
33905 * Decodes the message from a JSON string.
33906 * @name ProtoBuf.Builder.Message.decodeJSON
33907 * @function
33908 * @param {string} str String to decode from
33909 * @return {!ProtoBuf.Builder.Message} Decoded message
33910 * @throws {Error} If the message cannot be decoded or if required fields are
33911 * missing.
33912 * @expose
33913 */
33914 Message.decodeJSON = function(str) {
33915 return new Message(JSON.parse(str));
33916 };
33917
33918 // Utility
33919
33920 /**
33921 * Returns a string representation of this Message.
33922 * @name ProtoBuf.Builder.Message#toString
33923 * @function
33924 * @return {string} String representation as of ".Fully.Qualified.MessageName"
33925 * @expose
33926 */
33927 MessagePrototype.toString = function() {
33928 return T.toString();
33929 };
33930
33931 // Properties
33932
33933 /**
33934 * Message options.
33935 * @name ProtoBuf.Builder.Message.$options
33936 * @type {Object.<string,*>}
33937 * @expose
33938 */
33939 var $optionsS; // cc needs this
33940
33941 /**
33942 * Message options.
33943 * @name ProtoBuf.Builder.Message#$options
33944 * @type {Object.<string,*>}
33945 * @expose
33946 */
33947 var $options;
33948
33949 /**
33950 * Reflection type.
33951 * @name ProtoBuf.Builder.Message.$type
33952 * @type {!ProtoBuf.Reflect.Message}
33953 * @expose
33954 */
33955 var $typeS;
33956
33957 /**
33958 * Reflection type.
33959 * @name ProtoBuf.Builder.Message#$type
33960 * @type {!ProtoBuf.Reflect.Message}
33961 * @expose
33962 */
33963 var $type;
33964
33965 if (Object.defineProperty)
33966 Object.defineProperty(Message, '$options', { "value": T.buildOpt() }),
33967 Object.defineProperty(MessagePrototype, "$options", { "value": Message["$options"] }),
33968 Object.defineProperty(Message, "$type", { "value": T }),
33969 Object.defineProperty(MessagePrototype, "$type", { "value": T });
33970
33971 return Message;
33972
33973 })(ProtoBuf, this);
33974
33975 // Static enums and prototyped sub-messages / cached collections
33976 this._fields = [];
33977 this._fieldsById = {};
33978 this._fieldsByName = {};
33979 this._oneofsByName = {};
33980 for (var i=0, k=this.children.length, child; i<k; i++) {
33981 child = this.children[i];
33982 if (child instanceof Enum || child instanceof Message || child instanceof Service) {
33983 if (clazz.hasOwnProperty(child.name))
33984 throw Error("Illegal reflect child of "+this.toString(true)+": "+child.toString(true)+" cannot override static property '"+child.name+"'");
33985 clazz[child.name] = child.build();
33986 } else if (child instanceof Message.Field)
33987 child.build(),
33988 this._fields.push(child),
33989 this._fieldsById[child.id] = child,
33990 this._fieldsByName[child.name] = child;
33991 else if (child instanceof Message.OneOf) {
33992 this._oneofsByName[child.name] = child;
33993 }
33994 else if (!(child instanceof Message.OneOf) && !(child instanceof Extension)) // Not built
33995 throw Error("Illegal reflect child of "+this.toString(true)+": "+this.children[i].toString(true));
33996 }
33997
33998 return this.clazz = clazz;
33999 };
34000
34001 /**
34002 * Encodes a runtime message's contents to the specified buffer.
34003 * @param {!ProtoBuf.Builder.Message} message Runtime message to encode
34004 * @param {ByteBuffer} buffer ByteBuffer to write to
34005 * @param {boolean=} noVerify Whether to not verify field values, defaults to `false`
34006 * @return {ByteBuffer} The ByteBuffer for chaining
34007 * @throws {Error} If required fields are missing or the message cannot be encoded for another reason
34008 * @expose
34009 */
34010 MessagePrototype.encode = function(message, buffer, noVerify) {
34011 var fieldMissing = null,
34012 field;
34013 for (var i=0, k=this._fields.length, val; i<k; ++i) {
34014 field = this._fields[i];
34015 val = message[field.name];
34016 if (field.required && val === null) {
34017 if (fieldMissing === null)
34018 fieldMissing = field;
34019 } else
34020 field.encode(noVerify ? val : field.verifyValue(val), buffer, message);
34021 }
34022 if (fieldMissing !== null) {
34023 var err = Error("Missing at least one required field for "+this.toString(true)+": "+fieldMissing);
34024 err["encoded"] = buffer; // Still expose what we got
34025 throw(err);
34026 }
34027 return buffer;
34028 };
34029
34030 /**
34031 * Calculates a runtime message's byte length.
34032 * @param {!ProtoBuf.Builder.Message} message Runtime message to encode
34033 * @returns {number} Byte length
34034 * @throws {Error} If required fields are missing or the message cannot be calculated for another reason
34035 * @expose
34036 */
34037 MessagePrototype.calculate = function(message) {
34038 for (var n=0, i=0, k=this._fields.length, field, val; i<k; ++i) {
34039 field = this._fields[i];
34040 val = message[field.name];
34041 if (field.required && val === null)
34042 throw Error("Missing at least one required field for "+this.toString(true)+": "+field);
34043 else
34044 n += field.calculate(val, message);
34045 }
34046 return n;
34047 };
34048
34049 /**
34050 * Skips all data until the end of the specified group has been reached.
34051 * @param {number} expectedId Expected GROUPEND id
34052 * @param {!ByteBuffer} buf ByteBuffer
34053 * @returns {boolean} `true` if a value as been skipped, `false` if the end has been reached
34054 * @throws {Error} If it wasn't possible to find the end of the group (buffer overrun or end tag mismatch)
34055 * @inner
34056 */
34057 function skipTillGroupEnd(expectedId, buf) {
34058 var tag = buf.readVarint32(), // Throws on OOB
34059 wireType = tag & 0x07,
34060 id = tag >>> 3;
34061 switch (wireType) {
34062 case ProtoBuf.WIRE_TYPES.VARINT:
34063 do tag = buf.readUint8();
34064 while ((tag & 0x80) === 0x80);
34065 break;
34066 case ProtoBuf.WIRE_TYPES.BITS64:
34067 buf.offset += 8;
34068 break;
34069 case ProtoBuf.WIRE_TYPES.LDELIM:
34070 tag = buf.readVarint32(); // reads the varint
34071 buf.offset += tag; // skips n bytes
34072 break;
34073 case ProtoBuf.WIRE_TYPES.STARTGROUP:
34074 skipTillGroupEnd(id, buf);
34075 break;
34076 case ProtoBuf.WIRE_TYPES.ENDGROUP:
34077 if (id === expectedId)
34078 return false;
34079 else
34080 throw Error("Illegal GROUPEND after unknown group: "+id+" ("+expectedId+" expected)");
34081 case ProtoBuf.WIRE_TYPES.BITS32:
34082 buf.offset += 4;
34083 break;
34084 default:
34085 throw Error("Illegal wire type in unknown group "+expectedId+": "+wireType);
34086 }
34087 return true;
34088 }
34089
34090 /**
34091 * Decodes an encoded message and returns the decoded message.
34092 * @param {ByteBuffer} buffer ByteBuffer to decode from
34093 * @param {number=} length Message length. Defaults to decode all remaining data.
34094 * @param {number=} expectedGroupEndId Expected GROUPEND id if this is a legacy group
34095 * @return {ProtoBuf.Builder.Message} Decoded message
34096 * @throws {Error} If the message cannot be decoded
34097 * @expose
34098 */
34099 MessagePrototype.decode = function(buffer, length, expectedGroupEndId) {
34100 if (typeof length !== 'number')
34101 length = -1;
34102 var start = buffer.offset,
34103 msg = new (this.clazz)(),
34104 tag, wireType, id, field;
34105 while (buffer.offset < start+length || (length === -1 && buffer.remaining() > 0)) {
34106 tag = buffer.readVarint32();
34107 wireType = tag & 0x07;
34108 id = tag >>> 3;
34109 if (wireType === ProtoBuf.WIRE_TYPES.ENDGROUP) {
34110 if (id !== expectedGroupEndId)
34111 throw Error("Illegal group end indicator for "+this.toString(true)+": "+id+" ("+(expectedGroupEndId ? expectedGroupEndId+" expected" : "not a group")+")");
34112 break;
34113 }
34114 if (!(field = this._fieldsById[id])) {
34115 // "messages created by your new code can be parsed by your old code: old binaries simply ignore the new field when parsing."
34116 switch (wireType) {
34117 case ProtoBuf.WIRE_TYPES.VARINT:
34118 buffer.readVarint32();
34119 break;
34120 case ProtoBuf.WIRE_TYPES.BITS32:
34121 buffer.offset += 4;
34122 break;
34123 case ProtoBuf.WIRE_TYPES.BITS64:
34124 buffer.offset += 8;
34125 break;
34126 case ProtoBuf.WIRE_TYPES.LDELIM:
34127 var len = buffer.readVarint32();
34128 buffer.offset += len;
34129 break;
34130 case ProtoBuf.WIRE_TYPES.STARTGROUP:
34131 while (skipTillGroupEnd(id, buffer)) {}
34132 break;
34133 default:
34134 throw Error("Illegal wire type for unknown field "+id+" in "+this.toString(true)+"#decode: "+wireType);
34135 }
34136 continue;
34137 }
34138 if (field.repeated && !field.options["packed"]) {
34139 msg[field.name].push(field.decode(wireType, buffer));
34140 } else if (field.map) {
34141 var keyval = field.decode(wireType, buffer);
34142 msg[field.name].set(keyval[0], keyval[1]);
34143 } else {
34144 msg[field.name] = field.decode(wireType, buffer);
34145 if (field.oneof) { // Field is part of an OneOf (not a virtual OneOf field)
34146 var currentField = msg[field.oneof.name]; // Virtual field references currently set field
34147 if (currentField !== null && currentField !== field.name)
34148 msg[currentField] = null; // Clear currently set field
34149 msg[field.oneof.name] = field.name; // Point virtual field at this field
34150 }
34151 }
34152 }
34153
34154 // Check if all required fields are present and set default values for optional fields that are not
34155 for (var i=0, k=this._fields.length; i<k; ++i) {
34156 field = this._fields[i];
34157 if (msg[field.name] === null) {
34158 if (this.syntax === "proto3") { // Proto3 sets default values by specification
34159 msg[field.name] = field.defaultValue;
34160 } else if (field.required) {
34161 var err = Error("Missing at least one required field for " + this.toString(true) + ": " + field.name);
34162 err["decoded"] = msg; // Still expose what we got
34163 throw(err);
34164 } else if (ProtoBuf.populateDefaults && field.defaultValue !== null)
34165 msg[field.name] = field.defaultValue;
34166 }
34167 }
34168 return msg;
34169 };
34170
34171 /**
34172 * @alias ProtoBuf.Reflect.Message
34173 * @expose
34174 */
34175 Reflect.Message = Message;
34176
34177 /**
34178 * Constructs a new Message Field.
34179 * @exports ProtoBuf.Reflect.Message.Field
34180 * @param {!ProtoBuf.Builder} builder Builder reference
34181 * @param {!ProtoBuf.Reflect.Message} message Message reference
34182 * @param {string} rule Rule, one of requried, optional, repeated
34183 * @param {string?} keytype Key data type, if any.
34184 * @param {string} type Data type, e.g. int32
34185 * @param {string} name Field name
34186 * @param {number} id Unique field id
34187 * @param {Object.<string,*>=} options Options
34188 * @param {!ProtoBuf.Reflect.Message.OneOf=} oneof Enclosing OneOf
34189 * @param {string?} syntax The syntax level of this definition (e.g., proto3)
34190 * @constructor
34191 * @extends ProtoBuf.Reflect.T
34192 */
34193 var Field = function(builder, message, rule, keytype, type, name, id, options, oneof, syntax) {
34194 T.call(this, builder, message, name);
34195
34196 /**
34197 * @override
34198 */
34199 this.className = "Message.Field";
34200
34201 /**
34202 * Message field required flag.
34203 * @type {boolean}
34204 * @expose
34205 */
34206 this.required = rule === "required";
34207
34208 /**
34209 * Message field repeated flag.
34210 * @type {boolean}
34211 * @expose
34212 */
34213 this.repeated = rule === "repeated";
34214
34215 /**
34216 * Message field map flag.
34217 * @type {boolean}
34218 * @expose
34219 */
34220 this.map = rule === "map";
34221
34222 /**
34223 * Message field key type. Type reference string if unresolved, protobuf
34224 * type if resolved. Valid only if this.map === true, null otherwise.
34225 * @type {string|{name: string, wireType: number}|null}
34226 * @expose
34227 */
34228 this.keyType = keytype || null;
34229
34230 /**
34231 * Message field type. Type reference string if unresolved, protobuf type if
34232 * resolved. In a map field, this is the value type.
34233 * @type {string|{name: string, wireType: number}}
34234 * @expose
34235 */
34236 this.type = type;
34237
34238 /**
34239 * Resolved type reference inside the global namespace.
34240 * @type {ProtoBuf.Reflect.T|null}
34241 * @expose
34242 */
34243 this.resolvedType = null;
34244
34245 /**
34246 * Unique message field id.
34247 * @type {number}
34248 * @expose
34249 */
34250 this.id = id;
34251
34252 /**
34253 * Message field options.
34254 * @type {!Object.<string,*>}
34255 * @dict
34256 * @expose
34257 */
34258 this.options = options || {};
34259
34260 /**
34261 * Default value.
34262 * @type {*}
34263 * @expose
34264 */
34265 this.defaultValue = null;
34266
34267 /**
34268 * Enclosing OneOf.
34269 * @type {?ProtoBuf.Reflect.Message.OneOf}
34270 * @expose
34271 */
34272 this.oneof = oneof || null;
34273
34274 /**
34275 * Syntax level of this definition (e.g., proto3).
34276 * @type {string}
34277 * @expose
34278 */
34279 this.syntax = syntax || 'proto2';
34280
34281 /**
34282 * Original field name.
34283 * @type {string}
34284 * @expose
34285 */
34286 this.originalName = this.name; // Used to revert camelcase transformation on naming collisions
34287
34288 /**
34289 * Element implementation. Created in build() after types are resolved.
34290 * @type {ProtoBuf.Element}
34291 * @expose
34292 */
34293 this.element = null;
34294
34295 /**
34296 * Key element implementation, for map fields. Created in build() after
34297 * types are resolved.
34298 * @type {ProtoBuf.Element}
34299 * @expose
34300 */
34301 this.keyElement = null;
34302
34303 // Convert field names to camel case notation if the override is set
34304 if (this.builder.options['convertFieldsToCamelCase'] && !(this instanceof Message.ExtensionField))
34305 this.name = ProtoBuf.Util.toCamelCase(this.name);
34306 };
34307
34308 /**
34309 * @alias ProtoBuf.Reflect.Message.Field.prototype
34310 * @inner
34311 */
34312 var FieldPrototype = Field.prototype = Object.create(T.prototype);
34313
34314 /**
34315 * Builds the field.
34316 * @override
34317 * @expose
34318 */
34319 FieldPrototype.build = function() {
34320 this.element = new Element(this.type, this.resolvedType, false, this.syntax, this.name);
34321 if (this.map)
34322 this.keyElement = new Element(this.keyType, undefined, true, this.syntax, this.name);
34323
34324 // In proto3, fields do not have field presence, and every field is set to
34325 // its type's default value ("", 0, 0.0, or false).
34326 if (this.syntax === 'proto3' && !this.repeated && !this.map)
34327 this.defaultValue = Element.defaultFieldValue(this.type);
34328
34329 // Otherwise, default values are present when explicitly specified
34330 else if (typeof this.options['default'] !== 'undefined')
34331 this.defaultValue = this.verifyValue(this.options['default']);
34332 };
34333
34334 /**
34335 * Checks if the given value can be set for this field.
34336 * @param {*} value Value to check
34337 * @param {boolean=} skipRepeated Whether to skip the repeated value check or not. Defaults to false.
34338 * @return {*} Verified, maybe adjusted, value
34339 * @throws {Error} If the value cannot be set for this field
34340 * @expose
34341 */
34342 FieldPrototype.verifyValue = function(value, skipRepeated) {
34343 skipRepeated = skipRepeated || false;
34344 var self = this;
34345 function fail(val, msg) {
34346 throw Error("Illegal value for "+self.toString(true)+" of type "+self.type.name+": "+val+" ("+msg+")");
34347 }
34348 if (value === null) { // NULL values for optional fields
34349 if (this.required)
34350 fail(typeof value, "required");
34351 if (this.syntax === 'proto3' && this.type !== ProtoBuf.TYPES["message"])
34352 fail(typeof value, "proto3 field without field presence cannot be null");
34353 return null;
34354 }
34355 var i;
34356 if (this.repeated && !skipRepeated) { // Repeated values as arrays
34357 if (!Array.isArray(value))
34358 value = [value];
34359 var res = [];
34360 for (i=0; i<value.length; i++)
34361 res.push(this.element.verifyValue(value[i]));
34362 return res;
34363 }
34364 if (this.map && !skipRepeated) { // Map values as objects
34365 if (!(value instanceof ProtoBuf.Map)) {
34366 // If not already a Map, attempt to convert.
34367 if (!(value instanceof Object)) {
34368 fail(typeof value,
34369 "expected ProtoBuf.Map or raw object for map field");
34370 }
34371 return new ProtoBuf.Map(this, value);
34372 } else {
34373 return value;
34374 }
34375 }
34376 // All non-repeated fields expect no array
34377 if (!this.repeated && Array.isArray(value))
34378 fail(typeof value, "no array expected");
34379
34380 return this.element.verifyValue(value);
34381 };
34382
34383 /**
34384 * Determines whether the field will have a presence on the wire given its
34385 * value.
34386 * @param {*} value Verified field value
34387 * @param {!ProtoBuf.Builder.Message} message Runtime message
34388 * @return {boolean} Whether the field will be present on the wire
34389 */
34390 FieldPrototype.hasWirePresence = function(value, message) {
34391 if (this.syntax !== 'proto3')
34392 return (value !== null);
34393 if (this.oneof && message[this.oneof.name] === this.name)
34394 return true;
34395 switch (this.type) {
34396 case ProtoBuf.TYPES["int32"]:
34397 case ProtoBuf.TYPES["sint32"]:
34398 case ProtoBuf.TYPES["sfixed32"]:
34399 case ProtoBuf.TYPES["uint32"]:
34400 case ProtoBuf.TYPES["fixed32"]:
34401 return value !== 0;
34402
34403 case ProtoBuf.TYPES["int64"]:
34404 case ProtoBuf.TYPES["sint64"]:
34405 case ProtoBuf.TYPES["sfixed64"]:
34406 case ProtoBuf.TYPES["uint64"]:
34407 case ProtoBuf.TYPES["fixed64"]:
34408 return value.low !== 0 || value.high !== 0;
34409
34410 case ProtoBuf.TYPES["bool"]:
34411 return value;
34412
34413 case ProtoBuf.TYPES["float"]:
34414 case ProtoBuf.TYPES["double"]:
34415 return value !== 0.0;
34416
34417 case ProtoBuf.TYPES["string"]:
34418 return value.length > 0;
34419
34420 case ProtoBuf.TYPES["bytes"]:
34421 return value.remaining() > 0;
34422
34423 case ProtoBuf.TYPES["enum"]:
34424 return value !== 0;
34425
34426 case ProtoBuf.TYPES["message"]:
34427 return value !== null;
34428 default:
34429 return true;
34430 }
34431 };
34432
34433 /**
34434 * Encodes the specified field value to the specified buffer.
34435 * @param {*} value Verified field value
34436 * @param {ByteBuffer} buffer ByteBuffer to encode to
34437 * @param {!ProtoBuf.Builder.Message} message Runtime message
34438 * @return {ByteBuffer} The ByteBuffer for chaining
34439 * @throws {Error} If the field cannot be encoded
34440 * @expose
34441 */
34442 FieldPrototype.encode = function(value, buffer, message) {
34443 if (this.type === null || typeof this.type !== 'object')
34444 throw Error("[INTERNAL] Unresolved type in "+this.toString(true)+": "+this.type);
34445 if (value === null || (this.repeated && value.length == 0))
34446 return buffer; // Optional omitted
34447 try {
34448 if (this.repeated) {
34449 var i;
34450 // "Only repeated fields of primitive numeric types (types which use the varint, 32-bit, or 64-bit wire
34451 // types) can be declared 'packed'."
34452 if (this.options["packed"] && ProtoBuf.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType) >= 0) {
34453 // "All of the elements of the field are packed into a single key-value pair with wire type 2
34454 // (length-delimited). Each element is encoded the same way it would be normally, except without a
34455 // tag preceding it."
34456 buffer.writeVarint32((this.id << 3) | ProtoBuf.WIRE_TYPES.LDELIM);
34457 buffer.ensureCapacity(buffer.offset += 1); // We do not know the length yet, so let's assume a varint of length 1
34458 var start = buffer.offset; // Remember where the contents begin
34459 for (i=0; i<value.length; i++)
34460 this.element.encodeValue(this.id, value[i], buffer);
34461 var len = buffer.offset-start,
34462 varintLen = ByteBuffer.calculateVarint32(len);
34463 if (varintLen > 1) { // We need to move the contents
34464 var contents = buffer.slice(start, buffer.offset);
34465 start += varintLen-1;
34466 buffer.offset = start;
34467 buffer.append(contents);
34468 }
34469 buffer.writeVarint32(len, start-varintLen);
34470 } else {
34471 // "If your message definition has repeated elements (without the [packed=true] option), the encoded
34472 // message has zero or more key-value pairs with the same tag number"
34473 for (i=0; i<value.length; i++)
34474 buffer.writeVarint32((this.id << 3) | this.type.wireType),
34475 this.element.encodeValue(this.id, value[i], buffer);
34476 }
34477 } else if (this.map) {
34478 // Write out each map entry as a submessage.
34479 value.forEach(function(val, key, m) {
34480 // Compute the length of the submessage (key, val) pair.
34481 var length =
34482 ByteBuffer.calculateVarint32((1 << 3) | this.keyType.wireType) +
34483 this.keyElement.calculateLength(1, key) +
34484 ByteBuffer.calculateVarint32((2 << 3) | this.type.wireType) +
34485 this.element.calculateLength(2, val);
34486
34487 // Submessage with wire type of length-delimited.
34488 buffer.writeVarint32((this.id << 3) | ProtoBuf.WIRE_TYPES.LDELIM);
34489 buffer.writeVarint32(length);
34490
34491 // Write out the key and val.
34492 buffer.writeVarint32((1 << 3) | this.keyType.wireType);
34493 this.keyElement.encodeValue(1, key, buffer);
34494 buffer.writeVarint32((2 << 3) | this.type.wireType);
34495 this.element.encodeValue(2, val, buffer);
34496 }, this);
34497 } else {
34498 if (this.hasWirePresence(value, message)) {
34499 buffer.writeVarint32((this.id << 3) | this.type.wireType);
34500 this.element.encodeValue(this.id, value, buffer);
34501 }
34502 }
34503 } catch (e) {
34504 throw Error("Illegal value for "+this.toString(true)+": "+value+" ("+e+")");
34505 }
34506 return buffer;
34507 };
34508
34509 /**
34510 * Calculates the length of this field's value on the network level.
34511 * @param {*} value Field value
34512 * @param {!ProtoBuf.Builder.Message} message Runtime message
34513 * @returns {number} Byte length
34514 * @expose
34515 */
34516 FieldPrototype.calculate = function(value, message) {
34517 value = this.verifyValue(value); // May throw
34518 if (this.type === null || typeof this.type !== 'object')
34519 throw Error("[INTERNAL] Unresolved type in "+this.toString(true)+": "+this.type);
34520 if (value === null || (this.repeated && value.length == 0))
34521 return 0; // Optional omitted
34522 var n = 0;
34523 try {
34524 if (this.repeated) {
34525 var i, ni;
34526 if (this.options["packed"] && ProtoBuf.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType) >= 0) {
34527 n += ByteBuffer.calculateVarint32((this.id << 3) | ProtoBuf.WIRE_TYPES.LDELIM);
34528 ni = 0;
34529 for (i=0; i<value.length; i++)
34530 ni += this.element.calculateLength(this.id, value[i]);
34531 n += ByteBuffer.calculateVarint32(ni);
34532 n += ni;
34533 } else {
34534 for (i=0; i<value.length; i++)
34535 n += ByteBuffer.calculateVarint32((this.id << 3) | this.type.wireType),
34536 n += this.element.calculateLength(this.id, value[i]);
34537 }
34538 } else if (this.map) {
34539 // Each map entry becomes a submessage.
34540 value.forEach(function(val, key, m) {
34541 // Compute the length of the submessage (key, val) pair.
34542 var length =
34543 ByteBuffer.calculateVarint32((1 << 3) | this.keyType.wireType) +
34544 this.keyElement.calculateLength(1, key) +
34545 ByteBuffer.calculateVarint32((2 << 3) | this.type.wireType) +
34546 this.element.calculateLength(2, val);
34547
34548 n += ByteBuffer.calculateVarint32((this.id << 3) | ProtoBuf.WIRE_TYPES.LDELIM);
34549 n += ByteBuffer.calculateVarint32(length);
34550 n += length;
34551 }, this);
34552 } else {
34553 if (this.hasWirePresence(value, message)) {
34554 n += ByteBuffer.calculateVarint32((this.id << 3) | this.type.wireType);
34555 n += this.element.calculateLength(this.id, value);
34556 }
34557 }
34558 } catch (e) {
34559 throw Error("Illegal value for "+this.toString(true)+": "+value+" ("+e+")");
34560 }
34561 return n;
34562 };
34563
34564 /**
34565 * Decode the field value from the specified buffer.
34566 * @param {number} wireType Leading wire type
34567 * @param {ByteBuffer} buffer ByteBuffer to decode from
34568 * @param {boolean=} skipRepeated Whether to skip the repeated check or not. Defaults to false.
34569 * @return {*} Decoded value: array for packed repeated fields, [key, value] for
34570 * map fields, or an individual value otherwise.
34571 * @throws {Error} If the field cannot be decoded
34572 * @expose
34573 */
34574 FieldPrototype.decode = function(wireType, buffer, skipRepeated) {
34575 var value, nBytes;
34576
34577 // We expect wireType to match the underlying type's wireType unless we see
34578 // a packed repeated field, or unless this is a map field.
34579 var wireTypeOK =
34580 (!this.map && wireType == this.type.wireType) ||
34581 (!skipRepeated && this.repeated && this.options["packed"] &&
34582 wireType == ProtoBuf.WIRE_TYPES.LDELIM) ||
34583 (this.map && wireType == ProtoBuf.WIRE_TYPES.LDELIM);
34584 if (!wireTypeOK)
34585 throw Error("Illegal wire type for field "+this.toString(true)+": "+wireType+" ("+this.type.wireType+" expected)");
34586
34587 // Handle packed repeated fields.
34588 if (wireType == ProtoBuf.WIRE_TYPES.LDELIM && this.repeated && this.options["packed"] && ProtoBuf.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType) >= 0) {
34589 if (!skipRepeated) {
34590 nBytes = buffer.readVarint32();
34591 nBytes = buffer.offset + nBytes; // Limit
34592 var values = [];
34593 while (buffer.offset < nBytes)
34594 values.push(this.decode(this.type.wireType, buffer, true));
34595 return values;
34596 }
34597 // Read the next value otherwise...
34598 }
34599
34600 // Handle maps.
34601 if (this.map) {
34602 // Read one (key, value) submessage, and return [key, value]
34603 var key = Element.defaultFieldValue(this.keyType);
34604 value = Element.defaultFieldValue(this.type);
34605
34606 // Read the length
34607 nBytes = buffer.readVarint32();
34608 if (buffer.remaining() < nBytes)
34609 throw Error("Illegal number of bytes for "+this.toString(true)+": "+nBytes+" required but got only "+buffer.remaining());
34610
34611 // Get a sub-buffer of this key/value submessage
34612 var msgbuf = buffer.clone();
34613 msgbuf.limit = msgbuf.offset + nBytes;
34614 buffer.offset += nBytes;
34615
34616 while (msgbuf.remaining() > 0) {
34617 var tag = msgbuf.readVarint32();
34618 wireType = tag & 0x07;
34619 var id = tag >>> 3;
34620 if (id === 1) {
34621 key = this.keyElement.decode(msgbuf, wireType, id);
34622 } else if (id === 2) {
34623 value = this.element.decode(msgbuf, wireType, id);
34624 } else {
34625 throw Error("Unexpected tag in map field key/value submessage");
34626 }
34627 }
34628
34629 return [key, value];
34630 }
34631
34632 // Handle singular and non-packed repeated field values.
34633 return this.element.decode(buffer, wireType, this.id);
34634 };
34635
34636 /**
34637 * @alias ProtoBuf.Reflect.Message.Field
34638 * @expose
34639 */
34640 Reflect.Message.Field = Field;
34641
34642 /**
34643 * Constructs a new Message ExtensionField.
34644 * @exports ProtoBuf.Reflect.Message.ExtensionField
34645 * @param {!ProtoBuf.Builder} builder Builder reference
34646 * @param {!ProtoBuf.Reflect.Message} message Message reference
34647 * @param {string} rule Rule, one of requried, optional, repeated
34648 * @param {string} type Data type, e.g. int32
34649 * @param {string} name Field name
34650 * @param {number} id Unique field id
34651 * @param {!Object.<string,*>=} options Options
34652 * @constructor
34653 * @extends ProtoBuf.Reflect.Message.Field
34654 */
34655 var ExtensionField = function(builder, message, rule, type, name, id, options) {
34656 Field.call(this, builder, message, rule, /* keytype = */ null, type, name, id, options);
34657
34658 /**
34659 * Extension reference.
34660 * @type {!ProtoBuf.Reflect.Extension}
34661 * @expose
34662 */
34663 this.extension;
34664 };
34665
34666 // Extends Field
34667 ExtensionField.prototype = Object.create(Field.prototype);
34668
34669 /**
34670 * @alias ProtoBuf.Reflect.Message.ExtensionField
34671 * @expose
34672 */
34673 Reflect.Message.ExtensionField = ExtensionField;
34674
34675 /**
34676 * Constructs a new Message OneOf.
34677 * @exports ProtoBuf.Reflect.Message.OneOf
34678 * @param {!ProtoBuf.Builder} builder Builder reference
34679 * @param {!ProtoBuf.Reflect.Message} message Message reference
34680 * @param {string} name OneOf name
34681 * @constructor
34682 * @extends ProtoBuf.Reflect.T
34683 */
34684 var OneOf = function(builder, message, name) {
34685 T.call(this, builder, message, name);
34686
34687 /**
34688 * Enclosed fields.
34689 * @type {!Array.<!ProtoBuf.Reflect.Message.Field>}
34690 * @expose
34691 */
34692 this.fields = [];
34693 };
34694
34695 /**
34696 * @alias ProtoBuf.Reflect.Message.OneOf
34697 * @expose
34698 */
34699 Reflect.Message.OneOf = OneOf;
34700
34701 /**
34702 * Constructs a new Enum.
34703 * @exports ProtoBuf.Reflect.Enum
34704 * @param {!ProtoBuf.Builder} builder Builder reference
34705 * @param {!ProtoBuf.Reflect.T} parent Parent Reflect object
34706 * @param {string} name Enum name
34707 * @param {Object.<string,*>=} options Enum options
34708 * @param {string?} syntax The syntax level (e.g., proto3)
34709 * @constructor
34710 * @extends ProtoBuf.Reflect.Namespace
34711 */
34712 var Enum = function(builder, parent, name, options, syntax) {
34713 Namespace.call(this, builder, parent, name, options, syntax);
34714
34715 /**
34716 * @override
34717 */
34718 this.className = "Enum";
34719
34720 /**
34721 * Runtime enum object.
34722 * @type {Object.<string,number>|null}
34723 * @expose
34724 */
34725 this.object = null;
34726 };
34727
34728 /**
34729 * Gets the string name of an enum value.
34730 * @param {!ProtoBuf.Builder.Enum} enm Runtime enum
34731 * @param {number} value Enum value
34732 * @returns {?string} Name or `null` if not present
34733 * @expose
34734 */
34735 Enum.getName = function(enm, value) {
34736 var keys = Object.keys(enm);
34737 for (var i=0, key; i<keys.length; ++i)
34738 if (enm[key = keys[i]] === value)
34739 return key;
34740 return null;
34741 };
34742
34743 /**
34744 * @alias ProtoBuf.Reflect.Enum.prototype
34745 * @inner
34746 */
34747 var EnumPrototype = Enum.prototype = Object.create(Namespace.prototype);
34748
34749 /**
34750 * Builds this enum and returns the runtime counterpart.
34751 * @param {boolean} rebuild Whether to rebuild or not, defaults to false
34752 * @returns {!Object.<string,number>}
34753 * @expose
34754 */
34755 EnumPrototype.build = function(rebuild) {
34756 if (this.object && !rebuild)
34757 return this.object;
34758 var enm = new ProtoBuf.Builder.Enum(),
34759 values = this.getChildren(Enum.Value);
34760 for (var i=0, k=values.length; i<k; ++i)
34761 enm[values[i]['name']] = values[i]['id'];
34762 if (Object.defineProperty)
34763 Object.defineProperty(enm, '$options', {
34764 "value": this.buildOpt(),
34765 "enumerable": false
34766 });
34767 return this.object = enm;
34768 };
34769
34770 /**
34771 * @alias ProtoBuf.Reflect.Enum
34772 * @expose
34773 */
34774 Reflect.Enum = Enum;
34775
34776 /**
34777 * Constructs a new Enum Value.
34778 * @exports ProtoBuf.Reflect.Enum.Value
34779 * @param {!ProtoBuf.Builder} builder Builder reference
34780 * @param {!ProtoBuf.Reflect.Enum} enm Enum reference
34781 * @param {string} name Field name
34782 * @param {number} id Unique field id
34783 * @constructor
34784 * @extends ProtoBuf.Reflect.T
34785 */
34786 var Value = function(builder, enm, name, id) {
34787 T.call(this, builder, enm, name);
34788
34789 /**
34790 * @override
34791 */
34792 this.className = "Enum.Value";
34793
34794 /**
34795 * Unique enum value id.
34796 * @type {number}
34797 * @expose
34798 */
34799 this.id = id;
34800 };
34801
34802 // Extends T
34803 Value.prototype = Object.create(T.prototype);
34804
34805 /**
34806 * @alias ProtoBuf.Reflect.Enum.Value
34807 * @expose
34808 */
34809 Reflect.Enum.Value = Value;
34810
34811 /**
34812 * An extension (field).
34813 * @exports ProtoBuf.Reflect.Extension
34814 * @constructor
34815 * @param {!ProtoBuf.Builder} builder Builder reference
34816 * @param {!ProtoBuf.Reflect.T} parent Parent object
34817 * @param {string} name Object name
34818 * @param {!ProtoBuf.Reflect.Message.Field} field Extension field
34819 */
34820 var Extension = function(builder, parent, name, field) {
34821 T.call(this, builder, parent, name);
34822
34823 /**
34824 * Extended message field.
34825 * @type {!ProtoBuf.Reflect.Message.Field}
34826 * @expose
34827 */
34828 this.field = field;
34829 };
34830
34831 // Extends T
34832 Extension.prototype = Object.create(T.prototype);
34833
34834 /**
34835 * @alias ProtoBuf.Reflect.Extension
34836 * @expose
34837 */
34838 Reflect.Extension = Extension;
34839
34840 /**
34841 * Constructs a new Service.
34842 * @exports ProtoBuf.Reflect.Service
34843 * @param {!ProtoBuf.Builder} builder Builder reference
34844 * @param {!ProtoBuf.Reflect.Namespace} root Root
34845 * @param {string} name Service name
34846 * @param {Object.<string,*>=} options Options
34847 * @constructor
34848 * @extends ProtoBuf.Reflect.Namespace
34849 */
34850 var Service = function(builder, root, name, options) {
34851 Namespace.call(this, builder, root, name, options);
34852
34853 /**
34854 * @override
34855 */
34856 this.className = "Service";
34857
34858 /**
34859 * Built runtime service class.
34860 * @type {?function(new:ProtoBuf.Builder.Service)}
34861 */
34862 this.clazz = null;
34863 };
34864
34865 /**
34866 * @alias ProtoBuf.Reflect.Service.prototype
34867 * @inner
34868 */
34869 var ServicePrototype = Service.prototype = Object.create(Namespace.prototype);
34870
34871 /**
34872 * Builds the service and returns the runtime counterpart, which is a fully functional class.
34873 * @see ProtoBuf.Builder.Service
34874 * @param {boolean=} rebuild Whether to rebuild or not
34875 * @return {Function} Service class
34876 * @throws {Error} If the message cannot be built
34877 * @expose
34878 */
34879 ServicePrototype.build = function(rebuild) {
34880 if (this.clazz && !rebuild)
34881 return this.clazz;
34882
34883 // Create the runtime Service class in its own scope
34884 return this.clazz = (function(ProtoBuf, T) {
34885
34886 /**
34887 * Constructs a new runtime Service.
34888 * @name ProtoBuf.Builder.Service
34889 * @param {function(string, ProtoBuf.Builder.Message, function(Error, ProtoBuf.Builder.Message=))=} rpcImpl RPC implementation receiving the method name and the message
34890 * @class Barebone of all runtime services.
34891 * @constructor
34892 * @throws {Error} If the service cannot be created
34893 */
34894 var Service = function(rpcImpl) {
34895 ProtoBuf.Builder.Service.call(this);
34896
34897 /**
34898 * Service implementation.
34899 * @name ProtoBuf.Builder.Service#rpcImpl
34900 * @type {!function(string, ProtoBuf.Builder.Message, function(Error, ProtoBuf.Builder.Message=))}
34901 * @expose
34902 */
34903 this.rpcImpl = rpcImpl || function(name, msg, callback) {
34904 // This is what a user has to implement: A function receiving the method name, the actual message to
34905 // send (type checked) and the callback that's either provided with the error as its first
34906 // argument or null and the actual response message.
34907 setTimeout(callback.bind(this, Error("Not implemented, see: https://github.com/dcodeIO/ProtoBuf.js/wiki/Services")), 0); // Must be async!
34908 };
34909 };
34910
34911 /**
34912 * @alias ProtoBuf.Builder.Service.prototype
34913 * @inner
34914 */
34915 var ServicePrototype = Service.prototype = Object.create(ProtoBuf.Builder.Service.prototype);
34916
34917 /**
34918 * Asynchronously performs an RPC call using the given RPC implementation.
34919 * @name ProtoBuf.Builder.Service.[Method]
34920 * @function
34921 * @param {!function(string, ProtoBuf.Builder.Message, function(Error, ProtoBuf.Builder.Message=))} rpcImpl RPC implementation
34922 * @param {ProtoBuf.Builder.Message} req Request
34923 * @param {function(Error, (ProtoBuf.Builder.Message|ByteBuffer|Buffer|string)=)} callback Callback receiving
34924 * the error if any and the response either as a pre-parsed message or as its raw bytes
34925 * @abstract
34926 */
34927
34928 /**
34929 * Asynchronously performs an RPC call using the instance's RPC implementation.
34930 * @name ProtoBuf.Builder.Service#[Method]
34931 * @function
34932 * @param {ProtoBuf.Builder.Message} req Request
34933 * @param {function(Error, (ProtoBuf.Builder.Message|ByteBuffer|Buffer|string)=)} callback Callback receiving
34934 * the error if any and the response either as a pre-parsed message or as its raw bytes
34935 * @abstract
34936 */
34937
34938 var rpc = T.getChildren(ProtoBuf.Reflect.Service.RPCMethod);
34939 for (var i=0; i<rpc.length; i++) {
34940 (function(method) {
34941
34942 // service#Method(message, callback)
34943 ServicePrototype[method.name] = function(req, callback) {
34944 try {
34945 try {
34946 // If given as a buffer, decode the request. Will throw a TypeError if not a valid buffer.
34947 req = method.resolvedRequestType.clazz.decode(ByteBuffer.wrap(req));
34948 } catch (err) {
34949 if (!(err instanceof TypeError))
34950 throw err;
34951 }
34952 if (req === null || typeof req !== 'object')
34953 throw Error("Illegal arguments");
34954 if (!(req instanceof method.resolvedRequestType.clazz))
34955 req = new method.resolvedRequestType.clazz(req);
34956 this.rpcImpl(method.fqn(), req, function(err, res) { // Assumes that this is properly async
34957 if (err) {
34958 callback(err);
34959 return;
34960 }
34961 // Coalesce to empty string when service response has empty content
34962 if (res === null)
34963 res = ''
34964 try { res = method.resolvedResponseType.clazz.decode(res); } catch (notABuffer) {}
34965 if (!res || !(res instanceof method.resolvedResponseType.clazz)) {
34966 callback(Error("Illegal response type received in service method "+ T.name+"#"+method.name));
34967 return;
34968 }
34969 callback(null, res);
34970 });
34971 } catch (err) {
34972 setTimeout(callback.bind(this, err), 0);
34973 }
34974 };
34975
34976 // Service.Method(rpcImpl, message, callback)
34977 Service[method.name] = function(rpcImpl, req, callback) {
34978 new Service(rpcImpl)[method.name](req, callback);
34979 };
34980
34981 if (Object.defineProperty)
34982 Object.defineProperty(Service[method.name], "$options", { "value": method.buildOpt() }),
34983 Object.defineProperty(ServicePrototype[method.name], "$options", { "value": Service[method.name]["$options"] });
34984 })(rpc[i]);
34985 }
34986
34987 // Properties
34988
34989 /**
34990 * Service options.
34991 * @name ProtoBuf.Builder.Service.$options
34992 * @type {Object.<string,*>}
34993 * @expose
34994 */
34995 var $optionsS; // cc needs this
34996
34997 /**
34998 * Service options.
34999 * @name ProtoBuf.Builder.Service#$options
35000 * @type {Object.<string,*>}
35001 * @expose
35002 */
35003 var $options;
35004
35005 /**
35006 * Reflection type.
35007 * @name ProtoBuf.Builder.Service.$type
35008 * @type {!ProtoBuf.Reflect.Service}
35009 * @expose
35010 */
35011 var $typeS;
35012
35013 /**
35014 * Reflection type.
35015 * @name ProtoBuf.Builder.Service#$type
35016 * @type {!ProtoBuf.Reflect.Service}
35017 * @expose
35018 */
35019 var $type;
35020
35021 if (Object.defineProperty)
35022 Object.defineProperty(Service, "$options", { "value": T.buildOpt() }),
35023 Object.defineProperty(ServicePrototype, "$options", { "value": Service["$options"] }),
35024 Object.defineProperty(Service, "$type", { "value": T }),
35025 Object.defineProperty(ServicePrototype, "$type", { "value": T });
35026
35027 return Service;
35028
35029 })(ProtoBuf, this);
35030 };
35031
35032 /**
35033 * @alias ProtoBuf.Reflect.Service
35034 * @expose
35035 */
35036 Reflect.Service = Service;
35037
35038 /**
35039 * Abstract service method.
35040 * @exports ProtoBuf.Reflect.Service.Method
35041 * @param {!ProtoBuf.Builder} builder Builder reference
35042 * @param {!ProtoBuf.Reflect.Service} svc Service
35043 * @param {string} name Method name
35044 * @param {Object.<string,*>=} options Options
35045 * @constructor
35046 * @extends ProtoBuf.Reflect.T
35047 */
35048 var Method = function(builder, svc, name, options) {
35049 T.call(this, builder, svc, name);
35050
35051 /**
35052 * @override
35053 */
35054 this.className = "Service.Method";
35055
35056 /**
35057 * Options.
35058 * @type {Object.<string, *>}
35059 * @expose
35060 */
35061 this.options = options || {};
35062 };
35063
35064 /**
35065 * @alias ProtoBuf.Reflect.Service.Method.prototype
35066 * @inner
35067 */
35068 var MethodPrototype = Method.prototype = Object.create(T.prototype);
35069
35070 /**
35071 * Builds the method's '$options' property.
35072 * @name ProtoBuf.Reflect.Service.Method#buildOpt
35073 * @function
35074 * @return {Object.<string,*>}
35075 */
35076 MethodPrototype.buildOpt = NamespacePrototype.buildOpt;
35077
35078 /**
35079 * @alias ProtoBuf.Reflect.Service.Method
35080 * @expose
35081 */
35082 Reflect.Service.Method = Method;
35083
35084 /**
35085 * RPC service method.
35086 * @exports ProtoBuf.Reflect.Service.RPCMethod
35087 * @param {!ProtoBuf.Builder} builder Builder reference
35088 * @param {!ProtoBuf.Reflect.Service} svc Service
35089 * @param {string} name Method name
35090 * @param {string} request Request message name
35091 * @param {string} response Response message name
35092 * @param {boolean} request_stream Whether requests are streamed
35093 * @param {boolean} response_stream Whether responses are streamed
35094 * @param {Object.<string,*>=} options Options
35095 * @constructor
35096 * @extends ProtoBuf.Reflect.Service.Method
35097 */
35098 var RPCMethod = function(builder, svc, name, request, response, request_stream, response_stream, options) {
35099 Method.call(this, builder, svc, name, options);
35100
35101 /**
35102 * @override
35103 */
35104 this.className = "Service.RPCMethod";
35105
35106 /**
35107 * Request message name.
35108 * @type {string}
35109 * @expose
35110 */
35111 this.requestName = request;
35112
35113 /**
35114 * Response message name.
35115 * @type {string}
35116 * @expose
35117 */
35118 this.responseName = response;
35119
35120 /**
35121 * Whether requests are streamed
35122 * @type {bool}
35123 * @expose
35124 */
35125 this.requestStream = request_stream;
35126
35127 /**
35128 * Whether responses are streamed
35129 * @type {bool}
35130 * @expose
35131 */
35132 this.responseStream = response_stream;
35133
35134 /**
35135 * Resolved request message type.
35136 * @type {ProtoBuf.Reflect.Message}
35137 * @expose
35138 */
35139 this.resolvedRequestType = null;
35140
35141 /**
35142 * Resolved response message type.
35143 * @type {ProtoBuf.Reflect.Message}
35144 * @expose
35145 */
35146 this.resolvedResponseType = null;
35147 };
35148
35149 // Extends Method
35150 RPCMethod.prototype = Object.create(Method.prototype);
35151
35152 /**
35153 * @alias ProtoBuf.Reflect.Service.RPCMethod
35154 * @expose
35155 */
35156 Reflect.Service.RPCMethod = RPCMethod;
35157
35158 return Reflect;
35159
35160 })(ProtoBuf);
35161
35162 /**
35163 * @alias ProtoBuf.Builder
35164 * @expose
35165 */
35166 ProtoBuf.Builder = (function(ProtoBuf, Lang, Reflect) {
35167 "use strict";
35168
35169 /**
35170 * Constructs a new Builder.
35171 * @exports ProtoBuf.Builder
35172 * @class Provides the functionality to build protocol messages.
35173 * @param {Object.<string,*>=} options Options
35174 * @constructor
35175 */
35176 var Builder = function(options) {
35177
35178 /**
35179 * Namespace.
35180 * @type {ProtoBuf.Reflect.Namespace}
35181 * @expose
35182 */
35183 this.ns = new Reflect.Namespace(this, null, ""); // Global namespace
35184
35185 /**
35186 * Namespace pointer.
35187 * @type {ProtoBuf.Reflect.T}
35188 * @expose
35189 */
35190 this.ptr = this.ns;
35191
35192 /**
35193 * Resolved flag.
35194 * @type {boolean}
35195 * @expose
35196 */
35197 this.resolved = false;
35198
35199 /**
35200 * The current building result.
35201 * @type {Object.<string,ProtoBuf.Builder.Message|Object>|null}
35202 * @expose
35203 */
35204 this.result = null;
35205
35206 /**
35207 * Imported files.
35208 * @type {Array.<string>}
35209 * @expose
35210 */
35211 this.files = {};
35212
35213 /**
35214 * Import root override.
35215 * @type {?string}
35216 * @expose
35217 */
35218 this.importRoot = null;
35219
35220 /**
35221 * Options.
35222 * @type {!Object.<string, *>}
35223 * @expose
35224 */
35225 this.options = options || {};
35226 };
35227
35228 /**
35229 * @alias ProtoBuf.Builder.prototype
35230 * @inner
35231 */
35232 var BuilderPrototype = Builder.prototype;
35233
35234 // ----- Definition tests -----
35235
35236 /**
35237 * Tests if a definition most likely describes a message.
35238 * @param {!Object} def
35239 * @returns {boolean}
35240 * @expose
35241 */
35242 Builder.isMessage = function(def) {
35243 // Messages require a string name
35244 if (typeof def["name"] !== 'string')
35245 return false;
35246 // Messages do not contain values (enum) or rpc methods (service)
35247 if (typeof def["values"] !== 'undefined' || typeof def["rpc"] !== 'undefined')
35248 return false;
35249 return true;
35250 };
35251
35252 /**
35253 * Tests if a definition most likely describes a message field.
35254 * @param {!Object} def
35255 * @returns {boolean}
35256 * @expose
35257 */
35258 Builder.isMessageField = function(def) {
35259 // Message fields require a string rule, name and type and an id
35260 if (typeof def["rule"] !== 'string' || typeof def["name"] !== 'string' || typeof def["type"] !== 'string' || typeof def["id"] === 'undefined')
35261 return false;
35262 return true;
35263 };
35264
35265 /**
35266 * Tests if a definition most likely describes an enum.
35267 * @param {!Object} def
35268 * @returns {boolean}
35269 * @expose
35270 */
35271 Builder.isEnum = function(def) {
35272 // Enums require a string name
35273 if (typeof def["name"] !== 'string')
35274 return false;
35275 // Enums require at least one value
35276 if (typeof def["values"] === 'undefined' || !Array.isArray(def["values"]) || def["values"].length === 0)
35277 return false;
35278 return true;
35279 };
35280
35281 /**
35282 * Tests if a definition most likely describes a service.
35283 * @param {!Object} def
35284 * @returns {boolean}
35285 * @expose
35286 */
35287 Builder.isService = function(def) {
35288 // Services require a string name and an rpc object
35289 if (typeof def["name"] !== 'string' || typeof def["rpc"] !== 'object' || !def["rpc"])
35290 return false;
35291 return true;
35292 };
35293
35294 /**
35295 * Tests if a definition most likely describes an extended message
35296 * @param {!Object} def
35297 * @returns {boolean}
35298 * @expose
35299 */
35300 Builder.isExtend = function(def) {
35301 // Extends rquire a string ref
35302 if (typeof def["ref"] !== 'string')
35303 return false;
35304 return true;
35305 };
35306
35307 // ----- Building -----
35308
35309 /**
35310 * Resets the pointer to the root namespace.
35311 * @returns {!ProtoBuf.Builder} this
35312 * @expose
35313 */
35314 BuilderPrototype.reset = function() {
35315 this.ptr = this.ns;
35316 return this;
35317 };
35318
35319 /**
35320 * Defines a namespace on top of the current pointer position and places the pointer on it.
35321 * @param {string} namespace
35322 * @return {!ProtoBuf.Builder} this
35323 * @expose
35324 */
35325 BuilderPrototype.define = function(namespace) {
35326 if (typeof namespace !== 'string' || !Lang.TYPEREF.test(namespace))
35327 throw Error("illegal namespace: "+namespace);
35328 namespace.split(".").forEach(function(part) {
35329 var ns = this.ptr.getChild(part);
35330 if (ns === null) // Keep existing
35331 this.ptr.addChild(ns = new Reflect.Namespace(this, this.ptr, part));
35332 this.ptr = ns;
35333 }, this);
35334 return this;
35335 };
35336
35337 /**
35338 * Creates the specified definitions at the current pointer position.
35339 * @param {!Array.<!Object>} defs Messages, enums or services to create
35340 * @returns {!ProtoBuf.Builder} this
35341 * @throws {Error} If a message definition is invalid
35342 * @expose
35343 */
35344 BuilderPrototype.create = function(defs) {
35345 if (!defs)
35346 return this; // Nothing to create
35347 if (!Array.isArray(defs))
35348 defs = [defs];
35349 else {
35350 if (defs.length === 0)
35351 return this;
35352 defs = defs.slice();
35353 }
35354
35355 // It's quite hard to keep track of scopes and memory here, so let's do this iteratively.
35356 var stack = [defs];
35357 while (stack.length > 0) {
35358 defs = stack.pop();
35359
35360 if (!Array.isArray(defs)) // Stack always contains entire namespaces
35361 throw Error("not a valid namespace: "+JSON.stringify(defs));
35362
35363 while (defs.length > 0) {
35364 var def = defs.shift(); // Namespaces always contain an array of messages, enums and services
35365
35366 if (Builder.isMessage(def)) {
35367 var obj = new Reflect.Message(this, this.ptr, def["name"], def["options"], def["isGroup"], def["syntax"]);
35368
35369 // Create OneOfs
35370 var oneofs = {};
35371 if (def["oneofs"])
35372 Object.keys(def["oneofs"]).forEach(function(name) {
35373 obj.addChild(oneofs[name] = new Reflect.Message.OneOf(this, obj, name));
35374 }, this);
35375
35376 // Create fields
35377 if (def["fields"])
35378 def["fields"].forEach(function(fld) {
35379 if (obj.getChild(fld["id"]|0) !== null)
35380 throw Error("duplicate or invalid field id in "+obj.name+": "+fld['id']);
35381 if (fld["options"] && typeof fld["options"] !== 'object')
35382 throw Error("illegal field options in "+obj.name+"#"+fld["name"]);
35383 var oneof = null;
35384 if (typeof fld["oneof"] === 'string' && !(oneof = oneofs[fld["oneof"]]))
35385 throw Error("illegal oneof in "+obj.name+"#"+fld["name"]+": "+fld["oneof"]);
35386 fld = new Reflect.Message.Field(this, obj, fld["rule"], fld["keytype"], fld["type"], fld["name"], fld["id"], fld["options"], oneof, def["syntax"]);
35387 if (oneof)
35388 oneof.fields.push(fld);
35389 obj.addChild(fld);
35390 }, this);
35391
35392 // Push children to stack
35393 var subObj = [];
35394 if (def["enums"])
35395 def["enums"].forEach(function(enm) {
35396 subObj.push(enm);
35397 });
35398 if (def["messages"])
35399 def["messages"].forEach(function(msg) {
35400 subObj.push(msg);
35401 });
35402 if (def["services"])
35403 def["services"].forEach(function(svc) {
35404 subObj.push(svc);
35405 });
35406
35407 // Set extension ranges
35408 if (def["extensions"]) {
35409 if (typeof def["extensions"][0] === 'number') // pre 5.0.1
35410 obj.extensions = [ def["extensions"] ];
35411 else
35412 obj.extensions = def["extensions"];
35413 }
35414
35415 // Create on top of current namespace
35416 this.ptr.addChild(obj);
35417 if (subObj.length > 0) {
35418 stack.push(defs); // Push the current level back
35419 defs = subObj; // Continue processing sub level
35420 subObj = null;
35421 this.ptr = obj; // And move the pointer to this namespace
35422 obj = null;
35423 continue;
35424 }
35425 subObj = null;
35426
35427 } else if (Builder.isEnum(def)) {
35428
35429 obj = new Reflect.Enum(this, this.ptr, def["name"], def["options"], def["syntax"]);
35430 def["values"].forEach(function(val) {
35431 obj.addChild(new Reflect.Enum.Value(this, obj, val["name"], val["id"]));
35432 }, this);
35433 this.ptr.addChild(obj);
35434
35435 } else if (Builder.isService(def)) {
35436
35437 obj = new Reflect.Service(this, this.ptr, def["name"], def["options"]);
35438 Object.keys(def["rpc"]).forEach(function(name) {
35439 var mtd = def["rpc"][name];
35440 obj.addChild(new Reflect.Service.RPCMethod(this, obj, name, mtd["request"], mtd["response"], !!mtd["request_stream"], !!mtd["response_stream"], mtd["options"]));
35441 }, this);
35442 this.ptr.addChild(obj);
35443
35444 } else if (Builder.isExtend(def)) {
35445
35446 obj = this.ptr.resolve(def["ref"], true);
35447 if (obj) {
35448 def["fields"].forEach(function(fld) {
35449 if (obj.getChild(fld['id']|0) !== null)
35450 throw Error("duplicate extended field id in "+obj.name+": "+fld['id']);
35451 // Check if field id is allowed to be extended
35452 if (obj.extensions) {
35453 var valid = false;
35454 obj.extensions.forEach(function(range) {
35455 if (fld["id"] >= range[0] && fld["id"] <= range[1])
35456 valid = true;
35457 });
35458 if (!valid)
35459 throw Error("illegal extended field id in "+obj.name+": "+fld['id']+" (not within valid ranges)");
35460 }
35461 // Convert extension field names to camel case notation if the override is set
35462 var name = fld["name"];
35463 if (this.options['convertFieldsToCamelCase'])
35464 name = ProtoBuf.Util.toCamelCase(name);
35465 // see #161: Extensions use their fully qualified name as their runtime key and...
35466 var field = new Reflect.Message.ExtensionField(this, obj, fld["rule"], fld["type"], this.ptr.fqn()+'.'+name, fld["id"], fld["options"]);
35467 // ...are added on top of the current namespace as an extension which is used for
35468 // resolving their type later on (the extension always keeps the original name to
35469 // prevent naming collisions)
35470 var ext = new Reflect.Extension(this, this.ptr, fld["name"], field);
35471 field.extension = ext;
35472 this.ptr.addChild(ext);
35473 obj.addChild(field);
35474 }, this);
35475
35476 } else if (!/\.?google\.protobuf\./.test(def["ref"])) // Silently skip internal extensions
35477 throw Error("extended message "+def["ref"]+" is not defined");
35478
35479 } else
35480 throw Error("not a valid definition: "+JSON.stringify(def));
35481
35482 def = null;
35483 obj = null;
35484 }
35485 // Break goes here
35486 defs = null;
35487 this.ptr = this.ptr.parent; // Namespace done, continue at parent
35488 }
35489 this.resolved = false; // Require re-resolve
35490 this.result = null; // Require re-build
35491 return this;
35492 };
35493
35494 /**
35495 * Propagates syntax to all children.
35496 * @param {!Object} parent
35497 * @inner
35498 */
35499 function propagateSyntax(parent) {
35500 if (parent['messages']) {
35501 parent['messages'].forEach(function(child) {
35502 child["syntax"] = parent["syntax"];
35503 propagateSyntax(child);
35504 });
35505 }
35506 if (parent['enums']) {
35507 parent['enums'].forEach(function(child) {
35508 child["syntax"] = parent["syntax"];
35509 });
35510 }
35511 }
35512
35513 /**
35514 * Imports another definition into this builder.
35515 * @param {Object.<string,*>} json Parsed import
35516 * @param {(string|{root: string, file: string})=} filename Imported file name
35517 * @returns {!ProtoBuf.Builder} this
35518 * @throws {Error} If the definition or file cannot be imported
35519 * @expose
35520 */
35521 BuilderPrototype["import"] = function(json, filename) {
35522 var delim = '/';
35523
35524 // Make sure to skip duplicate imports
35525
35526 if (typeof filename === 'string') {
35527
35528 if (ProtoBuf.Util.IS_NODE)
35529 filename = __webpack_require__(117)['resolve'](filename);
35530 if (this.files[filename] === true)
35531 return this.reset();
35532 this.files[filename] = true;
35533
35534 } else if (typeof filename === 'object') { // Object with root, file.
35535
35536 var root = filename.root;
35537 if (ProtoBuf.Util.IS_NODE)
35538 root = __webpack_require__(117)['resolve'](root);
35539 if (root.indexOf("\\") >= 0 || filename.file.indexOf("\\") >= 0)
35540 delim = '\\';
35541 var fname;
35542 if (ProtoBuf.Util.IS_NODE)
35543 fname = __webpack_require__(117)['join'](root, filename.file);
35544 else
35545 fname = root + delim + filename.file;
35546 if (this.files[fname] === true)
35547 return this.reset();
35548 this.files[fname] = true;
35549 }
35550
35551 // Import imports
35552
35553 if (json['imports'] && json['imports'].length > 0) {
35554 var importRoot,
35555 resetRoot = false;
35556
35557 if (typeof filename === 'object') { // If an import root is specified, override
35558
35559 this.importRoot = filename["root"]; resetRoot = true; // ... and reset afterwards
35560 importRoot = this.importRoot;
35561 filename = filename["file"];
35562 if (importRoot.indexOf("\\") >= 0 || filename.indexOf("\\") >= 0)
35563 delim = '\\';
35564
35565 } else if (typeof filename === 'string') {
35566
35567 if (this.importRoot) // If import root is overridden, use it
35568 importRoot = this.importRoot;
35569 else { // Otherwise compute from filename
35570 if (filename.indexOf("/") >= 0) { // Unix
35571 importRoot = filename.replace(/\/[^\/]*$/, "");
35572 if (/* /file.proto */ importRoot === "")
35573 importRoot = "/";
35574 } else if (filename.indexOf("\\") >= 0) { // Windows
35575 importRoot = filename.replace(/\\[^\\]*$/, "");
35576 delim = '\\';
35577 } else
35578 importRoot = ".";
35579 }
35580
35581 } else
35582 importRoot = null;
35583
35584 for (var i=0; i<json['imports'].length; i++) {
35585 if (typeof json['imports'][i] === 'string') { // Import file
35586 if (!importRoot)
35587 throw Error("cannot determine import root");
35588 var importFilename = json['imports'][i];
35589 if (importFilename === "google/protobuf/descriptor.proto")
35590 continue; // Not needed and therefore not used
35591 if (ProtoBuf.Util.IS_NODE)
35592 importFilename = __webpack_require__(117)['join'](importRoot, importFilename);
35593 else
35594 importFilename = importRoot + delim + importFilename;
35595 if (this.files[importFilename] === true)
35596 continue; // Already imported
35597 if (/\.proto$/i.test(importFilename) && !ProtoBuf.DotProto) // If this is a light build
35598 importFilename = importFilename.replace(/\.proto$/, ".json"); // always load the JSON file
35599 var contents = ProtoBuf.Util.fetch(importFilename);
35600 if (contents === null)
35601 throw Error("failed to import '"+importFilename+"' in '"+filename+"': file not found");
35602 if (/\.json$/i.test(importFilename)) // Always possible
35603 this["import"](JSON.parse(contents+""), importFilename); // May throw
35604 else
35605 this["import"](ProtoBuf.DotProto.Parser.parse(contents), importFilename); // May throw
35606 } else // Import structure
35607 if (!filename)
35608 this["import"](json['imports'][i]);
35609 else if (/\.(\w+)$/.test(filename)) // With extension: Append _importN to the name portion to make it unique
35610 this["import"](json['imports'][i], filename.replace(/^(.+)\.(\w+)$/, function($0, $1, $2) { return $1+"_import"+i+"."+$2; }));
35611 else // Without extension: Append _importN to make it unique
35612 this["import"](json['imports'][i], filename+"_import"+i);
35613 }
35614 if (resetRoot) // Reset import root override when all imports are done
35615 this.importRoot = null;
35616 }
35617
35618 // Import structures
35619
35620 if (json['package'])
35621 this.define(json['package']);
35622 if (json['syntax'])
35623 propagateSyntax(json);
35624 var base = this.ptr;
35625 if (json['options'])
35626 Object.keys(json['options']).forEach(function(key) {
35627 base.options[key] = json['options'][key];
35628 });
35629 if (json['messages'])
35630 this.create(json['messages']),
35631 this.ptr = base;
35632 if (json['enums'])
35633 this.create(json['enums']),
35634 this.ptr = base;
35635 if (json['services'])
35636 this.create(json['services']),
35637 this.ptr = base;
35638 if (json['extends'])
35639 this.create(json['extends']);
35640
35641 return this.reset();
35642 };
35643
35644 /**
35645 * Resolves all namespace objects.
35646 * @throws {Error} If a type cannot be resolved
35647 * @returns {!ProtoBuf.Builder} this
35648 * @expose
35649 */
35650 BuilderPrototype.resolveAll = function() {
35651 // Resolve all reflected objects
35652 var res;
35653 if (this.ptr == null || typeof this.ptr.type === 'object')
35654 return this; // Done (already resolved)
35655
35656 if (this.ptr instanceof Reflect.Namespace) { // Resolve children
35657
35658 this.ptr.children.forEach(function(child) {
35659 this.ptr = child;
35660 this.resolveAll();
35661 }, this);
35662
35663 } else if (this.ptr instanceof Reflect.Message.Field) { // Resolve type
35664
35665 if (!Lang.TYPE.test(this.ptr.type)) {
35666 if (!Lang.TYPEREF.test(this.ptr.type))
35667 throw Error("illegal type reference in "+this.ptr.toString(true)+": "+this.ptr.type);
35668 res = (this.ptr instanceof Reflect.Message.ExtensionField ? this.ptr.extension.parent : this.ptr.parent).resolve(this.ptr.type, true);
35669 if (!res)
35670 throw Error("unresolvable type reference in "+this.ptr.toString(true)+": "+this.ptr.type);
35671 this.ptr.resolvedType = res;
35672 if (res instanceof Reflect.Enum) {
35673 this.ptr.type = ProtoBuf.TYPES["enum"];
35674 if (this.ptr.syntax === 'proto3' && res.syntax !== 'proto3')
35675 throw Error("proto3 message cannot reference proto2 enum");
35676 }
35677 else if (res instanceof Reflect.Message)
35678 this.ptr.type = res.isGroup ? ProtoBuf.TYPES["group"] : ProtoBuf.TYPES["message"];
35679 else
35680 throw Error("illegal type reference in "+this.ptr.toString(true)+": "+this.ptr.type);
35681 } else
35682 this.ptr.type = ProtoBuf.TYPES[this.ptr.type];
35683
35684 // If it's a map field, also resolve the key type. The key type can be only a numeric, string, or bool type
35685 // (i.e., no enums or messages), so we don't need to resolve against the current namespace.
35686 if (this.ptr.map) {
35687 if (!Lang.TYPE.test(this.ptr.keyType))
35688 throw Error("illegal key type for map field in "+this.ptr.toString(true)+": "+this.ptr.keyType);
35689 this.ptr.keyType = ProtoBuf.TYPES[this.ptr.keyType];
35690 }
35691
35692 // If it's a repeated and packable field then proto3 mandates it should be packed by
35693 // default
35694 if (
35695 this.ptr.syntax === 'proto3' &&
35696 this.ptr.repeated && this.ptr.options.packed === undefined &&
35697 ProtoBuf.PACKABLE_WIRE_TYPES.indexOf(this.ptr.type.wireType) !== -1
35698 ) {
35699 this.ptr.options.packed = true;
35700 }
35701
35702 } else if (this.ptr instanceof ProtoBuf.Reflect.Service.Method) {
35703
35704 if (this.ptr instanceof ProtoBuf.Reflect.Service.RPCMethod) {
35705 res = this.ptr.parent.resolve(this.ptr.requestName, true);
35706 if (!res || !(res instanceof ProtoBuf.Reflect.Message))
35707 throw Error("Illegal type reference in "+this.ptr.toString(true)+": "+this.ptr.requestName);
35708 this.ptr.resolvedRequestType = res;
35709 res = this.ptr.parent.resolve(this.ptr.responseName, true);
35710 if (!res || !(res instanceof ProtoBuf.Reflect.Message))
35711 throw Error("Illegal type reference in "+this.ptr.toString(true)+": "+this.ptr.responseName);
35712 this.ptr.resolvedResponseType = res;
35713 } else // Should not happen as nothing else is implemented
35714 throw Error("illegal service type in "+this.ptr.toString(true));
35715
35716 } else if (
35717 !(this.ptr instanceof ProtoBuf.Reflect.Message.OneOf) && // Not built
35718 !(this.ptr instanceof ProtoBuf.Reflect.Extension) && // Not built
35719 !(this.ptr instanceof ProtoBuf.Reflect.Enum.Value) // Built in enum
35720 )
35721 throw Error("illegal object in namespace: "+typeof(this.ptr)+": "+this.ptr);
35722
35723 return this.reset();
35724 };
35725
35726 /**
35727 * Builds the protocol. This will first try to resolve all definitions and, if this has been successful,
35728 * return the built package.
35729 * @param {(string|Array.<string>)=} path Specifies what to return. If omitted, the entire namespace will be returned.
35730 * @returns {!ProtoBuf.Builder.Message|!Object.<string,*>}
35731 * @throws {Error} If a type could not be resolved
35732 * @expose
35733 */
35734 BuilderPrototype.build = function(path) {
35735 this.reset();
35736 if (!this.resolved)
35737 this.resolveAll(),
35738 this.resolved = true,
35739 this.result = null; // Require re-build
35740 if (this.result === null) // (Re-)Build
35741 this.result = this.ns.build();
35742 if (!path)
35743 return this.result;
35744 var part = typeof path === 'string' ? path.split(".") : path,
35745 ptr = this.result; // Build namespace pointer (no hasChild etc.)
35746 for (var i=0; i<part.length; i++)
35747 if (ptr[part[i]])
35748 ptr = ptr[part[i]];
35749 else {
35750 ptr = null;
35751 break;
35752 }
35753 return ptr;
35754 };
35755
35756 /**
35757 * Similar to {@link ProtoBuf.Builder#build}, but looks up the internal reflection descriptor.
35758 * @param {string=} path Specifies what to return. If omitted, the entire namespace wiil be returned.
35759 * @param {boolean=} excludeNonNamespace Excludes non-namespace types like fields, defaults to `false`
35760 * @returns {?ProtoBuf.Reflect.T} Reflection descriptor or `null` if not found
35761 */
35762 BuilderPrototype.lookup = function(path, excludeNonNamespace) {
35763 return path ? this.ns.resolve(path, excludeNonNamespace) : this.ns;
35764 };
35765
35766 /**
35767 * Returns a string representation of this object.
35768 * @return {string} String representation as of "Builder"
35769 * @expose
35770 */
35771 BuilderPrototype.toString = function() {
35772 return "Builder";
35773 };
35774
35775 // ----- Base classes -----
35776 // Exist for the sole purpose of being able to "... instanceof ProtoBuf.Builder.Message" etc.
35777
35778 /**
35779 * @alias ProtoBuf.Builder.Message
35780 */
35781 Builder.Message = function() {};
35782
35783 /**
35784 * @alias ProtoBuf.Builder.Enum
35785 */
35786 Builder.Enum = function() {};
35787
35788 /**
35789 * @alias ProtoBuf.Builder.Message
35790 */
35791 Builder.Service = function() {};
35792
35793 return Builder;
35794
35795 })(ProtoBuf, ProtoBuf.Lang, ProtoBuf.Reflect);
35796
35797 /**
35798 * @alias ProtoBuf.Map
35799 * @expose
35800 */
35801 ProtoBuf.Map = (function(ProtoBuf, Reflect) {
35802 "use strict";
35803
35804 /**
35805 * Constructs a new Map. A Map is a container that is used to implement map
35806 * fields on message objects. It closely follows the ES6 Map API; however,
35807 * it is distinct because we do not want to depend on external polyfills or
35808 * on ES6 itself.
35809 *
35810 * @exports ProtoBuf.Map
35811 * @param {!ProtoBuf.Reflect.Field} field Map field
35812 * @param {Object.<string,*>=} contents Initial contents
35813 * @constructor
35814 */
35815 var Map = function(field, contents) {
35816 if (!field.map)
35817 throw Error("field is not a map");
35818
35819 /**
35820 * The field corresponding to this map.
35821 * @type {!ProtoBuf.Reflect.Field}
35822 */
35823 this.field = field;
35824
35825 /**
35826 * Element instance corresponding to key type.
35827 * @type {!ProtoBuf.Reflect.Element}
35828 */
35829 this.keyElem = new Reflect.Element(field.keyType, null, true, field.syntax);
35830
35831 /**
35832 * Element instance corresponding to value type.
35833 * @type {!ProtoBuf.Reflect.Element}
35834 */
35835 this.valueElem = new Reflect.Element(field.type, field.resolvedType, false, field.syntax);
35836
35837 /**
35838 * Internal map: stores mapping of (string form of key) -> (key, value)
35839 * pair.
35840 *
35841 * We provide map semantics for arbitrary key types, but we build on top
35842 * of an Object, which has only string keys. In order to avoid the need
35843 * to convert a string key back to its native type in many situations,
35844 * we store the native key value alongside the value. Thus, we only need
35845 * a one-way mapping from a key type to its string form that guarantees
35846 * uniqueness and equality (i.e., str(K1) === str(K2) if and only if K1
35847 * === K2).
35848 *
35849 * @type {!Object<string, {key: *, value: *}>}
35850 */
35851 this.map = {};
35852
35853 /**
35854 * Returns the number of elements in the map.
35855 */
35856 Object.defineProperty(this, "size", {
35857 get: function() { return Object.keys(this.map).length; }
35858 });
35859
35860 // Fill initial contents from a raw object.
35861 if (contents) {
35862 var keys = Object.keys(contents);
35863 for (var i = 0; i < keys.length; i++) {
35864 var key = this.keyElem.valueFromString(keys[i]);
35865 var val = this.valueElem.verifyValue(contents[keys[i]]);
35866 this.map[this.keyElem.valueToString(key)] =
35867 { key: key, value: val };
35868 }
35869 }
35870 };
35871
35872 var MapPrototype = Map.prototype;
35873
35874 /**
35875 * Helper: return an iterator over an array.
35876 * @param {!Array<*>} arr the array
35877 * @returns {!Object} an iterator
35878 * @inner
35879 */
35880 function arrayIterator(arr) {
35881 var idx = 0;
35882 return {
35883 next: function() {
35884 if (idx < arr.length)
35885 return { done: false, value: arr[idx++] };
35886 return { done: true };
35887 }
35888 }
35889 }
35890
35891 /**
35892 * Clears the map.
35893 */
35894 MapPrototype.clear = function() {
35895 this.map = {};
35896 };
35897
35898 /**
35899 * Deletes a particular key from the map.
35900 * @returns {boolean} Whether any entry with this key was deleted.
35901 */
35902 MapPrototype["delete"] = function(key) {
35903 var keyValue = this.keyElem.valueToString(this.keyElem.verifyValue(key));
35904 var hadKey = keyValue in this.map;
35905 delete this.map[keyValue];
35906 return hadKey;
35907 };
35908
35909 /**
35910 * Returns an iterator over [key, value] pairs in the map.
35911 * @returns {Object} The iterator
35912 */
35913 MapPrototype.entries = function() {
35914 var entries = [];
35915 var strKeys = Object.keys(this.map);
35916 for (var i = 0, entry; i < strKeys.length; i++)
35917 entries.push([(entry=this.map[strKeys[i]]).key, entry.value]);
35918 return arrayIterator(entries);
35919 };
35920
35921 /**
35922 * Returns an iterator over keys in the map.
35923 * @returns {Object} The iterator
35924 */
35925 MapPrototype.keys = function() {
35926 var keys = [];
35927 var strKeys = Object.keys(this.map);
35928 for (var i = 0; i < strKeys.length; i++)
35929 keys.push(this.map[strKeys[i]].key);
35930 return arrayIterator(keys);
35931 };
35932
35933 /**
35934 * Returns an iterator over values in the map.
35935 * @returns {!Object} The iterator
35936 */
35937 MapPrototype.values = function() {
35938 var values = [];
35939 var strKeys = Object.keys(this.map);
35940 for (var i = 0; i < strKeys.length; i++)
35941 values.push(this.map[strKeys[i]].value);
35942 return arrayIterator(values);
35943 };
35944
35945 /**
35946 * Iterates over entries in the map, calling a function on each.
35947 * @param {function(this:*, *, *, *)} cb The callback to invoke with value, key, and map arguments.
35948 * @param {Object=} thisArg The `this` value for the callback
35949 */
35950 MapPrototype.forEach = function(cb, thisArg) {
35951 var strKeys = Object.keys(this.map);
35952 for (var i = 0, entry; i < strKeys.length; i++)
35953 cb.call(thisArg, (entry=this.map[strKeys[i]]).value, entry.key, this);
35954 };
35955
35956 /**
35957 * Sets a key in the map to the given value.
35958 * @param {*} key The key
35959 * @param {*} value The value
35960 * @returns {!ProtoBuf.Map} The map instance
35961 */
35962 MapPrototype.set = function(key, value) {
35963 var keyValue = this.keyElem.verifyValue(key);
35964 var valValue = this.valueElem.verifyValue(value);
35965 this.map[this.keyElem.valueToString(keyValue)] =
35966 { key: keyValue, value: valValue };
35967 return this;
35968 };
35969
35970 /**
35971 * Gets the value corresponding to a key in the map.
35972 * @param {*} key The key
35973 * @returns {*|undefined} The value, or `undefined` if key not present
35974 */
35975 MapPrototype.get = function(key) {
35976 var keyValue = this.keyElem.valueToString(this.keyElem.verifyValue(key));
35977 if (!(keyValue in this.map))
35978 return undefined;
35979 return this.map[keyValue].value;
35980 };
35981
35982 /**
35983 * Determines whether the given key is present in the map.
35984 * @param {*} key The key
35985 * @returns {boolean} `true` if the key is present
35986 */
35987 MapPrototype.has = function(key) {
35988 var keyValue = this.keyElem.valueToString(this.keyElem.verifyValue(key));
35989 return (keyValue in this.map);
35990 };
35991
35992 return Map;
35993 })(ProtoBuf, ProtoBuf.Reflect);
35994
35995
35996 /**
35997 * Constructs a new empty Builder.
35998 * @param {Object.<string,*>=} options Builder options, defaults to global options set on ProtoBuf
35999 * @return {!ProtoBuf.Builder} Builder
36000 * @expose
36001 */
36002 ProtoBuf.newBuilder = function(options) {
36003 options = options || {};
36004 if (typeof options['convertFieldsToCamelCase'] === 'undefined')
36005 options['convertFieldsToCamelCase'] = ProtoBuf.convertFieldsToCamelCase;
36006 if (typeof options['populateAccessors'] === 'undefined')
36007 options['populateAccessors'] = ProtoBuf.populateAccessors;
36008 return new ProtoBuf.Builder(options);
36009 };
36010
36011 /**
36012 * Loads a .json definition and returns the Builder.
36013 * @param {!*|string} json JSON definition
36014 * @param {(ProtoBuf.Builder|string|{root: string, file: string})=} builder Builder to append to. Will create a new one if omitted.
36015 * @param {(string|{root: string, file: string})=} filename The corresponding file name if known. Must be specified for imports.
36016 * @return {ProtoBuf.Builder} Builder to create new messages
36017 * @throws {Error} If the definition cannot be parsed or built
36018 * @expose
36019 */
36020 ProtoBuf.loadJson = function(json, builder, filename) {
36021 if (typeof builder === 'string' || (builder && typeof builder["file"] === 'string' && typeof builder["root"] === 'string'))
36022 filename = builder,
36023 builder = null;
36024 if (!builder || typeof builder !== 'object')
36025 builder = ProtoBuf.newBuilder();
36026 if (typeof json === 'string')
36027 json = JSON.parse(json);
36028 builder["import"](json, filename);
36029 builder.resolveAll();
36030 return builder;
36031 };
36032
36033 /**
36034 * Loads a .json file and returns the Builder.
36035 * @param {string|!{root: string, file: string}} filename Path to json file or an object specifying 'file' with
36036 * an overridden 'root' path for all imported files.
36037 * @param {function(?Error, !ProtoBuf.Builder=)=} callback Callback that will receive `null` as the first and
36038 * the Builder as its second argument on success, otherwise the error as its first argument. If omitted, the
36039 * file will be read synchronously and this function will return the Builder.
36040 * @param {ProtoBuf.Builder=} builder Builder to append to. Will create a new one if omitted.
36041 * @return {?ProtoBuf.Builder|undefined} The Builder if synchronous (no callback specified, will be NULL if the
36042 * request has failed), else undefined
36043 * @expose
36044 */
36045 ProtoBuf.loadJsonFile = function(filename, callback, builder) {
36046 if (callback && typeof callback === 'object')
36047 builder = callback,
36048 callback = null;
36049 else if (!callback || typeof callback !== 'function')
36050 callback = null;
36051 if (callback)
36052 return ProtoBuf.Util.fetch(typeof filename === 'string' ? filename : filename["root"]+"/"+filename["file"], function(contents) {
36053 if (contents === null) {
36054 callback(Error("Failed to fetch file"));
36055 return;
36056 }
36057 try {
36058 callback(null, ProtoBuf.loadJson(JSON.parse(contents), builder, filename));
36059 } catch (e) {
36060 callback(e);
36061 }
36062 });
36063 var contents = ProtoBuf.Util.fetch(typeof filename === 'object' ? filename["root"]+"/"+filename["file"] : filename);
36064 return contents === null ? null : ProtoBuf.loadJson(JSON.parse(contents), builder, filename);
36065 };
36066
36067 return ProtoBuf;
36068});
36069
36070
36071/***/ }),
36072/* 615 */
36073/***/ (function(module, exports, __webpack_require__) {
36074
36075var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*
36076 Copyright 2013-2014 Daniel Wirtz <dcode@dcode.io>
36077
36078 Licensed under the Apache License, Version 2.0 (the "License");
36079 you may not use this file except in compliance with the License.
36080 You may obtain a copy of the License at
36081
36082 http://www.apache.org/licenses/LICENSE-2.0
36083
36084 Unless required by applicable law or agreed to in writing, software
36085 distributed under the License is distributed on an "AS IS" BASIS,
36086 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
36087 See the License for the specific language governing permissions and
36088 limitations under the License.
36089 */
36090
36091/**
36092 * @license bytebuffer.js (c) 2015 Daniel Wirtz <dcode@dcode.io>
36093 * Backing buffer: ArrayBuffer, Accessor: Uint8Array
36094 * Released under the Apache License, Version 2.0
36095 * see: https://github.com/dcodeIO/bytebuffer.js for details
36096 */
36097(function(global, factory) {
36098
36099 /* AMD */ if (true)
36100 !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(616)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
36101 __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
36102 (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
36103 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
36104 /* CommonJS */ else if (typeof require === 'function' && typeof module === "object" && module && module["exports"])
36105 module['exports'] = (function() {
36106 var Long; try { Long = require("long"); } catch (e) {}
36107 return factory(Long);
36108 })();
36109 /* Global */ else
36110 (global["dcodeIO"] = global["dcodeIO"] || {})["ByteBuffer"] = factory(global["dcodeIO"]["Long"]);
36111
36112})(this, function(Long) {
36113 "use strict";
36114
36115 /**
36116 * Constructs a new ByteBuffer.
36117 * @class The swiss army knife for binary data in JavaScript.
36118 * @exports ByteBuffer
36119 * @constructor
36120 * @param {number=} capacity Initial capacity. Defaults to {@link ByteBuffer.DEFAULT_CAPACITY}.
36121 * @param {boolean=} littleEndian Whether to use little or big endian byte order. Defaults to
36122 * {@link ByteBuffer.DEFAULT_ENDIAN}.
36123 * @param {boolean=} noAssert Whether to skip assertions of offsets and values. Defaults to
36124 * {@link ByteBuffer.DEFAULT_NOASSERT}.
36125 * @expose
36126 */
36127 var ByteBuffer = function(capacity, littleEndian, noAssert) {
36128 if (typeof capacity === 'undefined')
36129 capacity = ByteBuffer.DEFAULT_CAPACITY;
36130 if (typeof littleEndian === 'undefined')
36131 littleEndian = ByteBuffer.DEFAULT_ENDIAN;
36132 if (typeof noAssert === 'undefined')
36133 noAssert = ByteBuffer.DEFAULT_NOASSERT;
36134 if (!noAssert) {
36135 capacity = capacity | 0;
36136 if (capacity < 0)
36137 throw RangeError("Illegal capacity");
36138 littleEndian = !!littleEndian;
36139 noAssert = !!noAssert;
36140 }
36141
36142 /**
36143 * Backing ArrayBuffer.
36144 * @type {!ArrayBuffer}
36145 * @expose
36146 */
36147 this.buffer = capacity === 0 ? EMPTY_BUFFER : new ArrayBuffer(capacity);
36148
36149 /**
36150 * Uint8Array utilized to manipulate the backing buffer. Becomes `null` if the backing buffer has a capacity of `0`.
36151 * @type {?Uint8Array}
36152 * @expose
36153 */
36154 this.view = capacity === 0 ? null : new Uint8Array(this.buffer);
36155
36156 /**
36157 * Absolute read/write offset.
36158 * @type {number}
36159 * @expose
36160 * @see ByteBuffer#flip
36161 * @see ByteBuffer#clear
36162 */
36163 this.offset = 0;
36164
36165 /**
36166 * Marked offset.
36167 * @type {number}
36168 * @expose
36169 * @see ByteBuffer#mark
36170 * @see ByteBuffer#reset
36171 */
36172 this.markedOffset = -1;
36173
36174 /**
36175 * Absolute limit of the contained data. Set to the backing buffer's capacity upon allocation.
36176 * @type {number}
36177 * @expose
36178 * @see ByteBuffer#flip
36179 * @see ByteBuffer#clear
36180 */
36181 this.limit = capacity;
36182
36183 /**
36184 * Whether to use little endian byte order, defaults to `false` for big endian.
36185 * @type {boolean}
36186 * @expose
36187 */
36188 this.littleEndian = littleEndian;
36189
36190 /**
36191 * Whether to skip assertions of offsets and values, defaults to `false`.
36192 * @type {boolean}
36193 * @expose
36194 */
36195 this.noAssert = noAssert;
36196 };
36197
36198 /**
36199 * ByteBuffer version.
36200 * @type {string}
36201 * @const
36202 * @expose
36203 */
36204 ByteBuffer.VERSION = "5.0.1";
36205
36206 /**
36207 * Little endian constant that can be used instead of its boolean value. Evaluates to `true`.
36208 * @type {boolean}
36209 * @const
36210 * @expose
36211 */
36212 ByteBuffer.LITTLE_ENDIAN = true;
36213
36214 /**
36215 * Big endian constant that can be used instead of its boolean value. Evaluates to `false`.
36216 * @type {boolean}
36217 * @const
36218 * @expose
36219 */
36220 ByteBuffer.BIG_ENDIAN = false;
36221
36222 /**
36223 * Default initial capacity of `16`.
36224 * @type {number}
36225 * @expose
36226 */
36227 ByteBuffer.DEFAULT_CAPACITY = 16;
36228
36229 /**
36230 * Default endianess of `false` for big endian.
36231 * @type {boolean}
36232 * @expose
36233 */
36234 ByteBuffer.DEFAULT_ENDIAN = ByteBuffer.BIG_ENDIAN;
36235
36236 /**
36237 * Default no assertions flag of `false`.
36238 * @type {boolean}
36239 * @expose
36240 */
36241 ByteBuffer.DEFAULT_NOASSERT = false;
36242
36243 /**
36244 * A `Long` class for representing a 64-bit two's-complement integer value. May be `null` if Long.js has not been loaded
36245 * and int64 support is not available.
36246 * @type {?Long}
36247 * @const
36248 * @see https://github.com/dcodeIO/long.js
36249 * @expose
36250 */
36251 ByteBuffer.Long = Long || null;
36252
36253 /**
36254 * @alias ByteBuffer.prototype
36255 * @inner
36256 */
36257 var ByteBufferPrototype = ByteBuffer.prototype;
36258
36259 /**
36260 * An indicator used to reliably determine if an object is a ByteBuffer or not.
36261 * @type {boolean}
36262 * @const
36263 * @expose
36264 * @private
36265 */
36266 ByteBufferPrototype.__isByteBuffer__;
36267
36268 Object.defineProperty(ByteBufferPrototype, "__isByteBuffer__", {
36269 value: true,
36270 enumerable: false,
36271 configurable: false
36272 });
36273
36274 // helpers
36275
36276 /**
36277 * @type {!ArrayBuffer}
36278 * @inner
36279 */
36280 var EMPTY_BUFFER = new ArrayBuffer(0);
36281
36282 /**
36283 * String.fromCharCode reference for compile-time renaming.
36284 * @type {function(...number):string}
36285 * @inner
36286 */
36287 var stringFromCharCode = String.fromCharCode;
36288
36289 /**
36290 * Creates a source function for a string.
36291 * @param {string} s String to read from
36292 * @returns {function():number|null} Source function returning the next char code respectively `null` if there are
36293 * no more characters left.
36294 * @throws {TypeError} If the argument is invalid
36295 * @inner
36296 */
36297 function stringSource(s) {
36298 var i=0; return function() {
36299 return i < s.length ? s.charCodeAt(i++) : null;
36300 };
36301 }
36302
36303 /**
36304 * Creates a destination function for a string.
36305 * @returns {function(number=):undefined|string} Destination function successively called with the next char code.
36306 * Returns the final string when called without arguments.
36307 * @inner
36308 */
36309 function stringDestination() {
36310 var cs = [], ps = []; return function() {
36311 if (arguments.length === 0)
36312 return ps.join('')+stringFromCharCode.apply(String, cs);
36313 if (cs.length + arguments.length > 1024)
36314 ps.push(stringFromCharCode.apply(String, cs)),
36315 cs.length = 0;
36316 Array.prototype.push.apply(cs, arguments);
36317 };
36318 }
36319
36320 /**
36321 * Gets the accessor type.
36322 * @returns {Function} `Buffer` under node.js, `Uint8Array` respectively `DataView` in the browser (classes)
36323 * @expose
36324 */
36325 ByteBuffer.accessor = function() {
36326 return Uint8Array;
36327 };
36328 /**
36329 * Allocates a new ByteBuffer backed by a buffer of the specified capacity.
36330 * @param {number=} capacity Initial capacity. Defaults to {@link ByteBuffer.DEFAULT_CAPACITY}.
36331 * @param {boolean=} littleEndian Whether to use little or big endian byte order. Defaults to
36332 * {@link ByteBuffer.DEFAULT_ENDIAN}.
36333 * @param {boolean=} noAssert Whether to skip assertions of offsets and values. Defaults to
36334 * {@link ByteBuffer.DEFAULT_NOASSERT}.
36335 * @returns {!ByteBuffer}
36336 * @expose
36337 */
36338 ByteBuffer.allocate = function(capacity, littleEndian, noAssert) {
36339 return new ByteBuffer(capacity, littleEndian, noAssert);
36340 };
36341
36342 /**
36343 * Concatenates multiple ByteBuffers into one.
36344 * @param {!Array.<!ByteBuffer|!ArrayBuffer|!Uint8Array|string>} buffers Buffers to concatenate
36345 * @param {(string|boolean)=} encoding String encoding if `buffers` contains a string ("base64", "hex", "binary",
36346 * defaults to "utf8")
36347 * @param {boolean=} littleEndian Whether to use little or big endian byte order for the resulting ByteBuffer. Defaults
36348 * to {@link ByteBuffer.DEFAULT_ENDIAN}.
36349 * @param {boolean=} noAssert Whether to skip assertions of offsets and values for the resulting ByteBuffer. Defaults to
36350 * {@link ByteBuffer.DEFAULT_NOASSERT}.
36351 * @returns {!ByteBuffer} Concatenated ByteBuffer
36352 * @expose
36353 */
36354 ByteBuffer.concat = function(buffers, encoding, littleEndian, noAssert) {
36355 if (typeof encoding === 'boolean' || typeof encoding !== 'string') {
36356 noAssert = littleEndian;
36357 littleEndian = encoding;
36358 encoding = undefined;
36359 }
36360 var capacity = 0;
36361 for (var i=0, k=buffers.length, length; i<k; ++i) {
36362 if (!ByteBuffer.isByteBuffer(buffers[i]))
36363 buffers[i] = ByteBuffer.wrap(buffers[i], encoding);
36364 length = buffers[i].limit - buffers[i].offset;
36365 if (length > 0) capacity += length;
36366 }
36367 if (capacity === 0)
36368 return new ByteBuffer(0, littleEndian, noAssert);
36369 var bb = new ByteBuffer(capacity, littleEndian, noAssert),
36370 bi;
36371 i=0; while (i<k) {
36372 bi = buffers[i++];
36373 length = bi.limit - bi.offset;
36374 if (length <= 0) continue;
36375 bb.view.set(bi.view.subarray(bi.offset, bi.limit), bb.offset);
36376 bb.offset += length;
36377 }
36378 bb.limit = bb.offset;
36379 bb.offset = 0;
36380 return bb;
36381 };
36382
36383 /**
36384 * Tests if the specified type is a ByteBuffer.
36385 * @param {*} bb ByteBuffer to test
36386 * @returns {boolean} `true` if it is a ByteBuffer, otherwise `false`
36387 * @expose
36388 */
36389 ByteBuffer.isByteBuffer = function(bb) {
36390 return (bb && bb["__isByteBuffer__"]) === true;
36391 };
36392 /**
36393 * Gets the backing buffer type.
36394 * @returns {Function} `Buffer` under node.js, `ArrayBuffer` in the browser (classes)
36395 * @expose
36396 */
36397 ByteBuffer.type = function() {
36398 return ArrayBuffer;
36399 };
36400 /**
36401 * Wraps a buffer or a string. Sets the allocated ByteBuffer's {@link ByteBuffer#offset} to `0` and its
36402 * {@link ByteBuffer#limit} to the length of the wrapped data.
36403 * @param {!ByteBuffer|!ArrayBuffer|!Uint8Array|string|!Array.<number>} buffer Anything that can be wrapped
36404 * @param {(string|boolean)=} encoding String encoding if `buffer` is a string ("base64", "hex", "binary", defaults to
36405 * "utf8")
36406 * @param {boolean=} littleEndian Whether to use little or big endian byte order. Defaults to
36407 * {@link ByteBuffer.DEFAULT_ENDIAN}.
36408 * @param {boolean=} noAssert Whether to skip assertions of offsets and values. Defaults to
36409 * {@link ByteBuffer.DEFAULT_NOASSERT}.
36410 * @returns {!ByteBuffer} A ByteBuffer wrapping `buffer`
36411 * @expose
36412 */
36413 ByteBuffer.wrap = function(buffer, encoding, littleEndian, noAssert) {
36414 if (typeof encoding !== 'string') {
36415 noAssert = littleEndian;
36416 littleEndian = encoding;
36417 encoding = undefined;
36418 }
36419 if (typeof buffer === 'string') {
36420 if (typeof encoding === 'undefined')
36421 encoding = "utf8";
36422 switch (encoding) {
36423 case "base64":
36424 return ByteBuffer.fromBase64(buffer, littleEndian);
36425 case "hex":
36426 return ByteBuffer.fromHex(buffer, littleEndian);
36427 case "binary":
36428 return ByteBuffer.fromBinary(buffer, littleEndian);
36429 case "utf8":
36430 return ByteBuffer.fromUTF8(buffer, littleEndian);
36431 case "debug":
36432 return ByteBuffer.fromDebug(buffer, littleEndian);
36433 default:
36434 throw Error("Unsupported encoding: "+encoding);
36435 }
36436 }
36437 if (buffer === null || typeof buffer !== 'object')
36438 throw TypeError("Illegal buffer");
36439 var bb;
36440 if (ByteBuffer.isByteBuffer(buffer)) {
36441 bb = ByteBufferPrototype.clone.call(buffer);
36442 bb.markedOffset = -1;
36443 return bb;
36444 }
36445 if (buffer instanceof Uint8Array) { // Extract ArrayBuffer from Uint8Array
36446 bb = new ByteBuffer(0, littleEndian, noAssert);
36447 if (buffer.length > 0) { // Avoid references to more than one EMPTY_BUFFER
36448 bb.buffer = buffer.buffer;
36449 bb.offset = buffer.byteOffset;
36450 bb.limit = buffer.byteOffset + buffer.byteLength;
36451 bb.view = new Uint8Array(buffer.buffer);
36452 }
36453 } else if (buffer instanceof ArrayBuffer) { // Reuse ArrayBuffer
36454 bb = new ByteBuffer(0, littleEndian, noAssert);
36455 if (buffer.byteLength > 0) {
36456 bb.buffer = buffer;
36457 bb.offset = 0;
36458 bb.limit = buffer.byteLength;
36459 bb.view = buffer.byteLength > 0 ? new Uint8Array(buffer) : null;
36460 }
36461 } else if (Object.prototype.toString.call(buffer) === "[object Array]") { // Create from octets
36462 bb = new ByteBuffer(buffer.length, littleEndian, noAssert);
36463 bb.limit = buffer.length;
36464 for (var i=0; i<buffer.length; ++i)
36465 bb.view[i] = buffer[i];
36466 } else
36467 throw TypeError("Illegal buffer"); // Otherwise fail
36468 return bb;
36469 };
36470
36471 /**
36472 * Writes the array as a bitset.
36473 * @param {Array<boolean>} value Array of booleans to write
36474 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `length` if omitted.
36475 * @returns {!ByteBuffer}
36476 * @expose
36477 */
36478 ByteBufferPrototype.writeBitSet = function(value, offset) {
36479 var relative = typeof offset === 'undefined';
36480 if (relative) offset = this.offset;
36481 if (!this.noAssert) {
36482 if (!(value instanceof Array))
36483 throw TypeError("Illegal BitSet: Not an array");
36484 if (typeof offset !== 'number' || offset % 1 !== 0)
36485 throw TypeError("Illegal offset: "+offset+" (not an integer)");
36486 offset >>>= 0;
36487 if (offset < 0 || offset + 0 > this.buffer.byteLength)
36488 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
36489 }
36490
36491 var start = offset,
36492 bits = value.length,
36493 bytes = (bits >> 3),
36494 bit = 0,
36495 k;
36496
36497 offset += this.writeVarint32(bits,offset);
36498
36499 while(bytes--) {
36500 k = (!!value[bit++] & 1) |
36501 ((!!value[bit++] & 1) << 1) |
36502 ((!!value[bit++] & 1) << 2) |
36503 ((!!value[bit++] & 1) << 3) |
36504 ((!!value[bit++] & 1) << 4) |
36505 ((!!value[bit++] & 1) << 5) |
36506 ((!!value[bit++] & 1) << 6) |
36507 ((!!value[bit++] & 1) << 7);
36508 this.writeByte(k,offset++);
36509 }
36510
36511 if(bit < bits) {
36512 var m = 0; k = 0;
36513 while(bit < bits) k = k | ((!!value[bit++] & 1) << (m++));
36514 this.writeByte(k,offset++);
36515 }
36516
36517 if (relative) {
36518 this.offset = offset;
36519 return this;
36520 }
36521 return offset - start;
36522 }
36523
36524 /**
36525 * Reads a BitSet as an array of booleans.
36526 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `length` if omitted.
36527 * @returns {Array<boolean>
36528 * @expose
36529 */
36530 ByteBufferPrototype.readBitSet = function(offset) {
36531 var relative = typeof offset === 'undefined';
36532 if (relative) offset = this.offset;
36533
36534 var ret = this.readVarint32(offset),
36535 bits = ret.value,
36536 bytes = (bits >> 3),
36537 bit = 0,
36538 value = [],
36539 k;
36540
36541 offset += ret.length;
36542
36543 while(bytes--) {
36544 k = this.readByte(offset++);
36545 value[bit++] = !!(k & 0x01);
36546 value[bit++] = !!(k & 0x02);
36547 value[bit++] = !!(k & 0x04);
36548 value[bit++] = !!(k & 0x08);
36549 value[bit++] = !!(k & 0x10);
36550 value[bit++] = !!(k & 0x20);
36551 value[bit++] = !!(k & 0x40);
36552 value[bit++] = !!(k & 0x80);
36553 }
36554
36555 if(bit < bits) {
36556 var m = 0;
36557 k = this.readByte(offset++);
36558 while(bit < bits) value[bit++] = !!((k >> (m++)) & 1);
36559 }
36560
36561 if (relative) {
36562 this.offset = offset;
36563 }
36564 return value;
36565 }
36566 /**
36567 * Reads the specified number of bytes.
36568 * @param {number} length Number of bytes to read
36569 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `length` if omitted.
36570 * @returns {!ByteBuffer}
36571 * @expose
36572 */
36573 ByteBufferPrototype.readBytes = function(length, offset) {
36574 var relative = typeof offset === 'undefined';
36575 if (relative) offset = this.offset;
36576 if (!this.noAssert) {
36577 if (typeof offset !== 'number' || offset % 1 !== 0)
36578 throw TypeError("Illegal offset: "+offset+" (not an integer)");
36579 offset >>>= 0;
36580 if (offset < 0 || offset + length > this.buffer.byteLength)
36581 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+length+") <= "+this.buffer.byteLength);
36582 }
36583 var slice = this.slice(offset, offset + length);
36584 if (relative) this.offset += length;
36585 return slice;
36586 };
36587
36588 /**
36589 * Writes a payload of bytes. This is an alias of {@link ByteBuffer#append}.
36590 * @function
36591 * @param {!ByteBuffer|!ArrayBuffer|!Uint8Array|string} source Data to write. If `source` is a ByteBuffer, its offsets
36592 * will be modified according to the performed read operation.
36593 * @param {(string|number)=} encoding Encoding if `data` is a string ("base64", "hex", "binary", defaults to "utf8")
36594 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by the number of bytes
36595 * written if omitted.
36596 * @returns {!ByteBuffer} this
36597 * @expose
36598 */
36599 ByteBufferPrototype.writeBytes = ByteBufferPrototype.append;
36600
36601 // types/ints/int8
36602
36603 /**
36604 * Writes an 8bit signed integer.
36605 * @param {number} value Value to write
36606 * @param {number=} offset Offset to write to. Will use and advance {@link ByteBuffer#offset} by `1` if omitted.
36607 * @returns {!ByteBuffer} this
36608 * @expose
36609 */
36610 ByteBufferPrototype.writeInt8 = function(value, offset) {
36611 var relative = typeof offset === 'undefined';
36612 if (relative) offset = this.offset;
36613 if (!this.noAssert) {
36614 if (typeof value !== 'number' || value % 1 !== 0)
36615 throw TypeError("Illegal value: "+value+" (not an integer)");
36616 value |= 0;
36617 if (typeof offset !== 'number' || offset % 1 !== 0)
36618 throw TypeError("Illegal offset: "+offset+" (not an integer)");
36619 offset >>>= 0;
36620 if (offset < 0 || offset + 0 > this.buffer.byteLength)
36621 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
36622 }
36623 offset += 1;
36624 var capacity0 = this.buffer.byteLength;
36625 if (offset > capacity0)
36626 this.resize((capacity0 *= 2) > offset ? capacity0 : offset);
36627 offset -= 1;
36628 this.view[offset] = value;
36629 if (relative) this.offset += 1;
36630 return this;
36631 };
36632
36633 /**
36634 * Writes an 8bit signed integer. This is an alias of {@link ByteBuffer#writeInt8}.
36635 * @function
36636 * @param {number} value Value to write
36637 * @param {number=} offset Offset to write to. Will use and advance {@link ByteBuffer#offset} by `1` if omitted.
36638 * @returns {!ByteBuffer} this
36639 * @expose
36640 */
36641 ByteBufferPrototype.writeByte = ByteBufferPrototype.writeInt8;
36642
36643 /**
36644 * Reads an 8bit signed integer.
36645 * @param {number=} offset Offset to read from. Will use and advance {@link ByteBuffer#offset} by `1` if omitted.
36646 * @returns {number} Value read
36647 * @expose
36648 */
36649 ByteBufferPrototype.readInt8 = function(offset) {
36650 var relative = typeof offset === 'undefined';
36651 if (relative) offset = this.offset;
36652 if (!this.noAssert) {
36653 if (typeof offset !== 'number' || offset % 1 !== 0)
36654 throw TypeError("Illegal offset: "+offset+" (not an integer)");
36655 offset >>>= 0;
36656 if (offset < 0 || offset + 1 > this.buffer.byteLength)
36657 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+1+") <= "+this.buffer.byteLength);
36658 }
36659 var value = this.view[offset];
36660 if ((value & 0x80) === 0x80) value = -(0xFF - value + 1); // Cast to signed
36661 if (relative) this.offset += 1;
36662 return value;
36663 };
36664
36665 /**
36666 * Reads an 8bit signed integer. This is an alias of {@link ByteBuffer#readInt8}.
36667 * @function
36668 * @param {number=} offset Offset to read from. Will use and advance {@link ByteBuffer#offset} by `1` if omitted.
36669 * @returns {number} Value read
36670 * @expose
36671 */
36672 ByteBufferPrototype.readByte = ByteBufferPrototype.readInt8;
36673
36674 /**
36675 * Writes an 8bit unsigned integer.
36676 * @param {number} value Value to write
36677 * @param {number=} offset Offset to write to. Will use and advance {@link ByteBuffer#offset} by `1` if omitted.
36678 * @returns {!ByteBuffer} this
36679 * @expose
36680 */
36681 ByteBufferPrototype.writeUint8 = function(value, offset) {
36682 var relative = typeof offset === 'undefined';
36683 if (relative) offset = this.offset;
36684 if (!this.noAssert) {
36685 if (typeof value !== 'number' || value % 1 !== 0)
36686 throw TypeError("Illegal value: "+value+" (not an integer)");
36687 value >>>= 0;
36688 if (typeof offset !== 'number' || offset % 1 !== 0)
36689 throw TypeError("Illegal offset: "+offset+" (not an integer)");
36690 offset >>>= 0;
36691 if (offset < 0 || offset + 0 > this.buffer.byteLength)
36692 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
36693 }
36694 offset += 1;
36695 var capacity1 = this.buffer.byteLength;
36696 if (offset > capacity1)
36697 this.resize((capacity1 *= 2) > offset ? capacity1 : offset);
36698 offset -= 1;
36699 this.view[offset] = value;
36700 if (relative) this.offset += 1;
36701 return this;
36702 };
36703
36704 /**
36705 * Writes an 8bit unsigned integer. This is an alias of {@link ByteBuffer#writeUint8}.
36706 * @function
36707 * @param {number} value Value to write
36708 * @param {number=} offset Offset to write to. Will use and advance {@link ByteBuffer#offset} by `1` if omitted.
36709 * @returns {!ByteBuffer} this
36710 * @expose
36711 */
36712 ByteBufferPrototype.writeUInt8 = ByteBufferPrototype.writeUint8;
36713
36714 /**
36715 * Reads an 8bit unsigned integer.
36716 * @param {number=} offset Offset to read from. Will use and advance {@link ByteBuffer#offset} by `1` if omitted.
36717 * @returns {number} Value read
36718 * @expose
36719 */
36720 ByteBufferPrototype.readUint8 = function(offset) {
36721 var relative = typeof offset === 'undefined';
36722 if (relative) offset = this.offset;
36723 if (!this.noAssert) {
36724 if (typeof offset !== 'number' || offset % 1 !== 0)
36725 throw TypeError("Illegal offset: "+offset+" (not an integer)");
36726 offset >>>= 0;
36727 if (offset < 0 || offset + 1 > this.buffer.byteLength)
36728 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+1+") <= "+this.buffer.byteLength);
36729 }
36730 var value = this.view[offset];
36731 if (relative) this.offset += 1;
36732 return value;
36733 };
36734
36735 /**
36736 * Reads an 8bit unsigned integer. This is an alias of {@link ByteBuffer#readUint8}.
36737 * @function
36738 * @param {number=} offset Offset to read from. Will use and advance {@link ByteBuffer#offset} by `1` if omitted.
36739 * @returns {number} Value read
36740 * @expose
36741 */
36742 ByteBufferPrototype.readUInt8 = ByteBufferPrototype.readUint8;
36743
36744 // types/ints/int16
36745
36746 /**
36747 * Writes a 16bit signed integer.
36748 * @param {number} value Value to write
36749 * @param {number=} offset Offset to write to. Will use and advance {@link ByteBuffer#offset} by `2` if omitted.
36750 * @throws {TypeError} If `offset` or `value` is not a valid number
36751 * @throws {RangeError} If `offset` is out of bounds
36752 * @expose
36753 */
36754 ByteBufferPrototype.writeInt16 = function(value, offset) {
36755 var relative = typeof offset === 'undefined';
36756 if (relative) offset = this.offset;
36757 if (!this.noAssert) {
36758 if (typeof value !== 'number' || value % 1 !== 0)
36759 throw TypeError("Illegal value: "+value+" (not an integer)");
36760 value |= 0;
36761 if (typeof offset !== 'number' || offset % 1 !== 0)
36762 throw TypeError("Illegal offset: "+offset+" (not an integer)");
36763 offset >>>= 0;
36764 if (offset < 0 || offset + 0 > this.buffer.byteLength)
36765 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
36766 }
36767 offset += 2;
36768 var capacity2 = this.buffer.byteLength;
36769 if (offset > capacity2)
36770 this.resize((capacity2 *= 2) > offset ? capacity2 : offset);
36771 offset -= 2;
36772 if (this.littleEndian) {
36773 this.view[offset+1] = (value & 0xFF00) >>> 8;
36774 this.view[offset ] = value & 0x00FF;
36775 } else {
36776 this.view[offset] = (value & 0xFF00) >>> 8;
36777 this.view[offset+1] = value & 0x00FF;
36778 }
36779 if (relative) this.offset += 2;
36780 return this;
36781 };
36782
36783 /**
36784 * Writes a 16bit signed integer. This is an alias of {@link ByteBuffer#writeInt16}.
36785 * @function
36786 * @param {number} value Value to write
36787 * @param {number=} offset Offset to write to. Will use and advance {@link ByteBuffer#offset} by `2` if omitted.
36788 * @throws {TypeError} If `offset` or `value` is not a valid number
36789 * @throws {RangeError} If `offset` is out of bounds
36790 * @expose
36791 */
36792 ByteBufferPrototype.writeShort = ByteBufferPrototype.writeInt16;
36793
36794 /**
36795 * Reads a 16bit signed integer.
36796 * @param {number=} offset Offset to read from. Will use and advance {@link ByteBuffer#offset} by `2` if omitted.
36797 * @returns {number} Value read
36798 * @throws {TypeError} If `offset` is not a valid number
36799 * @throws {RangeError} If `offset` is out of bounds
36800 * @expose
36801 */
36802 ByteBufferPrototype.readInt16 = function(offset) {
36803 var relative = typeof offset === 'undefined';
36804 if (relative) offset = this.offset;
36805 if (!this.noAssert) {
36806 if (typeof offset !== 'number' || offset % 1 !== 0)
36807 throw TypeError("Illegal offset: "+offset+" (not an integer)");
36808 offset >>>= 0;
36809 if (offset < 0 || offset + 2 > this.buffer.byteLength)
36810 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+2+") <= "+this.buffer.byteLength);
36811 }
36812 var value = 0;
36813 if (this.littleEndian) {
36814 value = this.view[offset ];
36815 value |= this.view[offset+1] << 8;
36816 } else {
36817 value = this.view[offset ] << 8;
36818 value |= this.view[offset+1];
36819 }
36820 if ((value & 0x8000) === 0x8000) value = -(0xFFFF - value + 1); // Cast to signed
36821 if (relative) this.offset += 2;
36822 return value;
36823 };
36824
36825 /**
36826 * Reads a 16bit signed integer. This is an alias of {@link ByteBuffer#readInt16}.
36827 * @function
36828 * @param {number=} offset Offset to read from. Will use and advance {@link ByteBuffer#offset} by `2` if omitted.
36829 * @returns {number} Value read
36830 * @throws {TypeError} If `offset` is not a valid number
36831 * @throws {RangeError} If `offset` is out of bounds
36832 * @expose
36833 */
36834 ByteBufferPrototype.readShort = ByteBufferPrototype.readInt16;
36835
36836 /**
36837 * Writes a 16bit unsigned integer.
36838 * @param {number} value Value to write
36839 * @param {number=} offset Offset to write to. Will use and advance {@link ByteBuffer#offset} by `2` if omitted.
36840 * @throws {TypeError} If `offset` or `value` is not a valid number
36841 * @throws {RangeError} If `offset` is out of bounds
36842 * @expose
36843 */
36844 ByteBufferPrototype.writeUint16 = function(value, offset) {
36845 var relative = typeof offset === 'undefined';
36846 if (relative) offset = this.offset;
36847 if (!this.noAssert) {
36848 if (typeof value !== 'number' || value % 1 !== 0)
36849 throw TypeError("Illegal value: "+value+" (not an integer)");
36850 value >>>= 0;
36851 if (typeof offset !== 'number' || offset % 1 !== 0)
36852 throw TypeError("Illegal offset: "+offset+" (not an integer)");
36853 offset >>>= 0;
36854 if (offset < 0 || offset + 0 > this.buffer.byteLength)
36855 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
36856 }
36857 offset += 2;
36858 var capacity3 = this.buffer.byteLength;
36859 if (offset > capacity3)
36860 this.resize((capacity3 *= 2) > offset ? capacity3 : offset);
36861 offset -= 2;
36862 if (this.littleEndian) {
36863 this.view[offset+1] = (value & 0xFF00) >>> 8;
36864 this.view[offset ] = value & 0x00FF;
36865 } else {
36866 this.view[offset] = (value & 0xFF00) >>> 8;
36867 this.view[offset+1] = value & 0x00FF;
36868 }
36869 if (relative) this.offset += 2;
36870 return this;
36871 };
36872
36873 /**
36874 * Writes a 16bit unsigned integer. This is an alias of {@link ByteBuffer#writeUint16}.
36875 * @function
36876 * @param {number} value Value to write
36877 * @param {number=} offset Offset to write to. Will use and advance {@link ByteBuffer#offset} by `2` if omitted.
36878 * @throws {TypeError} If `offset` or `value` is not a valid number
36879 * @throws {RangeError} If `offset` is out of bounds
36880 * @expose
36881 */
36882 ByteBufferPrototype.writeUInt16 = ByteBufferPrototype.writeUint16;
36883
36884 /**
36885 * Reads a 16bit unsigned integer.
36886 * @param {number=} offset Offset to read from. Will use and advance {@link ByteBuffer#offset} by `2` if omitted.
36887 * @returns {number} Value read
36888 * @throws {TypeError} If `offset` is not a valid number
36889 * @throws {RangeError} If `offset` is out of bounds
36890 * @expose
36891 */
36892 ByteBufferPrototype.readUint16 = function(offset) {
36893 var relative = typeof offset === 'undefined';
36894 if (relative) offset = this.offset;
36895 if (!this.noAssert) {
36896 if (typeof offset !== 'number' || offset % 1 !== 0)
36897 throw TypeError("Illegal offset: "+offset+" (not an integer)");
36898 offset >>>= 0;
36899 if (offset < 0 || offset + 2 > this.buffer.byteLength)
36900 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+2+") <= "+this.buffer.byteLength);
36901 }
36902 var value = 0;
36903 if (this.littleEndian) {
36904 value = this.view[offset ];
36905 value |= this.view[offset+1] << 8;
36906 } else {
36907 value = this.view[offset ] << 8;
36908 value |= this.view[offset+1];
36909 }
36910 if (relative) this.offset += 2;
36911 return value;
36912 };
36913
36914 /**
36915 * Reads a 16bit unsigned integer. This is an alias of {@link ByteBuffer#readUint16}.
36916 * @function
36917 * @param {number=} offset Offset to read from. Will use and advance {@link ByteBuffer#offset} by `2` if omitted.
36918 * @returns {number} Value read
36919 * @throws {TypeError} If `offset` is not a valid number
36920 * @throws {RangeError} If `offset` is out of bounds
36921 * @expose
36922 */
36923 ByteBufferPrototype.readUInt16 = ByteBufferPrototype.readUint16;
36924
36925 // types/ints/int32
36926
36927 /**
36928 * Writes a 32bit signed integer.
36929 * @param {number} value Value to write
36930 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `4` if omitted.
36931 * @expose
36932 */
36933 ByteBufferPrototype.writeInt32 = function(value, offset) {
36934 var relative = typeof offset === 'undefined';
36935 if (relative) offset = this.offset;
36936 if (!this.noAssert) {
36937 if (typeof value !== 'number' || value % 1 !== 0)
36938 throw TypeError("Illegal value: "+value+" (not an integer)");
36939 value |= 0;
36940 if (typeof offset !== 'number' || offset % 1 !== 0)
36941 throw TypeError("Illegal offset: "+offset+" (not an integer)");
36942 offset >>>= 0;
36943 if (offset < 0 || offset + 0 > this.buffer.byteLength)
36944 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
36945 }
36946 offset += 4;
36947 var capacity4 = this.buffer.byteLength;
36948 if (offset > capacity4)
36949 this.resize((capacity4 *= 2) > offset ? capacity4 : offset);
36950 offset -= 4;
36951 if (this.littleEndian) {
36952 this.view[offset+3] = (value >>> 24) & 0xFF;
36953 this.view[offset+2] = (value >>> 16) & 0xFF;
36954 this.view[offset+1] = (value >>> 8) & 0xFF;
36955 this.view[offset ] = value & 0xFF;
36956 } else {
36957 this.view[offset ] = (value >>> 24) & 0xFF;
36958 this.view[offset+1] = (value >>> 16) & 0xFF;
36959 this.view[offset+2] = (value >>> 8) & 0xFF;
36960 this.view[offset+3] = value & 0xFF;
36961 }
36962 if (relative) this.offset += 4;
36963 return this;
36964 };
36965
36966 /**
36967 * Writes a 32bit signed integer. This is an alias of {@link ByteBuffer#writeInt32}.
36968 * @param {number} value Value to write
36969 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `4` if omitted.
36970 * @expose
36971 */
36972 ByteBufferPrototype.writeInt = ByteBufferPrototype.writeInt32;
36973
36974 /**
36975 * Reads a 32bit signed integer.
36976 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `4` if omitted.
36977 * @returns {number} Value read
36978 * @expose
36979 */
36980 ByteBufferPrototype.readInt32 = function(offset) {
36981 var relative = typeof offset === 'undefined';
36982 if (relative) offset = this.offset;
36983 if (!this.noAssert) {
36984 if (typeof offset !== 'number' || offset % 1 !== 0)
36985 throw TypeError("Illegal offset: "+offset+" (not an integer)");
36986 offset >>>= 0;
36987 if (offset < 0 || offset + 4 > this.buffer.byteLength)
36988 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+4+") <= "+this.buffer.byteLength);
36989 }
36990 var value = 0;
36991 if (this.littleEndian) {
36992 value = this.view[offset+2] << 16;
36993 value |= this.view[offset+1] << 8;
36994 value |= this.view[offset ];
36995 value += this.view[offset+3] << 24 >>> 0;
36996 } else {
36997 value = this.view[offset+1] << 16;
36998 value |= this.view[offset+2] << 8;
36999 value |= this.view[offset+3];
37000 value += this.view[offset ] << 24 >>> 0;
37001 }
37002 value |= 0; // Cast to signed
37003 if (relative) this.offset += 4;
37004 return value;
37005 };
37006
37007 /**
37008 * Reads a 32bit signed integer. This is an alias of {@link ByteBuffer#readInt32}.
37009 * @param {number=} offset Offset to read from. Will use and advance {@link ByteBuffer#offset} by `4` if omitted.
37010 * @returns {number} Value read
37011 * @expose
37012 */
37013 ByteBufferPrototype.readInt = ByteBufferPrototype.readInt32;
37014
37015 /**
37016 * Writes a 32bit unsigned integer.
37017 * @param {number} value Value to write
37018 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `4` if omitted.
37019 * @expose
37020 */
37021 ByteBufferPrototype.writeUint32 = function(value, offset) {
37022 var relative = typeof offset === 'undefined';
37023 if (relative) offset = this.offset;
37024 if (!this.noAssert) {
37025 if (typeof value !== 'number' || value % 1 !== 0)
37026 throw TypeError("Illegal value: "+value+" (not an integer)");
37027 value >>>= 0;
37028 if (typeof offset !== 'number' || offset % 1 !== 0)
37029 throw TypeError("Illegal offset: "+offset+" (not an integer)");
37030 offset >>>= 0;
37031 if (offset < 0 || offset + 0 > this.buffer.byteLength)
37032 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
37033 }
37034 offset += 4;
37035 var capacity5 = this.buffer.byteLength;
37036 if (offset > capacity5)
37037 this.resize((capacity5 *= 2) > offset ? capacity5 : offset);
37038 offset -= 4;
37039 if (this.littleEndian) {
37040 this.view[offset+3] = (value >>> 24) & 0xFF;
37041 this.view[offset+2] = (value >>> 16) & 0xFF;
37042 this.view[offset+1] = (value >>> 8) & 0xFF;
37043 this.view[offset ] = value & 0xFF;
37044 } else {
37045 this.view[offset ] = (value >>> 24) & 0xFF;
37046 this.view[offset+1] = (value >>> 16) & 0xFF;
37047 this.view[offset+2] = (value >>> 8) & 0xFF;
37048 this.view[offset+3] = value & 0xFF;
37049 }
37050 if (relative) this.offset += 4;
37051 return this;
37052 };
37053
37054 /**
37055 * Writes a 32bit unsigned integer. This is an alias of {@link ByteBuffer#writeUint32}.
37056 * @function
37057 * @param {number} value Value to write
37058 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `4` if omitted.
37059 * @expose
37060 */
37061 ByteBufferPrototype.writeUInt32 = ByteBufferPrototype.writeUint32;
37062
37063 /**
37064 * Reads a 32bit unsigned integer.
37065 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `4` if omitted.
37066 * @returns {number} Value read
37067 * @expose
37068 */
37069 ByteBufferPrototype.readUint32 = function(offset) {
37070 var relative = typeof offset === 'undefined';
37071 if (relative) offset = this.offset;
37072 if (!this.noAssert) {
37073 if (typeof offset !== 'number' || offset % 1 !== 0)
37074 throw TypeError("Illegal offset: "+offset+" (not an integer)");
37075 offset >>>= 0;
37076 if (offset < 0 || offset + 4 > this.buffer.byteLength)
37077 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+4+") <= "+this.buffer.byteLength);
37078 }
37079 var value = 0;
37080 if (this.littleEndian) {
37081 value = this.view[offset+2] << 16;
37082 value |= this.view[offset+1] << 8;
37083 value |= this.view[offset ];
37084 value += this.view[offset+3] << 24 >>> 0;
37085 } else {
37086 value = this.view[offset+1] << 16;
37087 value |= this.view[offset+2] << 8;
37088 value |= this.view[offset+3];
37089 value += this.view[offset ] << 24 >>> 0;
37090 }
37091 if (relative) this.offset += 4;
37092 return value;
37093 };
37094
37095 /**
37096 * Reads a 32bit unsigned integer. This is an alias of {@link ByteBuffer#readUint32}.
37097 * @function
37098 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `4` if omitted.
37099 * @returns {number} Value read
37100 * @expose
37101 */
37102 ByteBufferPrototype.readUInt32 = ByteBufferPrototype.readUint32;
37103
37104 // types/ints/int64
37105
37106 if (Long) {
37107
37108 /**
37109 * Writes a 64bit signed integer.
37110 * @param {number|!Long} value Value to write
37111 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
37112 * @returns {!ByteBuffer} this
37113 * @expose
37114 */
37115 ByteBufferPrototype.writeInt64 = function(value, offset) {
37116 var relative = typeof offset === 'undefined';
37117 if (relative) offset = this.offset;
37118 if (!this.noAssert) {
37119 if (typeof value === 'number')
37120 value = Long.fromNumber(value);
37121 else if (typeof value === 'string')
37122 value = Long.fromString(value);
37123 else if (!(value && value instanceof Long))
37124 throw TypeError("Illegal value: "+value+" (not an integer or Long)");
37125 if (typeof offset !== 'number' || offset % 1 !== 0)
37126 throw TypeError("Illegal offset: "+offset+" (not an integer)");
37127 offset >>>= 0;
37128 if (offset < 0 || offset + 0 > this.buffer.byteLength)
37129 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
37130 }
37131 if (typeof value === 'number')
37132 value = Long.fromNumber(value);
37133 else if (typeof value === 'string')
37134 value = Long.fromString(value);
37135 offset += 8;
37136 var capacity6 = this.buffer.byteLength;
37137 if (offset > capacity6)
37138 this.resize((capacity6 *= 2) > offset ? capacity6 : offset);
37139 offset -= 8;
37140 var lo = value.low,
37141 hi = value.high;
37142 if (this.littleEndian) {
37143 this.view[offset+3] = (lo >>> 24) & 0xFF;
37144 this.view[offset+2] = (lo >>> 16) & 0xFF;
37145 this.view[offset+1] = (lo >>> 8) & 0xFF;
37146 this.view[offset ] = lo & 0xFF;
37147 offset += 4;
37148 this.view[offset+3] = (hi >>> 24) & 0xFF;
37149 this.view[offset+2] = (hi >>> 16) & 0xFF;
37150 this.view[offset+1] = (hi >>> 8) & 0xFF;
37151 this.view[offset ] = hi & 0xFF;
37152 } else {
37153 this.view[offset ] = (hi >>> 24) & 0xFF;
37154 this.view[offset+1] = (hi >>> 16) & 0xFF;
37155 this.view[offset+2] = (hi >>> 8) & 0xFF;
37156 this.view[offset+3] = hi & 0xFF;
37157 offset += 4;
37158 this.view[offset ] = (lo >>> 24) & 0xFF;
37159 this.view[offset+1] = (lo >>> 16) & 0xFF;
37160 this.view[offset+2] = (lo >>> 8) & 0xFF;
37161 this.view[offset+3] = lo & 0xFF;
37162 }
37163 if (relative) this.offset += 8;
37164 return this;
37165 };
37166
37167 /**
37168 * Writes a 64bit signed integer. This is an alias of {@link ByteBuffer#writeInt64}.
37169 * @param {number|!Long} value Value to write
37170 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
37171 * @returns {!ByteBuffer} this
37172 * @expose
37173 */
37174 ByteBufferPrototype.writeLong = ByteBufferPrototype.writeInt64;
37175
37176 /**
37177 * Reads a 64bit signed integer.
37178 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
37179 * @returns {!Long}
37180 * @expose
37181 */
37182 ByteBufferPrototype.readInt64 = function(offset) {
37183 var relative = typeof offset === 'undefined';
37184 if (relative) offset = this.offset;
37185 if (!this.noAssert) {
37186 if (typeof offset !== 'number' || offset % 1 !== 0)
37187 throw TypeError("Illegal offset: "+offset+" (not an integer)");
37188 offset >>>= 0;
37189 if (offset < 0 || offset + 8 > this.buffer.byteLength)
37190 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+8+") <= "+this.buffer.byteLength);
37191 }
37192 var lo = 0,
37193 hi = 0;
37194 if (this.littleEndian) {
37195 lo = this.view[offset+2] << 16;
37196 lo |= this.view[offset+1] << 8;
37197 lo |= this.view[offset ];
37198 lo += this.view[offset+3] << 24 >>> 0;
37199 offset += 4;
37200 hi = this.view[offset+2] << 16;
37201 hi |= this.view[offset+1] << 8;
37202 hi |= this.view[offset ];
37203 hi += this.view[offset+3] << 24 >>> 0;
37204 } else {
37205 hi = this.view[offset+1] << 16;
37206 hi |= this.view[offset+2] << 8;
37207 hi |= this.view[offset+3];
37208 hi += this.view[offset ] << 24 >>> 0;
37209 offset += 4;
37210 lo = this.view[offset+1] << 16;
37211 lo |= this.view[offset+2] << 8;
37212 lo |= this.view[offset+3];
37213 lo += this.view[offset ] << 24 >>> 0;
37214 }
37215 var value = new Long(lo, hi, false);
37216 if (relative) this.offset += 8;
37217 return value;
37218 };
37219
37220 /**
37221 * Reads a 64bit signed integer. This is an alias of {@link ByteBuffer#readInt64}.
37222 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
37223 * @returns {!Long}
37224 * @expose
37225 */
37226 ByteBufferPrototype.readLong = ByteBufferPrototype.readInt64;
37227
37228 /**
37229 * Writes a 64bit unsigned integer.
37230 * @param {number|!Long} value Value to write
37231 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
37232 * @returns {!ByteBuffer} this
37233 * @expose
37234 */
37235 ByteBufferPrototype.writeUint64 = function(value, offset) {
37236 var relative = typeof offset === 'undefined';
37237 if (relative) offset = this.offset;
37238 if (!this.noAssert) {
37239 if (typeof value === 'number')
37240 value = Long.fromNumber(value);
37241 else if (typeof value === 'string')
37242 value = Long.fromString(value);
37243 else if (!(value && value instanceof Long))
37244 throw TypeError("Illegal value: "+value+" (not an integer or Long)");
37245 if (typeof offset !== 'number' || offset % 1 !== 0)
37246 throw TypeError("Illegal offset: "+offset+" (not an integer)");
37247 offset >>>= 0;
37248 if (offset < 0 || offset + 0 > this.buffer.byteLength)
37249 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
37250 }
37251 if (typeof value === 'number')
37252 value = Long.fromNumber(value);
37253 else if (typeof value === 'string')
37254 value = Long.fromString(value);
37255 offset += 8;
37256 var capacity7 = this.buffer.byteLength;
37257 if (offset > capacity7)
37258 this.resize((capacity7 *= 2) > offset ? capacity7 : offset);
37259 offset -= 8;
37260 var lo = value.low,
37261 hi = value.high;
37262 if (this.littleEndian) {
37263 this.view[offset+3] = (lo >>> 24) & 0xFF;
37264 this.view[offset+2] = (lo >>> 16) & 0xFF;
37265 this.view[offset+1] = (lo >>> 8) & 0xFF;
37266 this.view[offset ] = lo & 0xFF;
37267 offset += 4;
37268 this.view[offset+3] = (hi >>> 24) & 0xFF;
37269 this.view[offset+2] = (hi >>> 16) & 0xFF;
37270 this.view[offset+1] = (hi >>> 8) & 0xFF;
37271 this.view[offset ] = hi & 0xFF;
37272 } else {
37273 this.view[offset ] = (hi >>> 24) & 0xFF;
37274 this.view[offset+1] = (hi >>> 16) & 0xFF;
37275 this.view[offset+2] = (hi >>> 8) & 0xFF;
37276 this.view[offset+3] = hi & 0xFF;
37277 offset += 4;
37278 this.view[offset ] = (lo >>> 24) & 0xFF;
37279 this.view[offset+1] = (lo >>> 16) & 0xFF;
37280 this.view[offset+2] = (lo >>> 8) & 0xFF;
37281 this.view[offset+3] = lo & 0xFF;
37282 }
37283 if (relative) this.offset += 8;
37284 return this;
37285 };
37286
37287 /**
37288 * Writes a 64bit unsigned integer. This is an alias of {@link ByteBuffer#writeUint64}.
37289 * @function
37290 * @param {number|!Long} value Value to write
37291 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
37292 * @returns {!ByteBuffer} this
37293 * @expose
37294 */
37295 ByteBufferPrototype.writeUInt64 = ByteBufferPrototype.writeUint64;
37296
37297 /**
37298 * Reads a 64bit unsigned integer.
37299 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
37300 * @returns {!Long}
37301 * @expose
37302 */
37303 ByteBufferPrototype.readUint64 = function(offset) {
37304 var relative = typeof offset === 'undefined';
37305 if (relative) offset = this.offset;
37306 if (!this.noAssert) {
37307 if (typeof offset !== 'number' || offset % 1 !== 0)
37308 throw TypeError("Illegal offset: "+offset+" (not an integer)");
37309 offset >>>= 0;
37310 if (offset < 0 || offset + 8 > this.buffer.byteLength)
37311 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+8+") <= "+this.buffer.byteLength);
37312 }
37313 var lo = 0,
37314 hi = 0;
37315 if (this.littleEndian) {
37316 lo = this.view[offset+2] << 16;
37317 lo |= this.view[offset+1] << 8;
37318 lo |= this.view[offset ];
37319 lo += this.view[offset+3] << 24 >>> 0;
37320 offset += 4;
37321 hi = this.view[offset+2] << 16;
37322 hi |= this.view[offset+1] << 8;
37323 hi |= this.view[offset ];
37324 hi += this.view[offset+3] << 24 >>> 0;
37325 } else {
37326 hi = this.view[offset+1] << 16;
37327 hi |= this.view[offset+2] << 8;
37328 hi |= this.view[offset+3];
37329 hi += this.view[offset ] << 24 >>> 0;
37330 offset += 4;
37331 lo = this.view[offset+1] << 16;
37332 lo |= this.view[offset+2] << 8;
37333 lo |= this.view[offset+3];
37334 lo += this.view[offset ] << 24 >>> 0;
37335 }
37336 var value = new Long(lo, hi, true);
37337 if (relative) this.offset += 8;
37338 return value;
37339 };
37340
37341 /**
37342 * Reads a 64bit unsigned integer. This is an alias of {@link ByteBuffer#readUint64}.
37343 * @function
37344 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
37345 * @returns {!Long}
37346 * @expose
37347 */
37348 ByteBufferPrototype.readUInt64 = ByteBufferPrototype.readUint64;
37349
37350 } // Long
37351
37352
37353 // types/floats/float32
37354
37355 /*
37356 ieee754 - https://github.com/feross/ieee754
37357
37358 The MIT License (MIT)
37359
37360 Copyright (c) Feross Aboukhadijeh
37361
37362 Permission is hereby granted, free of charge, to any person obtaining a copy
37363 of this software and associated documentation files (the "Software"), to deal
37364 in the Software without restriction, including without limitation the rights
37365 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
37366 copies of the Software, and to permit persons to whom the Software is
37367 furnished to do so, subject to the following conditions:
37368
37369 The above copyright notice and this permission notice shall be included in
37370 all copies or substantial portions of the Software.
37371
37372 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
37373 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
37374 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
37375 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
37376 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
37377 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
37378 THE SOFTWARE.
37379 */
37380
37381 /**
37382 * Reads an IEEE754 float from a byte array.
37383 * @param {!Array} buffer
37384 * @param {number} offset
37385 * @param {boolean} isLE
37386 * @param {number} mLen
37387 * @param {number} nBytes
37388 * @returns {number}
37389 * @inner
37390 */
37391 function ieee754_read(buffer, offset, isLE, mLen, nBytes) {
37392 var e, m,
37393 eLen = nBytes * 8 - mLen - 1,
37394 eMax = (1 << eLen) - 1,
37395 eBias = eMax >> 1,
37396 nBits = -7,
37397 i = isLE ? (nBytes - 1) : 0,
37398 d = isLE ? -1 : 1,
37399 s = buffer[offset + i];
37400
37401 i += d;
37402
37403 e = s & ((1 << (-nBits)) - 1);
37404 s >>= (-nBits);
37405 nBits += eLen;
37406 for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8) {}
37407
37408 m = e & ((1 << (-nBits)) - 1);
37409 e >>= (-nBits);
37410 nBits += mLen;
37411 for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8) {}
37412
37413 if (e === 0) {
37414 e = 1 - eBias;
37415 } else if (e === eMax) {
37416 return m ? NaN : ((s ? -1 : 1) * Infinity);
37417 } else {
37418 m = m + Math.pow(2, mLen);
37419 e = e - eBias;
37420 }
37421 return (s ? -1 : 1) * m * Math.pow(2, e - mLen);
37422 }
37423
37424 /**
37425 * Writes an IEEE754 float to a byte array.
37426 * @param {!Array} buffer
37427 * @param {number} value
37428 * @param {number} offset
37429 * @param {boolean} isLE
37430 * @param {number} mLen
37431 * @param {number} nBytes
37432 * @inner
37433 */
37434 function ieee754_write(buffer, value, offset, isLE, mLen, nBytes) {
37435 var e, m, c,
37436 eLen = nBytes * 8 - mLen - 1,
37437 eMax = (1 << eLen) - 1,
37438 eBias = eMax >> 1,
37439 rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0),
37440 i = isLE ? 0 : (nBytes - 1),
37441 d = isLE ? 1 : -1,
37442 s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0;
37443
37444 value = Math.abs(value);
37445
37446 if (isNaN(value) || value === Infinity) {
37447 m = isNaN(value) ? 1 : 0;
37448 e = eMax;
37449 } else {
37450 e = Math.floor(Math.log(value) / Math.LN2);
37451 if (value * (c = Math.pow(2, -e)) < 1) {
37452 e--;
37453 c *= 2;
37454 }
37455 if (e + eBias >= 1) {
37456 value += rt / c;
37457 } else {
37458 value += rt * Math.pow(2, 1 - eBias);
37459 }
37460 if (value * c >= 2) {
37461 e++;
37462 c /= 2;
37463 }
37464
37465 if (e + eBias >= eMax) {
37466 m = 0;
37467 e = eMax;
37468 } else if (e + eBias >= 1) {
37469 m = (value * c - 1) * Math.pow(2, mLen);
37470 e = e + eBias;
37471 } else {
37472 m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen);
37473 e = 0;
37474 }
37475 }
37476
37477 for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
37478
37479 e = (e << mLen) | m;
37480 eLen += mLen;
37481 for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
37482
37483 buffer[offset + i - d] |= s * 128;
37484 }
37485
37486 /**
37487 * Writes a 32bit float.
37488 * @param {number} value Value to write
37489 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `4` if omitted.
37490 * @returns {!ByteBuffer} this
37491 * @expose
37492 */
37493 ByteBufferPrototype.writeFloat32 = function(value, offset) {
37494 var relative = typeof offset === 'undefined';
37495 if (relative) offset = this.offset;
37496 if (!this.noAssert) {
37497 if (typeof value !== 'number')
37498 throw TypeError("Illegal value: "+value+" (not a number)");
37499 if (typeof offset !== 'number' || offset % 1 !== 0)
37500 throw TypeError("Illegal offset: "+offset+" (not an integer)");
37501 offset >>>= 0;
37502 if (offset < 0 || offset + 0 > this.buffer.byteLength)
37503 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
37504 }
37505 offset += 4;
37506 var capacity8 = this.buffer.byteLength;
37507 if (offset > capacity8)
37508 this.resize((capacity8 *= 2) > offset ? capacity8 : offset);
37509 offset -= 4;
37510 ieee754_write(this.view, value, offset, this.littleEndian, 23, 4);
37511 if (relative) this.offset += 4;
37512 return this;
37513 };
37514
37515 /**
37516 * Writes a 32bit float. This is an alias of {@link ByteBuffer#writeFloat32}.
37517 * @function
37518 * @param {number} value Value to write
37519 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `4` if omitted.
37520 * @returns {!ByteBuffer} this
37521 * @expose
37522 */
37523 ByteBufferPrototype.writeFloat = ByteBufferPrototype.writeFloat32;
37524
37525 /**
37526 * Reads a 32bit float.
37527 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `4` if omitted.
37528 * @returns {number}
37529 * @expose
37530 */
37531 ByteBufferPrototype.readFloat32 = function(offset) {
37532 var relative = typeof offset === 'undefined';
37533 if (relative) offset = this.offset;
37534 if (!this.noAssert) {
37535 if (typeof offset !== 'number' || offset % 1 !== 0)
37536 throw TypeError("Illegal offset: "+offset+" (not an integer)");
37537 offset >>>= 0;
37538 if (offset < 0 || offset + 4 > this.buffer.byteLength)
37539 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+4+") <= "+this.buffer.byteLength);
37540 }
37541 var value = ieee754_read(this.view, offset, this.littleEndian, 23, 4);
37542 if (relative) this.offset += 4;
37543 return value;
37544 };
37545
37546 /**
37547 * Reads a 32bit float. This is an alias of {@link ByteBuffer#readFloat32}.
37548 * @function
37549 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `4` if omitted.
37550 * @returns {number}
37551 * @expose
37552 */
37553 ByteBufferPrototype.readFloat = ByteBufferPrototype.readFloat32;
37554
37555 // types/floats/float64
37556
37557 /**
37558 * Writes a 64bit float.
37559 * @param {number} value Value to write
37560 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
37561 * @returns {!ByteBuffer} this
37562 * @expose
37563 */
37564 ByteBufferPrototype.writeFloat64 = function(value, offset) {
37565 var relative = typeof offset === 'undefined';
37566 if (relative) offset = this.offset;
37567 if (!this.noAssert) {
37568 if (typeof value !== 'number')
37569 throw TypeError("Illegal value: "+value+" (not a number)");
37570 if (typeof offset !== 'number' || offset % 1 !== 0)
37571 throw TypeError("Illegal offset: "+offset+" (not an integer)");
37572 offset >>>= 0;
37573 if (offset < 0 || offset + 0 > this.buffer.byteLength)
37574 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
37575 }
37576 offset += 8;
37577 var capacity9 = this.buffer.byteLength;
37578 if (offset > capacity9)
37579 this.resize((capacity9 *= 2) > offset ? capacity9 : offset);
37580 offset -= 8;
37581 ieee754_write(this.view, value, offset, this.littleEndian, 52, 8);
37582 if (relative) this.offset += 8;
37583 return this;
37584 };
37585
37586 /**
37587 * Writes a 64bit float. This is an alias of {@link ByteBuffer#writeFloat64}.
37588 * @function
37589 * @param {number} value Value to write
37590 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
37591 * @returns {!ByteBuffer} this
37592 * @expose
37593 */
37594 ByteBufferPrototype.writeDouble = ByteBufferPrototype.writeFloat64;
37595
37596 /**
37597 * Reads a 64bit float.
37598 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
37599 * @returns {number}
37600 * @expose
37601 */
37602 ByteBufferPrototype.readFloat64 = function(offset) {
37603 var relative = typeof offset === 'undefined';
37604 if (relative) offset = this.offset;
37605 if (!this.noAssert) {
37606 if (typeof offset !== 'number' || offset % 1 !== 0)
37607 throw TypeError("Illegal offset: "+offset+" (not an integer)");
37608 offset >>>= 0;
37609 if (offset < 0 || offset + 8 > this.buffer.byteLength)
37610 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+8+") <= "+this.buffer.byteLength);
37611 }
37612 var value = ieee754_read(this.view, offset, this.littleEndian, 52, 8);
37613 if (relative) this.offset += 8;
37614 return value;
37615 };
37616
37617 /**
37618 * Reads a 64bit float. This is an alias of {@link ByteBuffer#readFloat64}.
37619 * @function
37620 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by `8` if omitted.
37621 * @returns {number}
37622 * @expose
37623 */
37624 ByteBufferPrototype.readDouble = ByteBufferPrototype.readFloat64;
37625
37626
37627 // types/varints/varint32
37628
37629 /**
37630 * Maximum number of bytes required to store a 32bit base 128 variable-length integer.
37631 * @type {number}
37632 * @const
37633 * @expose
37634 */
37635 ByteBuffer.MAX_VARINT32_BYTES = 5;
37636
37637 /**
37638 * Calculates the actual number of bytes required to store a 32bit base 128 variable-length integer.
37639 * @param {number} value Value to encode
37640 * @returns {number} Number of bytes required. Capped to {@link ByteBuffer.MAX_VARINT32_BYTES}
37641 * @expose
37642 */
37643 ByteBuffer.calculateVarint32 = function(value) {
37644 // ref: src/google/protobuf/io/coded_stream.cc
37645 value = value >>> 0;
37646 if (value < 1 << 7 ) return 1;
37647 else if (value < 1 << 14) return 2;
37648 else if (value < 1 << 21) return 3;
37649 else if (value < 1 << 28) return 4;
37650 else return 5;
37651 };
37652
37653 /**
37654 * Zigzag encodes a signed 32bit integer so that it can be effectively used with varint encoding.
37655 * @param {number} n Signed 32bit integer
37656 * @returns {number} Unsigned zigzag encoded 32bit integer
37657 * @expose
37658 */
37659 ByteBuffer.zigZagEncode32 = function(n) {
37660 return (((n |= 0) << 1) ^ (n >> 31)) >>> 0; // ref: src/google/protobuf/wire_format_lite.h
37661 };
37662
37663 /**
37664 * Decodes a zigzag encoded signed 32bit integer.
37665 * @param {number} n Unsigned zigzag encoded 32bit integer
37666 * @returns {number} Signed 32bit integer
37667 * @expose
37668 */
37669 ByteBuffer.zigZagDecode32 = function(n) {
37670 return ((n >>> 1) ^ -(n & 1)) | 0; // // ref: src/google/protobuf/wire_format_lite.h
37671 };
37672
37673 /**
37674 * Writes a 32bit base 128 variable-length integer.
37675 * @param {number} value Value to write
37676 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by the number of bytes
37677 * written if omitted.
37678 * @returns {!ByteBuffer|number} this if `offset` is omitted, else the actual number of bytes written
37679 * @expose
37680 */
37681 ByteBufferPrototype.writeVarint32 = function(value, offset) {
37682 var relative = typeof offset === 'undefined';
37683 if (relative) offset = this.offset;
37684 if (!this.noAssert) {
37685 if (typeof value !== 'number' || value % 1 !== 0)
37686 throw TypeError("Illegal value: "+value+" (not an integer)");
37687 value |= 0;
37688 if (typeof offset !== 'number' || offset % 1 !== 0)
37689 throw TypeError("Illegal offset: "+offset+" (not an integer)");
37690 offset >>>= 0;
37691 if (offset < 0 || offset + 0 > this.buffer.byteLength)
37692 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
37693 }
37694 var size = ByteBuffer.calculateVarint32(value),
37695 b;
37696 offset += size;
37697 var capacity10 = this.buffer.byteLength;
37698 if (offset > capacity10)
37699 this.resize((capacity10 *= 2) > offset ? capacity10 : offset);
37700 offset -= size;
37701 value >>>= 0;
37702 while (value >= 0x80) {
37703 b = (value & 0x7f) | 0x80;
37704 this.view[offset++] = b;
37705 value >>>= 7;
37706 }
37707 this.view[offset++] = value;
37708 if (relative) {
37709 this.offset = offset;
37710 return this;
37711 }
37712 return size;
37713 };
37714
37715 /**
37716 * Writes a zig-zag encoded (signed) 32bit base 128 variable-length integer.
37717 * @param {number} value Value to write
37718 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by the number of bytes
37719 * written if omitted.
37720 * @returns {!ByteBuffer|number} this if `offset` is omitted, else the actual number of bytes written
37721 * @expose
37722 */
37723 ByteBufferPrototype.writeVarint32ZigZag = function(value, offset) {
37724 return this.writeVarint32(ByteBuffer.zigZagEncode32(value), offset);
37725 };
37726
37727 /**
37728 * Reads a 32bit base 128 variable-length integer.
37729 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by the number of bytes
37730 * written if omitted.
37731 * @returns {number|!{value: number, length: number}} The value read if offset is omitted, else the value read
37732 * and the actual number of bytes read.
37733 * @throws {Error} If it's not a valid varint. Has a property `truncated = true` if there is not enough data available
37734 * to fully decode the varint.
37735 * @expose
37736 */
37737 ByteBufferPrototype.readVarint32 = function(offset) {
37738 var relative = typeof offset === 'undefined';
37739 if (relative) offset = this.offset;
37740 if (!this.noAssert) {
37741 if (typeof offset !== 'number' || offset % 1 !== 0)
37742 throw TypeError("Illegal offset: "+offset+" (not an integer)");
37743 offset >>>= 0;
37744 if (offset < 0 || offset + 1 > this.buffer.byteLength)
37745 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+1+") <= "+this.buffer.byteLength);
37746 }
37747 var c = 0,
37748 value = 0 >>> 0,
37749 b;
37750 do {
37751 if (!this.noAssert && offset > this.limit) {
37752 var err = Error("Truncated");
37753 err['truncated'] = true;
37754 throw err;
37755 }
37756 b = this.view[offset++];
37757 if (c < 5)
37758 value |= (b & 0x7f) << (7*c);
37759 ++c;
37760 } while ((b & 0x80) !== 0);
37761 value |= 0;
37762 if (relative) {
37763 this.offset = offset;
37764 return value;
37765 }
37766 return {
37767 "value": value,
37768 "length": c
37769 };
37770 };
37771
37772 /**
37773 * Reads a zig-zag encoded (signed) 32bit base 128 variable-length integer.
37774 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by the number of bytes
37775 * written if omitted.
37776 * @returns {number|!{value: number, length: number}} The value read if offset is omitted, else the value read
37777 * and the actual number of bytes read.
37778 * @throws {Error} If it's not a valid varint
37779 * @expose
37780 */
37781 ByteBufferPrototype.readVarint32ZigZag = function(offset) {
37782 var val = this.readVarint32(offset);
37783 if (typeof val === 'object')
37784 val["value"] = ByteBuffer.zigZagDecode32(val["value"]);
37785 else
37786 val = ByteBuffer.zigZagDecode32(val);
37787 return val;
37788 };
37789
37790 // types/varints/varint64
37791
37792 if (Long) {
37793
37794 /**
37795 * Maximum number of bytes required to store a 64bit base 128 variable-length integer.
37796 * @type {number}
37797 * @const
37798 * @expose
37799 */
37800 ByteBuffer.MAX_VARINT64_BYTES = 10;
37801
37802 /**
37803 * Calculates the actual number of bytes required to store a 64bit base 128 variable-length integer.
37804 * @param {number|!Long} value Value to encode
37805 * @returns {number} Number of bytes required. Capped to {@link ByteBuffer.MAX_VARINT64_BYTES}
37806 * @expose
37807 */
37808 ByteBuffer.calculateVarint64 = function(value) {
37809 if (typeof value === 'number')
37810 value = Long.fromNumber(value);
37811 else if (typeof value === 'string')
37812 value = Long.fromString(value);
37813 // ref: src/google/protobuf/io/coded_stream.cc
37814 var part0 = value.toInt() >>> 0,
37815 part1 = value.shiftRightUnsigned(28).toInt() >>> 0,
37816 part2 = value.shiftRightUnsigned(56).toInt() >>> 0;
37817 if (part2 == 0) {
37818 if (part1 == 0) {
37819 if (part0 < 1 << 14)
37820 return part0 < 1 << 7 ? 1 : 2;
37821 else
37822 return part0 < 1 << 21 ? 3 : 4;
37823 } else {
37824 if (part1 < 1 << 14)
37825 return part1 < 1 << 7 ? 5 : 6;
37826 else
37827 return part1 < 1 << 21 ? 7 : 8;
37828 }
37829 } else
37830 return part2 < 1 << 7 ? 9 : 10;
37831 };
37832
37833 /**
37834 * Zigzag encodes a signed 64bit integer so that it can be effectively used with varint encoding.
37835 * @param {number|!Long} value Signed long
37836 * @returns {!Long} Unsigned zigzag encoded long
37837 * @expose
37838 */
37839 ByteBuffer.zigZagEncode64 = function(value) {
37840 if (typeof value === 'number')
37841 value = Long.fromNumber(value, false);
37842 else if (typeof value === 'string')
37843 value = Long.fromString(value, false);
37844 else if (value.unsigned !== false) value = value.toSigned();
37845 // ref: src/google/protobuf/wire_format_lite.h
37846 return value.shiftLeft(1).xor(value.shiftRight(63)).toUnsigned();
37847 };
37848
37849 /**
37850 * Decodes a zigzag encoded signed 64bit integer.
37851 * @param {!Long|number} value Unsigned zigzag encoded long or JavaScript number
37852 * @returns {!Long} Signed long
37853 * @expose
37854 */
37855 ByteBuffer.zigZagDecode64 = function(value) {
37856 if (typeof value === 'number')
37857 value = Long.fromNumber(value, false);
37858 else if (typeof value === 'string')
37859 value = Long.fromString(value, false);
37860 else if (value.unsigned !== false) value = value.toSigned();
37861 // ref: src/google/protobuf/wire_format_lite.h
37862 return value.shiftRightUnsigned(1).xor(value.and(Long.ONE).toSigned().negate()).toSigned();
37863 };
37864
37865 /**
37866 * Writes a 64bit base 128 variable-length integer.
37867 * @param {number|Long} value Value to write
37868 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by the number of bytes
37869 * written if omitted.
37870 * @returns {!ByteBuffer|number} `this` if offset is omitted, else the actual number of bytes written.
37871 * @expose
37872 */
37873 ByteBufferPrototype.writeVarint64 = function(value, offset) {
37874 var relative = typeof offset === 'undefined';
37875 if (relative) offset = this.offset;
37876 if (!this.noAssert) {
37877 if (typeof value === 'number')
37878 value = Long.fromNumber(value);
37879 else if (typeof value === 'string')
37880 value = Long.fromString(value);
37881 else if (!(value && value instanceof Long))
37882 throw TypeError("Illegal value: "+value+" (not an integer or Long)");
37883 if (typeof offset !== 'number' || offset % 1 !== 0)
37884 throw TypeError("Illegal offset: "+offset+" (not an integer)");
37885 offset >>>= 0;
37886 if (offset < 0 || offset + 0 > this.buffer.byteLength)
37887 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
37888 }
37889 if (typeof value === 'number')
37890 value = Long.fromNumber(value, false);
37891 else if (typeof value === 'string')
37892 value = Long.fromString(value, false);
37893 else if (value.unsigned !== false) value = value.toSigned();
37894 var size = ByteBuffer.calculateVarint64(value),
37895 part0 = value.toInt() >>> 0,
37896 part1 = value.shiftRightUnsigned(28).toInt() >>> 0,
37897 part2 = value.shiftRightUnsigned(56).toInt() >>> 0;
37898 offset += size;
37899 var capacity11 = this.buffer.byteLength;
37900 if (offset > capacity11)
37901 this.resize((capacity11 *= 2) > offset ? capacity11 : offset);
37902 offset -= size;
37903 switch (size) {
37904 case 10: this.view[offset+9] = (part2 >>> 7) & 0x01;
37905 case 9 : this.view[offset+8] = size !== 9 ? (part2 ) | 0x80 : (part2 ) & 0x7F;
37906 case 8 : this.view[offset+7] = size !== 8 ? (part1 >>> 21) | 0x80 : (part1 >>> 21) & 0x7F;
37907 case 7 : this.view[offset+6] = size !== 7 ? (part1 >>> 14) | 0x80 : (part1 >>> 14) & 0x7F;
37908 case 6 : this.view[offset+5] = size !== 6 ? (part1 >>> 7) | 0x80 : (part1 >>> 7) & 0x7F;
37909 case 5 : this.view[offset+4] = size !== 5 ? (part1 ) | 0x80 : (part1 ) & 0x7F;
37910 case 4 : this.view[offset+3] = size !== 4 ? (part0 >>> 21) | 0x80 : (part0 >>> 21) & 0x7F;
37911 case 3 : this.view[offset+2] = size !== 3 ? (part0 >>> 14) | 0x80 : (part0 >>> 14) & 0x7F;
37912 case 2 : this.view[offset+1] = size !== 2 ? (part0 >>> 7) | 0x80 : (part0 >>> 7) & 0x7F;
37913 case 1 : this.view[offset ] = size !== 1 ? (part0 ) | 0x80 : (part0 ) & 0x7F;
37914 }
37915 if (relative) {
37916 this.offset += size;
37917 return this;
37918 } else {
37919 return size;
37920 }
37921 };
37922
37923 /**
37924 * Writes a zig-zag encoded 64bit base 128 variable-length integer.
37925 * @param {number|Long} value Value to write
37926 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by the number of bytes
37927 * written if omitted.
37928 * @returns {!ByteBuffer|number} `this` if offset is omitted, else the actual number of bytes written.
37929 * @expose
37930 */
37931 ByteBufferPrototype.writeVarint64ZigZag = function(value, offset) {
37932 return this.writeVarint64(ByteBuffer.zigZagEncode64(value), offset);
37933 };
37934
37935 /**
37936 * Reads a 64bit base 128 variable-length integer. Requires Long.js.
37937 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by the number of bytes
37938 * read if omitted.
37939 * @returns {!Long|!{value: Long, length: number}} The value read if offset is omitted, else the value read and
37940 * the actual number of bytes read.
37941 * @throws {Error} If it's not a valid varint
37942 * @expose
37943 */
37944 ByteBufferPrototype.readVarint64 = function(offset) {
37945 var relative = typeof offset === 'undefined';
37946 if (relative) offset = this.offset;
37947 if (!this.noAssert) {
37948 if (typeof offset !== 'number' || offset % 1 !== 0)
37949 throw TypeError("Illegal offset: "+offset+" (not an integer)");
37950 offset >>>= 0;
37951 if (offset < 0 || offset + 1 > this.buffer.byteLength)
37952 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+1+") <= "+this.buffer.byteLength);
37953 }
37954 // ref: src/google/protobuf/io/coded_stream.cc
37955 var start = offset,
37956 part0 = 0,
37957 part1 = 0,
37958 part2 = 0,
37959 b = 0;
37960 b = this.view[offset++]; part0 = (b & 0x7F) ; if ( b & 0x80 ) {
37961 b = this.view[offset++]; part0 |= (b & 0x7F) << 7; if ((b & 0x80) || (this.noAssert && typeof b === 'undefined')) {
37962 b = this.view[offset++]; part0 |= (b & 0x7F) << 14; if ((b & 0x80) || (this.noAssert && typeof b === 'undefined')) {
37963 b = this.view[offset++]; part0 |= (b & 0x7F) << 21; if ((b & 0x80) || (this.noAssert && typeof b === 'undefined')) {
37964 b = this.view[offset++]; part1 = (b & 0x7F) ; if ((b & 0x80) || (this.noAssert && typeof b === 'undefined')) {
37965 b = this.view[offset++]; part1 |= (b & 0x7F) << 7; if ((b & 0x80) || (this.noAssert && typeof b === 'undefined')) {
37966 b = this.view[offset++]; part1 |= (b & 0x7F) << 14; if ((b & 0x80) || (this.noAssert && typeof b === 'undefined')) {
37967 b = this.view[offset++]; part1 |= (b & 0x7F) << 21; if ((b & 0x80) || (this.noAssert && typeof b === 'undefined')) {
37968 b = this.view[offset++]; part2 = (b & 0x7F) ; if ((b & 0x80) || (this.noAssert && typeof b === 'undefined')) {
37969 b = this.view[offset++]; part2 |= (b & 0x7F) << 7; if ((b & 0x80) || (this.noAssert && typeof b === 'undefined')) {
37970 throw Error("Buffer overrun"); }}}}}}}}}}
37971 var value = Long.fromBits(part0 | (part1 << 28), (part1 >>> 4) | (part2) << 24, false);
37972 if (relative) {
37973 this.offset = offset;
37974 return value;
37975 } else {
37976 return {
37977 'value': value,
37978 'length': offset-start
37979 };
37980 }
37981 };
37982
37983 /**
37984 * Reads a zig-zag encoded 64bit base 128 variable-length integer. Requires Long.js.
37985 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by the number of bytes
37986 * read if omitted.
37987 * @returns {!Long|!{value: Long, length: number}} The value read if offset is omitted, else the value read and
37988 * the actual number of bytes read.
37989 * @throws {Error} If it's not a valid varint
37990 * @expose
37991 */
37992 ByteBufferPrototype.readVarint64ZigZag = function(offset) {
37993 var val = this.readVarint64(offset);
37994 if (val && val['value'] instanceof Long)
37995 val["value"] = ByteBuffer.zigZagDecode64(val["value"]);
37996 else
37997 val = ByteBuffer.zigZagDecode64(val);
37998 return val;
37999 };
38000
38001 } // Long
38002
38003
38004 // types/strings/cstring
38005
38006 /**
38007 * Writes a NULL-terminated UTF8 encoded string. For this to work the specified string must not contain any NULL
38008 * characters itself.
38009 * @param {string} str String to write
38010 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by the number of bytes
38011 * contained in `str` + 1 if omitted.
38012 * @returns {!ByteBuffer|number} this if offset is omitted, else the actual number of bytes written
38013 * @expose
38014 */
38015 ByteBufferPrototype.writeCString = function(str, offset) {
38016 var relative = typeof offset === 'undefined';
38017 if (relative) offset = this.offset;
38018 var i,
38019 k = str.length;
38020 if (!this.noAssert) {
38021 if (typeof str !== 'string')
38022 throw TypeError("Illegal str: Not a string");
38023 for (i=0; i<k; ++i) {
38024 if (str.charCodeAt(i) === 0)
38025 throw RangeError("Illegal str: Contains NULL-characters");
38026 }
38027 if (typeof offset !== 'number' || offset % 1 !== 0)
38028 throw TypeError("Illegal offset: "+offset+" (not an integer)");
38029 offset >>>= 0;
38030 if (offset < 0 || offset + 0 > this.buffer.byteLength)
38031 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
38032 }
38033 // UTF8 strings do not contain zero bytes in between except for the zero character, so:
38034 k = utfx.calculateUTF16asUTF8(stringSource(str))[1];
38035 offset += k+1;
38036 var capacity12 = this.buffer.byteLength;
38037 if (offset > capacity12)
38038 this.resize((capacity12 *= 2) > offset ? capacity12 : offset);
38039 offset -= k+1;
38040 utfx.encodeUTF16toUTF8(stringSource(str), function(b) {
38041 this.view[offset++] = b;
38042 }.bind(this));
38043 this.view[offset++] = 0;
38044 if (relative) {
38045 this.offset = offset;
38046 return this;
38047 }
38048 return k;
38049 };
38050
38051 /**
38052 * Reads a NULL-terminated UTF8 encoded string. For this to work the string read must not contain any NULL characters
38053 * itself.
38054 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by the number of bytes
38055 * read if omitted.
38056 * @returns {string|!{string: string, length: number}} The string read if offset is omitted, else the string
38057 * read and the actual number of bytes read.
38058 * @expose
38059 */
38060 ByteBufferPrototype.readCString = function(offset) {
38061 var relative = typeof offset === 'undefined';
38062 if (relative) offset = this.offset;
38063 if (!this.noAssert) {
38064 if (typeof offset !== 'number' || offset % 1 !== 0)
38065 throw TypeError("Illegal offset: "+offset+" (not an integer)");
38066 offset >>>= 0;
38067 if (offset < 0 || offset + 1 > this.buffer.byteLength)
38068 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+1+") <= "+this.buffer.byteLength);
38069 }
38070 var start = offset,
38071 temp;
38072 // UTF8 strings do not contain zero bytes in between except for the zero character itself, so:
38073 var sd, b = -1;
38074 utfx.decodeUTF8toUTF16(function() {
38075 if (b === 0) return null;
38076 if (offset >= this.limit)
38077 throw RangeError("Illegal range: Truncated data, "+offset+" < "+this.limit);
38078 b = this.view[offset++];
38079 return b === 0 ? null : b;
38080 }.bind(this), sd = stringDestination(), true);
38081 if (relative) {
38082 this.offset = offset;
38083 return sd();
38084 } else {
38085 return {
38086 "string": sd(),
38087 "length": offset - start
38088 };
38089 }
38090 };
38091
38092 // types/strings/istring
38093
38094 /**
38095 * Writes a length as uint32 prefixed UTF8 encoded string.
38096 * @param {string} str String to write
38097 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by the number of bytes
38098 * written if omitted.
38099 * @returns {!ByteBuffer|number} `this` if `offset` is omitted, else the actual number of bytes written
38100 * @expose
38101 * @see ByteBuffer#writeVarint32
38102 */
38103 ByteBufferPrototype.writeIString = function(str, offset) {
38104 var relative = typeof offset === 'undefined';
38105 if (relative) offset = this.offset;
38106 if (!this.noAssert) {
38107 if (typeof str !== 'string')
38108 throw TypeError("Illegal str: Not a string");
38109 if (typeof offset !== 'number' || offset % 1 !== 0)
38110 throw TypeError("Illegal offset: "+offset+" (not an integer)");
38111 offset >>>= 0;
38112 if (offset < 0 || offset + 0 > this.buffer.byteLength)
38113 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
38114 }
38115 var start = offset,
38116 k;
38117 k = utfx.calculateUTF16asUTF8(stringSource(str), this.noAssert)[1];
38118 offset += 4+k;
38119 var capacity13 = this.buffer.byteLength;
38120 if (offset > capacity13)
38121 this.resize((capacity13 *= 2) > offset ? capacity13 : offset);
38122 offset -= 4+k;
38123 if (this.littleEndian) {
38124 this.view[offset+3] = (k >>> 24) & 0xFF;
38125 this.view[offset+2] = (k >>> 16) & 0xFF;
38126 this.view[offset+1] = (k >>> 8) & 0xFF;
38127 this.view[offset ] = k & 0xFF;
38128 } else {
38129 this.view[offset ] = (k >>> 24) & 0xFF;
38130 this.view[offset+1] = (k >>> 16) & 0xFF;
38131 this.view[offset+2] = (k >>> 8) & 0xFF;
38132 this.view[offset+3] = k & 0xFF;
38133 }
38134 offset += 4;
38135 utfx.encodeUTF16toUTF8(stringSource(str), function(b) {
38136 this.view[offset++] = b;
38137 }.bind(this));
38138 if (offset !== start + 4 + k)
38139 throw RangeError("Illegal range: Truncated data, "+offset+" == "+(offset+4+k));
38140 if (relative) {
38141 this.offset = offset;
38142 return this;
38143 }
38144 return offset - start;
38145 };
38146
38147 /**
38148 * Reads a length as uint32 prefixed UTF8 encoded string.
38149 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by the number of bytes
38150 * read if omitted.
38151 * @returns {string|!{string: string, length: number}} The string read if offset is omitted, else the string
38152 * read and the actual number of bytes read.
38153 * @expose
38154 * @see ByteBuffer#readVarint32
38155 */
38156 ByteBufferPrototype.readIString = function(offset) {
38157 var relative = typeof offset === 'undefined';
38158 if (relative) offset = this.offset;
38159 if (!this.noAssert) {
38160 if (typeof offset !== 'number' || offset % 1 !== 0)
38161 throw TypeError("Illegal offset: "+offset+" (not an integer)");
38162 offset >>>= 0;
38163 if (offset < 0 || offset + 4 > this.buffer.byteLength)
38164 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+4+") <= "+this.buffer.byteLength);
38165 }
38166 var start = offset;
38167 var len = this.readUint32(offset);
38168 var str = this.readUTF8String(len, ByteBuffer.METRICS_BYTES, offset += 4);
38169 offset += str['length'];
38170 if (relative) {
38171 this.offset = offset;
38172 return str['string'];
38173 } else {
38174 return {
38175 'string': str['string'],
38176 'length': offset - start
38177 };
38178 }
38179 };
38180
38181 // types/strings/utf8string
38182
38183 /**
38184 * Metrics representing number of UTF8 characters. Evaluates to `c`.
38185 * @type {string}
38186 * @const
38187 * @expose
38188 */
38189 ByteBuffer.METRICS_CHARS = 'c';
38190
38191 /**
38192 * Metrics representing number of bytes. Evaluates to `b`.
38193 * @type {string}
38194 * @const
38195 * @expose
38196 */
38197 ByteBuffer.METRICS_BYTES = 'b';
38198
38199 /**
38200 * Writes an UTF8 encoded string.
38201 * @param {string} str String to write
38202 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} if omitted.
38203 * @returns {!ByteBuffer|number} this if offset is omitted, else the actual number of bytes written.
38204 * @expose
38205 */
38206 ByteBufferPrototype.writeUTF8String = function(str, offset) {
38207 var relative = typeof offset === 'undefined';
38208 if (relative) offset = this.offset;
38209 if (!this.noAssert) {
38210 if (typeof offset !== 'number' || offset % 1 !== 0)
38211 throw TypeError("Illegal offset: "+offset+" (not an integer)");
38212 offset >>>= 0;
38213 if (offset < 0 || offset + 0 > this.buffer.byteLength)
38214 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
38215 }
38216 var k;
38217 var start = offset;
38218 k = utfx.calculateUTF16asUTF8(stringSource(str))[1];
38219 offset += k;
38220 var capacity14 = this.buffer.byteLength;
38221 if (offset > capacity14)
38222 this.resize((capacity14 *= 2) > offset ? capacity14 : offset);
38223 offset -= k;
38224 utfx.encodeUTF16toUTF8(stringSource(str), function(b) {
38225 this.view[offset++] = b;
38226 }.bind(this));
38227 if (relative) {
38228 this.offset = offset;
38229 return this;
38230 }
38231 return offset - start;
38232 };
38233
38234 /**
38235 * Writes an UTF8 encoded string. This is an alias of {@link ByteBuffer#writeUTF8String}.
38236 * @function
38237 * @param {string} str String to write
38238 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} if omitted.
38239 * @returns {!ByteBuffer|number} this if offset is omitted, else the actual number of bytes written.
38240 * @expose
38241 */
38242 ByteBufferPrototype.writeString = ByteBufferPrototype.writeUTF8String;
38243
38244 /**
38245 * Calculates the number of UTF8 characters of a string. JavaScript itself uses UTF-16, so that a string's
38246 * `length` property does not reflect its actual UTF8 size if it contains code points larger than 0xFFFF.
38247 * @param {string} str String to calculate
38248 * @returns {number} Number of UTF8 characters
38249 * @expose
38250 */
38251 ByteBuffer.calculateUTF8Chars = function(str) {
38252 return utfx.calculateUTF16asUTF8(stringSource(str))[0];
38253 };
38254
38255 /**
38256 * Calculates the number of UTF8 bytes of a string.
38257 * @param {string} str String to calculate
38258 * @returns {number} Number of UTF8 bytes
38259 * @expose
38260 */
38261 ByteBuffer.calculateUTF8Bytes = function(str) {
38262 return utfx.calculateUTF16asUTF8(stringSource(str))[1];
38263 };
38264
38265 /**
38266 * Calculates the number of UTF8 bytes of a string. This is an alias of {@link ByteBuffer.calculateUTF8Bytes}.
38267 * @function
38268 * @param {string} str String to calculate
38269 * @returns {number} Number of UTF8 bytes
38270 * @expose
38271 */
38272 ByteBuffer.calculateString = ByteBuffer.calculateUTF8Bytes;
38273
38274 /**
38275 * Reads an UTF8 encoded string.
38276 * @param {number} length Number of characters or bytes to read.
38277 * @param {string=} metrics Metrics specifying what `length` is meant to count. Defaults to
38278 * {@link ByteBuffer.METRICS_CHARS}.
38279 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by the number of bytes
38280 * read if omitted.
38281 * @returns {string|!{string: string, length: number}} The string read if offset is omitted, else the string
38282 * read and the actual number of bytes read.
38283 * @expose
38284 */
38285 ByteBufferPrototype.readUTF8String = function(length, metrics, offset) {
38286 if (typeof metrics === 'number') {
38287 offset = metrics;
38288 metrics = undefined;
38289 }
38290 var relative = typeof offset === 'undefined';
38291 if (relative) offset = this.offset;
38292 if (typeof metrics === 'undefined') metrics = ByteBuffer.METRICS_CHARS;
38293 if (!this.noAssert) {
38294 if (typeof length !== 'number' || length % 1 !== 0)
38295 throw TypeError("Illegal length: "+length+" (not an integer)");
38296 length |= 0;
38297 if (typeof offset !== 'number' || offset % 1 !== 0)
38298 throw TypeError("Illegal offset: "+offset+" (not an integer)");
38299 offset >>>= 0;
38300 if (offset < 0 || offset + 0 > this.buffer.byteLength)
38301 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
38302 }
38303 var i = 0,
38304 start = offset,
38305 sd;
38306 if (metrics === ByteBuffer.METRICS_CHARS) { // The same for node and the browser
38307 sd = stringDestination();
38308 utfx.decodeUTF8(function() {
38309 return i < length && offset < this.limit ? this.view[offset++] : null;
38310 }.bind(this), function(cp) {
38311 ++i; utfx.UTF8toUTF16(cp, sd);
38312 });
38313 if (i !== length)
38314 throw RangeError("Illegal range: Truncated data, "+i+" == "+length);
38315 if (relative) {
38316 this.offset = offset;
38317 return sd();
38318 } else {
38319 return {
38320 "string": sd(),
38321 "length": offset - start
38322 };
38323 }
38324 } else if (metrics === ByteBuffer.METRICS_BYTES) {
38325 if (!this.noAssert) {
38326 if (typeof offset !== 'number' || offset % 1 !== 0)
38327 throw TypeError("Illegal offset: "+offset+" (not an integer)");
38328 offset >>>= 0;
38329 if (offset < 0 || offset + length > this.buffer.byteLength)
38330 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+length+") <= "+this.buffer.byteLength);
38331 }
38332 var k = offset + length;
38333 utfx.decodeUTF8toUTF16(function() {
38334 return offset < k ? this.view[offset++] : null;
38335 }.bind(this), sd = stringDestination(), this.noAssert);
38336 if (offset !== k)
38337 throw RangeError("Illegal range: Truncated data, "+offset+" == "+k);
38338 if (relative) {
38339 this.offset = offset;
38340 return sd();
38341 } else {
38342 return {
38343 'string': sd(),
38344 'length': offset - start
38345 };
38346 }
38347 } else
38348 throw TypeError("Unsupported metrics: "+metrics);
38349 };
38350
38351 /**
38352 * Reads an UTF8 encoded string. This is an alias of {@link ByteBuffer#readUTF8String}.
38353 * @function
38354 * @param {number} length Number of characters or bytes to read
38355 * @param {number=} metrics Metrics specifying what `n` is meant to count. Defaults to
38356 * {@link ByteBuffer.METRICS_CHARS}.
38357 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by the number of bytes
38358 * read if omitted.
38359 * @returns {string|!{string: string, length: number}} The string read if offset is omitted, else the string
38360 * read and the actual number of bytes read.
38361 * @expose
38362 */
38363 ByteBufferPrototype.readString = ByteBufferPrototype.readUTF8String;
38364
38365 // types/strings/vstring
38366
38367 /**
38368 * Writes a length as varint32 prefixed UTF8 encoded string.
38369 * @param {string} str String to write
38370 * @param {number=} offset Offset to write to. Will use and increase {@link ByteBuffer#offset} by the number of bytes
38371 * written if omitted.
38372 * @returns {!ByteBuffer|number} `this` if `offset` is omitted, else the actual number of bytes written
38373 * @expose
38374 * @see ByteBuffer#writeVarint32
38375 */
38376 ByteBufferPrototype.writeVString = function(str, offset) {
38377 var relative = typeof offset === 'undefined';
38378 if (relative) offset = this.offset;
38379 if (!this.noAssert) {
38380 if (typeof str !== 'string')
38381 throw TypeError("Illegal str: Not a string");
38382 if (typeof offset !== 'number' || offset % 1 !== 0)
38383 throw TypeError("Illegal offset: "+offset+" (not an integer)");
38384 offset >>>= 0;
38385 if (offset < 0 || offset + 0 > this.buffer.byteLength)
38386 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
38387 }
38388 var start = offset,
38389 k, l;
38390 k = utfx.calculateUTF16asUTF8(stringSource(str), this.noAssert)[1];
38391 l = ByteBuffer.calculateVarint32(k);
38392 offset += l+k;
38393 var capacity15 = this.buffer.byteLength;
38394 if (offset > capacity15)
38395 this.resize((capacity15 *= 2) > offset ? capacity15 : offset);
38396 offset -= l+k;
38397 offset += this.writeVarint32(k, offset);
38398 utfx.encodeUTF16toUTF8(stringSource(str), function(b) {
38399 this.view[offset++] = b;
38400 }.bind(this));
38401 if (offset !== start+k+l)
38402 throw RangeError("Illegal range: Truncated data, "+offset+" == "+(offset+k+l));
38403 if (relative) {
38404 this.offset = offset;
38405 return this;
38406 }
38407 return offset - start;
38408 };
38409
38410 /**
38411 * Reads a length as varint32 prefixed UTF8 encoded string.
38412 * @param {number=} offset Offset to read from. Will use and increase {@link ByteBuffer#offset} by the number of bytes
38413 * read if omitted.
38414 * @returns {string|!{string: string, length: number}} The string read if offset is omitted, else the string
38415 * read and the actual number of bytes read.
38416 * @expose
38417 * @see ByteBuffer#readVarint32
38418 */
38419 ByteBufferPrototype.readVString = function(offset) {
38420 var relative = typeof offset === 'undefined';
38421 if (relative) offset = this.offset;
38422 if (!this.noAssert) {
38423 if (typeof offset !== 'number' || offset % 1 !== 0)
38424 throw TypeError("Illegal offset: "+offset+" (not an integer)");
38425 offset >>>= 0;
38426 if (offset < 0 || offset + 1 > this.buffer.byteLength)
38427 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+1+") <= "+this.buffer.byteLength);
38428 }
38429 var start = offset;
38430 var len = this.readVarint32(offset);
38431 var str = this.readUTF8String(len['value'], ByteBuffer.METRICS_BYTES, offset += len['length']);
38432 offset += str['length'];
38433 if (relative) {
38434 this.offset = offset;
38435 return str['string'];
38436 } else {
38437 return {
38438 'string': str['string'],
38439 'length': offset - start
38440 };
38441 }
38442 };
38443
38444
38445 /**
38446 * Appends some data to this ByteBuffer. This will overwrite any contents behind the specified offset up to the appended
38447 * data's length.
38448 * @param {!ByteBuffer|!ArrayBuffer|!Uint8Array|string} source Data to append. If `source` is a ByteBuffer, its offsets
38449 * will be modified according to the performed read operation.
38450 * @param {(string|number)=} encoding Encoding if `data` is a string ("base64", "hex", "binary", defaults to "utf8")
38451 * @param {number=} offset Offset to append at. Will use and increase {@link ByteBuffer#offset} by the number of bytes
38452 * written if omitted.
38453 * @returns {!ByteBuffer} this
38454 * @expose
38455 * @example A relative `<01 02>03.append(<04 05>)` will result in `<01 02 04 05>, 04 05|`
38456 * @example An absolute `<01 02>03.append(04 05>, 1)` will result in `<01 04>05, 04 05|`
38457 */
38458 ByteBufferPrototype.append = function(source, encoding, offset) {
38459 if (typeof encoding === 'number' || typeof encoding !== 'string') {
38460 offset = encoding;
38461 encoding = undefined;
38462 }
38463 var relative = typeof offset === 'undefined';
38464 if (relative) offset = this.offset;
38465 if (!this.noAssert) {
38466 if (typeof offset !== 'number' || offset % 1 !== 0)
38467 throw TypeError("Illegal offset: "+offset+" (not an integer)");
38468 offset >>>= 0;
38469 if (offset < 0 || offset + 0 > this.buffer.byteLength)
38470 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
38471 }
38472 if (!(source instanceof ByteBuffer))
38473 source = ByteBuffer.wrap(source, encoding);
38474 var length = source.limit - source.offset;
38475 if (length <= 0) return this; // Nothing to append
38476 offset += length;
38477 var capacity16 = this.buffer.byteLength;
38478 if (offset > capacity16)
38479 this.resize((capacity16 *= 2) > offset ? capacity16 : offset);
38480 offset -= length;
38481 this.view.set(source.view.subarray(source.offset, source.limit), offset);
38482 source.offset += length;
38483 if (relative) this.offset += length;
38484 return this;
38485 };
38486
38487 /**
38488 * Appends this ByteBuffer's contents to another ByteBuffer. This will overwrite any contents at and after the
38489 specified offset up to the length of this ByteBuffer's data.
38490 * @param {!ByteBuffer} target Target ByteBuffer
38491 * @param {number=} offset Offset to append to. Will use and increase {@link ByteBuffer#offset} by the number of bytes
38492 * read if omitted.
38493 * @returns {!ByteBuffer} this
38494 * @expose
38495 * @see ByteBuffer#append
38496 */
38497 ByteBufferPrototype.appendTo = function(target, offset) {
38498 target.append(this, offset);
38499 return this;
38500 };
38501
38502 /**
38503 * Enables or disables assertions of argument types and offsets. Assertions are enabled by default but you can opt to
38504 * disable them if your code already makes sure that everything is valid.
38505 * @param {boolean} assert `true` to enable assertions, otherwise `false`
38506 * @returns {!ByteBuffer} this
38507 * @expose
38508 */
38509 ByteBufferPrototype.assert = function(assert) {
38510 this.noAssert = !assert;
38511 return this;
38512 };
38513
38514 /**
38515 * Gets the capacity of this ByteBuffer's backing buffer.
38516 * @returns {number} Capacity of the backing buffer
38517 * @expose
38518 */
38519 ByteBufferPrototype.capacity = function() {
38520 return this.buffer.byteLength;
38521 };
38522 /**
38523 * Clears this ByteBuffer's offsets by setting {@link ByteBuffer#offset} to `0` and {@link ByteBuffer#limit} to the
38524 * backing buffer's capacity. Discards {@link ByteBuffer#markedOffset}.
38525 * @returns {!ByteBuffer} this
38526 * @expose
38527 */
38528 ByteBufferPrototype.clear = function() {
38529 this.offset = 0;
38530 this.limit = this.buffer.byteLength;
38531 this.markedOffset = -1;
38532 return this;
38533 };
38534
38535 /**
38536 * Creates a cloned instance of this ByteBuffer, preset with this ByteBuffer's values for {@link ByteBuffer#offset},
38537 * {@link ByteBuffer#markedOffset} and {@link ByteBuffer#limit}.
38538 * @param {boolean=} copy Whether to copy the backing buffer or to return another view on the same, defaults to `false`
38539 * @returns {!ByteBuffer} Cloned instance
38540 * @expose
38541 */
38542 ByteBufferPrototype.clone = function(copy) {
38543 var bb = new ByteBuffer(0, this.littleEndian, this.noAssert);
38544 if (copy) {
38545 bb.buffer = new ArrayBuffer(this.buffer.byteLength);
38546 bb.view = new Uint8Array(bb.buffer);
38547 } else {
38548 bb.buffer = this.buffer;
38549 bb.view = this.view;
38550 }
38551 bb.offset = this.offset;
38552 bb.markedOffset = this.markedOffset;
38553 bb.limit = this.limit;
38554 return bb;
38555 };
38556
38557 /**
38558 * Compacts this ByteBuffer to be backed by a {@link ByteBuffer#buffer} of its contents' length. Contents are the bytes
38559 * between {@link ByteBuffer#offset} and {@link ByteBuffer#limit}. Will set `offset = 0` and `limit = capacity` and
38560 * adapt {@link ByteBuffer#markedOffset} to the same relative position if set.
38561 * @param {number=} begin Offset to start at, defaults to {@link ByteBuffer#offset}
38562 * @param {number=} end Offset to end at, defaults to {@link ByteBuffer#limit}
38563 * @returns {!ByteBuffer} this
38564 * @expose
38565 */
38566 ByteBufferPrototype.compact = function(begin, end) {
38567 if (typeof begin === 'undefined') begin = this.offset;
38568 if (typeof end === 'undefined') end = this.limit;
38569 if (!this.noAssert) {
38570 if (typeof begin !== 'number' || begin % 1 !== 0)
38571 throw TypeError("Illegal begin: Not an integer");
38572 begin >>>= 0;
38573 if (typeof end !== 'number' || end % 1 !== 0)
38574 throw TypeError("Illegal end: Not an integer");
38575 end >>>= 0;
38576 if (begin < 0 || begin > end || end > this.buffer.byteLength)
38577 throw RangeError("Illegal range: 0 <= "+begin+" <= "+end+" <= "+this.buffer.byteLength);
38578 }
38579 if (begin === 0 && end === this.buffer.byteLength)
38580 return this; // Already compacted
38581 var len = end - begin;
38582 if (len === 0) {
38583 this.buffer = EMPTY_BUFFER;
38584 this.view = null;
38585 if (this.markedOffset >= 0) this.markedOffset -= begin;
38586 this.offset = 0;
38587 this.limit = 0;
38588 return this;
38589 }
38590 var buffer = new ArrayBuffer(len);
38591 var view = new Uint8Array(buffer);
38592 view.set(this.view.subarray(begin, end));
38593 this.buffer = buffer;
38594 this.view = view;
38595 if (this.markedOffset >= 0) this.markedOffset -= begin;
38596 this.offset = 0;
38597 this.limit = len;
38598 return this;
38599 };
38600
38601 /**
38602 * Creates a copy of this ByteBuffer's contents. Contents are the bytes between {@link ByteBuffer#offset} and
38603 * {@link ByteBuffer#limit}.
38604 * @param {number=} begin Begin offset, defaults to {@link ByteBuffer#offset}.
38605 * @param {number=} end End offset, defaults to {@link ByteBuffer#limit}.
38606 * @returns {!ByteBuffer} Copy
38607 * @expose
38608 */
38609 ByteBufferPrototype.copy = function(begin, end) {
38610 if (typeof begin === 'undefined') begin = this.offset;
38611 if (typeof end === 'undefined') end = this.limit;
38612 if (!this.noAssert) {
38613 if (typeof begin !== 'number' || begin % 1 !== 0)
38614 throw TypeError("Illegal begin: Not an integer");
38615 begin >>>= 0;
38616 if (typeof end !== 'number' || end % 1 !== 0)
38617 throw TypeError("Illegal end: Not an integer");
38618 end >>>= 0;
38619 if (begin < 0 || begin > end || end > this.buffer.byteLength)
38620 throw RangeError("Illegal range: 0 <= "+begin+" <= "+end+" <= "+this.buffer.byteLength);
38621 }
38622 if (begin === end)
38623 return new ByteBuffer(0, this.littleEndian, this.noAssert);
38624 var capacity = end - begin,
38625 bb = new ByteBuffer(capacity, this.littleEndian, this.noAssert);
38626 bb.offset = 0;
38627 bb.limit = capacity;
38628 if (bb.markedOffset >= 0) bb.markedOffset -= begin;
38629 this.copyTo(bb, 0, begin, end);
38630 return bb;
38631 };
38632
38633 /**
38634 * Copies this ByteBuffer's contents to another ByteBuffer. Contents are the bytes between {@link ByteBuffer#offset} and
38635 * {@link ByteBuffer#limit}.
38636 * @param {!ByteBuffer} target Target ByteBuffer
38637 * @param {number=} targetOffset Offset to copy to. Will use and increase the target's {@link ByteBuffer#offset}
38638 * by the number of bytes copied if omitted.
38639 * @param {number=} sourceOffset Offset to start copying from. Will use and increase {@link ByteBuffer#offset} by the
38640 * number of bytes copied if omitted.
38641 * @param {number=} sourceLimit Offset to end copying from, defaults to {@link ByteBuffer#limit}
38642 * @returns {!ByteBuffer} this
38643 * @expose
38644 */
38645 ByteBufferPrototype.copyTo = function(target, targetOffset, sourceOffset, sourceLimit) {
38646 var relative,
38647 targetRelative;
38648 if (!this.noAssert) {
38649 if (!ByteBuffer.isByteBuffer(target))
38650 throw TypeError("Illegal target: Not a ByteBuffer");
38651 }
38652 targetOffset = (targetRelative = typeof targetOffset === 'undefined') ? target.offset : targetOffset | 0;
38653 sourceOffset = (relative = typeof sourceOffset === 'undefined') ? this.offset : sourceOffset | 0;
38654 sourceLimit = typeof sourceLimit === 'undefined' ? this.limit : sourceLimit | 0;
38655
38656 if (targetOffset < 0 || targetOffset > target.buffer.byteLength)
38657 throw RangeError("Illegal target range: 0 <= "+targetOffset+" <= "+target.buffer.byteLength);
38658 if (sourceOffset < 0 || sourceLimit > this.buffer.byteLength)
38659 throw RangeError("Illegal source range: 0 <= "+sourceOffset+" <= "+this.buffer.byteLength);
38660
38661 var len = sourceLimit - sourceOffset;
38662 if (len === 0)
38663 return target; // Nothing to copy
38664
38665 target.ensureCapacity(targetOffset + len);
38666
38667 target.view.set(this.view.subarray(sourceOffset, sourceLimit), targetOffset);
38668
38669 if (relative) this.offset += len;
38670 if (targetRelative) target.offset += len;
38671
38672 return this;
38673 };
38674
38675 /**
38676 * Makes sure that this ByteBuffer is backed by a {@link ByteBuffer#buffer} of at least the specified capacity. If the
38677 * current capacity is exceeded, it will be doubled. If double the current capacity is less than the required capacity,
38678 * the required capacity will be used instead.
38679 * @param {number} capacity Required capacity
38680 * @returns {!ByteBuffer} this
38681 * @expose
38682 */
38683 ByteBufferPrototype.ensureCapacity = function(capacity) {
38684 var current = this.buffer.byteLength;
38685 if (current < capacity)
38686 return this.resize((current *= 2) > capacity ? current : capacity);
38687 return this;
38688 };
38689
38690 /**
38691 * Overwrites this ByteBuffer's contents with the specified value. Contents are the bytes between
38692 * {@link ByteBuffer#offset} and {@link ByteBuffer#limit}.
38693 * @param {number|string} value Byte value to fill with. If given as a string, the first character is used.
38694 * @param {number=} begin Begin offset. Will use and increase {@link ByteBuffer#offset} by the number of bytes
38695 * written if omitted. defaults to {@link ByteBuffer#offset}.
38696 * @param {number=} end End offset, defaults to {@link ByteBuffer#limit}.
38697 * @returns {!ByteBuffer} this
38698 * @expose
38699 * @example `someByteBuffer.clear().fill(0)` fills the entire backing buffer with zeroes
38700 */
38701 ByteBufferPrototype.fill = function(value, begin, end) {
38702 var relative = typeof begin === 'undefined';
38703 if (relative) begin = this.offset;
38704 if (typeof value === 'string' && value.length > 0)
38705 value = value.charCodeAt(0);
38706 if (typeof begin === 'undefined') begin = this.offset;
38707 if (typeof end === 'undefined') end = this.limit;
38708 if (!this.noAssert) {
38709 if (typeof value !== 'number' || value % 1 !== 0)
38710 throw TypeError("Illegal value: "+value+" (not an integer)");
38711 value |= 0;
38712 if (typeof begin !== 'number' || begin % 1 !== 0)
38713 throw TypeError("Illegal begin: Not an integer");
38714 begin >>>= 0;
38715 if (typeof end !== 'number' || end % 1 !== 0)
38716 throw TypeError("Illegal end: Not an integer");
38717 end >>>= 0;
38718 if (begin < 0 || begin > end || end > this.buffer.byteLength)
38719 throw RangeError("Illegal range: 0 <= "+begin+" <= "+end+" <= "+this.buffer.byteLength);
38720 }
38721 if (begin >= end)
38722 return this; // Nothing to fill
38723 while (begin < end) this.view[begin++] = value;
38724 if (relative) this.offset = begin;
38725 return this;
38726 };
38727
38728 /**
38729 * Makes this ByteBuffer ready for a new sequence of write or relative read operations. Sets `limit = offset` and
38730 * `offset = 0`. Make sure always to flip a ByteBuffer when all relative read or write operations are complete.
38731 * @returns {!ByteBuffer} this
38732 * @expose
38733 */
38734 ByteBufferPrototype.flip = function() {
38735 this.limit = this.offset;
38736 this.offset = 0;
38737 return this;
38738 };
38739 /**
38740 * Marks an offset on this ByteBuffer to be used later.
38741 * @param {number=} offset Offset to mark. Defaults to {@link ByteBuffer#offset}.
38742 * @returns {!ByteBuffer} this
38743 * @throws {TypeError} If `offset` is not a valid number
38744 * @throws {RangeError} If `offset` is out of bounds
38745 * @see ByteBuffer#reset
38746 * @expose
38747 */
38748 ByteBufferPrototype.mark = function(offset) {
38749 offset = typeof offset === 'undefined' ? this.offset : offset;
38750 if (!this.noAssert) {
38751 if (typeof offset !== 'number' || offset % 1 !== 0)
38752 throw TypeError("Illegal offset: "+offset+" (not an integer)");
38753 offset >>>= 0;
38754 if (offset < 0 || offset + 0 > this.buffer.byteLength)
38755 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
38756 }
38757 this.markedOffset = offset;
38758 return this;
38759 };
38760 /**
38761 * Sets the byte order.
38762 * @param {boolean} littleEndian `true` for little endian byte order, `false` for big endian
38763 * @returns {!ByteBuffer} this
38764 * @expose
38765 */
38766 ByteBufferPrototype.order = function(littleEndian) {
38767 if (!this.noAssert) {
38768 if (typeof littleEndian !== 'boolean')
38769 throw TypeError("Illegal littleEndian: Not a boolean");
38770 }
38771 this.littleEndian = !!littleEndian;
38772 return this;
38773 };
38774
38775 /**
38776 * Switches (to) little endian byte order.
38777 * @param {boolean=} littleEndian Defaults to `true`, otherwise uses big endian
38778 * @returns {!ByteBuffer} this
38779 * @expose
38780 */
38781 ByteBufferPrototype.LE = function(littleEndian) {
38782 this.littleEndian = typeof littleEndian !== 'undefined' ? !!littleEndian : true;
38783 return this;
38784 };
38785
38786 /**
38787 * Switches (to) big endian byte order.
38788 * @param {boolean=} bigEndian Defaults to `true`, otherwise uses little endian
38789 * @returns {!ByteBuffer} this
38790 * @expose
38791 */
38792 ByteBufferPrototype.BE = function(bigEndian) {
38793 this.littleEndian = typeof bigEndian !== 'undefined' ? !bigEndian : false;
38794 return this;
38795 };
38796 /**
38797 * Prepends some data to this ByteBuffer. This will overwrite any contents before the specified offset up to the
38798 * prepended data's length. If there is not enough space available before the specified `offset`, the backing buffer
38799 * will be resized and its contents moved accordingly.
38800 * @param {!ByteBuffer|string|!ArrayBuffer} source Data to prepend. If `source` is a ByteBuffer, its offset will be
38801 * modified according to the performed read operation.
38802 * @param {(string|number)=} encoding Encoding if `data` is a string ("base64", "hex", "binary", defaults to "utf8")
38803 * @param {number=} offset Offset to prepend at. Will use and decrease {@link ByteBuffer#offset} by the number of bytes
38804 * prepended if omitted.
38805 * @returns {!ByteBuffer} this
38806 * @expose
38807 * @example A relative `00<01 02 03>.prepend(<04 05>)` results in `<04 05 01 02 03>, 04 05|`
38808 * @example An absolute `00<01 02 03>.prepend(<04 05>, 2)` results in `04<05 02 03>, 04 05|`
38809 */
38810 ByteBufferPrototype.prepend = function(source, encoding, offset) {
38811 if (typeof encoding === 'number' || typeof encoding !== 'string') {
38812 offset = encoding;
38813 encoding = undefined;
38814 }
38815 var relative = typeof offset === 'undefined';
38816 if (relative) offset = this.offset;
38817 if (!this.noAssert) {
38818 if (typeof offset !== 'number' || offset % 1 !== 0)
38819 throw TypeError("Illegal offset: "+offset+" (not an integer)");
38820 offset >>>= 0;
38821 if (offset < 0 || offset + 0 > this.buffer.byteLength)
38822 throw RangeError("Illegal offset: 0 <= "+offset+" (+"+0+") <= "+this.buffer.byteLength);
38823 }
38824 if (!(source instanceof ByteBuffer))
38825 source = ByteBuffer.wrap(source, encoding);
38826 var len = source.limit - source.offset;
38827 if (len <= 0) return this; // Nothing to prepend
38828 var diff = len - offset;
38829 if (diff > 0) { // Not enough space before offset, so resize + move
38830 var buffer = new ArrayBuffer(this.buffer.byteLength + diff);
38831 var view = new Uint8Array(buffer);
38832 view.set(this.view.subarray(offset, this.buffer.byteLength), len);
38833 this.buffer = buffer;
38834 this.view = view;
38835 this.offset += diff;
38836 if (this.markedOffset >= 0) this.markedOffset += diff;
38837 this.limit += diff;
38838 offset += diff;
38839 } else {
38840 var arrayView = new Uint8Array(this.buffer);
38841 }
38842 this.view.set(source.view.subarray(source.offset, source.limit), offset - len);
38843
38844 source.offset = source.limit;
38845 if (relative)
38846 this.offset -= len;
38847 return this;
38848 };
38849
38850 /**
38851 * Prepends this ByteBuffer to another ByteBuffer. This will overwrite any contents before the specified offset up to the
38852 * prepended data's length. If there is not enough space available before the specified `offset`, the backing buffer
38853 * will be resized and its contents moved accordingly.
38854 * @param {!ByteBuffer} target Target ByteBuffer
38855 * @param {number=} offset Offset to prepend at. Will use and decrease {@link ByteBuffer#offset} by the number of bytes
38856 * prepended if omitted.
38857 * @returns {!ByteBuffer} this
38858 * @expose
38859 * @see ByteBuffer#prepend
38860 */
38861 ByteBufferPrototype.prependTo = function(target, offset) {
38862 target.prepend(this, offset);
38863 return this;
38864 };
38865 /**
38866 * Prints debug information about this ByteBuffer's contents.
38867 * @param {function(string)=} out Output function to call, defaults to console.log
38868 * @expose
38869 */
38870 ByteBufferPrototype.printDebug = function(out) {
38871 if (typeof out !== 'function') out = console.log.bind(console);
38872 out(
38873 this.toString()+"\n"+
38874 "-------------------------------------------------------------------\n"+
38875 this.toDebug(/* columns */ true)
38876 );
38877 };
38878
38879 /**
38880 * Gets the number of remaining readable bytes. Contents are the bytes between {@link ByteBuffer#offset} and
38881 * {@link ByteBuffer#limit}, so this returns `limit - offset`.
38882 * @returns {number} Remaining readable bytes. May be negative if `offset > limit`.
38883 * @expose
38884 */
38885 ByteBufferPrototype.remaining = function() {
38886 return this.limit - this.offset;
38887 };
38888 /**
38889 * Resets this ByteBuffer's {@link ByteBuffer#offset}. If an offset has been marked through {@link ByteBuffer#mark}
38890 * before, `offset` will be set to {@link ByteBuffer#markedOffset}, which will then be discarded. If no offset has been
38891 * marked, sets `offset = 0`.
38892 * @returns {!ByteBuffer} this
38893 * @see ByteBuffer#mark
38894 * @expose
38895 */
38896 ByteBufferPrototype.reset = function() {
38897 if (this.markedOffset >= 0) {
38898 this.offset = this.markedOffset;
38899 this.markedOffset = -1;
38900 } else {
38901 this.offset = 0;
38902 }
38903 return this;
38904 };
38905 /**
38906 * Resizes this ByteBuffer to be backed by a buffer of at least the given capacity. Will do nothing if already that
38907 * large or larger.
38908 * @param {number} capacity Capacity required
38909 * @returns {!ByteBuffer} this
38910 * @throws {TypeError} If `capacity` is not a number
38911 * @throws {RangeError} If `capacity < 0`
38912 * @expose
38913 */
38914 ByteBufferPrototype.resize = function(capacity) {
38915 if (!this.noAssert) {
38916 if (typeof capacity !== 'number' || capacity % 1 !== 0)
38917 throw TypeError("Illegal capacity: "+capacity+" (not an integer)");
38918 capacity |= 0;
38919 if (capacity < 0)
38920 throw RangeError("Illegal capacity: 0 <= "+capacity);
38921 }
38922 if (this.buffer.byteLength < capacity) {
38923 var buffer = new ArrayBuffer(capacity);
38924 var view = new Uint8Array(buffer);
38925 view.set(this.view);
38926 this.buffer = buffer;
38927 this.view = view;
38928 }
38929 return this;
38930 };
38931 /**
38932 * Reverses this ByteBuffer's contents.
38933 * @param {number=} begin Offset to start at, defaults to {@link ByteBuffer#offset}
38934 * @param {number=} end Offset to end at, defaults to {@link ByteBuffer#limit}
38935 * @returns {!ByteBuffer} this
38936 * @expose
38937 */
38938 ByteBufferPrototype.reverse = function(begin, end) {
38939 if (typeof begin === 'undefined') begin = this.offset;
38940 if (typeof end === 'undefined') end = this.limit;
38941 if (!this.noAssert) {
38942 if (typeof begin !== 'number' || begin % 1 !== 0)
38943 throw TypeError("Illegal begin: Not an integer");
38944 begin >>>= 0;
38945 if (typeof end !== 'number' || end % 1 !== 0)
38946 throw TypeError("Illegal end: Not an integer");
38947 end >>>= 0;
38948 if (begin < 0 || begin > end || end > this.buffer.byteLength)
38949 throw RangeError("Illegal range: 0 <= "+begin+" <= "+end+" <= "+this.buffer.byteLength);
38950 }
38951 if (begin === end)
38952 return this; // Nothing to reverse
38953 Array.prototype.reverse.call(this.view.subarray(begin, end));
38954 return this;
38955 };
38956 /**
38957 * Skips the next `length` bytes. This will just advance
38958 * @param {number} length Number of bytes to skip. May also be negative to move the offset back.
38959 * @returns {!ByteBuffer} this
38960 * @expose
38961 */
38962 ByteBufferPrototype.skip = function(length) {
38963 if (!this.noAssert) {
38964 if (typeof length !== 'number' || length % 1 !== 0)
38965 throw TypeError("Illegal length: "+length+" (not an integer)");
38966 length |= 0;
38967 }
38968 var offset = this.offset + length;
38969 if (!this.noAssert) {
38970 if (offset < 0 || offset > this.buffer.byteLength)
38971 throw RangeError("Illegal length: 0 <= "+this.offset+" + "+length+" <= "+this.buffer.byteLength);
38972 }
38973 this.offset = offset;
38974 return this;
38975 };
38976
38977 /**
38978 * Slices this ByteBuffer by creating a cloned instance with `offset = begin` and `limit = end`.
38979 * @param {number=} begin Begin offset, defaults to {@link ByteBuffer#offset}.
38980 * @param {number=} end End offset, defaults to {@link ByteBuffer#limit}.
38981 * @returns {!ByteBuffer} Clone of this ByteBuffer with slicing applied, backed by the same {@link ByteBuffer#buffer}
38982 * @expose
38983 */
38984 ByteBufferPrototype.slice = function(begin, end) {
38985 if (typeof begin === 'undefined') begin = this.offset;
38986 if (typeof end === 'undefined') end = this.limit;
38987 if (!this.noAssert) {
38988 if (typeof begin !== 'number' || begin % 1 !== 0)
38989 throw TypeError("Illegal begin: Not an integer");
38990 begin >>>= 0;
38991 if (typeof end !== 'number' || end % 1 !== 0)
38992 throw TypeError("Illegal end: Not an integer");
38993 end >>>= 0;
38994 if (begin < 0 || begin > end || end > this.buffer.byteLength)
38995 throw RangeError("Illegal range: 0 <= "+begin+" <= "+end+" <= "+this.buffer.byteLength);
38996 }
38997 var bb = this.clone();
38998 bb.offset = begin;
38999 bb.limit = end;
39000 return bb;
39001 };
39002 /**
39003 * Returns a copy of the backing buffer that contains this ByteBuffer's contents. Contents are the bytes between
39004 * {@link ByteBuffer#offset} and {@link ByteBuffer#limit}.
39005 * @param {boolean=} forceCopy If `true` returns a copy, otherwise returns a view referencing the same memory if
39006 * possible. Defaults to `false`
39007 * @returns {!ArrayBuffer} Contents as an ArrayBuffer
39008 * @expose
39009 */
39010 ByteBufferPrototype.toBuffer = function(forceCopy) {
39011 var offset = this.offset,
39012 limit = this.limit;
39013 if (!this.noAssert) {
39014 if (typeof offset !== 'number' || offset % 1 !== 0)
39015 throw TypeError("Illegal offset: Not an integer");
39016 offset >>>= 0;
39017 if (typeof limit !== 'number' || limit % 1 !== 0)
39018 throw TypeError("Illegal limit: Not an integer");
39019 limit >>>= 0;
39020 if (offset < 0 || offset > limit || limit > this.buffer.byteLength)
39021 throw RangeError("Illegal range: 0 <= "+offset+" <= "+limit+" <= "+this.buffer.byteLength);
39022 }
39023 // NOTE: It's not possible to have another ArrayBuffer reference the same memory as the backing buffer. This is
39024 // possible with Uint8Array#subarray only, but we have to return an ArrayBuffer by contract. So:
39025 if (!forceCopy && offset === 0 && limit === this.buffer.byteLength)
39026 return this.buffer;
39027 if (offset === limit)
39028 return EMPTY_BUFFER;
39029 var buffer = new ArrayBuffer(limit - offset);
39030 new Uint8Array(buffer).set(new Uint8Array(this.buffer).subarray(offset, limit), 0);
39031 return buffer;
39032 };
39033
39034 /**
39035 * Returns a raw buffer compacted to contain this ByteBuffer's contents. Contents are the bytes between
39036 * {@link ByteBuffer#offset} and {@link ByteBuffer#limit}. This is an alias of {@link ByteBuffer#toBuffer}.
39037 * @function
39038 * @param {boolean=} forceCopy If `true` returns a copy, otherwise returns a view referencing the same memory.
39039 * Defaults to `false`
39040 * @returns {!ArrayBuffer} Contents as an ArrayBuffer
39041 * @expose
39042 */
39043 ByteBufferPrototype.toArrayBuffer = ByteBufferPrototype.toBuffer;
39044
39045 /**
39046 * Converts the ByteBuffer's contents to a string.
39047 * @param {string=} encoding Output encoding. Returns an informative string representation if omitted but also allows
39048 * direct conversion to "utf8", "hex", "base64" and "binary" encoding. "debug" returns a hex representation with
39049 * highlighted offsets.
39050 * @param {number=} begin Offset to begin at, defaults to {@link ByteBuffer#offset}
39051 * @param {number=} end Offset to end at, defaults to {@link ByteBuffer#limit}
39052 * @returns {string} String representation
39053 * @throws {Error} If `encoding` is invalid
39054 * @expose
39055 */
39056 ByteBufferPrototype.toString = function(encoding, begin, end) {
39057 if (typeof encoding === 'undefined')
39058 return "ByteBufferAB(offset="+this.offset+",markedOffset="+this.markedOffset+",limit="+this.limit+",capacity="+this.capacity()+")";
39059 if (typeof encoding === 'number')
39060 encoding = "utf8",
39061 begin = encoding,
39062 end = begin;
39063 switch (encoding) {
39064 case "utf8":
39065 return this.toUTF8(begin, end);
39066 case "base64":
39067 return this.toBase64(begin, end);
39068 case "hex":
39069 return this.toHex(begin, end);
39070 case "binary":
39071 return this.toBinary(begin, end);
39072 case "debug":
39073 return this.toDebug();
39074 case "columns":
39075 return this.toColumns();
39076 default:
39077 throw Error("Unsupported encoding: "+encoding);
39078 }
39079 };
39080
39081 // lxiv-embeddable
39082
39083 /**
39084 * lxiv-embeddable (c) 2014 Daniel Wirtz <dcode@dcode.io>
39085 * Released under the Apache License, Version 2.0
39086 * see: https://github.com/dcodeIO/lxiv for details
39087 */
39088 var lxiv = function() {
39089 "use strict";
39090
39091 /**
39092 * lxiv namespace.
39093 * @type {!Object.<string,*>}
39094 * @exports lxiv
39095 */
39096 var lxiv = {};
39097
39098 /**
39099 * Character codes for output.
39100 * @type {!Array.<number>}
39101 * @inner
39102 */
39103 var aout = [
39104 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
39105 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 97, 98, 99, 100, 101, 102,
39106 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118,
39107 119, 120, 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 43, 47
39108 ];
39109
39110 /**
39111 * Character codes for input.
39112 * @type {!Array.<number>}
39113 * @inner
39114 */
39115 var ain = [];
39116 for (var i=0, k=aout.length; i<k; ++i)
39117 ain[aout[i]] = i;
39118
39119 /**
39120 * Encodes bytes to base64 char codes.
39121 * @param {!function():number|null} src Bytes source as a function returning the next byte respectively `null` if
39122 * there are no more bytes left.
39123 * @param {!function(number)} dst Characters destination as a function successively called with each encoded char
39124 * code.
39125 */
39126 lxiv.encode = function(src, dst) {
39127 var b, t;
39128 while ((b = src()) !== null) {
39129 dst(aout[(b>>2)&0x3f]);
39130 t = (b&0x3)<<4;
39131 if ((b = src()) !== null) {
39132 t |= (b>>4)&0xf;
39133 dst(aout[(t|((b>>4)&0xf))&0x3f]);
39134 t = (b&0xf)<<2;
39135 if ((b = src()) !== null)
39136 dst(aout[(t|((b>>6)&0x3))&0x3f]),
39137 dst(aout[b&0x3f]);
39138 else
39139 dst(aout[t&0x3f]),
39140 dst(61);
39141 } else
39142 dst(aout[t&0x3f]),
39143 dst(61),
39144 dst(61);
39145 }
39146 };
39147
39148 /**
39149 * Decodes base64 char codes to bytes.
39150 * @param {!function():number|null} src Characters source as a function returning the next char code respectively
39151 * `null` if there are no more characters left.
39152 * @param {!function(number)} dst Bytes destination as a function successively called with the next byte.
39153 * @throws {Error} If a character code is invalid
39154 */
39155 lxiv.decode = function(src, dst) {
39156 var c, t1, t2;
39157 function fail(c) {
39158 throw Error("Illegal character code: "+c);
39159 }
39160 while ((c = src()) !== null) {
39161 t1 = ain[c];
39162 if (typeof t1 === 'undefined') fail(c);
39163 if ((c = src()) !== null) {
39164 t2 = ain[c];
39165 if (typeof t2 === 'undefined') fail(c);
39166 dst((t1<<2)>>>0|(t2&0x30)>>4);
39167 if ((c = src()) !== null) {
39168 t1 = ain[c];
39169 if (typeof t1 === 'undefined')
39170 if (c === 61) break; else fail(c);
39171 dst(((t2&0xf)<<4)>>>0|(t1&0x3c)>>2);
39172 if ((c = src()) !== null) {
39173 t2 = ain[c];
39174 if (typeof t2 === 'undefined')
39175 if (c === 61) break; else fail(c);
39176 dst(((t1&0x3)<<6)>>>0|t2);
39177 }
39178 }
39179 }
39180 }
39181 };
39182
39183 /**
39184 * Tests if a string is valid base64.
39185 * @param {string} str String to test
39186 * @returns {boolean} `true` if valid, otherwise `false`
39187 */
39188 lxiv.test = function(str) {
39189 return /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(str);
39190 };
39191
39192 return lxiv;
39193 }();
39194
39195 // encodings/base64
39196
39197 /**
39198 * Encodes this ByteBuffer's contents to a base64 encoded string.
39199 * @param {number=} begin Offset to begin at, defaults to {@link ByteBuffer#offset}.
39200 * @param {number=} end Offset to end at, defaults to {@link ByteBuffer#limit}.
39201 * @returns {string} Base64 encoded string
39202 * @throws {RangeError} If `begin` or `end` is out of bounds
39203 * @expose
39204 */
39205 ByteBufferPrototype.toBase64 = function(begin, end) {
39206 if (typeof begin === 'undefined')
39207 begin = this.offset;
39208 if (typeof end === 'undefined')
39209 end = this.limit;
39210 begin = begin | 0; end = end | 0;
39211 if (begin < 0 || end > this.capacity || begin > end)
39212 throw RangeError("begin, end");
39213 var sd; lxiv.encode(function() {
39214 return begin < end ? this.view[begin++] : null;
39215 }.bind(this), sd = stringDestination());
39216 return sd();
39217 };
39218
39219 /**
39220 * Decodes a base64 encoded string to a ByteBuffer.
39221 * @param {string} str String to decode
39222 * @param {boolean=} littleEndian Whether to use little or big endian byte order. Defaults to
39223 * {@link ByteBuffer.DEFAULT_ENDIAN}.
39224 * @returns {!ByteBuffer} ByteBuffer
39225 * @expose
39226 */
39227 ByteBuffer.fromBase64 = function(str, littleEndian) {
39228 if (typeof str !== 'string')
39229 throw TypeError("str");
39230 var bb = new ByteBuffer(str.length/4*3, littleEndian),
39231 i = 0;
39232 lxiv.decode(stringSource(str), function(b) {
39233 bb.view[i++] = b;
39234 });
39235 bb.limit = i;
39236 return bb;
39237 };
39238
39239 /**
39240 * Encodes a binary string to base64 like `window.btoa` does.
39241 * @param {string} str Binary string
39242 * @returns {string} Base64 encoded string
39243 * @see https://developer.mozilla.org/en-US/docs/Web/API/Window.btoa
39244 * @expose
39245 */
39246 ByteBuffer.btoa = function(str) {
39247 return ByteBuffer.fromBinary(str).toBase64();
39248 };
39249
39250 /**
39251 * Decodes a base64 encoded string to binary like `window.atob` does.
39252 * @param {string} b64 Base64 encoded string
39253 * @returns {string} Binary string
39254 * @see https://developer.mozilla.org/en-US/docs/Web/API/Window.atob
39255 * @expose
39256 */
39257 ByteBuffer.atob = function(b64) {
39258 return ByteBuffer.fromBase64(b64).toBinary();
39259 };
39260
39261 // encodings/binary
39262
39263 /**
39264 * Encodes this ByteBuffer to a binary encoded string, that is using only characters 0x00-0xFF as bytes.
39265 * @param {number=} begin Offset to begin at. Defaults to {@link ByteBuffer#offset}.
39266 * @param {number=} end Offset to end at. Defaults to {@link ByteBuffer#limit}.
39267 * @returns {string} Binary encoded string
39268 * @throws {RangeError} If `offset > limit`
39269 * @expose
39270 */
39271 ByteBufferPrototype.toBinary = function(begin, end) {
39272 if (typeof begin === 'undefined')
39273 begin = this.offset;
39274 if (typeof end === 'undefined')
39275 end = this.limit;
39276 begin |= 0; end |= 0;
39277 if (begin < 0 || end > this.capacity() || begin > end)
39278 throw RangeError("begin, end");
39279 if (begin === end)
39280 return "";
39281 var chars = [],
39282 parts = [];
39283 while (begin < end) {
39284 chars.push(this.view[begin++]);
39285 if (chars.length >= 1024)
39286 parts.push(String.fromCharCode.apply(String, chars)),
39287 chars = [];
39288 }
39289 return parts.join('') + String.fromCharCode.apply(String, chars);
39290 };
39291
39292 /**
39293 * Decodes a binary encoded string, that is using only characters 0x00-0xFF as bytes, to a ByteBuffer.
39294 * @param {string} str String to decode
39295 * @param {boolean=} littleEndian Whether to use little or big endian byte order. Defaults to
39296 * {@link ByteBuffer.DEFAULT_ENDIAN}.
39297 * @returns {!ByteBuffer} ByteBuffer
39298 * @expose
39299 */
39300 ByteBuffer.fromBinary = function(str, littleEndian) {
39301 if (typeof str !== 'string')
39302 throw TypeError("str");
39303 var i = 0,
39304 k = str.length,
39305 charCode,
39306 bb = new ByteBuffer(k, littleEndian);
39307 while (i<k) {
39308 charCode = str.charCodeAt(i);
39309 if (charCode > 0xff)
39310 throw RangeError("illegal char code: "+charCode);
39311 bb.view[i++] = charCode;
39312 }
39313 bb.limit = k;
39314 return bb;
39315 };
39316
39317 // encodings/debug
39318
39319 /**
39320 * Encodes this ByteBuffer to a hex encoded string with marked offsets. Offset symbols are:
39321 * * `<` : offset,
39322 * * `'` : markedOffset,
39323 * * `>` : limit,
39324 * * `|` : offset and limit,
39325 * * `[` : offset and markedOffset,
39326 * * `]` : markedOffset and limit,
39327 * * `!` : offset, markedOffset and limit
39328 * @param {boolean=} columns If `true` returns two columns hex + ascii, defaults to `false`
39329 * @returns {string|!Array.<string>} Debug string or array of lines if `asArray = true`
39330 * @expose
39331 * @example `>00'01 02<03` contains four bytes with `limit=0, markedOffset=1, offset=3`
39332 * @example `00[01 02 03>` contains four bytes with `offset=markedOffset=1, limit=4`
39333 * @example `00|01 02 03` contains four bytes with `offset=limit=1, markedOffset=-1`
39334 * @example `|` contains zero bytes with `offset=limit=0, markedOffset=-1`
39335 */
39336 ByteBufferPrototype.toDebug = function(columns) {
39337 var i = -1,
39338 k = this.buffer.byteLength,
39339 b,
39340 hex = "",
39341 asc = "",
39342 out = "";
39343 while (i<k) {
39344 if (i !== -1) {
39345 b = this.view[i];
39346 if (b < 0x10) hex += "0"+b.toString(16).toUpperCase();
39347 else hex += b.toString(16).toUpperCase();
39348 if (columns)
39349 asc += b > 32 && b < 127 ? String.fromCharCode(b) : '.';
39350 }
39351 ++i;
39352 if (columns) {
39353 if (i > 0 && i % 16 === 0 && i !== k) {
39354 while (hex.length < 3*16+3) hex += " ";
39355 out += hex+asc+"\n";
39356 hex = asc = "";
39357 }
39358 }
39359 if (i === this.offset && i === this.limit)
39360 hex += i === this.markedOffset ? "!" : "|";
39361 else if (i === this.offset)
39362 hex += i === this.markedOffset ? "[" : "<";
39363 else if (i === this.limit)
39364 hex += i === this.markedOffset ? "]" : ">";
39365 else
39366 hex += i === this.markedOffset ? "'" : (columns || (i !== 0 && i !== k) ? " " : "");
39367 }
39368 if (columns && hex !== " ") {
39369 while (hex.length < 3*16+3)
39370 hex += " ";
39371 out += hex + asc + "\n";
39372 }
39373 return columns ? out : hex;
39374 };
39375
39376 /**
39377 * Decodes a hex encoded string with marked offsets to a ByteBuffer.
39378 * @param {string} str Debug string to decode (not be generated with `columns = true`)
39379 * @param {boolean=} littleEndian Whether to use little or big endian byte order. Defaults to
39380 * {@link ByteBuffer.DEFAULT_ENDIAN}.
39381 * @param {boolean=} noAssert Whether to skip assertions of offsets and values. Defaults to
39382 * {@link ByteBuffer.DEFAULT_NOASSERT}.
39383 * @returns {!ByteBuffer} ByteBuffer
39384 * @expose
39385 * @see ByteBuffer#toDebug
39386 */
39387 ByteBuffer.fromDebug = function(str, littleEndian, noAssert) {
39388 var k = str.length,
39389 bb = new ByteBuffer(((k+1)/3)|0, littleEndian, noAssert);
39390 var i = 0, j = 0, ch, b,
39391 rs = false, // Require symbol next
39392 ho = false, hm = false, hl = false, // Already has offset (ho), markedOffset (hm), limit (hl)?
39393 fail = false;
39394 while (i<k) {
39395 switch (ch = str.charAt(i++)) {
39396 case '!':
39397 if (!noAssert) {
39398 if (ho || hm || hl) {
39399 fail = true;
39400 break;
39401 }
39402 ho = hm = hl = true;
39403 }
39404 bb.offset = bb.markedOffset = bb.limit = j;
39405 rs = false;
39406 break;
39407 case '|':
39408 if (!noAssert) {
39409 if (ho || hl) {
39410 fail = true;
39411 break;
39412 }
39413 ho = hl = true;
39414 }
39415 bb.offset = bb.limit = j;
39416 rs = false;
39417 break;
39418 case '[':
39419 if (!noAssert) {
39420 if (ho || hm) {
39421 fail = true;
39422 break;
39423 }
39424 ho = hm = true;
39425 }
39426 bb.offset = bb.markedOffset = j;
39427 rs = false;
39428 break;
39429 case '<':
39430 if (!noAssert) {
39431 if (ho) {
39432 fail = true;
39433 break;
39434 }
39435 ho = true;
39436 }
39437 bb.offset = j;
39438 rs = false;
39439 break;
39440 case ']':
39441 if (!noAssert) {
39442 if (hl || hm) {
39443 fail = true;
39444 break;
39445 }
39446 hl = hm = true;
39447 }
39448 bb.limit = bb.markedOffset = j;
39449 rs = false;
39450 break;
39451 case '>':
39452 if (!noAssert) {
39453 if (hl) {
39454 fail = true;
39455 break;
39456 }
39457 hl = true;
39458 }
39459 bb.limit = j;
39460 rs = false;
39461 break;
39462 case "'":
39463 if (!noAssert) {
39464 if (hm) {
39465 fail = true;
39466 break;
39467 }
39468 hm = true;
39469 }
39470 bb.markedOffset = j;
39471 rs = false;
39472 break;
39473 case ' ':
39474 rs = false;
39475 break;
39476 default:
39477 if (!noAssert) {
39478 if (rs) {
39479 fail = true;
39480 break;
39481 }
39482 }
39483 b = parseInt(ch+str.charAt(i++), 16);
39484 if (!noAssert) {
39485 if (isNaN(b) || b < 0 || b > 255)
39486 throw TypeError("Illegal str: Not a debug encoded string");
39487 }
39488 bb.view[j++] = b;
39489 rs = true;
39490 }
39491 if (fail)
39492 throw TypeError("Illegal str: Invalid symbol at "+i);
39493 }
39494 if (!noAssert) {
39495 if (!ho || !hl)
39496 throw TypeError("Illegal str: Missing offset or limit");
39497 if (j<bb.buffer.byteLength)
39498 throw TypeError("Illegal str: Not a debug encoded string (is it hex?) "+j+" < "+k);
39499 }
39500 return bb;
39501 };
39502
39503 // encodings/hex
39504
39505 /**
39506 * Encodes this ByteBuffer's contents to a hex encoded string.
39507 * @param {number=} begin Offset to begin at. Defaults to {@link ByteBuffer#offset}.
39508 * @param {number=} end Offset to end at. Defaults to {@link ByteBuffer#limit}.
39509 * @returns {string} Hex encoded string
39510 * @expose
39511 */
39512 ByteBufferPrototype.toHex = function(begin, end) {
39513 begin = typeof begin === 'undefined' ? this.offset : begin;
39514 end = typeof end === 'undefined' ? this.limit : end;
39515 if (!this.noAssert) {
39516 if (typeof begin !== 'number' || begin % 1 !== 0)
39517 throw TypeError("Illegal begin: Not an integer");
39518 begin >>>= 0;
39519 if (typeof end !== 'number' || end % 1 !== 0)
39520 throw TypeError("Illegal end: Not an integer");
39521 end >>>= 0;
39522 if (begin < 0 || begin > end || end > this.buffer.byteLength)
39523 throw RangeError("Illegal range: 0 <= "+begin+" <= "+end+" <= "+this.buffer.byteLength);
39524 }
39525 var out = new Array(end - begin),
39526 b;
39527 while (begin < end) {
39528 b = this.view[begin++];
39529 if (b < 0x10)
39530 out.push("0", b.toString(16));
39531 else out.push(b.toString(16));
39532 }
39533 return out.join('');
39534 };
39535
39536 /**
39537 * Decodes a hex encoded string to a ByteBuffer.
39538 * @param {string} str String to decode
39539 * @param {boolean=} littleEndian Whether to use little or big endian byte order. Defaults to
39540 * {@link ByteBuffer.DEFAULT_ENDIAN}.
39541 * @param {boolean=} noAssert Whether to skip assertions of offsets and values. Defaults to
39542 * {@link ByteBuffer.DEFAULT_NOASSERT}.
39543 * @returns {!ByteBuffer} ByteBuffer
39544 * @expose
39545 */
39546 ByteBuffer.fromHex = function(str, littleEndian, noAssert) {
39547 if (!noAssert) {
39548 if (typeof str !== 'string')
39549 throw TypeError("Illegal str: Not a string");
39550 if (str.length % 2 !== 0)
39551 throw TypeError("Illegal str: Length not a multiple of 2");
39552 }
39553 var k = str.length,
39554 bb = new ByteBuffer((k / 2) | 0, littleEndian),
39555 b;
39556 for (var i=0, j=0; i<k; i+=2) {
39557 b = parseInt(str.substring(i, i+2), 16);
39558 if (!noAssert)
39559 if (!isFinite(b) || b < 0 || b > 255)
39560 throw TypeError("Illegal str: Contains non-hex characters");
39561 bb.view[j++] = b;
39562 }
39563 bb.limit = j;
39564 return bb;
39565 };
39566
39567 // utfx-embeddable
39568
39569 /**
39570 * utfx-embeddable (c) 2014 Daniel Wirtz <dcode@dcode.io>
39571 * Released under the Apache License, Version 2.0
39572 * see: https://github.com/dcodeIO/utfx for details
39573 */
39574 var utfx = function() {
39575 "use strict";
39576
39577 /**
39578 * utfx namespace.
39579 * @inner
39580 * @type {!Object.<string,*>}
39581 */
39582 var utfx = {};
39583
39584 /**
39585 * Maximum valid code point.
39586 * @type {number}
39587 * @const
39588 */
39589 utfx.MAX_CODEPOINT = 0x10FFFF;
39590
39591 /**
39592 * Encodes UTF8 code points to UTF8 bytes.
39593 * @param {(!function():number|null) | number} src Code points source, either as a function returning the next code point
39594 * respectively `null` if there are no more code points left or a single numeric code point.
39595 * @param {!function(number)} dst Bytes destination as a function successively called with the next byte
39596 */
39597 utfx.encodeUTF8 = function(src, dst) {
39598 var cp = null;
39599 if (typeof src === 'number')
39600 cp = src,
39601 src = function() { return null; };
39602 while (cp !== null || (cp = src()) !== null) {
39603 if (cp < 0x80)
39604 dst(cp&0x7F);
39605 else if (cp < 0x800)
39606 dst(((cp>>6)&0x1F)|0xC0),
39607 dst((cp&0x3F)|0x80);
39608 else if (cp < 0x10000)
39609 dst(((cp>>12)&0x0F)|0xE0),
39610 dst(((cp>>6)&0x3F)|0x80),
39611 dst((cp&0x3F)|0x80);
39612 else
39613 dst(((cp>>18)&0x07)|0xF0),
39614 dst(((cp>>12)&0x3F)|0x80),
39615 dst(((cp>>6)&0x3F)|0x80),
39616 dst((cp&0x3F)|0x80);
39617 cp = null;
39618 }
39619 };
39620
39621 /**
39622 * Decodes UTF8 bytes to UTF8 code points.
39623 * @param {!function():number|null} src Bytes source as a function returning the next byte respectively `null` if there
39624 * are no more bytes left.
39625 * @param {!function(number)} dst Code points destination as a function successively called with each decoded code point.
39626 * @throws {RangeError} If a starting byte is invalid in UTF8
39627 * @throws {Error} If the last sequence is truncated. Has an array property `bytes` holding the
39628 * remaining bytes.
39629 */
39630 utfx.decodeUTF8 = function(src, dst) {
39631 var a, b, c, d, fail = function(b) {
39632 b = b.slice(0, b.indexOf(null));
39633 var err = Error(b.toString());
39634 err.name = "TruncatedError";
39635 err['bytes'] = b;
39636 throw err;
39637 };
39638 while ((a = src()) !== null) {
39639 if ((a&0x80) === 0)
39640 dst(a);
39641 else if ((a&0xE0) === 0xC0)
39642 ((b = src()) === null) && fail([a, b]),
39643 dst(((a&0x1F)<<6) | (b&0x3F));
39644 else if ((a&0xF0) === 0xE0)
39645 ((b=src()) === null || (c=src()) === null) && fail([a, b, c]),
39646 dst(((a&0x0F)<<12) | ((b&0x3F)<<6) | (c&0x3F));
39647 else if ((a&0xF8) === 0xF0)
39648 ((b=src()) === null || (c=src()) === null || (d=src()) === null) && fail([a, b, c ,d]),
39649 dst(((a&0x07)<<18) | ((b&0x3F)<<12) | ((c&0x3F)<<6) | (d&0x3F));
39650 else throw RangeError("Illegal starting byte: "+a);
39651 }
39652 };
39653
39654 /**
39655 * Converts UTF16 characters to UTF8 code points.
39656 * @param {!function():number|null} src Characters source as a function returning the next char code respectively
39657 * `null` if there are no more characters left.
39658 * @param {!function(number)} dst Code points destination as a function successively called with each converted code
39659 * point.
39660 */
39661 utfx.UTF16toUTF8 = function(src, dst) {
39662 var c1, c2 = null;
39663 while (true) {
39664 if ((c1 = c2 !== null ? c2 : src()) === null)
39665 break;
39666 if (c1 >= 0xD800 && c1 <= 0xDFFF) {
39667 if ((c2 = src()) !== null) {
39668 if (c2 >= 0xDC00 && c2 <= 0xDFFF) {
39669 dst((c1-0xD800)*0x400+c2-0xDC00+0x10000);
39670 c2 = null; continue;
39671 }
39672 }
39673 }
39674 dst(c1);
39675 }
39676 if (c2 !== null) dst(c2);
39677 };
39678
39679 /**
39680 * Converts UTF8 code points to UTF16 characters.
39681 * @param {(!function():number|null) | number} src Code points source, either as a function returning the next code point
39682 * respectively `null` if there are no more code points left or a single numeric code point.
39683 * @param {!function(number)} dst Characters destination as a function successively called with each converted char code.
39684 * @throws {RangeError} If a code point is out of range
39685 */
39686 utfx.UTF8toUTF16 = function(src, dst) {
39687 var cp = null;
39688 if (typeof src === 'number')
39689 cp = src, src = function() { return null; };
39690 while (cp !== null || (cp = src()) !== null) {
39691 if (cp <= 0xFFFF)
39692 dst(cp);
39693 else
39694 cp -= 0x10000,
39695 dst((cp>>10)+0xD800),
39696 dst((cp%0x400)+0xDC00);
39697 cp = null;
39698 }
39699 };
39700
39701 /**
39702 * Converts and encodes UTF16 characters to UTF8 bytes.
39703 * @param {!function():number|null} src Characters source as a function returning the next char code respectively `null`
39704 * if there are no more characters left.
39705 * @param {!function(number)} dst Bytes destination as a function successively called with the next byte.
39706 */
39707 utfx.encodeUTF16toUTF8 = function(src, dst) {
39708 utfx.UTF16toUTF8(src, function(cp) {
39709 utfx.encodeUTF8(cp, dst);
39710 });
39711 };
39712
39713 /**
39714 * Decodes and converts UTF8 bytes to UTF16 characters.
39715 * @param {!function():number|null} src Bytes source as a function returning the next byte respectively `null` if there
39716 * are no more bytes left.
39717 * @param {!function(number)} dst Characters destination as a function successively called with each converted char code.
39718 * @throws {RangeError} If a starting byte is invalid in UTF8
39719 * @throws {Error} If the last sequence is truncated. Has an array property `bytes` holding the remaining bytes.
39720 */
39721 utfx.decodeUTF8toUTF16 = function(src, dst) {
39722 utfx.decodeUTF8(src, function(cp) {
39723 utfx.UTF8toUTF16(cp, dst);
39724 });
39725 };
39726
39727 /**
39728 * Calculates the byte length of an UTF8 code point.
39729 * @param {number} cp UTF8 code point
39730 * @returns {number} Byte length
39731 */
39732 utfx.calculateCodePoint = function(cp) {
39733 return (cp < 0x80) ? 1 : (cp < 0x800) ? 2 : (cp < 0x10000) ? 3 : 4;
39734 };
39735
39736 /**
39737 * Calculates the number of UTF8 bytes required to store UTF8 code points.
39738 * @param {(!function():number|null)} src Code points source as a function returning the next code point respectively
39739 * `null` if there are no more code points left.
39740 * @returns {number} The number of UTF8 bytes required
39741 */
39742 utfx.calculateUTF8 = function(src) {
39743 var cp, l=0;
39744 while ((cp = src()) !== null)
39745 l += (cp < 0x80) ? 1 : (cp < 0x800) ? 2 : (cp < 0x10000) ? 3 : 4;
39746 return l;
39747 };
39748
39749 /**
39750 * Calculates the number of UTF8 code points respectively UTF8 bytes required to store UTF16 char codes.
39751 * @param {(!function():number|null)} src Characters source as a function returning the next char code respectively
39752 * `null` if there are no more characters left.
39753 * @returns {!Array.<number>} The number of UTF8 code points at index 0 and the number of UTF8 bytes required at index 1.
39754 */
39755 utfx.calculateUTF16asUTF8 = function(src) {
39756 var n=0, l=0;
39757 utfx.UTF16toUTF8(src, function(cp) {
39758 ++n; l += (cp < 0x80) ? 1 : (cp < 0x800) ? 2 : (cp < 0x10000) ? 3 : 4;
39759 });
39760 return [n,l];
39761 };
39762
39763 return utfx;
39764 }();
39765
39766 // encodings/utf8
39767
39768 /**
39769 * Encodes this ByteBuffer's contents between {@link ByteBuffer#offset} and {@link ByteBuffer#limit} to an UTF8 encoded
39770 * string.
39771 * @returns {string} Hex encoded string
39772 * @throws {RangeError} If `offset > limit`
39773 * @expose
39774 */
39775 ByteBufferPrototype.toUTF8 = function(begin, end) {
39776 if (typeof begin === 'undefined') begin = this.offset;
39777 if (typeof end === 'undefined') end = this.limit;
39778 if (!this.noAssert) {
39779 if (typeof begin !== 'number' || begin % 1 !== 0)
39780 throw TypeError("Illegal begin: Not an integer");
39781 begin >>>= 0;
39782 if (typeof end !== 'number' || end % 1 !== 0)
39783 throw TypeError("Illegal end: Not an integer");
39784 end >>>= 0;
39785 if (begin < 0 || begin > end || end > this.buffer.byteLength)
39786 throw RangeError("Illegal range: 0 <= "+begin+" <= "+end+" <= "+this.buffer.byteLength);
39787 }
39788 var sd; try {
39789 utfx.decodeUTF8toUTF16(function() {
39790 return begin < end ? this.view[begin++] : null;
39791 }.bind(this), sd = stringDestination());
39792 } catch (e) {
39793 if (begin !== end)
39794 throw RangeError("Illegal range: Truncated data, "+begin+" != "+end);
39795 }
39796 return sd();
39797 };
39798
39799 /**
39800 * Decodes an UTF8 encoded string to a ByteBuffer.
39801 * @param {string} str String to decode
39802 * @param {boolean=} littleEndian Whether to use little or big endian byte order. Defaults to
39803 * {@link ByteBuffer.DEFAULT_ENDIAN}.
39804 * @param {boolean=} noAssert Whether to skip assertions of offsets and values. Defaults to
39805 * {@link ByteBuffer.DEFAULT_NOASSERT}.
39806 * @returns {!ByteBuffer} ByteBuffer
39807 * @expose
39808 */
39809 ByteBuffer.fromUTF8 = function(str, littleEndian, noAssert) {
39810 if (!noAssert)
39811 if (typeof str !== 'string')
39812 throw TypeError("Illegal str: Not a string");
39813 var bb = new ByteBuffer(utfx.calculateUTF16asUTF8(stringSource(str), true)[1], littleEndian, noAssert),
39814 i = 0;
39815 utfx.encodeUTF16toUTF8(stringSource(str), function(b) {
39816 bb.view[i++] = b;
39817 });
39818 bb.limit = i;
39819 return bb;
39820 };
39821
39822 return ByteBuffer;
39823});
39824
39825
39826/***/ }),
39827/* 616 */
39828/***/ (function(module, exports, __webpack_require__) {
39829
39830var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*
39831 Copyright 2013 Daniel Wirtz <dcode@dcode.io>
39832 Copyright 2009 The Closure Library Authors. All Rights Reserved.
39833
39834 Licensed under the Apache License, Version 2.0 (the "License");
39835 you may not use this file except in compliance with the License.
39836 You may obtain a copy of the License at
39837
39838 http://www.apache.org/licenses/LICENSE-2.0
39839
39840 Unless required by applicable law or agreed to in writing, software
39841 distributed under the License is distributed on an "AS-IS" BASIS,
39842 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
39843 See the License for the specific language governing permissions and
39844 limitations under the License.
39845 */
39846
39847/**
39848 * @license long.js (c) 2013 Daniel Wirtz <dcode@dcode.io>
39849 * Released under the Apache License, Version 2.0
39850 * see: https://github.com/dcodeIO/long.js for details
39851 */
39852(function(global, factory) {
39853
39854 /* AMD */ if (true)
39855 !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
39856 __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
39857 (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
39858 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
39859 /* CommonJS */ else if (typeof require === 'function' && typeof module === "object" && module && module["exports"])
39860 module["exports"] = factory();
39861 /* Global */ else
39862 (global["dcodeIO"] = global["dcodeIO"] || {})["Long"] = factory();
39863
39864})(this, function() {
39865 "use strict";
39866
39867 /**
39868 * Constructs a 64 bit two's-complement integer, given its low and high 32 bit values as *signed* integers.
39869 * See the from* functions below for more convenient ways of constructing Longs.
39870 * @exports Long
39871 * @class A Long class for representing a 64 bit two's-complement integer value.
39872 * @param {number} low The low (signed) 32 bits of the long
39873 * @param {number} high The high (signed) 32 bits of the long
39874 * @param {boolean=} unsigned Whether unsigned or not, defaults to `false` for signed
39875 * @constructor
39876 */
39877 function Long(low, high, unsigned) {
39878
39879 /**
39880 * The low 32 bits as a signed value.
39881 * @type {number}
39882 */
39883 this.low = low | 0;
39884
39885 /**
39886 * The high 32 bits as a signed value.
39887 * @type {number}
39888 */
39889 this.high = high | 0;
39890
39891 /**
39892 * Whether unsigned or not.
39893 * @type {boolean}
39894 */
39895 this.unsigned = !!unsigned;
39896 }
39897
39898 // The internal representation of a long is the two given signed, 32-bit values.
39899 // We use 32-bit pieces because these are the size of integers on which
39900 // Javascript performs bit-operations. For operations like addition and
39901 // multiplication, we split each number into 16 bit pieces, which can easily be
39902 // multiplied within Javascript's floating-point representation without overflow
39903 // or change in sign.
39904 //
39905 // In the algorithms below, we frequently reduce the negative case to the
39906 // positive case by negating the input(s) and then post-processing the result.
39907 // Note that we must ALWAYS check specially whether those values are MIN_VALUE
39908 // (-2^63) because -MIN_VALUE == MIN_VALUE (since 2^63 cannot be represented as
39909 // a positive number, it overflows back into a negative). Not handling this
39910 // case would often result in infinite recursion.
39911 //
39912 // Common constant values ZERO, ONE, NEG_ONE, etc. are defined below the from*
39913 // methods on which they depend.
39914
39915 /**
39916 * An indicator used to reliably determine if an object is a Long or not.
39917 * @type {boolean}
39918 * @const
39919 * @private
39920 */
39921 Long.prototype.__isLong__;
39922
39923 Object.defineProperty(Long.prototype, "__isLong__", {
39924 value: true,
39925 enumerable: false,
39926 configurable: false
39927 });
39928
39929 /**
39930 * @function
39931 * @param {*} obj Object
39932 * @returns {boolean}
39933 * @inner
39934 */
39935 function isLong(obj) {
39936 return (obj && obj["__isLong__"]) === true;
39937 }
39938
39939 /**
39940 * Tests if the specified object is a Long.
39941 * @function
39942 * @param {*} obj Object
39943 * @returns {boolean}
39944 */
39945 Long.isLong = isLong;
39946
39947 /**
39948 * A cache of the Long representations of small integer values.
39949 * @type {!Object}
39950 * @inner
39951 */
39952 var INT_CACHE = {};
39953
39954 /**
39955 * A cache of the Long representations of small unsigned integer values.
39956 * @type {!Object}
39957 * @inner
39958 */
39959 var UINT_CACHE = {};
39960
39961 /**
39962 * @param {number} value
39963 * @param {boolean=} unsigned
39964 * @returns {!Long}
39965 * @inner
39966 */
39967 function fromInt(value, unsigned) {
39968 var obj, cachedObj, cache;
39969 if (unsigned) {
39970 value >>>= 0;
39971 if (cache = (0 <= value && value < 256)) {
39972 cachedObj = UINT_CACHE[value];
39973 if (cachedObj)
39974 return cachedObj;
39975 }
39976 obj = fromBits(value, (value | 0) < 0 ? -1 : 0, true);
39977 if (cache)
39978 UINT_CACHE[value] = obj;
39979 return obj;
39980 } else {
39981 value |= 0;
39982 if (cache = (-128 <= value && value < 128)) {
39983 cachedObj = INT_CACHE[value];
39984 if (cachedObj)
39985 return cachedObj;
39986 }
39987 obj = fromBits(value, value < 0 ? -1 : 0, false);
39988 if (cache)
39989 INT_CACHE[value] = obj;
39990 return obj;
39991 }
39992 }
39993
39994 /**
39995 * Returns a Long representing the given 32 bit integer value.
39996 * @function
39997 * @param {number} value The 32 bit integer in question
39998 * @param {boolean=} unsigned Whether unsigned or not, defaults to `false` for signed
39999 * @returns {!Long} The corresponding Long value
40000 */
40001 Long.fromInt = fromInt;
40002
40003 /**
40004 * @param {number} value
40005 * @param {boolean=} unsigned
40006 * @returns {!Long}
40007 * @inner
40008 */
40009 function fromNumber(value, unsigned) {
40010 if (isNaN(value) || !isFinite(value))
40011 return unsigned ? UZERO : ZERO;
40012 if (unsigned) {
40013 if (value < 0)
40014 return UZERO;
40015 if (value >= TWO_PWR_64_DBL)
40016 return MAX_UNSIGNED_VALUE;
40017 } else {
40018 if (value <= -TWO_PWR_63_DBL)
40019 return MIN_VALUE;
40020 if (value + 1 >= TWO_PWR_63_DBL)
40021 return MAX_VALUE;
40022 }
40023 if (value < 0)
40024 return fromNumber(-value, unsigned).neg();
40025 return fromBits((value % TWO_PWR_32_DBL) | 0, (value / TWO_PWR_32_DBL) | 0, unsigned);
40026 }
40027
40028 /**
40029 * Returns a Long representing the given value, provided that it is a finite number. Otherwise, zero is returned.
40030 * @function
40031 * @param {number} value The number in question
40032 * @param {boolean=} unsigned Whether unsigned or not, defaults to `false` for signed
40033 * @returns {!Long} The corresponding Long value
40034 */
40035 Long.fromNumber = fromNumber;
40036
40037 /**
40038 * @param {number} lowBits
40039 * @param {number} highBits
40040 * @param {boolean=} unsigned
40041 * @returns {!Long}
40042 * @inner
40043 */
40044 function fromBits(lowBits, highBits, unsigned) {
40045 return new Long(lowBits, highBits, unsigned);
40046 }
40047
40048 /**
40049 * Returns a Long representing the 64 bit integer that comes by concatenating the given low and high bits. Each is
40050 * assumed to use 32 bits.
40051 * @function
40052 * @param {number} lowBits The low 32 bits
40053 * @param {number} highBits The high 32 bits
40054 * @param {boolean=} unsigned Whether unsigned or not, defaults to `false` for signed
40055 * @returns {!Long} The corresponding Long value
40056 */
40057 Long.fromBits = fromBits;
40058
40059 /**
40060 * @function
40061 * @param {number} base
40062 * @param {number} exponent
40063 * @returns {number}
40064 * @inner
40065 */
40066 var pow_dbl = Math.pow; // Used 4 times (4*8 to 15+4)
40067
40068 /**
40069 * @param {string} str
40070 * @param {(boolean|number)=} unsigned
40071 * @param {number=} radix
40072 * @returns {!Long}
40073 * @inner
40074 */
40075 function fromString(str, unsigned, radix) {
40076 if (str.length === 0)
40077 throw Error('empty string');
40078 if (str === "NaN" || str === "Infinity" || str === "+Infinity" || str === "-Infinity")
40079 return ZERO;
40080 if (typeof unsigned === 'number') {
40081 // For goog.math.long compatibility
40082 radix = unsigned,
40083 unsigned = false;
40084 } else {
40085 unsigned = !! unsigned;
40086 }
40087 radix = radix || 10;
40088 if (radix < 2 || 36 < radix)
40089 throw RangeError('radix');
40090
40091 var p;
40092 if ((p = str.indexOf('-')) > 0)
40093 throw Error('interior hyphen');
40094 else if (p === 0) {
40095 return fromString(str.substring(1), unsigned, radix).neg();
40096 }
40097
40098 // Do several (8) digits each time through the loop, so as to
40099 // minimize the calls to the very expensive emulated div.
40100 var radixToPower = fromNumber(pow_dbl(radix, 8));
40101
40102 var result = ZERO;
40103 for (var i = 0; i < str.length; i += 8) {
40104 var size = Math.min(8, str.length - i),
40105 value = parseInt(str.substring(i, i + size), radix);
40106 if (size < 8) {
40107 var power = fromNumber(pow_dbl(radix, size));
40108 result = result.mul(power).add(fromNumber(value));
40109 } else {
40110 result = result.mul(radixToPower);
40111 result = result.add(fromNumber(value));
40112 }
40113 }
40114 result.unsigned = unsigned;
40115 return result;
40116 }
40117
40118 /**
40119 * Returns a Long representation of the given string, written using the specified radix.
40120 * @function
40121 * @param {string} str The textual representation of the Long
40122 * @param {(boolean|number)=} unsigned Whether unsigned or not, defaults to `false` for signed
40123 * @param {number=} radix The radix in which the text is written (2-36), defaults to 10
40124 * @returns {!Long} The corresponding Long value
40125 */
40126 Long.fromString = fromString;
40127
40128 /**
40129 * @function
40130 * @param {!Long|number|string|!{low: number, high: number, unsigned: boolean}} val
40131 * @returns {!Long}
40132 * @inner
40133 */
40134 function fromValue(val) {
40135 if (val /* is compatible */ instanceof Long)
40136 return val;
40137 if (typeof val === 'number')
40138 return fromNumber(val);
40139 if (typeof val === 'string')
40140 return fromString(val);
40141 // Throws for non-objects, converts non-instanceof Long:
40142 return fromBits(val.low, val.high, val.unsigned);
40143 }
40144
40145 /**
40146 * Converts the specified value to a Long.
40147 * @function
40148 * @param {!Long|number|string|!{low: number, high: number, unsigned: boolean}} val Value
40149 * @returns {!Long}
40150 */
40151 Long.fromValue = fromValue;
40152
40153 // NOTE: the compiler should inline these constant values below and then remove these variables, so there should be
40154 // no runtime penalty for these.
40155
40156 /**
40157 * @type {number}
40158 * @const
40159 * @inner
40160 */
40161 var TWO_PWR_16_DBL = 1 << 16;
40162
40163 /**
40164 * @type {number}
40165 * @const
40166 * @inner
40167 */
40168 var TWO_PWR_24_DBL = 1 << 24;
40169
40170 /**
40171 * @type {number}
40172 * @const
40173 * @inner
40174 */
40175 var TWO_PWR_32_DBL = TWO_PWR_16_DBL * TWO_PWR_16_DBL;
40176
40177 /**
40178 * @type {number}
40179 * @const
40180 * @inner
40181 */
40182 var TWO_PWR_64_DBL = TWO_PWR_32_DBL * TWO_PWR_32_DBL;
40183
40184 /**
40185 * @type {number}
40186 * @const
40187 * @inner
40188 */
40189 var TWO_PWR_63_DBL = TWO_PWR_64_DBL / 2;
40190
40191 /**
40192 * @type {!Long}
40193 * @const
40194 * @inner
40195 */
40196 var TWO_PWR_24 = fromInt(TWO_PWR_24_DBL);
40197
40198 /**
40199 * @type {!Long}
40200 * @inner
40201 */
40202 var ZERO = fromInt(0);
40203
40204 /**
40205 * Signed zero.
40206 * @type {!Long}
40207 */
40208 Long.ZERO = ZERO;
40209
40210 /**
40211 * @type {!Long}
40212 * @inner
40213 */
40214 var UZERO = fromInt(0, true);
40215
40216 /**
40217 * Unsigned zero.
40218 * @type {!Long}
40219 */
40220 Long.UZERO = UZERO;
40221
40222 /**
40223 * @type {!Long}
40224 * @inner
40225 */
40226 var ONE = fromInt(1);
40227
40228 /**
40229 * Signed one.
40230 * @type {!Long}
40231 */
40232 Long.ONE = ONE;
40233
40234 /**
40235 * @type {!Long}
40236 * @inner
40237 */
40238 var UONE = fromInt(1, true);
40239
40240 /**
40241 * Unsigned one.
40242 * @type {!Long}
40243 */
40244 Long.UONE = UONE;
40245
40246 /**
40247 * @type {!Long}
40248 * @inner
40249 */
40250 var NEG_ONE = fromInt(-1);
40251
40252 /**
40253 * Signed negative one.
40254 * @type {!Long}
40255 */
40256 Long.NEG_ONE = NEG_ONE;
40257
40258 /**
40259 * @type {!Long}
40260 * @inner
40261 */
40262 var MAX_VALUE = fromBits(0xFFFFFFFF|0, 0x7FFFFFFF|0, false);
40263
40264 /**
40265 * Maximum signed value.
40266 * @type {!Long}
40267 */
40268 Long.MAX_VALUE = MAX_VALUE;
40269
40270 /**
40271 * @type {!Long}
40272 * @inner
40273 */
40274 var MAX_UNSIGNED_VALUE = fromBits(0xFFFFFFFF|0, 0xFFFFFFFF|0, true);
40275
40276 /**
40277 * Maximum unsigned value.
40278 * @type {!Long}
40279 */
40280 Long.MAX_UNSIGNED_VALUE = MAX_UNSIGNED_VALUE;
40281
40282 /**
40283 * @type {!Long}
40284 * @inner
40285 */
40286 var MIN_VALUE = fromBits(0, 0x80000000|0, false);
40287
40288 /**
40289 * Minimum signed value.
40290 * @type {!Long}
40291 */
40292 Long.MIN_VALUE = MIN_VALUE;
40293
40294 /**
40295 * @alias Long.prototype
40296 * @inner
40297 */
40298 var LongPrototype = Long.prototype;
40299
40300 /**
40301 * Converts the Long to a 32 bit integer, assuming it is a 32 bit integer.
40302 * @returns {number}
40303 */
40304 LongPrototype.toInt = function toInt() {
40305 return this.unsigned ? this.low >>> 0 : this.low;
40306 };
40307
40308 /**
40309 * Converts the Long to a the nearest floating-point representation of this value (double, 53 bit mantissa).
40310 * @returns {number}
40311 */
40312 LongPrototype.toNumber = function toNumber() {
40313 if (this.unsigned)
40314 return ((this.high >>> 0) * TWO_PWR_32_DBL) + (this.low >>> 0);
40315 return this.high * TWO_PWR_32_DBL + (this.low >>> 0);
40316 };
40317
40318 /**
40319 * Converts the Long to a string written in the specified radix.
40320 * @param {number=} radix Radix (2-36), defaults to 10
40321 * @returns {string}
40322 * @override
40323 * @throws {RangeError} If `radix` is out of range
40324 */
40325 LongPrototype.toString = function toString(radix) {
40326 radix = radix || 10;
40327 if (radix < 2 || 36 < radix)
40328 throw RangeError('radix');
40329 if (this.isZero())
40330 return '0';
40331 if (this.isNegative()) { // Unsigned Longs are never negative
40332 if (this.eq(MIN_VALUE)) {
40333 // We need to change the Long value before it can be negated, so we remove
40334 // the bottom-most digit in this base and then recurse to do the rest.
40335 var radixLong = fromNumber(radix),
40336 div = this.div(radixLong),
40337 rem1 = div.mul(radixLong).sub(this);
40338 return div.toString(radix) + rem1.toInt().toString(radix);
40339 } else
40340 return '-' + this.neg().toString(radix);
40341 }
40342
40343 // Do several (6) digits each time through the loop, so as to
40344 // minimize the calls to the very expensive emulated div.
40345 var radixToPower = fromNumber(pow_dbl(radix, 6), this.unsigned),
40346 rem = this;
40347 var result = '';
40348 while (true) {
40349 var remDiv = rem.div(radixToPower),
40350 intval = rem.sub(remDiv.mul(radixToPower)).toInt() >>> 0,
40351 digits = intval.toString(radix);
40352 rem = remDiv;
40353 if (rem.isZero())
40354 return digits + result;
40355 else {
40356 while (digits.length < 6)
40357 digits = '0' + digits;
40358 result = '' + digits + result;
40359 }
40360 }
40361 };
40362
40363 /**
40364 * Gets the high 32 bits as a signed integer.
40365 * @returns {number} Signed high bits
40366 */
40367 LongPrototype.getHighBits = function getHighBits() {
40368 return this.high;
40369 };
40370
40371 /**
40372 * Gets the high 32 bits as an unsigned integer.
40373 * @returns {number} Unsigned high bits
40374 */
40375 LongPrototype.getHighBitsUnsigned = function getHighBitsUnsigned() {
40376 return this.high >>> 0;
40377 };
40378
40379 /**
40380 * Gets the low 32 bits as a signed integer.
40381 * @returns {number} Signed low bits
40382 */
40383 LongPrototype.getLowBits = function getLowBits() {
40384 return this.low;
40385 };
40386
40387 /**
40388 * Gets the low 32 bits as an unsigned integer.
40389 * @returns {number} Unsigned low bits
40390 */
40391 LongPrototype.getLowBitsUnsigned = function getLowBitsUnsigned() {
40392 return this.low >>> 0;
40393 };
40394
40395 /**
40396 * Gets the number of bits needed to represent the absolute value of this Long.
40397 * @returns {number}
40398 */
40399 LongPrototype.getNumBitsAbs = function getNumBitsAbs() {
40400 if (this.isNegative()) // Unsigned Longs are never negative
40401 return this.eq(MIN_VALUE) ? 64 : this.neg().getNumBitsAbs();
40402 var val = this.high != 0 ? this.high : this.low;
40403 for (var bit = 31; bit > 0; bit--)
40404 if ((val & (1 << bit)) != 0)
40405 break;
40406 return this.high != 0 ? bit + 33 : bit + 1;
40407 };
40408
40409 /**
40410 * Tests if this Long's value equals zero.
40411 * @returns {boolean}
40412 */
40413 LongPrototype.isZero = function isZero() {
40414 return this.high === 0 && this.low === 0;
40415 };
40416
40417 /**
40418 * Tests if this Long's value is negative.
40419 * @returns {boolean}
40420 */
40421 LongPrototype.isNegative = function isNegative() {
40422 return !this.unsigned && this.high < 0;
40423 };
40424
40425 /**
40426 * Tests if this Long's value is positive.
40427 * @returns {boolean}
40428 */
40429 LongPrototype.isPositive = function isPositive() {
40430 return this.unsigned || this.high >= 0;
40431 };
40432
40433 /**
40434 * Tests if this Long's value is odd.
40435 * @returns {boolean}
40436 */
40437 LongPrototype.isOdd = function isOdd() {
40438 return (this.low & 1) === 1;
40439 };
40440
40441 /**
40442 * Tests if this Long's value is even.
40443 * @returns {boolean}
40444 */
40445 LongPrototype.isEven = function isEven() {
40446 return (this.low & 1) === 0;
40447 };
40448
40449 /**
40450 * Tests if this Long's value equals the specified's.
40451 * @param {!Long|number|string} other Other value
40452 * @returns {boolean}
40453 */
40454 LongPrototype.equals = function equals(other) {
40455 if (!isLong(other))
40456 other = fromValue(other);
40457 if (this.unsigned !== other.unsigned && (this.high >>> 31) === 1 && (other.high >>> 31) === 1)
40458 return false;
40459 return this.high === other.high && this.low === other.low;
40460 };
40461
40462 /**
40463 * Tests if this Long's value equals the specified's. This is an alias of {@link Long#equals}.
40464 * @function
40465 * @param {!Long|number|string} other Other value
40466 * @returns {boolean}
40467 */
40468 LongPrototype.eq = LongPrototype.equals;
40469
40470 /**
40471 * Tests if this Long's value differs from the specified's.
40472 * @param {!Long|number|string} other Other value
40473 * @returns {boolean}
40474 */
40475 LongPrototype.notEquals = function notEquals(other) {
40476 return !this.eq(/* validates */ other);
40477 };
40478
40479 /**
40480 * Tests if this Long's value differs from the specified's. This is an alias of {@link Long#notEquals}.
40481 * @function
40482 * @param {!Long|number|string} other Other value
40483 * @returns {boolean}
40484 */
40485 LongPrototype.neq = LongPrototype.notEquals;
40486
40487 /**
40488 * Tests if this Long's value is less than the specified's.
40489 * @param {!Long|number|string} other Other value
40490 * @returns {boolean}
40491 */
40492 LongPrototype.lessThan = function lessThan(other) {
40493 return this.comp(/* validates */ other) < 0;
40494 };
40495
40496 /**
40497 * Tests if this Long's value is less than the specified's. This is an alias of {@link Long#lessThan}.
40498 * @function
40499 * @param {!Long|number|string} other Other value
40500 * @returns {boolean}
40501 */
40502 LongPrototype.lt = LongPrototype.lessThan;
40503
40504 /**
40505 * Tests if this Long's value is less than or equal the specified's.
40506 * @param {!Long|number|string} other Other value
40507 * @returns {boolean}
40508 */
40509 LongPrototype.lessThanOrEqual = function lessThanOrEqual(other) {
40510 return this.comp(/* validates */ other) <= 0;
40511 };
40512
40513 /**
40514 * Tests if this Long's value is less than or equal the specified's. This is an alias of {@link Long#lessThanOrEqual}.
40515 * @function
40516 * @param {!Long|number|string} other Other value
40517 * @returns {boolean}
40518 */
40519 LongPrototype.lte = LongPrototype.lessThanOrEqual;
40520
40521 /**
40522 * Tests if this Long's value is greater than the specified's.
40523 * @param {!Long|number|string} other Other value
40524 * @returns {boolean}
40525 */
40526 LongPrototype.greaterThan = function greaterThan(other) {
40527 return this.comp(/* validates */ other) > 0;
40528 };
40529
40530 /**
40531 * Tests if this Long's value is greater than the specified's. This is an alias of {@link Long#greaterThan}.
40532 * @function
40533 * @param {!Long|number|string} other Other value
40534 * @returns {boolean}
40535 */
40536 LongPrototype.gt = LongPrototype.greaterThan;
40537
40538 /**
40539 * Tests if this Long's value is greater than or equal the specified's.
40540 * @param {!Long|number|string} other Other value
40541 * @returns {boolean}
40542 */
40543 LongPrototype.greaterThanOrEqual = function greaterThanOrEqual(other) {
40544 return this.comp(/* validates */ other) >= 0;
40545 };
40546
40547 /**
40548 * Tests if this Long's value is greater than or equal the specified's. This is an alias of {@link Long#greaterThanOrEqual}.
40549 * @function
40550 * @param {!Long|number|string} other Other value
40551 * @returns {boolean}
40552 */
40553 LongPrototype.gte = LongPrototype.greaterThanOrEqual;
40554
40555 /**
40556 * Compares this Long's value with the specified's.
40557 * @param {!Long|number|string} other Other value
40558 * @returns {number} 0 if they are the same, 1 if the this is greater and -1
40559 * if the given one is greater
40560 */
40561 LongPrototype.compare = function compare(other) {
40562 if (!isLong(other))
40563 other = fromValue(other);
40564 if (this.eq(other))
40565 return 0;
40566 var thisNeg = this.isNegative(),
40567 otherNeg = other.isNegative();
40568 if (thisNeg && !otherNeg)
40569 return -1;
40570 if (!thisNeg && otherNeg)
40571 return 1;
40572 // At this point the sign bits are the same
40573 if (!this.unsigned)
40574 return this.sub(other).isNegative() ? -1 : 1;
40575 // Both are positive if at least one is unsigned
40576 return (other.high >>> 0) > (this.high >>> 0) || (other.high === this.high && (other.low >>> 0) > (this.low >>> 0)) ? -1 : 1;
40577 };
40578
40579 /**
40580 * Compares this Long's value with the specified's. This is an alias of {@link Long#compare}.
40581 * @function
40582 * @param {!Long|number|string} other Other value
40583 * @returns {number} 0 if they are the same, 1 if the this is greater and -1
40584 * if the given one is greater
40585 */
40586 LongPrototype.comp = LongPrototype.compare;
40587
40588 /**
40589 * Negates this Long's value.
40590 * @returns {!Long} Negated Long
40591 */
40592 LongPrototype.negate = function negate() {
40593 if (!this.unsigned && this.eq(MIN_VALUE))
40594 return MIN_VALUE;
40595 return this.not().add(ONE);
40596 };
40597
40598 /**
40599 * Negates this Long's value. This is an alias of {@link Long#negate}.
40600 * @function
40601 * @returns {!Long} Negated Long
40602 */
40603 LongPrototype.neg = LongPrototype.negate;
40604
40605 /**
40606 * Returns the sum of this and the specified Long.
40607 * @param {!Long|number|string} addend Addend
40608 * @returns {!Long} Sum
40609 */
40610 LongPrototype.add = function add(addend) {
40611 if (!isLong(addend))
40612 addend = fromValue(addend);
40613
40614 // Divide each number into 4 chunks of 16 bits, and then sum the chunks.
40615
40616 var a48 = this.high >>> 16;
40617 var a32 = this.high & 0xFFFF;
40618 var a16 = this.low >>> 16;
40619 var a00 = this.low & 0xFFFF;
40620
40621 var b48 = addend.high >>> 16;
40622 var b32 = addend.high & 0xFFFF;
40623 var b16 = addend.low >>> 16;
40624 var b00 = addend.low & 0xFFFF;
40625
40626 var c48 = 0, c32 = 0, c16 = 0, c00 = 0;
40627 c00 += a00 + b00;
40628 c16 += c00 >>> 16;
40629 c00 &= 0xFFFF;
40630 c16 += a16 + b16;
40631 c32 += c16 >>> 16;
40632 c16 &= 0xFFFF;
40633 c32 += a32 + b32;
40634 c48 += c32 >>> 16;
40635 c32 &= 0xFFFF;
40636 c48 += a48 + b48;
40637 c48 &= 0xFFFF;
40638 return fromBits((c16 << 16) | c00, (c48 << 16) | c32, this.unsigned);
40639 };
40640
40641 /**
40642 * Returns the difference of this and the specified Long.
40643 * @param {!Long|number|string} subtrahend Subtrahend
40644 * @returns {!Long} Difference
40645 */
40646 LongPrototype.subtract = function subtract(subtrahend) {
40647 if (!isLong(subtrahend))
40648 subtrahend = fromValue(subtrahend);
40649 return this.add(subtrahend.neg());
40650 };
40651
40652 /**
40653 * Returns the difference of this and the specified Long. This is an alias of {@link Long#subtract}.
40654 * @function
40655 * @param {!Long|number|string} subtrahend Subtrahend
40656 * @returns {!Long} Difference
40657 */
40658 LongPrototype.sub = LongPrototype.subtract;
40659
40660 /**
40661 * Returns the product of this and the specified Long.
40662 * @param {!Long|number|string} multiplier Multiplier
40663 * @returns {!Long} Product
40664 */
40665 LongPrototype.multiply = function multiply(multiplier) {
40666 if (this.isZero())
40667 return ZERO;
40668 if (!isLong(multiplier))
40669 multiplier = fromValue(multiplier);
40670 if (multiplier.isZero())
40671 return ZERO;
40672 if (this.eq(MIN_VALUE))
40673 return multiplier.isOdd() ? MIN_VALUE : ZERO;
40674 if (multiplier.eq(MIN_VALUE))
40675 return this.isOdd() ? MIN_VALUE : ZERO;
40676
40677 if (this.isNegative()) {
40678 if (multiplier.isNegative())
40679 return this.neg().mul(multiplier.neg());
40680 else
40681 return this.neg().mul(multiplier).neg();
40682 } else if (multiplier.isNegative())
40683 return this.mul(multiplier.neg()).neg();
40684
40685 // If both longs are small, use float multiplication
40686 if (this.lt(TWO_PWR_24) && multiplier.lt(TWO_PWR_24))
40687 return fromNumber(this.toNumber() * multiplier.toNumber(), this.unsigned);
40688
40689 // Divide each long into 4 chunks of 16 bits, and then add up 4x4 products.
40690 // We can skip products that would overflow.
40691
40692 var a48 = this.high >>> 16;
40693 var a32 = this.high & 0xFFFF;
40694 var a16 = this.low >>> 16;
40695 var a00 = this.low & 0xFFFF;
40696
40697 var b48 = multiplier.high >>> 16;
40698 var b32 = multiplier.high & 0xFFFF;
40699 var b16 = multiplier.low >>> 16;
40700 var b00 = multiplier.low & 0xFFFF;
40701
40702 var c48 = 0, c32 = 0, c16 = 0, c00 = 0;
40703 c00 += a00 * b00;
40704 c16 += c00 >>> 16;
40705 c00 &= 0xFFFF;
40706 c16 += a16 * b00;
40707 c32 += c16 >>> 16;
40708 c16 &= 0xFFFF;
40709 c16 += a00 * b16;
40710 c32 += c16 >>> 16;
40711 c16 &= 0xFFFF;
40712 c32 += a32 * b00;
40713 c48 += c32 >>> 16;
40714 c32 &= 0xFFFF;
40715 c32 += a16 * b16;
40716 c48 += c32 >>> 16;
40717 c32 &= 0xFFFF;
40718 c32 += a00 * b32;
40719 c48 += c32 >>> 16;
40720 c32 &= 0xFFFF;
40721 c48 += a48 * b00 + a32 * b16 + a16 * b32 + a00 * b48;
40722 c48 &= 0xFFFF;
40723 return fromBits((c16 << 16) | c00, (c48 << 16) | c32, this.unsigned);
40724 };
40725
40726 /**
40727 * Returns the product of this and the specified Long. This is an alias of {@link Long#multiply}.
40728 * @function
40729 * @param {!Long|number|string} multiplier Multiplier
40730 * @returns {!Long} Product
40731 */
40732 LongPrototype.mul = LongPrototype.multiply;
40733
40734 /**
40735 * Returns this Long divided by the specified. The result is signed if this Long is signed or
40736 * unsigned if this Long is unsigned.
40737 * @param {!Long|number|string} divisor Divisor
40738 * @returns {!Long} Quotient
40739 */
40740 LongPrototype.divide = function divide(divisor) {
40741 if (!isLong(divisor))
40742 divisor = fromValue(divisor);
40743 if (divisor.isZero())
40744 throw Error('division by zero');
40745 if (this.isZero())
40746 return this.unsigned ? UZERO : ZERO;
40747 var approx, rem, res;
40748 if (!this.unsigned) {
40749 // This section is only relevant for signed longs and is derived from the
40750 // closure library as a whole.
40751 if (this.eq(MIN_VALUE)) {
40752 if (divisor.eq(ONE) || divisor.eq(NEG_ONE))
40753 return MIN_VALUE; // recall that -MIN_VALUE == MIN_VALUE
40754 else if (divisor.eq(MIN_VALUE))
40755 return ONE;
40756 else {
40757 // At this point, we have |other| >= 2, so |this/other| < |MIN_VALUE|.
40758 var halfThis = this.shr(1);
40759 approx = halfThis.div(divisor).shl(1);
40760 if (approx.eq(ZERO)) {
40761 return divisor.isNegative() ? ONE : NEG_ONE;
40762 } else {
40763 rem = this.sub(divisor.mul(approx));
40764 res = approx.add(rem.div(divisor));
40765 return res;
40766 }
40767 }
40768 } else if (divisor.eq(MIN_VALUE))
40769 return this.unsigned ? UZERO : ZERO;
40770 if (this.isNegative()) {
40771 if (divisor.isNegative())
40772 return this.neg().div(divisor.neg());
40773 return this.neg().div(divisor).neg();
40774 } else if (divisor.isNegative())
40775 return this.div(divisor.neg()).neg();
40776 res = ZERO;
40777 } else {
40778 // The algorithm below has not been made for unsigned longs. It's therefore
40779 // required to take special care of the MSB prior to running it.
40780 if (!divisor.unsigned)
40781 divisor = divisor.toUnsigned();
40782 if (divisor.gt(this))
40783 return UZERO;
40784 if (divisor.gt(this.shru(1))) // 15 >>> 1 = 7 ; with divisor = 8 ; true
40785 return UONE;
40786 res = UZERO;
40787 }
40788
40789 // Repeat the following until the remainder is less than other: find a
40790 // floating-point that approximates remainder / other *from below*, add this
40791 // into the result, and subtract it from the remainder. It is critical that
40792 // the approximate value is less than or equal to the real value so that the
40793 // remainder never becomes negative.
40794 rem = this;
40795 while (rem.gte(divisor)) {
40796 // Approximate the result of division. This may be a little greater or
40797 // smaller than the actual value.
40798 approx = Math.max(1, Math.floor(rem.toNumber() / divisor.toNumber()));
40799
40800 // We will tweak the approximate result by changing it in the 48-th digit or
40801 // the smallest non-fractional digit, whichever is larger.
40802 var log2 = Math.ceil(Math.log(approx) / Math.LN2),
40803 delta = (log2 <= 48) ? 1 : pow_dbl(2, log2 - 48),
40804
40805 // Decrease the approximation until it is smaller than the remainder. Note
40806 // that if it is too large, the product overflows and is negative.
40807 approxRes = fromNumber(approx),
40808 approxRem = approxRes.mul(divisor);
40809 while (approxRem.isNegative() || approxRem.gt(rem)) {
40810 approx -= delta;
40811 approxRes = fromNumber(approx, this.unsigned);
40812 approxRem = approxRes.mul(divisor);
40813 }
40814
40815 // We know the answer can't be zero... and actually, zero would cause
40816 // infinite recursion since we would make no progress.
40817 if (approxRes.isZero())
40818 approxRes = ONE;
40819
40820 res = res.add(approxRes);
40821 rem = rem.sub(approxRem);
40822 }
40823 return res;
40824 };
40825
40826 /**
40827 * Returns this Long divided by the specified. This is an alias of {@link Long#divide}.
40828 * @function
40829 * @param {!Long|number|string} divisor Divisor
40830 * @returns {!Long} Quotient
40831 */
40832 LongPrototype.div = LongPrototype.divide;
40833
40834 /**
40835 * Returns this Long modulo the specified.
40836 * @param {!Long|number|string} divisor Divisor
40837 * @returns {!Long} Remainder
40838 */
40839 LongPrototype.modulo = function modulo(divisor) {
40840 if (!isLong(divisor))
40841 divisor = fromValue(divisor);
40842 return this.sub(this.div(divisor).mul(divisor));
40843 };
40844
40845 /**
40846 * Returns this Long modulo the specified. This is an alias of {@link Long#modulo}.
40847 * @function
40848 * @param {!Long|number|string} divisor Divisor
40849 * @returns {!Long} Remainder
40850 */
40851 LongPrototype.mod = LongPrototype.modulo;
40852
40853 /**
40854 * Returns the bitwise NOT of this Long.
40855 * @returns {!Long}
40856 */
40857 LongPrototype.not = function not() {
40858 return fromBits(~this.low, ~this.high, this.unsigned);
40859 };
40860
40861 /**
40862 * Returns the bitwise AND of this Long and the specified.
40863 * @param {!Long|number|string} other Other Long
40864 * @returns {!Long}
40865 */
40866 LongPrototype.and = function and(other) {
40867 if (!isLong(other))
40868 other = fromValue(other);
40869 return fromBits(this.low & other.low, this.high & other.high, this.unsigned);
40870 };
40871
40872 /**
40873 * Returns the bitwise OR of this Long and the specified.
40874 * @param {!Long|number|string} other Other Long
40875 * @returns {!Long}
40876 */
40877 LongPrototype.or = function or(other) {
40878 if (!isLong(other))
40879 other = fromValue(other);
40880 return fromBits(this.low | other.low, this.high | other.high, this.unsigned);
40881 };
40882
40883 /**
40884 * Returns the bitwise XOR of this Long and the given one.
40885 * @param {!Long|number|string} other Other Long
40886 * @returns {!Long}
40887 */
40888 LongPrototype.xor = function xor(other) {
40889 if (!isLong(other))
40890 other = fromValue(other);
40891 return fromBits(this.low ^ other.low, this.high ^ other.high, this.unsigned);
40892 };
40893
40894 /**
40895 * Returns this Long with bits shifted to the left by the given amount.
40896 * @param {number|!Long} numBits Number of bits
40897 * @returns {!Long} Shifted Long
40898 */
40899 LongPrototype.shiftLeft = function shiftLeft(numBits) {
40900 if (isLong(numBits))
40901 numBits = numBits.toInt();
40902 if ((numBits &= 63) === 0)
40903 return this;
40904 else if (numBits < 32)
40905 return fromBits(this.low << numBits, (this.high << numBits) | (this.low >>> (32 - numBits)), this.unsigned);
40906 else
40907 return fromBits(0, this.low << (numBits - 32), this.unsigned);
40908 };
40909
40910 /**
40911 * Returns this Long with bits shifted to the left by the given amount. This is an alias of {@link Long#shiftLeft}.
40912 * @function
40913 * @param {number|!Long} numBits Number of bits
40914 * @returns {!Long} Shifted Long
40915 */
40916 LongPrototype.shl = LongPrototype.shiftLeft;
40917
40918 /**
40919 * Returns this Long with bits arithmetically shifted to the right by the given amount.
40920 * @param {number|!Long} numBits Number of bits
40921 * @returns {!Long} Shifted Long
40922 */
40923 LongPrototype.shiftRight = function shiftRight(numBits) {
40924 if (isLong(numBits))
40925 numBits = numBits.toInt();
40926 if ((numBits &= 63) === 0)
40927 return this;
40928 else if (numBits < 32)
40929 return fromBits((this.low >>> numBits) | (this.high << (32 - numBits)), this.high >> numBits, this.unsigned);
40930 else
40931 return fromBits(this.high >> (numBits - 32), this.high >= 0 ? 0 : -1, this.unsigned);
40932 };
40933
40934 /**
40935 * Returns this Long with bits arithmetically shifted to the right by the given amount. This is an alias of {@link Long#shiftRight}.
40936 * @function
40937 * @param {number|!Long} numBits Number of bits
40938 * @returns {!Long} Shifted Long
40939 */
40940 LongPrototype.shr = LongPrototype.shiftRight;
40941
40942 /**
40943 * Returns this Long with bits logically shifted to the right by the given amount.
40944 * @param {number|!Long} numBits Number of bits
40945 * @returns {!Long} Shifted Long
40946 */
40947 LongPrototype.shiftRightUnsigned = function shiftRightUnsigned(numBits) {
40948 if (isLong(numBits))
40949 numBits = numBits.toInt();
40950 numBits &= 63;
40951 if (numBits === 0)
40952 return this;
40953 else {
40954 var high = this.high;
40955 if (numBits < 32) {
40956 var low = this.low;
40957 return fromBits((low >>> numBits) | (high << (32 - numBits)), high >>> numBits, this.unsigned);
40958 } else if (numBits === 32)
40959 return fromBits(high, 0, this.unsigned);
40960 else
40961 return fromBits(high >>> (numBits - 32), 0, this.unsigned);
40962 }
40963 };
40964
40965 /**
40966 * Returns this Long with bits logically shifted to the right by the given amount. This is an alias of {@link Long#shiftRightUnsigned}.
40967 * @function
40968 * @param {number|!Long} numBits Number of bits
40969 * @returns {!Long} Shifted Long
40970 */
40971 LongPrototype.shru = LongPrototype.shiftRightUnsigned;
40972
40973 /**
40974 * Converts this Long to signed.
40975 * @returns {!Long} Signed long
40976 */
40977 LongPrototype.toSigned = function toSigned() {
40978 if (!this.unsigned)
40979 return this;
40980 return fromBits(this.low, this.high, false);
40981 };
40982
40983 /**
40984 * Converts this Long to unsigned.
40985 * @returns {!Long} Unsigned long
40986 */
40987 LongPrototype.toUnsigned = function toUnsigned() {
40988 if (this.unsigned)
40989 return this;
40990 return fromBits(this.low, this.high, true);
40991 };
40992
40993 /**
40994 * Converts this Long to its byte representation.
40995 * @param {boolean=} le Whether little or big endian, defaults to big endian
40996 * @returns {!Array.<number>} Byte representation
40997 */
40998 LongPrototype.toBytes = function(le) {
40999 return le ? this.toBytesLE() : this.toBytesBE();
41000 }
41001
41002 /**
41003 * Converts this Long to its little endian byte representation.
41004 * @returns {!Array.<number>} Little endian byte representation
41005 */
41006 LongPrototype.toBytesLE = function() {
41007 var hi = this.high,
41008 lo = this.low;
41009 return [
41010 lo & 0xff,
41011 (lo >>> 8) & 0xff,
41012 (lo >>> 16) & 0xff,
41013 (lo >>> 24) & 0xff,
41014 hi & 0xff,
41015 (hi >>> 8) & 0xff,
41016 (hi >>> 16) & 0xff,
41017 (hi >>> 24) & 0xff
41018 ];
41019 }
41020
41021 /**
41022 * Converts this Long to its big endian byte representation.
41023 * @returns {!Array.<number>} Big endian byte representation
41024 */
41025 LongPrototype.toBytesBE = function() {
41026 var hi = this.high,
41027 lo = this.low;
41028 return [
41029 (hi >>> 24) & 0xff,
41030 (hi >>> 16) & 0xff,
41031 (hi >>> 8) & 0xff,
41032 hi & 0xff,
41033 (lo >>> 24) & 0xff,
41034 (lo >>> 16) & 0xff,
41035 (lo >>> 8) & 0xff,
41036 lo & 0xff
41037 ];
41038 }
41039
41040 return Long;
41041});
41042
41043
41044/***/ }),
41045/* 617 */
41046/***/ (function(module, exports) {
41047
41048/* (ignored) */
41049
41050/***/ }),
41051/* 618 */
41052/***/ (function(module, exports, __webpack_require__) {
41053
41054"use strict";
41055
41056
41057var _interopRequireDefault = __webpack_require__(1);
41058
41059var _slice = _interopRequireDefault(__webpack_require__(61));
41060
41061var _getOwnPropertySymbols = _interopRequireDefault(__webpack_require__(154));
41062
41063var _concat = _interopRequireDefault(__webpack_require__(22));
41064
41065var has = Object.prototype.hasOwnProperty,
41066 prefix = '~';
41067/**
41068 * Constructor to create a storage for our `EE` objects.
41069 * An `Events` instance is a plain object whose properties are event names.
41070 *
41071 * @constructor
41072 * @private
41073 */
41074
41075function Events() {} //
41076// We try to not inherit from `Object.prototype`. In some engines creating an
41077// instance in this way is faster than calling `Object.create(null)` directly.
41078// If `Object.create(null)` is not supported we prefix the event names with a
41079// character to make sure that the built-in object properties are not
41080// overridden or used as an attack vector.
41081//
41082
41083
41084if (Object.create) {
41085 Events.prototype = Object.create(null); //
41086 // This hack is needed because the `__proto__` property is still inherited in
41087 // some old browsers like Android 4, iPhone 5.1, Opera 11 and Safari 5.
41088 //
41089
41090 if (!new Events().__proto__) prefix = false;
41091}
41092/**
41093 * Representation of a single event listener.
41094 *
41095 * @param {Function} fn The listener function.
41096 * @param {*} context The context to invoke the listener with.
41097 * @param {Boolean} [once=false] Specify if the listener is a one-time listener.
41098 * @constructor
41099 * @private
41100 */
41101
41102
41103function EE(fn, context, once) {
41104 this.fn = fn;
41105 this.context = context;
41106 this.once = once || false;
41107}
41108/**
41109 * Add a listener for a given event.
41110 *
41111 * @param {EventEmitter} emitter Reference to the `EventEmitter` instance.
41112 * @param {(String|Symbol)} event The event name.
41113 * @param {Function} fn The listener function.
41114 * @param {*} context The context to invoke the listener with.
41115 * @param {Boolean} once Specify if the listener is a one-time listener.
41116 * @returns {EventEmitter}
41117 * @private
41118 */
41119
41120
41121function addListener(emitter, event, fn, context, once) {
41122 if (typeof fn !== 'function') {
41123 throw new TypeError('The listener must be a function');
41124 }
41125
41126 var listener = new EE(fn, context || emitter, once),
41127 evt = prefix ? prefix + event : event;
41128 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];
41129 return emitter;
41130}
41131/**
41132 * Clear event by name.
41133 *
41134 * @param {EventEmitter} emitter Reference to the `EventEmitter` instance.
41135 * @param {(String|Symbol)} evt The Event name.
41136 * @private
41137 */
41138
41139
41140function clearEvent(emitter, evt) {
41141 if (--emitter._eventsCount === 0) emitter._events = new Events();else delete emitter._events[evt];
41142}
41143/**
41144 * Minimal `EventEmitter` interface that is molded against the Node.js
41145 * `EventEmitter` interface.
41146 *
41147 * @constructor
41148 * @public
41149 */
41150
41151
41152function EventEmitter() {
41153 this._events = new Events();
41154 this._eventsCount = 0;
41155}
41156/**
41157 * Return an array listing the events for which the emitter has registered
41158 * listeners.
41159 *
41160 * @returns {Array}
41161 * @public
41162 */
41163
41164
41165EventEmitter.prototype.eventNames = function eventNames() {
41166 var names = [],
41167 events,
41168 name;
41169 if (this._eventsCount === 0) return names;
41170
41171 for (name in events = this._events) {
41172 if (has.call(events, name)) names.push(prefix ? (0, _slice.default)(name).call(name, 1) : name);
41173 }
41174
41175 if (_getOwnPropertySymbols.default) {
41176 return (0, _concat.default)(names).call(names, (0, _getOwnPropertySymbols.default)(events));
41177 }
41178
41179 return names;
41180};
41181/**
41182 * Return the listeners registered for a given event.
41183 *
41184 * @param {(String|Symbol)} event The event name.
41185 * @returns {Array} The registered listeners.
41186 * @public
41187 */
41188
41189
41190EventEmitter.prototype.listeners = function listeners(event) {
41191 var evt = prefix ? prefix + event : event,
41192 handlers = this._events[evt];
41193 if (!handlers) return [];
41194 if (handlers.fn) return [handlers.fn];
41195
41196 for (var i = 0, l = handlers.length, ee = new Array(l); i < l; i++) {
41197 ee[i] = handlers[i].fn;
41198 }
41199
41200 return ee;
41201};
41202/**
41203 * Return the number of listeners listening to a given event.
41204 *
41205 * @param {(String|Symbol)} event The event name.
41206 * @returns {Number} The number of listeners.
41207 * @public
41208 */
41209
41210
41211EventEmitter.prototype.listenerCount = function listenerCount(event) {
41212 var evt = prefix ? prefix + event : event,
41213 listeners = this._events[evt];
41214 if (!listeners) return 0;
41215 if (listeners.fn) return 1;
41216 return listeners.length;
41217};
41218/**
41219 * Calls each of the listeners registered for a given event.
41220 *
41221 * @param {(String|Symbol)} event The event name.
41222 * @returns {Boolean} `true` if the event had listeners, else `false`.
41223 * @public
41224 */
41225
41226
41227EventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {
41228 var evt = prefix ? prefix + event : event;
41229 if (!this._events[evt]) return false;
41230 var listeners = this._events[evt],
41231 len = arguments.length,
41232 args,
41233 i;
41234
41235 if (listeners.fn) {
41236 if (listeners.once) this.removeListener(event, listeners.fn, undefined, true);
41237
41238 switch (len) {
41239 case 1:
41240 return listeners.fn.call(listeners.context), true;
41241
41242 case 2:
41243 return listeners.fn.call(listeners.context, a1), true;
41244
41245 case 3:
41246 return listeners.fn.call(listeners.context, a1, a2), true;
41247
41248 case 4:
41249 return listeners.fn.call(listeners.context, a1, a2, a3), true;
41250
41251 case 5:
41252 return listeners.fn.call(listeners.context, a1, a2, a3, a4), true;
41253
41254 case 6:
41255 return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true;
41256 }
41257
41258 for (i = 1, args = new Array(len - 1); i < len; i++) {
41259 args[i - 1] = arguments[i];
41260 }
41261
41262 listeners.fn.apply(listeners.context, args);
41263 } else {
41264 var length = listeners.length,
41265 j;
41266
41267 for (i = 0; i < length; i++) {
41268 if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true);
41269
41270 switch (len) {
41271 case 1:
41272 listeners[i].fn.call(listeners[i].context);
41273 break;
41274
41275 case 2:
41276 listeners[i].fn.call(listeners[i].context, a1);
41277 break;
41278
41279 case 3:
41280 listeners[i].fn.call(listeners[i].context, a1, a2);
41281 break;
41282
41283 case 4:
41284 listeners[i].fn.call(listeners[i].context, a1, a2, a3);
41285 break;
41286
41287 default:
41288 if (!args) for (j = 1, args = new Array(len - 1); j < len; j++) {
41289 args[j - 1] = arguments[j];
41290 }
41291 listeners[i].fn.apply(listeners[i].context, args);
41292 }
41293 }
41294 }
41295
41296 return true;
41297};
41298/**
41299 * Add a listener for a given event.
41300 *
41301 * @param {(String|Symbol)} event The event name.
41302 * @param {Function} fn The listener function.
41303 * @param {*} [context=this] The context to invoke the listener with.
41304 * @returns {EventEmitter} `this`.
41305 * @public
41306 */
41307
41308
41309EventEmitter.prototype.on = function on(event, fn, context) {
41310 return addListener(this, event, fn, context, false);
41311};
41312/**
41313 * Add a one-time listener for a given event.
41314 *
41315 * @param {(String|Symbol)} event The event name.
41316 * @param {Function} fn The listener function.
41317 * @param {*} [context=this] The context to invoke the listener with.
41318 * @returns {EventEmitter} `this`.
41319 * @public
41320 */
41321
41322
41323EventEmitter.prototype.once = function once(event, fn, context) {
41324 return addListener(this, event, fn, context, true);
41325};
41326/**
41327 * Remove the listeners of a given event.
41328 *
41329 * @param {(String|Symbol)} event The event name.
41330 * @param {Function} fn Only remove the listeners that match this function.
41331 * @param {*} context Only remove the listeners that have this context.
41332 * @param {Boolean} once Only remove one-time listeners.
41333 * @returns {EventEmitter} `this`.
41334 * @public
41335 */
41336
41337
41338EventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) {
41339 var evt = prefix ? prefix + event : event;
41340 if (!this._events[evt]) return this;
41341
41342 if (!fn) {
41343 clearEvent(this, evt);
41344 return this;
41345 }
41346
41347 var listeners = this._events[evt];
41348
41349 if (listeners.fn) {
41350 if (listeners.fn === fn && (!once || listeners.once) && (!context || listeners.context === context)) {
41351 clearEvent(this, evt);
41352 }
41353 } else {
41354 for (var i = 0, events = [], length = listeners.length; i < length; i++) {
41355 if (listeners[i].fn !== fn || once && !listeners[i].once || context && listeners[i].context !== context) {
41356 events.push(listeners[i]);
41357 }
41358 } //
41359 // Reset the array, or remove it completely if we have no more listeners.
41360 //
41361
41362
41363 if (events.length) this._events[evt] = events.length === 1 ? events[0] : events;else clearEvent(this, evt);
41364 }
41365
41366 return this;
41367};
41368/**
41369 * Remove all listeners, or those of the specified event.
41370 *
41371 * @param {(String|Symbol)} [event] The event name.
41372 * @returns {EventEmitter} `this`.
41373 * @public
41374 */
41375
41376
41377EventEmitter.prototype.removeAllListeners = function removeAllListeners(event) {
41378 var evt;
41379
41380 if (event) {
41381 evt = prefix ? prefix + event : event;
41382 if (this._events[evt]) clearEvent(this, evt);
41383 } else {
41384 this._events = new Events();
41385 this._eventsCount = 0;
41386 }
41387
41388 return this;
41389}; //
41390// Alias methods names because people roll like that.
41391//
41392
41393
41394EventEmitter.prototype.off = EventEmitter.prototype.removeListener;
41395EventEmitter.prototype.addListener = EventEmitter.prototype.on; //
41396// Expose the prefix.
41397//
41398
41399EventEmitter.prefixed = prefix; //
41400// Allow `EventEmitter` to be imported as module namespace.
41401//
41402
41403EventEmitter.EventEmitter = EventEmitter; //
41404// Expose the module.
41405//
41406
41407if (true) {
41408 module.exports = EventEmitter;
41409}
41410
41411/***/ }),
41412/* 619 */
41413/***/ (function(module, exports) {
41414
41415function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
41416 try {
41417 var info = gen[key](arg);
41418 var value = info.value;
41419 } catch (error) {
41420 reject(error);
41421 return;
41422 }
41423 if (info.done) {
41424 resolve(value);
41425 } else {
41426 Promise.resolve(value).then(_next, _throw);
41427 }
41428}
41429function _asyncToGenerator(fn) {
41430 return function () {
41431 var self = this,
41432 args = arguments;
41433 return new Promise(function (resolve, reject) {
41434 var gen = fn.apply(self, args);
41435 function _next(value) {
41436 asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
41437 }
41438 function _throw(err) {
41439 asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
41440 }
41441 _next(undefined);
41442 });
41443 };
41444}
41445module.exports = _asyncToGenerator, module.exports.__esModule = true, module.exports["default"] = module.exports;
41446
41447/***/ }),
41448/* 620 */
41449/***/ (function(module, exports, __webpack_require__) {
41450
41451var arrayWithoutHoles = __webpack_require__(621);
41452var iterableToArray = __webpack_require__(267);
41453var unsupportedIterableToArray = __webpack_require__(268);
41454var nonIterableSpread = __webpack_require__(622);
41455function _toConsumableArray(arr) {
41456 return arrayWithoutHoles(arr) || iterableToArray(arr) || unsupportedIterableToArray(arr) || nonIterableSpread();
41457}
41458module.exports = _toConsumableArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
41459
41460/***/ }),
41461/* 621 */
41462/***/ (function(module, exports, __webpack_require__) {
41463
41464var arrayLikeToArray = __webpack_require__(266);
41465function _arrayWithoutHoles(arr) {
41466 if (Array.isArray(arr)) return arrayLikeToArray(arr);
41467}
41468module.exports = _arrayWithoutHoles, module.exports.__esModule = true, module.exports["default"] = module.exports;
41469
41470/***/ }),
41471/* 622 */
41472/***/ (function(module, exports) {
41473
41474function _nonIterableSpread() {
41475 throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
41476}
41477module.exports = _nonIterableSpread, module.exports.__esModule = true, module.exports["default"] = module.exports;
41478
41479/***/ }),
41480/* 623 */
41481/***/ (function(module, exports, __webpack_require__) {
41482
41483var toPropertyKey = __webpack_require__(269);
41484function _defineProperty(obj, key, value) {
41485 key = toPropertyKey(key);
41486 if (key in obj) {
41487 Object.defineProperty(obj, key, {
41488 value: value,
41489 enumerable: true,
41490 configurable: true,
41491 writable: true
41492 });
41493 } else {
41494 obj[key] = value;
41495 }
41496 return obj;
41497}
41498module.exports = _defineProperty, module.exports.__esModule = true, module.exports["default"] = module.exports;
41499
41500/***/ }),
41501/* 624 */
41502/***/ (function(module, exports, __webpack_require__) {
41503
41504var _typeof = __webpack_require__(118)["default"];
41505function _toPrimitive(input, hint) {
41506 if (_typeof(input) !== "object" || input === null) return input;
41507 var prim = input[Symbol.toPrimitive];
41508 if (prim !== undefined) {
41509 var res = prim.call(input, hint || "default");
41510 if (_typeof(res) !== "object") return res;
41511 throw new TypeError("@@toPrimitive must return a primitive value.");
41512 }
41513 return (hint === "string" ? String : Number)(input);
41514}
41515module.exports = _toPrimitive, module.exports.__esModule = true, module.exports["default"] = module.exports;
41516
41517/***/ }),
41518/* 625 */
41519/***/ (function(module, exports, __webpack_require__) {
41520
41521var objectWithoutPropertiesLoose = __webpack_require__(626);
41522function _objectWithoutProperties(source, excluded) {
41523 if (source == null) return {};
41524 var target = objectWithoutPropertiesLoose(source, excluded);
41525 var key, i;
41526 if (Object.getOwnPropertySymbols) {
41527 var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
41528 for (i = 0; i < sourceSymbolKeys.length; i++) {
41529 key = sourceSymbolKeys[i];
41530 if (excluded.indexOf(key) >= 0) continue;
41531 if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
41532 target[key] = source[key];
41533 }
41534 }
41535 return target;
41536}
41537module.exports = _objectWithoutProperties, module.exports.__esModule = true, module.exports["default"] = module.exports;
41538
41539/***/ }),
41540/* 626 */
41541/***/ (function(module, exports) {
41542
41543function _objectWithoutPropertiesLoose(source, excluded) {
41544 if (source == null) return {};
41545 var target = {};
41546 var sourceKeys = Object.keys(source);
41547 var key, i;
41548 for (i = 0; i < sourceKeys.length; i++) {
41549 key = sourceKeys[i];
41550 if (excluded.indexOf(key) >= 0) continue;
41551 target[key] = source[key];
41552 }
41553 return target;
41554}
41555module.exports = _objectWithoutPropertiesLoose, module.exports.__esModule = true, module.exports["default"] = module.exports;
41556
41557/***/ }),
41558/* 627 */
41559/***/ (function(module, exports) {
41560
41561function _assertThisInitialized(self) {
41562 if (self === void 0) {
41563 throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
41564 }
41565 return self;
41566}
41567module.exports = _assertThisInitialized, module.exports.__esModule = true, module.exports["default"] = module.exports;
41568
41569/***/ }),
41570/* 628 */
41571/***/ (function(module, exports, __webpack_require__) {
41572
41573var setPrototypeOf = __webpack_require__(629);
41574function _inheritsLoose(subClass, superClass) {
41575 subClass.prototype = Object.create(superClass.prototype);
41576 subClass.prototype.constructor = subClass;
41577 setPrototypeOf(subClass, superClass);
41578}
41579module.exports = _inheritsLoose, module.exports.__esModule = true, module.exports["default"] = module.exports;
41580
41581/***/ }),
41582/* 629 */
41583/***/ (function(module, exports) {
41584
41585function _setPrototypeOf(o, p) {
41586 module.exports = _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
41587 o.__proto__ = p;
41588 return o;
41589 }, module.exports.__esModule = true, module.exports["default"] = module.exports;
41590 return _setPrototypeOf(o, p);
41591}
41592module.exports = _setPrototypeOf, module.exports.__esModule = true, module.exports["default"] = module.exports;
41593
41594/***/ }),
41595/* 630 */
41596/***/ (function(module, exports, __webpack_require__) {
41597
41598// TODO(Babel 8): Remove this file.
41599
41600var runtime = __webpack_require__(631)();
41601module.exports = runtime;
41602
41603// Copied from https://github.com/facebook/regenerator/blob/main/packages/runtime/runtime.js#L736=
41604try {
41605 regeneratorRuntime = runtime;
41606} catch (accidentalStrictMode) {
41607 if (typeof globalThis === "object") {
41608 globalThis.regeneratorRuntime = runtime;
41609 } else {
41610 Function("r", "regeneratorRuntime = r")(runtime);
41611 }
41612}
41613
41614
41615/***/ }),
41616/* 631 */
41617/***/ (function(module, exports, __webpack_require__) {
41618
41619var _typeof = __webpack_require__(118)["default"];
41620function _regeneratorRuntime() {
41621 "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
41622 module.exports = _regeneratorRuntime = function _regeneratorRuntime() {
41623 return e;
41624 }, module.exports.__esModule = true, module.exports["default"] = module.exports;
41625 var t,
41626 e = {},
41627 r = Object.prototype,
41628 n = r.hasOwnProperty,
41629 o = Object.defineProperty || function (t, e, r) {
41630 t[e] = r.value;
41631 },
41632 i = "function" == typeof Symbol ? Symbol : {},
41633 a = i.iterator || "@@iterator",
41634 c = i.asyncIterator || "@@asyncIterator",
41635 u = i.toStringTag || "@@toStringTag";
41636 function define(t, e, r) {
41637 return Object.defineProperty(t, e, {
41638 value: r,
41639 enumerable: !0,
41640 configurable: !0,
41641 writable: !0
41642 }), t[e];
41643 }
41644 try {
41645 define({}, "");
41646 } catch (t) {
41647 define = function define(t, e, r) {
41648 return t[e] = r;
41649 };
41650 }
41651 function wrap(t, e, r, n) {
41652 var i = e && e.prototype instanceof Generator ? e : Generator,
41653 a = Object.create(i.prototype),
41654 c = new Context(n || []);
41655 return o(a, "_invoke", {
41656 value: makeInvokeMethod(t, r, c)
41657 }), a;
41658 }
41659 function tryCatch(t, e, r) {
41660 try {
41661 return {
41662 type: "normal",
41663 arg: t.call(e, r)
41664 };
41665 } catch (t) {
41666 return {
41667 type: "throw",
41668 arg: t
41669 };
41670 }
41671 }
41672 e.wrap = wrap;
41673 var h = "suspendedStart",
41674 l = "suspendedYield",
41675 f = "executing",
41676 s = "completed",
41677 y = {};
41678 function Generator() {}
41679 function GeneratorFunction() {}
41680 function GeneratorFunctionPrototype() {}
41681 var p = {};
41682 define(p, a, function () {
41683 return this;
41684 });
41685 var d = Object.getPrototypeOf,
41686 v = d && d(d(values([])));
41687 v && v !== r && n.call(v, a) && (p = v);
41688 var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p);
41689 function defineIteratorMethods(t) {
41690 ["next", "throw", "return"].forEach(function (e) {
41691 define(t, e, function (t) {
41692 return this._invoke(e, t);
41693 });
41694 });
41695 }
41696 function AsyncIterator(t, e) {
41697 function invoke(r, o, i, a) {
41698 var c = tryCatch(t[r], t, o);
41699 if ("throw" !== c.type) {
41700 var u = c.arg,
41701 h = u.value;
41702 return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) {
41703 invoke("next", t, i, a);
41704 }, function (t) {
41705 invoke("throw", t, i, a);
41706 }) : e.resolve(h).then(function (t) {
41707 u.value = t, i(u);
41708 }, function (t) {
41709 return invoke("throw", t, i, a);
41710 });
41711 }
41712 a(c.arg);
41713 }
41714 var r;
41715 o(this, "_invoke", {
41716 value: function value(t, n) {
41717 function callInvokeWithMethodAndArg() {
41718 return new e(function (e, r) {
41719 invoke(t, n, e, r);
41720 });
41721 }
41722 return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
41723 }
41724 });
41725 }
41726 function makeInvokeMethod(e, r, n) {
41727 var o = h;
41728 return function (i, a) {
41729 if (o === f) throw new Error("Generator is already running");
41730 if (o === s) {
41731 if ("throw" === i) throw a;
41732 return {
41733 value: t,
41734 done: !0
41735 };
41736 }
41737 for (n.method = i, n.arg = a;;) {
41738 var c = n.delegate;
41739 if (c) {
41740 var u = maybeInvokeDelegate(c, n);
41741 if (u) {
41742 if (u === y) continue;
41743 return u;
41744 }
41745 }
41746 if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) {
41747 if (o === h) throw o = s, n.arg;
41748 n.dispatchException(n.arg);
41749 } else "return" === n.method && n.abrupt("return", n.arg);
41750 o = f;
41751 var p = tryCatch(e, r, n);
41752 if ("normal" === p.type) {
41753 if (o = n.done ? s : l, p.arg === y) continue;
41754 return {
41755 value: p.arg,
41756 done: n.done
41757 };
41758 }
41759 "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg);
41760 }
41761 };
41762 }
41763 function maybeInvokeDelegate(e, r) {
41764 var n = r.method,
41765 o = e.iterator[n];
41766 if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y;
41767 var i = tryCatch(o, e.iterator, r.arg);
41768 if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y;
41769 var a = i.arg;
41770 return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y);
41771 }
41772 function pushTryEntry(t) {
41773 var e = {
41774 tryLoc: t[0]
41775 };
41776 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e);
41777 }
41778 function resetTryEntry(t) {
41779 var e = t.completion || {};
41780 e.type = "normal", delete e.arg, t.completion = e;
41781 }
41782 function Context(t) {
41783 this.tryEntries = [{
41784 tryLoc: "root"
41785 }], t.forEach(pushTryEntry, this), this.reset(!0);
41786 }
41787 function values(e) {
41788 if (e || "" === e) {
41789 var r = e[a];
41790 if (r) return r.call(e);
41791 if ("function" == typeof e.next) return e;
41792 if (!isNaN(e.length)) {
41793 var o = -1,
41794 i = function next() {
41795 for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next;
41796 return next.value = t, next.done = !0, next;
41797 };
41798 return i.next = i;
41799 }
41800 }
41801 throw new TypeError(_typeof(e) + " is not iterable");
41802 }
41803 return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", {
41804 value: GeneratorFunctionPrototype,
41805 configurable: !0
41806 }), o(GeneratorFunctionPrototype, "constructor", {
41807 value: GeneratorFunction,
41808 configurable: !0
41809 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) {
41810 var e = "function" == typeof t && t.constructor;
41811 return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name));
41812 }, e.mark = function (t) {
41813 return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t;
41814 }, e.awrap = function (t) {
41815 return {
41816 __await: t
41817 };
41818 }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () {
41819 return this;
41820 }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) {
41821 void 0 === i && (i = Promise);
41822 var a = new AsyncIterator(wrap(t, r, n, o), i);
41823 return e.isGeneratorFunction(r) ? a : a.next().then(function (t) {
41824 return t.done ? t.value : a.next();
41825 });
41826 }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () {
41827 return this;
41828 }), define(g, "toString", function () {
41829 return "[object Generator]";
41830 }), e.keys = function (t) {
41831 var e = Object(t),
41832 r = [];
41833 for (var n in e) r.push(n);
41834 return r.reverse(), function next() {
41835 for (; r.length;) {
41836 var t = r.pop();
41837 if (t in e) return next.value = t, next.done = !1, next;
41838 }
41839 return next.done = !0, next;
41840 };
41841 }, e.values = values, Context.prototype = {
41842 constructor: Context,
41843 reset: function reset(e) {
41844 if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t);
41845 },
41846 stop: function stop() {
41847 this.done = !0;
41848 var t = this.tryEntries[0].completion;
41849 if ("throw" === t.type) throw t.arg;
41850 return this.rval;
41851 },
41852 dispatchException: function dispatchException(e) {
41853 if (this.done) throw e;
41854 var r = this;
41855 function handle(n, o) {
41856 return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o;
41857 }
41858 for (var o = this.tryEntries.length - 1; o >= 0; --o) {
41859 var i = this.tryEntries[o],
41860 a = i.completion;
41861 if ("root" === i.tryLoc) return handle("end");
41862 if (i.tryLoc <= this.prev) {
41863 var c = n.call(i, "catchLoc"),
41864 u = n.call(i, "finallyLoc");
41865 if (c && u) {
41866 if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
41867 if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
41868 } else if (c) {
41869 if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
41870 } else {
41871 if (!u) throw new Error("try statement without catch or finally");
41872 if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
41873 }
41874 }
41875 }
41876 },
41877 abrupt: function abrupt(t, e) {
41878 for (var r = this.tryEntries.length - 1; r >= 0; --r) {
41879 var o = this.tryEntries[r];
41880 if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) {
41881 var i = o;
41882 break;
41883 }
41884 }
41885 i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null);
41886 var a = i ? i.completion : {};
41887 return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a);
41888 },
41889 complete: function complete(t, e) {
41890 if ("throw" === t.type) throw t.arg;
41891 return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y;
41892 },
41893 finish: function finish(t) {
41894 for (var e = this.tryEntries.length - 1; e >= 0; --e) {
41895 var r = this.tryEntries[e];
41896 if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y;
41897 }
41898 },
41899 "catch": function _catch(t) {
41900 for (var e = this.tryEntries.length - 1; e >= 0; --e) {
41901 var r = this.tryEntries[e];
41902 if (r.tryLoc === t) {
41903 var n = r.completion;
41904 if ("throw" === n.type) {
41905 var o = n.arg;
41906 resetTryEntry(r);
41907 }
41908 return o;
41909 }
41910 }
41911 throw new Error("illegal catch attempt");
41912 },
41913 delegateYield: function delegateYield(e, r, n) {
41914 return this.delegate = {
41915 iterator: values(e),
41916 resultName: r,
41917 nextLoc: n
41918 }, "next" === this.method && (this.arg = t), y;
41919 }
41920 }, e;
41921}
41922module.exports = _regeneratorRuntime, module.exports.__esModule = true, module.exports["default"] = module.exports;
41923
41924/***/ }),
41925/* 632 */
41926/***/ (function(module, exports, __webpack_require__) {
41927
41928var arrayShuffle = __webpack_require__(633),
41929 baseShuffle = __webpack_require__(636),
41930 isArray = __webpack_require__(275);
41931
41932/**
41933 * Creates an array of shuffled values, using a version of the
41934 * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle).
41935 *
41936 * @static
41937 * @memberOf _
41938 * @since 0.1.0
41939 * @category Collection
41940 * @param {Array|Object} collection The collection to shuffle.
41941 * @returns {Array} Returns the new shuffled array.
41942 * @example
41943 *
41944 * _.shuffle([1, 2, 3, 4]);
41945 * // => [4, 1, 3, 2]
41946 */
41947function shuffle(collection) {
41948 var func = isArray(collection) ? arrayShuffle : baseShuffle;
41949 return func(collection);
41950}
41951
41952module.exports = shuffle;
41953
41954
41955/***/ }),
41956/* 633 */
41957/***/ (function(module, exports, __webpack_require__) {
41958
41959var copyArray = __webpack_require__(634),
41960 shuffleSelf = __webpack_require__(270);
41961
41962/**
41963 * A specialized version of `_.shuffle` for arrays.
41964 *
41965 * @private
41966 * @param {Array} array The array to shuffle.
41967 * @returns {Array} Returns the new shuffled array.
41968 */
41969function arrayShuffle(array) {
41970 return shuffleSelf(copyArray(array));
41971}
41972
41973module.exports = arrayShuffle;
41974
41975
41976/***/ }),
41977/* 634 */
41978/***/ (function(module, exports) {
41979
41980/**
41981 * Copies the values of `source` to `array`.
41982 *
41983 * @private
41984 * @param {Array} source The array to copy values from.
41985 * @param {Array} [array=[]] The array to copy values to.
41986 * @returns {Array} Returns `array`.
41987 */
41988function copyArray(source, array) {
41989 var index = -1,
41990 length = source.length;
41991
41992 array || (array = Array(length));
41993 while (++index < length) {
41994 array[index] = source[index];
41995 }
41996 return array;
41997}
41998
41999module.exports = copyArray;
42000
42001
42002/***/ }),
42003/* 635 */
42004/***/ (function(module, exports) {
42005
42006/* Built-in method references for those with the same name as other `lodash` methods. */
42007var nativeFloor = Math.floor,
42008 nativeRandom = Math.random;
42009
42010/**
42011 * The base implementation of `_.random` without support for returning
42012 * floating-point numbers.
42013 *
42014 * @private
42015 * @param {number} lower The lower bound.
42016 * @param {number} upper The upper bound.
42017 * @returns {number} Returns the random number.
42018 */
42019function baseRandom(lower, upper) {
42020 return lower + nativeFloor(nativeRandom() * (upper - lower + 1));
42021}
42022
42023module.exports = baseRandom;
42024
42025
42026/***/ }),
42027/* 636 */
42028/***/ (function(module, exports, __webpack_require__) {
42029
42030var shuffleSelf = __webpack_require__(270),
42031 values = __webpack_require__(271);
42032
42033/**
42034 * The base implementation of `_.shuffle`.
42035 *
42036 * @private
42037 * @param {Array|Object} collection The collection to shuffle.
42038 * @returns {Array} Returns the new shuffled array.
42039 */
42040function baseShuffle(collection) {
42041 return shuffleSelf(values(collection));
42042}
42043
42044module.exports = baseShuffle;
42045
42046
42047/***/ }),
42048/* 637 */
42049/***/ (function(module, exports, __webpack_require__) {
42050
42051var arrayMap = __webpack_require__(638);
42052
42053/**
42054 * The base implementation of `_.values` and `_.valuesIn` which creates an
42055 * array of `object` property values corresponding to the property names
42056 * of `props`.
42057 *
42058 * @private
42059 * @param {Object} object The object to query.
42060 * @param {Array} props The property names to get values for.
42061 * @returns {Object} Returns the array of property values.
42062 */
42063function baseValues(object, props) {
42064 return arrayMap(props, function(key) {
42065 return object[key];
42066 });
42067}
42068
42069module.exports = baseValues;
42070
42071
42072/***/ }),
42073/* 638 */
42074/***/ (function(module, exports) {
42075
42076/**
42077 * A specialized version of `_.map` for arrays without support for iteratee
42078 * shorthands.
42079 *
42080 * @private
42081 * @param {Array} [array] The array to iterate over.
42082 * @param {Function} iteratee The function invoked per iteration.
42083 * @returns {Array} Returns the new mapped array.
42084 */
42085function arrayMap(array, iteratee) {
42086 var index = -1,
42087 length = array == null ? 0 : array.length,
42088 result = Array(length);
42089
42090 while (++index < length) {
42091 result[index] = iteratee(array[index], index, array);
42092 }
42093 return result;
42094}
42095
42096module.exports = arrayMap;
42097
42098
42099/***/ }),
42100/* 639 */
42101/***/ (function(module, exports, __webpack_require__) {
42102
42103var arrayLikeKeys = __webpack_require__(640),
42104 baseKeys = __webpack_require__(653),
42105 isArrayLike = __webpack_require__(656);
42106
42107/**
42108 * Creates an array of the own enumerable property names of `object`.
42109 *
42110 * **Note:** Non-object values are coerced to objects. See the
42111 * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
42112 * for more details.
42113 *
42114 * @static
42115 * @since 0.1.0
42116 * @memberOf _
42117 * @category Object
42118 * @param {Object} object The object to query.
42119 * @returns {Array} Returns the array of property names.
42120 * @example
42121 *
42122 * function Foo() {
42123 * this.a = 1;
42124 * this.b = 2;
42125 * }
42126 *
42127 * Foo.prototype.c = 3;
42128 *
42129 * _.keys(new Foo);
42130 * // => ['a', 'b'] (iteration order is not guaranteed)
42131 *
42132 * _.keys('hi');
42133 * // => ['0', '1']
42134 */
42135function keys(object) {
42136 return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
42137}
42138
42139module.exports = keys;
42140
42141
42142/***/ }),
42143/* 640 */
42144/***/ (function(module, exports, __webpack_require__) {
42145
42146var baseTimes = __webpack_require__(641),
42147 isArguments = __webpack_require__(642),
42148 isArray = __webpack_require__(275),
42149 isBuffer = __webpack_require__(646),
42150 isIndex = __webpack_require__(648),
42151 isTypedArray = __webpack_require__(649);
42152
42153/** Used for built-in method references. */
42154var objectProto = Object.prototype;
42155
42156/** Used to check objects for own properties. */
42157var hasOwnProperty = objectProto.hasOwnProperty;
42158
42159/**
42160 * Creates an array of the enumerable property names of the array-like `value`.
42161 *
42162 * @private
42163 * @param {*} value The value to query.
42164 * @param {boolean} inherited Specify returning inherited property names.
42165 * @returns {Array} Returns the array of property names.
42166 */
42167function arrayLikeKeys(value, inherited) {
42168 var isArr = isArray(value),
42169 isArg = !isArr && isArguments(value),
42170 isBuff = !isArr && !isArg && isBuffer(value),
42171 isType = !isArr && !isArg && !isBuff && isTypedArray(value),
42172 skipIndexes = isArr || isArg || isBuff || isType,
42173 result = skipIndexes ? baseTimes(value.length, String) : [],
42174 length = result.length;
42175
42176 for (var key in value) {
42177 if ((inherited || hasOwnProperty.call(value, key)) &&
42178 !(skipIndexes && (
42179 // Safari 9 has enumerable `arguments.length` in strict mode.
42180 key == 'length' ||
42181 // Node.js 0.10 has enumerable non-index properties on buffers.
42182 (isBuff && (key == 'offset' || key == 'parent')) ||
42183 // PhantomJS 2 has enumerable non-index properties on typed arrays.
42184 (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
42185 // Skip index properties.
42186 isIndex(key, length)
42187 ))) {
42188 result.push(key);
42189 }
42190 }
42191 return result;
42192}
42193
42194module.exports = arrayLikeKeys;
42195
42196
42197/***/ }),
42198/* 641 */
42199/***/ (function(module, exports) {
42200
42201/**
42202 * The base implementation of `_.times` without support for iteratee shorthands
42203 * or max array length checks.
42204 *
42205 * @private
42206 * @param {number} n The number of times to invoke `iteratee`.
42207 * @param {Function} iteratee The function invoked per iteration.
42208 * @returns {Array} Returns the array of results.
42209 */
42210function baseTimes(n, iteratee) {
42211 var index = -1,
42212 result = Array(n);
42213
42214 while (++index < n) {
42215 result[index] = iteratee(index);
42216 }
42217 return result;
42218}
42219
42220module.exports = baseTimes;
42221
42222
42223/***/ }),
42224/* 642 */
42225/***/ (function(module, exports, __webpack_require__) {
42226
42227var baseIsArguments = __webpack_require__(643),
42228 isObjectLike = __webpack_require__(120);
42229
42230/** Used for built-in method references. */
42231var objectProto = Object.prototype;
42232
42233/** Used to check objects for own properties. */
42234var hasOwnProperty = objectProto.hasOwnProperty;
42235
42236/** Built-in value references. */
42237var propertyIsEnumerable = objectProto.propertyIsEnumerable;
42238
42239/**
42240 * Checks if `value` is likely an `arguments` object.
42241 *
42242 * @static
42243 * @memberOf _
42244 * @since 0.1.0
42245 * @category Lang
42246 * @param {*} value The value to check.
42247 * @returns {boolean} Returns `true` if `value` is an `arguments` object,
42248 * else `false`.
42249 * @example
42250 *
42251 * _.isArguments(function() { return arguments; }());
42252 * // => true
42253 *
42254 * _.isArguments([1, 2, 3]);
42255 * // => false
42256 */
42257var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
42258 return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&
42259 !propertyIsEnumerable.call(value, 'callee');
42260};
42261
42262module.exports = isArguments;
42263
42264
42265/***/ }),
42266/* 643 */
42267/***/ (function(module, exports, __webpack_require__) {
42268
42269var baseGetTag = __webpack_require__(119),
42270 isObjectLike = __webpack_require__(120);
42271
42272/** `Object#toString` result references. */
42273var argsTag = '[object Arguments]';
42274
42275/**
42276 * The base implementation of `_.isArguments`.
42277 *
42278 * @private
42279 * @param {*} value The value to check.
42280 * @returns {boolean} Returns `true` if `value` is an `arguments` object,
42281 */
42282function baseIsArguments(value) {
42283 return isObjectLike(value) && baseGetTag(value) == argsTag;
42284}
42285
42286module.exports = baseIsArguments;
42287
42288
42289/***/ }),
42290/* 644 */
42291/***/ (function(module, exports, __webpack_require__) {
42292
42293var Symbol = __webpack_require__(272);
42294
42295/** Used for built-in method references. */
42296var objectProto = Object.prototype;
42297
42298/** Used to check objects for own properties. */
42299var hasOwnProperty = objectProto.hasOwnProperty;
42300
42301/**
42302 * Used to resolve the
42303 * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
42304 * of values.
42305 */
42306var nativeObjectToString = objectProto.toString;
42307
42308/** Built-in value references. */
42309var symToStringTag = Symbol ? Symbol.toStringTag : undefined;
42310
42311/**
42312 * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
42313 *
42314 * @private
42315 * @param {*} value The value to query.
42316 * @returns {string} Returns the raw `toStringTag`.
42317 */
42318function getRawTag(value) {
42319 var isOwn = hasOwnProperty.call(value, symToStringTag),
42320 tag = value[symToStringTag];
42321
42322 try {
42323 value[symToStringTag] = undefined;
42324 var unmasked = true;
42325 } catch (e) {}
42326
42327 var result = nativeObjectToString.call(value);
42328 if (unmasked) {
42329 if (isOwn) {
42330 value[symToStringTag] = tag;
42331 } else {
42332 delete value[symToStringTag];
42333 }
42334 }
42335 return result;
42336}
42337
42338module.exports = getRawTag;
42339
42340
42341/***/ }),
42342/* 645 */
42343/***/ (function(module, exports) {
42344
42345/** Used for built-in method references. */
42346var objectProto = Object.prototype;
42347
42348/**
42349 * Used to resolve the
42350 * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
42351 * of values.
42352 */
42353var nativeObjectToString = objectProto.toString;
42354
42355/**
42356 * Converts `value` to a string using `Object.prototype.toString`.
42357 *
42358 * @private
42359 * @param {*} value The value to convert.
42360 * @returns {string} Returns the converted string.
42361 */
42362function objectToString(value) {
42363 return nativeObjectToString.call(value);
42364}
42365
42366module.exports = objectToString;
42367
42368
42369/***/ }),
42370/* 646 */
42371/***/ (function(module, exports, __webpack_require__) {
42372
42373/* WEBPACK VAR INJECTION */(function(module) {var root = __webpack_require__(273),
42374 stubFalse = __webpack_require__(647);
42375
42376/** Detect free variable `exports`. */
42377var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;
42378
42379/** Detect free variable `module`. */
42380var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
42381
42382/** Detect the popular CommonJS extension `module.exports`. */
42383var moduleExports = freeModule && freeModule.exports === freeExports;
42384
42385/** Built-in value references. */
42386var Buffer = moduleExports ? root.Buffer : undefined;
42387
42388/* Built-in method references for those with the same name as other `lodash` methods. */
42389var nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined;
42390
42391/**
42392 * Checks if `value` is a buffer.
42393 *
42394 * @static
42395 * @memberOf _
42396 * @since 4.3.0
42397 * @category Lang
42398 * @param {*} value The value to check.
42399 * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
42400 * @example
42401 *
42402 * _.isBuffer(new Buffer(2));
42403 * // => true
42404 *
42405 * _.isBuffer(new Uint8Array(2));
42406 * // => false
42407 */
42408var isBuffer = nativeIsBuffer || stubFalse;
42409
42410module.exports = isBuffer;
42411
42412/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(276)(module)))
42413
42414/***/ }),
42415/* 647 */
42416/***/ (function(module, exports) {
42417
42418/**
42419 * This method returns `false`.
42420 *
42421 * @static
42422 * @memberOf _
42423 * @since 4.13.0
42424 * @category Util
42425 * @returns {boolean} Returns `false`.
42426 * @example
42427 *
42428 * _.times(2, _.stubFalse);
42429 * // => [false, false]
42430 */
42431function stubFalse() {
42432 return false;
42433}
42434
42435module.exports = stubFalse;
42436
42437
42438/***/ }),
42439/* 648 */
42440/***/ (function(module, exports) {
42441
42442/** Used as references for various `Number` constants. */
42443var MAX_SAFE_INTEGER = 9007199254740991;
42444
42445/** Used to detect unsigned integer values. */
42446var reIsUint = /^(?:0|[1-9]\d*)$/;
42447
42448/**
42449 * Checks if `value` is a valid array-like index.
42450 *
42451 * @private
42452 * @param {*} value The value to check.
42453 * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
42454 * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
42455 */
42456function isIndex(value, length) {
42457 var type = typeof value;
42458 length = length == null ? MAX_SAFE_INTEGER : length;
42459
42460 return !!length &&
42461 (type == 'number' ||
42462 (type != 'symbol' && reIsUint.test(value))) &&
42463 (value > -1 && value % 1 == 0 && value < length);
42464}
42465
42466module.exports = isIndex;
42467
42468
42469/***/ }),
42470/* 649 */
42471/***/ (function(module, exports, __webpack_require__) {
42472
42473var baseIsTypedArray = __webpack_require__(650),
42474 baseUnary = __webpack_require__(651),
42475 nodeUtil = __webpack_require__(652);
42476
42477/* Node.js helper references. */
42478var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
42479
42480/**
42481 * Checks if `value` is classified as a typed array.
42482 *
42483 * @static
42484 * @memberOf _
42485 * @since 3.0.0
42486 * @category Lang
42487 * @param {*} value The value to check.
42488 * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
42489 * @example
42490 *
42491 * _.isTypedArray(new Uint8Array);
42492 * // => true
42493 *
42494 * _.isTypedArray([]);
42495 * // => false
42496 */
42497var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
42498
42499module.exports = isTypedArray;
42500
42501
42502/***/ }),
42503/* 650 */
42504/***/ (function(module, exports, __webpack_require__) {
42505
42506var baseGetTag = __webpack_require__(119),
42507 isLength = __webpack_require__(277),
42508 isObjectLike = __webpack_require__(120);
42509
42510/** `Object#toString` result references. */
42511var argsTag = '[object Arguments]',
42512 arrayTag = '[object Array]',
42513 boolTag = '[object Boolean]',
42514 dateTag = '[object Date]',
42515 errorTag = '[object Error]',
42516 funcTag = '[object Function]',
42517 mapTag = '[object Map]',
42518 numberTag = '[object Number]',
42519 objectTag = '[object Object]',
42520 regexpTag = '[object RegExp]',
42521 setTag = '[object Set]',
42522 stringTag = '[object String]',
42523 weakMapTag = '[object WeakMap]';
42524
42525var arrayBufferTag = '[object ArrayBuffer]',
42526 dataViewTag = '[object DataView]',
42527 float32Tag = '[object Float32Array]',
42528 float64Tag = '[object Float64Array]',
42529 int8Tag = '[object Int8Array]',
42530 int16Tag = '[object Int16Array]',
42531 int32Tag = '[object Int32Array]',
42532 uint8Tag = '[object Uint8Array]',
42533 uint8ClampedTag = '[object Uint8ClampedArray]',
42534 uint16Tag = '[object Uint16Array]',
42535 uint32Tag = '[object Uint32Array]';
42536
42537/** Used to identify `toStringTag` values of typed arrays. */
42538var typedArrayTags = {};
42539typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
42540typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
42541typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
42542typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
42543typedArrayTags[uint32Tag] = true;
42544typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
42545typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
42546typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
42547typedArrayTags[errorTag] = typedArrayTags[funcTag] =
42548typedArrayTags[mapTag] = typedArrayTags[numberTag] =
42549typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
42550typedArrayTags[setTag] = typedArrayTags[stringTag] =
42551typedArrayTags[weakMapTag] = false;
42552
42553/**
42554 * The base implementation of `_.isTypedArray` without Node.js optimizations.
42555 *
42556 * @private
42557 * @param {*} value The value to check.
42558 * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
42559 */
42560function baseIsTypedArray(value) {
42561 return isObjectLike(value) &&
42562 isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
42563}
42564
42565module.exports = baseIsTypedArray;
42566
42567
42568/***/ }),
42569/* 651 */
42570/***/ (function(module, exports) {
42571
42572/**
42573 * The base implementation of `_.unary` without support for storing metadata.
42574 *
42575 * @private
42576 * @param {Function} func The function to cap arguments for.
42577 * @returns {Function} Returns the new capped function.
42578 */
42579function baseUnary(func) {
42580 return function(value) {
42581 return func(value);
42582 };
42583}
42584
42585module.exports = baseUnary;
42586
42587
42588/***/ }),
42589/* 652 */
42590/***/ (function(module, exports, __webpack_require__) {
42591
42592/* WEBPACK VAR INJECTION */(function(module) {var freeGlobal = __webpack_require__(274);
42593
42594/** Detect free variable `exports`. */
42595var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;
42596
42597/** Detect free variable `module`. */
42598var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
42599
42600/** Detect the popular CommonJS extension `module.exports`. */
42601var moduleExports = freeModule && freeModule.exports === freeExports;
42602
42603/** Detect free variable `process` from Node.js. */
42604var freeProcess = moduleExports && freeGlobal.process;
42605
42606/** Used to access faster Node.js helpers. */
42607var nodeUtil = (function() {
42608 try {
42609 // Use `util.types` for Node.js 10+.
42610 var types = freeModule && freeModule.require && freeModule.require('util').types;
42611
42612 if (types) {
42613 return types;
42614 }
42615
42616 // Legacy `process.binding('util')` for Node.js < 10.
42617 return freeProcess && freeProcess.binding && freeProcess.binding('util');
42618 } catch (e) {}
42619}());
42620
42621module.exports = nodeUtil;
42622
42623/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(276)(module)))
42624
42625/***/ }),
42626/* 653 */
42627/***/ (function(module, exports, __webpack_require__) {
42628
42629var isPrototype = __webpack_require__(654),
42630 nativeKeys = __webpack_require__(655);
42631
42632/** Used for built-in method references. */
42633var objectProto = Object.prototype;
42634
42635/** Used to check objects for own properties. */
42636var hasOwnProperty = objectProto.hasOwnProperty;
42637
42638/**
42639 * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
42640 *
42641 * @private
42642 * @param {Object} object The object to query.
42643 * @returns {Array} Returns the array of property names.
42644 */
42645function baseKeys(object) {
42646 if (!isPrototype(object)) {
42647 return nativeKeys(object);
42648 }
42649 var result = [];
42650 for (var key in Object(object)) {
42651 if (hasOwnProperty.call(object, key) && key != 'constructor') {
42652 result.push(key);
42653 }
42654 }
42655 return result;
42656}
42657
42658module.exports = baseKeys;
42659
42660
42661/***/ }),
42662/* 654 */
42663/***/ (function(module, exports) {
42664
42665/** Used for built-in method references. */
42666var objectProto = Object.prototype;
42667
42668/**
42669 * Checks if `value` is likely a prototype object.
42670 *
42671 * @private
42672 * @param {*} value The value to check.
42673 * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
42674 */
42675function isPrototype(value) {
42676 var Ctor = value && value.constructor,
42677 proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
42678
42679 return value === proto;
42680}
42681
42682module.exports = isPrototype;
42683
42684
42685/***/ }),
42686/* 655 */
42687/***/ (function(module, exports, __webpack_require__) {
42688
42689var overArg = __webpack_require__(278);
42690
42691/* Built-in method references for those with the same name as other `lodash` methods. */
42692var nativeKeys = overArg(Object.keys, Object);
42693
42694module.exports = nativeKeys;
42695
42696
42697/***/ }),
42698/* 656 */
42699/***/ (function(module, exports, __webpack_require__) {
42700
42701var isFunction = __webpack_require__(657),
42702 isLength = __webpack_require__(277);
42703
42704/**
42705 * Checks if `value` is array-like. A value is considered array-like if it's
42706 * not a function and has a `value.length` that's an integer greater than or
42707 * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
42708 *
42709 * @static
42710 * @memberOf _
42711 * @since 4.0.0
42712 * @category Lang
42713 * @param {*} value The value to check.
42714 * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
42715 * @example
42716 *
42717 * _.isArrayLike([1, 2, 3]);
42718 * // => true
42719 *
42720 * _.isArrayLike(document.body.children);
42721 * // => true
42722 *
42723 * _.isArrayLike('abc');
42724 * // => true
42725 *
42726 * _.isArrayLike(_.noop);
42727 * // => false
42728 */
42729function isArrayLike(value) {
42730 return value != null && isLength(value.length) && !isFunction(value);
42731}
42732
42733module.exports = isArrayLike;
42734
42735
42736/***/ }),
42737/* 657 */
42738/***/ (function(module, exports, __webpack_require__) {
42739
42740var baseGetTag = __webpack_require__(119),
42741 isObject = __webpack_require__(658);
42742
42743/** `Object#toString` result references. */
42744var asyncTag = '[object AsyncFunction]',
42745 funcTag = '[object Function]',
42746 genTag = '[object GeneratorFunction]',
42747 proxyTag = '[object Proxy]';
42748
42749/**
42750 * Checks if `value` is classified as a `Function` object.
42751 *
42752 * @static
42753 * @memberOf _
42754 * @since 0.1.0
42755 * @category Lang
42756 * @param {*} value The value to check.
42757 * @returns {boolean} Returns `true` if `value` is a function, else `false`.
42758 * @example
42759 *
42760 * _.isFunction(_);
42761 * // => true
42762 *
42763 * _.isFunction(/abc/);
42764 * // => false
42765 */
42766function isFunction(value) {
42767 if (!isObject(value)) {
42768 return false;
42769 }
42770 // The use of `Object#toString` avoids issues with the `typeof` operator
42771 // in Safari 9 which returns 'object' for typed arrays and other constructors.
42772 var tag = baseGetTag(value);
42773 return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
42774}
42775
42776module.exports = isFunction;
42777
42778
42779/***/ }),
42780/* 658 */
42781/***/ (function(module, exports) {
42782
42783/**
42784 * Checks if `value` is the
42785 * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
42786 * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
42787 *
42788 * @static
42789 * @memberOf _
42790 * @since 0.1.0
42791 * @category Lang
42792 * @param {*} value The value to check.
42793 * @returns {boolean} Returns `true` if `value` is an object, else `false`.
42794 * @example
42795 *
42796 * _.isObject({});
42797 * // => true
42798 *
42799 * _.isObject([1, 2, 3]);
42800 * // => true
42801 *
42802 * _.isObject(_.noop);
42803 * // => true
42804 *
42805 * _.isObject(null);
42806 * // => false
42807 */
42808function isObject(value) {
42809 var type = typeof value;
42810 return value != null && (type == 'object' || type == 'function');
42811}
42812
42813module.exports = isObject;
42814
42815
42816/***/ }),
42817/* 659 */
42818/***/ (function(module, exports, __webpack_require__) {
42819
42820var arrayWithHoles = __webpack_require__(660);
42821var iterableToArray = __webpack_require__(267);
42822var unsupportedIterableToArray = __webpack_require__(268);
42823var nonIterableRest = __webpack_require__(661);
42824function _toArray(arr) {
42825 return arrayWithHoles(arr) || iterableToArray(arr) || unsupportedIterableToArray(arr) || nonIterableRest();
42826}
42827module.exports = _toArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
42828
42829/***/ }),
42830/* 660 */
42831/***/ (function(module, exports) {
42832
42833function _arrayWithHoles(arr) {
42834 if (Array.isArray(arr)) return arr;
42835}
42836module.exports = _arrayWithHoles, module.exports.__esModule = true, module.exports["default"] = module.exports;
42837
42838/***/ }),
42839/* 661 */
42840/***/ (function(module, exports) {
42841
42842function _nonIterableRest() {
42843 throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
42844}
42845module.exports = _nonIterableRest, module.exports.__esModule = true, module.exports["default"] = module.exports;
42846
42847/***/ }),
42848/* 662 */
42849/***/ (function(module, exports, __webpack_require__) {
42850
42851var toPropertyKey = __webpack_require__(269);
42852function _defineProperties(target, props) {
42853 for (var i = 0; i < props.length; i++) {
42854 var descriptor = props[i];
42855 descriptor.enumerable = descriptor.enumerable || false;
42856 descriptor.configurable = true;
42857 if ("value" in descriptor) descriptor.writable = true;
42858 Object.defineProperty(target, toPropertyKey(descriptor.key), descriptor);
42859 }
42860}
42861function _createClass(Constructor, protoProps, staticProps) {
42862 if (protoProps) _defineProperties(Constructor.prototype, protoProps);
42863 if (staticProps) _defineProperties(Constructor, staticProps);
42864 Object.defineProperty(Constructor, "prototype", {
42865 writable: false
42866 });
42867 return Constructor;
42868}
42869module.exports = _createClass, module.exports.__esModule = true, module.exports["default"] = module.exports;
42870
42871/***/ }),
42872/* 663 */
42873/***/ (function(module, exports) {
42874
42875function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) {
42876 var desc = {};
42877 Object.keys(descriptor).forEach(function (key) {
42878 desc[key] = descriptor[key];
42879 });
42880 desc.enumerable = !!desc.enumerable;
42881 desc.configurable = !!desc.configurable;
42882 if ('value' in desc || desc.initializer) {
42883 desc.writable = true;
42884 }
42885 desc = decorators.slice().reverse().reduce(function (desc, decorator) {
42886 return decorator(target, property, desc) || desc;
42887 }, desc);
42888 if (context && desc.initializer !== void 0) {
42889 desc.value = desc.initializer ? desc.initializer.call(context) : void 0;
42890 desc.initializer = undefined;
42891 }
42892 if (desc.initializer === void 0) {
42893 Object.defineProperty(target, property, desc);
42894 desc = null;
42895 }
42896 return desc;
42897}
42898module.exports = _applyDecoratedDescriptor, module.exports.__esModule = true, module.exports["default"] = module.exports;
42899
42900/***/ }),
42901/* 664 */
42902/***/ (function(module, exports, __webpack_require__) {
42903
42904/*
42905
42906 Javascript State Machine Library - https://github.com/jakesgordon/javascript-state-machine
42907
42908 Copyright (c) 2012, 2013, 2014, 2015, Jake Gordon and contributors
42909 Released under the MIT license - https://github.com/jakesgordon/javascript-state-machine/blob/master/LICENSE
42910
42911*/
42912
42913(function () {
42914
42915 var StateMachine = {
42916
42917 //---------------------------------------------------------------------------
42918
42919 VERSION: "2.4.0",
42920
42921 //---------------------------------------------------------------------------
42922
42923 Result: {
42924 SUCCEEDED: 1, // the event transitioned successfully from one state to another
42925 NOTRANSITION: 2, // the event was successfull but no state transition was necessary
42926 CANCELLED: 3, // the event was cancelled by the caller in a beforeEvent callback
42927 PENDING: 4 // the event is asynchronous and the caller is in control of when the transition occurs
42928 },
42929
42930 Error: {
42931 INVALID_TRANSITION: 100, // caller tried to fire an event that was innapropriate in the current state
42932 PENDING_TRANSITION: 200, // caller tried to fire an event while an async transition was still pending
42933 INVALID_CALLBACK: 300 // caller provided callback function threw an exception
42934 },
42935
42936 WILDCARD: '*',
42937 ASYNC: 'async',
42938
42939 //---------------------------------------------------------------------------
42940
42941 create: function(cfg, target) {
42942
42943 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 }
42944 var terminal = cfg.terminal || cfg['final'];
42945 var fsm = target || cfg.target || {};
42946 var events = cfg.events || [];
42947 var callbacks = cfg.callbacks || {};
42948 var map = {}; // track state transitions allowed for an event { event: { from: [ to ] } }
42949 var transitions = {}; // track events allowed from a state { state: [ event ] }
42950
42951 var add = function(e) {
42952 var from = Array.isArray(e.from) ? e.from : (e.from ? [e.from] : [StateMachine.WILDCARD]); // allow 'wildcard' transition if 'from' is not specified
42953 map[e.name] = map[e.name] || {};
42954 for (var n = 0 ; n < from.length ; n++) {
42955 transitions[from[n]] = transitions[from[n]] || [];
42956 transitions[from[n]].push(e.name);
42957
42958 map[e.name][from[n]] = e.to || from[n]; // allow no-op transition if 'to' is not specified
42959 }
42960 if (e.to)
42961 transitions[e.to] = transitions[e.to] || [];
42962 };
42963
42964 if (initial) {
42965 initial.event = initial.event || 'startup';
42966 add({ name: initial.event, from: 'none', to: initial.state });
42967 }
42968
42969 for(var n = 0 ; n < events.length ; n++)
42970 add(events[n]);
42971
42972 for(var name in map) {
42973 if (map.hasOwnProperty(name))
42974 fsm[name] = StateMachine.buildEvent(name, map[name]);
42975 }
42976
42977 for(var name in callbacks) {
42978 if (callbacks.hasOwnProperty(name))
42979 fsm[name] = callbacks[name]
42980 }
42981
42982 fsm.current = 'none';
42983 fsm.is = function(state) { return Array.isArray(state) ? (state.indexOf(this.current) >= 0) : (this.current === state); };
42984 fsm.can = function(event) { return !this.transition && (map[event] !== undefined) && (map[event].hasOwnProperty(this.current) || map[event].hasOwnProperty(StateMachine.WILDCARD)); }
42985 fsm.cannot = function(event) { return !this.can(event); };
42986 fsm.transitions = function() { return (transitions[this.current] || []).concat(transitions[StateMachine.WILDCARD] || []); };
42987 fsm.isFinished = function() { return this.is(terminal); };
42988 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)
42989 fsm.states = function() { return Object.keys(transitions).sort() };
42990
42991 if (initial && !initial.defer)
42992 fsm[initial.event]();
42993
42994 return fsm;
42995
42996 },
42997
42998 //===========================================================================
42999
43000 doCallback: function(fsm, func, name, from, to, args) {
43001 if (func) {
43002 try {
43003 return func.apply(fsm, [name, from, to].concat(args));
43004 }
43005 catch(e) {
43006 return fsm.error(name, from, to, args, StateMachine.Error.INVALID_CALLBACK, "an exception occurred in a caller-provided callback function", e);
43007 }
43008 }
43009 },
43010
43011 beforeAnyEvent: function(fsm, name, from, to, args) { return StateMachine.doCallback(fsm, fsm['onbeforeevent'], name, from, to, args); },
43012 afterAnyEvent: function(fsm, name, from, to, args) { return StateMachine.doCallback(fsm, fsm['onafterevent'] || fsm['onevent'], name, from, to, args); },
43013 leaveAnyState: function(fsm, name, from, to, args) { return StateMachine.doCallback(fsm, fsm['onleavestate'], name, from, to, args); },
43014 enterAnyState: function(fsm, name, from, to, args) { return StateMachine.doCallback(fsm, fsm['onenterstate'] || fsm['onstate'], name, from, to, args); },
43015 changeState: function(fsm, name, from, to, args) { return StateMachine.doCallback(fsm, fsm['onchangestate'], name, from, to, args); },
43016
43017 beforeThisEvent: function(fsm, name, from, to, args) { return StateMachine.doCallback(fsm, fsm['onbefore' + name], name, from, to, args); },
43018 afterThisEvent: function(fsm, name, from, to, args) { return StateMachine.doCallback(fsm, fsm['onafter' + name] || fsm['on' + name], name, from, to, args); },
43019 leaveThisState: function(fsm, name, from, to, args) { return StateMachine.doCallback(fsm, fsm['onleave' + from], name, from, to, args); },
43020 enterThisState: function(fsm, name, from, to, args) { return StateMachine.doCallback(fsm, fsm['onenter' + to] || fsm['on' + to], name, from, to, args); },
43021
43022 beforeEvent: function(fsm, name, from, to, args) {
43023 if ((false === StateMachine.beforeThisEvent(fsm, name, from, to, args)) ||
43024 (false === StateMachine.beforeAnyEvent( fsm, name, from, to, args)))
43025 return false;
43026 },
43027
43028 afterEvent: function(fsm, name, from, to, args) {
43029 StateMachine.afterThisEvent(fsm, name, from, to, args);
43030 StateMachine.afterAnyEvent( fsm, name, from, to, args);
43031 },
43032
43033 leaveState: function(fsm, name, from, to, args) {
43034 var specific = StateMachine.leaveThisState(fsm, name, from, to, args),
43035 general = StateMachine.leaveAnyState( fsm, name, from, to, args);
43036 if ((false === specific) || (false === general))
43037 return false;
43038 else if ((StateMachine.ASYNC === specific) || (StateMachine.ASYNC === general))
43039 return StateMachine.ASYNC;
43040 },
43041
43042 enterState: function(fsm, name, from, to, args) {
43043 StateMachine.enterThisState(fsm, name, from, to, args);
43044 StateMachine.enterAnyState( fsm, name, from, to, args);
43045 },
43046
43047 //===========================================================================
43048
43049 buildEvent: function(name, map) {
43050 return function() {
43051
43052 var from = this.current;
43053 var to = map[from] || (map[StateMachine.WILDCARD] != StateMachine.WILDCARD ? map[StateMachine.WILDCARD] : from) || from;
43054 var args = Array.prototype.slice.call(arguments); // turn arguments into pure array
43055
43056 if (this.transition)
43057 return this.error(name, from, to, args, StateMachine.Error.PENDING_TRANSITION, "event " + name + " inappropriate because previous transition did not complete");
43058
43059 if (this.cannot(name))
43060 return this.error(name, from, to, args, StateMachine.Error.INVALID_TRANSITION, "event " + name + " inappropriate in current state " + this.current);
43061
43062 if (false === StateMachine.beforeEvent(this, name, from, to, args))
43063 return StateMachine.Result.CANCELLED;
43064
43065 if (from === to) {
43066 StateMachine.afterEvent(this, name, from, to, args);
43067 return StateMachine.Result.NOTRANSITION;
43068 }
43069
43070 // 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)
43071 var fsm = this;
43072 this.transition = function() {
43073 fsm.transition = null; // this method should only ever be called once
43074 fsm.current = to;
43075 StateMachine.enterState( fsm, name, from, to, args);
43076 StateMachine.changeState(fsm, name, from, to, args);
43077 StateMachine.afterEvent( fsm, name, from, to, args);
43078 return StateMachine.Result.SUCCEEDED;
43079 };
43080 this.transition.cancel = function() { // provide a way for caller to cancel async transition if desired (issue #22)
43081 fsm.transition = null;
43082 StateMachine.afterEvent(fsm, name, from, to, args);
43083 }
43084
43085 var leave = StateMachine.leaveState(this, name, from, to, args);
43086 if (false === leave) {
43087 this.transition = null;
43088 return StateMachine.Result.CANCELLED;
43089 }
43090 else if (StateMachine.ASYNC === leave) {
43091 return StateMachine.Result.PENDING;
43092 }
43093 else {
43094 if (this.transition) // need to check in case user manually called transition() but forgot to return StateMachine.ASYNC
43095 return this.transition();
43096 }
43097
43098 };
43099 }
43100
43101 }; // StateMachine
43102
43103 //===========================================================================
43104
43105 //======
43106 // NODE
43107 //======
43108 if (true) {
43109 if (typeof module !== 'undefined' && module.exports) {
43110 exports = module.exports = StateMachine;
43111 }
43112 exports.StateMachine = StateMachine;
43113 }
43114 //============
43115 // AMD/REQUIRE
43116 //============
43117 else if (typeof define === 'function' && define.amd) {
43118 define(function(require) { return StateMachine; });
43119 }
43120 //========
43121 // BROWSER
43122 //========
43123 else if (typeof window !== 'undefined') {
43124 window.StateMachine = StateMachine;
43125 }
43126 //===========
43127 // WEB WORKER
43128 //===========
43129 else if (typeof self !== 'undefined') {
43130 self.StateMachine = StateMachine;
43131 }
43132
43133}());
43134
43135
43136/***/ }),
43137/* 665 */
43138/***/ (function(module, exports, __webpack_require__) {
43139
43140var baseGetTag = __webpack_require__(119),
43141 getPrototype = __webpack_require__(666),
43142 isObjectLike = __webpack_require__(120);
43143
43144/** `Object#toString` result references. */
43145var objectTag = '[object Object]';
43146
43147/** Used for built-in method references. */
43148var funcProto = Function.prototype,
43149 objectProto = Object.prototype;
43150
43151/** Used to resolve the decompiled source of functions. */
43152var funcToString = funcProto.toString;
43153
43154/** Used to check objects for own properties. */
43155var hasOwnProperty = objectProto.hasOwnProperty;
43156
43157/** Used to infer the `Object` constructor. */
43158var objectCtorString = funcToString.call(Object);
43159
43160/**
43161 * Checks if `value` is a plain object, that is, an object created by the
43162 * `Object` constructor or one with a `[[Prototype]]` of `null`.
43163 *
43164 * @static
43165 * @memberOf _
43166 * @since 0.8.0
43167 * @category Lang
43168 * @param {*} value The value to check.
43169 * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
43170 * @example
43171 *
43172 * function Foo() {
43173 * this.a = 1;
43174 * }
43175 *
43176 * _.isPlainObject(new Foo);
43177 * // => false
43178 *
43179 * _.isPlainObject([1, 2, 3]);
43180 * // => false
43181 *
43182 * _.isPlainObject({ 'x': 0, 'y': 0 });
43183 * // => true
43184 *
43185 * _.isPlainObject(Object.create(null));
43186 * // => true
43187 */
43188function isPlainObject(value) {
43189 if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
43190 return false;
43191 }
43192 var proto = getPrototype(value);
43193 if (proto === null) {
43194 return true;
43195 }
43196 var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
43197 return typeof Ctor == 'function' && Ctor instanceof Ctor &&
43198 funcToString.call(Ctor) == objectCtorString;
43199}
43200
43201module.exports = isPlainObject;
43202
43203
43204/***/ }),
43205/* 666 */
43206/***/ (function(module, exports, __webpack_require__) {
43207
43208var overArg = __webpack_require__(278);
43209
43210/** Built-in value references. */
43211var getPrototype = overArg(Object.getPrototypeOf, Object);
43212
43213module.exports = getPrototype;
43214
43215
43216/***/ }),
43217/* 667 */
43218/***/ (function(module, exports, __webpack_require__) {
43219
43220"use strict";
43221var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
43222
43223var _interopRequireDefault = __webpack_require__(1);
43224
43225var _isIterable2 = _interopRequireDefault(__webpack_require__(668));
43226
43227var _from = _interopRequireDefault(__webpack_require__(253));
43228
43229var _set = _interopRequireDefault(__webpack_require__(265));
43230
43231var _concat = _interopRequireDefault(__webpack_require__(22));
43232
43233var _assign = _interopRequireDefault(__webpack_require__(153));
43234
43235var _map = _interopRequireDefault(__webpack_require__(35));
43236
43237var _defineProperty = _interopRequireDefault(__webpack_require__(92));
43238
43239var _typeof2 = _interopRequireDefault(__webpack_require__(73));
43240
43241(function (global, factory) {
43242 ( false ? "undefined" : (0, _typeof2.default)(exports)) === 'object' && typeof module !== 'undefined' ? factory(exports, __webpack_require__(157)) : true ? !(__WEBPACK_AMD_DEFINE_ARRAY__ = [exports, __webpack_require__(157)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
43243 __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
43244 (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
43245 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)) : (global = global || self, factory(global.AV = global.AV || {}, global.AV));
43246})(void 0, function (exports, core) {
43247 'use strict';
43248
43249 function _inheritsLoose(subClass, superClass) {
43250 subClass.prototype = Object.create(superClass.prototype);
43251 subClass.prototype.constructor = subClass;
43252 subClass.__proto__ = superClass;
43253 }
43254
43255 function _toConsumableArray(arr) {
43256 return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread();
43257 }
43258
43259 function _arrayWithoutHoles(arr) {
43260 if (Array.isArray(arr)) {
43261 for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) {
43262 arr2[i] = arr[i];
43263 }
43264
43265 return arr2;
43266 }
43267 }
43268
43269 function _iterableToArray(iter) {
43270 if ((0, _isIterable2.default)(Object(iter)) || Object.prototype.toString.call(iter) === "[object Arguments]") return (0, _from.default)(iter);
43271 }
43272
43273 function _nonIterableSpread() {
43274 throw new TypeError("Invalid attempt to spread non-iterable instance");
43275 }
43276 /* eslint-disable import/no-unresolved */
43277
43278
43279 if (!core.Protocals) {
43280 throw new Error('LeanCloud Realtime SDK not installed');
43281 }
43282
43283 var CommandType = core.Protocals.CommandType,
43284 GenericCommand = core.Protocals.GenericCommand,
43285 AckCommand = core.Protocals.AckCommand;
43286
43287 var warn = function warn(error) {
43288 return console.warn(error.message);
43289 };
43290
43291 var LiveQueryClient = /*#__PURE__*/function (_EventEmitter) {
43292 _inheritsLoose(LiveQueryClient, _EventEmitter);
43293
43294 function LiveQueryClient(appId, subscriptionId, connection) {
43295 var _this;
43296
43297 _this = _EventEmitter.call(this) || this;
43298 _this._appId = appId;
43299 _this.id = subscriptionId;
43300 _this._connection = connection;
43301 _this._eventemitter = new core.EventEmitter();
43302 _this._querys = new _set.default();
43303 return _this;
43304 }
43305
43306 var _proto = LiveQueryClient.prototype;
43307
43308 _proto._send = function _send(cmd) {
43309 var _context;
43310
43311 var _this$_connection;
43312
43313 for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
43314 args[_key - 1] = arguments[_key];
43315 }
43316
43317 return (_this$_connection = this._connection).send.apply(_this$_connection, (0, _concat.default)(_context = [(0, _assign.default)(cmd, {
43318 appId: this._appId,
43319 installationId: this.id,
43320 service: 1
43321 })]).call(_context, args));
43322 };
43323
43324 _proto._open = function _open() {
43325 return this._send(new GenericCommand({
43326 cmd: CommandType.login
43327 }));
43328 };
43329
43330 _proto.close = function close() {
43331 var _ee = this._eventemitter;
43332
43333 _ee.emit('beforeclose');
43334
43335 return this._send(new GenericCommand({
43336 cmd: CommandType.logout
43337 })).then(function () {
43338 return _ee.emit('close');
43339 });
43340 };
43341
43342 _proto.register = function register(liveQuery) {
43343 this._querys.add(liveQuery);
43344 };
43345
43346 _proto.deregister = function deregister(liveQuery) {
43347 var _this2 = this;
43348
43349 this._querys.delete(liveQuery);
43350
43351 setTimeout(function () {
43352 if (!_this2._querys.size) _this2.close().catch(warn);
43353 }, 0);
43354 };
43355
43356 _proto._dispatchCommand = function _dispatchCommand(command) {
43357 if (command.cmd !== CommandType.data) {
43358 this.emit('unhandledmessage', command);
43359 return core.Promise.resolve();
43360 }
43361
43362 return this._dispatchDataCommand(command);
43363 };
43364
43365 _proto._dispatchDataCommand = function _dispatchDataCommand(_ref) {
43366 var _ref$dataMessage = _ref.dataMessage,
43367 ids = _ref$dataMessage.ids,
43368 msg = _ref$dataMessage.msg;
43369 this.emit('message', (0, _map.default)(msg).call(msg, function (_ref2) {
43370 var data = _ref2.data;
43371 return JSON.parse(data);
43372 })); // send ack
43373
43374 var command = new GenericCommand({
43375 cmd: CommandType.ack,
43376 ackMessage: new AckCommand({
43377 ids: ids
43378 })
43379 });
43380 return this._send(command, false).catch(warn);
43381 };
43382
43383 return LiveQueryClient;
43384 }(core.EventEmitter);
43385
43386 var finalize = function finalize(callback) {
43387 return [// eslint-disable-next-line no-sequences
43388 function (value) {
43389 return callback(), value;
43390 }, function (error) {
43391 callback();
43392 throw error;
43393 }];
43394 };
43395
43396 var onRealtimeCreate = function onRealtimeCreate(realtime) {
43397 /* eslint-disable no-param-reassign */
43398 realtime._liveQueryClients = {};
43399
43400 realtime.createLiveQueryClient = function (subscriptionId) {
43401 var _realtime$_open$then;
43402
43403 if (realtime._liveQueryClients[subscriptionId] !== undefined) {
43404 return core.Promise.resolve(realtime._liveQueryClients[subscriptionId]);
43405 }
43406
43407 var promise = (_realtime$_open$then = realtime._open().then(function (connection) {
43408 var client = new LiveQueryClient(realtime._options.appId, subscriptionId, connection);
43409 connection.on('reconnect', function () {
43410 return client._open().then(function () {
43411 return client.emit('reconnect');
43412 }, function (error) {
43413 return client.emit('reconnecterror', error);
43414 });
43415 });
43416
43417 client._eventemitter.on('beforeclose', function () {
43418 delete realtime._liveQueryClients[client.id];
43419 }, realtime);
43420
43421 client._eventemitter.on('close', function () {
43422 realtime._deregister(client);
43423 }, realtime);
43424
43425 return client._open().then(function () {
43426 realtime._liveQueryClients[client.id] = client;
43427
43428 realtime._register(client);
43429
43430 return client;
43431 });
43432 })).then.apply(_realtime$_open$then, _toConsumableArray(finalize(function () {
43433 if (realtime._deregisterPending) realtime._deregisterPending(promise);
43434 })));
43435
43436 realtime._liveQueryClients[subscriptionId] = promise;
43437 if (realtime._registerPending) realtime._registerPending(promise);
43438 return promise;
43439 };
43440 /* eslint-enable no-param-reassign */
43441
43442 };
43443
43444 var beforeCommandDispatch = function beforeCommandDispatch(command, realtime) {
43445 var isLiveQueryCommand = command.installationId && command.service === 1;
43446 if (!isLiveQueryCommand) return true;
43447 var targetClient = realtime._liveQueryClients[command.installationId];
43448
43449 if (targetClient) {
43450 targetClient._dispatchCommand(command).catch(function (error) {
43451 return console.warn(error);
43452 });
43453 } else {
43454 console.warn('Unexpected message received without any live client match: %O', command);
43455 }
43456
43457 return false;
43458 }; // eslint-disable-next-line import/prefer-default-export
43459
43460
43461 var LiveQueryPlugin = {
43462 name: 'leancloud-realtime-plugin-live-query',
43463 onRealtimeCreate: onRealtimeCreate,
43464 beforeCommandDispatch: beforeCommandDispatch
43465 };
43466 exports.LiveQueryPlugin = LiveQueryPlugin;
43467 (0, _defineProperty.default)(exports, '__esModule', {
43468 value: true
43469 });
43470});
43471
43472/***/ }),
43473/* 668 */
43474/***/ (function(module, exports, __webpack_require__) {
43475
43476module.exports = __webpack_require__(669);
43477
43478/***/ }),
43479/* 669 */
43480/***/ (function(module, exports, __webpack_require__) {
43481
43482module.exports = __webpack_require__(670);
43483
43484
43485/***/ }),
43486/* 670 */
43487/***/ (function(module, exports, __webpack_require__) {
43488
43489var parent = __webpack_require__(671);
43490
43491module.exports = parent;
43492
43493
43494/***/ }),
43495/* 671 */
43496/***/ (function(module, exports, __webpack_require__) {
43497
43498var parent = __webpack_require__(672);
43499
43500module.exports = parent;
43501
43502
43503/***/ }),
43504/* 672 */
43505/***/ (function(module, exports, __webpack_require__) {
43506
43507var parent = __webpack_require__(673);
43508__webpack_require__(39);
43509
43510module.exports = parent;
43511
43512
43513/***/ }),
43514/* 673 */
43515/***/ (function(module, exports, __webpack_require__) {
43516
43517__webpack_require__(38);
43518__webpack_require__(55);
43519var isIterable = __webpack_require__(674);
43520
43521module.exports = isIterable;
43522
43523
43524/***/ }),
43525/* 674 */
43526/***/ (function(module, exports, __webpack_require__) {
43527
43528var classof = __webpack_require__(51);
43529var hasOwn = __webpack_require__(13);
43530var wellKnownSymbol = __webpack_require__(9);
43531var Iterators = __webpack_require__(50);
43532
43533var ITERATOR = wellKnownSymbol('iterator');
43534var $Object = Object;
43535
43536module.exports = function (it) {
43537 var O = $Object(it);
43538 return O[ITERATOR] !== undefined
43539 || '@@iterator' in O
43540 || hasOwn(Iterators, classof(O));
43541};
43542
43543
43544/***/ })
43545/******/ ]);
43546});
43547//# sourceMappingURL=av-live-query-weapp.js.map
\No newline at end of file