UNPKG

698 kBJavaScriptView 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 = 164);
74/******/ })
75/************************************************************************/
76/******/ ([
77/* 0 */
78/***/ (function(module, __webpack_exports__, __webpack_require__) {
79
80"use strict";
81Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
82/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__index_default_js__ = __webpack_require__(189);
83/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return __WEBPACK_IMPORTED_MODULE_0__index_default_js__["a"]; });
84/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__index_js__ = __webpack_require__(70);
85/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "VERSION", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["VERSION"]; });
86/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "restArguments", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["restArguments"]; });
87/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isObject", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isObject"]; });
88/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isNull", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isNull"]; });
89/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isUndefined", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isUndefined"]; });
90/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isBoolean", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isBoolean"]; });
91/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isElement", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isElement"]; });
92/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isString", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isString"]; });
93/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isNumber", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isNumber"]; });
94/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isDate", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isDate"]; });
95/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isRegExp", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isRegExp"]; });
96/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isError", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isError"]; });
97/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isSymbol", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isSymbol"]; });
98/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isArrayBuffer", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isArrayBuffer"]; });
99/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isDataView", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isDataView"]; });
100/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isArray", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isArray"]; });
101/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isFunction", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isFunction"]; });
102/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isArguments", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isArguments"]; });
103/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isFinite", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isFinite"]; });
104/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isNaN", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isNaN"]; });
105/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isTypedArray", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isTypedArray"]; });
106/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isEmpty", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isEmpty"]; });
107/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isMatch", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isMatch"]; });
108/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isEqual", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isEqual"]; });
109/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isMap", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isMap"]; });
110/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isWeakMap", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isWeakMap"]; });
111/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isSet", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isSet"]; });
112/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "isWeakSet", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["isWeakSet"]; });
113/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "keys", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["keys"]; });
114/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "allKeys", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["allKeys"]; });
115/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "values", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["values"]; });
116/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "pairs", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["pairs"]; });
117/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "invert", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["invert"]; });
118/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "functions", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["functions"]; });
119/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "methods", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["methods"]; });
120/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "extend", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["extend"]; });
121/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "extendOwn", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["extendOwn"]; });
122/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "assign", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["assign"]; });
123/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "defaults", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["defaults"]; });
124/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "create", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["create"]; });
125/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "clone", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["clone"]; });
126/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "tap", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["tap"]; });
127/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "get", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["get"]; });
128/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "has", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["has"]; });
129/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "mapObject", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["mapObject"]; });
130/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "identity", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["identity"]; });
131/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "constant", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["constant"]; });
132/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "noop", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["noop"]; });
133/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "toPath", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["toPath"]; });
134/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "property", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["property"]; });
135/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "propertyOf", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["propertyOf"]; });
136/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "matcher", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["matcher"]; });
137/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "matches", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["matches"]; });
138/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "times", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["times"]; });
139/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "random", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["random"]; });
140/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "now", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["now"]; });
141/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "escape", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["escape"]; });
142/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "unescape", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["unescape"]; });
143/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "templateSettings", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["templateSettings"]; });
144/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "template", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["template"]; });
145/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "result", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["result"]; });
146/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "uniqueId", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["uniqueId"]; });
147/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "chain", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["chain"]; });
148/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "iteratee", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["iteratee"]; });
149/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "partial", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["partial"]; });
150/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "bind", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["bind"]; });
151/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "bindAll", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["bindAll"]; });
152/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "memoize", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["memoize"]; });
153/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "delay", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["delay"]; });
154/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "defer", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["defer"]; });
155/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "throttle", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["throttle"]; });
156/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "debounce", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["debounce"]; });
157/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "wrap", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["wrap"]; });
158/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "negate", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["negate"]; });
159/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "compose", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["compose"]; });
160/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "after", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["after"]; });
161/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "before", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["before"]; });
162/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "once", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["once"]; });
163/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "findKey", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["findKey"]; });
164/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "findIndex", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["findIndex"]; });
165/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "findLastIndex", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["findLastIndex"]; });
166/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "sortedIndex", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["sortedIndex"]; });
167/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "indexOf", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["indexOf"]; });
168/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "lastIndexOf", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["lastIndexOf"]; });
169/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "find", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["find"]; });
170/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "detect", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["detect"]; });
171/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "findWhere", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["findWhere"]; });
172/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "each", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["each"]; });
173/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "forEach", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["forEach"]; });
174/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "map", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["map"]; });
175/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "collect", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["collect"]; });
176/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "reduce", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["reduce"]; });
177/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "foldl", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["foldl"]; });
178/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "inject", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["inject"]; });
179/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "reduceRight", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["reduceRight"]; });
180/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "foldr", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["foldr"]; });
181/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "filter", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["filter"]; });
182/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "select", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["select"]; });
183/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "reject", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["reject"]; });
184/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "every", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["every"]; });
185/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "all", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["all"]; });
186/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "some", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["some"]; });
187/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "any", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["any"]; });
188/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "contains", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["contains"]; });
189/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "includes", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["includes"]; });
190/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "include", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["include"]; });
191/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "invoke", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["invoke"]; });
192/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "pluck", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["pluck"]; });
193/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "where", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["where"]; });
194/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "max", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["max"]; });
195/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "min", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["min"]; });
196/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "shuffle", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["shuffle"]; });
197/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "sample", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["sample"]; });
198/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "sortBy", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["sortBy"]; });
199/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "groupBy", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["groupBy"]; });
200/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "indexBy", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["indexBy"]; });
201/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "countBy", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["countBy"]; });
202/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "partition", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["partition"]; });
203/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "toArray", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["toArray"]; });
204/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "size", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["size"]; });
205/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "pick", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["pick"]; });
206/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "omit", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["omit"]; });
207/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "first", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["first"]; });
208/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "head", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["head"]; });
209/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "take", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["take"]; });
210/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "initial", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["initial"]; });
211/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "last", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["last"]; });
212/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "rest", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["rest"]; });
213/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "tail", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["tail"]; });
214/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "drop", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["drop"]; });
215/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "compact", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["compact"]; });
216/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "flatten", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["flatten"]; });
217/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "without", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["without"]; });
218/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "uniq", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["uniq"]; });
219/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "unique", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["unique"]; });
220/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "union", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["union"]; });
221/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "intersection", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["intersection"]; });
222/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "difference", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["difference"]; });
223/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "unzip", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["unzip"]; });
224/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "transpose", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["transpose"]; });
225/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "zip", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["zip"]; });
226/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "object", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["object"]; });
227/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "range", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["range"]; });
228/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "chunk", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["chunk"]; });
229/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "mixin", function() { return __WEBPACK_IMPORTED_MODULE_1__index_js__["mixin"]; });
230// ESM Exports
231// ===========
232// This module is the package entry point for ES module users. In other words,
233// it is the module they are interfacing with when they import from the whole
234// package instead of from a submodule, like this:
235//
236// ```js
237// import { map } from 'underscore';
238// ```
239//
240// The difference with `./index-default`, which is the package entry point for
241// CommonJS, AMD and UMD users, is purely technical. In ES modules, named and
242// default exports are considered to be siblings, so when you have a default
243// export, its properties are not automatically available as named exports. For
244// this reason, we re-export the named exports in addition to providing the same
245// default export as in `./index-default`.
246
247
248
249
250/***/ }),
251/* 1 */
252/***/ (function(module, __webpack_exports__, __webpack_require__) {
253
254"use strict";
255/* WEBPACK VAR INJECTION */(function(global) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return VERSION; });
256/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "p", function() { return root; });
257/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return ArrayProto; });
258/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return ObjProto; });
259/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return SymbolProto; });
260/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "o", function() { return push; });
261/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "q", function() { return slice; });
262/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "t", function() { return toString; });
263/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i", function() { return hasOwnProperty; });
264/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "r", function() { return supportsArrayBuffer; });
265/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "s", function() { return supportsDataView; });
266/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "k", function() { return nativeIsArray; });
267/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "m", function() { return nativeKeys; });
268/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "j", function() { return nativeCreate; });
269/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "l", function() { return nativeIsView; });
270/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return _isNaN; });
271/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return _isFinite; });
272/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return hasEnumBug; });
273/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "n", function() { return nonEnumerableProps; });
274/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return MAX_ARRAY_INDEX; });
275// Current version.
276var VERSION = '1.12.1';
277
278// Establish the root object, `window` (`self`) in the browser, `global`
279// on the server, or `this` in some virtual machines. We use `self`
280// instead of `window` for `WebWorker` support.
281var root = typeof self == 'object' && self.self === self && self ||
282 typeof global == 'object' && global.global === global && global ||
283 Function('return this')() ||
284 {};
285
286// Save bytes in the minified (but not gzipped) version:
287var ArrayProto = Array.prototype, ObjProto = Object.prototype;
288var SymbolProto = typeof Symbol !== 'undefined' ? Symbol.prototype : null;
289
290// Create quick reference variables for speed access to core prototypes.
291var push = ArrayProto.push,
292 slice = ArrayProto.slice,
293 toString = ObjProto.toString,
294 hasOwnProperty = ObjProto.hasOwnProperty;
295
296// Modern feature detection.
297var supportsArrayBuffer = typeof ArrayBuffer !== 'undefined',
298 supportsDataView = typeof DataView !== 'undefined';
299
300// All **ECMAScript 5+** native function implementations that we hope to use
301// are declared here.
302var nativeIsArray = Array.isArray,
303 nativeKeys = Object.keys,
304 nativeCreate = Object.create,
305 nativeIsView = supportsArrayBuffer && ArrayBuffer.isView;
306
307// Create references to these builtin functions because we override them.
308var _isNaN = isNaN,
309 _isFinite = isFinite;
310
311// Keys in IE < 9 that won't be iterated by `for key in ...` and thus missed.
312var hasEnumBug = !{toString: null}.propertyIsEnumerable('toString');
313var nonEnumerableProps = ['valueOf', 'isPrototypeOf', 'toString',
314 'propertyIsEnumerable', 'hasOwnProperty', 'toLocaleString'];
315
316// The largest integer that can be represented exactly.
317var MAX_ARRAY_INDEX = Math.pow(2, 53) - 1;
318
319/* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__(104)))
320
321/***/ }),
322/* 2 */
323/***/ (function(module, exports) {
324
325var core = module.exports = { version: '2.6.9' };
326if (typeof __e == 'number') __e = core; // eslint-disable-line no-undef
327
328
329/***/ }),
330/* 3 */
331/***/ (function(module, __webpack_exports__, __webpack_require__) {
332
333"use strict";
334/* harmony export (immutable) */ __webpack_exports__["a"] = keys;
335/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isObject_js__ = __webpack_require__(26);
336/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__setup_js__ = __webpack_require__(1);
337/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__has_js__ = __webpack_require__(22);
338/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__collectNonEnumProps_js__ = __webpack_require__(115);
339
340
341
342
343
344// Retrieve the names of an object's own properties.
345// Delegates to **ECMAScript 5**'s native `Object.keys`.
346function keys(obj) {
347 if (!Object(__WEBPACK_IMPORTED_MODULE_0__isObject_js__["a" /* default */])(obj)) return [];
348 if (__WEBPACK_IMPORTED_MODULE_1__setup_js__["m" /* nativeKeys */]) return Object(__WEBPACK_IMPORTED_MODULE_1__setup_js__["m" /* nativeKeys */])(obj);
349 var keys = [];
350 for (var key in obj) if (Object(__WEBPACK_IMPORTED_MODULE_2__has_js__["a" /* default */])(obj, key)) keys.push(key);
351 // Ahem, IE < 9.
352 if (__WEBPACK_IMPORTED_MODULE_1__setup_js__["h" /* hasEnumBug */]) Object(__WEBPACK_IMPORTED_MODULE_3__collectNonEnumProps_js__["a" /* default */])(obj, keys);
353 return keys;
354}
355
356
357/***/ }),
358/* 4 */
359/***/ (function(module, exports, __webpack_require__) {
360
361module.exports = { "default": __webpack_require__(166), __esModule: true };
362
363/***/ }),
364/* 5 */
365/***/ (function(module, __webpack_exports__, __webpack_require__) {
366
367"use strict";
368/* harmony export (immutable) */ __webpack_exports__["a"] = tagTester;
369/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(1);
370
371
372// Internal function for creating a `toString`-based type tester.
373function tagTester(name) {
374 var tag = '[object ' + name + ']';
375 return function(obj) {
376 return __WEBPACK_IMPORTED_MODULE_0__setup_js__["t" /* toString */].call(obj) === tag;
377 };
378}
379
380
381/***/ }),
382/* 6 */
383/***/ (function(module, exports) {
384
385// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
386var global = module.exports = typeof window != 'undefined' && window.Math == Math
387 ? window : typeof self != 'undefined' && self.Math == Math ? self
388 // eslint-disable-next-line no-new-func
389 : Function('return this')();
390if (typeof __g == 'number') __g = global; // eslint-disable-line no-undef
391
392
393/***/ }),
394/* 7 */
395/***/ (function(module, exports, __webpack_require__) {
396
397var store = __webpack_require__(66)('wks');
398var uid = __webpack_require__(51);
399var Symbol = __webpack_require__(6).Symbol;
400var USE_SYMBOL = typeof Symbol == 'function';
401
402var $exports = module.exports = function (name) {
403 return store[name] || (store[name] =
404 USE_SYMBOL && Symbol[name] || (USE_SYMBOL ? Symbol : uid)('Symbol.' + name));
405};
406
407$exports.store = store;
408
409
410/***/ }),
411/* 8 */
412/***/ (function(module, __webpack_exports__, __webpack_require__) {
413
414"use strict";
415/* harmony export (immutable) */ __webpack_exports__["a"] = cb;
416/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__underscore_js__ = __webpack_require__(10);
417/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__baseIteratee_js__ = __webpack_require__(125);
418/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__iteratee_js__ = __webpack_require__(126);
419
420
421
422
423// The function we call internally to generate a callback. It invokes
424// `_.iteratee` if overridden, otherwise `baseIteratee`.
425function cb(value, context, argCount) {
426 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);
427 return Object(__WEBPACK_IMPORTED_MODULE_1__baseIteratee_js__["a" /* default */])(value, context, argCount);
428}
429
430
431/***/ }),
432/* 9 */
433/***/ (function(module, __webpack_exports__, __webpack_require__) {
434
435"use strict";
436/* harmony export (immutable) */ __webpack_exports__["a"] = restArguments;
437// Some functions take a variable number of arguments, or a few expected
438// arguments at the beginning and then a variable number of values to operate
439// on. This helper accumulates all remaining arguments past the function’s
440// argument length (or an explicit `startIndex`), into an array that becomes
441// the last argument. Similar to ES6’s "rest parameter".
442function restArguments(func, startIndex) {
443 startIndex = startIndex == null ? func.length - 1 : +startIndex;
444 return function() {
445 var length = Math.max(arguments.length - startIndex, 0),
446 rest = Array(length),
447 index = 0;
448 for (; index < length; index++) {
449 rest[index] = arguments[index + startIndex];
450 }
451 switch (startIndex) {
452 case 0: return func.call(this, rest);
453 case 1: return func.call(this, arguments[0], rest);
454 case 2: return func.call(this, arguments[0], arguments[1], rest);
455 }
456 var args = Array(startIndex + 1);
457 for (index = 0; index < startIndex; index++) {
458 args[index] = arguments[index];
459 }
460 args[startIndex] = rest;
461 return func.apply(this, args);
462 };
463}
464
465
466/***/ }),
467/* 10 */
468/***/ (function(module, __webpack_exports__, __webpack_require__) {
469
470"use strict";
471/* harmony export (immutable) */ __webpack_exports__["a"] = _;
472/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(1);
473
474
475// If Underscore is called as a function, it returns a wrapped object that can
476// be used OO-style. This wrapper holds altered versions of all functions added
477// through `_.mixin`. Wrapped objects may be chained.
478function _(obj) {
479 if (obj instanceof _) return obj;
480 if (!(this instanceof _)) return new _(obj);
481 this._wrapped = obj;
482}
483
484_.VERSION = __WEBPACK_IMPORTED_MODULE_0__setup_js__["e" /* VERSION */];
485
486// Extracts the result from a wrapped and chained object.
487_.prototype.value = function() {
488 return this._wrapped;
489};
490
491// Provide unwrapping proxies for some methods used in engine operations
492// such as arithmetic and JSON stringification.
493_.prototype.valueOf = _.prototype.toJSON = _.prototype.value;
494
495_.prototype.toString = function() {
496 return String(this._wrapped);
497};
498
499
500/***/ }),
501/* 11 */
502/***/ (function(module, __webpack_exports__, __webpack_require__) {
503
504"use strict";
505/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createSizePropertyCheck_js__ = __webpack_require__(113);
506/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__getLength_js__ = __webpack_require__(14);
507
508
509
510// Internal helper for collection methods to determine whether a collection
511// should be iterated as an array or as an object.
512// Related: https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength
513// Avoids a very nasty iOS 8 JIT bug on ARM-64. #2094
514/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createSizePropertyCheck_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__getLength_js__["a" /* default */]));
515
516
517/***/ }),
518/* 12 */
519/***/ (function(module, exports, __webpack_require__) {
520
521"use strict";
522
523
524var _promise = __webpack_require__(4);
525
526var _promise2 = _interopRequireDefault(_promise);
527
528function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
529
530var _ = __webpack_require__(0);
531var md5 = __webpack_require__(309);
532
533var _require = __webpack_require__(0),
534 extend = _require.extend;
535
536var AV = __webpack_require__(34);
537
538var _require2 = __webpack_require__(15),
539 getSessionToken = _require2.getSessionToken;
540
541var ajax = __webpack_require__(58);
542
543// 计算 X-LC-Sign 的签名方法
544var sign = function sign(key, isMasterKey) {
545 var now = new Date().getTime();
546 var signature = md5(now + key);
547 if (isMasterKey) {
548 return signature + ',' + now + ',master';
549 }
550 return signature + ',' + now;
551};
552
553var setAppKey = function setAppKey(headers, signKey) {
554 if (signKey) {
555 headers['X-LC-Sign'] = sign(AV.applicationKey);
556 } else {
557 headers['X-LC-Key'] = AV.applicationKey;
558 }
559};
560
561var setHeaders = function setHeaders() {
562 var authOptions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
563 var signKey = arguments[1];
564
565 var headers = {
566 'X-LC-Id': AV.applicationId,
567 'Content-Type': 'application/json;charset=UTF-8'
568 };
569 var useMasterKey = false;
570 if (typeof authOptions.useMasterKey === 'boolean') {
571 useMasterKey = authOptions.useMasterKey;
572 } else if (typeof AV._config.useMasterKey === 'boolean') {
573 useMasterKey = AV._config.useMasterKey;
574 }
575 if (useMasterKey) {
576 if (AV.masterKey) {
577 if (signKey) {
578 headers['X-LC-Sign'] = sign(AV.masterKey, true);
579 } else {
580 headers['X-LC-Key'] = AV.masterKey + ',master';
581 }
582 } else {
583 console.warn('masterKey is not set, fall back to use appKey');
584 setAppKey(headers, signKey);
585 }
586 } else {
587 setAppKey(headers, signKey);
588 }
589 if (AV.hookKey) {
590 headers['X-LC-Hook-Key'] = AV.hookKey;
591 }
592 if (AV._config.production !== null) {
593 headers['X-LC-Prod'] = String(AV._config.production);
594 }
595 headers[undefined === 'NODE_JS' ? 'User-Agent' : 'X-LC-UA'] = AV._sharedConfig.userAgent;
596
597 return _promise2.default.resolve().then(function () {
598 // Pass the session token
599 var sessionToken = getSessionToken(authOptions);
600 if (sessionToken) {
601 headers['X-LC-Session'] = sessionToken;
602 } else if (!AV._config.disableCurrentUser) {
603 return AV.User.currentAsync().then(function (currentUser) {
604 if (currentUser && currentUser._sessionToken) {
605 headers['X-LC-Session'] = currentUser._sessionToken;
606 }
607 return headers;
608 });
609 }
610 return headers;
611 });
612};
613
614var createApiUrl = function createApiUrl(_ref) {
615 var _ref$service = _ref.service,
616 service = _ref$service === undefined ? 'api' : _ref$service,
617 _ref$version = _ref.version,
618 version = _ref$version === undefined ? '1.1' : _ref$version,
619 path = _ref.path;
620
621 var apiURL = AV._config.serverURLs[service];
622
623 if (!apiURL) throw new Error('undefined server URL for ' + service);
624
625 if (apiURL.charAt(apiURL.length - 1) !== '/') {
626 apiURL += '/';
627 }
628 apiURL += version;
629 if (path) {
630 apiURL += path;
631 }
632
633 return apiURL;
634};
635
636/**
637 * Low level REST API client. Call REST endpoints with authorization headers.
638 * @function AV.request
639 * @since 3.0.0
640 * @param {Object} options
641 * @param {String} options.method HTTP method
642 * @param {String} options.path endpoint path, e.g. `/classes/Test/55759577e4b029ae6015ac20`
643 * @param {Object} [options.query] query string dict
644 * @param {Object} [options.data] HTTP body
645 * @param {AuthOptions} [options.authOptions]
646 * @param {String} [options.service = 'api']
647 * @param {String} [options.version = '1.1']
648 */
649var request = function request(_ref2) {
650 var service = _ref2.service,
651 version = _ref2.version,
652 method = _ref2.method,
653 path = _ref2.path,
654 query = _ref2.query,
655 data = _ref2.data,
656 authOptions = _ref2.authOptions,
657 _ref2$signKey = _ref2.signKey,
658 signKey = _ref2$signKey === undefined ? true : _ref2$signKey;
659
660 if (!(AV.applicationId && (AV.applicationKey || AV.masterKey))) {
661 throw new Error('Not initialized');
662 }
663 if (AV._appRouter) {
664 AV._appRouter.refresh();
665 }
666 var timeout = AV._config.requestTimeout;
667
668 var url = createApiUrl({ service: service, path: path, version: version });
669 return setHeaders(authOptions, signKey).then(function (headers) {
670 return ajax({ method: method, url: url, query: query, data: data, headers: headers, timeout: timeout }).catch(function (error) {
671 var errorJSON = {
672 code: error.code || -1,
673 error: error.message || error.responseText
674 };
675 if (error.response && error.response.code) {
676 errorJSON = error.response;
677 } else if (error.responseText) {
678 try {
679 errorJSON = JSON.parse(error.responseText);
680 } catch (e) {
681 // If we fail to parse the error text, that's okay.
682 }
683 }
684 errorJSON.rawMessage = errorJSON.rawMessage || errorJSON.error;
685 if (!AV._sharedConfig.keepErrorRawMessage) {
686 errorJSON.error += ' [' + (error.statusCode || 'N/A') + ' ' + method + ' ' + url + ']';
687 }
688 // Transform the error into an instance of AVError by trying to parse
689 // the error string as JSON.
690 var err = new Error(errorJSON.error);
691 delete errorJSON.error;
692 throw _.extend(err, errorJSON);
693 });
694 });
695};
696
697// lagecy request
698var _request = function _request(route, className, objectId, method, data, authOptions, query) {
699 var path = '';
700 if (route) path += '/' + route;
701 if (className) path += '/' + className;
702 if (objectId) path += '/' + objectId;
703 // for migeration
704 if (data && data._fetchWhenSave) throw new Error('_fetchWhenSave should be in the query');
705 if (data && data._where) throw new Error('_where should be in the query');
706 if (method && method.toLowerCase() === 'get') {
707 query = extend({}, query, data);
708 data = null;
709 }
710 return request({
711 method: method,
712 path: path,
713 query: query,
714 data: data,
715 authOptions: authOptions
716 });
717};
718
719AV.request = request;
720
721module.exports = {
722 _request: _request,
723 request: request
724};
725
726/***/ }),
727/* 13 */
728/***/ (function(module, __webpack_exports__, __webpack_require__) {
729
730"use strict";
731/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(5);
732/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__setup_js__ = __webpack_require__(1);
733
734
735
736var isFunction = Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('Function');
737
738// Optimize `isFunction` if appropriate. Work around some `typeof` bugs in old
739// v8, IE 11 (#1621), Safari 8 (#1929), and PhantomJS (#2236).
740var nodelist = __WEBPACK_IMPORTED_MODULE_1__setup_js__["p" /* root */].document && __WEBPACK_IMPORTED_MODULE_1__setup_js__["p" /* root */].document.childNodes;
741if (typeof /./ != 'function' && typeof Int8Array != 'object' && typeof nodelist != 'function') {
742 isFunction = function(obj) {
743 return typeof obj == 'function' || false;
744 };
745}
746
747/* harmony default export */ __webpack_exports__["a"] = (isFunction);
748
749
750/***/ }),
751/* 14 */
752/***/ (function(module, __webpack_exports__, __webpack_require__) {
753
754"use strict";
755/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__shallowProperty_js__ = __webpack_require__(114);
756
757
758// Internal helper to obtain the `length` property of an object.
759/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__shallowProperty_js__["a" /* default */])('length'));
760
761
762/***/ }),
763/* 15 */
764/***/ (function(module, exports, __webpack_require__) {
765
766"use strict";
767
768
769var _promise = __webpack_require__(4);
770
771var _promise2 = _interopRequireDefault(_promise);
772
773var _getPrototypeOf = __webpack_require__(155);
774
775var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);
776
777function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
778
779var _ = __webpack_require__(0);
780
781// Helper function to check null or undefined.
782var isNullOrUndefined = function isNullOrUndefined(x) {
783 return _.isNull(x) || _.isUndefined(x);
784};
785
786var ensureArray = function ensureArray(target) {
787 if (_.isArray(target)) {
788 return target;
789 }
790 if (target === undefined || target === null) {
791 return [];
792 }
793 return [target];
794};
795
796var transformFetchOptions = function transformFetchOptions() {
797 var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
798 keys = _ref.keys,
799 include = _ref.include,
800 includeACL = _ref.includeACL;
801
802 var fetchOptions = {};
803 if (keys) {
804 fetchOptions.keys = ensureArray(keys).join(',');
805 }
806 if (include) {
807 fetchOptions.include = ensureArray(include).join(',');
808 }
809 if (includeACL) {
810 fetchOptions.returnACL = includeACL;
811 }
812 return fetchOptions;
813};
814
815var getSessionToken = function getSessionToken(authOptions) {
816 if (authOptions.sessionToken) {
817 return authOptions.sessionToken;
818 }
819 if (authOptions.user && typeof authOptions.user.getSessionToken === 'function') {
820 return authOptions.user.getSessionToken();
821 }
822};
823
824var tap = function tap(interceptor) {
825 return function (value) {
826 return interceptor(value), value;
827 };
828};
829
830// Shared empty constructor function to aid in prototype-chain creation.
831var EmptyConstructor = function EmptyConstructor() {};
832
833// Helper function to correctly set up the prototype chain, for subclasses.
834// Similar to `goog.inherits`, but uses a hash of prototype properties and
835// class properties to be extended.
836var inherits = function inherits(parent, protoProps, staticProps) {
837 var child;
838
839 // The constructor function for the new subclass is either defined by you
840 // (the "constructor" property in your `extend` definition), or defaulted
841 // by us to simply call the parent's constructor.
842 if (protoProps && protoProps.hasOwnProperty('constructor')) {
843 child = protoProps.constructor;
844 } else {
845 /** @ignore */
846 child = function child() {
847 parent.apply(this, arguments);
848 };
849 }
850
851 // Inherit class (static) properties from parent.
852 _.extend(child, parent);
853
854 // Set the prototype chain to inherit from `parent`, without calling
855 // `parent`'s constructor function.
856 EmptyConstructor.prototype = parent.prototype;
857 child.prototype = new EmptyConstructor();
858
859 // Add prototype properties (instance properties) to the subclass,
860 // if supplied.
861 if (protoProps) {
862 _.extend(child.prototype, protoProps);
863 }
864
865 // Add static properties to the constructor function, if supplied.
866 if (staticProps) {
867 _.extend(child, staticProps);
868 }
869
870 // Correctly set child's `prototype.constructor`.
871 child.prototype.constructor = child;
872
873 // Set a convenience property in case the parent's prototype is
874 // needed later.
875 child.__super__ = parent.prototype;
876
877 return child;
878};
879
880var parseDate = function parseDate(iso8601) {
881 return new Date(iso8601);
882};
883
884var setValue = function setValue(target, key, value) {
885 // '.' is not allowed in Class keys, escaping is not in concern now.
886 var segs = key.split('.');
887 var lastSeg = segs.pop();
888 var currentTarget = target;
889 segs.forEach(function (seg) {
890 if (currentTarget[seg] === undefined) currentTarget[seg] = {};
891 currentTarget = currentTarget[seg];
892 });
893 currentTarget[lastSeg] = value;
894 return target;
895};
896
897var findValue = function findValue(target, key) {
898 var segs = key.split('.');
899 var firstSeg = segs[0];
900 var lastSeg = segs.pop();
901 var currentTarget = target;
902 for (var i = 0; i < segs.length; i++) {
903 currentTarget = currentTarget[segs[i]];
904 if (currentTarget === undefined) {
905 return [undefined, undefined, lastSeg];
906 }
907 }
908 var value = currentTarget[lastSeg];
909 return [value, currentTarget, lastSeg, firstSeg];
910};
911
912var isPlainObject = function isPlainObject(obj) {
913 return _.isObject(obj) && (0, _getPrototypeOf2.default)(obj) === Object.prototype;
914};
915
916var continueWhile = function continueWhile(predicate, asyncFunction) {
917 if (predicate()) {
918 return asyncFunction().then(function () {
919 return continueWhile(predicate, asyncFunction);
920 });
921 }
922 return _promise2.default.resolve();
923};
924
925module.exports = {
926 isNullOrUndefined: isNullOrUndefined,
927 ensureArray: ensureArray,
928 transformFetchOptions: transformFetchOptions,
929 getSessionToken: getSessionToken,
930 tap: tap,
931 inherits: inherits,
932 parseDate: parseDate,
933 setValue: setValue,
934 findValue: findValue,
935 isPlainObject: isPlainObject,
936 continueWhile: continueWhile
937};
938
939/***/ }),
940/* 16 */
941/***/ (function(module, exports, __webpack_require__) {
942
943var isObject = __webpack_require__(20);
944module.exports = function (it) {
945 if (!isObject(it)) throw TypeError(it + ' is not an object!');
946 return it;
947};
948
949
950/***/ }),
951/* 17 */
952/***/ (function(module, exports, __webpack_require__) {
953
954var global = __webpack_require__(6);
955var core = __webpack_require__(2);
956var ctx = __webpack_require__(38);
957var hide = __webpack_require__(23);
958var has = __webpack_require__(24);
959var PROTOTYPE = 'prototype';
960
961var $export = function (type, name, source) {
962 var IS_FORCED = type & $export.F;
963 var IS_GLOBAL = type & $export.G;
964 var IS_STATIC = type & $export.S;
965 var IS_PROTO = type & $export.P;
966 var IS_BIND = type & $export.B;
967 var IS_WRAP = type & $export.W;
968 var exports = IS_GLOBAL ? core : core[name] || (core[name] = {});
969 var expProto = exports[PROTOTYPE];
970 var target = IS_GLOBAL ? global : IS_STATIC ? global[name] : (global[name] || {})[PROTOTYPE];
971 var key, own, out;
972 if (IS_GLOBAL) source = name;
973 for (key in source) {
974 // contains in native
975 own = !IS_FORCED && target && target[key] !== undefined;
976 if (own && has(exports, key)) continue;
977 // export native or passed
978 out = own ? target[key] : source[key];
979 // prevent global pollution for namespaces
980 exports[key] = IS_GLOBAL && typeof target[key] != 'function' ? source[key]
981 // bind timers to global for call from export context
982 : IS_BIND && own ? ctx(out, global)
983 // wrap global constructors for prevent change them in library
984 : IS_WRAP && target[key] == out ? (function (C) {
985 var F = function (a, b, c) {
986 if (this instanceof C) {
987 switch (arguments.length) {
988 case 0: return new C();
989 case 1: return new C(a);
990 case 2: return new C(a, b);
991 } return new C(a, b, c);
992 } return C.apply(this, arguments);
993 };
994 F[PROTOTYPE] = C[PROTOTYPE];
995 return F;
996 // make static versions for prototype methods
997 })(out) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out;
998 // export proto methods to core.%CONSTRUCTOR%.methods.%NAME%
999 if (IS_PROTO) {
1000 (exports.virtual || (exports.virtual = {}))[key] = out;
1001 // export proto methods to core.%CONSTRUCTOR%.prototype.%NAME%
1002 if (type & $export.R && expProto && !expProto[key]) hide(expProto, key, out);
1003 }
1004 }
1005};
1006// type bitmap
1007$export.F = 1; // forced
1008$export.G = 2; // global
1009$export.S = 4; // static
1010$export.P = 8; // proto
1011$export.B = 16; // bind
1012$export.W = 32; // wrap
1013$export.U = 64; // safe
1014$export.R = 128; // real proto method for `library`
1015module.exports = $export;
1016
1017
1018/***/ }),
1019/* 18 */
1020/***/ (function(module, exports, __webpack_require__) {
1021
1022module.exports = { "default": __webpack_require__(261), __esModule: true };
1023
1024/***/ }),
1025/* 19 */
1026/***/ (function(module, exports, __webpack_require__) {
1027
1028var anObject = __webpack_require__(16);
1029var IE8_DOM_DEFINE = __webpack_require__(93);
1030var toPrimitive = __webpack_require__(63);
1031var dP = Object.defineProperty;
1032
1033exports.f = __webpack_require__(21) ? Object.defineProperty : function defineProperty(O, P, Attributes) {
1034 anObject(O);
1035 P = toPrimitive(P, true);
1036 anObject(Attributes);
1037 if (IE8_DOM_DEFINE) try {
1038 return dP(O, P, Attributes);
1039 } catch (e) { /* empty */ }
1040 if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported!');
1041 if ('value' in Attributes) O[P] = Attributes.value;
1042 return O;
1043};
1044
1045
1046/***/ }),
1047/* 20 */
1048/***/ (function(module, exports) {
1049
1050module.exports = function (it) {
1051 return typeof it === 'object' ? it !== null : typeof it === 'function';
1052};
1053
1054
1055/***/ }),
1056/* 21 */
1057/***/ (function(module, exports, __webpack_require__) {
1058
1059// Thank's IE8 for his funny defineProperty
1060module.exports = !__webpack_require__(39)(function () {
1061 return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7;
1062});
1063
1064
1065/***/ }),
1066/* 22 */
1067/***/ (function(module, __webpack_exports__, __webpack_require__) {
1068
1069"use strict";
1070/* harmony export (immutable) */ __webpack_exports__["a"] = has;
1071/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(1);
1072
1073
1074// Internal function to check whether `key` is an own property name of `obj`.
1075function has(obj, key) {
1076 return obj != null && __WEBPACK_IMPORTED_MODULE_0__setup_js__["i" /* hasOwnProperty */].call(obj, key);
1077}
1078
1079
1080/***/ }),
1081/* 23 */
1082/***/ (function(module, exports, __webpack_require__) {
1083
1084var dP = __webpack_require__(19);
1085var createDesc = __webpack_require__(49);
1086module.exports = __webpack_require__(21) ? function (object, key, value) {
1087 return dP.f(object, key, createDesc(1, value));
1088} : function (object, key, value) {
1089 object[key] = value;
1090 return object;
1091};
1092
1093
1094/***/ }),
1095/* 24 */
1096/***/ (function(module, exports) {
1097
1098var hasOwnProperty = {}.hasOwnProperty;
1099module.exports = function (it, key) {
1100 return hasOwnProperty.call(it, key);
1101};
1102
1103
1104/***/ }),
1105/* 25 */
1106/***/ (function(module, exports, __webpack_require__) {
1107
1108// to indexed object, toObject with fallback for non-array-like ES3 strings
1109var IObject = __webpack_require__(170);
1110var defined = __webpack_require__(61);
1111module.exports = function (it) {
1112 return IObject(defined(it));
1113};
1114
1115
1116/***/ }),
1117/* 26 */
1118/***/ (function(module, __webpack_exports__, __webpack_require__) {
1119
1120"use strict";
1121/* harmony export (immutable) */ __webpack_exports__["a"] = isObject;
1122// Is a given variable an object?
1123function isObject(obj) {
1124 var type = typeof obj;
1125 return type === 'function' || type === 'object' && !!obj;
1126}
1127
1128
1129/***/ }),
1130/* 27 */
1131/***/ (function(module, __webpack_exports__, __webpack_require__) {
1132
1133"use strict";
1134/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(1);
1135/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__tagTester_js__ = __webpack_require__(5);
1136
1137
1138
1139// Is a given value an array?
1140// Delegates to ECMA5's native `Array.isArray`.
1141/* harmony default export */ __webpack_exports__["a"] = (__WEBPACK_IMPORTED_MODULE_0__setup_js__["k" /* nativeIsArray */] || Object(__WEBPACK_IMPORTED_MODULE_1__tagTester_js__["a" /* default */])('Array'));
1142
1143
1144/***/ }),
1145/* 28 */
1146/***/ (function(module, __webpack_exports__, __webpack_require__) {
1147
1148"use strict";
1149/* harmony export (immutable) */ __webpack_exports__["a"] = each;
1150/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__optimizeCb_js__ = __webpack_require__(44);
1151/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isArrayLike_js__ = __webpack_require__(11);
1152/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__keys_js__ = __webpack_require__(3);
1153
1154
1155
1156
1157// The cornerstone for collection functions, an `each`
1158// implementation, aka `forEach`.
1159// Handles raw objects in addition to array-likes. Treats all
1160// sparse array-likes as if they were dense.
1161function each(obj, iteratee, context) {
1162 iteratee = Object(__WEBPACK_IMPORTED_MODULE_0__optimizeCb_js__["a" /* default */])(iteratee, context);
1163 var i, length;
1164 if (Object(__WEBPACK_IMPORTED_MODULE_1__isArrayLike_js__["a" /* default */])(obj)) {
1165 for (i = 0, length = obj.length; i < length; i++) {
1166 iteratee(obj[i], i, obj);
1167 }
1168 } else {
1169 var _keys = Object(__WEBPACK_IMPORTED_MODULE_2__keys_js__["a" /* default */])(obj);
1170 for (i = 0, length = _keys.length; i < length; i++) {
1171 iteratee(obj[_keys[i]], _keys[i], obj);
1172 }
1173 }
1174 return obj;
1175}
1176
1177
1178/***/ }),
1179/* 29 */
1180/***/ (function(module, exports, __webpack_require__) {
1181
1182"use strict";
1183
1184
1185var _ = __webpack_require__(0);
1186
1187/**
1188 * @class AV.Error
1189 */
1190
1191function AVError(code, message) {
1192 var error = new Error(message);
1193 error.code = code;
1194 return error;
1195}
1196
1197_.extend(AVError,
1198/** @lends AV.Error */{
1199 /**
1200 * Error code indicating some error other than those enumerated here.
1201 * @constant
1202 */
1203 OTHER_CAUSE: -1,
1204
1205 /**
1206 * Error code indicating that something has gone wrong with the server.
1207 * If you get this error code, it is AV's fault. Contact us at
1208 * https://avoscloud.com/help
1209 * @constant
1210 */
1211 INTERNAL_SERVER_ERROR: 1,
1212
1213 /**
1214 * Error code indicating the connection to the AV servers failed.
1215 * @constant
1216 */
1217 CONNECTION_FAILED: 100,
1218
1219 /**
1220 * Error code indicating the specified object doesn't exist.
1221 * @constant
1222 */
1223 OBJECT_NOT_FOUND: 101,
1224
1225 /**
1226 * Error code indicating you tried to query with a datatype that doesn't
1227 * support it, like exact matching an array or object.
1228 * @constant
1229 */
1230 INVALID_QUERY: 102,
1231
1232 /**
1233 * Error code indicating a missing or invalid classname. Classnames are
1234 * case-sensitive. They must start with a letter, and a-zA-Z0-9_ are the
1235 * only valid characters.
1236 * @constant
1237 */
1238 INVALID_CLASS_NAME: 103,
1239
1240 /**
1241 * Error code indicating an unspecified object id.
1242 * @constant
1243 */
1244 MISSING_OBJECT_ID: 104,
1245
1246 /**
1247 * Error code indicating an invalid key name. Keys are case-sensitive. They
1248 * must start with a letter, and a-zA-Z0-9_ are the only valid characters.
1249 * @constant
1250 */
1251 INVALID_KEY_NAME: 105,
1252
1253 /**
1254 * Error code indicating a malformed pointer. You should not see this unless
1255 * you have been mucking about changing internal AV code.
1256 * @constant
1257 */
1258 INVALID_POINTER: 106,
1259
1260 /**
1261 * Error code indicating that badly formed JSON was received upstream. This
1262 * either indicates you have done something unusual with modifying how
1263 * things encode to JSON, or the network is failing badly.
1264 * @constant
1265 */
1266 INVALID_JSON: 107,
1267
1268 /**
1269 * Error code indicating that the feature you tried to access is only
1270 * available internally for testing purposes.
1271 * @constant
1272 */
1273 COMMAND_UNAVAILABLE: 108,
1274
1275 /**
1276 * You must call AV.initialize before using the AV library.
1277 * @constant
1278 */
1279 NOT_INITIALIZED: 109,
1280
1281 /**
1282 * Error code indicating that a field was set to an inconsistent type.
1283 * @constant
1284 */
1285 INCORRECT_TYPE: 111,
1286
1287 /**
1288 * Error code indicating an invalid channel name. A channel name is either
1289 * an empty string (the broadcast channel) or contains only a-zA-Z0-9_
1290 * characters.
1291 * @constant
1292 */
1293 INVALID_CHANNEL_NAME: 112,
1294
1295 /**
1296 * Error code indicating that push is misconfigured.
1297 * @constant
1298 */
1299 PUSH_MISCONFIGURED: 115,
1300
1301 /**
1302 * Error code indicating that the object is too large.
1303 * @constant
1304 */
1305 OBJECT_TOO_LARGE: 116,
1306
1307 /**
1308 * Error code indicating that the operation isn't allowed for clients.
1309 * @constant
1310 */
1311 OPERATION_FORBIDDEN: 119,
1312
1313 /**
1314 * Error code indicating the result was not found in the cache.
1315 * @constant
1316 */
1317 CACHE_MISS: 120,
1318
1319 /**
1320 * Error code indicating that an invalid key was used in a nested
1321 * JSONObject.
1322 * @constant
1323 */
1324 INVALID_NESTED_KEY: 121,
1325
1326 /**
1327 * Error code indicating that an invalid filename was used for AVFile.
1328 * A valid file name contains only a-zA-Z0-9_. characters and is between 1
1329 * and 128 characters.
1330 * @constant
1331 */
1332 INVALID_FILE_NAME: 122,
1333
1334 /**
1335 * Error code indicating an invalid ACL was provided.
1336 * @constant
1337 */
1338 INVALID_ACL: 123,
1339
1340 /**
1341 * Error code indicating that the request timed out on the server. Typically
1342 * this indicates that the request is too expensive to run.
1343 * @constant
1344 */
1345 TIMEOUT: 124,
1346
1347 /**
1348 * Error code indicating that the email address was invalid.
1349 * @constant
1350 */
1351 INVALID_EMAIL_ADDRESS: 125,
1352
1353 /**
1354 * Error code indicating a missing content type.
1355 * @constant
1356 */
1357 MISSING_CONTENT_TYPE: 126,
1358
1359 /**
1360 * Error code indicating a missing content length.
1361 * @constant
1362 */
1363 MISSING_CONTENT_LENGTH: 127,
1364
1365 /**
1366 * Error code indicating an invalid content length.
1367 * @constant
1368 */
1369 INVALID_CONTENT_LENGTH: 128,
1370
1371 /**
1372 * Error code indicating a file that was too large.
1373 * @constant
1374 */
1375 FILE_TOO_LARGE: 129,
1376
1377 /**
1378 * Error code indicating an error saving a file.
1379 * @constant
1380 */
1381 FILE_SAVE_ERROR: 130,
1382
1383 /**
1384 * Error code indicating an error deleting a file.
1385 * @constant
1386 */
1387 FILE_DELETE_ERROR: 153,
1388
1389 /**
1390 * Error code indicating that a unique field was given a value that is
1391 * already taken.
1392 * @constant
1393 */
1394 DUPLICATE_VALUE: 137,
1395
1396 /**
1397 * Error code indicating that a role's name is invalid.
1398 * @constant
1399 */
1400 INVALID_ROLE_NAME: 139,
1401
1402 /**
1403 * Error code indicating that an application quota was exceeded. Upgrade to
1404 * resolve.
1405 * @constant
1406 */
1407 EXCEEDED_QUOTA: 140,
1408
1409 /**
1410 * Error code indicating that a Cloud Code script failed.
1411 * @constant
1412 */
1413 SCRIPT_FAILED: 141,
1414
1415 /**
1416 * Error code indicating that a Cloud Code validation failed.
1417 * @constant
1418 */
1419 VALIDATION_ERROR: 142,
1420
1421 /**
1422 * Error code indicating that invalid image data was provided.
1423 * @constant
1424 */
1425 INVALID_IMAGE_DATA: 150,
1426
1427 /**
1428 * Error code indicating an unsaved file.
1429 * @constant
1430 */
1431 UNSAVED_FILE_ERROR: 151,
1432
1433 /**
1434 * Error code indicating an invalid push time.
1435 */
1436 INVALID_PUSH_TIME_ERROR: 152,
1437
1438 /**
1439 * Error code indicating that the username is missing or empty.
1440 * @constant
1441 */
1442 USERNAME_MISSING: 200,
1443
1444 /**
1445 * Error code indicating that the password is missing or empty.
1446 * @constant
1447 */
1448 PASSWORD_MISSING: 201,
1449
1450 /**
1451 * Error code indicating that the username has already been taken.
1452 * @constant
1453 */
1454 USERNAME_TAKEN: 202,
1455
1456 /**
1457 * Error code indicating that the email has already been taken.
1458 * @constant
1459 */
1460 EMAIL_TAKEN: 203,
1461
1462 /**
1463 * Error code indicating that the email is missing, but must be specified.
1464 * @constant
1465 */
1466 EMAIL_MISSING: 204,
1467
1468 /**
1469 * Error code indicating that a user with the specified email was not found.
1470 * @constant
1471 */
1472 EMAIL_NOT_FOUND: 205,
1473
1474 /**
1475 * Error code indicating that a user object without a valid session could
1476 * not be altered.
1477 * @constant
1478 */
1479 SESSION_MISSING: 206,
1480
1481 /**
1482 * Error code indicating that a user can only be created through signup.
1483 * @constant
1484 */
1485 MUST_CREATE_USER_THROUGH_SIGNUP: 207,
1486
1487 /**
1488 * Error code indicating that an an account being linked is already linked
1489 * to another user.
1490 * @constant
1491 */
1492 ACCOUNT_ALREADY_LINKED: 208,
1493
1494 /**
1495 * Error code indicating that a user cannot be linked to an account because
1496 * that account's id could not be found.
1497 * @constant
1498 */
1499 LINKED_ID_MISSING: 250,
1500
1501 /**
1502 * Error code indicating that a user with a linked (e.g. Facebook) account
1503 * has an invalid session.
1504 * @constant
1505 */
1506 INVALID_LINKED_SESSION: 251,
1507
1508 /**
1509 * Error code indicating that a service being linked (e.g. Facebook or
1510 * Twitter) is unsupported.
1511 * @constant
1512 */
1513 UNSUPPORTED_SERVICE: 252,
1514 /**
1515 * Error code indicating a real error code is unavailable because
1516 * we had to use an XDomainRequest object to allow CORS requests in
1517 * Internet Explorer, which strips the body from HTTP responses that have
1518 * a non-2XX status code.
1519 * @constant
1520 */
1521 X_DOMAIN_REQUEST: 602
1522});
1523
1524module.exports = AVError;
1525
1526/***/ }),
1527/* 30 */
1528/***/ (function(module, exports) {
1529
1530module.exports = {};
1531
1532
1533/***/ }),
1534/* 31 */
1535/***/ (function(module, __webpack_exports__, __webpack_require__) {
1536
1537"use strict";
1538/* harmony export (immutable) */ __webpack_exports__["a"] = values;
1539/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__keys_js__ = __webpack_require__(3);
1540
1541
1542// Retrieve the values of an object's properties.
1543function values(obj) {
1544 var _keys = Object(__WEBPACK_IMPORTED_MODULE_0__keys_js__["a" /* default */])(obj);
1545 var length = _keys.length;
1546 var values = Array(length);
1547 for (var i = 0; i < length; i++) {
1548 values[i] = obj[_keys[i]];
1549 }
1550 return values;
1551}
1552
1553
1554/***/ }),
1555/* 32 */
1556/***/ (function(module, __webpack_exports__, __webpack_require__) {
1557
1558"use strict";
1559/* harmony export (immutable) */ __webpack_exports__["a"] = flatten;
1560/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__getLength_js__ = __webpack_require__(14);
1561/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isArrayLike_js__ = __webpack_require__(11);
1562/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__isArray_js__ = __webpack_require__(27);
1563/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__isArguments_js__ = __webpack_require__(73);
1564
1565
1566
1567
1568
1569// Internal implementation of a recursive `flatten` function.
1570function flatten(input, depth, strict, output) {
1571 output = output || [];
1572 if (!depth && depth !== 0) {
1573 depth = Infinity;
1574 } else if (depth <= 0) {
1575 return output.concat(input);
1576 }
1577 var idx = output.length;
1578 for (var i = 0, length = Object(__WEBPACK_IMPORTED_MODULE_0__getLength_js__["a" /* default */])(input); i < length; i++) {
1579 var value = input[i];
1580 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))) {
1581 // Flatten current level of array or arguments object.
1582 if (depth > 1) {
1583 flatten(value, depth - 1, strict, output);
1584 idx = output.length;
1585 } else {
1586 var j = 0, len = value.length;
1587 while (j < len) output[idx++] = value[j++];
1588 }
1589 } else if (!strict) {
1590 output[idx++] = value;
1591 }
1592 }
1593 return output;
1594}
1595
1596
1597/***/ }),
1598/* 33 */
1599/***/ (function(module, __webpack_exports__, __webpack_require__) {
1600
1601"use strict";
1602/* harmony export (immutable) */ __webpack_exports__["a"] = map;
1603/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(8);
1604/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isArrayLike_js__ = __webpack_require__(11);
1605/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__keys_js__ = __webpack_require__(3);
1606
1607
1608
1609
1610// Return the results of applying the iteratee to each element.
1611function map(obj, iteratee, context) {
1612 iteratee = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(iteratee, context);
1613 var _keys = !Object(__WEBPACK_IMPORTED_MODULE_1__isArrayLike_js__["a" /* default */])(obj) && Object(__WEBPACK_IMPORTED_MODULE_2__keys_js__["a" /* default */])(obj),
1614 length = (_keys || obj).length,
1615 results = Array(length);
1616 for (var index = 0; index < length; index++) {
1617 var currentKey = _keys ? _keys[index] : index;
1618 results[index] = iteratee(obj[currentKey], currentKey, obj);
1619 }
1620 return results;
1621}
1622
1623
1624/***/ }),
1625/* 34 */
1626/***/ (function(module, exports, __webpack_require__) {
1627
1628"use strict";
1629/* WEBPACK VAR INJECTION */(function(global) {
1630
1631var _stringify = __webpack_require__(18);
1632
1633var _stringify2 = _interopRequireDefault(_stringify);
1634
1635var _keys = __webpack_require__(153);
1636
1637var _keys2 = _interopRequireDefault(_keys);
1638
1639var _promise = __webpack_require__(4);
1640
1641var _promise2 = _interopRequireDefault(_promise);
1642
1643function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
1644
1645var _ = __webpack_require__(0);
1646var uuid = __webpack_require__(154);
1647var debug = __webpack_require__(35);
1648
1649var _require = __webpack_require__(15),
1650 inherits = _require.inherits,
1651 parseDate = _require.parseDate;
1652
1653var version = __webpack_require__(156);
1654
1655var _require2 = __webpack_require__(36),
1656 setAdapters = _require2.setAdapters,
1657 adapterManager = _require2.adapterManager;
1658
1659var AV = global.AV || {};
1660
1661// All internal configuration items
1662AV._config = {
1663 serverURLs: {},
1664 useMasterKey: false,
1665 production: null,
1666 realtime: null,
1667 requestTimeout: null
1668};
1669
1670var initialUserAgent = 'LeanCloud-JS-SDK/' + version;
1671
1672// configs shared by all AV instances
1673AV._sharedConfig = {
1674 userAgent: initialUserAgent,
1675 liveQueryRealtime: null
1676};
1677
1678adapterManager.on('platformInfo', function (platformInfo) {
1679 var ua = initialUserAgent;
1680 if (platformInfo) {
1681 if (platformInfo.userAgent) {
1682 ua = platformInfo.userAgent;
1683 } else {
1684 var comments = platformInfo.name;
1685 if (platformInfo.version) {
1686 comments += '/' + platformInfo.version;
1687 }
1688 if (platformInfo.extra) {
1689 comments += '; ' + platformInfo.extra;
1690 }
1691 ua += ' (' + comments + ')';
1692 }
1693 }
1694 AV._sharedConfig.userAgent = ua;
1695});
1696
1697/**
1698 * Contains all AV API classes and functions.
1699 * @namespace AV
1700 */
1701
1702/**
1703 * Returns prefix for localStorage keys used by this instance of AV.
1704 * @param {String} path The relative suffix to append to it.
1705 * null or undefined is treated as the empty string.
1706 * @return {String} The full key name.
1707 * @private
1708 */
1709AV._getAVPath = function (path) {
1710 if (!AV.applicationId) {
1711 throw new Error('You need to call AV.initialize before using AV.');
1712 }
1713 if (!path) {
1714 path = '';
1715 }
1716 if (!_.isString(path)) {
1717 throw new Error("Tried to get a localStorage path that wasn't a String.");
1718 }
1719 if (path[0] === '/') {
1720 path = path.substring(1);
1721 }
1722 return 'AV/' + AV.applicationId + '/' + path;
1723};
1724
1725/**
1726 * Returns the unique string for this app on this machine.
1727 * Gets reset when localStorage is cleared.
1728 * @private
1729 */
1730AV._installationId = null;
1731AV._getInstallationId = function () {
1732 // See if it's cached in RAM.
1733 if (AV._installationId) {
1734 return _promise2.default.resolve(AV._installationId);
1735 }
1736
1737 // Try to get it from localStorage.
1738 var path = AV._getAVPath('installationId');
1739 return AV.localStorage.getItemAsync(path).then(function (_installationId) {
1740 AV._installationId = _installationId;
1741 if (!AV._installationId) {
1742 // It wasn't in localStorage, so create a new one.
1743 AV._installationId = _installationId = uuid();
1744 return AV.localStorage.setItemAsync(path, _installationId).then(function () {
1745 return _installationId;
1746 });
1747 }
1748 return _installationId;
1749 });
1750};
1751
1752AV._subscriptionId = null;
1753AV._refreshSubscriptionId = function () {
1754 var path = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : AV._getAVPath('subscriptionId');
1755
1756 var subscriptionId = AV._subscriptionId = uuid();
1757 return AV.localStorage.setItemAsync(path, subscriptionId).then(function () {
1758 return subscriptionId;
1759 });
1760};
1761AV._getSubscriptionId = function () {
1762 // See if it's cached in RAM.
1763 if (AV._subscriptionId) {
1764 return _promise2.default.resolve(AV._subscriptionId);
1765 }
1766
1767 // Try to get it from localStorage.
1768 var path = AV._getAVPath('subscriptionId');
1769 return AV.localStorage.getItemAsync(path).then(function (_subscriptionId) {
1770 AV._subscriptionId = _subscriptionId;
1771 if (!AV._subscriptionId) {
1772 // It wasn't in localStorage, so create a new one.
1773 _subscriptionId = AV._refreshSubscriptionId(path);
1774 }
1775 return _subscriptionId;
1776 });
1777};
1778
1779AV._parseDate = parseDate;
1780
1781// A self-propagating extend function.
1782AV._extend = function (protoProps, classProps) {
1783 var child = inherits(this, protoProps, classProps);
1784 child.extend = this.extend;
1785 return child;
1786};
1787
1788/**
1789 * Converts a value in a AV Object into the appropriate representation.
1790 * This is the JS equivalent of Java's AV.maybeReferenceAndEncode(Object)
1791 * if seenObjects is falsey. Otherwise any AV.Objects not in
1792 * seenObjects will be fully embedded rather than encoded
1793 * as a pointer. This array will be used to prevent going into an infinite
1794 * loop because we have circular references. If <seenObjects>
1795 * is set, then none of the AV Objects that are serialized can be dirty.
1796 * @private
1797 */
1798AV._encode = function (value, seenObjects, disallowObjects) {
1799 var full = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
1800
1801 if (value instanceof AV.Object) {
1802 if (disallowObjects) {
1803 throw new Error('AV.Objects not allowed here');
1804 }
1805 if (!seenObjects || _.include(seenObjects, value) || !value._hasData) {
1806 return value._toPointer();
1807 }
1808 return value._toFullJSON(seenObjects.concat(value), full);
1809 }
1810 if (value instanceof AV.ACL) {
1811 return value.toJSON();
1812 }
1813 if (_.isDate(value)) {
1814 return full ? { __type: 'Date', iso: value.toJSON() } : value.toJSON();
1815 }
1816 if (value instanceof AV.GeoPoint) {
1817 return value.toJSON();
1818 }
1819 if (_.isArray(value)) {
1820 return _.map(value, function (x) {
1821 return AV._encode(x, seenObjects, disallowObjects, full);
1822 });
1823 }
1824 if (_.isRegExp(value)) {
1825 return value.source;
1826 }
1827 if (value instanceof AV.Relation) {
1828 return value.toJSON();
1829 }
1830 if (value instanceof AV.Op) {
1831 return value.toJSON();
1832 }
1833 if (value instanceof AV.File) {
1834 if (!value.url() && !value.id) {
1835 throw new Error('Tried to save an object containing an unsaved file.');
1836 }
1837 return value._toFullJSON(seenObjects, full);
1838 }
1839 if (_.isObject(value)) {
1840 return _.mapObject(value, function (v, k) {
1841 return AV._encode(v, seenObjects, disallowObjects, full);
1842 });
1843 }
1844 return value;
1845};
1846
1847/**
1848 * The inverse function of AV._encode.
1849 * @private
1850 */
1851AV._decode = function (value, key) {
1852 if (!_.isObject(value) || _.isDate(value)) {
1853 return value;
1854 }
1855 if (_.isArray(value)) {
1856 return _.map(value, function (v) {
1857 return AV._decode(v);
1858 });
1859 }
1860 if (value instanceof AV.Object) {
1861 return value;
1862 }
1863 if (value instanceof AV.File) {
1864 return value;
1865 }
1866 if (value instanceof AV.Op) {
1867 return value;
1868 }
1869 if (value instanceof AV.GeoPoint) {
1870 return value;
1871 }
1872 if (value instanceof AV.ACL) {
1873 return value;
1874 }
1875 if (key === 'ACL') {
1876 return new AV.ACL(value);
1877 }
1878 if (value.__op) {
1879 return AV.Op._decode(value);
1880 }
1881 var className;
1882 if (value.__type === 'Pointer') {
1883 className = value.className;
1884 var pointer = AV.Object._create(className);
1885 if ((0, _keys2.default)(value).length > 3) {
1886 var v = _.clone(value);
1887 delete v.__type;
1888 delete v.className;
1889 pointer._finishFetch(v, true);
1890 } else {
1891 pointer._finishFetch({ objectId: value.objectId }, false);
1892 }
1893 return pointer;
1894 }
1895 if (value.__type === 'Object') {
1896 // It's an Object included in a query result.
1897 className = value.className;
1898 var _v = _.clone(value);
1899 delete _v.__type;
1900 delete _v.className;
1901 var object = AV.Object._create(className);
1902 object._finishFetch(_v, true);
1903 return object;
1904 }
1905 if (value.__type === 'Date') {
1906 return AV._parseDate(value.iso);
1907 }
1908 if (value.__type === 'GeoPoint') {
1909 return new AV.GeoPoint({
1910 latitude: value.latitude,
1911 longitude: value.longitude
1912 });
1913 }
1914 if (value.__type === 'Relation') {
1915 if (!key) throw new Error('key missing decoding a Relation');
1916 var relation = new AV.Relation(null, key);
1917 relation.targetClassName = value.className;
1918 return relation;
1919 }
1920 if (value.__type === 'File') {
1921 var file = new AV.File(value.name);
1922 var _v2 = _.clone(value);
1923 delete _v2.__type;
1924 file._finishFetch(_v2);
1925 return file;
1926 }
1927 return _.mapObject(value, AV._decode);
1928};
1929
1930/**
1931 * The inverse function of {@link AV.Object#toFullJSON}.
1932 * @since 3.0.0
1933 * @method
1934 * @param {Object}
1935 * return {AV.Object|AV.File|any}
1936 */
1937AV.parseJSON = AV._decode;
1938
1939/**
1940 * Similar to JSON.parse, except that AV internal types will be used if possible.
1941 * Inverse to {@link AV.stringify}
1942 * @since 3.14.0
1943 * @param {string} text the string to parse.
1944 * @return {AV.Object|AV.File|any}
1945 */
1946AV.parse = function (text) {
1947 return AV.parseJSON(JSON.parse(text));
1948};
1949/**
1950 * Serialize a target containing AV.Object, similar to JSON.stringify.
1951 * Inverse to {@link AV.parse}
1952 * @since 3.14.0
1953 * @return {string}
1954 */
1955AV.stringify = function (target) {
1956 return (0, _stringify2.default)(AV._encode(target, [], false, true));
1957};
1958
1959AV._encodeObjectOrArray = function (value) {
1960 var encodeAVObject = function encodeAVObject(object) {
1961 if (object && object._toFullJSON) {
1962 object = object._toFullJSON([]);
1963 }
1964
1965 return _.mapObject(object, function (value) {
1966 return AV._encode(value, []);
1967 });
1968 };
1969
1970 if (_.isArray(value)) {
1971 return value.map(function (object) {
1972 return encodeAVObject(object);
1973 });
1974 } else {
1975 return encodeAVObject(value);
1976 }
1977};
1978
1979AV._arrayEach = _.each;
1980
1981/**
1982 * Does a deep traversal of every item in object, calling func on every one.
1983 * @param {Object} object The object or array to traverse deeply.
1984 * @param {Function} func The function to call for every item. It will
1985 * be passed the item as an argument. If it returns a truthy value, that
1986 * value will replace the item in its parent container.
1987 * @returns {} the result of calling func on the top-level object itself.
1988 * @private
1989 */
1990AV._traverse = function (object, func, seen) {
1991 if (object instanceof AV.Object) {
1992 seen = seen || [];
1993 if (_.indexOf(seen, object) >= 0) {
1994 // We've already visited this object in this call.
1995 return;
1996 }
1997 seen.push(object);
1998 AV._traverse(object.attributes, func, seen);
1999 return func(object);
2000 }
2001 if (object instanceof AV.Relation || object instanceof AV.File) {
2002 // Nothing needs to be done, but we don't want to recurse into the
2003 // object's parent infinitely, so we catch this case.
2004 return func(object);
2005 }
2006 if (_.isArray(object)) {
2007 _.each(object, function (child, index) {
2008 var newChild = AV._traverse(child, func, seen);
2009 if (newChild) {
2010 object[index] = newChild;
2011 }
2012 });
2013 return func(object);
2014 }
2015 if (_.isObject(object)) {
2016 AV._each(object, function (child, key) {
2017 var newChild = AV._traverse(child, func, seen);
2018 if (newChild) {
2019 object[key] = newChild;
2020 }
2021 });
2022 return func(object);
2023 }
2024 return func(object);
2025};
2026
2027/**
2028 * This is like _.each, except:
2029 * * it doesn't work for so-called array-like objects,
2030 * * it does work for dictionaries with a "length" attribute.
2031 * @private
2032 */
2033AV._objectEach = AV._each = function (obj, callback) {
2034 if (_.isObject(obj)) {
2035 _.each(_.keys(obj), function (key) {
2036 callback(obj[key], key);
2037 });
2038 } else {
2039 _.each(obj, callback);
2040 }
2041};
2042
2043/**
2044 * @namespace
2045 * @since 3.14.0
2046 */
2047AV.debug = {
2048 /**
2049 * Enable debug
2050 */
2051 enable: function enable() {
2052 var namespaces = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'leancloud*';
2053 return debug.enable(namespaces);
2054 },
2055 /**
2056 * Disable debug
2057 */
2058 disable: debug.disable
2059};
2060
2061/**
2062 * Specify Adapters
2063 * @since 4.4.0
2064 * @function
2065 * @param {Adapters} newAdapters See {@link https://url.leanapp.cn/adapter-type-definitions @leancloud/adapter-types} for detailed definitions.
2066 */
2067AV.setAdapters = setAdapters;
2068
2069module.exports = AV;
2070/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(104)))
2071
2072/***/ }),
2073/* 35 */
2074/***/ (function(module, exports, __webpack_require__) {
2075
2076"use strict";
2077
2078
2079function _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); }
2080
2081/* eslint-env browser */
2082
2083/**
2084 * This is the web browser implementation of `debug()`.
2085 */
2086exports.log = log;
2087exports.formatArgs = formatArgs;
2088exports.save = save;
2089exports.load = load;
2090exports.useColors = useColors;
2091exports.storage = localstorage();
2092/**
2093 * Colors.
2094 */
2095
2096exports.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'];
2097/**
2098 * Currently only WebKit-based Web Inspectors, Firefox >= v31,
2099 * and the Firebug extension (any Firefox version) are known
2100 * to support "%c" CSS customizations.
2101 *
2102 * TODO: add a `localStorage` variable to explicitly enable/disable colors
2103 */
2104// eslint-disable-next-line complexity
2105
2106function useColors() {
2107 // NB: In an Electron preload script, document will be defined but not fully
2108 // initialized. Since we know we're in Chrome, we'll just detect this case
2109 // explicitly
2110 if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) {
2111 return true;
2112 } // Internet Explorer and Edge do not support colors.
2113
2114
2115 if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
2116 return false;
2117 } // Is webkit? http://stackoverflow.com/a/16459606/376773
2118 // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
2119
2120
2121 return typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || // Is firebug? http://stackoverflow.com/a/398120/376773
2122 typeof window !== 'undefined' && window.console && (window.console.firebug || window.console.exception && window.console.table) || // Is firefox >= v31?
2123 // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
2124 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
2125 typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/);
2126}
2127/**
2128 * Colorize log arguments if enabled.
2129 *
2130 * @api public
2131 */
2132
2133
2134function formatArgs(args) {
2135 args[0] = (this.useColors ? '%c' : '') + this.namespace + (this.useColors ? ' %c' : ' ') + args[0] + (this.useColors ? '%c ' : ' ') + '+' + module.exports.humanize(this.diff);
2136
2137 if (!this.useColors) {
2138 return;
2139 }
2140
2141 var c = 'color: ' + this.color;
2142 args.splice(1, 0, c, 'color: inherit'); // The final "%c" is somewhat tricky, because there could be other
2143 // arguments passed either before or after the %c, so we need to
2144 // figure out the correct index to insert the CSS into
2145
2146 var index = 0;
2147 var lastC = 0;
2148 args[0].replace(/%[a-zA-Z%]/g, function (match) {
2149 if (match === '%%') {
2150 return;
2151 }
2152
2153 index++;
2154
2155 if (match === '%c') {
2156 // We only are interested in the *last* %c
2157 // (the user may have provided their own)
2158 lastC = index;
2159 }
2160 });
2161 args.splice(lastC, 0, c);
2162}
2163/**
2164 * Invokes `console.log()` when available.
2165 * No-op when `console.log` is not a "function".
2166 *
2167 * @api public
2168 */
2169
2170
2171function log() {
2172 var _console;
2173
2174 // This hackery is required for IE8/9, where
2175 // the `console.log` function doesn't have 'apply'
2176 return (typeof console === "undefined" ? "undefined" : _typeof(console)) === 'object' && console.log && (_console = console).log.apply(_console, arguments);
2177}
2178/**
2179 * Save `namespaces`.
2180 *
2181 * @param {String} namespaces
2182 * @api private
2183 */
2184
2185
2186function save(namespaces) {
2187 try {
2188 if (namespaces) {
2189 exports.storage.setItem('debug', namespaces);
2190 } else {
2191 exports.storage.removeItem('debug');
2192 }
2193 } catch (error) {// Swallow
2194 // XXX (@Qix-) should we be logging these?
2195 }
2196}
2197/**
2198 * Load `namespaces`.
2199 *
2200 * @return {String} returns the previously persisted debug modes
2201 * @api private
2202 */
2203
2204
2205function load() {
2206 var r;
2207
2208 try {
2209 r = exports.storage.getItem('debug');
2210 } catch (error) {} // Swallow
2211 // XXX (@Qix-) should we be logging these?
2212 // If debug isn't set in LS, and we're in Electron, try to load $DEBUG
2213
2214
2215 if (!r && typeof process !== 'undefined' && 'env' in process) {
2216 r = process.env.DEBUG;
2217 }
2218
2219 return r;
2220}
2221/**
2222 * Localstorage attempts to return the localstorage.
2223 *
2224 * This is necessary because safari throws
2225 * when a user disables cookies/localstorage
2226 * and you attempt to access it.
2227 *
2228 * @return {LocalStorage}
2229 * @api private
2230 */
2231
2232
2233function localstorage() {
2234 try {
2235 // TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context
2236 // The Browser also has localStorage in the global context.
2237 return localStorage;
2238 } catch (error) {// Swallow
2239 // XXX (@Qix-) should we be logging these?
2240 }
2241}
2242
2243module.exports = __webpack_require__(266)(exports);
2244var formatters = module.exports.formatters;
2245/**
2246 * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
2247 */
2248
2249formatters.j = function (v) {
2250 try {
2251 return JSON.stringify(v);
2252 } catch (error) {
2253 return '[UnexpectedJSONParseError]: ' + error.message;
2254 }
2255};
2256
2257
2258
2259/***/ }),
2260/* 36 */
2261/***/ (function(module, exports, __webpack_require__) {
2262
2263"use strict";
2264
2265
2266var _ = __webpack_require__(0);
2267var EventEmitter = __webpack_require__(157);
2268
2269var _require = __webpack_require__(15),
2270 inherits = _require.inherits;
2271
2272var AdapterManager = inherits(EventEmitter, {
2273 constructor: function constructor() {
2274 EventEmitter.apply(this);
2275 this._adapters = {};
2276 },
2277 getAdapter: function getAdapter(name) {
2278 var adapter = this._adapters[name];
2279 if (adapter === undefined) {
2280 throw new Error(name + ' adapter is not configured');
2281 }
2282 return adapter;
2283 },
2284 setAdapters: function setAdapters(newAdapters) {
2285 var _this = this;
2286
2287 _.extend(this._adapters, newAdapters);
2288 _.keys(newAdapters).forEach(function (name) {
2289 return _this.emit(name, newAdapters[name]);
2290 });
2291 }
2292});
2293
2294var adapterManager = new AdapterManager();
2295
2296module.exports = {
2297 getAdapter: adapterManager.getAdapter.bind(adapterManager),
2298 setAdapters: adapterManager.setAdapters.bind(adapterManager),
2299 adapterManager: adapterManager
2300};
2301
2302/***/ }),
2303/* 37 */
2304/***/ (function(module, exports) {
2305
2306module.exports = true;
2307
2308
2309/***/ }),
2310/* 38 */
2311/***/ (function(module, exports, __webpack_require__) {
2312
2313// optional / simple context binding
2314var aFunction = __webpack_require__(48);
2315module.exports = function (fn, that, length) {
2316 aFunction(fn);
2317 if (that === undefined) return fn;
2318 switch (length) {
2319 case 1: return function (a) {
2320 return fn.call(that, a);
2321 };
2322 case 2: return function (a, b) {
2323 return fn.call(that, a, b);
2324 };
2325 case 3: return function (a, b, c) {
2326 return fn.call(that, a, b, c);
2327 };
2328 }
2329 return function (/* ...args */) {
2330 return fn.apply(that, arguments);
2331 };
2332};
2333
2334
2335/***/ }),
2336/* 39 */
2337/***/ (function(module, exports) {
2338
2339module.exports = function (exec) {
2340 try {
2341 return !!exec();
2342 } catch (e) {
2343 return true;
2344 }
2345};
2346
2347
2348/***/ }),
2349/* 40 */
2350/***/ (function(module, exports) {
2351
2352var toString = {}.toString;
2353
2354module.exports = function (it) {
2355 return toString.call(it).slice(8, -1);
2356};
2357
2358
2359/***/ }),
2360/* 41 */
2361/***/ (function(module, __webpack_exports__, __webpack_require__) {
2362
2363"use strict";
2364/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return hasStringTagBug; });
2365/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return isIE11; });
2366/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(1);
2367/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__hasObjectTag_js__ = __webpack_require__(195);
2368
2369
2370
2371// In IE 10 - Edge 13, `DataView` has string tag `'[object Object]'`.
2372// In IE 11, the most common among them, this problem also applies to
2373// `Map`, `WeakMap` and `Set`.
2374var hasStringTagBug = (
2375 __WEBPACK_IMPORTED_MODULE_0__setup_js__["s" /* supportsDataView */] && Object(__WEBPACK_IMPORTED_MODULE_1__hasObjectTag_js__["a" /* default */])(new DataView(new ArrayBuffer(8)))
2376 ),
2377 isIE11 = (typeof Map !== 'undefined' && Object(__WEBPACK_IMPORTED_MODULE_1__hasObjectTag_js__["a" /* default */])(new Map));
2378
2379
2380/***/ }),
2381/* 42 */
2382/***/ (function(module, __webpack_exports__, __webpack_require__) {
2383
2384"use strict";
2385/* harmony export (immutable) */ __webpack_exports__["a"] = allKeys;
2386/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isObject_js__ = __webpack_require__(26);
2387/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__setup_js__ = __webpack_require__(1);
2388/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__collectNonEnumProps_js__ = __webpack_require__(115);
2389
2390
2391
2392
2393// Retrieve all the enumerable property names of an object.
2394function allKeys(obj) {
2395 if (!Object(__WEBPACK_IMPORTED_MODULE_0__isObject_js__["a" /* default */])(obj)) return [];
2396 var keys = [];
2397 for (var key in obj) keys.push(key);
2398 // Ahem, IE < 9.
2399 if (__WEBPACK_IMPORTED_MODULE_1__setup_js__["h" /* hasEnumBug */]) Object(__WEBPACK_IMPORTED_MODULE_2__collectNonEnumProps_js__["a" /* default */])(obj, keys);
2400 return keys;
2401}
2402
2403
2404/***/ }),
2405/* 43 */
2406/***/ (function(module, __webpack_exports__, __webpack_require__) {
2407
2408"use strict";
2409/* harmony export (immutable) */ __webpack_exports__["a"] = toPath;
2410/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__underscore_js__ = __webpack_require__(10);
2411/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__toPath_js__ = __webpack_require__(124);
2412
2413
2414
2415// Internal wrapper for `_.toPath` to enable minification.
2416// Similar to `cb` for `_.iteratee`.
2417function toPath(path) {
2418 return __WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */].toPath(path);
2419}
2420
2421
2422/***/ }),
2423/* 44 */
2424/***/ (function(module, __webpack_exports__, __webpack_require__) {
2425
2426"use strict";
2427/* harmony export (immutable) */ __webpack_exports__["a"] = optimizeCb;
2428// Internal function that returns an efficient (for current engines) version
2429// of the passed-in callback, to be repeatedly applied in other Underscore
2430// functions.
2431function optimizeCb(func, context, argCount) {
2432 if (context === void 0) return func;
2433 switch (argCount == null ? 3 : argCount) {
2434 case 1: return function(value) {
2435 return func.call(context, value);
2436 };
2437 // The 2-argument case is omitted because we’re not using it.
2438 case 3: return function(value, index, collection) {
2439 return func.call(context, value, index, collection);
2440 };
2441 case 4: return function(accumulator, value, index, collection) {
2442 return func.call(context, accumulator, value, index, collection);
2443 };
2444 }
2445 return function() {
2446 return func.apply(context, arguments);
2447 };
2448}
2449
2450
2451/***/ }),
2452/* 45 */
2453/***/ (function(module, __webpack_exports__, __webpack_require__) {
2454
2455"use strict";
2456/* harmony export (immutable) */ __webpack_exports__["a"] = filter;
2457/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(8);
2458/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__each_js__ = __webpack_require__(28);
2459
2460
2461
2462// Return all the elements that pass a truth test.
2463function filter(obj, predicate, context) {
2464 var results = [];
2465 predicate = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(predicate, context);
2466 Object(__WEBPACK_IMPORTED_MODULE_1__each_js__["a" /* default */])(obj, function(value, index, list) {
2467 if (predicate(value, index, list)) results.push(value);
2468 });
2469 return results;
2470}
2471
2472
2473/***/ }),
2474/* 46 */
2475/***/ (function(module, __webpack_exports__, __webpack_require__) {
2476
2477"use strict";
2478/* harmony export (immutable) */ __webpack_exports__["a"] = contains;
2479/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__ = __webpack_require__(11);
2480/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__values_js__ = __webpack_require__(31);
2481/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__indexOf_js__ = __webpack_require__(140);
2482
2483
2484
2485
2486// Determine if the array or object contains a given item (using `===`).
2487function contains(obj, item, fromIndex, guard) {
2488 if (!Object(__WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__["a" /* default */])(obj)) obj = Object(__WEBPACK_IMPORTED_MODULE_1__values_js__["a" /* default */])(obj);
2489 if (typeof fromIndex != 'number' || guard) fromIndex = 0;
2490 return Object(__WEBPACK_IMPORTED_MODULE_2__indexOf_js__["a" /* default */])(obj, item, fromIndex) >= 0;
2491}
2492
2493
2494/***/ }),
2495/* 47 */
2496/***/ (function(module, exports, __webpack_require__) {
2497
2498"use strict";
2499
2500var $at = __webpack_require__(167)(true);
2501
2502// 21.1.3.27 String.prototype[@@iterator]()
2503__webpack_require__(92)(String, 'String', function (iterated) {
2504 this._t = String(iterated); // target
2505 this._i = 0; // next index
2506// 21.1.5.2.1 %StringIteratorPrototype%.next()
2507}, function () {
2508 var O = this._t;
2509 var index = this._i;
2510 var point;
2511 if (index >= O.length) return { value: undefined, done: true };
2512 point = $at(O, index);
2513 this._i += point.length;
2514 return { value: point, done: false };
2515});
2516
2517
2518/***/ }),
2519/* 48 */
2520/***/ (function(module, exports) {
2521
2522module.exports = function (it) {
2523 if (typeof it != 'function') throw TypeError(it + ' is not a function!');
2524 return it;
2525};
2526
2527
2528/***/ }),
2529/* 49 */
2530/***/ (function(module, exports) {
2531
2532module.exports = function (bitmap, value) {
2533 return {
2534 enumerable: !(bitmap & 1),
2535 configurable: !(bitmap & 2),
2536 writable: !(bitmap & 4),
2537 value: value
2538 };
2539};
2540
2541
2542/***/ }),
2543/* 50 */
2544/***/ (function(module, exports, __webpack_require__) {
2545
2546// 19.1.2.14 / 15.2.3.14 Object.keys(O)
2547var $keys = __webpack_require__(95);
2548var enumBugKeys = __webpack_require__(67);
2549
2550module.exports = Object.keys || function keys(O) {
2551 return $keys(O, enumBugKeys);
2552};
2553
2554
2555/***/ }),
2556/* 51 */
2557/***/ (function(module, exports) {
2558
2559var id = 0;
2560var px = Math.random();
2561module.exports = function (key) {
2562 return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36));
2563};
2564
2565
2566/***/ }),
2567/* 52 */
2568/***/ (function(module, exports, __webpack_require__) {
2569
2570var def = __webpack_require__(19).f;
2571var has = __webpack_require__(24);
2572var TAG = __webpack_require__(7)('toStringTag');
2573
2574module.exports = function (it, tag, stat) {
2575 if (it && !has(it = stat ? it : it.prototype, TAG)) def(it, TAG, { configurable: true, value: tag });
2576};
2577
2578
2579/***/ }),
2580/* 53 */
2581/***/ (function(module, exports, __webpack_require__) {
2582
2583// 7.1.13 ToObject(argument)
2584var defined = __webpack_require__(61);
2585module.exports = function (it) {
2586 return Object(defined(it));
2587};
2588
2589
2590/***/ }),
2591/* 54 */
2592/***/ (function(module, exports, __webpack_require__) {
2593
2594__webpack_require__(173);
2595var global = __webpack_require__(6);
2596var hide = __webpack_require__(23);
2597var Iterators = __webpack_require__(30);
2598var TO_STRING_TAG = __webpack_require__(7)('toStringTag');
2599
2600var DOMIterables = ('CSSRuleList,CSSStyleDeclaration,CSSValueList,ClientRectList,DOMRectList,DOMStringList,' +
2601 'DOMTokenList,DataTransferItemList,FileList,HTMLAllCollection,HTMLCollection,HTMLFormElement,HTMLSelectElement,' +
2602 'MediaList,MimeTypeArray,NamedNodeMap,NodeList,PaintRequestList,Plugin,PluginArray,SVGLengthList,SVGNumberList,' +
2603 'SVGPathSegList,SVGPointList,SVGStringList,SVGTransformList,SourceBufferList,StyleSheetList,TextTrackCueList,' +
2604 'TextTrackList,TouchList').split(',');
2605
2606for (var i = 0; i < DOMIterables.length; i++) {
2607 var NAME = DOMIterables[i];
2608 var Collection = global[NAME];
2609 var proto = Collection && Collection.prototype;
2610 if (proto && !proto[TO_STRING_TAG]) hide(proto, TO_STRING_TAG, NAME);
2611 Iterators[NAME] = Iterators.Array;
2612}
2613
2614
2615/***/ }),
2616/* 55 */
2617/***/ (function(module, __webpack_exports__, __webpack_require__) {
2618
2619"use strict";
2620/* harmony export (immutable) */ __webpack_exports__["a"] = matcher;
2621/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__extendOwn_js__ = __webpack_require__(77);
2622/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isMatch_js__ = __webpack_require__(116);
2623
2624
2625
2626// Returns a predicate for checking whether an object has a given set of
2627// `key:value` pairs.
2628function matcher(attrs) {
2629 attrs = Object(__WEBPACK_IMPORTED_MODULE_0__extendOwn_js__["a" /* default */])({}, attrs);
2630 return function(obj) {
2631 return Object(__WEBPACK_IMPORTED_MODULE_1__isMatch_js__["a" /* default */])(obj, attrs);
2632 };
2633}
2634
2635
2636/***/ }),
2637/* 56 */
2638/***/ (function(module, __webpack_exports__, __webpack_require__) {
2639
2640"use strict";
2641/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(9);
2642/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__executeBound_js__ = __webpack_require__(132);
2643/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__underscore_js__ = __webpack_require__(10);
2644
2645
2646
2647
2648// Partially apply a function by creating a version that has had some of its
2649// arguments pre-filled, without changing its dynamic `this` context. `_` acts
2650// as a placeholder by default, allowing any combination of arguments to be
2651// pre-filled. Set `_.partial.placeholder` for a custom placeholder argument.
2652var partial = Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(func, boundArgs) {
2653 var placeholder = partial.placeholder;
2654 var bound = function() {
2655 var position = 0, length = boundArgs.length;
2656 var args = Array(length);
2657 for (var i = 0; i < length; i++) {
2658 args[i] = boundArgs[i] === placeholder ? arguments[position++] : boundArgs[i];
2659 }
2660 while (position < arguments.length) args.push(arguments[position++]);
2661 return Object(__WEBPACK_IMPORTED_MODULE_1__executeBound_js__["a" /* default */])(func, bound, this, this, args);
2662 };
2663 return bound;
2664});
2665
2666partial.placeholder = __WEBPACK_IMPORTED_MODULE_2__underscore_js__["a" /* default */];
2667/* harmony default export */ __webpack_exports__["a"] = (partial);
2668
2669
2670/***/ }),
2671/* 57 */
2672/***/ (function(module, __webpack_exports__, __webpack_require__) {
2673
2674"use strict";
2675/* harmony export (immutable) */ __webpack_exports__["a"] = group;
2676/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(8);
2677/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__each_js__ = __webpack_require__(28);
2678
2679
2680
2681// An internal function used for aggregate "group by" operations.
2682function group(behavior, partition) {
2683 return function(obj, iteratee, context) {
2684 var result = partition ? [[], []] : {};
2685 iteratee = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(iteratee, context);
2686 Object(__WEBPACK_IMPORTED_MODULE_1__each_js__["a" /* default */])(obj, function(value, index) {
2687 var key = iteratee(value, index, obj);
2688 behavior(result, value, key);
2689 });
2690 return result;
2691 };
2692}
2693
2694
2695/***/ }),
2696/* 58 */
2697/***/ (function(module, exports, __webpack_require__) {
2698
2699"use strict";
2700
2701
2702var _stringify = __webpack_require__(18);
2703
2704var _stringify2 = _interopRequireDefault(_stringify);
2705
2706var _typeof2 = __webpack_require__(59);
2707
2708var _typeof3 = _interopRequireDefault(_typeof2);
2709
2710var _keys = __webpack_require__(153);
2711
2712var _keys2 = _interopRequireDefault(_keys);
2713
2714function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
2715
2716var _ = __webpack_require__(0);
2717
2718var _require = __webpack_require__(285),
2719 timeout = _require.timeout;
2720
2721var debug = __webpack_require__(35);
2722var debugRequest = debug('leancloud:request');
2723var debugRequestError = debug('leancloud:request:error');
2724
2725var _require2 = __webpack_require__(36),
2726 getAdapter = _require2.getAdapter;
2727
2728var requestsCount = 0;
2729
2730var ajax = function ajax(_ref) {
2731 var method = _ref.method,
2732 url = _ref.url,
2733 query = _ref.query,
2734 data = _ref.data,
2735 _ref$headers = _ref.headers,
2736 headers = _ref$headers === undefined ? {} : _ref$headers,
2737 time = _ref.timeout,
2738 onprogress = _ref.onprogress;
2739
2740 if (query) {
2741 var queryString = (0, _keys2.default)(query).map(function (key) {
2742 var value = query[key];
2743 if (value === undefined) return undefined;
2744 var v = (typeof value === 'undefined' ? 'undefined' : (0, _typeof3.default)(value)) === 'object' ? (0, _stringify2.default)(value) : value;
2745 return encodeURIComponent(key) + '=' + encodeURIComponent(v);
2746 }).filter(function (qs) {
2747 return qs;
2748 }).join('&');
2749 url = url + '?' + queryString;
2750 }
2751
2752 var count = requestsCount++;
2753 debugRequest('request(%d) %s %s %o %o %o', count, method, url, query, data, headers);
2754
2755 var request = getAdapter('request');
2756 var promise = request(url, { method: method, headers: headers, data: data, onprogress: onprogress }).then(function (response) {
2757 debugRequest('response(%d) %d %O %o', count, response.status, response.data || response.text, response.header);
2758 if (response.ok === false) {
2759 var error = new Error();
2760 error.response = response;
2761 throw error;
2762 }
2763 return response.data;
2764 }).catch(function (error) {
2765 if (error.response) {
2766 if (!debug.enabled('leancloud:request')) {
2767 debugRequestError('request(%d) %s %s %o %o %o', count, method, url, query, data, headers);
2768 }
2769 debugRequestError('response(%d) %d %O %o', count, error.response.status, error.response.data || error.response.text, error.response.header);
2770 error.statusCode = error.response.status;
2771 error.responseText = error.response.text;
2772 error.response = error.response.data;
2773 }
2774 throw error;
2775 });
2776 return time ? timeout(promise, time) : promise;
2777};
2778
2779module.exports = ajax;
2780
2781/***/ }),
2782/* 59 */
2783/***/ (function(module, exports, __webpack_require__) {
2784
2785"use strict";
2786
2787
2788exports.__esModule = true;
2789
2790var _iterator = __webpack_require__(274);
2791
2792var _iterator2 = _interopRequireDefault(_iterator);
2793
2794var _symbol = __webpack_require__(276);
2795
2796var _symbol2 = _interopRequireDefault(_symbol);
2797
2798var _typeof = typeof _symbol2.default === "function" && typeof _iterator2.default === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof _symbol2.default === "function" && obj.constructor === _symbol2.default && obj !== _symbol2.default.prototype ? "symbol" : typeof obj; };
2799
2800function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
2801
2802exports.default = typeof _symbol2.default === "function" && _typeof(_iterator2.default) === "symbol" ? function (obj) {
2803 return typeof obj === "undefined" ? "undefined" : _typeof(obj);
2804} : function (obj) {
2805 return obj && typeof _symbol2.default === "function" && obj.constructor === _symbol2.default && obj !== _symbol2.default.prototype ? "symbol" : typeof obj === "undefined" ? "undefined" : _typeof(obj);
2806};
2807
2808/***/ }),
2809/* 60 */
2810/***/ (function(module, exports) {
2811
2812// 7.1.4 ToInteger
2813var ceil = Math.ceil;
2814var floor = Math.floor;
2815module.exports = function (it) {
2816 return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it);
2817};
2818
2819
2820/***/ }),
2821/* 61 */
2822/***/ (function(module, exports) {
2823
2824// 7.2.1 RequireObjectCoercible(argument)
2825module.exports = function (it) {
2826 if (it == undefined) throw TypeError("Can't call method on " + it);
2827 return it;
2828};
2829
2830
2831/***/ }),
2832/* 62 */
2833/***/ (function(module, exports, __webpack_require__) {
2834
2835var isObject = __webpack_require__(20);
2836var document = __webpack_require__(6).document;
2837// typeof document.createElement is 'object' in old IE
2838var is = isObject(document) && isObject(document.createElement);
2839module.exports = function (it) {
2840 return is ? document.createElement(it) : {};
2841};
2842
2843
2844/***/ }),
2845/* 63 */
2846/***/ (function(module, exports, __webpack_require__) {
2847
2848// 7.1.1 ToPrimitive(input [, PreferredType])
2849var isObject = __webpack_require__(20);
2850// instead of the ES6 spec version, we didn't implement @@toPrimitive case
2851// and the second argument - flag - preferred type is a string
2852module.exports = function (it, S) {
2853 if (!isObject(it)) return it;
2854 var fn, val;
2855 if (S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val;
2856 if (typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it))) return val;
2857 if (!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val;
2858 throw TypeError("Can't convert object to primitive value");
2859};
2860
2861
2862/***/ }),
2863/* 64 */
2864/***/ (function(module, exports, __webpack_require__) {
2865
2866// 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties])
2867var anObject = __webpack_require__(16);
2868var dPs = __webpack_require__(169);
2869var enumBugKeys = __webpack_require__(67);
2870var IE_PROTO = __webpack_require__(65)('IE_PROTO');
2871var Empty = function () { /* empty */ };
2872var PROTOTYPE = 'prototype';
2873
2874// Create object with fake `null` prototype: use iframe Object with cleared prototype
2875var createDict = function () {
2876 // Thrash, waste and sodomy: IE GC bug
2877 var iframe = __webpack_require__(62)('iframe');
2878 var i = enumBugKeys.length;
2879 var lt = '<';
2880 var gt = '>';
2881 var iframeDocument;
2882 iframe.style.display = 'none';
2883 __webpack_require__(97).appendChild(iframe);
2884 iframe.src = 'javascript:'; // eslint-disable-line no-script-url
2885 // createDict = iframe.contentWindow.Object;
2886 // html.removeChild(iframe);
2887 iframeDocument = iframe.contentWindow.document;
2888 iframeDocument.open();
2889 iframeDocument.write(lt + 'script' + gt + 'document.F=Object' + lt + '/script' + gt);
2890 iframeDocument.close();
2891 createDict = iframeDocument.F;
2892 while (i--) delete createDict[PROTOTYPE][enumBugKeys[i]];
2893 return createDict();
2894};
2895
2896module.exports = Object.create || function create(O, Properties) {
2897 var result;
2898 if (O !== null) {
2899 Empty[PROTOTYPE] = anObject(O);
2900 result = new Empty();
2901 Empty[PROTOTYPE] = null;
2902 // add "__proto__" for Object.getPrototypeOf polyfill
2903 result[IE_PROTO] = O;
2904 } else result = createDict();
2905 return Properties === undefined ? result : dPs(result, Properties);
2906};
2907
2908
2909/***/ }),
2910/* 65 */
2911/***/ (function(module, exports, __webpack_require__) {
2912
2913var shared = __webpack_require__(66)('keys');
2914var uid = __webpack_require__(51);
2915module.exports = function (key) {
2916 return shared[key] || (shared[key] = uid(key));
2917};
2918
2919
2920/***/ }),
2921/* 66 */
2922/***/ (function(module, exports, __webpack_require__) {
2923
2924var core = __webpack_require__(2);
2925var global = __webpack_require__(6);
2926var SHARED = '__core-js_shared__';
2927var store = global[SHARED] || (global[SHARED] = {});
2928
2929(module.exports = function (key, value) {
2930 return store[key] || (store[key] = value !== undefined ? value : {});
2931})('versions', []).push({
2932 version: core.version,
2933 mode: __webpack_require__(37) ? 'pure' : 'global',
2934 copyright: '© 2019 Denis Pushkarev (zloirock.ru)'
2935});
2936
2937
2938/***/ }),
2939/* 67 */
2940/***/ (function(module, exports) {
2941
2942// IE 8- don't enum bug keys
2943module.exports = (
2944 'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf'
2945).split(',');
2946
2947
2948/***/ }),
2949/* 68 */
2950/***/ (function(module, exports, __webpack_require__) {
2951
2952// getting tag from 19.1.3.6 Object.prototype.toString()
2953var cof = __webpack_require__(40);
2954var TAG = __webpack_require__(7)('toStringTag');
2955// ES3 wrong here
2956var ARG = cof(function () { return arguments; }()) == 'Arguments';
2957
2958// fallback for IE11 Script Access Denied error
2959var tryGet = function (it, key) {
2960 try {
2961 return it[key];
2962 } catch (e) { /* empty */ }
2963};
2964
2965module.exports = function (it) {
2966 var O, T, B;
2967 return it === undefined ? 'Undefined' : it === null ? 'Null'
2968 // @@toStringTag case
2969 : typeof (T = tryGet(O = Object(it), TAG)) == 'string' ? T
2970 // builtinTag case
2971 : ARG ? cof(O)
2972 // ES3 arguments fallback
2973 : (B = cof(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : B;
2974};
2975
2976
2977/***/ }),
2978/* 69 */
2979/***/ (function(module, exports, __webpack_require__) {
2980
2981"use strict";
2982
2983// 25.4.1.5 NewPromiseCapability(C)
2984var aFunction = __webpack_require__(48);
2985
2986function PromiseCapability(C) {
2987 var resolve, reject;
2988 this.promise = new C(function ($$resolve, $$reject) {
2989 if (resolve !== undefined || reject !== undefined) throw TypeError('Bad Promise constructor');
2990 resolve = $$resolve;
2991 reject = $$reject;
2992 });
2993 this.resolve = aFunction(resolve);
2994 this.reject = aFunction(reject);
2995}
2996
2997module.exports.f = function (C) {
2998 return new PromiseCapability(C);
2999};
3000
3001
3002/***/ }),
3003/* 70 */
3004/***/ (function(module, __webpack_exports__, __webpack_require__) {
3005
3006"use strict";
3007Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
3008/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(1);
3009/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "VERSION", function() { return __WEBPACK_IMPORTED_MODULE_0__setup_js__["e"]; });
3010/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__restArguments_js__ = __webpack_require__(9);
3011/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "restArguments", function() { return __WEBPACK_IMPORTED_MODULE_1__restArguments_js__["a"]; });
3012/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__isObject_js__ = __webpack_require__(26);
3013/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isObject", function() { return __WEBPACK_IMPORTED_MODULE_2__isObject_js__["a"]; });
3014/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__isNull_js__ = __webpack_require__(190);
3015/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isNull", function() { return __WEBPACK_IMPORTED_MODULE_3__isNull_js__["a"]; });
3016/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__isUndefined_js__ = __webpack_require__(105);
3017/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isUndefined", function() { return __WEBPACK_IMPORTED_MODULE_4__isUndefined_js__["a"]; });
3018/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__isBoolean_js__ = __webpack_require__(106);
3019/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isBoolean", function() { return __WEBPACK_IMPORTED_MODULE_5__isBoolean_js__["a"]; });
3020/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__isElement_js__ = __webpack_require__(191);
3021/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isElement", function() { return __WEBPACK_IMPORTED_MODULE_6__isElement_js__["a"]; });
3022/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__isString_js__ = __webpack_require__(71);
3023/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isString", function() { return __WEBPACK_IMPORTED_MODULE_7__isString_js__["a"]; });
3024/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__isNumber_js__ = __webpack_require__(107);
3025/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isNumber", function() { return __WEBPACK_IMPORTED_MODULE_8__isNumber_js__["a"]; });
3026/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__isDate_js__ = __webpack_require__(192);
3027/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isDate", function() { return __WEBPACK_IMPORTED_MODULE_9__isDate_js__["a"]; });
3028/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__isRegExp_js__ = __webpack_require__(193);
3029/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isRegExp", function() { return __WEBPACK_IMPORTED_MODULE_10__isRegExp_js__["a"]; });
3030/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__isError_js__ = __webpack_require__(194);
3031/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isError", function() { return __WEBPACK_IMPORTED_MODULE_11__isError_js__["a"]; });
3032/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__isSymbol_js__ = __webpack_require__(108);
3033/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isSymbol", function() { return __WEBPACK_IMPORTED_MODULE_12__isSymbol_js__["a"]; });
3034/* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__isArrayBuffer_js__ = __webpack_require__(109);
3035/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isArrayBuffer", function() { return __WEBPACK_IMPORTED_MODULE_13__isArrayBuffer_js__["a"]; });
3036/* harmony import */ var __WEBPACK_IMPORTED_MODULE_14__isDataView_js__ = __webpack_require__(72);
3037/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isDataView", function() { return __WEBPACK_IMPORTED_MODULE_14__isDataView_js__["a"]; });
3038/* harmony import */ var __WEBPACK_IMPORTED_MODULE_15__isArray_js__ = __webpack_require__(27);
3039/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isArray", function() { return __WEBPACK_IMPORTED_MODULE_15__isArray_js__["a"]; });
3040/* harmony import */ var __WEBPACK_IMPORTED_MODULE_16__isFunction_js__ = __webpack_require__(13);
3041/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isFunction", function() { return __WEBPACK_IMPORTED_MODULE_16__isFunction_js__["a"]; });
3042/* harmony import */ var __WEBPACK_IMPORTED_MODULE_17__isArguments_js__ = __webpack_require__(73);
3043/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isArguments", function() { return __WEBPACK_IMPORTED_MODULE_17__isArguments_js__["a"]; });
3044/* harmony import */ var __WEBPACK_IMPORTED_MODULE_18__isFinite_js__ = __webpack_require__(196);
3045/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isFinite", function() { return __WEBPACK_IMPORTED_MODULE_18__isFinite_js__["a"]; });
3046/* harmony import */ var __WEBPACK_IMPORTED_MODULE_19__isNaN_js__ = __webpack_require__(110);
3047/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isNaN", function() { return __WEBPACK_IMPORTED_MODULE_19__isNaN_js__["a"]; });
3048/* harmony import */ var __WEBPACK_IMPORTED_MODULE_20__isTypedArray_js__ = __webpack_require__(111);
3049/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isTypedArray", function() { return __WEBPACK_IMPORTED_MODULE_20__isTypedArray_js__["a"]; });
3050/* harmony import */ var __WEBPACK_IMPORTED_MODULE_21__isEmpty_js__ = __webpack_require__(198);
3051/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isEmpty", function() { return __WEBPACK_IMPORTED_MODULE_21__isEmpty_js__["a"]; });
3052/* harmony import */ var __WEBPACK_IMPORTED_MODULE_22__isMatch_js__ = __webpack_require__(116);
3053/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isMatch", function() { return __WEBPACK_IMPORTED_MODULE_22__isMatch_js__["a"]; });
3054/* harmony import */ var __WEBPACK_IMPORTED_MODULE_23__isEqual_js__ = __webpack_require__(199);
3055/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isEqual", function() { return __WEBPACK_IMPORTED_MODULE_23__isEqual_js__["a"]; });
3056/* harmony import */ var __WEBPACK_IMPORTED_MODULE_24__isMap_js__ = __webpack_require__(201);
3057/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isMap", function() { return __WEBPACK_IMPORTED_MODULE_24__isMap_js__["a"]; });
3058/* harmony import */ var __WEBPACK_IMPORTED_MODULE_25__isWeakMap_js__ = __webpack_require__(202);
3059/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isWeakMap", function() { return __WEBPACK_IMPORTED_MODULE_25__isWeakMap_js__["a"]; });
3060/* harmony import */ var __WEBPACK_IMPORTED_MODULE_26__isSet_js__ = __webpack_require__(203);
3061/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isSet", function() { return __WEBPACK_IMPORTED_MODULE_26__isSet_js__["a"]; });
3062/* harmony import */ var __WEBPACK_IMPORTED_MODULE_27__isWeakSet_js__ = __webpack_require__(204);
3063/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isWeakSet", function() { return __WEBPACK_IMPORTED_MODULE_27__isWeakSet_js__["a"]; });
3064/* harmony import */ var __WEBPACK_IMPORTED_MODULE_28__keys_js__ = __webpack_require__(3);
3065/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "keys", function() { return __WEBPACK_IMPORTED_MODULE_28__keys_js__["a"]; });
3066/* harmony import */ var __WEBPACK_IMPORTED_MODULE_29__allKeys_js__ = __webpack_require__(42);
3067/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "allKeys", function() { return __WEBPACK_IMPORTED_MODULE_29__allKeys_js__["a"]; });
3068/* harmony import */ var __WEBPACK_IMPORTED_MODULE_30__values_js__ = __webpack_require__(31);
3069/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "values", function() { return __WEBPACK_IMPORTED_MODULE_30__values_js__["a"]; });
3070/* harmony import */ var __WEBPACK_IMPORTED_MODULE_31__pairs_js__ = __webpack_require__(205);
3071/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "pairs", function() { return __WEBPACK_IMPORTED_MODULE_31__pairs_js__["a"]; });
3072/* harmony import */ var __WEBPACK_IMPORTED_MODULE_32__invert_js__ = __webpack_require__(117);
3073/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "invert", function() { return __WEBPACK_IMPORTED_MODULE_32__invert_js__["a"]; });
3074/* harmony import */ var __WEBPACK_IMPORTED_MODULE_33__functions_js__ = __webpack_require__(118);
3075/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "functions", function() { return __WEBPACK_IMPORTED_MODULE_33__functions_js__["a"]; });
3076/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "methods", function() { return __WEBPACK_IMPORTED_MODULE_33__functions_js__["a"]; });
3077/* harmony import */ var __WEBPACK_IMPORTED_MODULE_34__extend_js__ = __webpack_require__(119);
3078/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "extend", function() { return __WEBPACK_IMPORTED_MODULE_34__extend_js__["a"]; });
3079/* harmony import */ var __WEBPACK_IMPORTED_MODULE_35__extendOwn_js__ = __webpack_require__(77);
3080/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "extendOwn", function() { return __WEBPACK_IMPORTED_MODULE_35__extendOwn_js__["a"]; });
3081/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "assign", function() { return __WEBPACK_IMPORTED_MODULE_35__extendOwn_js__["a"]; });
3082/* harmony import */ var __WEBPACK_IMPORTED_MODULE_36__defaults_js__ = __webpack_require__(120);
3083/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "defaults", function() { return __WEBPACK_IMPORTED_MODULE_36__defaults_js__["a"]; });
3084/* harmony import */ var __WEBPACK_IMPORTED_MODULE_37__create_js__ = __webpack_require__(206);
3085/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "create", function() { return __WEBPACK_IMPORTED_MODULE_37__create_js__["a"]; });
3086/* harmony import */ var __WEBPACK_IMPORTED_MODULE_38__clone_js__ = __webpack_require__(122);
3087/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "clone", function() { return __WEBPACK_IMPORTED_MODULE_38__clone_js__["a"]; });
3088/* harmony import */ var __WEBPACK_IMPORTED_MODULE_39__tap_js__ = __webpack_require__(207);
3089/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "tap", function() { return __WEBPACK_IMPORTED_MODULE_39__tap_js__["a"]; });
3090/* harmony import */ var __WEBPACK_IMPORTED_MODULE_40__get_js__ = __webpack_require__(123);
3091/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "get", function() { return __WEBPACK_IMPORTED_MODULE_40__get_js__["a"]; });
3092/* harmony import */ var __WEBPACK_IMPORTED_MODULE_41__has_js__ = __webpack_require__(208);
3093/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "has", function() { return __WEBPACK_IMPORTED_MODULE_41__has_js__["a"]; });
3094/* harmony import */ var __WEBPACK_IMPORTED_MODULE_42__mapObject_js__ = __webpack_require__(209);
3095/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "mapObject", function() { return __WEBPACK_IMPORTED_MODULE_42__mapObject_js__["a"]; });
3096/* harmony import */ var __WEBPACK_IMPORTED_MODULE_43__identity_js__ = __webpack_require__(79);
3097/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "identity", function() { return __WEBPACK_IMPORTED_MODULE_43__identity_js__["a"]; });
3098/* harmony import */ var __WEBPACK_IMPORTED_MODULE_44__constant_js__ = __webpack_require__(112);
3099/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "constant", function() { return __WEBPACK_IMPORTED_MODULE_44__constant_js__["a"]; });
3100/* harmony import */ var __WEBPACK_IMPORTED_MODULE_45__noop_js__ = __webpack_require__(127);
3101/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "noop", function() { return __WEBPACK_IMPORTED_MODULE_45__noop_js__["a"]; });
3102/* harmony import */ var __WEBPACK_IMPORTED_MODULE_46__toPath_js__ = __webpack_require__(124);
3103/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "toPath", function() { return __WEBPACK_IMPORTED_MODULE_46__toPath_js__["a"]; });
3104/* harmony import */ var __WEBPACK_IMPORTED_MODULE_47__property_js__ = __webpack_require__(80);
3105/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "property", function() { return __WEBPACK_IMPORTED_MODULE_47__property_js__["a"]; });
3106/* harmony import */ var __WEBPACK_IMPORTED_MODULE_48__propertyOf_js__ = __webpack_require__(210);
3107/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "propertyOf", function() { return __WEBPACK_IMPORTED_MODULE_48__propertyOf_js__["a"]; });
3108/* harmony import */ var __WEBPACK_IMPORTED_MODULE_49__matcher_js__ = __webpack_require__(55);
3109/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "matcher", function() { return __WEBPACK_IMPORTED_MODULE_49__matcher_js__["a"]; });
3110/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "matches", function() { return __WEBPACK_IMPORTED_MODULE_49__matcher_js__["a"]; });
3111/* harmony import */ var __WEBPACK_IMPORTED_MODULE_50__times_js__ = __webpack_require__(211);
3112/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "times", function() { return __WEBPACK_IMPORTED_MODULE_50__times_js__["a"]; });
3113/* harmony import */ var __WEBPACK_IMPORTED_MODULE_51__random_js__ = __webpack_require__(128);
3114/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "random", function() { return __WEBPACK_IMPORTED_MODULE_51__random_js__["a"]; });
3115/* harmony import */ var __WEBPACK_IMPORTED_MODULE_52__now_js__ = __webpack_require__(81);
3116/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "now", function() { return __WEBPACK_IMPORTED_MODULE_52__now_js__["a"]; });
3117/* harmony import */ var __WEBPACK_IMPORTED_MODULE_53__escape_js__ = __webpack_require__(212);
3118/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "escape", function() { return __WEBPACK_IMPORTED_MODULE_53__escape_js__["a"]; });
3119/* harmony import */ var __WEBPACK_IMPORTED_MODULE_54__unescape_js__ = __webpack_require__(213);
3120/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "unescape", function() { return __WEBPACK_IMPORTED_MODULE_54__unescape_js__["a"]; });
3121/* harmony import */ var __WEBPACK_IMPORTED_MODULE_55__templateSettings_js__ = __webpack_require__(131);
3122/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "templateSettings", function() { return __WEBPACK_IMPORTED_MODULE_55__templateSettings_js__["a"]; });
3123/* harmony import */ var __WEBPACK_IMPORTED_MODULE_56__template_js__ = __webpack_require__(215);
3124/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "template", function() { return __WEBPACK_IMPORTED_MODULE_56__template_js__["a"]; });
3125/* harmony import */ var __WEBPACK_IMPORTED_MODULE_57__result_js__ = __webpack_require__(216);
3126/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "result", function() { return __WEBPACK_IMPORTED_MODULE_57__result_js__["a"]; });
3127/* harmony import */ var __WEBPACK_IMPORTED_MODULE_58__uniqueId_js__ = __webpack_require__(217);
3128/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "uniqueId", function() { return __WEBPACK_IMPORTED_MODULE_58__uniqueId_js__["a"]; });
3129/* harmony import */ var __WEBPACK_IMPORTED_MODULE_59__chain_js__ = __webpack_require__(218);
3130/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "chain", function() { return __WEBPACK_IMPORTED_MODULE_59__chain_js__["a"]; });
3131/* harmony import */ var __WEBPACK_IMPORTED_MODULE_60__iteratee_js__ = __webpack_require__(126);
3132/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "iteratee", function() { return __WEBPACK_IMPORTED_MODULE_60__iteratee_js__["a"]; });
3133/* harmony import */ var __WEBPACK_IMPORTED_MODULE_61__partial_js__ = __webpack_require__(56);
3134/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "partial", function() { return __WEBPACK_IMPORTED_MODULE_61__partial_js__["a"]; });
3135/* harmony import */ var __WEBPACK_IMPORTED_MODULE_62__bind_js__ = __webpack_require__(133);
3136/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "bind", function() { return __WEBPACK_IMPORTED_MODULE_62__bind_js__["a"]; });
3137/* harmony import */ var __WEBPACK_IMPORTED_MODULE_63__bindAll_js__ = __webpack_require__(219);
3138/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "bindAll", function() { return __WEBPACK_IMPORTED_MODULE_63__bindAll_js__["a"]; });
3139/* harmony import */ var __WEBPACK_IMPORTED_MODULE_64__memoize_js__ = __webpack_require__(220);
3140/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "memoize", function() { return __WEBPACK_IMPORTED_MODULE_64__memoize_js__["a"]; });
3141/* harmony import */ var __WEBPACK_IMPORTED_MODULE_65__delay_js__ = __webpack_require__(134);
3142/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "delay", function() { return __WEBPACK_IMPORTED_MODULE_65__delay_js__["a"]; });
3143/* harmony import */ var __WEBPACK_IMPORTED_MODULE_66__defer_js__ = __webpack_require__(221);
3144/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "defer", function() { return __WEBPACK_IMPORTED_MODULE_66__defer_js__["a"]; });
3145/* harmony import */ var __WEBPACK_IMPORTED_MODULE_67__throttle_js__ = __webpack_require__(222);
3146/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "throttle", function() { return __WEBPACK_IMPORTED_MODULE_67__throttle_js__["a"]; });
3147/* harmony import */ var __WEBPACK_IMPORTED_MODULE_68__debounce_js__ = __webpack_require__(223);
3148/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "debounce", function() { return __WEBPACK_IMPORTED_MODULE_68__debounce_js__["a"]; });
3149/* harmony import */ var __WEBPACK_IMPORTED_MODULE_69__wrap_js__ = __webpack_require__(224);
3150/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "wrap", function() { return __WEBPACK_IMPORTED_MODULE_69__wrap_js__["a"]; });
3151/* harmony import */ var __WEBPACK_IMPORTED_MODULE_70__negate_js__ = __webpack_require__(82);
3152/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "negate", function() { return __WEBPACK_IMPORTED_MODULE_70__negate_js__["a"]; });
3153/* harmony import */ var __WEBPACK_IMPORTED_MODULE_71__compose_js__ = __webpack_require__(225);
3154/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "compose", function() { return __WEBPACK_IMPORTED_MODULE_71__compose_js__["a"]; });
3155/* harmony import */ var __WEBPACK_IMPORTED_MODULE_72__after_js__ = __webpack_require__(226);
3156/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "after", function() { return __WEBPACK_IMPORTED_MODULE_72__after_js__["a"]; });
3157/* harmony import */ var __WEBPACK_IMPORTED_MODULE_73__before_js__ = __webpack_require__(135);
3158/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "before", function() { return __WEBPACK_IMPORTED_MODULE_73__before_js__["a"]; });
3159/* harmony import */ var __WEBPACK_IMPORTED_MODULE_74__once_js__ = __webpack_require__(227);
3160/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "once", function() { return __WEBPACK_IMPORTED_MODULE_74__once_js__["a"]; });
3161/* harmony import */ var __WEBPACK_IMPORTED_MODULE_75__findKey_js__ = __webpack_require__(136);
3162/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "findKey", function() { return __WEBPACK_IMPORTED_MODULE_75__findKey_js__["a"]; });
3163/* harmony import */ var __WEBPACK_IMPORTED_MODULE_76__findIndex_js__ = __webpack_require__(83);
3164/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "findIndex", function() { return __WEBPACK_IMPORTED_MODULE_76__findIndex_js__["a"]; });
3165/* harmony import */ var __WEBPACK_IMPORTED_MODULE_77__findLastIndex_js__ = __webpack_require__(138);
3166/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "findLastIndex", function() { return __WEBPACK_IMPORTED_MODULE_77__findLastIndex_js__["a"]; });
3167/* harmony import */ var __WEBPACK_IMPORTED_MODULE_78__sortedIndex_js__ = __webpack_require__(139);
3168/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "sortedIndex", function() { return __WEBPACK_IMPORTED_MODULE_78__sortedIndex_js__["a"]; });
3169/* harmony import */ var __WEBPACK_IMPORTED_MODULE_79__indexOf_js__ = __webpack_require__(140);
3170/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "indexOf", function() { return __WEBPACK_IMPORTED_MODULE_79__indexOf_js__["a"]; });
3171/* harmony import */ var __WEBPACK_IMPORTED_MODULE_80__lastIndexOf_js__ = __webpack_require__(228);
3172/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "lastIndexOf", function() { return __WEBPACK_IMPORTED_MODULE_80__lastIndexOf_js__["a"]; });
3173/* harmony import */ var __WEBPACK_IMPORTED_MODULE_81__find_js__ = __webpack_require__(142);
3174/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "find", function() { return __WEBPACK_IMPORTED_MODULE_81__find_js__["a"]; });
3175/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "detect", function() { return __WEBPACK_IMPORTED_MODULE_81__find_js__["a"]; });
3176/* harmony import */ var __WEBPACK_IMPORTED_MODULE_82__findWhere_js__ = __webpack_require__(229);
3177/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "findWhere", function() { return __WEBPACK_IMPORTED_MODULE_82__findWhere_js__["a"]; });
3178/* harmony import */ var __WEBPACK_IMPORTED_MODULE_83__each_js__ = __webpack_require__(28);
3179/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "each", function() { return __WEBPACK_IMPORTED_MODULE_83__each_js__["a"]; });
3180/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "forEach", function() { return __WEBPACK_IMPORTED_MODULE_83__each_js__["a"]; });
3181/* harmony import */ var __WEBPACK_IMPORTED_MODULE_84__map_js__ = __webpack_require__(33);
3182/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "map", function() { return __WEBPACK_IMPORTED_MODULE_84__map_js__["a"]; });
3183/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "collect", function() { return __WEBPACK_IMPORTED_MODULE_84__map_js__["a"]; });
3184/* harmony import */ var __WEBPACK_IMPORTED_MODULE_85__reduce_js__ = __webpack_require__(230);
3185/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "reduce", function() { return __WEBPACK_IMPORTED_MODULE_85__reduce_js__["a"]; });
3186/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "foldl", function() { return __WEBPACK_IMPORTED_MODULE_85__reduce_js__["a"]; });
3187/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "inject", function() { return __WEBPACK_IMPORTED_MODULE_85__reduce_js__["a"]; });
3188/* harmony import */ var __WEBPACK_IMPORTED_MODULE_86__reduceRight_js__ = __webpack_require__(231);
3189/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "reduceRight", function() { return __WEBPACK_IMPORTED_MODULE_86__reduceRight_js__["a"]; });
3190/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "foldr", function() { return __WEBPACK_IMPORTED_MODULE_86__reduceRight_js__["a"]; });
3191/* harmony import */ var __WEBPACK_IMPORTED_MODULE_87__filter_js__ = __webpack_require__(45);
3192/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "filter", function() { return __WEBPACK_IMPORTED_MODULE_87__filter_js__["a"]; });
3193/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "select", function() { return __WEBPACK_IMPORTED_MODULE_87__filter_js__["a"]; });
3194/* harmony import */ var __WEBPACK_IMPORTED_MODULE_88__reject_js__ = __webpack_require__(232);
3195/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "reject", function() { return __WEBPACK_IMPORTED_MODULE_88__reject_js__["a"]; });
3196/* harmony import */ var __WEBPACK_IMPORTED_MODULE_89__every_js__ = __webpack_require__(233);
3197/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "every", function() { return __WEBPACK_IMPORTED_MODULE_89__every_js__["a"]; });
3198/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "all", function() { return __WEBPACK_IMPORTED_MODULE_89__every_js__["a"]; });
3199/* harmony import */ var __WEBPACK_IMPORTED_MODULE_90__some_js__ = __webpack_require__(234);
3200/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "some", function() { return __WEBPACK_IMPORTED_MODULE_90__some_js__["a"]; });
3201/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "any", function() { return __WEBPACK_IMPORTED_MODULE_90__some_js__["a"]; });
3202/* harmony import */ var __WEBPACK_IMPORTED_MODULE_91__contains_js__ = __webpack_require__(46);
3203/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "contains", function() { return __WEBPACK_IMPORTED_MODULE_91__contains_js__["a"]; });
3204/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "includes", function() { return __WEBPACK_IMPORTED_MODULE_91__contains_js__["a"]; });
3205/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "include", function() { return __WEBPACK_IMPORTED_MODULE_91__contains_js__["a"]; });
3206/* harmony import */ var __WEBPACK_IMPORTED_MODULE_92__invoke_js__ = __webpack_require__(235);
3207/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "invoke", function() { return __WEBPACK_IMPORTED_MODULE_92__invoke_js__["a"]; });
3208/* harmony import */ var __WEBPACK_IMPORTED_MODULE_93__pluck_js__ = __webpack_require__(84);
3209/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "pluck", function() { return __WEBPACK_IMPORTED_MODULE_93__pluck_js__["a"]; });
3210/* harmony import */ var __WEBPACK_IMPORTED_MODULE_94__where_js__ = __webpack_require__(236);
3211/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "where", function() { return __WEBPACK_IMPORTED_MODULE_94__where_js__["a"]; });
3212/* harmony import */ var __WEBPACK_IMPORTED_MODULE_95__max_js__ = __webpack_require__(144);
3213/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "max", function() { return __WEBPACK_IMPORTED_MODULE_95__max_js__["a"]; });
3214/* harmony import */ var __WEBPACK_IMPORTED_MODULE_96__min_js__ = __webpack_require__(237);
3215/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "min", function() { return __WEBPACK_IMPORTED_MODULE_96__min_js__["a"]; });
3216/* harmony import */ var __WEBPACK_IMPORTED_MODULE_97__shuffle_js__ = __webpack_require__(238);
3217/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "shuffle", function() { return __WEBPACK_IMPORTED_MODULE_97__shuffle_js__["a"]; });
3218/* harmony import */ var __WEBPACK_IMPORTED_MODULE_98__sample_js__ = __webpack_require__(145);
3219/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "sample", function() { return __WEBPACK_IMPORTED_MODULE_98__sample_js__["a"]; });
3220/* harmony import */ var __WEBPACK_IMPORTED_MODULE_99__sortBy_js__ = __webpack_require__(239);
3221/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "sortBy", function() { return __WEBPACK_IMPORTED_MODULE_99__sortBy_js__["a"]; });
3222/* harmony import */ var __WEBPACK_IMPORTED_MODULE_100__groupBy_js__ = __webpack_require__(240);
3223/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "groupBy", function() { return __WEBPACK_IMPORTED_MODULE_100__groupBy_js__["a"]; });
3224/* harmony import */ var __WEBPACK_IMPORTED_MODULE_101__indexBy_js__ = __webpack_require__(241);
3225/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "indexBy", function() { return __WEBPACK_IMPORTED_MODULE_101__indexBy_js__["a"]; });
3226/* harmony import */ var __WEBPACK_IMPORTED_MODULE_102__countBy_js__ = __webpack_require__(242);
3227/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "countBy", function() { return __WEBPACK_IMPORTED_MODULE_102__countBy_js__["a"]; });
3228/* harmony import */ var __WEBPACK_IMPORTED_MODULE_103__partition_js__ = __webpack_require__(243);
3229/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "partition", function() { return __WEBPACK_IMPORTED_MODULE_103__partition_js__["a"]; });
3230/* harmony import */ var __WEBPACK_IMPORTED_MODULE_104__toArray_js__ = __webpack_require__(244);
3231/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "toArray", function() { return __WEBPACK_IMPORTED_MODULE_104__toArray_js__["a"]; });
3232/* harmony import */ var __WEBPACK_IMPORTED_MODULE_105__size_js__ = __webpack_require__(245);
3233/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "size", function() { return __WEBPACK_IMPORTED_MODULE_105__size_js__["a"]; });
3234/* harmony import */ var __WEBPACK_IMPORTED_MODULE_106__pick_js__ = __webpack_require__(146);
3235/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "pick", function() { return __WEBPACK_IMPORTED_MODULE_106__pick_js__["a"]; });
3236/* harmony import */ var __WEBPACK_IMPORTED_MODULE_107__omit_js__ = __webpack_require__(247);
3237/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "omit", function() { return __WEBPACK_IMPORTED_MODULE_107__omit_js__["a"]; });
3238/* harmony import */ var __WEBPACK_IMPORTED_MODULE_108__first_js__ = __webpack_require__(248);
3239/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "first", function() { return __WEBPACK_IMPORTED_MODULE_108__first_js__["a"]; });
3240/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "head", function() { return __WEBPACK_IMPORTED_MODULE_108__first_js__["a"]; });
3241/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "take", function() { return __WEBPACK_IMPORTED_MODULE_108__first_js__["a"]; });
3242/* harmony import */ var __WEBPACK_IMPORTED_MODULE_109__initial_js__ = __webpack_require__(147);
3243/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "initial", function() { return __WEBPACK_IMPORTED_MODULE_109__initial_js__["a"]; });
3244/* harmony import */ var __WEBPACK_IMPORTED_MODULE_110__last_js__ = __webpack_require__(249);
3245/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "last", function() { return __WEBPACK_IMPORTED_MODULE_110__last_js__["a"]; });
3246/* harmony import */ var __WEBPACK_IMPORTED_MODULE_111__rest_js__ = __webpack_require__(148);
3247/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "rest", function() { return __WEBPACK_IMPORTED_MODULE_111__rest_js__["a"]; });
3248/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "tail", function() { return __WEBPACK_IMPORTED_MODULE_111__rest_js__["a"]; });
3249/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "drop", function() { return __WEBPACK_IMPORTED_MODULE_111__rest_js__["a"]; });
3250/* harmony import */ var __WEBPACK_IMPORTED_MODULE_112__compact_js__ = __webpack_require__(250);
3251/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "compact", function() { return __WEBPACK_IMPORTED_MODULE_112__compact_js__["a"]; });
3252/* harmony import */ var __WEBPACK_IMPORTED_MODULE_113__flatten_js__ = __webpack_require__(251);
3253/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "flatten", function() { return __WEBPACK_IMPORTED_MODULE_113__flatten_js__["a"]; });
3254/* harmony import */ var __WEBPACK_IMPORTED_MODULE_114__without_js__ = __webpack_require__(252);
3255/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "without", function() { return __WEBPACK_IMPORTED_MODULE_114__without_js__["a"]; });
3256/* harmony import */ var __WEBPACK_IMPORTED_MODULE_115__uniq_js__ = __webpack_require__(150);
3257/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "uniq", function() { return __WEBPACK_IMPORTED_MODULE_115__uniq_js__["a"]; });
3258/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "unique", function() { return __WEBPACK_IMPORTED_MODULE_115__uniq_js__["a"]; });
3259/* harmony import */ var __WEBPACK_IMPORTED_MODULE_116__union_js__ = __webpack_require__(253);
3260/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "union", function() { return __WEBPACK_IMPORTED_MODULE_116__union_js__["a"]; });
3261/* harmony import */ var __WEBPACK_IMPORTED_MODULE_117__intersection_js__ = __webpack_require__(254);
3262/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "intersection", function() { return __WEBPACK_IMPORTED_MODULE_117__intersection_js__["a"]; });
3263/* harmony import */ var __WEBPACK_IMPORTED_MODULE_118__difference_js__ = __webpack_require__(149);
3264/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "difference", function() { return __WEBPACK_IMPORTED_MODULE_118__difference_js__["a"]; });
3265/* harmony import */ var __WEBPACK_IMPORTED_MODULE_119__unzip_js__ = __webpack_require__(151);
3266/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "unzip", function() { return __WEBPACK_IMPORTED_MODULE_119__unzip_js__["a"]; });
3267/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "transpose", function() { return __WEBPACK_IMPORTED_MODULE_119__unzip_js__["a"]; });
3268/* harmony import */ var __WEBPACK_IMPORTED_MODULE_120__zip_js__ = __webpack_require__(255);
3269/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "zip", function() { return __WEBPACK_IMPORTED_MODULE_120__zip_js__["a"]; });
3270/* harmony import */ var __WEBPACK_IMPORTED_MODULE_121__object_js__ = __webpack_require__(256);
3271/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "object", function() { return __WEBPACK_IMPORTED_MODULE_121__object_js__["a"]; });
3272/* harmony import */ var __WEBPACK_IMPORTED_MODULE_122__range_js__ = __webpack_require__(257);
3273/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "range", function() { return __WEBPACK_IMPORTED_MODULE_122__range_js__["a"]; });
3274/* harmony import */ var __WEBPACK_IMPORTED_MODULE_123__chunk_js__ = __webpack_require__(258);
3275/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "chunk", function() { return __WEBPACK_IMPORTED_MODULE_123__chunk_js__["a"]; });
3276/* harmony import */ var __WEBPACK_IMPORTED_MODULE_124__mixin_js__ = __webpack_require__(259);
3277/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "mixin", function() { return __WEBPACK_IMPORTED_MODULE_124__mixin_js__["a"]; });
3278/* harmony import */ var __WEBPACK_IMPORTED_MODULE_125__underscore_array_methods_js__ = __webpack_require__(260);
3279/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return __WEBPACK_IMPORTED_MODULE_125__underscore_array_methods_js__["a"]; });
3280// Named Exports
3281// =============
3282
3283// Underscore.js 1.12.1
3284// https://underscorejs.org
3285// (c) 2009-2020 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
3286// Underscore may be freely distributed under the MIT license.
3287
3288// Baseline setup.
3289
3290
3291
3292// Object Functions
3293// ----------------
3294// Our most fundamental functions operate on any JavaScript object.
3295// Most functions in Underscore depend on at least one function in this section.
3296
3297// A group of functions that check the types of core JavaScript values.
3298// These are often informally referred to as the "isType" functions.
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326// Functions that treat an object as a dictionary of key-value pairs.
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343// Utility Functions
3344// -----------------
3345// A bit of a grab bag: Predicate-generating functions for use with filters and
3346// loops, string escaping and templating, create random numbers and unique ids,
3347// and functions that facilitate Underscore's chaining and iteration conventions.
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367// Function (ahem) Functions
3368// -------------------------
3369// These functions take a function as an argument and return a new function
3370// as the result. Also known as higher-order functions.
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386// Finders
3387// -------
3388// Functions that extract (the position of) a single element from an object
3389// or array based on some criterion.
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399// Collection Functions
3400// --------------------
3401// Functions that work on any collection of elements: either an array, or
3402// an object of key-value pairs.
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427// `_.pick` and `_.omit` are actually object functions, but we put
3428// them here in order to create a more natural reading order in the
3429// monolithic build as they depend on `_.contains`.
3430
3431
3432
3433// Array Functions
3434// ---------------
3435// Functions that operate on arrays (and array-likes) only, because they’re
3436// expressed in terms of operations on an ordered list of values.
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454// OOP
3455// ---
3456// These modules support the "object-oriented" calling style. See also
3457// `underscore.js` and `index-default.js`.
3458
3459
3460
3461
3462/***/ }),
3463/* 71 */
3464/***/ (function(module, __webpack_exports__, __webpack_require__) {
3465
3466"use strict";
3467/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(5);
3468
3469
3470/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('String'));
3471
3472
3473/***/ }),
3474/* 72 */
3475/***/ (function(module, __webpack_exports__, __webpack_require__) {
3476
3477"use strict";
3478/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(5);
3479/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isFunction_js__ = __webpack_require__(13);
3480/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__isArrayBuffer_js__ = __webpack_require__(109);
3481/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__stringTagBug_js__ = __webpack_require__(41);
3482
3483
3484
3485
3486
3487var isDataView = Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('DataView');
3488
3489// In IE 10 - Edge 13, we need a different heuristic
3490// to determine whether an object is a `DataView`.
3491function ie10IsDataView(obj) {
3492 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);
3493}
3494
3495/* harmony default export */ __webpack_exports__["a"] = (__WEBPACK_IMPORTED_MODULE_3__stringTagBug_js__["a" /* hasStringTagBug */] ? ie10IsDataView : isDataView);
3496
3497
3498/***/ }),
3499/* 73 */
3500/***/ (function(module, __webpack_exports__, __webpack_require__) {
3501
3502"use strict";
3503/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(5);
3504/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__has_js__ = __webpack_require__(22);
3505
3506
3507
3508var isArguments = Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('Arguments');
3509
3510// Define a fallback version of the method in browsers (ahem, IE < 9), where
3511// there isn't any inspectable "Arguments" type.
3512(function() {
3513 if (!isArguments(arguments)) {
3514 isArguments = function(obj) {
3515 return Object(__WEBPACK_IMPORTED_MODULE_1__has_js__["a" /* default */])(obj, 'callee');
3516 };
3517 }
3518}());
3519
3520/* harmony default export */ __webpack_exports__["a"] = (isArguments);
3521
3522
3523/***/ }),
3524/* 74 */
3525/***/ (function(module, __webpack_exports__, __webpack_require__) {
3526
3527"use strict";
3528/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__shallowProperty_js__ = __webpack_require__(114);
3529
3530
3531// Internal helper to obtain the `byteLength` property of an object.
3532/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__shallowProperty_js__["a" /* default */])('byteLength'));
3533
3534
3535/***/ }),
3536/* 75 */
3537/***/ (function(module, __webpack_exports__, __webpack_require__) {
3538
3539"use strict";
3540/* harmony export (immutable) */ __webpack_exports__["a"] = ie11fingerprint;
3541/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return mapMethods; });
3542/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return weakMapMethods; });
3543/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return setMethods; });
3544/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__getLength_js__ = __webpack_require__(14);
3545/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isFunction_js__ = __webpack_require__(13);
3546/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__allKeys_js__ = __webpack_require__(42);
3547
3548
3549
3550
3551// Since the regular `Object.prototype.toString` type tests don't work for
3552// some types in IE 11, we use a fingerprinting heuristic instead, based
3553// on the methods. It's not great, but it's the best we got.
3554// The fingerprint method lists are defined below.
3555function ie11fingerprint(methods) {
3556 var length = Object(__WEBPACK_IMPORTED_MODULE_0__getLength_js__["a" /* default */])(methods);
3557 return function(obj) {
3558 if (obj == null) return false;
3559 // `Map`, `WeakMap` and `Set` have no enumerable keys.
3560 var keys = Object(__WEBPACK_IMPORTED_MODULE_2__allKeys_js__["a" /* default */])(obj);
3561 if (Object(__WEBPACK_IMPORTED_MODULE_0__getLength_js__["a" /* default */])(keys)) return false;
3562 for (var i = 0; i < length; i++) {
3563 if (!Object(__WEBPACK_IMPORTED_MODULE_1__isFunction_js__["a" /* default */])(obj[methods[i]])) return false;
3564 }
3565 // If we are testing against `WeakMap`, we need to ensure that
3566 // `obj` doesn't have a `forEach` method in order to distinguish
3567 // it from a regular `Map`.
3568 return methods !== weakMapMethods || !Object(__WEBPACK_IMPORTED_MODULE_1__isFunction_js__["a" /* default */])(obj[forEachName]);
3569 };
3570}
3571
3572// In the interest of compact minification, we write
3573// each string in the fingerprints only once.
3574var forEachName = 'forEach',
3575 hasName = 'has',
3576 commonInit = ['clear', 'delete'],
3577 mapTail = ['get', hasName, 'set'];
3578
3579// `Map`, `WeakMap` and `Set` each have slightly different
3580// combinations of the above sublists.
3581var mapMethods = commonInit.concat(forEachName, mapTail),
3582 weakMapMethods = commonInit.concat(mapTail),
3583 setMethods = ['add'].concat(commonInit, forEachName, hasName);
3584
3585
3586/***/ }),
3587/* 76 */
3588/***/ (function(module, __webpack_exports__, __webpack_require__) {
3589
3590"use strict";
3591/* harmony export (immutable) */ __webpack_exports__["a"] = createAssigner;
3592// An internal function for creating assigner functions.
3593function createAssigner(keysFunc, defaults) {
3594 return function(obj) {
3595 var length = arguments.length;
3596 if (defaults) obj = Object(obj);
3597 if (length < 2 || obj == null) return obj;
3598 for (var index = 1; index < length; index++) {
3599 var source = arguments[index],
3600 keys = keysFunc(source),
3601 l = keys.length;
3602 for (var i = 0; i < l; i++) {
3603 var key = keys[i];
3604 if (!defaults || obj[key] === void 0) obj[key] = source[key];
3605 }
3606 }
3607 return obj;
3608 };
3609}
3610
3611
3612/***/ }),
3613/* 77 */
3614/***/ (function(module, __webpack_exports__, __webpack_require__) {
3615
3616"use strict";
3617/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createAssigner_js__ = __webpack_require__(76);
3618/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__keys_js__ = __webpack_require__(3);
3619
3620
3621
3622// Assigns a given object with all the own properties in the passed-in
3623// object(s).
3624// (https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object/assign)
3625/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createAssigner_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__keys_js__["a" /* default */]));
3626
3627
3628/***/ }),
3629/* 78 */
3630/***/ (function(module, __webpack_exports__, __webpack_require__) {
3631
3632"use strict";
3633/* harmony export (immutable) */ __webpack_exports__["a"] = deepGet;
3634// Internal function to obtain a nested property in `obj` along `path`.
3635function deepGet(obj, path) {
3636 var length = path.length;
3637 for (var i = 0; i < length; i++) {
3638 if (obj == null) return void 0;
3639 obj = obj[path[i]];
3640 }
3641 return length ? obj : void 0;
3642}
3643
3644
3645/***/ }),
3646/* 79 */
3647/***/ (function(module, __webpack_exports__, __webpack_require__) {
3648
3649"use strict";
3650/* harmony export (immutable) */ __webpack_exports__["a"] = identity;
3651// Keep the identity function around for default iteratees.
3652function identity(value) {
3653 return value;
3654}
3655
3656
3657/***/ }),
3658/* 80 */
3659/***/ (function(module, __webpack_exports__, __webpack_require__) {
3660
3661"use strict";
3662/* harmony export (immutable) */ __webpack_exports__["a"] = property;
3663/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__deepGet_js__ = __webpack_require__(78);
3664/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__toPath_js__ = __webpack_require__(43);
3665
3666
3667
3668// Creates a function that, when passed an object, will traverse that object’s
3669// properties down the given `path`, specified as an array of keys or indices.
3670function property(path) {
3671 path = Object(__WEBPACK_IMPORTED_MODULE_1__toPath_js__["a" /* default */])(path);
3672 return function(obj) {
3673 return Object(__WEBPACK_IMPORTED_MODULE_0__deepGet_js__["a" /* default */])(obj, path);
3674 };
3675}
3676
3677
3678/***/ }),
3679/* 81 */
3680/***/ (function(module, __webpack_exports__, __webpack_require__) {
3681
3682"use strict";
3683// A (possibly faster) way to get the current timestamp as an integer.
3684/* harmony default export */ __webpack_exports__["a"] = (Date.now || function() {
3685 return new Date().getTime();
3686});
3687
3688
3689/***/ }),
3690/* 82 */
3691/***/ (function(module, __webpack_exports__, __webpack_require__) {
3692
3693"use strict";
3694/* harmony export (immutable) */ __webpack_exports__["a"] = negate;
3695// Returns a negated version of the passed-in predicate.
3696function negate(predicate) {
3697 return function() {
3698 return !predicate.apply(this, arguments);
3699 };
3700}
3701
3702
3703/***/ }),
3704/* 83 */
3705/***/ (function(module, __webpack_exports__, __webpack_require__) {
3706
3707"use strict";
3708/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createPredicateIndexFinder_js__ = __webpack_require__(137);
3709
3710
3711// Returns the first index on an array-like that passes a truth test.
3712/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createPredicateIndexFinder_js__["a" /* default */])(1));
3713
3714
3715/***/ }),
3716/* 84 */
3717/***/ (function(module, __webpack_exports__, __webpack_require__) {
3718
3719"use strict";
3720/* harmony export (immutable) */ __webpack_exports__["a"] = pluck;
3721/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__map_js__ = __webpack_require__(33);
3722/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__property_js__ = __webpack_require__(80);
3723
3724
3725
3726// Convenience version of a common use case of `_.map`: fetching a property.
3727function pluck(obj, key) {
3728 return Object(__WEBPACK_IMPORTED_MODULE_0__map_js__["a" /* default */])(obj, Object(__WEBPACK_IMPORTED_MODULE_1__property_js__["a" /* default */])(key));
3729}
3730
3731
3732/***/ }),
3733/* 85 */
3734/***/ (function(module, exports, __webpack_require__) {
3735
3736// most Object methods by ES6 should accept primitives
3737var $export = __webpack_require__(17);
3738var core = __webpack_require__(2);
3739var fails = __webpack_require__(39);
3740module.exports = function (KEY, exec) {
3741 var fn = (core.Object || {})[KEY] || Object[KEY];
3742 var exp = {};
3743 exp[KEY] = exec(fn);
3744 $export($export.S + $export.F * fails(function () { fn(1); }), 'Object', exp);
3745};
3746
3747
3748/***/ }),
3749/* 86 */
3750/***/ (function(module, exports, __webpack_require__) {
3751
3752module.exports = { "default": __webpack_require__(271), __esModule: true };
3753
3754/***/ }),
3755/* 87 */
3756/***/ (function(module, exports, __webpack_require__) {
3757
3758exports.f = __webpack_require__(7);
3759
3760
3761/***/ }),
3762/* 88 */
3763/***/ (function(module, exports, __webpack_require__) {
3764
3765var global = __webpack_require__(6);
3766var core = __webpack_require__(2);
3767var LIBRARY = __webpack_require__(37);
3768var wksExt = __webpack_require__(87);
3769var defineProperty = __webpack_require__(19).f;
3770module.exports = function (name) {
3771 var $Symbol = core.Symbol || (core.Symbol = LIBRARY ? {} : global.Symbol || {});
3772 if (name.charAt(0) != '_' && !(name in $Symbol)) defineProperty($Symbol, name, { value: wksExt.f(name) });
3773};
3774
3775
3776/***/ }),
3777/* 89 */
3778/***/ (function(module, exports) {
3779
3780exports.f = {}.propertyIsEnumerable;
3781
3782
3783/***/ }),
3784/* 90 */
3785/***/ (function(module, exports, __webpack_require__) {
3786
3787var pIE = __webpack_require__(89);
3788var createDesc = __webpack_require__(49);
3789var toIObject = __webpack_require__(25);
3790var toPrimitive = __webpack_require__(63);
3791var has = __webpack_require__(24);
3792var IE8_DOM_DEFINE = __webpack_require__(93);
3793var gOPD = Object.getOwnPropertyDescriptor;
3794
3795exports.f = __webpack_require__(21) ? gOPD : function getOwnPropertyDescriptor(O, P) {
3796 O = toIObject(O);
3797 P = toPrimitive(P, true);
3798 if (IE8_DOM_DEFINE) try {
3799 return gOPD(O, P);
3800 } catch (e) { /* empty */ }
3801 if (has(O, P)) return createDesc(!pIE.f.call(O, P), O[P]);
3802};
3803
3804
3805/***/ }),
3806/* 91 */
3807/***/ (function(module, exports) {
3808
3809
3810
3811/***/ }),
3812/* 92 */
3813/***/ (function(module, exports, __webpack_require__) {
3814
3815"use strict";
3816
3817var LIBRARY = __webpack_require__(37);
3818var $export = __webpack_require__(17);
3819var redefine = __webpack_require__(94);
3820var hide = __webpack_require__(23);
3821var Iterators = __webpack_require__(30);
3822var $iterCreate = __webpack_require__(168);
3823var setToStringTag = __webpack_require__(52);
3824var getPrototypeOf = __webpack_require__(98);
3825var ITERATOR = __webpack_require__(7)('iterator');
3826var BUGGY = !([].keys && 'next' in [].keys()); // Safari has buggy iterators w/o `next`
3827var FF_ITERATOR = '@@iterator';
3828var KEYS = 'keys';
3829var VALUES = 'values';
3830
3831var returnThis = function () { return this; };
3832
3833module.exports = function (Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED) {
3834 $iterCreate(Constructor, NAME, next);
3835 var getMethod = function (kind) {
3836 if (!BUGGY && kind in proto) return proto[kind];
3837 switch (kind) {
3838 case KEYS: return function keys() { return new Constructor(this, kind); };
3839 case VALUES: return function values() { return new Constructor(this, kind); };
3840 } return function entries() { return new Constructor(this, kind); };
3841 };
3842 var TAG = NAME + ' Iterator';
3843 var DEF_VALUES = DEFAULT == VALUES;
3844 var VALUES_BUG = false;
3845 var proto = Base.prototype;
3846 var $native = proto[ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT];
3847 var $default = $native || getMethod(DEFAULT);
3848 var $entries = DEFAULT ? !DEF_VALUES ? $default : getMethod('entries') : undefined;
3849 var $anyNative = NAME == 'Array' ? proto.entries || $native : $native;
3850 var methods, key, IteratorPrototype;
3851 // Fix native
3852 if ($anyNative) {
3853 IteratorPrototype = getPrototypeOf($anyNative.call(new Base()));
3854 if (IteratorPrototype !== Object.prototype && IteratorPrototype.next) {
3855 // Set @@toStringTag to native iterators
3856 setToStringTag(IteratorPrototype, TAG, true);
3857 // fix for some old engines
3858 if (!LIBRARY && typeof IteratorPrototype[ITERATOR] != 'function') hide(IteratorPrototype, ITERATOR, returnThis);
3859 }
3860 }
3861 // fix Array#{values, @@iterator}.name in V8 / FF
3862 if (DEF_VALUES && $native && $native.name !== VALUES) {
3863 VALUES_BUG = true;
3864 $default = function values() { return $native.call(this); };
3865 }
3866 // Define iterator
3867 if ((!LIBRARY || FORCED) && (BUGGY || VALUES_BUG || !proto[ITERATOR])) {
3868 hide(proto, ITERATOR, $default);
3869 }
3870 // Plug for library
3871 Iterators[NAME] = $default;
3872 Iterators[TAG] = returnThis;
3873 if (DEFAULT) {
3874 methods = {
3875 values: DEF_VALUES ? $default : getMethod(VALUES),
3876 keys: IS_SET ? $default : getMethod(KEYS),
3877 entries: $entries
3878 };
3879 if (FORCED) for (key in methods) {
3880 if (!(key in proto)) redefine(proto, key, methods[key]);
3881 } else $export($export.P + $export.F * (BUGGY || VALUES_BUG), NAME, methods);
3882 }
3883 return methods;
3884};
3885
3886
3887/***/ }),
3888/* 93 */
3889/***/ (function(module, exports, __webpack_require__) {
3890
3891module.exports = !__webpack_require__(21) && !__webpack_require__(39)(function () {
3892 return Object.defineProperty(__webpack_require__(62)('div'), 'a', { get: function () { return 7; } }).a != 7;
3893});
3894
3895
3896/***/ }),
3897/* 94 */
3898/***/ (function(module, exports, __webpack_require__) {
3899
3900module.exports = __webpack_require__(23);
3901
3902
3903/***/ }),
3904/* 95 */
3905/***/ (function(module, exports, __webpack_require__) {
3906
3907var has = __webpack_require__(24);
3908var toIObject = __webpack_require__(25);
3909var arrayIndexOf = __webpack_require__(171)(false);
3910var IE_PROTO = __webpack_require__(65)('IE_PROTO');
3911
3912module.exports = function (object, names) {
3913 var O = toIObject(object);
3914 var i = 0;
3915 var result = [];
3916 var key;
3917 for (key in O) if (key != IE_PROTO) has(O, key) && result.push(key);
3918 // Don't enum bug & hidden keys
3919 while (names.length > i) if (has(O, key = names[i++])) {
3920 ~arrayIndexOf(result, key) || result.push(key);
3921 }
3922 return result;
3923};
3924
3925
3926/***/ }),
3927/* 96 */
3928/***/ (function(module, exports, __webpack_require__) {
3929
3930// 7.1.15 ToLength
3931var toInteger = __webpack_require__(60);
3932var min = Math.min;
3933module.exports = function (it) {
3934 return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991
3935};
3936
3937
3938/***/ }),
3939/* 97 */
3940/***/ (function(module, exports, __webpack_require__) {
3941
3942var document = __webpack_require__(6).document;
3943module.exports = document && document.documentElement;
3944
3945
3946/***/ }),
3947/* 98 */
3948/***/ (function(module, exports, __webpack_require__) {
3949
3950// 19.1.2.9 / 15.2.3.2 Object.getPrototypeOf(O)
3951var has = __webpack_require__(24);
3952var toObject = __webpack_require__(53);
3953var IE_PROTO = __webpack_require__(65)('IE_PROTO');
3954var ObjectProto = Object.prototype;
3955
3956module.exports = Object.getPrototypeOf || function (O) {
3957 O = toObject(O);
3958 if (has(O, IE_PROTO)) return O[IE_PROTO];
3959 if (typeof O.constructor == 'function' && O instanceof O.constructor) {
3960 return O.constructor.prototype;
3961 } return O instanceof Object ? ObjectProto : null;
3962};
3963
3964
3965/***/ }),
3966/* 99 */
3967/***/ (function(module, exports, __webpack_require__) {
3968
3969var classof = __webpack_require__(68);
3970var ITERATOR = __webpack_require__(7)('iterator');
3971var Iterators = __webpack_require__(30);
3972module.exports = __webpack_require__(2).getIteratorMethod = function (it) {
3973 if (it != undefined) return it[ITERATOR]
3974 || it['@@iterator']
3975 || Iterators[classof(it)];
3976};
3977
3978
3979/***/ }),
3980/* 100 */
3981/***/ (function(module, exports, __webpack_require__) {
3982
3983// 7.3.20 SpeciesConstructor(O, defaultConstructor)
3984var anObject = __webpack_require__(16);
3985var aFunction = __webpack_require__(48);
3986var SPECIES = __webpack_require__(7)('species');
3987module.exports = function (O, D) {
3988 var C = anObject(O).constructor;
3989 var S;
3990 return C === undefined || (S = anObject(C)[SPECIES]) == undefined ? D : aFunction(S);
3991};
3992
3993
3994/***/ }),
3995/* 101 */
3996/***/ (function(module, exports, __webpack_require__) {
3997
3998var ctx = __webpack_require__(38);
3999var invoke = __webpack_require__(181);
4000var html = __webpack_require__(97);
4001var cel = __webpack_require__(62);
4002var global = __webpack_require__(6);
4003var process = global.process;
4004var setTask = global.setImmediate;
4005var clearTask = global.clearImmediate;
4006var MessageChannel = global.MessageChannel;
4007var Dispatch = global.Dispatch;
4008var counter = 0;
4009var queue = {};
4010var ONREADYSTATECHANGE = 'onreadystatechange';
4011var defer, channel, port;
4012var run = function () {
4013 var id = +this;
4014 // eslint-disable-next-line no-prototype-builtins
4015 if (queue.hasOwnProperty(id)) {
4016 var fn = queue[id];
4017 delete queue[id];
4018 fn();
4019 }
4020};
4021var listener = function (event) {
4022 run.call(event.data);
4023};
4024// Node.js 0.9+ & IE10+ has setImmediate, otherwise:
4025if (!setTask || !clearTask) {
4026 setTask = function setImmediate(fn) {
4027 var args = [];
4028 var i = 1;
4029 while (arguments.length > i) args.push(arguments[i++]);
4030 queue[++counter] = function () {
4031 // eslint-disable-next-line no-new-func
4032 invoke(typeof fn == 'function' ? fn : Function(fn), args);
4033 };
4034 defer(counter);
4035 return counter;
4036 };
4037 clearTask = function clearImmediate(id) {
4038 delete queue[id];
4039 };
4040 // Node.js 0.8-
4041 if (__webpack_require__(40)(process) == 'process') {
4042 defer = function (id) {
4043 process.nextTick(ctx(run, id, 1));
4044 };
4045 // Sphere (JS game engine) Dispatch API
4046 } else if (Dispatch && Dispatch.now) {
4047 defer = function (id) {
4048 Dispatch.now(ctx(run, id, 1));
4049 };
4050 // Browsers with MessageChannel, includes WebWorkers
4051 } else if (MessageChannel) {
4052 channel = new MessageChannel();
4053 port = channel.port2;
4054 channel.port1.onmessage = listener;
4055 defer = ctx(port.postMessage, port, 1);
4056 // Browsers with postMessage, skip WebWorkers
4057 // IE8 has postMessage, but it's sync & typeof its postMessage is 'object'
4058 } else if (global.addEventListener && typeof postMessage == 'function' && !global.importScripts) {
4059 defer = function (id) {
4060 global.postMessage(id + '', '*');
4061 };
4062 global.addEventListener('message', listener, false);
4063 // IE8-
4064 } else if (ONREADYSTATECHANGE in cel('script')) {
4065 defer = function (id) {
4066 html.appendChild(cel('script'))[ONREADYSTATECHANGE] = function () {
4067 html.removeChild(this);
4068 run.call(id);
4069 };
4070 };
4071 // Rest old browsers
4072 } else {
4073 defer = function (id) {
4074 setTimeout(ctx(run, id, 1), 0);
4075 };
4076 }
4077}
4078module.exports = {
4079 set: setTask,
4080 clear: clearTask
4081};
4082
4083
4084/***/ }),
4085/* 102 */
4086/***/ (function(module, exports) {
4087
4088module.exports = function (exec) {
4089 try {
4090 return { e: false, v: exec() };
4091 } catch (e) {
4092 return { e: true, v: e };
4093 }
4094};
4095
4096
4097/***/ }),
4098/* 103 */
4099/***/ (function(module, exports, __webpack_require__) {
4100
4101var anObject = __webpack_require__(16);
4102var isObject = __webpack_require__(20);
4103var newPromiseCapability = __webpack_require__(69);
4104
4105module.exports = function (C, x) {
4106 anObject(C);
4107 if (isObject(x) && x.constructor === C) return x;
4108 var promiseCapability = newPromiseCapability.f(C);
4109 var resolve = promiseCapability.resolve;
4110 resolve(x);
4111 return promiseCapability.promise;
4112};
4113
4114
4115/***/ }),
4116/* 104 */
4117/***/ (function(module, exports) {
4118
4119var g;
4120
4121// This works in non-strict mode
4122g = (function() {
4123 return this;
4124})();
4125
4126try {
4127 // This works if eval is allowed (see CSP)
4128 g = g || Function("return this")() || (1,eval)("this");
4129} catch(e) {
4130 // This works if the window reference is available
4131 if(typeof window === "object")
4132 g = window;
4133}
4134
4135// g can still be undefined, but nothing to do about it...
4136// We return undefined, instead of nothing here, so it's
4137// easier to handle this case. if(!global) { ...}
4138
4139module.exports = g;
4140
4141
4142/***/ }),
4143/* 105 */
4144/***/ (function(module, __webpack_exports__, __webpack_require__) {
4145
4146"use strict";
4147/* harmony export (immutable) */ __webpack_exports__["a"] = isUndefined;
4148// Is a given variable undefined?
4149function isUndefined(obj) {
4150 return obj === void 0;
4151}
4152
4153
4154/***/ }),
4155/* 106 */
4156/***/ (function(module, __webpack_exports__, __webpack_require__) {
4157
4158"use strict";
4159/* harmony export (immutable) */ __webpack_exports__["a"] = isBoolean;
4160/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(1);
4161
4162
4163// Is a given value a boolean?
4164function isBoolean(obj) {
4165 return obj === true || obj === false || __WEBPACK_IMPORTED_MODULE_0__setup_js__["t" /* toString */].call(obj) === '[object Boolean]';
4166}
4167
4168
4169/***/ }),
4170/* 107 */
4171/***/ (function(module, __webpack_exports__, __webpack_require__) {
4172
4173"use strict";
4174/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(5);
4175
4176
4177/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('Number'));
4178
4179
4180/***/ }),
4181/* 108 */
4182/***/ (function(module, __webpack_exports__, __webpack_require__) {
4183
4184"use strict";
4185/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(5);
4186
4187
4188/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('Symbol'));
4189
4190
4191/***/ }),
4192/* 109 */
4193/***/ (function(module, __webpack_exports__, __webpack_require__) {
4194
4195"use strict";
4196/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(5);
4197
4198
4199/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('ArrayBuffer'));
4200
4201
4202/***/ }),
4203/* 110 */
4204/***/ (function(module, __webpack_exports__, __webpack_require__) {
4205
4206"use strict";
4207/* harmony export (immutable) */ __webpack_exports__["a"] = isNaN;
4208/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(1);
4209/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isNumber_js__ = __webpack_require__(107);
4210
4211
4212
4213// Is the given value `NaN`?
4214function isNaN(obj) {
4215 return Object(__WEBPACK_IMPORTED_MODULE_1__isNumber_js__["a" /* default */])(obj) && Object(__WEBPACK_IMPORTED_MODULE_0__setup_js__["g" /* _isNaN */])(obj);
4216}
4217
4218
4219/***/ }),
4220/* 111 */
4221/***/ (function(module, __webpack_exports__, __webpack_require__) {
4222
4223"use strict";
4224/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(1);
4225/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isDataView_js__ = __webpack_require__(72);
4226/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__constant_js__ = __webpack_require__(112);
4227/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__isBufferLike_js__ = __webpack_require__(197);
4228
4229
4230
4231
4232
4233// Is a given value a typed array?
4234var typedArrayPattern = /\[object ((I|Ui)nt(8|16|32)|Float(32|64)|Uint8Clamped|Big(I|Ui)nt64)Array\]/;
4235function isTypedArray(obj) {
4236 // `ArrayBuffer.isView` is the most future-proof, so use it when available.
4237 // Otherwise, fall back on the above regular expression.
4238 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)) :
4239 Object(__WEBPACK_IMPORTED_MODULE_3__isBufferLike_js__["a" /* default */])(obj) && typedArrayPattern.test(__WEBPACK_IMPORTED_MODULE_0__setup_js__["t" /* toString */].call(obj));
4240}
4241
4242/* 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));
4243
4244
4245/***/ }),
4246/* 112 */
4247/***/ (function(module, __webpack_exports__, __webpack_require__) {
4248
4249"use strict";
4250/* harmony export (immutable) */ __webpack_exports__["a"] = constant;
4251// Predicate-generating function. Often useful outside of Underscore.
4252function constant(value) {
4253 return function() {
4254 return value;
4255 };
4256}
4257
4258
4259/***/ }),
4260/* 113 */
4261/***/ (function(module, __webpack_exports__, __webpack_require__) {
4262
4263"use strict";
4264/* harmony export (immutable) */ __webpack_exports__["a"] = createSizePropertyCheck;
4265/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(1);
4266
4267
4268// Common internal logic for `isArrayLike` and `isBufferLike`.
4269function createSizePropertyCheck(getSizeProperty) {
4270 return function(collection) {
4271 var sizeProperty = getSizeProperty(collection);
4272 return typeof sizeProperty == 'number' && sizeProperty >= 0 && sizeProperty <= __WEBPACK_IMPORTED_MODULE_0__setup_js__["b" /* MAX_ARRAY_INDEX */];
4273 }
4274}
4275
4276
4277/***/ }),
4278/* 114 */
4279/***/ (function(module, __webpack_exports__, __webpack_require__) {
4280
4281"use strict";
4282/* harmony export (immutable) */ __webpack_exports__["a"] = shallowProperty;
4283// Internal helper to generate a function to obtain property `key` from `obj`.
4284function shallowProperty(key) {
4285 return function(obj) {
4286 return obj == null ? void 0 : obj[key];
4287 };
4288}
4289
4290
4291/***/ }),
4292/* 115 */
4293/***/ (function(module, __webpack_exports__, __webpack_require__) {
4294
4295"use strict";
4296/* harmony export (immutable) */ __webpack_exports__["a"] = collectNonEnumProps;
4297/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(1);
4298/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isFunction_js__ = __webpack_require__(13);
4299/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__has_js__ = __webpack_require__(22);
4300
4301
4302
4303
4304// Internal helper to create a simple lookup structure.
4305// `collectNonEnumProps` used to depend on `_.contains`, but this led to
4306// circular imports. `emulatedSet` is a one-off solution that only works for
4307// arrays of strings.
4308function emulatedSet(keys) {
4309 var hash = {};
4310 for (var l = keys.length, i = 0; i < l; ++i) hash[keys[i]] = true;
4311 return {
4312 contains: function(key) { return hash[key]; },
4313 push: function(key) {
4314 hash[key] = true;
4315 return keys.push(key);
4316 }
4317 };
4318}
4319
4320// Internal helper. Checks `keys` for the presence of keys in IE < 9 that won't
4321// be iterated by `for key in ...` and thus missed. Extends `keys` in place if
4322// needed.
4323function collectNonEnumProps(obj, keys) {
4324 keys = emulatedSet(keys);
4325 var nonEnumIdx = __WEBPACK_IMPORTED_MODULE_0__setup_js__["n" /* nonEnumerableProps */].length;
4326 var constructor = obj.constructor;
4327 var proto = Object(__WEBPACK_IMPORTED_MODULE_1__isFunction_js__["a" /* default */])(constructor) && constructor.prototype || __WEBPACK_IMPORTED_MODULE_0__setup_js__["c" /* ObjProto */];
4328
4329 // Constructor is a special case.
4330 var prop = 'constructor';
4331 if (Object(__WEBPACK_IMPORTED_MODULE_2__has_js__["a" /* default */])(obj, prop) && !keys.contains(prop)) keys.push(prop);
4332
4333 while (nonEnumIdx--) {
4334 prop = __WEBPACK_IMPORTED_MODULE_0__setup_js__["n" /* nonEnumerableProps */][nonEnumIdx];
4335 if (prop in obj && obj[prop] !== proto[prop] && !keys.contains(prop)) {
4336 keys.push(prop);
4337 }
4338 }
4339}
4340
4341
4342/***/ }),
4343/* 116 */
4344/***/ (function(module, __webpack_exports__, __webpack_require__) {
4345
4346"use strict";
4347/* harmony export (immutable) */ __webpack_exports__["a"] = isMatch;
4348/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__keys_js__ = __webpack_require__(3);
4349
4350
4351// Returns whether an object has a given set of `key:value` pairs.
4352function isMatch(object, attrs) {
4353 var _keys = Object(__WEBPACK_IMPORTED_MODULE_0__keys_js__["a" /* default */])(attrs), length = _keys.length;
4354 if (object == null) return !length;
4355 var obj = Object(object);
4356 for (var i = 0; i < length; i++) {
4357 var key = _keys[i];
4358 if (attrs[key] !== obj[key] || !(key in obj)) return false;
4359 }
4360 return true;
4361}
4362
4363
4364/***/ }),
4365/* 117 */
4366/***/ (function(module, __webpack_exports__, __webpack_require__) {
4367
4368"use strict";
4369/* harmony export (immutable) */ __webpack_exports__["a"] = invert;
4370/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__keys_js__ = __webpack_require__(3);
4371
4372
4373// Invert the keys and values of an object. The values must be serializable.
4374function invert(obj) {
4375 var result = {};
4376 var _keys = Object(__WEBPACK_IMPORTED_MODULE_0__keys_js__["a" /* default */])(obj);
4377 for (var i = 0, length = _keys.length; i < length; i++) {
4378 result[obj[_keys[i]]] = _keys[i];
4379 }
4380 return result;
4381}
4382
4383
4384/***/ }),
4385/* 118 */
4386/***/ (function(module, __webpack_exports__, __webpack_require__) {
4387
4388"use strict";
4389/* harmony export (immutable) */ __webpack_exports__["a"] = functions;
4390/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isFunction_js__ = __webpack_require__(13);
4391
4392
4393// Return a sorted list of the function names available on the object.
4394function functions(obj) {
4395 var names = [];
4396 for (var key in obj) {
4397 if (Object(__WEBPACK_IMPORTED_MODULE_0__isFunction_js__["a" /* default */])(obj[key])) names.push(key);
4398 }
4399 return names.sort();
4400}
4401
4402
4403/***/ }),
4404/* 119 */
4405/***/ (function(module, __webpack_exports__, __webpack_require__) {
4406
4407"use strict";
4408/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createAssigner_js__ = __webpack_require__(76);
4409/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__allKeys_js__ = __webpack_require__(42);
4410
4411
4412
4413// Extend a given object with all the properties in passed-in object(s).
4414/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createAssigner_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__allKeys_js__["a" /* default */]));
4415
4416
4417/***/ }),
4418/* 120 */
4419/***/ (function(module, __webpack_exports__, __webpack_require__) {
4420
4421"use strict";
4422/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createAssigner_js__ = __webpack_require__(76);
4423/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__allKeys_js__ = __webpack_require__(42);
4424
4425
4426
4427// Fill in a given object with default properties.
4428/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createAssigner_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__allKeys_js__["a" /* default */], true));
4429
4430
4431/***/ }),
4432/* 121 */
4433/***/ (function(module, __webpack_exports__, __webpack_require__) {
4434
4435"use strict";
4436/* harmony export (immutable) */ __webpack_exports__["a"] = baseCreate;
4437/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isObject_js__ = __webpack_require__(26);
4438/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__setup_js__ = __webpack_require__(1);
4439
4440
4441
4442// Create a naked function reference for surrogate-prototype-swapping.
4443function ctor() {
4444 return function(){};
4445}
4446
4447// An internal function for creating a new object that inherits from another.
4448function baseCreate(prototype) {
4449 if (!Object(__WEBPACK_IMPORTED_MODULE_0__isObject_js__["a" /* default */])(prototype)) return {};
4450 if (__WEBPACK_IMPORTED_MODULE_1__setup_js__["j" /* nativeCreate */]) return Object(__WEBPACK_IMPORTED_MODULE_1__setup_js__["j" /* nativeCreate */])(prototype);
4451 var Ctor = ctor();
4452 Ctor.prototype = prototype;
4453 var result = new Ctor;
4454 Ctor.prototype = null;
4455 return result;
4456}
4457
4458
4459/***/ }),
4460/* 122 */
4461/***/ (function(module, __webpack_exports__, __webpack_require__) {
4462
4463"use strict";
4464/* harmony export (immutable) */ __webpack_exports__["a"] = clone;
4465/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isObject_js__ = __webpack_require__(26);
4466/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isArray_js__ = __webpack_require__(27);
4467/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__extend_js__ = __webpack_require__(119);
4468
4469
4470
4471
4472// Create a (shallow-cloned) duplicate of an object.
4473function clone(obj) {
4474 if (!Object(__WEBPACK_IMPORTED_MODULE_0__isObject_js__["a" /* default */])(obj)) return obj;
4475 return Object(__WEBPACK_IMPORTED_MODULE_1__isArray_js__["a" /* default */])(obj) ? obj.slice() : Object(__WEBPACK_IMPORTED_MODULE_2__extend_js__["a" /* default */])({}, obj);
4476}
4477
4478
4479/***/ }),
4480/* 123 */
4481/***/ (function(module, __webpack_exports__, __webpack_require__) {
4482
4483"use strict";
4484/* harmony export (immutable) */ __webpack_exports__["a"] = get;
4485/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__toPath_js__ = __webpack_require__(43);
4486/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__deepGet_js__ = __webpack_require__(78);
4487/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__isUndefined_js__ = __webpack_require__(105);
4488
4489
4490
4491
4492// Get the value of the (deep) property on `path` from `object`.
4493// If any property in `path` does not exist or if the value is
4494// `undefined`, return `defaultValue` instead.
4495// The `path` is normalized through `_.toPath`.
4496function get(object, path, defaultValue) {
4497 var value = Object(__WEBPACK_IMPORTED_MODULE_1__deepGet_js__["a" /* default */])(object, Object(__WEBPACK_IMPORTED_MODULE_0__toPath_js__["a" /* default */])(path));
4498 return Object(__WEBPACK_IMPORTED_MODULE_2__isUndefined_js__["a" /* default */])(value) ? defaultValue : value;
4499}
4500
4501
4502/***/ }),
4503/* 124 */
4504/***/ (function(module, __webpack_exports__, __webpack_require__) {
4505
4506"use strict";
4507/* harmony export (immutable) */ __webpack_exports__["a"] = toPath;
4508/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__underscore_js__ = __webpack_require__(10);
4509/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isArray_js__ = __webpack_require__(27);
4510
4511
4512
4513// Normalize a (deep) property `path` to array.
4514// Like `_.iteratee`, this function can be customized.
4515function toPath(path) {
4516 return Object(__WEBPACK_IMPORTED_MODULE_1__isArray_js__["a" /* default */])(path) ? path : [path];
4517}
4518__WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */].toPath = toPath;
4519
4520
4521/***/ }),
4522/* 125 */
4523/***/ (function(module, __webpack_exports__, __webpack_require__) {
4524
4525"use strict";
4526/* harmony export (immutable) */ __webpack_exports__["a"] = baseIteratee;
4527/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__identity_js__ = __webpack_require__(79);
4528/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isFunction_js__ = __webpack_require__(13);
4529/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__isObject_js__ = __webpack_require__(26);
4530/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__isArray_js__ = __webpack_require__(27);
4531/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__matcher_js__ = __webpack_require__(55);
4532/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__property_js__ = __webpack_require__(80);
4533/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__optimizeCb_js__ = __webpack_require__(44);
4534
4535
4536
4537
4538
4539
4540
4541
4542// An internal function to generate callbacks that can be applied to each
4543// element in a collection, returning the desired result — either `_.identity`,
4544// an arbitrary callback, a property matcher, or a property accessor.
4545function baseIteratee(value, context, argCount) {
4546 if (value == null) return __WEBPACK_IMPORTED_MODULE_0__identity_js__["a" /* default */];
4547 if (Object(__WEBPACK_IMPORTED_MODULE_1__isFunction_js__["a" /* default */])(value)) return Object(__WEBPACK_IMPORTED_MODULE_6__optimizeCb_js__["a" /* default */])(value, context, argCount);
4548 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);
4549 return Object(__WEBPACK_IMPORTED_MODULE_5__property_js__["a" /* default */])(value);
4550}
4551
4552
4553/***/ }),
4554/* 126 */
4555/***/ (function(module, __webpack_exports__, __webpack_require__) {
4556
4557"use strict";
4558/* harmony export (immutable) */ __webpack_exports__["a"] = iteratee;
4559/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__underscore_js__ = __webpack_require__(10);
4560/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__baseIteratee_js__ = __webpack_require__(125);
4561
4562
4563
4564// External wrapper for our callback generator. Users may customize
4565// `_.iteratee` if they want additional predicate/iteratee shorthand styles.
4566// This abstraction hides the internal-only `argCount` argument.
4567function iteratee(value, context) {
4568 return Object(__WEBPACK_IMPORTED_MODULE_1__baseIteratee_js__["a" /* default */])(value, context, Infinity);
4569}
4570__WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */].iteratee = iteratee;
4571
4572
4573/***/ }),
4574/* 127 */
4575/***/ (function(module, __webpack_exports__, __webpack_require__) {
4576
4577"use strict";
4578/* harmony export (immutable) */ __webpack_exports__["a"] = noop;
4579// Predicate-generating function. Often useful outside of Underscore.
4580function noop(){}
4581
4582
4583/***/ }),
4584/* 128 */
4585/***/ (function(module, __webpack_exports__, __webpack_require__) {
4586
4587"use strict";
4588/* harmony export (immutable) */ __webpack_exports__["a"] = random;
4589// Return a random integer between `min` and `max` (inclusive).
4590function random(min, max) {
4591 if (max == null) {
4592 max = min;
4593 min = 0;
4594 }
4595 return min + Math.floor(Math.random() * (max - min + 1));
4596}
4597
4598
4599/***/ }),
4600/* 129 */
4601/***/ (function(module, __webpack_exports__, __webpack_require__) {
4602
4603"use strict";
4604/* harmony export (immutable) */ __webpack_exports__["a"] = createEscaper;
4605/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__keys_js__ = __webpack_require__(3);
4606
4607
4608// Internal helper to generate functions for escaping and unescaping strings
4609// to/from HTML interpolation.
4610function createEscaper(map) {
4611 var escaper = function(match) {
4612 return map[match];
4613 };
4614 // Regexes for identifying a key that needs to be escaped.
4615 var source = '(?:' + Object(__WEBPACK_IMPORTED_MODULE_0__keys_js__["a" /* default */])(map).join('|') + ')';
4616 var testRegexp = RegExp(source);
4617 var replaceRegexp = RegExp(source, 'g');
4618 return function(string) {
4619 string = string == null ? '' : '' + string;
4620 return testRegexp.test(string) ? string.replace(replaceRegexp, escaper) : string;
4621 };
4622}
4623
4624
4625/***/ }),
4626/* 130 */
4627/***/ (function(module, __webpack_exports__, __webpack_require__) {
4628
4629"use strict";
4630// Internal list of HTML entities for escaping.
4631/* harmony default export */ __webpack_exports__["a"] = ({
4632 '&': '&amp;',
4633 '<': '&lt;',
4634 '>': '&gt;',
4635 '"': '&quot;',
4636 "'": '&#x27;',
4637 '`': '&#x60;'
4638});
4639
4640
4641/***/ }),
4642/* 131 */
4643/***/ (function(module, __webpack_exports__, __webpack_require__) {
4644
4645"use strict";
4646/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__underscore_js__ = __webpack_require__(10);
4647
4648
4649// By default, Underscore uses ERB-style template delimiters. Change the
4650// following template settings to use alternative delimiters.
4651/* harmony default export */ __webpack_exports__["a"] = (__WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */].templateSettings = {
4652 evaluate: /<%([\s\S]+?)%>/g,
4653 interpolate: /<%=([\s\S]+?)%>/g,
4654 escape: /<%-([\s\S]+?)%>/g
4655});
4656
4657
4658/***/ }),
4659/* 132 */
4660/***/ (function(module, __webpack_exports__, __webpack_require__) {
4661
4662"use strict";
4663/* harmony export (immutable) */ __webpack_exports__["a"] = executeBound;
4664/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__baseCreate_js__ = __webpack_require__(121);
4665/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isObject_js__ = __webpack_require__(26);
4666
4667
4668
4669// Internal function to execute `sourceFunc` bound to `context` with optional
4670// `args`. Determines whether to execute a function as a constructor or as a
4671// normal function.
4672function executeBound(sourceFunc, boundFunc, context, callingContext, args) {
4673 if (!(callingContext instanceof boundFunc)) return sourceFunc.apply(context, args);
4674 var self = Object(__WEBPACK_IMPORTED_MODULE_0__baseCreate_js__["a" /* default */])(sourceFunc.prototype);
4675 var result = sourceFunc.apply(self, args);
4676 if (Object(__WEBPACK_IMPORTED_MODULE_1__isObject_js__["a" /* default */])(result)) return result;
4677 return self;
4678}
4679
4680
4681/***/ }),
4682/* 133 */
4683/***/ (function(module, __webpack_exports__, __webpack_require__) {
4684
4685"use strict";
4686/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(9);
4687/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isFunction_js__ = __webpack_require__(13);
4688/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__executeBound_js__ = __webpack_require__(132);
4689
4690
4691
4692
4693// Create a function bound to a given object (assigning `this`, and arguments,
4694// optionally).
4695/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(func, context, args) {
4696 if (!Object(__WEBPACK_IMPORTED_MODULE_1__isFunction_js__["a" /* default */])(func)) throw new TypeError('Bind must be called on a function');
4697 var bound = Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(callArgs) {
4698 return Object(__WEBPACK_IMPORTED_MODULE_2__executeBound_js__["a" /* default */])(func, bound, context, this, args.concat(callArgs));
4699 });
4700 return bound;
4701}));
4702
4703
4704/***/ }),
4705/* 134 */
4706/***/ (function(module, __webpack_exports__, __webpack_require__) {
4707
4708"use strict";
4709/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(9);
4710
4711
4712// Delays a function for the given number of milliseconds, and then calls
4713// it with the arguments supplied.
4714/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(func, wait, args) {
4715 return setTimeout(function() {
4716 return func.apply(null, args);
4717 }, wait);
4718}));
4719
4720
4721/***/ }),
4722/* 135 */
4723/***/ (function(module, __webpack_exports__, __webpack_require__) {
4724
4725"use strict";
4726/* harmony export (immutable) */ __webpack_exports__["a"] = before;
4727// Returns a function that will only be executed up to (but not including) the
4728// Nth call.
4729function before(times, func) {
4730 var memo;
4731 return function() {
4732 if (--times > 0) {
4733 memo = func.apply(this, arguments);
4734 }
4735 if (times <= 1) func = null;
4736 return memo;
4737 };
4738}
4739
4740
4741/***/ }),
4742/* 136 */
4743/***/ (function(module, __webpack_exports__, __webpack_require__) {
4744
4745"use strict";
4746/* harmony export (immutable) */ __webpack_exports__["a"] = findKey;
4747/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(8);
4748/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__keys_js__ = __webpack_require__(3);
4749
4750
4751
4752// Returns the first key on an object that passes a truth test.
4753function findKey(obj, predicate, context) {
4754 predicate = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(predicate, context);
4755 var _keys = Object(__WEBPACK_IMPORTED_MODULE_1__keys_js__["a" /* default */])(obj), key;
4756 for (var i = 0, length = _keys.length; i < length; i++) {
4757 key = _keys[i];
4758 if (predicate(obj[key], key, obj)) return key;
4759 }
4760}
4761
4762
4763/***/ }),
4764/* 137 */
4765/***/ (function(module, __webpack_exports__, __webpack_require__) {
4766
4767"use strict";
4768/* harmony export (immutable) */ __webpack_exports__["a"] = createPredicateIndexFinder;
4769/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(8);
4770/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__getLength_js__ = __webpack_require__(14);
4771
4772
4773
4774// Internal function to generate `_.findIndex` and `_.findLastIndex`.
4775function createPredicateIndexFinder(dir) {
4776 return function(array, predicate, context) {
4777 predicate = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(predicate, context);
4778 var length = Object(__WEBPACK_IMPORTED_MODULE_1__getLength_js__["a" /* default */])(array);
4779 var index = dir > 0 ? 0 : length - 1;
4780 for (; index >= 0 && index < length; index += dir) {
4781 if (predicate(array[index], index, array)) return index;
4782 }
4783 return -1;
4784 };
4785}
4786
4787
4788/***/ }),
4789/* 138 */
4790/***/ (function(module, __webpack_exports__, __webpack_require__) {
4791
4792"use strict";
4793/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createPredicateIndexFinder_js__ = __webpack_require__(137);
4794
4795
4796// Returns the last index on an array-like that passes a truth test.
4797/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createPredicateIndexFinder_js__["a" /* default */])(-1));
4798
4799
4800/***/ }),
4801/* 139 */
4802/***/ (function(module, __webpack_exports__, __webpack_require__) {
4803
4804"use strict";
4805/* harmony export (immutable) */ __webpack_exports__["a"] = sortedIndex;
4806/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(8);
4807/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__getLength_js__ = __webpack_require__(14);
4808
4809
4810
4811// Use a comparator function to figure out the smallest index at which
4812// an object should be inserted so as to maintain order. Uses binary search.
4813function sortedIndex(array, obj, iteratee, context) {
4814 iteratee = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(iteratee, context, 1);
4815 var value = iteratee(obj);
4816 var low = 0, high = Object(__WEBPACK_IMPORTED_MODULE_1__getLength_js__["a" /* default */])(array);
4817 while (low < high) {
4818 var mid = Math.floor((low + high) / 2);
4819 if (iteratee(array[mid]) < value) low = mid + 1; else high = mid;
4820 }
4821 return low;
4822}
4823
4824
4825/***/ }),
4826/* 140 */
4827/***/ (function(module, __webpack_exports__, __webpack_require__) {
4828
4829"use strict";
4830/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__sortedIndex_js__ = __webpack_require__(139);
4831/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__findIndex_js__ = __webpack_require__(83);
4832/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__createIndexFinder_js__ = __webpack_require__(141);
4833
4834
4835
4836
4837// Return the position of the first occurrence of an item in an array,
4838// or -1 if the item is not included in the array.
4839// If the array is large and already in sort order, pass `true`
4840// for **isSorted** to use binary search.
4841/* 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 */]));
4842
4843
4844/***/ }),
4845/* 141 */
4846/***/ (function(module, __webpack_exports__, __webpack_require__) {
4847
4848"use strict";
4849/* harmony export (immutable) */ __webpack_exports__["a"] = createIndexFinder;
4850/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__getLength_js__ = __webpack_require__(14);
4851/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__setup_js__ = __webpack_require__(1);
4852/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__isNaN_js__ = __webpack_require__(110);
4853
4854
4855
4856
4857// Internal function to generate the `_.indexOf` and `_.lastIndexOf` functions.
4858function createIndexFinder(dir, predicateFind, sortedIndex) {
4859 return function(array, item, idx) {
4860 var i = 0, length = Object(__WEBPACK_IMPORTED_MODULE_0__getLength_js__["a" /* default */])(array);
4861 if (typeof idx == 'number') {
4862 if (dir > 0) {
4863 i = idx >= 0 ? idx : Math.max(idx + length, i);
4864 } else {
4865 length = idx >= 0 ? Math.min(idx + 1, length) : idx + length + 1;
4866 }
4867 } else if (sortedIndex && idx && length) {
4868 idx = sortedIndex(array, item);
4869 return array[idx] === item ? idx : -1;
4870 }
4871 if (item !== item) {
4872 idx = predicateFind(__WEBPACK_IMPORTED_MODULE_1__setup_js__["q" /* slice */].call(array, i, length), __WEBPACK_IMPORTED_MODULE_2__isNaN_js__["a" /* default */]);
4873 return idx >= 0 ? idx + i : -1;
4874 }
4875 for (idx = dir > 0 ? i : length - 1; idx >= 0 && idx < length; idx += dir) {
4876 if (array[idx] === item) return idx;
4877 }
4878 return -1;
4879 };
4880}
4881
4882
4883/***/ }),
4884/* 142 */
4885/***/ (function(module, __webpack_exports__, __webpack_require__) {
4886
4887"use strict";
4888/* harmony export (immutable) */ __webpack_exports__["a"] = find;
4889/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__ = __webpack_require__(11);
4890/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__findIndex_js__ = __webpack_require__(83);
4891/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__findKey_js__ = __webpack_require__(136);
4892
4893
4894
4895
4896// Return the first value which passes a truth test.
4897function find(obj, predicate, context) {
4898 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 */];
4899 var key = keyFinder(obj, predicate, context);
4900 if (key !== void 0 && key !== -1) return obj[key];
4901}
4902
4903
4904/***/ }),
4905/* 143 */
4906/***/ (function(module, __webpack_exports__, __webpack_require__) {
4907
4908"use strict";
4909/* harmony export (immutable) */ __webpack_exports__["a"] = createReduce;
4910/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__ = __webpack_require__(11);
4911/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__keys_js__ = __webpack_require__(3);
4912/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__optimizeCb_js__ = __webpack_require__(44);
4913
4914
4915
4916
4917// Internal helper to create a reducing function, iterating left or right.
4918function createReduce(dir) {
4919 // Wrap code that reassigns argument variables in a separate function than
4920 // the one that accesses `arguments.length` to avoid a perf hit. (#1991)
4921 var reducer = function(obj, iteratee, memo, initial) {
4922 var _keys = !Object(__WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__["a" /* default */])(obj) && Object(__WEBPACK_IMPORTED_MODULE_1__keys_js__["a" /* default */])(obj),
4923 length = (_keys || obj).length,
4924 index = dir > 0 ? 0 : length - 1;
4925 if (!initial) {
4926 memo = obj[_keys ? _keys[index] : index];
4927 index += dir;
4928 }
4929 for (; index >= 0 && index < length; index += dir) {
4930 var currentKey = _keys ? _keys[index] : index;
4931 memo = iteratee(memo, obj[currentKey], currentKey, obj);
4932 }
4933 return memo;
4934 };
4935
4936 return function(obj, iteratee, memo, context) {
4937 var initial = arguments.length >= 3;
4938 return reducer(obj, Object(__WEBPACK_IMPORTED_MODULE_2__optimizeCb_js__["a" /* default */])(iteratee, context, 4), memo, initial);
4939 };
4940}
4941
4942
4943/***/ }),
4944/* 144 */
4945/***/ (function(module, __webpack_exports__, __webpack_require__) {
4946
4947"use strict";
4948/* harmony export (immutable) */ __webpack_exports__["a"] = max;
4949/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__ = __webpack_require__(11);
4950/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__values_js__ = __webpack_require__(31);
4951/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__cb_js__ = __webpack_require__(8);
4952/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__each_js__ = __webpack_require__(28);
4953
4954
4955
4956
4957
4958// Return the maximum element (or element-based computation).
4959function max(obj, iteratee, context) {
4960 var result = -Infinity, lastComputed = -Infinity,
4961 value, computed;
4962 if (iteratee == null || typeof iteratee == 'number' && typeof obj[0] != 'object' && obj != null) {
4963 obj = Object(__WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__["a" /* default */])(obj) ? obj : Object(__WEBPACK_IMPORTED_MODULE_1__values_js__["a" /* default */])(obj);
4964 for (var i = 0, length = obj.length; i < length; i++) {
4965 value = obj[i];
4966 if (value != null && value > result) {
4967 result = value;
4968 }
4969 }
4970 } else {
4971 iteratee = Object(__WEBPACK_IMPORTED_MODULE_2__cb_js__["a" /* default */])(iteratee, context);
4972 Object(__WEBPACK_IMPORTED_MODULE_3__each_js__["a" /* default */])(obj, function(v, index, list) {
4973 computed = iteratee(v, index, list);
4974 if (computed > lastComputed || computed === -Infinity && result === -Infinity) {
4975 result = v;
4976 lastComputed = computed;
4977 }
4978 });
4979 }
4980 return result;
4981}
4982
4983
4984/***/ }),
4985/* 145 */
4986/***/ (function(module, __webpack_exports__, __webpack_require__) {
4987
4988"use strict";
4989/* harmony export (immutable) */ __webpack_exports__["a"] = sample;
4990/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__ = __webpack_require__(11);
4991/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__clone_js__ = __webpack_require__(122);
4992/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__values_js__ = __webpack_require__(31);
4993/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__getLength_js__ = __webpack_require__(14);
4994/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__random_js__ = __webpack_require__(128);
4995
4996
4997
4998
4999
5000
5001// Sample **n** random values from a collection using the modern version of the
5002// [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher–Yates_shuffle).
5003// If **n** is not specified, returns a single random element.
5004// The internal `guard` argument allows it to work with `_.map`.
5005function sample(obj, n, guard) {
5006 if (n == null || guard) {
5007 if (!Object(__WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__["a" /* default */])(obj)) obj = Object(__WEBPACK_IMPORTED_MODULE_2__values_js__["a" /* default */])(obj);
5008 return obj[Object(__WEBPACK_IMPORTED_MODULE_4__random_js__["a" /* default */])(obj.length - 1)];
5009 }
5010 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);
5011 var length = Object(__WEBPACK_IMPORTED_MODULE_3__getLength_js__["a" /* default */])(sample);
5012 n = Math.max(Math.min(n, length), 0);
5013 var last = length - 1;
5014 for (var index = 0; index < n; index++) {
5015 var rand = Object(__WEBPACK_IMPORTED_MODULE_4__random_js__["a" /* default */])(index, last);
5016 var temp = sample[index];
5017 sample[index] = sample[rand];
5018 sample[rand] = temp;
5019 }
5020 return sample.slice(0, n);
5021}
5022
5023
5024/***/ }),
5025/* 146 */
5026/***/ (function(module, __webpack_exports__, __webpack_require__) {
5027
5028"use strict";
5029/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(9);
5030/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isFunction_js__ = __webpack_require__(13);
5031/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__optimizeCb_js__ = __webpack_require__(44);
5032/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__allKeys_js__ = __webpack_require__(42);
5033/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__keyInObj_js__ = __webpack_require__(246);
5034/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__flatten_js__ = __webpack_require__(32);
5035
5036
5037
5038
5039
5040
5041
5042// Return a copy of the object only containing the allowed properties.
5043/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(obj, keys) {
5044 var result = {}, iteratee = keys[0];
5045 if (obj == null) return result;
5046 if (Object(__WEBPACK_IMPORTED_MODULE_1__isFunction_js__["a" /* default */])(iteratee)) {
5047 if (keys.length > 1) iteratee = Object(__WEBPACK_IMPORTED_MODULE_2__optimizeCb_js__["a" /* default */])(iteratee, keys[1]);
5048 keys = Object(__WEBPACK_IMPORTED_MODULE_3__allKeys_js__["a" /* default */])(obj);
5049 } else {
5050 iteratee = __WEBPACK_IMPORTED_MODULE_4__keyInObj_js__["a" /* default */];
5051 keys = Object(__WEBPACK_IMPORTED_MODULE_5__flatten_js__["a" /* default */])(keys, false, false);
5052 obj = Object(obj);
5053 }
5054 for (var i = 0, length = keys.length; i < length; i++) {
5055 var key = keys[i];
5056 var value = obj[key];
5057 if (iteratee(value, key, obj)) result[key] = value;
5058 }
5059 return result;
5060}));
5061
5062
5063/***/ }),
5064/* 147 */
5065/***/ (function(module, __webpack_exports__, __webpack_require__) {
5066
5067"use strict";
5068/* harmony export (immutable) */ __webpack_exports__["a"] = initial;
5069/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(1);
5070
5071
5072// Returns everything but the last entry of the array. Especially useful on
5073// the arguments object. Passing **n** will return all the values in
5074// the array, excluding the last N.
5075function initial(array, n, guard) {
5076 return __WEBPACK_IMPORTED_MODULE_0__setup_js__["q" /* slice */].call(array, 0, Math.max(0, array.length - (n == null || guard ? 1 : n)));
5077}
5078
5079
5080/***/ }),
5081/* 148 */
5082/***/ (function(module, __webpack_exports__, __webpack_require__) {
5083
5084"use strict";
5085/* harmony export (immutable) */ __webpack_exports__["a"] = rest;
5086/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(1);
5087
5088
5089// Returns everything but the first entry of the `array`. Especially useful on
5090// the `arguments` object. Passing an **n** will return the rest N values in the
5091// `array`.
5092function rest(array, n, guard) {
5093 return __WEBPACK_IMPORTED_MODULE_0__setup_js__["q" /* slice */].call(array, n == null || guard ? 1 : n);
5094}
5095
5096
5097/***/ }),
5098/* 149 */
5099/***/ (function(module, __webpack_exports__, __webpack_require__) {
5100
5101"use strict";
5102/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(9);
5103/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__flatten_js__ = __webpack_require__(32);
5104/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__filter_js__ = __webpack_require__(45);
5105/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__contains_js__ = __webpack_require__(46);
5106
5107
5108
5109
5110
5111// Take the difference between one array and a number of other arrays.
5112// Only the elements present in just the first array will remain.
5113/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(array, rest) {
5114 rest = Object(__WEBPACK_IMPORTED_MODULE_1__flatten_js__["a" /* default */])(rest, true, true);
5115 return Object(__WEBPACK_IMPORTED_MODULE_2__filter_js__["a" /* default */])(array, function(value){
5116 return !Object(__WEBPACK_IMPORTED_MODULE_3__contains_js__["a" /* default */])(rest, value);
5117 });
5118}));
5119
5120
5121/***/ }),
5122/* 150 */
5123/***/ (function(module, __webpack_exports__, __webpack_require__) {
5124
5125"use strict";
5126/* harmony export (immutable) */ __webpack_exports__["a"] = uniq;
5127/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isBoolean_js__ = __webpack_require__(106);
5128/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__cb_js__ = __webpack_require__(8);
5129/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__getLength_js__ = __webpack_require__(14);
5130/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__contains_js__ = __webpack_require__(46);
5131
5132
5133
5134
5135
5136// Produce a duplicate-free version of the array. If the array has already
5137// been sorted, you have the option of using a faster algorithm.
5138// The faster algorithm will not work with an iteratee if the iteratee
5139// is not a one-to-one function, so providing an iteratee will disable
5140// the faster algorithm.
5141function uniq(array, isSorted, iteratee, context) {
5142 if (!Object(__WEBPACK_IMPORTED_MODULE_0__isBoolean_js__["a" /* default */])(isSorted)) {
5143 context = iteratee;
5144 iteratee = isSorted;
5145 isSorted = false;
5146 }
5147 if (iteratee != null) iteratee = Object(__WEBPACK_IMPORTED_MODULE_1__cb_js__["a" /* default */])(iteratee, context);
5148 var result = [];
5149 var seen = [];
5150 for (var i = 0, length = Object(__WEBPACK_IMPORTED_MODULE_2__getLength_js__["a" /* default */])(array); i < length; i++) {
5151 var value = array[i],
5152 computed = iteratee ? iteratee(value, i, array) : value;
5153 if (isSorted && !iteratee) {
5154 if (!i || seen !== computed) result.push(value);
5155 seen = computed;
5156 } else if (iteratee) {
5157 if (!Object(__WEBPACK_IMPORTED_MODULE_3__contains_js__["a" /* default */])(seen, computed)) {
5158 seen.push(computed);
5159 result.push(value);
5160 }
5161 } else if (!Object(__WEBPACK_IMPORTED_MODULE_3__contains_js__["a" /* default */])(result, value)) {
5162 result.push(value);
5163 }
5164 }
5165 return result;
5166}
5167
5168
5169/***/ }),
5170/* 151 */
5171/***/ (function(module, __webpack_exports__, __webpack_require__) {
5172
5173"use strict";
5174/* harmony export (immutable) */ __webpack_exports__["a"] = unzip;
5175/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__max_js__ = __webpack_require__(144);
5176/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__getLength_js__ = __webpack_require__(14);
5177/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__pluck_js__ = __webpack_require__(84);
5178
5179
5180
5181
5182// Complement of zip. Unzip accepts an array of arrays and groups
5183// each array's elements on shared indices.
5184function unzip(array) {
5185 var length = array && Object(__WEBPACK_IMPORTED_MODULE_0__max_js__["a" /* default */])(array, __WEBPACK_IMPORTED_MODULE_1__getLength_js__["a" /* default */]).length || 0;
5186 var result = Array(length);
5187
5188 for (var index = 0; index < length; index++) {
5189 result[index] = Object(__WEBPACK_IMPORTED_MODULE_2__pluck_js__["a" /* default */])(array, index);
5190 }
5191 return result;
5192}
5193
5194
5195/***/ }),
5196/* 152 */
5197/***/ (function(module, __webpack_exports__, __webpack_require__) {
5198
5199"use strict";
5200/* harmony export (immutable) */ __webpack_exports__["a"] = chainResult;
5201/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__underscore_js__ = __webpack_require__(10);
5202
5203
5204// Helper function to continue chaining intermediate results.
5205function chainResult(instance, obj) {
5206 return instance._chain ? Object(__WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */])(obj).chain() : obj;
5207}
5208
5209
5210/***/ }),
5211/* 153 */
5212/***/ (function(module, exports, __webpack_require__) {
5213
5214module.exports = { "default": __webpack_require__(262), __esModule: true };
5215
5216/***/ }),
5217/* 154 */
5218/***/ (function(module, exports, __webpack_require__) {
5219
5220var rng = __webpack_require__(264);
5221var bytesToUuid = __webpack_require__(265);
5222
5223function v4(options, buf, offset) {
5224 var i = buf && offset || 0;
5225
5226 if (typeof(options) == 'string') {
5227 buf = options === 'binary' ? new Array(16) : null;
5228 options = null;
5229 }
5230 options = options || {};
5231
5232 var rnds = options.random || (options.rng || rng)();
5233
5234 // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
5235 rnds[6] = (rnds[6] & 0x0f) | 0x40;
5236 rnds[8] = (rnds[8] & 0x3f) | 0x80;
5237
5238 // Copy bytes to buffer, if provided
5239 if (buf) {
5240 for (var ii = 0; ii < 16; ++ii) {
5241 buf[i + ii] = rnds[ii];
5242 }
5243 }
5244
5245 return buf || bytesToUuid(rnds);
5246}
5247
5248module.exports = v4;
5249
5250
5251/***/ }),
5252/* 155 */
5253/***/ (function(module, exports, __webpack_require__) {
5254
5255module.exports = { "default": __webpack_require__(268), __esModule: true };
5256
5257/***/ }),
5258/* 156 */
5259/***/ (function(module, exports, __webpack_require__) {
5260
5261"use strict";
5262
5263
5264module.exports = '4.12.2';
5265
5266/***/ }),
5267/* 157 */
5268/***/ (function(module, exports, __webpack_require__) {
5269
5270"use strict";
5271
5272
5273var has = Object.prototype.hasOwnProperty
5274 , prefix = '~';
5275
5276/**
5277 * Constructor to create a storage for our `EE` objects.
5278 * An `Events` instance is a plain object whose properties are event names.
5279 *
5280 * @constructor
5281 * @api private
5282 */
5283function Events() {}
5284
5285//
5286// We try to not inherit from `Object.prototype`. In some engines creating an
5287// instance in this way is faster than calling `Object.create(null)` directly.
5288// If `Object.create(null)` is not supported we prefix the event names with a
5289// character to make sure that the built-in object properties are not
5290// overridden or used as an attack vector.
5291//
5292if (Object.create) {
5293 Events.prototype = Object.create(null);
5294
5295 //
5296 // This hack is needed because the `__proto__` property is still inherited in
5297 // some old browsers like Android 4, iPhone 5.1, Opera 11 and Safari 5.
5298 //
5299 if (!new Events().__proto__) prefix = false;
5300}
5301
5302/**
5303 * Representation of a single event listener.
5304 *
5305 * @param {Function} fn The listener function.
5306 * @param {Mixed} context The context to invoke the listener with.
5307 * @param {Boolean} [once=false] Specify if the listener is a one-time listener.
5308 * @constructor
5309 * @api private
5310 */
5311function EE(fn, context, once) {
5312 this.fn = fn;
5313 this.context = context;
5314 this.once = once || false;
5315}
5316
5317/**
5318 * Minimal `EventEmitter` interface that is molded against the Node.js
5319 * `EventEmitter` interface.
5320 *
5321 * @constructor
5322 * @api public
5323 */
5324function EventEmitter() {
5325 this._events = new Events();
5326 this._eventsCount = 0;
5327}
5328
5329/**
5330 * Return an array listing the events for which the emitter has registered
5331 * listeners.
5332 *
5333 * @returns {Array}
5334 * @api public
5335 */
5336EventEmitter.prototype.eventNames = function eventNames() {
5337 var names = []
5338 , events
5339 , name;
5340
5341 if (this._eventsCount === 0) return names;
5342
5343 for (name in (events = this._events)) {
5344 if (has.call(events, name)) names.push(prefix ? name.slice(1) : name);
5345 }
5346
5347 if (Object.getOwnPropertySymbols) {
5348 return names.concat(Object.getOwnPropertySymbols(events));
5349 }
5350
5351 return names;
5352};
5353
5354/**
5355 * Return the listeners registered for a given event.
5356 *
5357 * @param {String|Symbol} event The event name.
5358 * @param {Boolean} exists Only check if there are listeners.
5359 * @returns {Array|Boolean}
5360 * @api public
5361 */
5362EventEmitter.prototype.listeners = function listeners(event, exists) {
5363 var evt = prefix ? prefix + event : event
5364 , available = this._events[evt];
5365
5366 if (exists) return !!available;
5367 if (!available) return [];
5368 if (available.fn) return [available.fn];
5369
5370 for (var i = 0, l = available.length, ee = new Array(l); i < l; i++) {
5371 ee[i] = available[i].fn;
5372 }
5373
5374 return ee;
5375};
5376
5377/**
5378 * Calls each of the listeners registered for a given event.
5379 *
5380 * @param {String|Symbol} event The event name.
5381 * @returns {Boolean} `true` if the event had listeners, else `false`.
5382 * @api public
5383 */
5384EventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {
5385 var evt = prefix ? prefix + event : event;
5386
5387 if (!this._events[evt]) return false;
5388
5389 var listeners = this._events[evt]
5390 , len = arguments.length
5391 , args
5392 , i;
5393
5394 if (listeners.fn) {
5395 if (listeners.once) this.removeListener(event, listeners.fn, undefined, true);
5396
5397 switch (len) {
5398 case 1: return listeners.fn.call(listeners.context), true;
5399 case 2: return listeners.fn.call(listeners.context, a1), true;
5400 case 3: return listeners.fn.call(listeners.context, a1, a2), true;
5401 case 4: return listeners.fn.call(listeners.context, a1, a2, a3), true;
5402 case 5: return listeners.fn.call(listeners.context, a1, a2, a3, a4), true;
5403 case 6: return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true;
5404 }
5405
5406 for (i = 1, args = new Array(len -1); i < len; i++) {
5407 args[i - 1] = arguments[i];
5408 }
5409
5410 listeners.fn.apply(listeners.context, args);
5411 } else {
5412 var length = listeners.length
5413 , j;
5414
5415 for (i = 0; i < length; i++) {
5416 if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true);
5417
5418 switch (len) {
5419 case 1: listeners[i].fn.call(listeners[i].context); break;
5420 case 2: listeners[i].fn.call(listeners[i].context, a1); break;
5421 case 3: listeners[i].fn.call(listeners[i].context, a1, a2); break;
5422 case 4: listeners[i].fn.call(listeners[i].context, a1, a2, a3); break;
5423 default:
5424 if (!args) for (j = 1, args = new Array(len -1); j < len; j++) {
5425 args[j - 1] = arguments[j];
5426 }
5427
5428 listeners[i].fn.apply(listeners[i].context, args);
5429 }
5430 }
5431 }
5432
5433 return true;
5434};
5435
5436/**
5437 * Add a listener for a given event.
5438 *
5439 * @param {String|Symbol} event The event name.
5440 * @param {Function} fn The listener function.
5441 * @param {Mixed} [context=this] The context to invoke the listener with.
5442 * @returns {EventEmitter} `this`.
5443 * @api public
5444 */
5445EventEmitter.prototype.on = function on(event, fn, context) {
5446 var listener = new EE(fn, context || this)
5447 , evt = prefix ? prefix + event : event;
5448
5449 if (!this._events[evt]) this._events[evt] = listener, this._eventsCount++;
5450 else if (!this._events[evt].fn) this._events[evt].push(listener);
5451 else this._events[evt] = [this._events[evt], listener];
5452
5453 return this;
5454};
5455
5456/**
5457 * Add a one-time listener for a given event.
5458 *
5459 * @param {String|Symbol} event The event name.
5460 * @param {Function} fn The listener function.
5461 * @param {Mixed} [context=this] The context to invoke the listener with.
5462 * @returns {EventEmitter} `this`.
5463 * @api public
5464 */
5465EventEmitter.prototype.once = function once(event, fn, context) {
5466 var listener = new EE(fn, context || this, true)
5467 , evt = prefix ? prefix + event : event;
5468
5469 if (!this._events[evt]) this._events[evt] = listener, this._eventsCount++;
5470 else if (!this._events[evt].fn) this._events[evt].push(listener);
5471 else this._events[evt] = [this._events[evt], listener];
5472
5473 return this;
5474};
5475
5476/**
5477 * Remove the listeners of a given event.
5478 *
5479 * @param {String|Symbol} event The event name.
5480 * @param {Function} fn Only remove the listeners that match this function.
5481 * @param {Mixed} context Only remove the listeners that have this context.
5482 * @param {Boolean} once Only remove one-time listeners.
5483 * @returns {EventEmitter} `this`.
5484 * @api public
5485 */
5486EventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) {
5487 var evt = prefix ? prefix + event : event;
5488
5489 if (!this._events[evt]) return this;
5490 if (!fn) {
5491 if (--this._eventsCount === 0) this._events = new Events();
5492 else delete this._events[evt];
5493 return this;
5494 }
5495
5496 var listeners = this._events[evt];
5497
5498 if (listeners.fn) {
5499 if (
5500 listeners.fn === fn
5501 && (!once || listeners.once)
5502 && (!context || listeners.context === context)
5503 ) {
5504 if (--this._eventsCount === 0) this._events = new Events();
5505 else delete this._events[evt];
5506 }
5507 } else {
5508 for (var i = 0, events = [], length = listeners.length; i < length; i++) {
5509 if (
5510 listeners[i].fn !== fn
5511 || (once && !listeners[i].once)
5512 || (context && listeners[i].context !== context)
5513 ) {
5514 events.push(listeners[i]);
5515 }
5516 }
5517
5518 //
5519 // Reset the array, or remove it completely if we have no more listeners.
5520 //
5521 if (events.length) this._events[evt] = events.length === 1 ? events[0] : events;
5522 else if (--this._eventsCount === 0) this._events = new Events();
5523 else delete this._events[evt];
5524 }
5525
5526 return this;
5527};
5528
5529/**
5530 * Remove all listeners, or those of the specified event.
5531 *
5532 * @param {String|Symbol} [event] The event name.
5533 * @returns {EventEmitter} `this`.
5534 * @api public
5535 */
5536EventEmitter.prototype.removeAllListeners = function removeAllListeners(event) {
5537 var evt;
5538
5539 if (event) {
5540 evt = prefix ? prefix + event : event;
5541 if (this._events[evt]) {
5542 if (--this._eventsCount === 0) this._events = new Events();
5543 else delete this._events[evt];
5544 }
5545 } else {
5546 this._events = new Events();
5547 this._eventsCount = 0;
5548 }
5549
5550 return this;
5551};
5552
5553//
5554// Alias methods names because people roll like that.
5555//
5556EventEmitter.prototype.off = EventEmitter.prototype.removeListener;
5557EventEmitter.prototype.addListener = EventEmitter.prototype.on;
5558
5559//
5560// This function doesn't apply anymore.
5561//
5562EventEmitter.prototype.setMaxListeners = function setMaxListeners() {
5563 return this;
5564};
5565
5566//
5567// Expose the prefix.
5568//
5569EventEmitter.prefixed = prefix;
5570
5571//
5572// Allow `EventEmitter` to be imported as module namespace.
5573//
5574EventEmitter.EventEmitter = EventEmitter;
5575
5576//
5577// Expose the module.
5578//
5579if (true) {
5580 module.exports = EventEmitter;
5581}
5582
5583
5584/***/ }),
5585/* 158 */
5586/***/ (function(module, exports, __webpack_require__) {
5587
5588"use strict";
5589
5590
5591var _promise = __webpack_require__(4);
5592
5593var _promise2 = _interopRequireDefault(_promise);
5594
5595function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
5596
5597var _require = __webpack_require__(36),
5598 getAdapter = _require.getAdapter;
5599
5600var syncApiNames = ['getItem', 'setItem', 'removeItem', 'clear'];
5601
5602var localStorage = {
5603 get async() {
5604 return getAdapter('storage').async;
5605 }
5606};
5607
5608// wrap sync apis with async ones.
5609syncApiNames.forEach(function (apiName) {
5610 localStorage[apiName + 'Async'] = function () {
5611 var storage = getAdapter('storage');
5612 return _promise2.default.resolve(storage[apiName].apply(storage, arguments));
5613 };
5614
5615 localStorage[apiName] = function () {
5616 var storage = getAdapter('storage');
5617 if (!storage.async) {
5618 return storage[apiName].apply(storage, arguments);
5619 }
5620 var error = new Error('Synchronous API [' + apiName + '] is not available in this runtime.');
5621 error.code = 'SYNC_API_NOT_AVAILABLE';
5622 throw error;
5623 };
5624});
5625
5626module.exports = localStorage;
5627
5628/***/ }),
5629/* 159 */
5630/***/ (function(module, exports, __webpack_require__) {
5631
5632"use strict";
5633
5634
5635var _stringify = __webpack_require__(18);
5636
5637var _stringify2 = _interopRequireDefault(_stringify);
5638
5639function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
5640
5641var storage = __webpack_require__(158);
5642var AV = __webpack_require__(34);
5643
5644var removeAsync = exports.removeAsync = storage.removeItemAsync.bind(storage);
5645
5646var getCacheData = function getCacheData(cacheData, key) {
5647 try {
5648 cacheData = JSON.parse(cacheData);
5649 } catch (e) {
5650 return null;
5651 }
5652 if (cacheData) {
5653 var expired = cacheData.expiredAt && cacheData.expiredAt < Date.now();
5654 if (!expired) {
5655 return cacheData.value;
5656 }
5657 return removeAsync(key).then(function () {
5658 return null;
5659 });
5660 }
5661 return null;
5662};
5663
5664exports.getAsync = function (key) {
5665 key = 'AV/' + AV.applicationId + '/' + key;
5666 return storage.getItemAsync(key).then(function (cache) {
5667 return getCacheData(cache, key);
5668 });
5669};
5670
5671exports.setAsync = function (key, value, ttl) {
5672 var cache = { value: value };
5673 if (typeof ttl === 'number') {
5674 cache.expiredAt = Date.now() + ttl;
5675 }
5676 return storage.setItemAsync('AV/' + AV.applicationId + '/' + key, (0, _stringify2.default)(cache));
5677};
5678
5679/***/ }),
5680/* 160 */
5681/***/ (function(module, exports) {
5682
5683exports.f = Object.getOwnPropertySymbols;
5684
5685
5686/***/ }),
5687/* 161 */
5688/***/ (function(module, exports, __webpack_require__) {
5689
5690// 19.1.2.7 / 15.2.3.4 Object.getOwnPropertyNames(O)
5691var $keys = __webpack_require__(95);
5692var hiddenKeys = __webpack_require__(67).concat('length', 'prototype');
5693
5694exports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
5695 return $keys(O, hiddenKeys);
5696};
5697
5698
5699/***/ }),
5700/* 162 */
5701/***/ (function(module, exports, __webpack_require__) {
5702
5703module.exports = { "default": __webpack_require__(305), __esModule: true };
5704
5705/***/ }),
5706/* 163 */
5707/***/ (function(module, exports) {
5708
5709var charenc = {
5710 // UTF-8 encoding
5711 utf8: {
5712 // Convert a string to a byte array
5713 stringToBytes: function(str) {
5714 return charenc.bin.stringToBytes(unescape(encodeURIComponent(str)));
5715 },
5716
5717 // Convert a byte array to a string
5718 bytesToString: function(bytes) {
5719 return decodeURIComponent(escape(charenc.bin.bytesToString(bytes)));
5720 }
5721 },
5722
5723 // Binary encoding
5724 bin: {
5725 // Convert a string to a byte array
5726 stringToBytes: function(str) {
5727 for (var bytes = [], i = 0; i < str.length; i++)
5728 bytes.push(str.charCodeAt(i) & 0xFF);
5729 return bytes;
5730 },
5731
5732 // Convert a byte array to a string
5733 bytesToString: function(bytes) {
5734 for (var str = [], i = 0; i < bytes.length; i++)
5735 str.push(String.fromCharCode(bytes[i]));
5736 return str.join('');
5737 }
5738 }
5739};
5740
5741module.exports = charenc;
5742
5743
5744/***/ }),
5745/* 164 */
5746/***/ (function(module, exports, __webpack_require__) {
5747
5748"use strict";
5749
5750
5751module.exports = __webpack_require__(165);
5752
5753/***/ }),
5754/* 165 */
5755/***/ (function(module, exports, __webpack_require__) {
5756
5757"use strict";
5758
5759
5760var _promise = __webpack_require__(4);
5761
5762var _promise2 = _interopRequireDefault(_promise);
5763
5764function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
5765
5766/*!
5767 * LeanCloud JavaScript SDK
5768 * https://leancloud.cn
5769 *
5770 * Copyright 2016 LeanCloud.cn, Inc.
5771 * The LeanCloud JavaScript SDK is freely distributable under the MIT license.
5772 */
5773var _ = __webpack_require__(0);
5774
5775var AV = __webpack_require__(34);
5776
5777AV._ = _;
5778AV.version = __webpack_require__(156);
5779AV.Promise = _promise2.default;
5780AV.localStorage = __webpack_require__(158);
5781AV.Cache = __webpack_require__(159);
5782AV.Error = __webpack_require__(29);
5783
5784__webpack_require__(270);
5785__webpack_require__(286)(AV);
5786__webpack_require__(287)(AV);
5787__webpack_require__(288)(AV);
5788__webpack_require__(289)(AV);
5789__webpack_require__(290)(AV);
5790__webpack_require__(291)(AV);
5791__webpack_require__(313)(AV);
5792__webpack_require__(321)(AV);
5793__webpack_require__(322)(AV);
5794__webpack_require__(324)(AV);
5795__webpack_require__(325)(AV);
5796__webpack_require__(326)(AV);
5797__webpack_require__(327)(AV);
5798__webpack_require__(328)(AV);
5799__webpack_require__(329)(AV);
5800__webpack_require__(330)(AV);
5801__webpack_require__(331)(AV);
5802__webpack_require__(332)(AV);
5803
5804AV.Conversation = __webpack_require__(333);
5805__webpack_require__(334);
5806module.exports = AV;
5807
5808/**
5809 * Options to controll the authentication for an operation
5810 * @typedef {Object} AuthOptions
5811 * @property {String} [sessionToken] Specify a user to excute the operation as.
5812 * @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.
5813 * @property {Boolean} [useMasterKey] Indicates whether masterKey is used for this operation. Only valid when masterKey is set.
5814 */
5815
5816/**
5817 * Options to controll the authentication for an SMS operation
5818 * @typedef {Object} SMSAuthOptions
5819 * @property {String} [sessionToken] Specify a user to excute the operation as.
5820 * @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.
5821 * @property {Boolean} [useMasterKey] Indicates whether masterKey is used for this operation. Only valid when masterKey is set.
5822 * @property {String} [validateToken] a validate token returned by {@link AV.Cloud.verifyCaptcha}
5823 */
5824
5825/***/ }),
5826/* 166 */
5827/***/ (function(module, exports, __webpack_require__) {
5828
5829__webpack_require__(91);
5830__webpack_require__(47);
5831__webpack_require__(54);
5832__webpack_require__(176);
5833__webpack_require__(187);
5834__webpack_require__(188);
5835module.exports = __webpack_require__(2).Promise;
5836
5837
5838/***/ }),
5839/* 167 */
5840/***/ (function(module, exports, __webpack_require__) {
5841
5842var toInteger = __webpack_require__(60);
5843var defined = __webpack_require__(61);
5844// true -> String#at
5845// false -> String#codePointAt
5846module.exports = function (TO_STRING) {
5847 return function (that, pos) {
5848 var s = String(defined(that));
5849 var i = toInteger(pos);
5850 var l = s.length;
5851 var a, b;
5852 if (i < 0 || i >= l) return TO_STRING ? '' : undefined;
5853 a = s.charCodeAt(i);
5854 return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff
5855 ? TO_STRING ? s.charAt(i) : a
5856 : TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000;
5857 };
5858};
5859
5860
5861/***/ }),
5862/* 168 */
5863/***/ (function(module, exports, __webpack_require__) {
5864
5865"use strict";
5866
5867var create = __webpack_require__(64);
5868var descriptor = __webpack_require__(49);
5869var setToStringTag = __webpack_require__(52);
5870var IteratorPrototype = {};
5871
5872// 25.1.2.1.1 %IteratorPrototype%[@@iterator]()
5873__webpack_require__(23)(IteratorPrototype, __webpack_require__(7)('iterator'), function () { return this; });
5874
5875module.exports = function (Constructor, NAME, next) {
5876 Constructor.prototype = create(IteratorPrototype, { next: descriptor(1, next) });
5877 setToStringTag(Constructor, NAME + ' Iterator');
5878};
5879
5880
5881/***/ }),
5882/* 169 */
5883/***/ (function(module, exports, __webpack_require__) {
5884
5885var dP = __webpack_require__(19);
5886var anObject = __webpack_require__(16);
5887var getKeys = __webpack_require__(50);
5888
5889module.exports = __webpack_require__(21) ? Object.defineProperties : function defineProperties(O, Properties) {
5890 anObject(O);
5891 var keys = getKeys(Properties);
5892 var length = keys.length;
5893 var i = 0;
5894 var P;
5895 while (length > i) dP.f(O, P = keys[i++], Properties[P]);
5896 return O;
5897};
5898
5899
5900/***/ }),
5901/* 170 */
5902/***/ (function(module, exports, __webpack_require__) {
5903
5904// fallback for non-array-like ES3 and non-enumerable old V8 strings
5905var cof = __webpack_require__(40);
5906// eslint-disable-next-line no-prototype-builtins
5907module.exports = Object('z').propertyIsEnumerable(0) ? Object : function (it) {
5908 return cof(it) == 'String' ? it.split('') : Object(it);
5909};
5910
5911
5912/***/ }),
5913/* 171 */
5914/***/ (function(module, exports, __webpack_require__) {
5915
5916// false -> Array#indexOf
5917// true -> Array#includes
5918var toIObject = __webpack_require__(25);
5919var toLength = __webpack_require__(96);
5920var toAbsoluteIndex = __webpack_require__(172);
5921module.exports = function (IS_INCLUDES) {
5922 return function ($this, el, fromIndex) {
5923 var O = toIObject($this);
5924 var length = toLength(O.length);
5925 var index = toAbsoluteIndex(fromIndex, length);
5926 var value;
5927 // Array#includes uses SameValueZero equality algorithm
5928 // eslint-disable-next-line no-self-compare
5929 if (IS_INCLUDES && el != el) while (length > index) {
5930 value = O[index++];
5931 // eslint-disable-next-line no-self-compare
5932 if (value != value) return true;
5933 // Array#indexOf ignores holes, Array#includes - not
5934 } else for (;length > index; index++) if (IS_INCLUDES || index in O) {
5935 if (O[index] === el) return IS_INCLUDES || index || 0;
5936 } return !IS_INCLUDES && -1;
5937 };
5938};
5939
5940
5941/***/ }),
5942/* 172 */
5943/***/ (function(module, exports, __webpack_require__) {
5944
5945var toInteger = __webpack_require__(60);
5946var max = Math.max;
5947var min = Math.min;
5948module.exports = function (index, length) {
5949 index = toInteger(index);
5950 return index < 0 ? max(index + length, 0) : min(index, length);
5951};
5952
5953
5954/***/ }),
5955/* 173 */
5956/***/ (function(module, exports, __webpack_require__) {
5957
5958"use strict";
5959
5960var addToUnscopables = __webpack_require__(174);
5961var step = __webpack_require__(175);
5962var Iterators = __webpack_require__(30);
5963var toIObject = __webpack_require__(25);
5964
5965// 22.1.3.4 Array.prototype.entries()
5966// 22.1.3.13 Array.prototype.keys()
5967// 22.1.3.29 Array.prototype.values()
5968// 22.1.3.30 Array.prototype[@@iterator]()
5969module.exports = __webpack_require__(92)(Array, 'Array', function (iterated, kind) {
5970 this._t = toIObject(iterated); // target
5971 this._i = 0; // next index
5972 this._k = kind; // kind
5973// 22.1.5.2.1 %ArrayIteratorPrototype%.next()
5974}, function () {
5975 var O = this._t;
5976 var kind = this._k;
5977 var index = this._i++;
5978 if (!O || index >= O.length) {
5979 this._t = undefined;
5980 return step(1);
5981 }
5982 if (kind == 'keys') return step(0, index);
5983 if (kind == 'values') return step(0, O[index]);
5984 return step(0, [index, O[index]]);
5985}, 'values');
5986
5987// argumentsList[@@iterator] is %ArrayProto_values% (9.4.4.6, 9.4.4.7)
5988Iterators.Arguments = Iterators.Array;
5989
5990addToUnscopables('keys');
5991addToUnscopables('values');
5992addToUnscopables('entries');
5993
5994
5995/***/ }),
5996/* 174 */
5997/***/ (function(module, exports) {
5998
5999module.exports = function () { /* empty */ };
6000
6001
6002/***/ }),
6003/* 175 */
6004/***/ (function(module, exports) {
6005
6006module.exports = function (done, value) {
6007 return { value: value, done: !!done };
6008};
6009
6010
6011/***/ }),
6012/* 176 */
6013/***/ (function(module, exports, __webpack_require__) {
6014
6015"use strict";
6016
6017var LIBRARY = __webpack_require__(37);
6018var global = __webpack_require__(6);
6019var ctx = __webpack_require__(38);
6020var classof = __webpack_require__(68);
6021var $export = __webpack_require__(17);
6022var isObject = __webpack_require__(20);
6023var aFunction = __webpack_require__(48);
6024var anInstance = __webpack_require__(177);
6025var forOf = __webpack_require__(178);
6026var speciesConstructor = __webpack_require__(100);
6027var task = __webpack_require__(101).set;
6028var microtask = __webpack_require__(182)();
6029var newPromiseCapabilityModule = __webpack_require__(69);
6030var perform = __webpack_require__(102);
6031var userAgent = __webpack_require__(183);
6032var promiseResolve = __webpack_require__(103);
6033var PROMISE = 'Promise';
6034var TypeError = global.TypeError;
6035var process = global.process;
6036var versions = process && process.versions;
6037var v8 = versions && versions.v8 || '';
6038var $Promise = global[PROMISE];
6039var isNode = classof(process) == 'process';
6040var empty = function () { /* empty */ };
6041var Internal, newGenericPromiseCapability, OwnPromiseCapability, Wrapper;
6042var newPromiseCapability = newGenericPromiseCapability = newPromiseCapabilityModule.f;
6043
6044var USE_NATIVE = !!function () {
6045 try {
6046 // correct subclassing with @@species support
6047 var promise = $Promise.resolve(1);
6048 var FakePromise = (promise.constructor = {})[__webpack_require__(7)('species')] = function (exec) {
6049 exec(empty, empty);
6050 };
6051 // unhandled rejections tracking support, NodeJS Promise without it fails @@species test
6052 return (isNode || typeof PromiseRejectionEvent == 'function')
6053 && promise.then(empty) instanceof FakePromise
6054 // v8 6.6 (Node 10 and Chrome 66) have a bug with resolving custom thenables
6055 // https://bugs.chromium.org/p/chromium/issues/detail?id=830565
6056 // we can't detect it synchronously, so just check versions
6057 && v8.indexOf('6.6') !== 0
6058 && userAgent.indexOf('Chrome/66') === -1;
6059 } catch (e) { /* empty */ }
6060}();
6061
6062// helpers
6063var isThenable = function (it) {
6064 var then;
6065 return isObject(it) && typeof (then = it.then) == 'function' ? then : false;
6066};
6067var notify = function (promise, isReject) {
6068 if (promise._n) return;
6069 promise._n = true;
6070 var chain = promise._c;
6071 microtask(function () {
6072 var value = promise._v;
6073 var ok = promise._s == 1;
6074 var i = 0;
6075 var run = function (reaction) {
6076 var handler = ok ? reaction.ok : reaction.fail;
6077 var resolve = reaction.resolve;
6078 var reject = reaction.reject;
6079 var domain = reaction.domain;
6080 var result, then, exited;
6081 try {
6082 if (handler) {
6083 if (!ok) {
6084 if (promise._h == 2) onHandleUnhandled(promise);
6085 promise._h = 1;
6086 }
6087 if (handler === true) result = value;
6088 else {
6089 if (domain) domain.enter();
6090 result = handler(value); // may throw
6091 if (domain) {
6092 domain.exit();
6093 exited = true;
6094 }
6095 }
6096 if (result === reaction.promise) {
6097 reject(TypeError('Promise-chain cycle'));
6098 } else if (then = isThenable(result)) {
6099 then.call(result, resolve, reject);
6100 } else resolve(result);
6101 } else reject(value);
6102 } catch (e) {
6103 if (domain && !exited) domain.exit();
6104 reject(e);
6105 }
6106 };
6107 while (chain.length > i) run(chain[i++]); // variable length - can't use forEach
6108 promise._c = [];
6109 promise._n = false;
6110 if (isReject && !promise._h) onUnhandled(promise);
6111 });
6112};
6113var onUnhandled = function (promise) {
6114 task.call(global, function () {
6115 var value = promise._v;
6116 var unhandled = isUnhandled(promise);
6117 var result, handler, console;
6118 if (unhandled) {
6119 result = perform(function () {
6120 if (isNode) {
6121 process.emit('unhandledRejection', value, promise);
6122 } else if (handler = global.onunhandledrejection) {
6123 handler({ promise: promise, reason: value });
6124 } else if ((console = global.console) && console.error) {
6125 console.error('Unhandled promise rejection', value);
6126 }
6127 });
6128 // Browsers should not trigger `rejectionHandled` event if it was handled here, NodeJS - should
6129 promise._h = isNode || isUnhandled(promise) ? 2 : 1;
6130 } promise._a = undefined;
6131 if (unhandled && result.e) throw result.v;
6132 });
6133};
6134var isUnhandled = function (promise) {
6135 return promise._h !== 1 && (promise._a || promise._c).length === 0;
6136};
6137var onHandleUnhandled = function (promise) {
6138 task.call(global, function () {
6139 var handler;
6140 if (isNode) {
6141 process.emit('rejectionHandled', promise);
6142 } else if (handler = global.onrejectionhandled) {
6143 handler({ promise: promise, reason: promise._v });
6144 }
6145 });
6146};
6147var $reject = function (value) {
6148 var promise = this;
6149 if (promise._d) return;
6150 promise._d = true;
6151 promise = promise._w || promise; // unwrap
6152 promise._v = value;
6153 promise._s = 2;
6154 if (!promise._a) promise._a = promise._c.slice();
6155 notify(promise, true);
6156};
6157var $resolve = function (value) {
6158 var promise = this;
6159 var then;
6160 if (promise._d) return;
6161 promise._d = true;
6162 promise = promise._w || promise; // unwrap
6163 try {
6164 if (promise === value) throw TypeError("Promise can't be resolved itself");
6165 if (then = isThenable(value)) {
6166 microtask(function () {
6167 var wrapper = { _w: promise, _d: false }; // wrap
6168 try {
6169 then.call(value, ctx($resolve, wrapper, 1), ctx($reject, wrapper, 1));
6170 } catch (e) {
6171 $reject.call(wrapper, e);
6172 }
6173 });
6174 } else {
6175 promise._v = value;
6176 promise._s = 1;
6177 notify(promise, false);
6178 }
6179 } catch (e) {
6180 $reject.call({ _w: promise, _d: false }, e); // wrap
6181 }
6182};
6183
6184// constructor polyfill
6185if (!USE_NATIVE) {
6186 // 25.4.3.1 Promise(executor)
6187 $Promise = function Promise(executor) {
6188 anInstance(this, $Promise, PROMISE, '_h');
6189 aFunction(executor);
6190 Internal.call(this);
6191 try {
6192 executor(ctx($resolve, this, 1), ctx($reject, this, 1));
6193 } catch (err) {
6194 $reject.call(this, err);
6195 }
6196 };
6197 // eslint-disable-next-line no-unused-vars
6198 Internal = function Promise(executor) {
6199 this._c = []; // <- awaiting reactions
6200 this._a = undefined; // <- checked in isUnhandled reactions
6201 this._s = 0; // <- state
6202 this._d = false; // <- done
6203 this._v = undefined; // <- value
6204 this._h = 0; // <- rejection state, 0 - default, 1 - handled, 2 - unhandled
6205 this._n = false; // <- notify
6206 };
6207 Internal.prototype = __webpack_require__(184)($Promise.prototype, {
6208 // 25.4.5.3 Promise.prototype.then(onFulfilled, onRejected)
6209 then: function then(onFulfilled, onRejected) {
6210 var reaction = newPromiseCapability(speciesConstructor(this, $Promise));
6211 reaction.ok = typeof onFulfilled == 'function' ? onFulfilled : true;
6212 reaction.fail = typeof onRejected == 'function' && onRejected;
6213 reaction.domain = isNode ? process.domain : undefined;
6214 this._c.push(reaction);
6215 if (this._a) this._a.push(reaction);
6216 if (this._s) notify(this, false);
6217 return reaction.promise;
6218 },
6219 // 25.4.5.1 Promise.prototype.catch(onRejected)
6220 'catch': function (onRejected) {
6221 return this.then(undefined, onRejected);
6222 }
6223 });
6224 OwnPromiseCapability = function () {
6225 var promise = new Internal();
6226 this.promise = promise;
6227 this.resolve = ctx($resolve, promise, 1);
6228 this.reject = ctx($reject, promise, 1);
6229 };
6230 newPromiseCapabilityModule.f = newPromiseCapability = function (C) {
6231 return C === $Promise || C === Wrapper
6232 ? new OwnPromiseCapability(C)
6233 : newGenericPromiseCapability(C);
6234 };
6235}
6236
6237$export($export.G + $export.W + $export.F * !USE_NATIVE, { Promise: $Promise });
6238__webpack_require__(52)($Promise, PROMISE);
6239__webpack_require__(185)(PROMISE);
6240Wrapper = __webpack_require__(2)[PROMISE];
6241
6242// statics
6243$export($export.S + $export.F * !USE_NATIVE, PROMISE, {
6244 // 25.4.4.5 Promise.reject(r)
6245 reject: function reject(r) {
6246 var capability = newPromiseCapability(this);
6247 var $$reject = capability.reject;
6248 $$reject(r);
6249 return capability.promise;
6250 }
6251});
6252$export($export.S + $export.F * (LIBRARY || !USE_NATIVE), PROMISE, {
6253 // 25.4.4.6 Promise.resolve(x)
6254 resolve: function resolve(x) {
6255 return promiseResolve(LIBRARY && this === Wrapper ? $Promise : this, x);
6256 }
6257});
6258$export($export.S + $export.F * !(USE_NATIVE && __webpack_require__(186)(function (iter) {
6259 $Promise.all(iter)['catch'](empty);
6260})), PROMISE, {
6261 // 25.4.4.1 Promise.all(iterable)
6262 all: function all(iterable) {
6263 var C = this;
6264 var capability = newPromiseCapability(C);
6265 var resolve = capability.resolve;
6266 var reject = capability.reject;
6267 var result = perform(function () {
6268 var values = [];
6269 var index = 0;
6270 var remaining = 1;
6271 forOf(iterable, false, function (promise) {
6272 var $index = index++;
6273 var alreadyCalled = false;
6274 values.push(undefined);
6275 remaining++;
6276 C.resolve(promise).then(function (value) {
6277 if (alreadyCalled) return;
6278 alreadyCalled = true;
6279 values[$index] = value;
6280 --remaining || resolve(values);
6281 }, reject);
6282 });
6283 --remaining || resolve(values);
6284 });
6285 if (result.e) reject(result.v);
6286 return capability.promise;
6287 },
6288 // 25.4.4.4 Promise.race(iterable)
6289 race: function race(iterable) {
6290 var C = this;
6291 var capability = newPromiseCapability(C);
6292 var reject = capability.reject;
6293 var result = perform(function () {
6294 forOf(iterable, false, function (promise) {
6295 C.resolve(promise).then(capability.resolve, reject);
6296 });
6297 });
6298 if (result.e) reject(result.v);
6299 return capability.promise;
6300 }
6301});
6302
6303
6304/***/ }),
6305/* 177 */
6306/***/ (function(module, exports) {
6307
6308module.exports = function (it, Constructor, name, forbiddenField) {
6309 if (!(it instanceof Constructor) || (forbiddenField !== undefined && forbiddenField in it)) {
6310 throw TypeError(name + ': incorrect invocation!');
6311 } return it;
6312};
6313
6314
6315/***/ }),
6316/* 178 */
6317/***/ (function(module, exports, __webpack_require__) {
6318
6319var ctx = __webpack_require__(38);
6320var call = __webpack_require__(179);
6321var isArrayIter = __webpack_require__(180);
6322var anObject = __webpack_require__(16);
6323var toLength = __webpack_require__(96);
6324var getIterFn = __webpack_require__(99);
6325var BREAK = {};
6326var RETURN = {};
6327var exports = module.exports = function (iterable, entries, fn, that, ITERATOR) {
6328 var iterFn = ITERATOR ? function () { return iterable; } : getIterFn(iterable);
6329 var f = ctx(fn, that, entries ? 2 : 1);
6330 var index = 0;
6331 var length, step, iterator, result;
6332 if (typeof iterFn != 'function') throw TypeError(iterable + ' is not iterable!');
6333 // fast case for arrays with default iterator
6334 if (isArrayIter(iterFn)) for (length = toLength(iterable.length); length > index; index++) {
6335 result = entries ? f(anObject(step = iterable[index])[0], step[1]) : f(iterable[index]);
6336 if (result === BREAK || result === RETURN) return result;
6337 } else for (iterator = iterFn.call(iterable); !(step = iterator.next()).done;) {
6338 result = call(iterator, f, step.value, entries);
6339 if (result === BREAK || result === RETURN) return result;
6340 }
6341};
6342exports.BREAK = BREAK;
6343exports.RETURN = RETURN;
6344
6345
6346/***/ }),
6347/* 179 */
6348/***/ (function(module, exports, __webpack_require__) {
6349
6350// call something on iterator step with safe closing on error
6351var anObject = __webpack_require__(16);
6352module.exports = function (iterator, fn, value, entries) {
6353 try {
6354 return entries ? fn(anObject(value)[0], value[1]) : fn(value);
6355 // 7.4.6 IteratorClose(iterator, completion)
6356 } catch (e) {
6357 var ret = iterator['return'];
6358 if (ret !== undefined) anObject(ret.call(iterator));
6359 throw e;
6360 }
6361};
6362
6363
6364/***/ }),
6365/* 180 */
6366/***/ (function(module, exports, __webpack_require__) {
6367
6368// check on default Array iterator
6369var Iterators = __webpack_require__(30);
6370var ITERATOR = __webpack_require__(7)('iterator');
6371var ArrayProto = Array.prototype;
6372
6373module.exports = function (it) {
6374 return it !== undefined && (Iterators.Array === it || ArrayProto[ITERATOR] === it);
6375};
6376
6377
6378/***/ }),
6379/* 181 */
6380/***/ (function(module, exports) {
6381
6382// fast apply, http://jsperf.lnkit.com/fast-apply/5
6383module.exports = function (fn, args, that) {
6384 var un = that === undefined;
6385 switch (args.length) {
6386 case 0: return un ? fn()
6387 : fn.call(that);
6388 case 1: return un ? fn(args[0])
6389 : fn.call(that, args[0]);
6390 case 2: return un ? fn(args[0], args[1])
6391 : fn.call(that, args[0], args[1]);
6392 case 3: return un ? fn(args[0], args[1], args[2])
6393 : fn.call(that, args[0], args[1], args[2]);
6394 case 4: return un ? fn(args[0], args[1], args[2], args[3])
6395 : fn.call(that, args[0], args[1], args[2], args[3]);
6396 } return fn.apply(that, args);
6397};
6398
6399
6400/***/ }),
6401/* 182 */
6402/***/ (function(module, exports, __webpack_require__) {
6403
6404var global = __webpack_require__(6);
6405var macrotask = __webpack_require__(101).set;
6406var Observer = global.MutationObserver || global.WebKitMutationObserver;
6407var process = global.process;
6408var Promise = global.Promise;
6409var isNode = __webpack_require__(40)(process) == 'process';
6410
6411module.exports = function () {
6412 var head, last, notify;
6413
6414 var flush = function () {
6415 var parent, fn;
6416 if (isNode && (parent = process.domain)) parent.exit();
6417 while (head) {
6418 fn = head.fn;
6419 head = head.next;
6420 try {
6421 fn();
6422 } catch (e) {
6423 if (head) notify();
6424 else last = undefined;
6425 throw e;
6426 }
6427 } last = undefined;
6428 if (parent) parent.enter();
6429 };
6430
6431 // Node.js
6432 if (isNode) {
6433 notify = function () {
6434 process.nextTick(flush);
6435 };
6436 // browsers with MutationObserver, except iOS Safari - https://github.com/zloirock/core-js/issues/339
6437 } else if (Observer && !(global.navigator && global.navigator.standalone)) {
6438 var toggle = true;
6439 var node = document.createTextNode('');
6440 new Observer(flush).observe(node, { characterData: true }); // eslint-disable-line no-new
6441 notify = function () {
6442 node.data = toggle = !toggle;
6443 };
6444 // environments with maybe non-completely correct, but existent Promise
6445 } else if (Promise && Promise.resolve) {
6446 // Promise.resolve without an argument throws an error in LG WebOS 2
6447 var promise = Promise.resolve(undefined);
6448 notify = function () {
6449 promise.then(flush);
6450 };
6451 // for other environments - macrotask based on:
6452 // - setImmediate
6453 // - MessageChannel
6454 // - window.postMessag
6455 // - onreadystatechange
6456 // - setTimeout
6457 } else {
6458 notify = function () {
6459 // strange IE + webpack dev server bug - use .call(global)
6460 macrotask.call(global, flush);
6461 };
6462 }
6463
6464 return function (fn) {
6465 var task = { fn: fn, next: undefined };
6466 if (last) last.next = task;
6467 if (!head) {
6468 head = task;
6469 notify();
6470 } last = task;
6471 };
6472};
6473
6474
6475/***/ }),
6476/* 183 */
6477/***/ (function(module, exports, __webpack_require__) {
6478
6479var global = __webpack_require__(6);
6480var navigator = global.navigator;
6481
6482module.exports = navigator && navigator.userAgent || '';
6483
6484
6485/***/ }),
6486/* 184 */
6487/***/ (function(module, exports, __webpack_require__) {
6488
6489var hide = __webpack_require__(23);
6490module.exports = function (target, src, safe) {
6491 for (var key in src) {
6492 if (safe && target[key]) target[key] = src[key];
6493 else hide(target, key, src[key]);
6494 } return target;
6495};
6496
6497
6498/***/ }),
6499/* 185 */
6500/***/ (function(module, exports, __webpack_require__) {
6501
6502"use strict";
6503
6504var global = __webpack_require__(6);
6505var core = __webpack_require__(2);
6506var dP = __webpack_require__(19);
6507var DESCRIPTORS = __webpack_require__(21);
6508var SPECIES = __webpack_require__(7)('species');
6509
6510module.exports = function (KEY) {
6511 var C = typeof core[KEY] == 'function' ? core[KEY] : global[KEY];
6512 if (DESCRIPTORS && C && !C[SPECIES]) dP.f(C, SPECIES, {
6513 configurable: true,
6514 get: function () { return this; }
6515 });
6516};
6517
6518
6519/***/ }),
6520/* 186 */
6521/***/ (function(module, exports, __webpack_require__) {
6522
6523var ITERATOR = __webpack_require__(7)('iterator');
6524var SAFE_CLOSING = false;
6525
6526try {
6527 var riter = [7][ITERATOR]();
6528 riter['return'] = function () { SAFE_CLOSING = true; };
6529 // eslint-disable-next-line no-throw-literal
6530 Array.from(riter, function () { throw 2; });
6531} catch (e) { /* empty */ }
6532
6533module.exports = function (exec, skipClosing) {
6534 if (!skipClosing && !SAFE_CLOSING) return false;
6535 var safe = false;
6536 try {
6537 var arr = [7];
6538 var iter = arr[ITERATOR]();
6539 iter.next = function () { return { done: safe = true }; };
6540 arr[ITERATOR] = function () { return iter; };
6541 exec(arr);
6542 } catch (e) { /* empty */ }
6543 return safe;
6544};
6545
6546
6547/***/ }),
6548/* 187 */
6549/***/ (function(module, exports, __webpack_require__) {
6550
6551"use strict";
6552// https://github.com/tc39/proposal-promise-finally
6553
6554var $export = __webpack_require__(17);
6555var core = __webpack_require__(2);
6556var global = __webpack_require__(6);
6557var speciesConstructor = __webpack_require__(100);
6558var promiseResolve = __webpack_require__(103);
6559
6560$export($export.P + $export.R, 'Promise', { 'finally': function (onFinally) {
6561 var C = speciesConstructor(this, core.Promise || global.Promise);
6562 var isFunction = typeof onFinally == 'function';
6563 return this.then(
6564 isFunction ? function (x) {
6565 return promiseResolve(C, onFinally()).then(function () { return x; });
6566 } : onFinally,
6567 isFunction ? function (e) {
6568 return promiseResolve(C, onFinally()).then(function () { throw e; });
6569 } : onFinally
6570 );
6571} });
6572
6573
6574/***/ }),
6575/* 188 */
6576/***/ (function(module, exports, __webpack_require__) {
6577
6578"use strict";
6579
6580// https://github.com/tc39/proposal-promise-try
6581var $export = __webpack_require__(17);
6582var newPromiseCapability = __webpack_require__(69);
6583var perform = __webpack_require__(102);
6584
6585$export($export.S, 'Promise', { 'try': function (callbackfn) {
6586 var promiseCapability = newPromiseCapability.f(this);
6587 var result = perform(callbackfn);
6588 (result.e ? promiseCapability.reject : promiseCapability.resolve)(result.v);
6589 return promiseCapability.promise;
6590} });
6591
6592
6593/***/ }),
6594/* 189 */
6595/***/ (function(module, __webpack_exports__, __webpack_require__) {
6596
6597"use strict";
6598/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__index_js__ = __webpack_require__(70);
6599// Default Export
6600// ==============
6601// In this module, we mix our bundled exports into the `_` object and export
6602// the result. This is analogous to setting `module.exports = _` in CommonJS.
6603// Hence, this module is also the entry point of our UMD bundle and the package
6604// entry point for CommonJS and AMD users. In other words, this is (the source
6605// of) the module you are interfacing with when you do any of the following:
6606//
6607// ```js
6608// // CommonJS
6609// var _ = require('underscore');
6610//
6611// // AMD
6612// define(['underscore'], function(_) {...});
6613//
6614// // UMD in the browser
6615// // _ is available as a global variable
6616// ```
6617
6618
6619
6620// Add all of the Underscore functions to the wrapper object.
6621var _ = Object(__WEBPACK_IMPORTED_MODULE_0__index_js__["mixin"])(__WEBPACK_IMPORTED_MODULE_0__index_js__);
6622// Legacy Node.js API.
6623_._ = _;
6624// Export the Underscore API.
6625/* harmony default export */ __webpack_exports__["a"] = (_);
6626
6627
6628/***/ }),
6629/* 190 */
6630/***/ (function(module, __webpack_exports__, __webpack_require__) {
6631
6632"use strict";
6633/* harmony export (immutable) */ __webpack_exports__["a"] = isNull;
6634// Is a given value equal to null?
6635function isNull(obj) {
6636 return obj === null;
6637}
6638
6639
6640/***/ }),
6641/* 191 */
6642/***/ (function(module, __webpack_exports__, __webpack_require__) {
6643
6644"use strict";
6645/* harmony export (immutable) */ __webpack_exports__["a"] = isElement;
6646// Is a given value a DOM element?
6647function isElement(obj) {
6648 return !!(obj && obj.nodeType === 1);
6649}
6650
6651
6652/***/ }),
6653/* 192 */
6654/***/ (function(module, __webpack_exports__, __webpack_require__) {
6655
6656"use strict";
6657/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(5);
6658
6659
6660/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('Date'));
6661
6662
6663/***/ }),
6664/* 193 */
6665/***/ (function(module, __webpack_exports__, __webpack_require__) {
6666
6667"use strict";
6668/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(5);
6669
6670
6671/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('RegExp'));
6672
6673
6674/***/ }),
6675/* 194 */
6676/***/ (function(module, __webpack_exports__, __webpack_require__) {
6677
6678"use strict";
6679/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(5);
6680
6681
6682/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('Error'));
6683
6684
6685/***/ }),
6686/* 195 */
6687/***/ (function(module, __webpack_exports__, __webpack_require__) {
6688
6689"use strict";
6690/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(5);
6691
6692
6693/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('Object'));
6694
6695
6696/***/ }),
6697/* 196 */
6698/***/ (function(module, __webpack_exports__, __webpack_require__) {
6699
6700"use strict";
6701/* harmony export (immutable) */ __webpack_exports__["a"] = isFinite;
6702/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(1);
6703/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isSymbol_js__ = __webpack_require__(108);
6704
6705
6706
6707// Is a given object a finite number?
6708function isFinite(obj) {
6709 return !Object(__WEBPACK_IMPORTED_MODULE_1__isSymbol_js__["a" /* default */])(obj) && Object(__WEBPACK_IMPORTED_MODULE_0__setup_js__["f" /* _isFinite */])(obj) && !isNaN(parseFloat(obj));
6710}
6711
6712
6713/***/ }),
6714/* 197 */
6715/***/ (function(module, __webpack_exports__, __webpack_require__) {
6716
6717"use strict";
6718/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createSizePropertyCheck_js__ = __webpack_require__(113);
6719/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__getByteLength_js__ = __webpack_require__(74);
6720
6721
6722
6723// Internal helper to determine whether we should spend extensive checks against
6724// `ArrayBuffer` et al.
6725/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createSizePropertyCheck_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__getByteLength_js__["a" /* default */]));
6726
6727
6728/***/ }),
6729/* 198 */
6730/***/ (function(module, __webpack_exports__, __webpack_require__) {
6731
6732"use strict";
6733/* harmony export (immutable) */ __webpack_exports__["a"] = isEmpty;
6734/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__getLength_js__ = __webpack_require__(14);
6735/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isArray_js__ = __webpack_require__(27);
6736/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__isString_js__ = __webpack_require__(71);
6737/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__isArguments_js__ = __webpack_require__(73);
6738/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__keys_js__ = __webpack_require__(3);
6739
6740
6741
6742
6743
6744
6745// Is a given array, string, or object empty?
6746// An "empty" object has no enumerable own-properties.
6747function isEmpty(obj) {
6748 if (obj == null) return true;
6749 // Skip the more expensive `toString`-based type checks if `obj` has no
6750 // `.length`.
6751 var length = Object(__WEBPACK_IMPORTED_MODULE_0__getLength_js__["a" /* default */])(obj);
6752 if (typeof length == 'number' && (
6753 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)
6754 )) return length === 0;
6755 return Object(__WEBPACK_IMPORTED_MODULE_0__getLength_js__["a" /* default */])(Object(__WEBPACK_IMPORTED_MODULE_4__keys_js__["a" /* default */])(obj)) === 0;
6756}
6757
6758
6759/***/ }),
6760/* 199 */
6761/***/ (function(module, __webpack_exports__, __webpack_require__) {
6762
6763"use strict";
6764/* harmony export (immutable) */ __webpack_exports__["a"] = isEqual;
6765/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__underscore_js__ = __webpack_require__(10);
6766/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__setup_js__ = __webpack_require__(1);
6767/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__getByteLength_js__ = __webpack_require__(74);
6768/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__isTypedArray_js__ = __webpack_require__(111);
6769/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__isFunction_js__ = __webpack_require__(13);
6770/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__stringTagBug_js__ = __webpack_require__(41);
6771/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__isDataView_js__ = __webpack_require__(72);
6772/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__keys_js__ = __webpack_require__(3);
6773/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__has_js__ = __webpack_require__(22);
6774/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__toBufferView_js__ = __webpack_require__(200);
6775
6776
6777
6778
6779
6780
6781
6782
6783
6784
6785
6786// We use this string twice, so give it a name for minification.
6787var tagDataView = '[object DataView]';
6788
6789// Internal recursive comparison function for `_.isEqual`.
6790function eq(a, b, aStack, bStack) {
6791 // Identical objects are equal. `0 === -0`, but they aren't identical.
6792 // See the [Harmony `egal` proposal](https://wiki.ecmascript.org/doku.php?id=harmony:egal).
6793 if (a === b) return a !== 0 || 1 / a === 1 / b;
6794 // `null` or `undefined` only equal to itself (strict comparison).
6795 if (a == null || b == null) return false;
6796 // `NaN`s are equivalent, but non-reflexive.
6797 if (a !== a) return b !== b;
6798 // Exhaust primitive checks
6799 var type = typeof a;
6800 if (type !== 'function' && type !== 'object' && typeof b != 'object') return false;
6801 return deepEq(a, b, aStack, bStack);
6802}
6803
6804// Internal recursive comparison function for `_.isEqual`.
6805function deepEq(a, b, aStack, bStack) {
6806 // Unwrap any wrapped objects.
6807 if (a instanceof __WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */]) a = a._wrapped;
6808 if (b instanceof __WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */]) b = b._wrapped;
6809 // Compare `[[Class]]` names.
6810 var className = __WEBPACK_IMPORTED_MODULE_1__setup_js__["t" /* toString */].call(a);
6811 if (className !== __WEBPACK_IMPORTED_MODULE_1__setup_js__["t" /* toString */].call(b)) return false;
6812 // Work around a bug in IE 10 - Edge 13.
6813 if (__WEBPACK_IMPORTED_MODULE_5__stringTagBug_js__["a" /* hasStringTagBug */] && className == '[object Object]' && Object(__WEBPACK_IMPORTED_MODULE_6__isDataView_js__["a" /* default */])(a)) {
6814 if (!Object(__WEBPACK_IMPORTED_MODULE_6__isDataView_js__["a" /* default */])(b)) return false;
6815 className = tagDataView;
6816 }
6817 switch (className) {
6818 // These types are compared by value.
6819 case '[object RegExp]':
6820 // RegExps are coerced to strings for comparison (Note: '' + /a/i === '/a/i')
6821 case '[object String]':
6822 // Primitives and their corresponding object wrappers are equivalent; thus, `"5"` is
6823 // equivalent to `new String("5")`.
6824 return '' + a === '' + b;
6825 case '[object Number]':
6826 // `NaN`s are equivalent, but non-reflexive.
6827 // Object(NaN) is equivalent to NaN.
6828 if (+a !== +a) return +b !== +b;
6829 // An `egal` comparison is performed for other numeric values.
6830 return +a === 0 ? 1 / +a === 1 / b : +a === +b;
6831 case '[object Date]':
6832 case '[object Boolean]':
6833 // Coerce dates and booleans to numeric primitive values. Dates are compared by their
6834 // millisecond representations. Note that invalid dates with millisecond representations
6835 // of `NaN` are not equivalent.
6836 return +a === +b;
6837 case '[object Symbol]':
6838 return __WEBPACK_IMPORTED_MODULE_1__setup_js__["d" /* SymbolProto */].valueOf.call(a) === __WEBPACK_IMPORTED_MODULE_1__setup_js__["d" /* SymbolProto */].valueOf.call(b);
6839 case '[object ArrayBuffer]':
6840 case tagDataView:
6841 // Coerce to typed array so we can fall through.
6842 return deepEq(Object(__WEBPACK_IMPORTED_MODULE_9__toBufferView_js__["a" /* default */])(a), Object(__WEBPACK_IMPORTED_MODULE_9__toBufferView_js__["a" /* default */])(b), aStack, bStack);
6843 }
6844
6845 var areArrays = className === '[object Array]';
6846 if (!areArrays && Object(__WEBPACK_IMPORTED_MODULE_3__isTypedArray_js__["a" /* default */])(a)) {
6847 var byteLength = Object(__WEBPACK_IMPORTED_MODULE_2__getByteLength_js__["a" /* default */])(a);
6848 if (byteLength !== Object(__WEBPACK_IMPORTED_MODULE_2__getByteLength_js__["a" /* default */])(b)) return false;
6849 if (a.buffer === b.buffer && a.byteOffset === b.byteOffset) return true;
6850 areArrays = true;
6851 }
6852 if (!areArrays) {
6853 if (typeof a != 'object' || typeof b != 'object') return false;
6854
6855 // Objects with different constructors are not equivalent, but `Object`s or `Array`s
6856 // from different frames are.
6857 var aCtor = a.constructor, bCtor = b.constructor;
6858 if (aCtor !== bCtor && !(Object(__WEBPACK_IMPORTED_MODULE_4__isFunction_js__["a" /* default */])(aCtor) && aCtor instanceof aCtor &&
6859 Object(__WEBPACK_IMPORTED_MODULE_4__isFunction_js__["a" /* default */])(bCtor) && bCtor instanceof bCtor)
6860 && ('constructor' in a && 'constructor' in b)) {
6861 return false;
6862 }
6863 }
6864 // Assume equality for cyclic structures. The algorithm for detecting cyclic
6865 // structures is adapted from ES 5.1 section 15.12.3, abstract operation `JO`.
6866
6867 // Initializing stack of traversed objects.
6868 // It's done here since we only need them for objects and arrays comparison.
6869 aStack = aStack || [];
6870 bStack = bStack || [];
6871 var length = aStack.length;
6872 while (length--) {
6873 // Linear search. Performance is inversely proportional to the number of
6874 // unique nested structures.
6875 if (aStack[length] === a) return bStack[length] === b;
6876 }
6877
6878 // Add the first object to the stack of traversed objects.
6879 aStack.push(a);
6880 bStack.push(b);
6881
6882 // Recursively compare objects and arrays.
6883 if (areArrays) {
6884 // Compare array lengths to determine if a deep comparison is necessary.
6885 length = a.length;
6886 if (length !== b.length) return false;
6887 // Deep compare the contents, ignoring non-numeric properties.
6888 while (length--) {
6889 if (!eq(a[length], b[length], aStack, bStack)) return false;
6890 }
6891 } else {
6892 // Deep compare objects.
6893 var _keys = Object(__WEBPACK_IMPORTED_MODULE_7__keys_js__["a" /* default */])(a), key;
6894 length = _keys.length;
6895 // Ensure that both objects contain the same number of properties before comparing deep equality.
6896 if (Object(__WEBPACK_IMPORTED_MODULE_7__keys_js__["a" /* default */])(b).length !== length) return false;
6897 while (length--) {
6898 // Deep compare each member
6899 key = _keys[length];
6900 if (!(Object(__WEBPACK_IMPORTED_MODULE_8__has_js__["a" /* default */])(b, key) && eq(a[key], b[key], aStack, bStack))) return false;
6901 }
6902 }
6903 // Remove the first object from the stack of traversed objects.
6904 aStack.pop();
6905 bStack.pop();
6906 return true;
6907}
6908
6909// Perform a deep comparison to check if two objects are equal.
6910function isEqual(a, b) {
6911 return eq(a, b);
6912}
6913
6914
6915/***/ }),
6916/* 200 */
6917/***/ (function(module, __webpack_exports__, __webpack_require__) {
6918
6919"use strict";
6920/* harmony export (immutable) */ __webpack_exports__["a"] = toBufferView;
6921/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__getByteLength_js__ = __webpack_require__(74);
6922
6923
6924// Internal function to wrap or shallow-copy an ArrayBuffer,
6925// typed array or DataView to a new view, reusing the buffer.
6926function toBufferView(bufferSource) {
6927 return new Uint8Array(
6928 bufferSource.buffer || bufferSource,
6929 bufferSource.byteOffset || 0,
6930 Object(__WEBPACK_IMPORTED_MODULE_0__getByteLength_js__["a" /* default */])(bufferSource)
6931 );
6932}
6933
6934
6935/***/ }),
6936/* 201 */
6937/***/ (function(module, __webpack_exports__, __webpack_require__) {
6938
6939"use strict";
6940/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(5);
6941/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__stringTagBug_js__ = __webpack_require__(41);
6942/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__methodFingerprint_js__ = __webpack_require__(75);
6943
6944
6945
6946
6947/* 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'));
6948
6949
6950/***/ }),
6951/* 202 */
6952/***/ (function(module, __webpack_exports__, __webpack_require__) {
6953
6954"use strict";
6955/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(5);
6956/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__stringTagBug_js__ = __webpack_require__(41);
6957/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__methodFingerprint_js__ = __webpack_require__(75);
6958
6959
6960
6961
6962/* 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'));
6963
6964
6965/***/ }),
6966/* 203 */
6967/***/ (function(module, __webpack_exports__, __webpack_require__) {
6968
6969"use strict";
6970/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(5);
6971/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__stringTagBug_js__ = __webpack_require__(41);
6972/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__methodFingerprint_js__ = __webpack_require__(75);
6973
6974
6975
6976
6977/* 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'));
6978
6979
6980/***/ }),
6981/* 204 */
6982/***/ (function(module, __webpack_exports__, __webpack_require__) {
6983
6984"use strict";
6985/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__tagTester_js__ = __webpack_require__(5);
6986
6987
6988/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__tagTester_js__["a" /* default */])('WeakSet'));
6989
6990
6991/***/ }),
6992/* 205 */
6993/***/ (function(module, __webpack_exports__, __webpack_require__) {
6994
6995"use strict";
6996/* harmony export (immutable) */ __webpack_exports__["a"] = pairs;
6997/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__keys_js__ = __webpack_require__(3);
6998
6999
7000// Convert an object into a list of `[key, value]` pairs.
7001// The opposite of `_.object` with one argument.
7002function pairs(obj) {
7003 var _keys = Object(__WEBPACK_IMPORTED_MODULE_0__keys_js__["a" /* default */])(obj);
7004 var length = _keys.length;
7005 var pairs = Array(length);
7006 for (var i = 0; i < length; i++) {
7007 pairs[i] = [_keys[i], obj[_keys[i]]];
7008 }
7009 return pairs;
7010}
7011
7012
7013/***/ }),
7014/* 206 */
7015/***/ (function(module, __webpack_exports__, __webpack_require__) {
7016
7017"use strict";
7018/* harmony export (immutable) */ __webpack_exports__["a"] = create;
7019/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__baseCreate_js__ = __webpack_require__(121);
7020/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__extendOwn_js__ = __webpack_require__(77);
7021
7022
7023
7024// Creates an object that inherits from the given prototype object.
7025// If additional properties are provided then they will be added to the
7026// created object.
7027function create(prototype, props) {
7028 var result = Object(__WEBPACK_IMPORTED_MODULE_0__baseCreate_js__["a" /* default */])(prototype);
7029 if (props) Object(__WEBPACK_IMPORTED_MODULE_1__extendOwn_js__["a" /* default */])(result, props);
7030 return result;
7031}
7032
7033
7034/***/ }),
7035/* 207 */
7036/***/ (function(module, __webpack_exports__, __webpack_require__) {
7037
7038"use strict";
7039/* harmony export (immutable) */ __webpack_exports__["a"] = tap;
7040// Invokes `interceptor` with the `obj` and then returns `obj`.
7041// The primary purpose of this method is to "tap into" a method chain, in
7042// order to perform operations on intermediate results within the chain.
7043function tap(obj, interceptor) {
7044 interceptor(obj);
7045 return obj;
7046}
7047
7048
7049/***/ }),
7050/* 208 */
7051/***/ (function(module, __webpack_exports__, __webpack_require__) {
7052
7053"use strict";
7054/* harmony export (immutable) */ __webpack_exports__["a"] = has;
7055/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__has_js__ = __webpack_require__(22);
7056/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__toPath_js__ = __webpack_require__(43);
7057
7058
7059
7060// Shortcut function for checking if an object has a given property directly on
7061// itself (in other words, not on a prototype). Unlike the internal `has`
7062// function, this public version can also traverse nested properties.
7063function has(obj, path) {
7064 path = Object(__WEBPACK_IMPORTED_MODULE_1__toPath_js__["a" /* default */])(path);
7065 var length = path.length;
7066 for (var i = 0; i < length; i++) {
7067 var key = path[i];
7068 if (!Object(__WEBPACK_IMPORTED_MODULE_0__has_js__["a" /* default */])(obj, key)) return false;
7069 obj = obj[key];
7070 }
7071 return !!length;
7072}
7073
7074
7075/***/ }),
7076/* 209 */
7077/***/ (function(module, __webpack_exports__, __webpack_require__) {
7078
7079"use strict";
7080/* harmony export (immutable) */ __webpack_exports__["a"] = mapObject;
7081/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(8);
7082/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__keys_js__ = __webpack_require__(3);
7083
7084
7085
7086// Returns the results of applying the `iteratee` to each element of `obj`.
7087// In contrast to `_.map` it returns an object.
7088function mapObject(obj, iteratee, context) {
7089 iteratee = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(iteratee, context);
7090 var _keys = Object(__WEBPACK_IMPORTED_MODULE_1__keys_js__["a" /* default */])(obj),
7091 length = _keys.length,
7092 results = {};
7093 for (var index = 0; index < length; index++) {
7094 var currentKey = _keys[index];
7095 results[currentKey] = iteratee(obj[currentKey], currentKey, obj);
7096 }
7097 return results;
7098}
7099
7100
7101/***/ }),
7102/* 210 */
7103/***/ (function(module, __webpack_exports__, __webpack_require__) {
7104
7105"use strict";
7106/* harmony export (immutable) */ __webpack_exports__["a"] = propertyOf;
7107/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__noop_js__ = __webpack_require__(127);
7108/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__get_js__ = __webpack_require__(123);
7109
7110
7111
7112// Generates a function for a given object that returns a given property.
7113function propertyOf(obj) {
7114 if (obj == null) return __WEBPACK_IMPORTED_MODULE_0__noop_js__["a" /* default */];
7115 return function(path) {
7116 return Object(__WEBPACK_IMPORTED_MODULE_1__get_js__["a" /* default */])(obj, path);
7117 };
7118}
7119
7120
7121/***/ }),
7122/* 211 */
7123/***/ (function(module, __webpack_exports__, __webpack_require__) {
7124
7125"use strict";
7126/* harmony export (immutable) */ __webpack_exports__["a"] = times;
7127/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__optimizeCb_js__ = __webpack_require__(44);
7128
7129
7130// Run a function **n** times.
7131function times(n, iteratee, context) {
7132 var accum = Array(Math.max(0, n));
7133 iteratee = Object(__WEBPACK_IMPORTED_MODULE_0__optimizeCb_js__["a" /* default */])(iteratee, context, 1);
7134 for (var i = 0; i < n; i++) accum[i] = iteratee(i);
7135 return accum;
7136}
7137
7138
7139/***/ }),
7140/* 212 */
7141/***/ (function(module, __webpack_exports__, __webpack_require__) {
7142
7143"use strict";
7144/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createEscaper_js__ = __webpack_require__(129);
7145/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__escapeMap_js__ = __webpack_require__(130);
7146
7147
7148
7149// Function for escaping strings to HTML interpolation.
7150/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createEscaper_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__escapeMap_js__["a" /* default */]));
7151
7152
7153/***/ }),
7154/* 213 */
7155/***/ (function(module, __webpack_exports__, __webpack_require__) {
7156
7157"use strict";
7158/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createEscaper_js__ = __webpack_require__(129);
7159/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__unescapeMap_js__ = __webpack_require__(214);
7160
7161
7162
7163// Function for unescaping strings from HTML interpolation.
7164/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createEscaper_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__unescapeMap_js__["a" /* default */]));
7165
7166
7167/***/ }),
7168/* 214 */
7169/***/ (function(module, __webpack_exports__, __webpack_require__) {
7170
7171"use strict";
7172/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__invert_js__ = __webpack_require__(117);
7173/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__escapeMap_js__ = __webpack_require__(130);
7174
7175
7176
7177// Internal list of HTML entities for unescaping.
7178/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__invert_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__escapeMap_js__["a" /* default */]));
7179
7180
7181/***/ }),
7182/* 215 */
7183/***/ (function(module, __webpack_exports__, __webpack_require__) {
7184
7185"use strict";
7186/* harmony export (immutable) */ __webpack_exports__["a"] = template;
7187/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__defaults_js__ = __webpack_require__(120);
7188/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__underscore_js__ = __webpack_require__(10);
7189/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__templateSettings_js__ = __webpack_require__(131);
7190
7191
7192
7193
7194// When customizing `_.templateSettings`, if you don't want to define an
7195// interpolation, evaluation or escaping regex, we need one that is
7196// guaranteed not to match.
7197var noMatch = /(.)^/;
7198
7199// Certain characters need to be escaped so that they can be put into a
7200// string literal.
7201var escapes = {
7202 "'": "'",
7203 '\\': '\\',
7204 '\r': 'r',
7205 '\n': 'n',
7206 '\u2028': 'u2028',
7207 '\u2029': 'u2029'
7208};
7209
7210var escapeRegExp = /\\|'|\r|\n|\u2028|\u2029/g;
7211
7212function escapeChar(match) {
7213 return '\\' + escapes[match];
7214}
7215
7216var bareIdentifier = /^\s*(\w|\$)+\s*$/;
7217
7218// JavaScript micro-templating, similar to John Resig's implementation.
7219// Underscore templating handles arbitrary delimiters, preserves whitespace,
7220// and correctly escapes quotes within interpolated code.
7221// NB: `oldSettings` only exists for backwards compatibility.
7222function template(text, settings, oldSettings) {
7223 if (!settings && oldSettings) settings = oldSettings;
7224 settings = Object(__WEBPACK_IMPORTED_MODULE_0__defaults_js__["a" /* default */])({}, settings, __WEBPACK_IMPORTED_MODULE_1__underscore_js__["a" /* default */].templateSettings);
7225
7226 // Combine delimiters into one regular expression via alternation.
7227 var matcher = RegExp([
7228 (settings.escape || noMatch).source,
7229 (settings.interpolate || noMatch).source,
7230 (settings.evaluate || noMatch).source
7231 ].join('|') + '|$', 'g');
7232
7233 // Compile the template source, escaping string literals appropriately.
7234 var index = 0;
7235 var source = "__p+='";
7236 text.replace(matcher, function(match, escape, interpolate, evaluate, offset) {
7237 source += text.slice(index, offset).replace(escapeRegExp, escapeChar);
7238 index = offset + match.length;
7239
7240 if (escape) {
7241 source += "'+\n((__t=(" + escape + "))==null?'':_.escape(__t))+\n'";
7242 } else if (interpolate) {
7243 source += "'+\n((__t=(" + interpolate + "))==null?'':__t)+\n'";
7244 } else if (evaluate) {
7245 source += "';\n" + evaluate + "\n__p+='";
7246 }
7247
7248 // Adobe VMs need the match returned to produce the correct offset.
7249 return match;
7250 });
7251 source += "';\n";
7252
7253 var argument = settings.variable;
7254 if (argument) {
7255 if (!bareIdentifier.test(argument)) throw new Error(argument);
7256 } else {
7257 // If a variable is not specified, place data values in local scope.
7258 source = 'with(obj||{}){\n' + source + '}\n';
7259 argument = 'obj';
7260 }
7261
7262 source = "var __t,__p='',__j=Array.prototype.join," +
7263 "print=function(){__p+=__j.call(arguments,'');};\n" +
7264 source + 'return __p;\n';
7265
7266 var render;
7267 try {
7268 render = new Function(argument, '_', source);
7269 } catch (e) {
7270 e.source = source;
7271 throw e;
7272 }
7273
7274 var template = function(data) {
7275 return render.call(this, data, __WEBPACK_IMPORTED_MODULE_1__underscore_js__["a" /* default */]);
7276 };
7277
7278 // Provide the compiled source as a convenience for precompilation.
7279 template.source = 'function(' + argument + '){\n' + source + '}';
7280
7281 return template;
7282}
7283
7284
7285/***/ }),
7286/* 216 */
7287/***/ (function(module, __webpack_exports__, __webpack_require__) {
7288
7289"use strict";
7290/* harmony export (immutable) */ __webpack_exports__["a"] = result;
7291/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isFunction_js__ = __webpack_require__(13);
7292/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__toPath_js__ = __webpack_require__(43);
7293
7294
7295
7296// Traverses the children of `obj` along `path`. If a child is a function, it
7297// is invoked with its parent as context. Returns the value of the final
7298// child, or `fallback` if any child is undefined.
7299function result(obj, path, fallback) {
7300 path = Object(__WEBPACK_IMPORTED_MODULE_1__toPath_js__["a" /* default */])(path);
7301 var length = path.length;
7302 if (!length) {
7303 return Object(__WEBPACK_IMPORTED_MODULE_0__isFunction_js__["a" /* default */])(fallback) ? fallback.call(obj) : fallback;
7304 }
7305 for (var i = 0; i < length; i++) {
7306 var prop = obj == null ? void 0 : obj[path[i]];
7307 if (prop === void 0) {
7308 prop = fallback;
7309 i = length; // Ensure we don't continue iterating.
7310 }
7311 obj = Object(__WEBPACK_IMPORTED_MODULE_0__isFunction_js__["a" /* default */])(prop) ? prop.call(obj) : prop;
7312 }
7313 return obj;
7314}
7315
7316
7317/***/ }),
7318/* 217 */
7319/***/ (function(module, __webpack_exports__, __webpack_require__) {
7320
7321"use strict";
7322/* harmony export (immutable) */ __webpack_exports__["a"] = uniqueId;
7323// Generate a unique integer id (unique within the entire client session).
7324// Useful for temporary DOM ids.
7325var idCounter = 0;
7326function uniqueId(prefix) {
7327 var id = ++idCounter + '';
7328 return prefix ? prefix + id : id;
7329}
7330
7331
7332/***/ }),
7333/* 218 */
7334/***/ (function(module, __webpack_exports__, __webpack_require__) {
7335
7336"use strict";
7337/* harmony export (immutable) */ __webpack_exports__["a"] = chain;
7338/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__underscore_js__ = __webpack_require__(10);
7339
7340
7341// Start chaining a wrapped Underscore object.
7342function chain(obj) {
7343 var instance = Object(__WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */])(obj);
7344 instance._chain = true;
7345 return instance;
7346}
7347
7348
7349/***/ }),
7350/* 219 */
7351/***/ (function(module, __webpack_exports__, __webpack_require__) {
7352
7353"use strict";
7354/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(9);
7355/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__flatten_js__ = __webpack_require__(32);
7356/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__bind_js__ = __webpack_require__(133);
7357
7358
7359
7360
7361// Bind a number of an object's methods to that object. Remaining arguments
7362// are the method names to be bound. Useful for ensuring that all callbacks
7363// defined on an object belong to it.
7364/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(obj, keys) {
7365 keys = Object(__WEBPACK_IMPORTED_MODULE_1__flatten_js__["a" /* default */])(keys, false, false);
7366 var index = keys.length;
7367 if (index < 1) throw new Error('bindAll must be passed function names');
7368 while (index--) {
7369 var key = keys[index];
7370 obj[key] = Object(__WEBPACK_IMPORTED_MODULE_2__bind_js__["a" /* default */])(obj[key], obj);
7371 }
7372 return obj;
7373}));
7374
7375
7376/***/ }),
7377/* 220 */
7378/***/ (function(module, __webpack_exports__, __webpack_require__) {
7379
7380"use strict";
7381/* harmony export (immutable) */ __webpack_exports__["a"] = memoize;
7382/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__has_js__ = __webpack_require__(22);
7383
7384
7385// Memoize an expensive function by storing its results.
7386function memoize(func, hasher) {
7387 var memoize = function(key) {
7388 var cache = memoize.cache;
7389 var address = '' + (hasher ? hasher.apply(this, arguments) : key);
7390 if (!Object(__WEBPACK_IMPORTED_MODULE_0__has_js__["a" /* default */])(cache, address)) cache[address] = func.apply(this, arguments);
7391 return cache[address];
7392 };
7393 memoize.cache = {};
7394 return memoize;
7395}
7396
7397
7398/***/ }),
7399/* 221 */
7400/***/ (function(module, __webpack_exports__, __webpack_require__) {
7401
7402"use strict";
7403/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__partial_js__ = __webpack_require__(56);
7404/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__delay_js__ = __webpack_require__(134);
7405/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__underscore_js__ = __webpack_require__(10);
7406
7407
7408
7409
7410// Defers a function, scheduling it to run after the current call stack has
7411// cleared.
7412/* 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));
7413
7414
7415/***/ }),
7416/* 222 */
7417/***/ (function(module, __webpack_exports__, __webpack_require__) {
7418
7419"use strict";
7420/* harmony export (immutable) */ __webpack_exports__["a"] = throttle;
7421/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__now_js__ = __webpack_require__(81);
7422
7423
7424// Returns a function, that, when invoked, will only be triggered at most once
7425// during a given window of time. Normally, the throttled function will run
7426// as much as it can, without ever going more than once per `wait` duration;
7427// but if you'd like to disable the execution on the leading edge, pass
7428// `{leading: false}`. To disable execution on the trailing edge, ditto.
7429function throttle(func, wait, options) {
7430 var timeout, context, args, result;
7431 var previous = 0;
7432 if (!options) options = {};
7433
7434 var later = function() {
7435 previous = options.leading === false ? 0 : Object(__WEBPACK_IMPORTED_MODULE_0__now_js__["a" /* default */])();
7436 timeout = null;
7437 result = func.apply(context, args);
7438 if (!timeout) context = args = null;
7439 };
7440
7441 var throttled = function() {
7442 var _now = Object(__WEBPACK_IMPORTED_MODULE_0__now_js__["a" /* default */])();
7443 if (!previous && options.leading === false) previous = _now;
7444 var remaining = wait - (_now - previous);
7445 context = this;
7446 args = arguments;
7447 if (remaining <= 0 || remaining > wait) {
7448 if (timeout) {
7449 clearTimeout(timeout);
7450 timeout = null;
7451 }
7452 previous = _now;
7453 result = func.apply(context, args);
7454 if (!timeout) context = args = null;
7455 } else if (!timeout && options.trailing !== false) {
7456 timeout = setTimeout(later, remaining);
7457 }
7458 return result;
7459 };
7460
7461 throttled.cancel = function() {
7462 clearTimeout(timeout);
7463 previous = 0;
7464 timeout = context = args = null;
7465 };
7466
7467 return throttled;
7468}
7469
7470
7471/***/ }),
7472/* 223 */
7473/***/ (function(module, __webpack_exports__, __webpack_require__) {
7474
7475"use strict";
7476/* harmony export (immutable) */ __webpack_exports__["a"] = debounce;
7477/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(9);
7478/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__now_js__ = __webpack_require__(81);
7479
7480
7481
7482// When a sequence of calls of the returned function ends, the argument
7483// function is triggered. The end of a sequence is defined by the `wait`
7484// parameter. If `immediate` is passed, the argument function will be
7485// triggered at the beginning of the sequence instead of at the end.
7486function debounce(func, wait, immediate) {
7487 var timeout, previous, args, result, context;
7488
7489 var later = function() {
7490 var passed = Object(__WEBPACK_IMPORTED_MODULE_1__now_js__["a" /* default */])() - previous;
7491 if (wait > passed) {
7492 timeout = setTimeout(later, wait - passed);
7493 } else {
7494 timeout = null;
7495 if (!immediate) result = func.apply(context, args);
7496 // This check is needed because `func` can recursively invoke `debounced`.
7497 if (!timeout) args = context = null;
7498 }
7499 };
7500
7501 var debounced = Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(_args) {
7502 context = this;
7503 args = _args;
7504 previous = Object(__WEBPACK_IMPORTED_MODULE_1__now_js__["a" /* default */])();
7505 if (!timeout) {
7506 timeout = setTimeout(later, wait);
7507 if (immediate) result = func.apply(context, args);
7508 }
7509 return result;
7510 });
7511
7512 debounced.cancel = function() {
7513 clearTimeout(timeout);
7514 timeout = args = context = null;
7515 };
7516
7517 return debounced;
7518}
7519
7520
7521/***/ }),
7522/* 224 */
7523/***/ (function(module, __webpack_exports__, __webpack_require__) {
7524
7525"use strict";
7526/* harmony export (immutable) */ __webpack_exports__["a"] = wrap;
7527/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__partial_js__ = __webpack_require__(56);
7528
7529
7530// Returns the first function passed as an argument to the second,
7531// allowing you to adjust arguments, run code before and after, and
7532// conditionally execute the original function.
7533function wrap(func, wrapper) {
7534 return Object(__WEBPACK_IMPORTED_MODULE_0__partial_js__["a" /* default */])(wrapper, func);
7535}
7536
7537
7538/***/ }),
7539/* 225 */
7540/***/ (function(module, __webpack_exports__, __webpack_require__) {
7541
7542"use strict";
7543/* harmony export (immutable) */ __webpack_exports__["a"] = compose;
7544// Returns a function that is the composition of a list of functions, each
7545// consuming the return value of the function that follows.
7546function compose() {
7547 var args = arguments;
7548 var start = args.length - 1;
7549 return function() {
7550 var i = start;
7551 var result = args[start].apply(this, arguments);
7552 while (i--) result = args[i].call(this, result);
7553 return result;
7554 };
7555}
7556
7557
7558/***/ }),
7559/* 226 */
7560/***/ (function(module, __webpack_exports__, __webpack_require__) {
7561
7562"use strict";
7563/* harmony export (immutable) */ __webpack_exports__["a"] = after;
7564// Returns a function that will only be executed on and after the Nth call.
7565function after(times, func) {
7566 return function() {
7567 if (--times < 1) {
7568 return func.apply(this, arguments);
7569 }
7570 };
7571}
7572
7573
7574/***/ }),
7575/* 227 */
7576/***/ (function(module, __webpack_exports__, __webpack_require__) {
7577
7578"use strict";
7579/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__partial_js__ = __webpack_require__(56);
7580/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__before_js__ = __webpack_require__(135);
7581
7582
7583
7584// Returns a function that will be executed at most one time, no matter how
7585// often you call it. Useful for lazy initialization.
7586/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__partial_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__before_js__["a" /* default */], 2));
7587
7588
7589/***/ }),
7590/* 228 */
7591/***/ (function(module, __webpack_exports__, __webpack_require__) {
7592
7593"use strict";
7594/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__findLastIndex_js__ = __webpack_require__(138);
7595/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__createIndexFinder_js__ = __webpack_require__(141);
7596
7597
7598
7599// Return the position of the last occurrence of an item in an array,
7600// or -1 if the item is not included in the array.
7601/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_1__createIndexFinder_js__["a" /* default */])(-1, __WEBPACK_IMPORTED_MODULE_0__findLastIndex_js__["a" /* default */]));
7602
7603
7604/***/ }),
7605/* 229 */
7606/***/ (function(module, __webpack_exports__, __webpack_require__) {
7607
7608"use strict";
7609/* harmony export (immutable) */ __webpack_exports__["a"] = findWhere;
7610/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__find_js__ = __webpack_require__(142);
7611/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__matcher_js__ = __webpack_require__(55);
7612
7613
7614
7615// Convenience version of a common use case of `_.find`: getting the first
7616// object containing specific `key:value` pairs.
7617function findWhere(obj, attrs) {
7618 return Object(__WEBPACK_IMPORTED_MODULE_0__find_js__["a" /* default */])(obj, Object(__WEBPACK_IMPORTED_MODULE_1__matcher_js__["a" /* default */])(attrs));
7619}
7620
7621
7622/***/ }),
7623/* 230 */
7624/***/ (function(module, __webpack_exports__, __webpack_require__) {
7625
7626"use strict";
7627/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createReduce_js__ = __webpack_require__(143);
7628
7629
7630// **Reduce** builds up a single result from a list of values, aka `inject`,
7631// or `foldl`.
7632/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createReduce_js__["a" /* default */])(1));
7633
7634
7635/***/ }),
7636/* 231 */
7637/***/ (function(module, __webpack_exports__, __webpack_require__) {
7638
7639"use strict";
7640/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createReduce_js__ = __webpack_require__(143);
7641
7642
7643// The right-associative version of reduce, also known as `foldr`.
7644/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__createReduce_js__["a" /* default */])(-1));
7645
7646
7647/***/ }),
7648/* 232 */
7649/***/ (function(module, __webpack_exports__, __webpack_require__) {
7650
7651"use strict";
7652/* harmony export (immutable) */ __webpack_exports__["a"] = reject;
7653/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__filter_js__ = __webpack_require__(45);
7654/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__negate_js__ = __webpack_require__(82);
7655/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__cb_js__ = __webpack_require__(8);
7656
7657
7658
7659
7660// Return all the elements for which a truth test fails.
7661function reject(obj, predicate, context) {
7662 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);
7663}
7664
7665
7666/***/ }),
7667/* 233 */
7668/***/ (function(module, __webpack_exports__, __webpack_require__) {
7669
7670"use strict";
7671/* harmony export (immutable) */ __webpack_exports__["a"] = every;
7672/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(8);
7673/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isArrayLike_js__ = __webpack_require__(11);
7674/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__keys_js__ = __webpack_require__(3);
7675
7676
7677
7678
7679// Determine whether all of the elements pass a truth test.
7680function every(obj, predicate, context) {
7681 predicate = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(predicate, context);
7682 var _keys = !Object(__WEBPACK_IMPORTED_MODULE_1__isArrayLike_js__["a" /* default */])(obj) && Object(__WEBPACK_IMPORTED_MODULE_2__keys_js__["a" /* default */])(obj),
7683 length = (_keys || obj).length;
7684 for (var index = 0; index < length; index++) {
7685 var currentKey = _keys ? _keys[index] : index;
7686 if (!predicate(obj[currentKey], currentKey, obj)) return false;
7687 }
7688 return true;
7689}
7690
7691
7692/***/ }),
7693/* 234 */
7694/***/ (function(module, __webpack_exports__, __webpack_require__) {
7695
7696"use strict";
7697/* harmony export (immutable) */ __webpack_exports__["a"] = some;
7698/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(8);
7699/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isArrayLike_js__ = __webpack_require__(11);
7700/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__keys_js__ = __webpack_require__(3);
7701
7702
7703
7704
7705// Determine if at least one element in the object passes a truth test.
7706function some(obj, predicate, context) {
7707 predicate = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(predicate, context);
7708 var _keys = !Object(__WEBPACK_IMPORTED_MODULE_1__isArrayLike_js__["a" /* default */])(obj) && Object(__WEBPACK_IMPORTED_MODULE_2__keys_js__["a" /* default */])(obj),
7709 length = (_keys || obj).length;
7710 for (var index = 0; index < length; index++) {
7711 var currentKey = _keys ? _keys[index] : index;
7712 if (predicate(obj[currentKey], currentKey, obj)) return true;
7713 }
7714 return false;
7715}
7716
7717
7718/***/ }),
7719/* 235 */
7720/***/ (function(module, __webpack_exports__, __webpack_require__) {
7721
7722"use strict";
7723/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(9);
7724/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isFunction_js__ = __webpack_require__(13);
7725/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__map_js__ = __webpack_require__(33);
7726/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__deepGet_js__ = __webpack_require__(78);
7727/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__toPath_js__ = __webpack_require__(43);
7728
7729
7730
7731
7732
7733
7734// Invoke a method (with arguments) on every item in a collection.
7735/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(obj, path, args) {
7736 var contextPath, func;
7737 if (Object(__WEBPACK_IMPORTED_MODULE_1__isFunction_js__["a" /* default */])(path)) {
7738 func = path;
7739 } else {
7740 path = Object(__WEBPACK_IMPORTED_MODULE_4__toPath_js__["a" /* default */])(path);
7741 contextPath = path.slice(0, -1);
7742 path = path[path.length - 1];
7743 }
7744 return Object(__WEBPACK_IMPORTED_MODULE_2__map_js__["a" /* default */])(obj, function(context) {
7745 var method = func;
7746 if (!method) {
7747 if (contextPath && contextPath.length) {
7748 context = Object(__WEBPACK_IMPORTED_MODULE_3__deepGet_js__["a" /* default */])(context, contextPath);
7749 }
7750 if (context == null) return void 0;
7751 method = context[path];
7752 }
7753 return method == null ? method : method.apply(context, args);
7754 });
7755}));
7756
7757
7758/***/ }),
7759/* 236 */
7760/***/ (function(module, __webpack_exports__, __webpack_require__) {
7761
7762"use strict";
7763/* harmony export (immutable) */ __webpack_exports__["a"] = where;
7764/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__filter_js__ = __webpack_require__(45);
7765/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__matcher_js__ = __webpack_require__(55);
7766
7767
7768
7769// Convenience version of a common use case of `_.filter`: selecting only
7770// objects containing specific `key:value` pairs.
7771function where(obj, attrs) {
7772 return Object(__WEBPACK_IMPORTED_MODULE_0__filter_js__["a" /* default */])(obj, Object(__WEBPACK_IMPORTED_MODULE_1__matcher_js__["a" /* default */])(attrs));
7773}
7774
7775
7776/***/ }),
7777/* 237 */
7778/***/ (function(module, __webpack_exports__, __webpack_require__) {
7779
7780"use strict";
7781/* harmony export (immutable) */ __webpack_exports__["a"] = min;
7782/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__ = __webpack_require__(11);
7783/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__values_js__ = __webpack_require__(31);
7784/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__cb_js__ = __webpack_require__(8);
7785/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__each_js__ = __webpack_require__(28);
7786
7787
7788
7789
7790
7791// Return the minimum element (or element-based computation).
7792function min(obj, iteratee, context) {
7793 var result = Infinity, lastComputed = Infinity,
7794 value, computed;
7795 if (iteratee == null || typeof iteratee == 'number' && typeof obj[0] != 'object' && obj != null) {
7796 obj = Object(__WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__["a" /* default */])(obj) ? obj : Object(__WEBPACK_IMPORTED_MODULE_1__values_js__["a" /* default */])(obj);
7797 for (var i = 0, length = obj.length; i < length; i++) {
7798 value = obj[i];
7799 if (value != null && value < result) {
7800 result = value;
7801 }
7802 }
7803 } else {
7804 iteratee = Object(__WEBPACK_IMPORTED_MODULE_2__cb_js__["a" /* default */])(iteratee, context);
7805 Object(__WEBPACK_IMPORTED_MODULE_3__each_js__["a" /* default */])(obj, function(v, index, list) {
7806 computed = iteratee(v, index, list);
7807 if (computed < lastComputed || computed === Infinity && result === Infinity) {
7808 result = v;
7809 lastComputed = computed;
7810 }
7811 });
7812 }
7813 return result;
7814}
7815
7816
7817/***/ }),
7818/* 238 */
7819/***/ (function(module, __webpack_exports__, __webpack_require__) {
7820
7821"use strict";
7822/* harmony export (immutable) */ __webpack_exports__["a"] = shuffle;
7823/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__sample_js__ = __webpack_require__(145);
7824
7825
7826// Shuffle a collection.
7827function shuffle(obj) {
7828 return Object(__WEBPACK_IMPORTED_MODULE_0__sample_js__["a" /* default */])(obj, Infinity);
7829}
7830
7831
7832/***/ }),
7833/* 239 */
7834/***/ (function(module, __webpack_exports__, __webpack_require__) {
7835
7836"use strict";
7837/* harmony export (immutable) */ __webpack_exports__["a"] = sortBy;
7838/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__cb_js__ = __webpack_require__(8);
7839/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__pluck_js__ = __webpack_require__(84);
7840/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__map_js__ = __webpack_require__(33);
7841
7842
7843
7844
7845// Sort the object's values by a criterion produced by an iteratee.
7846function sortBy(obj, iteratee, context) {
7847 var index = 0;
7848 iteratee = Object(__WEBPACK_IMPORTED_MODULE_0__cb_js__["a" /* default */])(iteratee, context);
7849 return Object(__WEBPACK_IMPORTED_MODULE_1__pluck_js__["a" /* default */])(Object(__WEBPACK_IMPORTED_MODULE_2__map_js__["a" /* default */])(obj, function(value, key, list) {
7850 return {
7851 value: value,
7852 index: index++,
7853 criteria: iteratee(value, key, list)
7854 };
7855 }).sort(function(left, right) {
7856 var a = left.criteria;
7857 var b = right.criteria;
7858 if (a !== b) {
7859 if (a > b || a === void 0) return 1;
7860 if (a < b || b === void 0) return -1;
7861 }
7862 return left.index - right.index;
7863 }), 'value');
7864}
7865
7866
7867/***/ }),
7868/* 240 */
7869/***/ (function(module, __webpack_exports__, __webpack_require__) {
7870
7871"use strict";
7872/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__group_js__ = __webpack_require__(57);
7873/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__has_js__ = __webpack_require__(22);
7874
7875
7876
7877// Groups the object's values by a criterion. Pass either a string attribute
7878// to group by, or a function that returns the criterion.
7879/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__group_js__["a" /* default */])(function(result, value, key) {
7880 if (Object(__WEBPACK_IMPORTED_MODULE_1__has_js__["a" /* default */])(result, key)) result[key].push(value); else result[key] = [value];
7881}));
7882
7883
7884/***/ }),
7885/* 241 */
7886/***/ (function(module, __webpack_exports__, __webpack_require__) {
7887
7888"use strict";
7889/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__group_js__ = __webpack_require__(57);
7890
7891
7892// Indexes the object's values by a criterion, similar to `_.groupBy`, but for
7893// when you know that your index values will be unique.
7894/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__group_js__["a" /* default */])(function(result, value, key) {
7895 result[key] = value;
7896}));
7897
7898
7899/***/ }),
7900/* 242 */
7901/***/ (function(module, __webpack_exports__, __webpack_require__) {
7902
7903"use strict";
7904/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__group_js__ = __webpack_require__(57);
7905/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__has_js__ = __webpack_require__(22);
7906
7907
7908
7909// Counts instances of an object that group by a certain criterion. Pass
7910// either a string attribute to count by, or a function that returns the
7911// criterion.
7912/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__group_js__["a" /* default */])(function(result, value, key) {
7913 if (Object(__WEBPACK_IMPORTED_MODULE_1__has_js__["a" /* default */])(result, key)) result[key]++; else result[key] = 1;
7914}));
7915
7916
7917/***/ }),
7918/* 243 */
7919/***/ (function(module, __webpack_exports__, __webpack_require__) {
7920
7921"use strict";
7922/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__group_js__ = __webpack_require__(57);
7923
7924
7925// Split a collection into two arrays: one whose elements all pass the given
7926// truth test, and one whose elements all do not pass the truth test.
7927/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__group_js__["a" /* default */])(function(result, value, pass) {
7928 result[pass ? 0 : 1].push(value);
7929}, true));
7930
7931
7932/***/ }),
7933/* 244 */
7934/***/ (function(module, __webpack_exports__, __webpack_require__) {
7935
7936"use strict";
7937/* harmony export (immutable) */ __webpack_exports__["a"] = toArray;
7938/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isArray_js__ = __webpack_require__(27);
7939/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__setup_js__ = __webpack_require__(1);
7940/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__isString_js__ = __webpack_require__(71);
7941/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__isArrayLike_js__ = __webpack_require__(11);
7942/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__map_js__ = __webpack_require__(33);
7943/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__identity_js__ = __webpack_require__(79);
7944/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__values_js__ = __webpack_require__(31);
7945
7946
7947
7948
7949
7950
7951
7952
7953// Safely create a real, live array from anything iterable.
7954var reStrSymbol = /[^\ud800-\udfff]|[\ud800-\udbff][\udc00-\udfff]|[\ud800-\udfff]/g;
7955function toArray(obj) {
7956 if (!obj) return [];
7957 if (Object(__WEBPACK_IMPORTED_MODULE_0__isArray_js__["a" /* default */])(obj)) return __WEBPACK_IMPORTED_MODULE_1__setup_js__["q" /* slice */].call(obj);
7958 if (Object(__WEBPACK_IMPORTED_MODULE_2__isString_js__["a" /* default */])(obj)) {
7959 // Keep surrogate pair characters together.
7960 return obj.match(reStrSymbol);
7961 }
7962 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 */]);
7963 return Object(__WEBPACK_IMPORTED_MODULE_6__values_js__["a" /* default */])(obj);
7964}
7965
7966
7967/***/ }),
7968/* 245 */
7969/***/ (function(module, __webpack_exports__, __webpack_require__) {
7970
7971"use strict";
7972/* harmony export (immutable) */ __webpack_exports__["a"] = size;
7973/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__ = __webpack_require__(11);
7974/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__keys_js__ = __webpack_require__(3);
7975
7976
7977
7978// Return the number of elements in a collection.
7979function size(obj) {
7980 if (obj == null) return 0;
7981 return Object(__WEBPACK_IMPORTED_MODULE_0__isArrayLike_js__["a" /* default */])(obj) ? obj.length : Object(__WEBPACK_IMPORTED_MODULE_1__keys_js__["a" /* default */])(obj).length;
7982}
7983
7984
7985/***/ }),
7986/* 246 */
7987/***/ (function(module, __webpack_exports__, __webpack_require__) {
7988
7989"use strict";
7990/* harmony export (immutable) */ __webpack_exports__["a"] = keyInObj;
7991// Internal `_.pick` helper function to determine whether `key` is an enumerable
7992// property name of `obj`.
7993function keyInObj(value, key, obj) {
7994 return key in obj;
7995}
7996
7997
7998/***/ }),
7999/* 247 */
8000/***/ (function(module, __webpack_exports__, __webpack_require__) {
8001
8002"use strict";
8003/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(9);
8004/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__isFunction_js__ = __webpack_require__(13);
8005/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__negate_js__ = __webpack_require__(82);
8006/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__map_js__ = __webpack_require__(33);
8007/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__flatten_js__ = __webpack_require__(32);
8008/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__contains_js__ = __webpack_require__(46);
8009/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__pick_js__ = __webpack_require__(146);
8010
8011
8012
8013
8014
8015
8016
8017
8018// Return a copy of the object without the disallowed properties.
8019/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(obj, keys) {
8020 var iteratee = keys[0], context;
8021 if (Object(__WEBPACK_IMPORTED_MODULE_1__isFunction_js__["a" /* default */])(iteratee)) {
8022 iteratee = Object(__WEBPACK_IMPORTED_MODULE_2__negate_js__["a" /* default */])(iteratee);
8023 if (keys.length > 1) context = keys[1];
8024 } else {
8025 keys = Object(__WEBPACK_IMPORTED_MODULE_3__map_js__["a" /* default */])(Object(__WEBPACK_IMPORTED_MODULE_4__flatten_js__["a" /* default */])(keys, false, false), String);
8026 iteratee = function(value, key) {
8027 return !Object(__WEBPACK_IMPORTED_MODULE_5__contains_js__["a" /* default */])(keys, key);
8028 };
8029 }
8030 return Object(__WEBPACK_IMPORTED_MODULE_6__pick_js__["a" /* default */])(obj, iteratee, context);
8031}));
8032
8033
8034/***/ }),
8035/* 248 */
8036/***/ (function(module, __webpack_exports__, __webpack_require__) {
8037
8038"use strict";
8039/* harmony export (immutable) */ __webpack_exports__["a"] = first;
8040/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__initial_js__ = __webpack_require__(147);
8041
8042
8043// Get the first element of an array. Passing **n** will return the first N
8044// values in the array. The **guard** check allows it to work with `_.map`.
8045function first(array, n, guard) {
8046 if (array == null || array.length < 1) return n == null || guard ? void 0 : [];
8047 if (n == null || guard) return array[0];
8048 return Object(__WEBPACK_IMPORTED_MODULE_0__initial_js__["a" /* default */])(array, array.length - n);
8049}
8050
8051
8052/***/ }),
8053/* 249 */
8054/***/ (function(module, __webpack_exports__, __webpack_require__) {
8055
8056"use strict";
8057/* harmony export (immutable) */ __webpack_exports__["a"] = last;
8058/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__rest_js__ = __webpack_require__(148);
8059
8060
8061// Get the last element of an array. Passing **n** will return the last N
8062// values in the array.
8063function last(array, n, guard) {
8064 if (array == null || array.length < 1) return n == null || guard ? void 0 : [];
8065 if (n == null || guard) return array[array.length - 1];
8066 return Object(__WEBPACK_IMPORTED_MODULE_0__rest_js__["a" /* default */])(array, Math.max(0, array.length - n));
8067}
8068
8069
8070/***/ }),
8071/* 250 */
8072/***/ (function(module, __webpack_exports__, __webpack_require__) {
8073
8074"use strict";
8075/* harmony export (immutable) */ __webpack_exports__["a"] = compact;
8076/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__filter_js__ = __webpack_require__(45);
8077
8078
8079// Trim out all falsy values from an array.
8080function compact(array) {
8081 return Object(__WEBPACK_IMPORTED_MODULE_0__filter_js__["a" /* default */])(array, Boolean);
8082}
8083
8084
8085/***/ }),
8086/* 251 */
8087/***/ (function(module, __webpack_exports__, __webpack_require__) {
8088
8089"use strict";
8090/* harmony export (immutable) */ __webpack_exports__["a"] = flatten;
8091/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__flatten_js__ = __webpack_require__(32);
8092
8093
8094// Flatten out an array, either recursively (by default), or up to `depth`.
8095// Passing `true` or `false` as `depth` means `1` or `Infinity`, respectively.
8096function flatten(array, depth) {
8097 return Object(__WEBPACK_IMPORTED_MODULE_0__flatten_js__["a" /* default */])(array, depth, false);
8098}
8099
8100
8101/***/ }),
8102/* 252 */
8103/***/ (function(module, __webpack_exports__, __webpack_require__) {
8104
8105"use strict";
8106/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(9);
8107/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__difference_js__ = __webpack_require__(149);
8108
8109
8110
8111// Return a version of the array that does not contain the specified value(s).
8112/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(array, otherArrays) {
8113 return Object(__WEBPACK_IMPORTED_MODULE_1__difference_js__["a" /* default */])(array, otherArrays);
8114}));
8115
8116
8117/***/ }),
8118/* 253 */
8119/***/ (function(module, __webpack_exports__, __webpack_require__) {
8120
8121"use strict";
8122/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(9);
8123/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__uniq_js__ = __webpack_require__(150);
8124/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__flatten_js__ = __webpack_require__(32);
8125
8126
8127
8128
8129// Produce an array that contains the union: each distinct element from all of
8130// the passed-in arrays.
8131/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(function(arrays) {
8132 return Object(__WEBPACK_IMPORTED_MODULE_1__uniq_js__["a" /* default */])(Object(__WEBPACK_IMPORTED_MODULE_2__flatten_js__["a" /* default */])(arrays, true, true));
8133}));
8134
8135
8136/***/ }),
8137/* 254 */
8138/***/ (function(module, __webpack_exports__, __webpack_require__) {
8139
8140"use strict";
8141/* harmony export (immutable) */ __webpack_exports__["a"] = intersection;
8142/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__getLength_js__ = __webpack_require__(14);
8143/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__contains_js__ = __webpack_require__(46);
8144
8145
8146
8147// Produce an array that contains every item shared between all the
8148// passed-in arrays.
8149function intersection(array) {
8150 var result = [];
8151 var argsLength = arguments.length;
8152 for (var i = 0, length = Object(__WEBPACK_IMPORTED_MODULE_0__getLength_js__["a" /* default */])(array); i < length; i++) {
8153 var item = array[i];
8154 if (Object(__WEBPACK_IMPORTED_MODULE_1__contains_js__["a" /* default */])(result, item)) continue;
8155 var j;
8156 for (j = 1; j < argsLength; j++) {
8157 if (!Object(__WEBPACK_IMPORTED_MODULE_1__contains_js__["a" /* default */])(arguments[j], item)) break;
8158 }
8159 if (j === argsLength) result.push(item);
8160 }
8161 return result;
8162}
8163
8164
8165/***/ }),
8166/* 255 */
8167/***/ (function(module, __webpack_exports__, __webpack_require__) {
8168
8169"use strict";
8170/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__restArguments_js__ = __webpack_require__(9);
8171/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__unzip_js__ = __webpack_require__(151);
8172
8173
8174
8175// Zip together multiple lists into a single array -- elements that share
8176// an index go together.
8177/* harmony default export */ __webpack_exports__["a"] = (Object(__WEBPACK_IMPORTED_MODULE_0__restArguments_js__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_1__unzip_js__["a" /* default */]));
8178
8179
8180/***/ }),
8181/* 256 */
8182/***/ (function(module, __webpack_exports__, __webpack_require__) {
8183
8184"use strict";
8185/* harmony export (immutable) */ __webpack_exports__["a"] = object;
8186/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__getLength_js__ = __webpack_require__(14);
8187
8188
8189// Converts lists into objects. Pass either a single array of `[key, value]`
8190// pairs, or two parallel arrays of the same length -- one of keys, and one of
8191// the corresponding values. Passing by pairs is the reverse of `_.pairs`.
8192function object(list, values) {
8193 var result = {};
8194 for (var i = 0, length = Object(__WEBPACK_IMPORTED_MODULE_0__getLength_js__["a" /* default */])(list); i < length; i++) {
8195 if (values) {
8196 result[list[i]] = values[i];
8197 } else {
8198 result[list[i][0]] = list[i][1];
8199 }
8200 }
8201 return result;
8202}
8203
8204
8205/***/ }),
8206/* 257 */
8207/***/ (function(module, __webpack_exports__, __webpack_require__) {
8208
8209"use strict";
8210/* harmony export (immutable) */ __webpack_exports__["a"] = range;
8211// Generate an integer Array containing an arithmetic progression. A port of
8212// the native Python `range()` function. See
8213// [the Python documentation](https://docs.python.org/library/functions.html#range).
8214function range(start, stop, step) {
8215 if (stop == null) {
8216 stop = start || 0;
8217 start = 0;
8218 }
8219 if (!step) {
8220 step = stop < start ? -1 : 1;
8221 }
8222
8223 var length = Math.max(Math.ceil((stop - start) / step), 0);
8224 var range = Array(length);
8225
8226 for (var idx = 0; idx < length; idx++, start += step) {
8227 range[idx] = start;
8228 }
8229
8230 return range;
8231}
8232
8233
8234/***/ }),
8235/* 258 */
8236/***/ (function(module, __webpack_exports__, __webpack_require__) {
8237
8238"use strict";
8239/* harmony export (immutable) */ __webpack_exports__["a"] = chunk;
8240/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__setup_js__ = __webpack_require__(1);
8241
8242
8243// Chunk a single array into multiple arrays, each containing `count` or fewer
8244// items.
8245function chunk(array, count) {
8246 if (count == null || count < 1) return [];
8247 var result = [];
8248 var i = 0, length = array.length;
8249 while (i < length) {
8250 result.push(__WEBPACK_IMPORTED_MODULE_0__setup_js__["q" /* slice */].call(array, i, i += count));
8251 }
8252 return result;
8253}
8254
8255
8256/***/ }),
8257/* 259 */
8258/***/ (function(module, __webpack_exports__, __webpack_require__) {
8259
8260"use strict";
8261/* harmony export (immutable) */ __webpack_exports__["a"] = mixin;
8262/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__underscore_js__ = __webpack_require__(10);
8263/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__each_js__ = __webpack_require__(28);
8264/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__functions_js__ = __webpack_require__(118);
8265/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__setup_js__ = __webpack_require__(1);
8266/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__chainResult_js__ = __webpack_require__(152);
8267
8268
8269
8270
8271
8272
8273// Add your own custom functions to the Underscore object.
8274function mixin(obj) {
8275 Object(__WEBPACK_IMPORTED_MODULE_1__each_js__["a" /* default */])(Object(__WEBPACK_IMPORTED_MODULE_2__functions_js__["a" /* default */])(obj), function(name) {
8276 var func = __WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */][name] = obj[name];
8277 __WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */].prototype[name] = function() {
8278 var args = [this._wrapped];
8279 __WEBPACK_IMPORTED_MODULE_3__setup_js__["o" /* push */].apply(args, arguments);
8280 return Object(__WEBPACK_IMPORTED_MODULE_4__chainResult_js__["a" /* default */])(this, func.apply(__WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */], args));
8281 };
8282 });
8283 return __WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */];
8284}
8285
8286
8287/***/ }),
8288/* 260 */
8289/***/ (function(module, __webpack_exports__, __webpack_require__) {
8290
8291"use strict";
8292/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__underscore_js__ = __webpack_require__(10);
8293/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__each_js__ = __webpack_require__(28);
8294/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__setup_js__ = __webpack_require__(1);
8295/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__chainResult_js__ = __webpack_require__(152);
8296
8297
8298
8299
8300
8301// Add all mutator `Array` functions to the wrapper.
8302Object(__WEBPACK_IMPORTED_MODULE_1__each_js__["a" /* default */])(['pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift'], function(name) {
8303 var method = __WEBPACK_IMPORTED_MODULE_2__setup_js__["a" /* ArrayProto */][name];
8304 __WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */].prototype[name] = function() {
8305 var obj = this._wrapped;
8306 if (obj != null) {
8307 method.apply(obj, arguments);
8308 if ((name === 'shift' || name === 'splice') && obj.length === 0) {
8309 delete obj[0];
8310 }
8311 }
8312 return Object(__WEBPACK_IMPORTED_MODULE_3__chainResult_js__["a" /* default */])(this, obj);
8313 };
8314});
8315
8316// Add all accessor `Array` functions to the wrapper.
8317Object(__WEBPACK_IMPORTED_MODULE_1__each_js__["a" /* default */])(['concat', 'join', 'slice'], function(name) {
8318 var method = __WEBPACK_IMPORTED_MODULE_2__setup_js__["a" /* ArrayProto */][name];
8319 __WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */].prototype[name] = function() {
8320 var obj = this._wrapped;
8321 if (obj != null) obj = method.apply(obj, arguments);
8322 return Object(__WEBPACK_IMPORTED_MODULE_3__chainResult_js__["a" /* default */])(this, obj);
8323 };
8324});
8325
8326/* harmony default export */ __webpack_exports__["a"] = (__WEBPACK_IMPORTED_MODULE_0__underscore_js__["a" /* default */]);
8327
8328
8329/***/ }),
8330/* 261 */
8331/***/ (function(module, exports, __webpack_require__) {
8332
8333var core = __webpack_require__(2);
8334var $JSON = core.JSON || (core.JSON = { stringify: JSON.stringify });
8335module.exports = function stringify(it) { // eslint-disable-line no-unused-vars
8336 return $JSON.stringify.apply($JSON, arguments);
8337};
8338
8339
8340/***/ }),
8341/* 262 */
8342/***/ (function(module, exports, __webpack_require__) {
8343
8344__webpack_require__(263);
8345module.exports = __webpack_require__(2).Object.keys;
8346
8347
8348/***/ }),
8349/* 263 */
8350/***/ (function(module, exports, __webpack_require__) {
8351
8352// 19.1.2.14 Object.keys(O)
8353var toObject = __webpack_require__(53);
8354var $keys = __webpack_require__(50);
8355
8356__webpack_require__(85)('keys', function () {
8357 return function keys(it) {
8358 return $keys(toObject(it));
8359 };
8360});
8361
8362
8363/***/ }),
8364/* 264 */
8365/***/ (function(module, exports) {
8366
8367// Unique ID creation requires a high quality random # generator. In the
8368// browser this is a little complicated due to unknown quality of Math.random()
8369// and inconsistent support for the `crypto` API. We do the best we can via
8370// feature-detection
8371
8372// getRandomValues needs to be invoked in a context where "this" is a Crypto
8373// implementation. Also, find the complete implementation of crypto on IE11.
8374var getRandomValues = (typeof(crypto) != 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto)) ||
8375 (typeof(msCrypto) != 'undefined' && typeof window.msCrypto.getRandomValues == 'function' && msCrypto.getRandomValues.bind(msCrypto));
8376
8377if (getRandomValues) {
8378 // WHATWG crypto RNG - http://wiki.whatwg.org/wiki/Crypto
8379 var rnds8 = new Uint8Array(16); // eslint-disable-line no-undef
8380
8381 module.exports = function whatwgRNG() {
8382 getRandomValues(rnds8);
8383 return rnds8;
8384 };
8385} else {
8386 // Math.random()-based (RNG)
8387 //
8388 // If all else fails, use Math.random(). It's fast, but is of unspecified
8389 // quality.
8390 var rnds = new Array(16);
8391
8392 module.exports = function mathRNG() {
8393 for (var i = 0, r; i < 16; i++) {
8394 if ((i & 0x03) === 0) r = Math.random() * 0x100000000;
8395 rnds[i] = r >>> ((i & 0x03) << 3) & 0xff;
8396 }
8397
8398 return rnds;
8399 };
8400}
8401
8402
8403/***/ }),
8404/* 265 */
8405/***/ (function(module, exports) {
8406
8407/**
8408 * Convert array of 16 byte values to UUID string format of the form:
8409 * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
8410 */
8411var byteToHex = [];
8412for (var i = 0; i < 256; ++i) {
8413 byteToHex[i] = (i + 0x100).toString(16).substr(1);
8414}
8415
8416function bytesToUuid(buf, offset) {
8417 var i = offset || 0;
8418 var bth = byteToHex;
8419 // join used to fix memory issue caused by concatenation: https://bugs.chromium.org/p/v8/issues/detail?id=3175#c4
8420 return ([bth[buf[i++]], bth[buf[i++]],
8421 bth[buf[i++]], bth[buf[i++]], '-',
8422 bth[buf[i++]], bth[buf[i++]], '-',
8423 bth[buf[i++]], bth[buf[i++]], '-',
8424 bth[buf[i++]], bth[buf[i++]], '-',
8425 bth[buf[i++]], bth[buf[i++]],
8426 bth[buf[i++]], bth[buf[i++]],
8427 bth[buf[i++]], bth[buf[i++]]]).join('');
8428}
8429
8430module.exports = bytesToUuid;
8431
8432
8433/***/ }),
8434/* 266 */
8435/***/ (function(module, exports, __webpack_require__) {
8436
8437"use strict";
8438
8439
8440/**
8441 * This is the common logic for both the Node.js and web browser
8442 * implementations of `debug()`.
8443 */
8444function setup(env) {
8445 createDebug.debug = createDebug;
8446 createDebug.default = createDebug;
8447 createDebug.coerce = coerce;
8448 createDebug.disable = disable;
8449 createDebug.enable = enable;
8450 createDebug.enabled = enabled;
8451 createDebug.humanize = __webpack_require__(267);
8452 Object.keys(env).forEach(function (key) {
8453 createDebug[key] = env[key];
8454 });
8455 /**
8456 * Active `debug` instances.
8457 */
8458
8459 createDebug.instances = [];
8460 /**
8461 * The currently active debug mode names, and names to skip.
8462 */
8463
8464 createDebug.names = [];
8465 createDebug.skips = [];
8466 /**
8467 * Map of special "%n" handling functions, for the debug "format" argument.
8468 *
8469 * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N".
8470 */
8471
8472 createDebug.formatters = {};
8473 /**
8474 * Selects a color for a debug namespace
8475 * @param {String} namespace The namespace string for the for the debug instance to be colored
8476 * @return {Number|String} An ANSI color code for the given namespace
8477 * @api private
8478 */
8479
8480 function selectColor(namespace) {
8481 var hash = 0;
8482
8483 for (var i = 0; i < namespace.length; i++) {
8484 hash = (hash << 5) - hash + namespace.charCodeAt(i);
8485 hash |= 0; // Convert to 32bit integer
8486 }
8487
8488 return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
8489 }
8490
8491 createDebug.selectColor = selectColor;
8492 /**
8493 * Create a debugger with the given `namespace`.
8494 *
8495 * @param {String} namespace
8496 * @return {Function}
8497 * @api public
8498 */
8499
8500 function createDebug(namespace) {
8501 var prevTime;
8502
8503 function debug() {
8504 // Disabled?
8505 if (!debug.enabled) {
8506 return;
8507 }
8508
8509 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
8510 args[_key] = arguments[_key];
8511 }
8512
8513 var self = debug; // Set `diff` timestamp
8514
8515 var curr = Number(new Date());
8516 var ms = curr - (prevTime || curr);
8517 self.diff = ms;
8518 self.prev = prevTime;
8519 self.curr = curr;
8520 prevTime = curr;
8521 args[0] = createDebug.coerce(args[0]);
8522
8523 if (typeof args[0] !== 'string') {
8524 // Anything else let's inspect with %O
8525 args.unshift('%O');
8526 } // Apply any `formatters` transformations
8527
8528
8529 var index = 0;
8530 args[0] = args[0].replace(/%([a-zA-Z%])/g, function (match, format) {
8531 // If we encounter an escaped % then don't increase the array index
8532 if (match === '%%') {
8533 return match;
8534 }
8535
8536 index++;
8537 var formatter = createDebug.formatters[format];
8538
8539 if (typeof formatter === 'function') {
8540 var val = args[index];
8541 match = formatter.call(self, val); // Now we need to remove `args[index]` since it's inlined in the `format`
8542
8543 args.splice(index, 1);
8544 index--;
8545 }
8546
8547 return match;
8548 }); // Apply env-specific formatting (colors, etc.)
8549
8550 createDebug.formatArgs.call(self, args);
8551 var logFn = self.log || createDebug.log;
8552 logFn.apply(self, args);
8553 }
8554
8555 debug.namespace = namespace;
8556 debug.enabled = createDebug.enabled(namespace);
8557 debug.useColors = createDebug.useColors();
8558 debug.color = selectColor(namespace);
8559 debug.destroy = destroy;
8560 debug.extend = extend; // Debug.formatArgs = formatArgs;
8561 // debug.rawLog = rawLog;
8562 // env-specific initialization logic for debug instances
8563
8564 if (typeof createDebug.init === 'function') {
8565 createDebug.init(debug);
8566 }
8567
8568 createDebug.instances.push(debug);
8569 return debug;
8570 }
8571
8572 function destroy() {
8573 var index = createDebug.instances.indexOf(this);
8574
8575 if (index !== -1) {
8576 createDebug.instances.splice(index, 1);
8577 return true;
8578 }
8579
8580 return false;
8581 }
8582
8583 function extend(namespace, delimiter) {
8584 return createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace);
8585 }
8586 /**
8587 * Enables a debug mode by namespaces. This can include modes
8588 * separated by a colon and wildcards.
8589 *
8590 * @param {String} namespaces
8591 * @api public
8592 */
8593
8594
8595 function enable(namespaces) {
8596 createDebug.save(namespaces);
8597 createDebug.names = [];
8598 createDebug.skips = [];
8599 var i;
8600 var split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/);
8601 var len = split.length;
8602
8603 for (i = 0; i < len; i++) {
8604 if (!split[i]) {
8605 // ignore empty strings
8606 continue;
8607 }
8608
8609 namespaces = split[i].replace(/\*/g, '.*?');
8610
8611 if (namespaces[0] === '-') {
8612 createDebug.skips.push(new RegExp('^' + namespaces.substr(1) + '$'));
8613 } else {
8614 createDebug.names.push(new RegExp('^' + namespaces + '$'));
8615 }
8616 }
8617
8618 for (i = 0; i < createDebug.instances.length; i++) {
8619 var instance = createDebug.instances[i];
8620 instance.enabled = createDebug.enabled(instance.namespace);
8621 }
8622 }
8623 /**
8624 * Disable debug output.
8625 *
8626 * @api public
8627 */
8628
8629
8630 function disable() {
8631 createDebug.enable('');
8632 }
8633 /**
8634 * Returns true if the given mode name is enabled, false otherwise.
8635 *
8636 * @param {String} name
8637 * @return {Boolean}
8638 * @api public
8639 */
8640
8641
8642 function enabled(name) {
8643 if (name[name.length - 1] === '*') {
8644 return true;
8645 }
8646
8647 var i;
8648 var len;
8649
8650 for (i = 0, len = createDebug.skips.length; i < len; i++) {
8651 if (createDebug.skips[i].test(name)) {
8652 return false;
8653 }
8654 }
8655
8656 for (i = 0, len = createDebug.names.length; i < len; i++) {
8657 if (createDebug.names[i].test(name)) {
8658 return true;
8659 }
8660 }
8661
8662 return false;
8663 }
8664 /**
8665 * Coerce `val`.
8666 *
8667 * @param {Mixed} val
8668 * @return {Mixed}
8669 * @api private
8670 */
8671
8672
8673 function coerce(val) {
8674 if (val instanceof Error) {
8675 return val.stack || val.message;
8676 }
8677
8678 return val;
8679 }
8680
8681 createDebug.enable(createDebug.load());
8682 return createDebug;
8683}
8684
8685module.exports = setup;
8686
8687
8688
8689/***/ }),
8690/* 267 */
8691/***/ (function(module, exports) {
8692
8693/**
8694 * Helpers.
8695 */
8696
8697var s = 1000;
8698var m = s * 60;
8699var h = m * 60;
8700var d = h * 24;
8701var w = d * 7;
8702var y = d * 365.25;
8703
8704/**
8705 * Parse or format the given `val`.
8706 *
8707 * Options:
8708 *
8709 * - `long` verbose formatting [false]
8710 *
8711 * @param {String|Number} val
8712 * @param {Object} [options]
8713 * @throws {Error} throw an error if val is not a non-empty string or a number
8714 * @return {String|Number}
8715 * @api public
8716 */
8717
8718module.exports = function(val, options) {
8719 options = options || {};
8720 var type = typeof val;
8721 if (type === 'string' && val.length > 0) {
8722 return parse(val);
8723 } else if (type === 'number' && isFinite(val)) {
8724 return options.long ? fmtLong(val) : fmtShort(val);
8725 }
8726 throw new Error(
8727 'val is not a non-empty string or a valid number. val=' +
8728 JSON.stringify(val)
8729 );
8730};
8731
8732/**
8733 * Parse the given `str` and return milliseconds.
8734 *
8735 * @param {String} str
8736 * @return {Number}
8737 * @api private
8738 */
8739
8740function parse(str) {
8741 str = String(str);
8742 if (str.length > 100) {
8743 return;
8744 }
8745 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(
8746 str
8747 );
8748 if (!match) {
8749 return;
8750 }
8751 var n = parseFloat(match[1]);
8752 var type = (match[2] || 'ms').toLowerCase();
8753 switch (type) {
8754 case 'years':
8755 case 'year':
8756 case 'yrs':
8757 case 'yr':
8758 case 'y':
8759 return n * y;
8760 case 'weeks':
8761 case 'week':
8762 case 'w':
8763 return n * w;
8764 case 'days':
8765 case 'day':
8766 case 'd':
8767 return n * d;
8768 case 'hours':
8769 case 'hour':
8770 case 'hrs':
8771 case 'hr':
8772 case 'h':
8773 return n * h;
8774 case 'minutes':
8775 case 'minute':
8776 case 'mins':
8777 case 'min':
8778 case 'm':
8779 return n * m;
8780 case 'seconds':
8781 case 'second':
8782 case 'secs':
8783 case 'sec':
8784 case 's':
8785 return n * s;
8786 case 'milliseconds':
8787 case 'millisecond':
8788 case 'msecs':
8789 case 'msec':
8790 case 'ms':
8791 return n;
8792 default:
8793 return undefined;
8794 }
8795}
8796
8797/**
8798 * Short format for `ms`.
8799 *
8800 * @param {Number} ms
8801 * @return {String}
8802 * @api private
8803 */
8804
8805function fmtShort(ms) {
8806 var msAbs = Math.abs(ms);
8807 if (msAbs >= d) {
8808 return Math.round(ms / d) + 'd';
8809 }
8810 if (msAbs >= h) {
8811 return Math.round(ms / h) + 'h';
8812 }
8813 if (msAbs >= m) {
8814 return Math.round(ms / m) + 'm';
8815 }
8816 if (msAbs >= s) {
8817 return Math.round(ms / s) + 's';
8818 }
8819 return ms + 'ms';
8820}
8821
8822/**
8823 * Long format for `ms`.
8824 *
8825 * @param {Number} ms
8826 * @return {String}
8827 * @api private
8828 */
8829
8830function fmtLong(ms) {
8831 var msAbs = Math.abs(ms);
8832 if (msAbs >= d) {
8833 return plural(ms, msAbs, d, 'day');
8834 }
8835 if (msAbs >= h) {
8836 return plural(ms, msAbs, h, 'hour');
8837 }
8838 if (msAbs >= m) {
8839 return plural(ms, msAbs, m, 'minute');
8840 }
8841 if (msAbs >= s) {
8842 return plural(ms, msAbs, s, 'second');
8843 }
8844 return ms + ' ms';
8845}
8846
8847/**
8848 * Pluralization helper.
8849 */
8850
8851function plural(ms, msAbs, n, name) {
8852 var isPlural = msAbs >= n * 1.5;
8853 return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');
8854}
8855
8856
8857/***/ }),
8858/* 268 */
8859/***/ (function(module, exports, __webpack_require__) {
8860
8861__webpack_require__(269);
8862module.exports = __webpack_require__(2).Object.getPrototypeOf;
8863
8864
8865/***/ }),
8866/* 269 */
8867/***/ (function(module, exports, __webpack_require__) {
8868
8869// 19.1.2.9 Object.getPrototypeOf(O)
8870var toObject = __webpack_require__(53);
8871var $getPrototypeOf = __webpack_require__(98);
8872
8873__webpack_require__(85)('getPrototypeOf', function () {
8874 return function getPrototypeOf(it) {
8875 return $getPrototypeOf(toObject(it));
8876 };
8877});
8878
8879
8880/***/ }),
8881/* 270 */
8882/***/ (function(module, exports, __webpack_require__) {
8883
8884"use strict";
8885
8886
8887var _defineProperty = __webpack_require__(86);
8888
8889var _defineProperty2 = _interopRequireDefault(_defineProperty);
8890
8891function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
8892
8893var AV = __webpack_require__(34);
8894var AppRouter = __webpack_require__(273);
8895
8896var _require = __webpack_require__(15),
8897 isNullOrUndefined = _require.isNullOrUndefined;
8898
8899var _require2 = __webpack_require__(0),
8900 extend = _require2.extend,
8901 isObject = _require2.isObject,
8902 isEmpty = _require2.isEmpty;
8903
8904var isCNApp = function isCNApp(appId) {
8905 return appId.slice(-9) !== '-MdYXbMMI';
8906};
8907
8908var fillServerURLs = function fillServerURLs(url) {
8909 return {
8910 push: url,
8911 stats: url,
8912 engine: url,
8913 api: url,
8914 rtm: url
8915 };
8916};
8917
8918function getDefaultServerURLs(appId) {
8919 if (isCNApp(appId)) {
8920 return {};
8921 }
8922 var id = appId.slice(0, 8).toLowerCase();
8923 var domain = 'lncldglobal.com';
8924 return {
8925 push: 'https://' + id + '.push.' + domain,
8926 stats: 'https://' + id + '.stats.' + domain,
8927 engine: 'https://' + id + '.engine.' + domain,
8928 api: 'https://' + id + '.api.' + domain,
8929 rtm: 'https://' + id + '.rtm.' + domain
8930 };
8931}
8932
8933var _disableAppRouter = false;
8934var _initialized = false;
8935
8936/**
8937 * URLs for services
8938 * @typedef {Object} ServerURLs
8939 * @property {String} [api] serverURL for API service
8940 * @property {String} [engine] serverURL for engine service
8941 * @property {String} [stats] serverURL for stats service
8942 * @property {String} [push] serverURL for push service
8943 * @property {String} [rtm] serverURL for LiveQuery service
8944 */
8945
8946/**
8947 * Call this method first to set up your authentication tokens for AV.
8948 * You can get your app keys from the LeanCloud dashboard on http://leancloud.cn .
8949 * @function AV.init
8950 * @param {Object} options
8951 * @param {String} options.appId application id
8952 * @param {String} options.appKey application key
8953 * @param {String} [options.masterKey] application master key
8954 * @param {Boolean} [options.production]
8955 * @param {String|ServerURLs} [options.serverURL] URLs for services. if a string was given, it will be applied for all services.
8956 * @param {Boolean} [options.disableCurrentUser]
8957 */
8958AV.init = function init(options) {
8959 if (!isObject(options)) {
8960 return AV.init({
8961 appId: options,
8962 appKey: arguments.length <= 1 ? undefined : arguments[1],
8963 masterKey: arguments.length <= 2 ? undefined : arguments[2]
8964 });
8965 }
8966 var appId = options.appId,
8967 appKey = options.appKey,
8968 masterKey = options.masterKey,
8969 hookKey = options.hookKey,
8970 serverURL = options.serverURL,
8971 _options$serverURLs = options.serverURLs,
8972 serverURLs = _options$serverURLs === undefined ? serverURL : _options$serverURLs,
8973 disableCurrentUser = options.disableCurrentUser,
8974 production = options.production,
8975 realtime = options.realtime;
8976
8977 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.');
8978 if (!appId) throw new TypeError('appId must be a string');
8979 if (!appKey) throw new TypeError('appKey must be a string');
8980 if (undefined !== 'NODE_JS' && masterKey) console.warn('MasterKey is not supposed to be used at client side.');
8981 if (isCNApp(appId)) {
8982 if (!serverURLs && isEmpty(AV._config.serverURLs)) {
8983 throw new TypeError('serverURL option is required for apps from CN region');
8984 }
8985 }
8986 if (appId !== AV._config.applicationId) {
8987 // overwrite all keys when reinitializing as a new app
8988 AV._config.masterKey = masterKey;
8989 AV._config.hookKey = hookKey;
8990 } else {
8991 if (masterKey) AV._config.masterKey = masterKey;
8992 if (hookKey) AV._config.hookKey = hookKey;
8993 }
8994 AV._config.applicationId = appId;
8995 AV._config.applicationKey = appKey;
8996 if (!isNullOrUndefined(production)) {
8997 AV.setProduction(production);
8998 }
8999 if (typeof disableCurrentUser !== 'undefined') AV._config.disableCurrentUser = disableCurrentUser;
9000 var disableAppRouter = _disableAppRouter || typeof serverURLs !== 'undefined';
9001 if (!disableAppRouter) {
9002 AV._appRouter = new AppRouter(AV);
9003 }
9004 AV._setServerURLs(extend({}, getDefaultServerURLs(appId), AV._config.serverURLs, typeof serverURLs === 'string' ? fillServerURLs(serverURLs) : serverURLs), disableAppRouter);
9005 if (realtime) {
9006 AV._config.realtime = realtime;
9007 } else if (AV._sharedConfig.liveQueryRealtime) {
9008 var _AV$_config$serverURL = AV._config.serverURLs,
9009 api = _AV$_config$serverURL.api,
9010 rtm = _AV$_config$serverURL.rtm;
9011
9012 AV._config.realtime = new AV._sharedConfig.liveQueryRealtime({
9013 appId: appId,
9014 appKey: appKey,
9015 server: {
9016 api: api,
9017 RTMRouter: rtm
9018 }
9019 });
9020 }
9021 _initialized = true;
9022};
9023
9024// If we're running in node.js, allow using the master key.
9025if (undefined === 'NODE_JS') {
9026 AV.Cloud = AV.Cloud || {};
9027 /**
9028 * Switches the LeanCloud SDK to using the Master key. The Master key grants
9029 * priveleged access to the data in LeanCloud and can be used to bypass ACLs and
9030 * other restrictions that are applied to the client SDKs.
9031 * <p><strong><em>Available in Cloud Code and Node.js only.</em></strong>
9032 * </p>
9033 */
9034 AV.Cloud.useMasterKey = function () {
9035 AV._config.useMasterKey = true;
9036 };
9037}
9038
9039/**
9040 * Call this method to set production environment variable.
9041 * @function AV.setProduction
9042 * @param {Boolean} production True is production environment,and
9043 * it's true by default.
9044 */
9045AV.setProduction = function (production) {
9046 if (!isNullOrUndefined(production)) {
9047 AV._config.production = production ? 1 : 0;
9048 } else {
9049 // change to default value
9050 AV._config.production = null;
9051 }
9052};
9053
9054AV._setServerURLs = function (urls) {
9055 var disableAppRouter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
9056
9057 if (typeof urls !== 'string') {
9058 extend(AV._config.serverURLs, urls);
9059 } else {
9060 AV._config.serverURLs = fillServerURLs(urls);
9061 }
9062 if (disableAppRouter) {
9063 if (AV._appRouter) {
9064 AV._appRouter.disable();
9065 } else {
9066 _disableAppRouter = true;
9067 }
9068 }
9069};
9070/**
9071 * Set server URLs for services.
9072 * @function AV.setServerURL
9073 * @since 4.3.0
9074 * @param {String|ServerURLs} urls URLs for services. if a string was given, it will be applied for all services.
9075 * You can also set them when initializing SDK with `options.serverURL`
9076 */
9077AV.setServerURL = function (urls) {
9078 return AV._setServerURLs(urls);
9079};
9080AV.setServerURLs = AV.setServerURL;
9081
9082AV.keepErrorRawMessage = function (value) {
9083 AV._sharedConfig.keepErrorRawMessage = value;
9084};
9085
9086/**
9087 * Set a deadline for requests to complete.
9088 * Note that file upload requests are not affected.
9089 * @function AV.setRequestTimeout
9090 * @since 3.6.0
9091 * @param {number} ms
9092 */
9093AV.setRequestTimeout = function (ms) {
9094 AV._config.requestTimeout = ms;
9095};
9096
9097// backword compatible
9098AV.initialize = AV.init;
9099
9100var defineConfig = function defineConfig(property) {
9101 return (0, _defineProperty2.default)(AV, property, {
9102 get: function get() {
9103 return AV._config[property];
9104 },
9105 set: function set(value) {
9106 AV._config[property] = value;
9107 }
9108 });
9109};
9110
9111['applicationId', 'applicationKey', 'masterKey', 'hookKey'].forEach(defineConfig);
9112
9113/***/ }),
9114/* 271 */
9115/***/ (function(module, exports, __webpack_require__) {
9116
9117__webpack_require__(272);
9118var $Object = __webpack_require__(2).Object;
9119module.exports = function defineProperty(it, key, desc) {
9120 return $Object.defineProperty(it, key, desc);
9121};
9122
9123
9124/***/ }),
9125/* 272 */
9126/***/ (function(module, exports, __webpack_require__) {
9127
9128var $export = __webpack_require__(17);
9129// 19.1.2.4 / 15.2.3.6 Object.defineProperty(O, P, Attributes)
9130$export($export.S + $export.F * !__webpack_require__(21), 'Object', { defineProperty: __webpack_require__(19).f });
9131
9132
9133/***/ }),
9134/* 273 */
9135/***/ (function(module, exports, __webpack_require__) {
9136
9137"use strict";
9138
9139
9140var ajax = __webpack_require__(58);
9141var Cache = __webpack_require__(159);
9142
9143function AppRouter(AV) {
9144 var _this = this;
9145
9146 this.AV = AV;
9147 this.lockedUntil = 0;
9148 Cache.getAsync('serverURLs').then(function (data) {
9149 if (_this.disabled) return;
9150 if (!data) return _this.lock(0);
9151 var serverURLs = data.serverURLs,
9152 lockedUntil = data.lockedUntil;
9153
9154 _this.AV._setServerURLs(serverURLs, false);
9155 _this.lockedUntil = lockedUntil;
9156 }).catch(function () {
9157 return _this.lock(0);
9158 });
9159}
9160
9161AppRouter.prototype.disable = function disable() {
9162 this.disabled = true;
9163};
9164AppRouter.prototype.lock = function lock(ttl) {
9165 this.lockedUntil = Date.now() + ttl;
9166};
9167AppRouter.prototype.refresh = function refresh() {
9168 var _this2 = this;
9169
9170 if (this.disabled) return;
9171 if (Date.now() < this.lockedUntil) return;
9172 this.lock(10);
9173 var url = 'https://app-router.com/2/route';
9174 return ajax({
9175 method: 'get',
9176 url: url,
9177 query: {
9178 appId: this.AV.applicationId
9179 }
9180 }).then(function (servers) {
9181 if (_this2.disabled) return;
9182 var ttl = servers.ttl;
9183 if (!ttl) throw new Error('missing ttl');
9184 ttl = ttl * 1000;
9185 var protocal = 'https://';
9186 var serverURLs = {
9187 push: protocal + servers.push_server,
9188 stats: protocal + servers.stats_server,
9189 engine: protocal + servers.engine_server,
9190 api: protocal + servers.api_server
9191 };
9192 _this2.AV._setServerURLs(serverURLs, false);
9193 _this2.lock(ttl);
9194 return Cache.setAsync('serverURLs', {
9195 serverURLs: serverURLs,
9196 lockedUntil: _this2.lockedUntil
9197 }, ttl);
9198 }).catch(function (error) {
9199 // bypass all errors
9200 console.warn('refresh server URLs failed: ' + error.message);
9201 _this2.lock(600);
9202 });
9203};
9204
9205module.exports = AppRouter;
9206
9207/***/ }),
9208/* 274 */
9209/***/ (function(module, exports, __webpack_require__) {
9210
9211module.exports = { "default": __webpack_require__(275), __esModule: true };
9212
9213/***/ }),
9214/* 275 */
9215/***/ (function(module, exports, __webpack_require__) {
9216
9217__webpack_require__(47);
9218__webpack_require__(54);
9219module.exports = __webpack_require__(87).f('iterator');
9220
9221
9222/***/ }),
9223/* 276 */
9224/***/ (function(module, exports, __webpack_require__) {
9225
9226module.exports = { "default": __webpack_require__(277), __esModule: true };
9227
9228/***/ }),
9229/* 277 */
9230/***/ (function(module, exports, __webpack_require__) {
9231
9232__webpack_require__(278);
9233__webpack_require__(91);
9234__webpack_require__(283);
9235__webpack_require__(284);
9236module.exports = __webpack_require__(2).Symbol;
9237
9238
9239/***/ }),
9240/* 278 */
9241/***/ (function(module, exports, __webpack_require__) {
9242
9243"use strict";
9244
9245// ECMAScript 6 symbols shim
9246var global = __webpack_require__(6);
9247var has = __webpack_require__(24);
9248var DESCRIPTORS = __webpack_require__(21);
9249var $export = __webpack_require__(17);
9250var redefine = __webpack_require__(94);
9251var META = __webpack_require__(279).KEY;
9252var $fails = __webpack_require__(39);
9253var shared = __webpack_require__(66);
9254var setToStringTag = __webpack_require__(52);
9255var uid = __webpack_require__(51);
9256var wks = __webpack_require__(7);
9257var wksExt = __webpack_require__(87);
9258var wksDefine = __webpack_require__(88);
9259var enumKeys = __webpack_require__(280);
9260var isArray = __webpack_require__(281);
9261var anObject = __webpack_require__(16);
9262var isObject = __webpack_require__(20);
9263var toObject = __webpack_require__(53);
9264var toIObject = __webpack_require__(25);
9265var toPrimitive = __webpack_require__(63);
9266var createDesc = __webpack_require__(49);
9267var _create = __webpack_require__(64);
9268var gOPNExt = __webpack_require__(282);
9269var $GOPD = __webpack_require__(90);
9270var $GOPS = __webpack_require__(160);
9271var $DP = __webpack_require__(19);
9272var $keys = __webpack_require__(50);
9273var gOPD = $GOPD.f;
9274var dP = $DP.f;
9275var gOPN = gOPNExt.f;
9276var $Symbol = global.Symbol;
9277var $JSON = global.JSON;
9278var _stringify = $JSON && $JSON.stringify;
9279var PROTOTYPE = 'prototype';
9280var HIDDEN = wks('_hidden');
9281var TO_PRIMITIVE = wks('toPrimitive');
9282var isEnum = {}.propertyIsEnumerable;
9283var SymbolRegistry = shared('symbol-registry');
9284var AllSymbols = shared('symbols');
9285var OPSymbols = shared('op-symbols');
9286var ObjectProto = Object[PROTOTYPE];
9287var USE_NATIVE = typeof $Symbol == 'function' && !!$GOPS.f;
9288var QObject = global.QObject;
9289// Don't use setters in Qt Script, https://github.com/zloirock/core-js/issues/173
9290var setter = !QObject || !QObject[PROTOTYPE] || !QObject[PROTOTYPE].findChild;
9291
9292// fallback for old Android, https://code.google.com/p/v8/issues/detail?id=687
9293var setSymbolDesc = DESCRIPTORS && $fails(function () {
9294 return _create(dP({}, 'a', {
9295 get: function () { return dP(this, 'a', { value: 7 }).a; }
9296 })).a != 7;
9297}) ? function (it, key, D) {
9298 var protoDesc = gOPD(ObjectProto, key);
9299 if (protoDesc) delete ObjectProto[key];
9300 dP(it, key, D);
9301 if (protoDesc && it !== ObjectProto) dP(ObjectProto, key, protoDesc);
9302} : dP;
9303
9304var wrap = function (tag) {
9305 var sym = AllSymbols[tag] = _create($Symbol[PROTOTYPE]);
9306 sym._k = tag;
9307 return sym;
9308};
9309
9310var isSymbol = USE_NATIVE && typeof $Symbol.iterator == 'symbol' ? function (it) {
9311 return typeof it == 'symbol';
9312} : function (it) {
9313 return it instanceof $Symbol;
9314};
9315
9316var $defineProperty = function defineProperty(it, key, D) {
9317 if (it === ObjectProto) $defineProperty(OPSymbols, key, D);
9318 anObject(it);
9319 key = toPrimitive(key, true);
9320 anObject(D);
9321 if (has(AllSymbols, key)) {
9322 if (!D.enumerable) {
9323 if (!has(it, HIDDEN)) dP(it, HIDDEN, createDesc(1, {}));
9324 it[HIDDEN][key] = true;
9325 } else {
9326 if (has(it, HIDDEN) && it[HIDDEN][key]) it[HIDDEN][key] = false;
9327 D = _create(D, { enumerable: createDesc(0, false) });
9328 } return setSymbolDesc(it, key, D);
9329 } return dP(it, key, D);
9330};
9331var $defineProperties = function defineProperties(it, P) {
9332 anObject(it);
9333 var keys = enumKeys(P = toIObject(P));
9334 var i = 0;
9335 var l = keys.length;
9336 var key;
9337 while (l > i) $defineProperty(it, key = keys[i++], P[key]);
9338 return it;
9339};
9340var $create = function create(it, P) {
9341 return P === undefined ? _create(it) : $defineProperties(_create(it), P);
9342};
9343var $propertyIsEnumerable = function propertyIsEnumerable(key) {
9344 var E = isEnum.call(this, key = toPrimitive(key, true));
9345 if (this === ObjectProto && has(AllSymbols, key) && !has(OPSymbols, key)) return false;
9346 return E || !has(this, key) || !has(AllSymbols, key) || has(this, HIDDEN) && this[HIDDEN][key] ? E : true;
9347};
9348var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(it, key) {
9349 it = toIObject(it);
9350 key = toPrimitive(key, true);
9351 if (it === ObjectProto && has(AllSymbols, key) && !has(OPSymbols, key)) return;
9352 var D = gOPD(it, key);
9353 if (D && has(AllSymbols, key) && !(has(it, HIDDEN) && it[HIDDEN][key])) D.enumerable = true;
9354 return D;
9355};
9356var $getOwnPropertyNames = function getOwnPropertyNames(it) {
9357 var names = gOPN(toIObject(it));
9358 var result = [];
9359 var i = 0;
9360 var key;
9361 while (names.length > i) {
9362 if (!has(AllSymbols, key = names[i++]) && key != HIDDEN && key != META) result.push(key);
9363 } return result;
9364};
9365var $getOwnPropertySymbols = function getOwnPropertySymbols(it) {
9366 var IS_OP = it === ObjectProto;
9367 var names = gOPN(IS_OP ? OPSymbols : toIObject(it));
9368 var result = [];
9369 var i = 0;
9370 var key;
9371 while (names.length > i) {
9372 if (has(AllSymbols, key = names[i++]) && (IS_OP ? has(ObjectProto, key) : true)) result.push(AllSymbols[key]);
9373 } return result;
9374};
9375
9376// 19.4.1.1 Symbol([description])
9377if (!USE_NATIVE) {
9378 $Symbol = function Symbol() {
9379 if (this instanceof $Symbol) throw TypeError('Symbol is not a constructor!');
9380 var tag = uid(arguments.length > 0 ? arguments[0] : undefined);
9381 var $set = function (value) {
9382 if (this === ObjectProto) $set.call(OPSymbols, value);
9383 if (has(this, HIDDEN) && has(this[HIDDEN], tag)) this[HIDDEN][tag] = false;
9384 setSymbolDesc(this, tag, createDesc(1, value));
9385 };
9386 if (DESCRIPTORS && setter) setSymbolDesc(ObjectProto, tag, { configurable: true, set: $set });
9387 return wrap(tag);
9388 };
9389 redefine($Symbol[PROTOTYPE], 'toString', function toString() {
9390 return this._k;
9391 });
9392
9393 $GOPD.f = $getOwnPropertyDescriptor;
9394 $DP.f = $defineProperty;
9395 __webpack_require__(161).f = gOPNExt.f = $getOwnPropertyNames;
9396 __webpack_require__(89).f = $propertyIsEnumerable;
9397 $GOPS.f = $getOwnPropertySymbols;
9398
9399 if (DESCRIPTORS && !__webpack_require__(37)) {
9400 redefine(ObjectProto, 'propertyIsEnumerable', $propertyIsEnumerable, true);
9401 }
9402
9403 wksExt.f = function (name) {
9404 return wrap(wks(name));
9405 };
9406}
9407
9408$export($export.G + $export.W + $export.F * !USE_NATIVE, { Symbol: $Symbol });
9409
9410for (var es6Symbols = (
9411 // 19.4.2.2, 19.4.2.3, 19.4.2.4, 19.4.2.6, 19.4.2.8, 19.4.2.9, 19.4.2.10, 19.4.2.11, 19.4.2.12, 19.4.2.13, 19.4.2.14
9412 'hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables'
9413).split(','), j = 0; es6Symbols.length > j;)wks(es6Symbols[j++]);
9414
9415for (var wellKnownSymbols = $keys(wks.store), k = 0; wellKnownSymbols.length > k;) wksDefine(wellKnownSymbols[k++]);
9416
9417$export($export.S + $export.F * !USE_NATIVE, 'Symbol', {
9418 // 19.4.2.1 Symbol.for(key)
9419 'for': function (key) {
9420 return has(SymbolRegistry, key += '')
9421 ? SymbolRegistry[key]
9422 : SymbolRegistry[key] = $Symbol(key);
9423 },
9424 // 19.4.2.5 Symbol.keyFor(sym)
9425 keyFor: function keyFor(sym) {
9426 if (!isSymbol(sym)) throw TypeError(sym + ' is not a symbol!');
9427 for (var key in SymbolRegistry) if (SymbolRegistry[key] === sym) return key;
9428 },
9429 useSetter: function () { setter = true; },
9430 useSimple: function () { setter = false; }
9431});
9432
9433$export($export.S + $export.F * !USE_NATIVE, 'Object', {
9434 // 19.1.2.2 Object.create(O [, Properties])
9435 create: $create,
9436 // 19.1.2.4 Object.defineProperty(O, P, Attributes)
9437 defineProperty: $defineProperty,
9438 // 19.1.2.3 Object.defineProperties(O, Properties)
9439 defineProperties: $defineProperties,
9440 // 19.1.2.6 Object.getOwnPropertyDescriptor(O, P)
9441 getOwnPropertyDescriptor: $getOwnPropertyDescriptor,
9442 // 19.1.2.7 Object.getOwnPropertyNames(O)
9443 getOwnPropertyNames: $getOwnPropertyNames,
9444 // 19.1.2.8 Object.getOwnPropertySymbols(O)
9445 getOwnPropertySymbols: $getOwnPropertySymbols
9446});
9447
9448// Chrome 38 and 39 `Object.getOwnPropertySymbols` fails on primitives
9449// https://bugs.chromium.org/p/v8/issues/detail?id=3443
9450var FAILS_ON_PRIMITIVES = $fails(function () { $GOPS.f(1); });
9451
9452$export($export.S + $export.F * FAILS_ON_PRIMITIVES, 'Object', {
9453 getOwnPropertySymbols: function getOwnPropertySymbols(it) {
9454 return $GOPS.f(toObject(it));
9455 }
9456});
9457
9458// 24.3.2 JSON.stringify(value [, replacer [, space]])
9459$JSON && $export($export.S + $export.F * (!USE_NATIVE || $fails(function () {
9460 var S = $Symbol();
9461 // MS Edge converts symbol values to JSON as {}
9462 // WebKit converts symbol values to JSON as null
9463 // V8 throws on boxed symbols
9464 return _stringify([S]) != '[null]' || _stringify({ a: S }) != '{}' || _stringify(Object(S)) != '{}';
9465})), 'JSON', {
9466 stringify: function stringify(it) {
9467 var args = [it];
9468 var i = 1;
9469 var replacer, $replacer;
9470 while (arguments.length > i) args.push(arguments[i++]);
9471 $replacer = replacer = args[1];
9472 if (!isObject(replacer) && it === undefined || isSymbol(it)) return; // IE8 returns string on undefined
9473 if (!isArray(replacer)) replacer = function (key, value) {
9474 if (typeof $replacer == 'function') value = $replacer.call(this, key, value);
9475 if (!isSymbol(value)) return value;
9476 };
9477 args[1] = replacer;
9478 return _stringify.apply($JSON, args);
9479 }
9480});
9481
9482// 19.4.3.4 Symbol.prototype[@@toPrimitive](hint)
9483$Symbol[PROTOTYPE][TO_PRIMITIVE] || __webpack_require__(23)($Symbol[PROTOTYPE], TO_PRIMITIVE, $Symbol[PROTOTYPE].valueOf);
9484// 19.4.3.5 Symbol.prototype[@@toStringTag]
9485setToStringTag($Symbol, 'Symbol');
9486// 20.2.1.9 Math[@@toStringTag]
9487setToStringTag(Math, 'Math', true);
9488// 24.3.3 JSON[@@toStringTag]
9489setToStringTag(global.JSON, 'JSON', true);
9490
9491
9492/***/ }),
9493/* 279 */
9494/***/ (function(module, exports, __webpack_require__) {
9495
9496var META = __webpack_require__(51)('meta');
9497var isObject = __webpack_require__(20);
9498var has = __webpack_require__(24);
9499var setDesc = __webpack_require__(19).f;
9500var id = 0;
9501var isExtensible = Object.isExtensible || function () {
9502 return true;
9503};
9504var FREEZE = !__webpack_require__(39)(function () {
9505 return isExtensible(Object.preventExtensions({}));
9506});
9507var setMeta = function (it) {
9508 setDesc(it, META, { value: {
9509 i: 'O' + ++id, // object ID
9510 w: {} // weak collections IDs
9511 } });
9512};
9513var fastKey = function (it, create) {
9514 // return primitive with prefix
9515 if (!isObject(it)) return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it;
9516 if (!has(it, META)) {
9517 // can't set metadata to uncaught frozen object
9518 if (!isExtensible(it)) return 'F';
9519 // not necessary to add metadata
9520 if (!create) return 'E';
9521 // add missing metadata
9522 setMeta(it);
9523 // return object ID
9524 } return it[META].i;
9525};
9526var getWeak = function (it, create) {
9527 if (!has(it, META)) {
9528 // can't set metadata to uncaught frozen object
9529 if (!isExtensible(it)) return true;
9530 // not necessary to add metadata
9531 if (!create) return false;
9532 // add missing metadata
9533 setMeta(it);
9534 // return hash weak collections IDs
9535 } return it[META].w;
9536};
9537// add metadata on freeze-family methods calling
9538var onFreeze = function (it) {
9539 if (FREEZE && meta.NEED && isExtensible(it) && !has(it, META)) setMeta(it);
9540 return it;
9541};
9542var meta = module.exports = {
9543 KEY: META,
9544 NEED: false,
9545 fastKey: fastKey,
9546 getWeak: getWeak,
9547 onFreeze: onFreeze
9548};
9549
9550
9551/***/ }),
9552/* 280 */
9553/***/ (function(module, exports, __webpack_require__) {
9554
9555// all enumerable object keys, includes symbols
9556var getKeys = __webpack_require__(50);
9557var gOPS = __webpack_require__(160);
9558var pIE = __webpack_require__(89);
9559module.exports = function (it) {
9560 var result = getKeys(it);
9561 var getSymbols = gOPS.f;
9562 if (getSymbols) {
9563 var symbols = getSymbols(it);
9564 var isEnum = pIE.f;
9565 var i = 0;
9566 var key;
9567 while (symbols.length > i) if (isEnum.call(it, key = symbols[i++])) result.push(key);
9568 } return result;
9569};
9570
9571
9572/***/ }),
9573/* 281 */
9574/***/ (function(module, exports, __webpack_require__) {
9575
9576// 7.2.2 IsArray(argument)
9577var cof = __webpack_require__(40);
9578module.exports = Array.isArray || function isArray(arg) {
9579 return cof(arg) == 'Array';
9580};
9581
9582
9583/***/ }),
9584/* 282 */
9585/***/ (function(module, exports, __webpack_require__) {
9586
9587// fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window
9588var toIObject = __webpack_require__(25);
9589var gOPN = __webpack_require__(161).f;
9590var toString = {}.toString;
9591
9592var windowNames = typeof window == 'object' && window && Object.getOwnPropertyNames
9593 ? Object.getOwnPropertyNames(window) : [];
9594
9595var getWindowNames = function (it) {
9596 try {
9597 return gOPN(it);
9598 } catch (e) {
9599 return windowNames.slice();
9600 }
9601};
9602
9603module.exports.f = function getOwnPropertyNames(it) {
9604 return windowNames && toString.call(it) == '[object Window]' ? getWindowNames(it) : gOPN(toIObject(it));
9605};
9606
9607
9608/***/ }),
9609/* 283 */
9610/***/ (function(module, exports, __webpack_require__) {
9611
9612__webpack_require__(88)('asyncIterator');
9613
9614
9615/***/ }),
9616/* 284 */
9617/***/ (function(module, exports, __webpack_require__) {
9618
9619__webpack_require__(88)('observable');
9620
9621
9622/***/ }),
9623/* 285 */
9624/***/ (function(module, exports, __webpack_require__) {
9625
9626"use strict";
9627// Copyright (c) 2015-2017 David M. Lee, II
9628
9629
9630/**
9631 * Local reference to TimeoutError
9632 * @private
9633 */
9634var TimeoutError;
9635
9636/**
9637 * Rejects a promise with a {@link TimeoutError} if it does not settle within
9638 * the specified timeout.
9639 *
9640 * @param {Promise} promise The promise.
9641 * @param {number} timeoutMillis Number of milliseconds to wait on settling.
9642 * @returns {Promise} Either resolves/rejects with `promise`, or rejects with
9643 * `TimeoutError`, whichever settles first.
9644 */
9645var timeout = module.exports.timeout = function(promise, timeoutMillis) {
9646 var error = new TimeoutError(),
9647 timeout;
9648
9649 return Promise.race([
9650 promise,
9651 new Promise(function(resolve, reject) {
9652 timeout = setTimeout(function() {
9653 reject(error);
9654 }, timeoutMillis);
9655 }),
9656 ]).then(function(v) {
9657 clearTimeout(timeout);
9658 return v;
9659 }, function(err) {
9660 clearTimeout(timeout);
9661 throw err;
9662 });
9663};
9664
9665/**
9666 * Exception indicating that the timeout expired.
9667 */
9668TimeoutError = module.exports.TimeoutError = function() {
9669 Error.call(this)
9670 this.stack = Error().stack
9671 this.message = 'Timeout';
9672};
9673
9674TimeoutError.prototype = Object.create(Error.prototype);
9675TimeoutError.prototype.name = "TimeoutError";
9676
9677
9678/***/ }),
9679/* 286 */
9680/***/ (function(module, exports, __webpack_require__) {
9681
9682"use strict";
9683
9684
9685var _ = __webpack_require__(0);
9686
9687module.exports = function (AV) {
9688 var eventSplitter = /\s+/;
9689 var slice = Array.prototype.slice;
9690
9691 /**
9692 * @class
9693 *
9694 * <p>AV.Events is a fork of Backbone's Events module, provided for your
9695 * convenience.</p>
9696 *
9697 * <p>A module that can be mixed in to any object in order to provide
9698 * it with custom events. You may bind callback functions to an event
9699 * with `on`, or remove these functions with `off`.
9700 * Triggering an event fires all callbacks in the order that `on` was
9701 * called.
9702 *
9703 * @private
9704 * @example
9705 * var object = {};
9706 * _.extend(object, AV.Events);
9707 * object.on('expand', function(){ alert('expanded'); });
9708 * object.trigger('expand');</pre></p>
9709 *
9710 */
9711 AV.Events = {
9712 /**
9713 * Bind one or more space separated events, `events`, to a `callback`
9714 * function. Passing `"all"` will bind the callback to all events fired.
9715 */
9716 on: function on(events, callback, context) {
9717 var calls, event, node, tail, list;
9718 if (!callback) {
9719 return this;
9720 }
9721 events = events.split(eventSplitter);
9722 calls = this._callbacks || (this._callbacks = {});
9723
9724 // Create an immutable callback list, allowing traversal during
9725 // modification. The tail is an empty object that will always be used
9726 // as the next node.
9727 event = events.shift();
9728 while (event) {
9729 list = calls[event];
9730 node = list ? list.tail : {};
9731 node.next = tail = {};
9732 node.context = context;
9733 node.callback = callback;
9734 calls[event] = { tail: tail, next: list ? list.next : node };
9735 event = events.shift();
9736 }
9737
9738 return this;
9739 },
9740
9741 /**
9742 * Remove one or many callbacks. If `context` is null, removes all callbacks
9743 * with that function. If `callback` is null, removes all callbacks for the
9744 * event. If `events` is null, removes all bound callbacks for all events.
9745 */
9746 off: function off(events, callback, context) {
9747 var event, calls, node, tail, cb, ctx;
9748
9749 // No events, or removing *all* events.
9750 if (!(calls = this._callbacks)) {
9751 return;
9752 }
9753 if (!(events || callback || context)) {
9754 delete this._callbacks;
9755 return this;
9756 }
9757
9758 // Loop through the listed events and contexts, splicing them out of the
9759 // linked list of callbacks if appropriate.
9760 events = events ? events.split(eventSplitter) : _.keys(calls);
9761 event = events.shift();
9762 while (event) {
9763 node = calls[event];
9764 delete calls[event];
9765 if (!node || !(callback || context)) {
9766 continue;
9767 }
9768 // Create a new list, omitting the indicated callbacks.
9769 tail = node.tail;
9770 node = node.next;
9771 while (node !== tail) {
9772 cb = node.callback;
9773 ctx = node.context;
9774 if (callback && cb !== callback || context && ctx !== context) {
9775 this.on(event, cb, ctx);
9776 }
9777 node = node.next;
9778 }
9779 event = events.shift();
9780 }
9781
9782 return this;
9783 },
9784
9785 /**
9786 * Trigger one or many events, firing all bound callbacks. Callbacks are
9787 * passed the same arguments as `trigger` is, apart from the event name
9788 * (unless you're listening on `"all"`, which will cause your callback to
9789 * receive the true name of the event as the first argument).
9790 */
9791 trigger: function trigger(events) {
9792 var event, node, calls, tail, args, all, rest;
9793 if (!(calls = this._callbacks)) {
9794 return this;
9795 }
9796 all = calls.all;
9797 events = events.split(eventSplitter);
9798 rest = slice.call(arguments, 1);
9799
9800 // For each event, walk through the linked list of callbacks twice,
9801 // first to trigger the event, then to trigger any `"all"` callbacks.
9802 event = events.shift();
9803 while (event) {
9804 node = calls[event];
9805 if (node) {
9806 tail = node.tail;
9807 while ((node = node.next) !== tail) {
9808 node.callback.apply(node.context || this, rest);
9809 }
9810 }
9811 node = all;
9812 if (node) {
9813 tail = node.tail;
9814 args = [event].concat(rest);
9815 while ((node = node.next) !== tail) {
9816 node.callback.apply(node.context || this, args);
9817 }
9818 }
9819 event = events.shift();
9820 }
9821
9822 return this;
9823 }
9824 };
9825
9826 /**
9827 * @function
9828 */
9829 AV.Events.bind = AV.Events.on;
9830
9831 /**
9832 * @function
9833 */
9834 AV.Events.unbind = AV.Events.off;
9835};
9836
9837/***/ }),
9838/* 287 */
9839/***/ (function(module, exports, __webpack_require__) {
9840
9841"use strict";
9842
9843
9844var _promise = __webpack_require__(4);
9845
9846var _promise2 = _interopRequireDefault(_promise);
9847
9848function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
9849
9850var _ = __webpack_require__(0);
9851
9852/*global navigator: false */
9853module.exports = function (AV) {
9854 /**
9855 * Creates a new GeoPoint with any of the following forms:<br>
9856 * @example
9857 * new GeoPoint(otherGeoPoint)
9858 * new GeoPoint(30, 30)
9859 * new GeoPoint([30, 30])
9860 * new GeoPoint({latitude: 30, longitude: 30})
9861 * new GeoPoint() // defaults to (0, 0)
9862 * @class
9863 *
9864 * <p>Represents a latitude / longitude point that may be associated
9865 * with a key in a AVObject or used as a reference point for geo queries.
9866 * This allows proximity-based queries on the key.</p>
9867 *
9868 * <p>Only one key in a class may contain a GeoPoint.</p>
9869 *
9870 * <p>Example:<pre>
9871 * var point = new AV.GeoPoint(30.0, -20.0);
9872 * var object = new AV.Object("PlaceObject");
9873 * object.set("location", point);
9874 * object.save();</pre></p>
9875 */
9876 AV.GeoPoint = function (arg1, arg2) {
9877 if (_.isArray(arg1)) {
9878 AV.GeoPoint._validate(arg1[0], arg1[1]);
9879 this.latitude = arg1[0];
9880 this.longitude = arg1[1];
9881 } else if (_.isObject(arg1)) {
9882 AV.GeoPoint._validate(arg1.latitude, arg1.longitude);
9883 this.latitude = arg1.latitude;
9884 this.longitude = arg1.longitude;
9885 } else if (_.isNumber(arg1) && _.isNumber(arg2)) {
9886 AV.GeoPoint._validate(arg1, arg2);
9887 this.latitude = arg1;
9888 this.longitude = arg2;
9889 } else {
9890 this.latitude = 0;
9891 this.longitude = 0;
9892 }
9893
9894 // Add properties so that anyone using Webkit or Mozilla will get an error
9895 // if they try to set values that are out of bounds.
9896 var self = this;
9897 if (this.__defineGetter__ && this.__defineSetter__) {
9898 // Use _latitude and _longitude to actually store the values, and add
9899 // getters and setters for latitude and longitude.
9900 this._latitude = this.latitude;
9901 this._longitude = this.longitude;
9902 this.__defineGetter__('latitude', function () {
9903 return self._latitude;
9904 });
9905 this.__defineGetter__('longitude', function () {
9906 return self._longitude;
9907 });
9908 this.__defineSetter__('latitude', function (val) {
9909 AV.GeoPoint._validate(val, self.longitude);
9910 self._latitude = val;
9911 });
9912 this.__defineSetter__('longitude', function (val) {
9913 AV.GeoPoint._validate(self.latitude, val);
9914 self._longitude = val;
9915 });
9916 }
9917 };
9918
9919 /**
9920 * @lends AV.GeoPoint.prototype
9921 * @property {float} latitude North-south portion of the coordinate, in range
9922 * [-90, 90]. Throws an exception if set out of range in a modern browser.
9923 * @property {float} longitude East-west portion of the coordinate, in range
9924 * [-180, 180]. Throws if set out of range in a modern browser.
9925 */
9926
9927 /**
9928 * Throws an exception if the given lat-long is out of bounds.
9929 * @private
9930 */
9931 AV.GeoPoint._validate = function (latitude, longitude) {
9932 if (latitude < -90.0) {
9933 throw new Error('AV.GeoPoint latitude ' + latitude + ' < -90.0.');
9934 }
9935 if (latitude > 90.0) {
9936 throw new Error('AV.GeoPoint latitude ' + latitude + ' > 90.0.');
9937 }
9938 if (longitude < -180.0) {
9939 throw new Error('AV.GeoPoint longitude ' + longitude + ' < -180.0.');
9940 }
9941 if (longitude > 180.0) {
9942 throw new Error('AV.GeoPoint longitude ' + longitude + ' > 180.0.');
9943 }
9944 };
9945
9946 /**
9947 * Creates a GeoPoint with the user's current location, if available.
9948 * @return {Promise.<AV.GeoPoint>}
9949 */
9950 AV.GeoPoint.current = function () {
9951 return new _promise2.default(function (resolve, reject) {
9952 navigator.geolocation.getCurrentPosition(function (location) {
9953 resolve(new AV.GeoPoint({
9954 latitude: location.coords.latitude,
9955 longitude: location.coords.longitude
9956 }));
9957 }, reject);
9958 });
9959 };
9960
9961 _.extend(AV.GeoPoint.prototype,
9962 /** @lends AV.GeoPoint.prototype */{
9963 /**
9964 * Returns a JSON representation of the GeoPoint, suitable for AV.
9965 * @return {Object}
9966 */
9967 toJSON: function toJSON() {
9968 AV.GeoPoint._validate(this.latitude, this.longitude);
9969 return {
9970 __type: 'GeoPoint',
9971 latitude: this.latitude,
9972 longitude: this.longitude
9973 };
9974 },
9975
9976 /**
9977 * Returns the distance from this GeoPoint to another in radians.
9978 * @param {AV.GeoPoint} point the other AV.GeoPoint.
9979 * @return {Number}
9980 */
9981 radiansTo: function radiansTo(point) {
9982 var d2r = Math.PI / 180.0;
9983 var lat1rad = this.latitude * d2r;
9984 var long1rad = this.longitude * d2r;
9985 var lat2rad = point.latitude * d2r;
9986 var long2rad = point.longitude * d2r;
9987 var deltaLat = lat1rad - lat2rad;
9988 var deltaLong = long1rad - long2rad;
9989 var sinDeltaLatDiv2 = Math.sin(deltaLat / 2);
9990 var sinDeltaLongDiv2 = Math.sin(deltaLong / 2);
9991 // Square of half the straight line chord distance between both points.
9992 var a = sinDeltaLatDiv2 * sinDeltaLatDiv2 + Math.cos(lat1rad) * Math.cos(lat2rad) * sinDeltaLongDiv2 * sinDeltaLongDiv2;
9993 a = Math.min(1.0, a);
9994 return 2 * Math.asin(Math.sqrt(a));
9995 },
9996
9997 /**
9998 * Returns the distance from this GeoPoint to another in kilometers.
9999 * @param {AV.GeoPoint} point the other AV.GeoPoint.
10000 * @return {Number}
10001 */
10002 kilometersTo: function kilometersTo(point) {
10003 return this.radiansTo(point) * 6371.0;
10004 },
10005
10006 /**
10007 * Returns the distance from this GeoPoint to another in miles.
10008 * @param {AV.GeoPoint} point the other AV.GeoPoint.
10009 * @return {Number}
10010 */
10011 milesTo: function milesTo(point) {
10012 return this.radiansTo(point) * 3958.8;
10013 }
10014 });
10015};
10016
10017/***/ }),
10018/* 288 */
10019/***/ (function(module, exports, __webpack_require__) {
10020
10021"use strict";
10022
10023
10024var _ = __webpack_require__(0);
10025
10026module.exports = function (AV) {
10027 var PUBLIC_KEY = '*';
10028
10029 /**
10030 * Creates a new ACL.
10031 * If no argument is given, the ACL has no permissions for anyone.
10032 * If the argument is a AV.User, the ACL will have read and write
10033 * permission for only that user.
10034 * If the argument is any other JSON object, that object will be interpretted
10035 * as a serialized ACL created with toJSON().
10036 * @see AV.Object#setACL
10037 * @class
10038 *
10039 * <p>An ACL, or Access Control List can be added to any
10040 * <code>AV.Object</code> to restrict access to only a subset of users
10041 * of your application.</p>
10042 */
10043 AV.ACL = function (arg1) {
10044 var self = this;
10045 self.permissionsById = {};
10046 if (_.isObject(arg1)) {
10047 if (arg1 instanceof AV.User) {
10048 self.setReadAccess(arg1, true);
10049 self.setWriteAccess(arg1, true);
10050 } else {
10051 if (_.isFunction(arg1)) {
10052 throw new Error('AV.ACL() called with a function. Did you forget ()?');
10053 }
10054 AV._objectEach(arg1, function (accessList, userId) {
10055 if (!_.isString(userId)) {
10056 throw new Error('Tried to create an ACL with an invalid userId.');
10057 }
10058 self.permissionsById[userId] = {};
10059 AV._objectEach(accessList, function (allowed, permission) {
10060 if (permission !== 'read' && permission !== 'write') {
10061 throw new Error('Tried to create an ACL with an invalid permission type.');
10062 }
10063 if (!_.isBoolean(allowed)) {
10064 throw new Error('Tried to create an ACL with an invalid permission value.');
10065 }
10066 self.permissionsById[userId][permission] = allowed;
10067 });
10068 });
10069 }
10070 }
10071 };
10072
10073 /**
10074 * Returns a JSON-encoded version of the ACL.
10075 * @return {Object}
10076 */
10077 AV.ACL.prototype.toJSON = function () {
10078 return _.clone(this.permissionsById);
10079 };
10080
10081 AV.ACL.prototype._setAccess = function (accessType, userId, allowed) {
10082 if (userId instanceof AV.User) {
10083 userId = userId.id;
10084 } else if (userId instanceof AV.Role) {
10085 userId = 'role:' + userId.getName();
10086 }
10087 if (!_.isString(userId)) {
10088 throw new Error('userId must be a string.');
10089 }
10090 if (!_.isBoolean(allowed)) {
10091 throw new Error('allowed must be either true or false.');
10092 }
10093 var permissions = this.permissionsById[userId];
10094 if (!permissions) {
10095 if (!allowed) {
10096 // The user already doesn't have this permission, so no action needed.
10097 return;
10098 } else {
10099 permissions = {};
10100 this.permissionsById[userId] = permissions;
10101 }
10102 }
10103
10104 if (allowed) {
10105 this.permissionsById[userId][accessType] = true;
10106 } else {
10107 delete permissions[accessType];
10108 if (_.isEmpty(permissions)) {
10109 delete this.permissionsById[userId];
10110 }
10111 }
10112 };
10113
10114 AV.ACL.prototype._getAccess = function (accessType, userId) {
10115 if (userId instanceof AV.User) {
10116 userId = userId.id;
10117 } else if (userId instanceof AV.Role) {
10118 userId = 'role:' + userId.getName();
10119 }
10120 var permissions = this.permissionsById[userId];
10121 if (!permissions) {
10122 return false;
10123 }
10124 return permissions[accessType] ? true : false;
10125 };
10126
10127 /**
10128 * Set whether the given user is allowed to read this object.
10129 * @param userId An instance of AV.User or its objectId.
10130 * @param {Boolean} allowed Whether that user should have read access.
10131 */
10132 AV.ACL.prototype.setReadAccess = function (userId, allowed) {
10133 this._setAccess('read', userId, allowed);
10134 };
10135
10136 /**
10137 * Get whether the given user id is *explicitly* allowed to read this object.
10138 * Even if this returns false, the user may still be able to access it if
10139 * getPublicReadAccess returns true or a role that the user belongs to has
10140 * write access.
10141 * @param userId An instance of AV.User or its objectId, or a AV.Role.
10142 * @return {Boolean}
10143 */
10144 AV.ACL.prototype.getReadAccess = function (userId) {
10145 return this._getAccess('read', userId);
10146 };
10147
10148 /**
10149 * Set whether the given user id is allowed to write this object.
10150 * @param userId An instance of AV.User or its objectId, or a AV.Role..
10151 * @param {Boolean} allowed Whether that user should have write access.
10152 */
10153 AV.ACL.prototype.setWriteAccess = function (userId, allowed) {
10154 this._setAccess('write', userId, allowed);
10155 };
10156
10157 /**
10158 * Get whether the given user id is *explicitly* allowed to write this object.
10159 * Even if this returns false, the user may still be able to write it if
10160 * getPublicWriteAccess returns true or a role that the user belongs to has
10161 * write access.
10162 * @param userId An instance of AV.User or its objectId, or a AV.Role.
10163 * @return {Boolean}
10164 */
10165 AV.ACL.prototype.getWriteAccess = function (userId) {
10166 return this._getAccess('write', userId);
10167 };
10168
10169 /**
10170 * Set whether the public is allowed to read this object.
10171 * @param {Boolean} allowed
10172 */
10173 AV.ACL.prototype.setPublicReadAccess = function (allowed) {
10174 this.setReadAccess(PUBLIC_KEY, allowed);
10175 };
10176
10177 /**
10178 * Get whether the public is allowed to read this object.
10179 * @return {Boolean}
10180 */
10181 AV.ACL.prototype.getPublicReadAccess = function () {
10182 return this.getReadAccess(PUBLIC_KEY);
10183 };
10184
10185 /**
10186 * Set whether the public is allowed to write this object.
10187 * @param {Boolean} allowed
10188 */
10189 AV.ACL.prototype.setPublicWriteAccess = function (allowed) {
10190 this.setWriteAccess(PUBLIC_KEY, allowed);
10191 };
10192
10193 /**
10194 * Get whether the public is allowed to write this object.
10195 * @return {Boolean}
10196 */
10197 AV.ACL.prototype.getPublicWriteAccess = function () {
10198 return this.getWriteAccess(PUBLIC_KEY);
10199 };
10200
10201 /**
10202 * Get whether users belonging to the given role are allowed
10203 * to read this object. Even if this returns false, the role may
10204 * still be able to write it if a parent role has read access.
10205 *
10206 * @param role The name of the role, or a AV.Role object.
10207 * @return {Boolean} true if the role has read access. false otherwise.
10208 * @throws {String} If role is neither a AV.Role nor a String.
10209 */
10210 AV.ACL.prototype.getRoleReadAccess = function (role) {
10211 if (role instanceof AV.Role) {
10212 // Normalize to the String name
10213 role = role.getName();
10214 }
10215 if (_.isString(role)) {
10216 return this.getReadAccess('role:' + role);
10217 }
10218 throw new Error('role must be a AV.Role or a String');
10219 };
10220
10221 /**
10222 * Get whether users belonging to the given role are allowed
10223 * to write this object. Even if this returns false, the role may
10224 * still be able to write it if a parent role has write access.
10225 *
10226 * @param role The name of the role, or a AV.Role object.
10227 * @return {Boolean} true if the role has write access. false otherwise.
10228 * @throws {String} If role is neither a AV.Role nor a String.
10229 */
10230 AV.ACL.prototype.getRoleWriteAccess = function (role) {
10231 if (role instanceof AV.Role) {
10232 // Normalize to the String name
10233 role = role.getName();
10234 }
10235 if (_.isString(role)) {
10236 return this.getWriteAccess('role:' + role);
10237 }
10238 throw new Error('role must be a AV.Role or a String');
10239 };
10240
10241 /**
10242 * Set whether users belonging to the given role are allowed
10243 * to read this object.
10244 *
10245 * @param role The name of the role, or a AV.Role object.
10246 * @param {Boolean} allowed Whether the given role can read this object.
10247 * @throws {String} If role is neither a AV.Role nor a String.
10248 */
10249 AV.ACL.prototype.setRoleReadAccess = function (role, allowed) {
10250 if (role instanceof AV.Role) {
10251 // Normalize to the String name
10252 role = role.getName();
10253 }
10254 if (_.isString(role)) {
10255 this.setReadAccess('role:' + role, allowed);
10256 return;
10257 }
10258 throw new Error('role must be a AV.Role or a String');
10259 };
10260
10261 /**
10262 * Set whether users belonging to the given role are allowed
10263 * to write this object.
10264 *
10265 * @param role The name of the role, or a AV.Role object.
10266 * @param {Boolean} allowed Whether the given role can write this object.
10267 * @throws {String} If role is neither a AV.Role nor a String.
10268 */
10269 AV.ACL.prototype.setRoleWriteAccess = function (role, allowed) {
10270 if (role instanceof AV.Role) {
10271 // Normalize to the String name
10272 role = role.getName();
10273 }
10274 if (_.isString(role)) {
10275 this.setWriteAccess('role:' + role, allowed);
10276 return;
10277 }
10278 throw new Error('role must be a AV.Role or a String');
10279 };
10280};
10281
10282/***/ }),
10283/* 289 */
10284/***/ (function(module, exports, __webpack_require__) {
10285
10286"use strict";
10287
10288
10289var _ = __webpack_require__(0);
10290
10291module.exports = function (AV) {
10292 /**
10293 * @private
10294 * @class
10295 * A AV.Op is an atomic operation that can be applied to a field in a
10296 * AV.Object. For example, calling <code>object.set("foo", "bar")</code>
10297 * is an example of a AV.Op.Set. Calling <code>object.unset("foo")</code>
10298 * is a AV.Op.Unset. These operations are stored in a AV.Object and
10299 * sent to the server as part of <code>object.save()</code> operations.
10300 * Instances of AV.Op should be immutable.
10301 *
10302 * You should not create subclasses of AV.Op or instantiate AV.Op
10303 * directly.
10304 */
10305 AV.Op = function () {
10306 this._initialize.apply(this, arguments);
10307 };
10308
10309 _.extend(AV.Op.prototype,
10310 /** @lends AV.Op.prototype */{
10311 _initialize: function _initialize() {}
10312 });
10313
10314 _.extend(AV.Op, {
10315 /**
10316 * To create a new Op, call AV.Op._extend();
10317 * @private
10318 */
10319 _extend: AV._extend,
10320
10321 // A map of __op string to decoder function.
10322 _opDecoderMap: {},
10323
10324 /**
10325 * Registers a function to convert a json object with an __op field into an
10326 * instance of a subclass of AV.Op.
10327 * @private
10328 */
10329 _registerDecoder: function _registerDecoder(opName, decoder) {
10330 AV.Op._opDecoderMap[opName] = decoder;
10331 },
10332
10333 /**
10334 * Converts a json object into an instance of a subclass of AV.Op.
10335 * @private
10336 */
10337 _decode: function _decode(json) {
10338 var decoder = AV.Op._opDecoderMap[json.__op];
10339 if (decoder) {
10340 return decoder(json);
10341 } else {
10342 return undefined;
10343 }
10344 }
10345 });
10346
10347 /*
10348 * Add a handler for Batch ops.
10349 */
10350 AV.Op._registerDecoder('Batch', function (json) {
10351 var op = null;
10352 AV._arrayEach(json.ops, function (nextOp) {
10353 nextOp = AV.Op._decode(nextOp);
10354 op = nextOp._mergeWithPrevious(op);
10355 });
10356 return op;
10357 });
10358
10359 /**
10360 * @private
10361 * @class
10362 * A Set operation indicates that either the field was changed using
10363 * AV.Object.set, or it is a mutable container that was detected as being
10364 * changed.
10365 */
10366 AV.Op.Set = AV.Op._extend(
10367 /** @lends AV.Op.Set.prototype */{
10368 _initialize: function _initialize(value) {
10369 this._value = value;
10370 },
10371
10372 /**
10373 * Returns the new value of this field after the set.
10374 */
10375 value: function value() {
10376 return this._value;
10377 },
10378
10379 /**
10380 * Returns a JSON version of the operation suitable for sending to AV.
10381 * @return {Object}
10382 */
10383 toJSON: function toJSON() {
10384 return AV._encode(this.value());
10385 },
10386
10387 _mergeWithPrevious: function _mergeWithPrevious(previous) {
10388 return this;
10389 },
10390
10391 _estimate: function _estimate(oldValue) {
10392 return this.value();
10393 }
10394 });
10395
10396 /**
10397 * A sentinel value that is returned by AV.Op.Unset._estimate to
10398 * indicate the field should be deleted. Basically, if you find _UNSET as a
10399 * value in your object, you should remove that key.
10400 */
10401 AV.Op._UNSET = {};
10402
10403 /**
10404 * @private
10405 * @class
10406 * An Unset operation indicates that this field has been deleted from the
10407 * object.
10408 */
10409 AV.Op.Unset = AV.Op._extend(
10410 /** @lends AV.Op.Unset.prototype */{
10411 /**
10412 * Returns a JSON version of the operation suitable for sending to AV.
10413 * @return {Object}
10414 */
10415 toJSON: function toJSON() {
10416 return { __op: 'Delete' };
10417 },
10418
10419 _mergeWithPrevious: function _mergeWithPrevious(previous) {
10420 return this;
10421 },
10422
10423 _estimate: function _estimate(oldValue) {
10424 return AV.Op._UNSET;
10425 }
10426 });
10427
10428 AV.Op._registerDecoder('Delete', function (json) {
10429 return new AV.Op.Unset();
10430 });
10431
10432 /**
10433 * @private
10434 * @class
10435 * An Increment is an atomic operation where the numeric value for the field
10436 * will be increased by a given amount.
10437 */
10438 AV.Op.Increment = AV.Op._extend(
10439 /** @lends AV.Op.Increment.prototype */{
10440 _initialize: function _initialize(amount) {
10441 this._amount = amount;
10442 },
10443
10444 /**
10445 * Returns the amount to increment by.
10446 * @return {Number} the amount to increment by.
10447 */
10448 amount: function amount() {
10449 return this._amount;
10450 },
10451
10452 /**
10453 * Returns a JSON version of the operation suitable for sending to AV.
10454 * @return {Object}
10455 */
10456 toJSON: function toJSON() {
10457 return { __op: 'Increment', amount: this._amount };
10458 },
10459
10460 _mergeWithPrevious: function _mergeWithPrevious(previous) {
10461 if (!previous) {
10462 return this;
10463 } else if (previous instanceof AV.Op.Unset) {
10464 return new AV.Op.Set(this.amount());
10465 } else if (previous instanceof AV.Op.Set) {
10466 return new AV.Op.Set(previous.value() + this.amount());
10467 } else if (previous instanceof AV.Op.Increment) {
10468 return new AV.Op.Increment(this.amount() + previous.amount());
10469 } else {
10470 throw new Error('Op is invalid after previous op.');
10471 }
10472 },
10473
10474 _estimate: function _estimate(oldValue) {
10475 if (!oldValue) {
10476 return this.amount();
10477 }
10478 return oldValue + this.amount();
10479 }
10480 });
10481
10482 AV.Op._registerDecoder('Increment', function (json) {
10483 return new AV.Op.Increment(json.amount);
10484 });
10485
10486 /**
10487 * @private
10488 * @class
10489 * BitAnd is an atomic operation where the given value will be bit and to the
10490 * value than is stored in this field.
10491 */
10492 AV.Op.BitAnd = AV.Op._extend(
10493 /** @lends AV.Op.BitAnd.prototype */{
10494 _initialize: function _initialize(value) {
10495 this._value = value;
10496 },
10497 value: function value() {
10498 return this._value;
10499 },
10500
10501
10502 /**
10503 * Returns a JSON version of the operation suitable for sending to AV.
10504 * @return {Object}
10505 */
10506 toJSON: function toJSON() {
10507 return { __op: 'BitAnd', value: this.value() };
10508 },
10509 _mergeWithPrevious: function _mergeWithPrevious(previous) {
10510 if (!previous) {
10511 return this;
10512 } else if (previous instanceof AV.Op.Unset) {
10513 return new AV.Op.Set(0);
10514 } else if (previous instanceof AV.Op.Set) {
10515 return new AV.Op.Set(previous.value() & this.value());
10516 } else {
10517 throw new Error('Op is invalid after previous op.');
10518 }
10519 },
10520 _estimate: function _estimate(oldValue) {
10521 return oldValue & this.value();
10522 }
10523 });
10524
10525 AV.Op._registerDecoder('BitAnd', function (json) {
10526 return new AV.Op.BitAnd(json.value);
10527 });
10528
10529 /**
10530 * @private
10531 * @class
10532 * BitOr is an atomic operation where the given value will be bit and to the
10533 * value than is stored in this field.
10534 */
10535 AV.Op.BitOr = AV.Op._extend(
10536 /** @lends AV.Op.BitOr.prototype */{
10537 _initialize: function _initialize(value) {
10538 this._value = value;
10539 },
10540 value: function value() {
10541 return this._value;
10542 },
10543
10544
10545 /**
10546 * Returns a JSON version of the operation suitable for sending to AV.
10547 * @return {Object}
10548 */
10549 toJSON: function toJSON() {
10550 return { __op: 'BitOr', value: this.value() };
10551 },
10552 _mergeWithPrevious: function _mergeWithPrevious(previous) {
10553 if (!previous) {
10554 return this;
10555 } else if (previous instanceof AV.Op.Unset) {
10556 return new AV.Op.Set(this.value());
10557 } else if (previous instanceof AV.Op.Set) {
10558 return new AV.Op.Set(previous.value() | this.value());
10559 } else {
10560 throw new Error('Op is invalid after previous op.');
10561 }
10562 },
10563 _estimate: function _estimate(oldValue) {
10564 return oldValue | this.value();
10565 }
10566 });
10567
10568 AV.Op._registerDecoder('BitOr', function (json) {
10569 return new AV.Op.BitOr(json.value);
10570 });
10571
10572 /**
10573 * @private
10574 * @class
10575 * BitXor is an atomic operation where the given value will be bit and to the
10576 * value than is stored in this field.
10577 */
10578 AV.Op.BitXor = AV.Op._extend(
10579 /** @lends AV.Op.BitXor.prototype */{
10580 _initialize: function _initialize(value) {
10581 this._value = value;
10582 },
10583 value: function value() {
10584 return this._value;
10585 },
10586
10587
10588 /**
10589 * Returns a JSON version of the operation suitable for sending to AV.
10590 * @return {Object}
10591 */
10592 toJSON: function toJSON() {
10593 return { __op: 'BitXor', value: this.value() };
10594 },
10595 _mergeWithPrevious: function _mergeWithPrevious(previous) {
10596 if (!previous) {
10597 return this;
10598 } else if (previous instanceof AV.Op.Unset) {
10599 return new AV.Op.Set(this.value());
10600 } else if (previous instanceof AV.Op.Set) {
10601 return new AV.Op.Set(previous.value() ^ this.value());
10602 } else {
10603 throw new Error('Op is invalid after previous op.');
10604 }
10605 },
10606 _estimate: function _estimate(oldValue) {
10607 return oldValue ^ this.value();
10608 }
10609 });
10610
10611 AV.Op._registerDecoder('BitXor', function (json) {
10612 return new AV.Op.BitXor(json.value);
10613 });
10614
10615 /**
10616 * @private
10617 * @class
10618 * Add is an atomic operation where the given objects will be appended to the
10619 * array that is stored in this field.
10620 */
10621 AV.Op.Add = AV.Op._extend(
10622 /** @lends AV.Op.Add.prototype */{
10623 _initialize: function _initialize(objects) {
10624 this._objects = objects;
10625 },
10626
10627 /**
10628 * Returns the objects to be added to the array.
10629 * @return {Array} The objects to be added to the array.
10630 */
10631 objects: function objects() {
10632 return this._objects;
10633 },
10634
10635 /**
10636 * Returns a JSON version of the operation suitable for sending to AV.
10637 * @return {Object}
10638 */
10639 toJSON: function toJSON() {
10640 return { __op: 'Add', objects: AV._encode(this.objects()) };
10641 },
10642
10643 _mergeWithPrevious: function _mergeWithPrevious(previous) {
10644 if (!previous) {
10645 return this;
10646 } else if (previous instanceof AV.Op.Unset) {
10647 return new AV.Op.Set(this.objects());
10648 } else if (previous instanceof AV.Op.Set) {
10649 return new AV.Op.Set(this._estimate(previous.value()));
10650 } else if (previous instanceof AV.Op.Add) {
10651 return new AV.Op.Add(previous.objects().concat(this.objects()));
10652 } else {
10653 throw new Error('Op is invalid after previous op.');
10654 }
10655 },
10656
10657 _estimate: function _estimate(oldValue) {
10658 if (!oldValue) {
10659 return _.clone(this.objects());
10660 } else {
10661 return oldValue.concat(this.objects());
10662 }
10663 }
10664 });
10665
10666 AV.Op._registerDecoder('Add', function (json) {
10667 return new AV.Op.Add(AV._decode(json.objects));
10668 });
10669
10670 /**
10671 * @private
10672 * @class
10673 * AddUnique is an atomic operation where the given items will be appended to
10674 * the array that is stored in this field only if they were not already
10675 * present in the array.
10676 */
10677 AV.Op.AddUnique = AV.Op._extend(
10678 /** @lends AV.Op.AddUnique.prototype */{
10679 _initialize: function _initialize(objects) {
10680 this._objects = _.uniq(objects);
10681 },
10682
10683 /**
10684 * Returns the objects to be added to the array.
10685 * @return {Array} The objects to be added to the array.
10686 */
10687 objects: function objects() {
10688 return this._objects;
10689 },
10690
10691 /**
10692 * Returns a JSON version of the operation suitable for sending to AV.
10693 * @return {Object}
10694 */
10695 toJSON: function toJSON() {
10696 return { __op: 'AddUnique', objects: AV._encode(this.objects()) };
10697 },
10698
10699 _mergeWithPrevious: function _mergeWithPrevious(previous) {
10700 if (!previous) {
10701 return this;
10702 } else if (previous instanceof AV.Op.Unset) {
10703 return new AV.Op.Set(this.objects());
10704 } else if (previous instanceof AV.Op.Set) {
10705 return new AV.Op.Set(this._estimate(previous.value()));
10706 } else if (previous instanceof AV.Op.AddUnique) {
10707 return new AV.Op.AddUnique(this._estimate(previous.objects()));
10708 } else {
10709 throw new Error('Op is invalid after previous op.');
10710 }
10711 },
10712
10713 _estimate: function _estimate(oldValue) {
10714 if (!oldValue) {
10715 return _.clone(this.objects());
10716 } else {
10717 // We can't just take the _.uniq(_.union(...)) of oldValue and
10718 // this.objects, because the uniqueness may not apply to oldValue
10719 // (especially if the oldValue was set via .set())
10720 var newValue = _.clone(oldValue);
10721 AV._arrayEach(this.objects(), function (obj) {
10722 if (obj instanceof AV.Object && obj.id) {
10723 var matchingObj = _.find(newValue, function (anObj) {
10724 return anObj instanceof AV.Object && anObj.id === obj.id;
10725 });
10726 if (!matchingObj) {
10727 newValue.push(obj);
10728 } else {
10729 var index = _.indexOf(newValue, matchingObj);
10730 newValue[index] = obj;
10731 }
10732 } else if (!_.contains(newValue, obj)) {
10733 newValue.push(obj);
10734 }
10735 });
10736 return newValue;
10737 }
10738 }
10739 });
10740
10741 AV.Op._registerDecoder('AddUnique', function (json) {
10742 return new AV.Op.AddUnique(AV._decode(json.objects));
10743 });
10744
10745 /**
10746 * @private
10747 * @class
10748 * Remove is an atomic operation where the given objects will be removed from
10749 * the array that is stored in this field.
10750 */
10751 AV.Op.Remove = AV.Op._extend(
10752 /** @lends AV.Op.Remove.prototype */{
10753 _initialize: function _initialize(objects) {
10754 this._objects = _.uniq(objects);
10755 },
10756
10757 /**
10758 * Returns the objects to be removed from the array.
10759 * @return {Array} The objects to be removed from the array.
10760 */
10761 objects: function objects() {
10762 return this._objects;
10763 },
10764
10765 /**
10766 * Returns a JSON version of the operation suitable for sending to AV.
10767 * @return {Object}
10768 */
10769 toJSON: function toJSON() {
10770 return { __op: 'Remove', objects: AV._encode(this.objects()) };
10771 },
10772
10773 _mergeWithPrevious: function _mergeWithPrevious(previous) {
10774 if (!previous) {
10775 return this;
10776 } else if (previous instanceof AV.Op.Unset) {
10777 return previous;
10778 } else if (previous instanceof AV.Op.Set) {
10779 return new AV.Op.Set(this._estimate(previous.value()));
10780 } else if (previous instanceof AV.Op.Remove) {
10781 return new AV.Op.Remove(_.union(previous.objects(), this.objects()));
10782 } else {
10783 throw new Error('Op is invalid after previous op.');
10784 }
10785 },
10786
10787 _estimate: function _estimate(oldValue) {
10788 if (!oldValue) {
10789 return [];
10790 } else {
10791 var newValue = _.difference(oldValue, this.objects());
10792 // If there are saved AV Objects being removed, also remove them.
10793 AV._arrayEach(this.objects(), function (obj) {
10794 if (obj instanceof AV.Object && obj.id) {
10795 newValue = _.reject(newValue, function (other) {
10796 return other instanceof AV.Object && other.id === obj.id;
10797 });
10798 }
10799 });
10800 return newValue;
10801 }
10802 }
10803 });
10804
10805 AV.Op._registerDecoder('Remove', function (json) {
10806 return new AV.Op.Remove(AV._decode(json.objects));
10807 });
10808
10809 /**
10810 * @private
10811 * @class
10812 * A Relation operation indicates that the field is an instance of
10813 * AV.Relation, and objects are being added to, or removed from, that
10814 * relation.
10815 */
10816 AV.Op.Relation = AV.Op._extend(
10817 /** @lends AV.Op.Relation.prototype */{
10818 _initialize: function _initialize(adds, removes) {
10819 this._targetClassName = null;
10820
10821 var self = this;
10822
10823 var pointerToId = function pointerToId(object) {
10824 if (object instanceof AV.Object) {
10825 if (!object.id) {
10826 throw new Error("You can't add an unsaved AV.Object to a relation.");
10827 }
10828 if (!self._targetClassName) {
10829 self._targetClassName = object.className;
10830 }
10831 if (self._targetClassName !== object.className) {
10832 throw new Error('Tried to create a AV.Relation with 2 different types: ' + self._targetClassName + ' and ' + object.className + '.');
10833 }
10834 return object.id;
10835 }
10836 return object;
10837 };
10838
10839 this.relationsToAdd = _.uniq(_.map(adds, pointerToId));
10840 this.relationsToRemove = _.uniq(_.map(removes, pointerToId));
10841 },
10842
10843 /**
10844 * Returns an array of unfetched AV.Object that are being added to the
10845 * relation.
10846 * @return {Array}
10847 */
10848 added: function added() {
10849 var self = this;
10850 return _.map(this.relationsToAdd, function (objectId) {
10851 var object = AV.Object._create(self._targetClassName);
10852 object.id = objectId;
10853 return object;
10854 });
10855 },
10856
10857 /**
10858 * Returns an array of unfetched AV.Object that are being removed from
10859 * the relation.
10860 * @return {Array}
10861 */
10862 removed: function removed() {
10863 var self = this;
10864 return _.map(this.relationsToRemove, function (objectId) {
10865 var object = AV.Object._create(self._targetClassName);
10866 object.id = objectId;
10867 return object;
10868 });
10869 },
10870
10871 /**
10872 * Returns a JSON version of the operation suitable for sending to AV.
10873 * @return {Object}
10874 */
10875 toJSON: function toJSON() {
10876 var adds = null;
10877 var removes = null;
10878 var self = this;
10879 var idToPointer = function idToPointer(id) {
10880 return {
10881 __type: 'Pointer',
10882 className: self._targetClassName,
10883 objectId: id
10884 };
10885 };
10886 var pointers = null;
10887 if (this.relationsToAdd.length > 0) {
10888 pointers = _.map(this.relationsToAdd, idToPointer);
10889 adds = { __op: 'AddRelation', objects: pointers };
10890 }
10891
10892 if (this.relationsToRemove.length > 0) {
10893 pointers = _.map(this.relationsToRemove, idToPointer);
10894 removes = { __op: 'RemoveRelation', objects: pointers };
10895 }
10896
10897 if (adds && removes) {
10898 return { __op: 'Batch', ops: [adds, removes] };
10899 }
10900
10901 return adds || removes || {};
10902 },
10903
10904 _mergeWithPrevious: function _mergeWithPrevious(previous) {
10905 if (!previous) {
10906 return this;
10907 } else if (previous instanceof AV.Op.Unset) {
10908 throw new Error("You can't modify a relation after deleting it.");
10909 } else if (previous instanceof AV.Op.Relation) {
10910 if (previous._targetClassName && previous._targetClassName !== this._targetClassName) {
10911 throw new Error('Related object must be of class ' + previous._targetClassName + ', but ' + this._targetClassName + ' was passed in.');
10912 }
10913 var newAdd = _.union(_.difference(previous.relationsToAdd, this.relationsToRemove), this.relationsToAdd);
10914 var newRemove = _.union(_.difference(previous.relationsToRemove, this.relationsToAdd), this.relationsToRemove);
10915
10916 var newRelation = new AV.Op.Relation(newAdd, newRemove);
10917 newRelation._targetClassName = this._targetClassName;
10918 return newRelation;
10919 } else {
10920 throw new Error('Op is invalid after previous op.');
10921 }
10922 },
10923
10924 _estimate: function _estimate(oldValue, object, key) {
10925 if (!oldValue) {
10926 var relation = new AV.Relation(object, key);
10927 relation.targetClassName = this._targetClassName;
10928 } else if (oldValue instanceof AV.Relation) {
10929 if (this._targetClassName) {
10930 if (oldValue.targetClassName) {
10931 if (oldValue.targetClassName !== this._targetClassName) {
10932 throw new Error('Related object must be a ' + oldValue.targetClassName + ', but a ' + this._targetClassName + ' was passed in.');
10933 }
10934 } else {
10935 oldValue.targetClassName = this._targetClassName;
10936 }
10937 }
10938 return oldValue;
10939 } else {
10940 throw new Error('Op is invalid after previous op.');
10941 }
10942 }
10943 });
10944
10945 AV.Op._registerDecoder('AddRelation', function (json) {
10946 return new AV.Op.Relation(AV._decode(json.objects), []);
10947 });
10948 AV.Op._registerDecoder('RemoveRelation', function (json) {
10949 return new AV.Op.Relation([], AV._decode(json.objects));
10950 });
10951};
10952
10953/***/ }),
10954/* 290 */
10955/***/ (function(module, exports, __webpack_require__) {
10956
10957"use strict";
10958
10959
10960var _ = __webpack_require__(0);
10961
10962module.exports = function (AV) {
10963 /**
10964 * Creates a new Relation for the given parent object and key. This
10965 * constructor should rarely be used directly, but rather created by
10966 * {@link AV.Object#relation}.
10967 * @param {AV.Object} parent The parent of this relation.
10968 * @param {String} key The key for this relation on the parent.
10969 * @see AV.Object#relation
10970 * @class
10971 *
10972 * <p>
10973 * A class that is used to access all of the children of a many-to-many
10974 * relationship. Each instance of AV.Relation is associated with a
10975 * particular parent object and key.
10976 * </p>
10977 */
10978 AV.Relation = function (parent, key) {
10979 if (!_.isString(key)) {
10980 throw new TypeError('key must be a string');
10981 }
10982 this.parent = parent;
10983 this.key = key;
10984 this.targetClassName = null;
10985 };
10986
10987 /**
10988 * Creates a query that can be used to query the parent objects in this relation.
10989 * @param {String} parentClass The parent class or name.
10990 * @param {String} relationKey The relation field key in parent.
10991 * @param {AV.Object} child The child object.
10992 * @return {AV.Query}
10993 */
10994 AV.Relation.reverseQuery = function (parentClass, relationKey, child) {
10995 var query = new AV.Query(parentClass);
10996 query.equalTo(relationKey, child._toPointer());
10997 return query;
10998 };
10999
11000 _.extend(AV.Relation.prototype,
11001 /** @lends AV.Relation.prototype */{
11002 /**
11003 * Makes sure that this relation has the right parent and key.
11004 * @private
11005 */
11006 _ensureParentAndKey: function _ensureParentAndKey(parent, key) {
11007 this.parent = this.parent || parent;
11008 this.key = this.key || key;
11009 if (this.parent !== parent) {
11010 throw new Error('Internal Error. Relation retrieved from two different Objects.');
11011 }
11012 if (this.key !== key) {
11013 throw new Error('Internal Error. Relation retrieved from two different keys.');
11014 }
11015 },
11016
11017 /**
11018 * Adds a AV.Object or an array of AV.Objects to the relation.
11019 * @param {AV.Object|AV.Object[]} objects The item or items to add.
11020 */
11021 add: function add(objects) {
11022 if (!_.isArray(objects)) {
11023 objects = [objects];
11024 }
11025
11026 var change = new AV.Op.Relation(objects, []);
11027 this.parent.set(this.key, change);
11028 this.targetClassName = change._targetClassName;
11029 },
11030
11031 /**
11032 * Removes a AV.Object or an array of AV.Objects from this relation.
11033 * @param {AV.Object|AV.Object[]} objects The item or items to remove.
11034 */
11035 remove: function remove(objects) {
11036 if (!_.isArray(objects)) {
11037 objects = [objects];
11038 }
11039
11040 var change = new AV.Op.Relation([], objects);
11041 this.parent.set(this.key, change);
11042 this.targetClassName = change._targetClassName;
11043 },
11044
11045 /**
11046 * Returns a JSON version of the object suitable for saving to disk.
11047 * @return {Object}
11048 */
11049 toJSON: function toJSON() {
11050 return { __type: 'Relation', className: this.targetClassName };
11051 },
11052
11053 /**
11054 * Returns a AV.Query that is limited to objects in this
11055 * relation.
11056 * @return {AV.Query}
11057 */
11058 query: function query() {
11059 var targetClass;
11060 var query;
11061 if (!this.targetClassName) {
11062 targetClass = AV.Object._getSubclass(this.parent.className);
11063 query = new AV.Query(targetClass);
11064 query._defaultParams.redirectClassNameForKey = this.key;
11065 } else {
11066 targetClass = AV.Object._getSubclass(this.targetClassName);
11067 query = new AV.Query(targetClass);
11068 }
11069 query._addCondition('$relatedTo', 'object', this.parent._toPointer());
11070 query._addCondition('$relatedTo', 'key', this.key);
11071
11072 return query;
11073 }
11074 });
11075};
11076
11077/***/ }),
11078/* 291 */
11079/***/ (function(module, exports, __webpack_require__) {
11080
11081"use strict";
11082
11083
11084var _promise = __webpack_require__(4);
11085
11086var _promise2 = _interopRequireDefault(_promise);
11087
11088function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11089
11090var _ = __webpack_require__(0);
11091var cos = __webpack_require__(292);
11092var qiniu = __webpack_require__(293);
11093var s3 = __webpack_require__(308);
11094var AVError = __webpack_require__(29);
11095var AVRequest = __webpack_require__(12)._request;
11096
11097var _require = __webpack_require__(15),
11098 tap = _require.tap,
11099 transformFetchOptions = _require.transformFetchOptions;
11100
11101var debug = __webpack_require__(35)('leancloud:file');
11102var parseBase64 = __webpack_require__(312);
11103
11104module.exports = function (AV) {
11105 // port from browserify path module
11106 // since react-native packager won't shim node modules.
11107 var extname = function extname(path) {
11108 if (!_.isString(path)) return '';
11109 return path.match(/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/)[4];
11110 };
11111
11112 var b64Digit = function b64Digit(number) {
11113 if (number < 26) {
11114 return String.fromCharCode(65 + number);
11115 }
11116 if (number < 52) {
11117 return String.fromCharCode(97 + (number - 26));
11118 }
11119 if (number < 62) {
11120 return String.fromCharCode(48 + (number - 52));
11121 }
11122 if (number === 62) {
11123 return '+';
11124 }
11125 if (number === 63) {
11126 return '/';
11127 }
11128 throw new Error('Tried to encode large digit ' + number + ' in base64.');
11129 };
11130
11131 var encodeBase64 = function encodeBase64(array) {
11132 var chunks = [];
11133 chunks.length = Math.ceil(array.length / 3);
11134 _.times(chunks.length, function (i) {
11135 var b1 = array[i * 3];
11136 var b2 = array[i * 3 + 1] || 0;
11137 var b3 = array[i * 3 + 2] || 0;
11138
11139 var has2 = i * 3 + 1 < array.length;
11140 var has3 = i * 3 + 2 < array.length;
11141
11142 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('');
11143 });
11144 return chunks.join('');
11145 };
11146
11147 /**
11148 * An AV.File is a local representation of a file that is saved to the AV
11149 * cloud.
11150 * @param name {String} The file's name. This will change to a unique value
11151 * once the file has finished saving.
11152 * @param data {Array} The data for the file, as either:
11153 * 1. an Array of byte value Numbers, or
11154 * 2. an Object like { base64: "..." } with a base64-encoded String.
11155 * 3. a Blob(File) selected with a file upload control in a browser.
11156 * 4. an Object like { blob: {uri: "..."} } that mimics Blob
11157 * in some non-browser environments such as React Native.
11158 * 5. a Buffer in Node.js runtime.
11159 * 6. a Stream in Node.js runtime.
11160 *
11161 * For example:<pre>
11162 * var fileUploadControl = $("#profilePhotoFileUpload")[0];
11163 * if (fileUploadControl.files.length > 0) {
11164 * var file = fileUploadControl.files[0];
11165 * var name = "photo.jpg";
11166 * var file = new AV.File(name, file);
11167 * file.save().then(function() {
11168 * // The file has been saved to AV.
11169 * }, function(error) {
11170 * // The file either could not be read, or could not be saved to AV.
11171 * });
11172 * }</pre>
11173 *
11174 * @class
11175 * @param [mimeType] {String} Content-Type header to use for the file. If
11176 * this is omitted, the content type will be inferred from the name's
11177 * extension.
11178 */
11179 AV.File = function (name, data, mimeType) {
11180 this.attributes = {
11181 name: name,
11182 url: '',
11183 metaData: {},
11184 // 用来存储转换后要上传的 base64 String
11185 base64: ''
11186 };
11187
11188 if (_.isString(data)) {
11189 throw new TypeError('Creating an AV.File from a String is not yet supported.');
11190 }
11191 if (_.isArray(data)) {
11192 this.attributes.metaData.size = data.length;
11193 data = { base64: encodeBase64(data) };
11194 }
11195
11196 this._extName = '';
11197 this._data = data;
11198 this._uploadHeaders = {};
11199
11200 if (data && data.blob && typeof data.blob.uri === 'string') {
11201 this._extName = extname(data.blob.uri);
11202 }
11203
11204 if (typeof Blob !== 'undefined' && data instanceof Blob) {
11205 if (data.size) {
11206 this.attributes.metaData.size = data.size;
11207 }
11208 if (data.name) {
11209 this._extName = extname(data.name);
11210 }
11211 }
11212
11213 var owner = void 0;
11214 if (data && data.owner) {
11215 owner = data.owner;
11216 } else if (!AV._config.disableCurrentUser) {
11217 try {
11218 owner = AV.User.current();
11219 } catch (error) {
11220 if ('SYNC_API_NOT_AVAILABLE' !== error.code) {
11221 throw error;
11222 }
11223 }
11224 }
11225
11226 this.attributes.metaData.owner = owner ? owner.id : 'unknown';
11227
11228 this.set('mime_type', mimeType);
11229 };
11230
11231 /**
11232 * Creates a fresh AV.File object with exists url for saving to AVOS Cloud.
11233 * @param {String} name the file name
11234 * @param {String} url the file url.
11235 * @param {Object} [metaData] the file metadata object.
11236 * @param {String} [type] Content-Type header to use for the file. If
11237 * this is omitted, the content type will be inferred from the name's
11238 * extension.
11239 * @return {AV.File} the file object
11240 */
11241 AV.File.withURL = function (name, url, metaData, type) {
11242 if (!name || !url) {
11243 throw new Error('Please provide file name and url');
11244 }
11245 var file = new AV.File(name, null, type);
11246 //copy metaData properties to file.
11247 if (metaData) {
11248 for (var prop in metaData) {
11249 if (!file.attributes.metaData[prop]) file.attributes.metaData[prop] = metaData[prop];
11250 }
11251 }
11252 file.attributes.url = url;
11253 //Mark the file is from external source.
11254 file.attributes.metaData.__source = 'external';
11255 file.attributes.metaData.size = 0;
11256 return file;
11257 };
11258
11259 /**
11260 * Creates a file object with exists objectId.
11261 * @param {String} objectId The objectId string
11262 * @return {AV.File} the file object
11263 */
11264 AV.File.createWithoutData = function (objectId) {
11265 if (!objectId) {
11266 throw new TypeError('The objectId must be provided');
11267 }
11268 var file = new AV.File();
11269 file.id = objectId;
11270 return file;
11271 };
11272
11273 _.extend(AV.File.prototype,
11274 /** @lends AV.File.prototype */{
11275 className: '_File',
11276
11277 _toFullJSON: function _toFullJSON(seenObjects) {
11278 var _this = this;
11279
11280 var full = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
11281
11282 var json = _.clone(this.attributes);
11283 AV._objectEach(json, function (val, key) {
11284 json[key] = AV._encode(val, seenObjects, undefined, full);
11285 });
11286 AV._objectEach(this._operations, function (val, key) {
11287 json[key] = val;
11288 });
11289
11290 if (_.has(this, 'id')) {
11291 json.objectId = this.id;
11292 }
11293 ['createdAt', 'updatedAt'].forEach(function (key) {
11294 if (_.has(_this, key)) {
11295 var val = _this[key];
11296 json[key] = _.isDate(val) ? val.toJSON() : val;
11297 }
11298 });
11299 if (full) {
11300 json.__type = 'File';
11301 }
11302 return json;
11303 },
11304
11305
11306 /**
11307 * Returns a JSON version of the file with meta data.
11308 * Inverse to {@link AV.parseJSON}
11309 * @since 3.0.0
11310 * @return {Object}
11311 */
11312 toFullJSON: function toFullJSON() {
11313 var seenObjects = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
11314
11315 return this._toFullJSON(seenObjects);
11316 },
11317
11318
11319 /**
11320 * Returns a JSON version of the object.
11321 * @return {Object}
11322 */
11323 toJSON: function toJSON(key, holder) {
11324 var seenObjects = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [this];
11325
11326 return this._toFullJSON(seenObjects, false);
11327 },
11328
11329
11330 /**
11331 * Gets a Pointer referencing this file.
11332 * @private
11333 */
11334 _toPointer: function _toPointer() {
11335 return {
11336 __type: 'Pointer',
11337 className: this.className,
11338 objectId: this.id
11339 };
11340 },
11341
11342
11343 /**
11344 * Returns the ACL for this file.
11345 * @returns {AV.ACL} An instance of AV.ACL.
11346 */
11347 getACL: function getACL() {
11348 return this._acl;
11349 },
11350
11351
11352 /**
11353 * Sets the ACL to be used for this file.
11354 * @param {AV.ACL} acl An instance of AV.ACL.
11355 */
11356 setACL: function setACL(acl) {
11357 if (!(acl instanceof AV.ACL)) {
11358 return new AVError(AVError.OTHER_CAUSE, 'ACL must be a AV.ACL.');
11359 }
11360 this._acl = acl;
11361 return this;
11362 },
11363
11364
11365 /**
11366 * Gets the name of the file. Before save is called, this is the filename
11367 * given by the user. After save is called, that name gets prefixed with a
11368 * unique identifier.
11369 */
11370 name: function name() {
11371 return this.get('name');
11372 },
11373
11374
11375 /**
11376 * Gets the url of the file. It is only available after you save the file or
11377 * after you get the file from a AV.Object.
11378 * @return {String}
11379 */
11380 url: function url() {
11381 return this.get('url');
11382 },
11383
11384
11385 /**
11386 * Gets the attributs of the file object.
11387 * @param {String} The attribute name which want to get.
11388 * @returns {Any}
11389 */
11390 get: function get(attrName) {
11391 switch (attrName) {
11392 case 'objectId':
11393 return this.id;
11394 case 'url':
11395 case 'name':
11396 case 'mime_type':
11397 case 'metaData':
11398 case 'createdAt':
11399 case 'updatedAt':
11400 return this.attributes[attrName];
11401 default:
11402 return this.attributes.metaData[attrName];
11403 }
11404 },
11405
11406
11407 /**
11408 * Set the metaData of the file object.
11409 * @param {Object} Object is an key value Object for setting metaData.
11410 * @param {String} attr is an optional metadata key.
11411 * @param {Object} value is an optional metadata value.
11412 * @returns {String|Number|Array|Object}
11413 */
11414 set: function set() {
11415 var _this2 = this;
11416
11417 var set = function set(attrName, value) {
11418 switch (attrName) {
11419 case 'name':
11420 case 'url':
11421 case 'mime_type':
11422 case 'base64':
11423 case 'metaData':
11424 _this2.attributes[attrName] = value;
11425 break;
11426 default:
11427 // File 并非一个 AVObject,不能完全自定义其他属性,所以只能都放在 metaData 上面
11428 _this2.attributes.metaData[attrName] = value;
11429 break;
11430 }
11431 };
11432
11433 for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
11434 args[_key] = arguments[_key];
11435 }
11436
11437 switch (args.length) {
11438 case 1:
11439 // 传入一个 Object
11440 for (var k in args[0]) {
11441 set(k, args[0][k]);
11442 }
11443 break;
11444 case 2:
11445 set(args[0], args[1]);
11446 break;
11447 }
11448 return this;
11449 },
11450
11451
11452 /**
11453 * Set a header for the upload request.
11454 * For more infomation, go to https://url.leanapp.cn/avfile-upload-headers
11455 *
11456 * @param {String} key header key
11457 * @param {String} value header value
11458 * @return {AV.File} this
11459 */
11460 setUploadHeader: function setUploadHeader(key, value) {
11461 this._uploadHeaders[key] = value;
11462 return this;
11463 },
11464
11465
11466 /**
11467 * <p>Returns the file's metadata JSON object if no arguments is given.Returns the
11468 * metadata value if a key is given.Set metadata value if key and value are both given.</p>
11469 * <p><pre>
11470 * var metadata = file.metaData(); //Get metadata JSON object.
11471 * var size = file.metaData('size'); // Get the size metadata value.
11472 * file.metaData('format', 'jpeg'); //set metadata attribute and value.
11473 *</pre></p>
11474 * @return {Object} The file's metadata JSON object.
11475 * @param {String} attr an optional metadata key.
11476 * @param {Object} value an optional metadata value.
11477 **/
11478 metaData: function metaData(attr, value) {
11479 if (attr && value) {
11480 this.attributes.metaData[attr] = value;
11481 return this;
11482 } else if (attr && !value) {
11483 return this.attributes.metaData[attr];
11484 } else {
11485 return this.attributes.metaData;
11486 }
11487 },
11488
11489
11490 /**
11491 * 如果文件是图片,获取图片的缩略图URL。可以传入宽度、高度、质量、格式等参数。
11492 * @return {String} 缩略图URL
11493 * @param {Number} width 宽度,单位:像素
11494 * @param {Number} heigth 高度,单位:像素
11495 * @param {Number} quality 质量,1-100的数字,默认100
11496 * @param {Number} scaleToFit 是否将图片自适应大小。默认为true。
11497 * @param {String} fmt 格式,默认为png,也可以为jpeg,gif等格式。
11498 */
11499
11500 thumbnailURL: function thumbnailURL(width, height) {
11501 var quality = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 100;
11502 var scaleToFit = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
11503 var fmt = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 'png';
11504
11505 var url = this.attributes.url;
11506 if (!url) {
11507 throw new Error('Invalid url.');
11508 }
11509 if (!width || !height || width <= 0 || height <= 0) {
11510 throw new Error('Invalid width or height value.');
11511 }
11512 if (quality <= 0 || quality > 100) {
11513 throw new Error('Invalid quality value.');
11514 }
11515 var mode = scaleToFit ? 2 : 1;
11516 return url + '?imageView/' + mode + '/w/' + width + '/h/' + height + '/q/' + quality + '/format/' + fmt;
11517 },
11518
11519
11520 /**
11521 * Returns the file's size.
11522 * @return {Number} The file's size in bytes.
11523 **/
11524 size: function size() {
11525 return this.metaData().size;
11526 },
11527
11528
11529 /**
11530 * Returns the file's owner.
11531 * @return {String} The file's owner id.
11532 */
11533 ownerId: function ownerId() {
11534 return this.metaData().owner;
11535 },
11536
11537
11538 /**
11539 * Destroy the file.
11540 * @param {AuthOptions} options
11541 * @return {Promise} A promise that is fulfilled when the destroy
11542 * completes.
11543 */
11544 destroy: function destroy(options) {
11545 if (!this.id) {
11546 return _promise2.default.reject(new Error('The file id does not eixst.'));
11547 }
11548 var request = AVRequest('files', null, this.id, 'DELETE', null, options);
11549 return request;
11550 },
11551
11552
11553 /**
11554 * Request Qiniu upload token
11555 * @param {string} type
11556 * @return {Promise} Resolved with the response
11557 * @private
11558 */
11559 _fileToken: function _fileToken(type, authOptions) {
11560 var name = this.attributes.name;
11561
11562 var extName = extname(name);
11563 if (!extName && this._extName) {
11564 name += this._extName;
11565 extName = this._extName;
11566 }
11567 var data = {
11568 name: name,
11569 keep_file_name: authOptions.keepFileName,
11570 key: authOptions.key,
11571 ACL: this._acl,
11572 mime_type: type,
11573 metaData: this.attributes.metaData
11574 };
11575 return AVRequest('fileTokens', null, null, 'POST', data, authOptions);
11576 },
11577
11578
11579 /**
11580 * @callback UploadProgressCallback
11581 * @param {XMLHttpRequestProgressEvent} event - The progress event with 'loaded' and 'total' attributes
11582 */
11583 /**
11584 * Saves the file to the AV cloud.
11585 * @param {AuthOptions} [options] AuthOptions plus:
11586 * @param {UploadProgressCallback} [options.onprogress] 文件上传进度,在 Node.js 中无效,回调参数说明详见 {@link UploadProgressCallback}。
11587 * @param {boolean} [options.keepFileName = false] 保留下载文件的文件名。
11588 * @param {string} [options.key] 指定文件的 key。设置该选项需要使用 masterKey
11589 * @return {Promise} Promise that is resolved when the save finishes.
11590 */
11591 save: function save() {
11592 var _this3 = this;
11593
11594 var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
11595
11596 if (this.id) {
11597 throw new Error('File is already saved.');
11598 }
11599 if (!this._previousSave) {
11600 if (this._data) {
11601 var mimeType = this.get('mime_type');
11602 this._previousSave = this._fileToken(mimeType, options).then(function (uploadInfo) {
11603 if (uploadInfo.mime_type) {
11604 mimeType = uploadInfo.mime_type;
11605 _this3.set('mime_type', mimeType);
11606 }
11607 _this3._token = uploadInfo.token;
11608 return _promise2.default.resolve().then(function () {
11609 var data = _this3._data;
11610 if (data && data.base64) {
11611 return parseBase64(data.base64, mimeType);
11612 }
11613 if (data && data.blob) {
11614 if (!data.blob.type && mimeType) {
11615 data.blob.type = mimeType;
11616 }
11617 if (!data.blob.name) {
11618 data.blob.name = _this3.get('name');
11619 }
11620 return data.blob;
11621 }
11622 if (typeof Blob !== 'undefined' && data instanceof Blob) {
11623 return data;
11624 }
11625 throw new TypeError('malformed file data');
11626 }).then(function (data) {
11627 var _options = _.extend({}, options);
11628 // filter out download progress events
11629 if (options.onprogress) {
11630 _options.onprogress = function (event) {
11631 if (event.direction === 'download') return;
11632 return options.onprogress(event);
11633 };
11634 }
11635 switch (uploadInfo.provider) {
11636 case 's3':
11637 return s3(uploadInfo, data, _this3, _options);
11638 case 'qcloud':
11639 return cos(uploadInfo, data, _this3, _options);
11640 case 'qiniu':
11641 default:
11642 return qiniu(uploadInfo, data, _this3, _options);
11643 }
11644 }).then(tap(function () {
11645 return _this3._callback(true);
11646 }), function (error) {
11647 _this3._callback(false);
11648 throw error;
11649 });
11650 });
11651 } else if (this.attributes.url && this.attributes.metaData.__source === 'external') {
11652 // external link file.
11653 var data = {
11654 name: this.attributes.name,
11655 ACL: this._acl,
11656 metaData: this.attributes.metaData,
11657 mime_type: this.mimeType,
11658 url: this.attributes.url
11659 };
11660 this._previousSave = AVRequest('files', null, null, 'post', data, options).then(function (response) {
11661 _this3.id = response.objectId;
11662 return _this3;
11663 });
11664 }
11665 }
11666 return this._previousSave;
11667 },
11668 _callback: function _callback(success) {
11669 AVRequest('fileCallback', null, null, 'post', {
11670 token: this._token,
11671 result: success
11672 }).catch(debug);
11673 delete this._token;
11674 delete this._data;
11675 },
11676
11677
11678 /**
11679 * fetch the file from server. If the server's representation of the
11680 * model differs from its current attributes, they will be overriden,
11681 * @param {Object} fetchOptions Optional options to set 'keys',
11682 * 'include' and 'includeACL' option.
11683 * @param {AuthOptions} options
11684 * @return {Promise} A promise that is fulfilled when the fetch
11685 * completes.
11686 */
11687 fetch: function fetch(fetchOptions, options) {
11688 if (!this.id) {
11689 throw new Error('Cannot fetch unsaved file');
11690 }
11691 var request = AVRequest('files', null, this.id, 'GET', transformFetchOptions(fetchOptions), options);
11692 return request.then(this._finishFetch.bind(this));
11693 },
11694 _finishFetch: function _finishFetch(response) {
11695 var value = AV.Object.prototype.parse(response);
11696 value.attributes = {
11697 name: value.name,
11698 url: value.url,
11699 mime_type: value.mime_type,
11700 bucket: value.bucket
11701 };
11702 value.attributes.metaData = value.metaData || {};
11703 value.id = value.objectId;
11704 // clean
11705 delete value.objectId;
11706 delete value.metaData;
11707 delete value.url;
11708 delete value.name;
11709 delete value.mime_type;
11710 delete value.bucket;
11711 _.extend(this, value);
11712 return this;
11713 }
11714 });
11715};
11716
11717/***/ }),
11718/* 292 */
11719/***/ (function(module, exports, __webpack_require__) {
11720
11721"use strict";
11722
11723
11724var _require = __webpack_require__(36),
11725 getAdapter = _require.getAdapter;
11726
11727var debug = __webpack_require__(35)('cos');
11728
11729module.exports = function (uploadInfo, data, file) {
11730 var saveOptions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
11731
11732 var url = uploadInfo.upload_url + '?sign=' + encodeURIComponent(uploadInfo.token);
11733 var fileFormData = {
11734 field: 'fileContent',
11735 data: data,
11736 name: file.attributes.name
11737 };
11738 var options = {
11739 headers: file._uploadHeaders,
11740 data: {
11741 op: 'upload'
11742 },
11743 onprogress: saveOptions.onprogress
11744 };
11745 debug('url: %s, file: %o, options: %o', url, fileFormData, options);
11746 var upload = getAdapter('upload');
11747 return upload(url, fileFormData, options).then(function (response) {
11748 debug(response.status, response.data);
11749 if (response.ok === false) {
11750 var error = new Error(response.status);
11751 error.response = response;
11752 throw error;
11753 }
11754 file.attributes.url = uploadInfo.url;
11755 file._bucket = uploadInfo.bucket;
11756 file.id = uploadInfo.objectId;
11757 return file;
11758 }, function (error) {
11759 var response = error.response;
11760
11761 if (response) {
11762 debug(response.status, response.data);
11763 error.statusCode = response.status;
11764 error.response = response.data;
11765 }
11766 throw error;
11767 });
11768};
11769
11770/***/ }),
11771/* 293 */
11772/***/ (function(module, exports, __webpack_require__) {
11773
11774"use strict";
11775
11776
11777var _getPrototypeOf = __webpack_require__(155);
11778
11779var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);
11780
11781var _possibleConstructorReturn2 = __webpack_require__(294);
11782
11783var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
11784
11785var _inherits2 = __webpack_require__(295);
11786
11787var _inherits3 = _interopRequireDefault(_inherits2);
11788
11789var _promise = __webpack_require__(4);
11790
11791var _promise2 = _interopRequireDefault(_promise);
11792
11793var _classCallCheck2 = __webpack_require__(303);
11794
11795var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
11796
11797var _createClass2 = __webpack_require__(304);
11798
11799var _createClass3 = _interopRequireDefault(_createClass2);
11800
11801var _getIterator2 = __webpack_require__(162);
11802
11803var _getIterator3 = _interopRequireDefault(_getIterator2);
11804
11805var _stringify = __webpack_require__(18);
11806
11807var _stringify2 = _interopRequireDefault(_stringify);
11808
11809function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11810
11811var _require = __webpack_require__(36),
11812 getAdapter = _require.getAdapter;
11813
11814var debug = __webpack_require__(35)('leancloud:qiniu');
11815var ajax = __webpack_require__(58);
11816var btoa = __webpack_require__(307);
11817
11818var SHARD_THRESHOLD = 1024 * 1024 * 64;
11819
11820var CHUNK_SIZE = 1024 * 1024 * 16;
11821
11822function upload(uploadInfo, data, file) {
11823 var saveOptions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
11824
11825 // Get the uptoken to upload files to qiniu.
11826 var uptoken = uploadInfo.token;
11827 var url = uploadInfo.upload_url || 'https://upload.qiniup.com';
11828 var fileFormData = {
11829 field: 'file',
11830 data: data,
11831 name: file.attributes.name
11832 };
11833 var options = {
11834 headers: file._uploadHeaders,
11835 data: {
11836 name: file.attributes.name,
11837 key: uploadInfo.key,
11838 token: uptoken
11839 },
11840 onprogress: saveOptions.onprogress
11841 };
11842 debug('url: %s, file: %o, options: %o', url, fileFormData, options);
11843 var upload = getAdapter('upload');
11844 return upload(url, fileFormData, options).then(function (response) {
11845 debug(response.status, response.data);
11846 if (response.ok === false) {
11847 var message = response.status;
11848 if (response.data) {
11849 if (response.data.error) {
11850 message = response.data.error;
11851 } else {
11852 message = (0, _stringify2.default)(response.data);
11853 }
11854 }
11855 var error = new Error(message);
11856 error.response = response;
11857 throw error;
11858 }
11859 file.attributes.url = uploadInfo.url;
11860 file._bucket = uploadInfo.bucket;
11861 file.id = uploadInfo.objectId;
11862 return file;
11863 }, function (error) {
11864 var response = error.response;
11865
11866 if (response) {
11867 debug(response.status, response.data);
11868 error.statusCode = response.status;
11869 error.response = response.data;
11870 }
11871 throw error;
11872 });
11873}
11874
11875function urlSafeBase64(string) {
11876 var base64 = btoa(unescape(encodeURIComponent(string)));
11877 var result = '';
11878 var _iteratorNormalCompletion = true;
11879 var _didIteratorError = false;
11880 var _iteratorError = undefined;
11881
11882 try {
11883 for (var _iterator = (0, _getIterator3.default)(base64), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
11884 var ch = _step.value;
11885
11886 switch (ch) {
11887 case '+':
11888 result += '-';
11889 break;
11890 case '/':
11891 result += '_';
11892 break;
11893 default:
11894 result += ch;
11895 }
11896 }
11897 } catch (err) {
11898 _didIteratorError = true;
11899 _iteratorError = err;
11900 } finally {
11901 try {
11902 if (!_iteratorNormalCompletion && _iterator.return) {
11903 _iterator.return();
11904 }
11905 } finally {
11906 if (_didIteratorError) {
11907 throw _iteratorError;
11908 }
11909 }
11910 }
11911
11912 return result;
11913}
11914
11915var ShardUploader = function () {
11916 function ShardUploader(uploadInfo, data, file, saveOptions) {
11917 var _this = this;
11918
11919 (0, _classCallCheck3.default)(this, ShardUploader);
11920
11921 this.uploadInfo = uploadInfo;
11922 this.data = data;
11923 this.file = file;
11924 this.size = undefined;
11925 this.offset = 0;
11926 this.uploadedChunks = 0;
11927
11928 var key = urlSafeBase64(uploadInfo.key);
11929 var uploadURL = uploadInfo.upload_url || 'https://upload.qiniup.com';
11930 this.baseURL = uploadURL + '/buckets/' + uploadInfo.bucket + '/objects/' + key + '/uploads';
11931 this.upToken = 'UpToken ' + uploadInfo.token;
11932
11933 this.uploaded = 0;
11934 if (saveOptions && saveOptions.onprogress) {
11935 this.onProgress = function (_ref) {
11936 var loaded = _ref.loaded;
11937
11938 loaded += _this.uploadedChunks * CHUNK_SIZE;
11939 if (loaded <= _this.uploaded) {
11940 return;
11941 }
11942 if (_this.size) {
11943 saveOptions.onprogress({
11944 loaded: loaded,
11945 total: _this.size,
11946 percent: loaded / _this.size * 100
11947 });
11948 } else {
11949 saveOptions.onprogress({ loaded: loaded });
11950 }
11951 _this.uploaded = loaded;
11952 };
11953 }
11954 }
11955
11956 /**
11957 * @returns {Promise<string>}
11958 */
11959
11960
11961 (0, _createClass3.default)(ShardUploader, [{
11962 key: 'getUploadId',
11963 value: function getUploadId() {
11964 return ajax({
11965 method: 'POST',
11966 url: this.baseURL,
11967 headers: {
11968 Authorization: this.upToken
11969 }
11970 }).then(function (res) {
11971 return res.uploadId;
11972 });
11973 }
11974 }, {
11975 key: 'getChunk',
11976 value: function getChunk() {
11977 throw new Error('Not implemented');
11978 }
11979
11980 /**
11981 * @param {string} uploadId
11982 * @param {number} partNumber
11983 * @param {any} data
11984 * @returns {Promise<{ partNumber: number, etag: string }>}
11985 */
11986
11987 }, {
11988 key: 'uploadPart',
11989 value: function uploadPart(uploadId, partNumber, data) {
11990 return ajax({
11991 method: 'PUT',
11992 url: this.baseURL + '/' + uploadId + '/' + partNumber,
11993 headers: {
11994 Authorization: this.upToken
11995 },
11996 data: data,
11997 onprogress: this.onProgress
11998 }).then(function (_ref2) {
11999 var etag = _ref2.etag;
12000 return { partNumber: partNumber, etag: etag };
12001 });
12002 }
12003 }, {
12004 key: 'stopUpload',
12005 value: function stopUpload(uploadId) {
12006 return ajax({
12007 method: 'DELETE',
12008 url: this.baseURL + '/' + uploadId,
12009 headers: {
12010 Authorization: this.upToken
12011 }
12012 });
12013 }
12014 }, {
12015 key: 'upload',
12016 value: function upload() {
12017 var _this2 = this;
12018
12019 var parts = [];
12020 return this.getUploadId().then(function (uploadId) {
12021 var uploadPart = function uploadPart() {
12022 return _promise2.default.resolve(_this2.getChunk()).then(function (chunk) {
12023 if (!chunk) {
12024 return;
12025 }
12026 var partNumber = parts.length + 1;
12027 return _this2.uploadPart(uploadId, partNumber, chunk).then(function (part) {
12028 parts.push(part);
12029 _this2.uploadedChunks++;
12030 return uploadPart();
12031 });
12032 }).catch(function (error) {
12033 return _this2.stopUpload(uploadId).then(function () {
12034 return _promise2.default.reject(error);
12035 });
12036 });
12037 };
12038
12039 return uploadPart().then(function () {
12040 return ajax({
12041 method: 'POST',
12042 url: _this2.baseURL + '/' + uploadId,
12043 headers: {
12044 Authorization: _this2.upToken
12045 },
12046 data: {
12047 parts: parts,
12048 fname: _this2.file.attributes.name,
12049 mimeType: _this2.file.attributes.mime_type
12050 }
12051 });
12052 });
12053 }).then(function () {
12054 _this2.file.attributes.url = _this2.uploadInfo.url;
12055 _this2.file._bucket = _this2.uploadInfo.bucket;
12056 _this2.file.id = _this2.uploadInfo.objectId;
12057 return _this2.file;
12058 });
12059 }
12060 }]);
12061 return ShardUploader;
12062}();
12063
12064var BlobUploader = function (_ShardUploader) {
12065 (0, _inherits3.default)(BlobUploader, _ShardUploader);
12066
12067 function BlobUploader(uploadInfo, data, file, saveOptions) {
12068 (0, _classCallCheck3.default)(this, BlobUploader);
12069
12070 var _this3 = (0, _possibleConstructorReturn3.default)(this, (BlobUploader.__proto__ || (0, _getPrototypeOf2.default)(BlobUploader)).call(this, uploadInfo, data, file, saveOptions));
12071
12072 _this3.size = data.size;
12073 return _this3;
12074 }
12075
12076 /**
12077 * @returns {Blob | null}
12078 */
12079
12080
12081 (0, _createClass3.default)(BlobUploader, [{
12082 key: 'getChunk',
12083 value: function getChunk() {
12084 if (this.offset >= this.size) {
12085 return null;
12086 }
12087 var chunk = this.data.slice(this.offset, this.offset + CHUNK_SIZE);
12088 this.offset += chunk.size;
12089 return chunk;
12090 }
12091 }]);
12092 return BlobUploader;
12093}(ShardUploader);
12094
12095function isBlob(data) {
12096 return typeof Blob !== 'undefined' && data instanceof Blob;
12097}
12098
12099module.exports = function (uploadInfo, data, file) {
12100 var saveOptions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
12101
12102 if (isBlob(data) && data.size >= SHARD_THRESHOLD) {
12103 return new BlobUploader(uploadInfo, data, file, saveOptions).upload();
12104 }
12105 return upload(uploadInfo, data, file, saveOptions);
12106};
12107
12108/***/ }),
12109/* 294 */
12110/***/ (function(module, exports, __webpack_require__) {
12111
12112"use strict";
12113
12114
12115exports.__esModule = true;
12116
12117var _typeof2 = __webpack_require__(59);
12118
12119var _typeof3 = _interopRequireDefault(_typeof2);
12120
12121function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12122
12123exports.default = function (self, call) {
12124 if (!self) {
12125 throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
12126 }
12127
12128 return call && ((typeof call === "undefined" ? "undefined" : (0, _typeof3.default)(call)) === "object" || typeof call === "function") ? call : self;
12129};
12130
12131/***/ }),
12132/* 295 */
12133/***/ (function(module, exports, __webpack_require__) {
12134
12135"use strict";
12136
12137
12138exports.__esModule = true;
12139
12140var _setPrototypeOf = __webpack_require__(296);
12141
12142var _setPrototypeOf2 = _interopRequireDefault(_setPrototypeOf);
12143
12144var _create = __webpack_require__(300);
12145
12146var _create2 = _interopRequireDefault(_create);
12147
12148var _typeof2 = __webpack_require__(59);
12149
12150var _typeof3 = _interopRequireDefault(_typeof2);
12151
12152function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12153
12154exports.default = function (subClass, superClass) {
12155 if (typeof superClass !== "function" && superClass !== null) {
12156 throw new TypeError("Super expression must either be null or a function, not " + (typeof superClass === "undefined" ? "undefined" : (0, _typeof3.default)(superClass)));
12157 }
12158
12159 subClass.prototype = (0, _create2.default)(superClass && superClass.prototype, {
12160 constructor: {
12161 value: subClass,
12162 enumerable: false,
12163 writable: true,
12164 configurable: true
12165 }
12166 });
12167 if (superClass) _setPrototypeOf2.default ? (0, _setPrototypeOf2.default)(subClass, superClass) : subClass.__proto__ = superClass;
12168};
12169
12170/***/ }),
12171/* 296 */
12172/***/ (function(module, exports, __webpack_require__) {
12173
12174module.exports = { "default": __webpack_require__(297), __esModule: true };
12175
12176/***/ }),
12177/* 297 */
12178/***/ (function(module, exports, __webpack_require__) {
12179
12180__webpack_require__(298);
12181module.exports = __webpack_require__(2).Object.setPrototypeOf;
12182
12183
12184/***/ }),
12185/* 298 */
12186/***/ (function(module, exports, __webpack_require__) {
12187
12188// 19.1.3.19 Object.setPrototypeOf(O, proto)
12189var $export = __webpack_require__(17);
12190$export($export.S, 'Object', { setPrototypeOf: __webpack_require__(299).set });
12191
12192
12193/***/ }),
12194/* 299 */
12195/***/ (function(module, exports, __webpack_require__) {
12196
12197// Works with __proto__ only. Old v8 can't work with null proto objects.
12198/* eslint-disable no-proto */
12199var isObject = __webpack_require__(20);
12200var anObject = __webpack_require__(16);
12201var check = function (O, proto) {
12202 anObject(O);
12203 if (!isObject(proto) && proto !== null) throw TypeError(proto + ": can't set as prototype!");
12204};
12205module.exports = {
12206 set: Object.setPrototypeOf || ('__proto__' in {} ? // eslint-disable-line
12207 function (test, buggy, set) {
12208 try {
12209 set = __webpack_require__(38)(Function.call, __webpack_require__(90).f(Object.prototype, '__proto__').set, 2);
12210 set(test, []);
12211 buggy = !(test instanceof Array);
12212 } catch (e) { buggy = true; }
12213 return function setPrototypeOf(O, proto) {
12214 check(O, proto);
12215 if (buggy) O.__proto__ = proto;
12216 else set(O, proto);
12217 return O;
12218 };
12219 }({}, false) : undefined),
12220 check: check
12221};
12222
12223
12224/***/ }),
12225/* 300 */
12226/***/ (function(module, exports, __webpack_require__) {
12227
12228module.exports = { "default": __webpack_require__(301), __esModule: true };
12229
12230/***/ }),
12231/* 301 */
12232/***/ (function(module, exports, __webpack_require__) {
12233
12234__webpack_require__(302);
12235var $Object = __webpack_require__(2).Object;
12236module.exports = function create(P, D) {
12237 return $Object.create(P, D);
12238};
12239
12240
12241/***/ }),
12242/* 302 */
12243/***/ (function(module, exports, __webpack_require__) {
12244
12245var $export = __webpack_require__(17);
12246// 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties])
12247$export($export.S, 'Object', { create: __webpack_require__(64) });
12248
12249
12250/***/ }),
12251/* 303 */
12252/***/ (function(module, exports, __webpack_require__) {
12253
12254"use strict";
12255
12256
12257exports.__esModule = true;
12258
12259exports.default = function (instance, Constructor) {
12260 if (!(instance instanceof Constructor)) {
12261 throw new TypeError("Cannot call a class as a function");
12262 }
12263};
12264
12265/***/ }),
12266/* 304 */
12267/***/ (function(module, exports, __webpack_require__) {
12268
12269"use strict";
12270
12271
12272exports.__esModule = true;
12273
12274var _defineProperty = __webpack_require__(86);
12275
12276var _defineProperty2 = _interopRequireDefault(_defineProperty);
12277
12278function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12279
12280exports.default = function () {
12281 function defineProperties(target, props) {
12282 for (var i = 0; i < props.length; i++) {
12283 var descriptor = props[i];
12284 descriptor.enumerable = descriptor.enumerable || false;
12285 descriptor.configurable = true;
12286 if ("value" in descriptor) descriptor.writable = true;
12287 (0, _defineProperty2.default)(target, descriptor.key, descriptor);
12288 }
12289 }
12290
12291 return function (Constructor, protoProps, staticProps) {
12292 if (protoProps) defineProperties(Constructor.prototype, protoProps);
12293 if (staticProps) defineProperties(Constructor, staticProps);
12294 return Constructor;
12295 };
12296}();
12297
12298/***/ }),
12299/* 305 */
12300/***/ (function(module, exports, __webpack_require__) {
12301
12302__webpack_require__(54);
12303__webpack_require__(47);
12304module.exports = __webpack_require__(306);
12305
12306
12307/***/ }),
12308/* 306 */
12309/***/ (function(module, exports, __webpack_require__) {
12310
12311var anObject = __webpack_require__(16);
12312var get = __webpack_require__(99);
12313module.exports = __webpack_require__(2).getIterator = function (it) {
12314 var iterFn = get(it);
12315 if (typeof iterFn != 'function') throw TypeError(it + ' is not iterable!');
12316 return anObject(iterFn.call(it));
12317};
12318
12319
12320/***/ }),
12321/* 307 */
12322/***/ (function(module, exports, __webpack_require__) {
12323
12324"use strict";
12325
12326
12327// base64 character set, plus padding character (=)
12328var b64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
12329
12330module.exports = function (string) {
12331 var result = '';
12332
12333 for (var i = 0; i < string.length;) {
12334 var a = string.charCodeAt(i++);
12335 var b = string.charCodeAt(i++);
12336 var c = string.charCodeAt(i++);
12337 if (a > 255 || b > 255 || c > 255) {
12338 throw new TypeError('Failed to encode base64: The string to be encoded contains characters outside of the Latin1 range.');
12339 }
12340
12341 var bitmap = a << 16 | b << 8 | c;
12342 result += b64.charAt(bitmap >> 18 & 63) + b64.charAt(bitmap >> 12 & 63) + b64.charAt(bitmap >> 6 & 63) + b64.charAt(bitmap & 63);
12343 }
12344
12345 // To determine the final padding
12346 var rest = string.length % 3;
12347 // If there's need of padding, replace the last 'A's with equal signs
12348 return rest ? result.slice(0, rest - 3) + '==='.substring(rest) : result;
12349};
12350
12351/***/ }),
12352/* 308 */
12353/***/ (function(module, exports, __webpack_require__) {
12354
12355"use strict";
12356
12357
12358var _ = __webpack_require__(0);
12359var ajax = __webpack_require__(58);
12360
12361module.exports = function upload(uploadInfo, data, file) {
12362 var saveOptions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
12363
12364
12365 return ajax({
12366 url: uploadInfo.upload_url,
12367 method: 'PUT',
12368 data: data,
12369 headers: _.extend({
12370 'Content-Type': file.get('mime_type'),
12371 'Cache-Control': 'public, max-age=31536000'
12372 }, file._uploadHeaders),
12373 onprogress: saveOptions.onprogress
12374 }).then(function () {
12375 file.attributes.url = uploadInfo.url;
12376 file._bucket = uploadInfo.bucket;
12377 file.id = uploadInfo.objectId;
12378 return file;
12379 });
12380};
12381
12382/***/ }),
12383/* 309 */
12384/***/ (function(module, exports, __webpack_require__) {
12385
12386(function(){
12387 var crypt = __webpack_require__(310),
12388 utf8 = __webpack_require__(163).utf8,
12389 isBuffer = __webpack_require__(311),
12390 bin = __webpack_require__(163).bin,
12391
12392 // The core
12393 md5 = function (message, options) {
12394 // Convert to byte array
12395 if (message.constructor == String)
12396 if (options && options.encoding === 'binary')
12397 message = bin.stringToBytes(message);
12398 else
12399 message = utf8.stringToBytes(message);
12400 else if (isBuffer(message))
12401 message = Array.prototype.slice.call(message, 0);
12402 else if (!Array.isArray(message))
12403 message = message.toString();
12404 // else, assume byte array already
12405
12406 var m = crypt.bytesToWords(message),
12407 l = message.length * 8,
12408 a = 1732584193,
12409 b = -271733879,
12410 c = -1732584194,
12411 d = 271733878;
12412
12413 // Swap endian
12414 for (var i = 0; i < m.length; i++) {
12415 m[i] = ((m[i] << 8) | (m[i] >>> 24)) & 0x00FF00FF |
12416 ((m[i] << 24) | (m[i] >>> 8)) & 0xFF00FF00;
12417 }
12418
12419 // Padding
12420 m[l >>> 5] |= 0x80 << (l % 32);
12421 m[(((l + 64) >>> 9) << 4) + 14] = l;
12422
12423 // Method shortcuts
12424 var FF = md5._ff,
12425 GG = md5._gg,
12426 HH = md5._hh,
12427 II = md5._ii;
12428
12429 for (var i = 0; i < m.length; i += 16) {
12430
12431 var aa = a,
12432 bb = b,
12433 cc = c,
12434 dd = d;
12435
12436 a = FF(a, b, c, d, m[i+ 0], 7, -680876936);
12437 d = FF(d, a, b, c, m[i+ 1], 12, -389564586);
12438 c = FF(c, d, a, b, m[i+ 2], 17, 606105819);
12439 b = FF(b, c, d, a, m[i+ 3], 22, -1044525330);
12440 a = FF(a, b, c, d, m[i+ 4], 7, -176418897);
12441 d = FF(d, a, b, c, m[i+ 5], 12, 1200080426);
12442 c = FF(c, d, a, b, m[i+ 6], 17, -1473231341);
12443 b = FF(b, c, d, a, m[i+ 7], 22, -45705983);
12444 a = FF(a, b, c, d, m[i+ 8], 7, 1770035416);
12445 d = FF(d, a, b, c, m[i+ 9], 12, -1958414417);
12446 c = FF(c, d, a, b, m[i+10], 17, -42063);
12447 b = FF(b, c, d, a, m[i+11], 22, -1990404162);
12448 a = FF(a, b, c, d, m[i+12], 7, 1804603682);
12449 d = FF(d, a, b, c, m[i+13], 12, -40341101);
12450 c = FF(c, d, a, b, m[i+14], 17, -1502002290);
12451 b = FF(b, c, d, a, m[i+15], 22, 1236535329);
12452
12453 a = GG(a, b, c, d, m[i+ 1], 5, -165796510);
12454 d = GG(d, a, b, c, m[i+ 6], 9, -1069501632);
12455 c = GG(c, d, a, b, m[i+11], 14, 643717713);
12456 b = GG(b, c, d, a, m[i+ 0], 20, -373897302);
12457 a = GG(a, b, c, d, m[i+ 5], 5, -701558691);
12458 d = GG(d, a, b, c, m[i+10], 9, 38016083);
12459 c = GG(c, d, a, b, m[i+15], 14, -660478335);
12460 b = GG(b, c, d, a, m[i+ 4], 20, -405537848);
12461 a = GG(a, b, c, d, m[i+ 9], 5, 568446438);
12462 d = GG(d, a, b, c, m[i+14], 9, -1019803690);
12463 c = GG(c, d, a, b, m[i+ 3], 14, -187363961);
12464 b = GG(b, c, d, a, m[i+ 8], 20, 1163531501);
12465 a = GG(a, b, c, d, m[i+13], 5, -1444681467);
12466 d = GG(d, a, b, c, m[i+ 2], 9, -51403784);
12467 c = GG(c, d, a, b, m[i+ 7], 14, 1735328473);
12468 b = GG(b, c, d, a, m[i+12], 20, -1926607734);
12469
12470 a = HH(a, b, c, d, m[i+ 5], 4, -378558);
12471 d = HH(d, a, b, c, m[i+ 8], 11, -2022574463);
12472 c = HH(c, d, a, b, m[i+11], 16, 1839030562);
12473 b = HH(b, c, d, a, m[i+14], 23, -35309556);
12474 a = HH(a, b, c, d, m[i+ 1], 4, -1530992060);
12475 d = HH(d, a, b, c, m[i+ 4], 11, 1272893353);
12476 c = HH(c, d, a, b, m[i+ 7], 16, -155497632);
12477 b = HH(b, c, d, a, m[i+10], 23, -1094730640);
12478 a = HH(a, b, c, d, m[i+13], 4, 681279174);
12479 d = HH(d, a, b, c, m[i+ 0], 11, -358537222);
12480 c = HH(c, d, a, b, m[i+ 3], 16, -722521979);
12481 b = HH(b, c, d, a, m[i+ 6], 23, 76029189);
12482 a = HH(a, b, c, d, m[i+ 9], 4, -640364487);
12483 d = HH(d, a, b, c, m[i+12], 11, -421815835);
12484 c = HH(c, d, a, b, m[i+15], 16, 530742520);
12485 b = HH(b, c, d, a, m[i+ 2], 23, -995338651);
12486
12487 a = II(a, b, c, d, m[i+ 0], 6, -198630844);
12488 d = II(d, a, b, c, m[i+ 7], 10, 1126891415);
12489 c = II(c, d, a, b, m[i+14], 15, -1416354905);
12490 b = II(b, c, d, a, m[i+ 5], 21, -57434055);
12491 a = II(a, b, c, d, m[i+12], 6, 1700485571);
12492 d = II(d, a, b, c, m[i+ 3], 10, -1894986606);
12493 c = II(c, d, a, b, m[i+10], 15, -1051523);
12494 b = II(b, c, d, a, m[i+ 1], 21, -2054922799);
12495 a = II(a, b, c, d, m[i+ 8], 6, 1873313359);
12496 d = II(d, a, b, c, m[i+15], 10, -30611744);
12497 c = II(c, d, a, b, m[i+ 6], 15, -1560198380);
12498 b = II(b, c, d, a, m[i+13], 21, 1309151649);
12499 a = II(a, b, c, d, m[i+ 4], 6, -145523070);
12500 d = II(d, a, b, c, m[i+11], 10, -1120210379);
12501 c = II(c, d, a, b, m[i+ 2], 15, 718787259);
12502 b = II(b, c, d, a, m[i+ 9], 21, -343485551);
12503
12504 a = (a + aa) >>> 0;
12505 b = (b + bb) >>> 0;
12506 c = (c + cc) >>> 0;
12507 d = (d + dd) >>> 0;
12508 }
12509
12510 return crypt.endian([a, b, c, d]);
12511 };
12512
12513 // Auxiliary functions
12514 md5._ff = function (a, b, c, d, x, s, t) {
12515 var n = a + (b & c | ~b & d) + (x >>> 0) + t;
12516 return ((n << s) | (n >>> (32 - s))) + b;
12517 };
12518 md5._gg = function (a, b, c, d, x, s, t) {
12519 var n = a + (b & d | c & ~d) + (x >>> 0) + t;
12520 return ((n << s) | (n >>> (32 - s))) + b;
12521 };
12522 md5._hh = function (a, b, c, d, x, s, t) {
12523 var n = a + (b ^ c ^ d) + (x >>> 0) + t;
12524 return ((n << s) | (n >>> (32 - s))) + b;
12525 };
12526 md5._ii = function (a, b, c, d, x, s, t) {
12527 var n = a + (c ^ (b | ~d)) + (x >>> 0) + t;
12528 return ((n << s) | (n >>> (32 - s))) + b;
12529 };
12530
12531 // Package private blocksize
12532 md5._blocksize = 16;
12533 md5._digestsize = 16;
12534
12535 module.exports = function (message, options) {
12536 if (message === undefined || message === null)
12537 throw new Error('Illegal argument ' + message);
12538
12539 var digestbytes = crypt.wordsToBytes(md5(message, options));
12540 return options && options.asBytes ? digestbytes :
12541 options && options.asString ? bin.bytesToString(digestbytes) :
12542 crypt.bytesToHex(digestbytes);
12543 };
12544
12545})();
12546
12547
12548/***/ }),
12549/* 310 */
12550/***/ (function(module, exports) {
12551
12552(function() {
12553 var base64map
12554 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/',
12555
12556 crypt = {
12557 // Bit-wise rotation left
12558 rotl: function(n, b) {
12559 return (n << b) | (n >>> (32 - b));
12560 },
12561
12562 // Bit-wise rotation right
12563 rotr: function(n, b) {
12564 return (n << (32 - b)) | (n >>> b);
12565 },
12566
12567 // Swap big-endian to little-endian and vice versa
12568 endian: function(n) {
12569 // If number given, swap endian
12570 if (n.constructor == Number) {
12571 return crypt.rotl(n, 8) & 0x00FF00FF | crypt.rotl(n, 24) & 0xFF00FF00;
12572 }
12573
12574 // Else, assume array and swap all items
12575 for (var i = 0; i < n.length; i++)
12576 n[i] = crypt.endian(n[i]);
12577 return n;
12578 },
12579
12580 // Generate an array of any length of random bytes
12581 randomBytes: function(n) {
12582 for (var bytes = []; n > 0; n--)
12583 bytes.push(Math.floor(Math.random() * 256));
12584 return bytes;
12585 },
12586
12587 // Convert a byte array to big-endian 32-bit words
12588 bytesToWords: function(bytes) {
12589 for (var words = [], i = 0, b = 0; i < bytes.length; i++, b += 8)
12590 words[b >>> 5] |= bytes[i] << (24 - b % 32);
12591 return words;
12592 },
12593
12594 // Convert big-endian 32-bit words to a byte array
12595 wordsToBytes: function(words) {
12596 for (var bytes = [], b = 0; b < words.length * 32; b += 8)
12597 bytes.push((words[b >>> 5] >>> (24 - b % 32)) & 0xFF);
12598 return bytes;
12599 },
12600
12601 // Convert a byte array to a hex string
12602 bytesToHex: function(bytes) {
12603 for (var hex = [], i = 0; i < bytes.length; i++) {
12604 hex.push((bytes[i] >>> 4).toString(16));
12605 hex.push((bytes[i] & 0xF).toString(16));
12606 }
12607 return hex.join('');
12608 },
12609
12610 // Convert a hex string to a byte array
12611 hexToBytes: function(hex) {
12612 for (var bytes = [], c = 0; c < hex.length; c += 2)
12613 bytes.push(parseInt(hex.substr(c, 2), 16));
12614 return bytes;
12615 },
12616
12617 // Convert a byte array to a base-64 string
12618 bytesToBase64: function(bytes) {
12619 for (var base64 = [], i = 0; i < bytes.length; i += 3) {
12620 var triplet = (bytes[i] << 16) | (bytes[i + 1] << 8) | bytes[i + 2];
12621 for (var j = 0; j < 4; j++)
12622 if (i * 8 + j * 6 <= bytes.length * 8)
12623 base64.push(base64map.charAt((triplet >>> 6 * (3 - j)) & 0x3F));
12624 else
12625 base64.push('=');
12626 }
12627 return base64.join('');
12628 },
12629
12630 // Convert a base-64 string to a byte array
12631 base64ToBytes: function(base64) {
12632 // Remove non-base-64 characters
12633 base64 = base64.replace(/[^A-Z0-9+\/]/ig, '');
12634
12635 for (var bytes = [], i = 0, imod4 = 0; i < base64.length;
12636 imod4 = ++i % 4) {
12637 if (imod4 == 0) continue;
12638 bytes.push(((base64map.indexOf(base64.charAt(i - 1))
12639 & (Math.pow(2, -2 * imod4 + 8) - 1)) << (imod4 * 2))
12640 | (base64map.indexOf(base64.charAt(i)) >>> (6 - imod4 * 2)));
12641 }
12642 return bytes;
12643 }
12644 };
12645
12646 module.exports = crypt;
12647})();
12648
12649
12650/***/ }),
12651/* 311 */
12652/***/ (function(module, exports) {
12653
12654/*!
12655 * Determine if an object is a Buffer
12656 *
12657 * @author Feross Aboukhadijeh <https://feross.org>
12658 * @license MIT
12659 */
12660
12661// The _isBuffer check is for Safari 5-7 support, because it's missing
12662// Object.prototype.constructor. Remove this eventually
12663module.exports = function (obj) {
12664 return obj != null && (isBuffer(obj) || isSlowBuffer(obj) || !!obj._isBuffer)
12665}
12666
12667function isBuffer (obj) {
12668 return !!obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj)
12669}
12670
12671// For Node v0.10 support. Remove this eventually.
12672function isSlowBuffer (obj) {
12673 return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isBuffer(obj.slice(0, 0))
12674}
12675
12676
12677/***/ }),
12678/* 312 */
12679/***/ (function(module, exports, __webpack_require__) {
12680
12681"use strict";
12682
12683
12684var dataURItoBlob = function dataURItoBlob(dataURI, type) {
12685 var byteString;
12686
12687 // 传入的 base64,不是 dataURL
12688 if (dataURI.indexOf('base64') < 0) {
12689 byteString = atob(dataURI);
12690 } else if (dataURI.split(',')[0].indexOf('base64') >= 0) {
12691 type = type || dataURI.split(',')[0].split(':')[1].split(';')[0];
12692 byteString = atob(dataURI.split(',')[1]);
12693 } else {
12694 byteString = unescape(dataURI.split(',')[1]);
12695 }
12696 var ia = new Uint8Array(byteString.length);
12697 for (var i = 0; i < byteString.length; i++) {
12698 ia[i] = byteString.charCodeAt(i);
12699 }
12700 return new Blob([ia], { type: type });
12701};
12702
12703module.exports = dataURItoBlob;
12704
12705/***/ }),
12706/* 313 */
12707/***/ (function(module, exports, __webpack_require__) {
12708
12709"use strict";
12710
12711
12712var _getOwnPropertyDescriptor = __webpack_require__(314);
12713
12714var _getOwnPropertyDescriptor2 = _interopRequireDefault(_getOwnPropertyDescriptor);
12715
12716var _stringify = __webpack_require__(18);
12717
12718var _stringify2 = _interopRequireDefault(_stringify);
12719
12720var _slicedToArray2 = __webpack_require__(317);
12721
12722var _slicedToArray3 = _interopRequireDefault(_slicedToArray2);
12723
12724var _promise = __webpack_require__(4);
12725
12726var _promise2 = _interopRequireDefault(_promise);
12727
12728function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12729
12730var _ = __webpack_require__(0);
12731var AVError = __webpack_require__(29);
12732
12733var _require = __webpack_require__(12),
12734 _request = _require._request;
12735
12736var _require2 = __webpack_require__(15),
12737 isNullOrUndefined = _require2.isNullOrUndefined,
12738 ensureArray = _require2.ensureArray,
12739 transformFetchOptions = _require2.transformFetchOptions,
12740 setValue = _require2.setValue,
12741 findValue = _require2.findValue,
12742 isPlainObject = _require2.isPlainObject,
12743 continueWhile = _require2.continueWhile;
12744
12745var recursiveToPointer = function recursiveToPointer(value) {
12746 if (_.isArray(value)) return value.map(recursiveToPointer);
12747 if (isPlainObject(value)) return _.mapObject(value, recursiveToPointer);
12748 if (_.isObject(value) && value._toPointer) return value._toPointer();
12749 return value;
12750};
12751
12752var RESERVED_KEYS = ['objectId', 'createdAt', 'updatedAt'];
12753var checkReservedKey = function checkReservedKey(key) {
12754 if (RESERVED_KEYS.indexOf(key) !== -1) {
12755 throw new Error('key[' + key + '] is reserved');
12756 }
12757};
12758
12759var handleBatchResults = function handleBatchResults(results) {
12760 var firstError = _.find(results, function (result) {
12761 return result instanceof Error;
12762 });
12763 if (!firstError) {
12764 return results;
12765 }
12766 var error = new AVError(firstError.code, firstError.message);
12767 error.results = results;
12768 throw error;
12769};
12770
12771// Helper function to get a value from a Backbone object as a property
12772// or as a function.
12773function getValue(object, prop) {
12774 if (!(object && object[prop])) {
12775 return null;
12776 }
12777 return _.isFunction(object[prop]) ? object[prop]() : object[prop];
12778}
12779
12780// AV.Object is analogous to the Java AVObject.
12781// It also implements the same interface as a Backbone model.
12782
12783module.exports = function (AV) {
12784 /**
12785 * Creates a new model with defined attributes. A client id (cid) is
12786 * automatically generated and assigned for you.
12787 *
12788 * <p>You won't normally call this method directly. It is recommended that
12789 * you use a subclass of <code>AV.Object</code> instead, created by calling
12790 * <code>extend</code>.</p>
12791 *
12792 * <p>However, if you don't want to use a subclass, or aren't sure which
12793 * subclass is appropriate, you can use this form:<pre>
12794 * var object = new AV.Object("ClassName");
12795 * </pre>
12796 * That is basically equivalent to:<pre>
12797 * var MyClass = AV.Object.extend("ClassName");
12798 * var object = new MyClass();
12799 * </pre></p>
12800 *
12801 * @param {Object} attributes The initial set of data to store in the object.
12802 * @param {Object} options A set of Backbone-like options for creating the
12803 * object. The only option currently supported is "collection".
12804 * @see AV.Object.extend
12805 *
12806 * @class
12807 *
12808 * <p>The fundamental unit of AV data, which implements the Backbone Model
12809 * interface.</p>
12810 */
12811 AV.Object = function (attributes, options) {
12812 // Allow new AV.Object("ClassName") as a shortcut to _create.
12813 if (_.isString(attributes)) {
12814 return AV.Object._create.apply(this, arguments);
12815 }
12816
12817 attributes = attributes || {};
12818 if (options && options.parse) {
12819 attributes = this.parse(attributes);
12820 attributes = this._mergeMagicFields(attributes);
12821 }
12822 var defaults = getValue(this, 'defaults');
12823 if (defaults) {
12824 attributes = _.extend({}, defaults, attributes);
12825 }
12826 if (options && options.collection) {
12827 this.collection = options.collection;
12828 }
12829
12830 this._serverData = {}; // The last known data for this object from cloud.
12831 this._opSetQueue = [{}]; // List of sets of changes to the data.
12832 this._flags = {};
12833 this.attributes = {}; // The best estimate of this's current data.
12834
12835 this._hashedJSON = {}; // Hash of values of containers at last save.
12836 this._escapedAttributes = {};
12837 this.cid = _.uniqueId('c');
12838 this.changed = {};
12839 this._silent = {};
12840 this._pending = {};
12841 this.set(attributes, { silent: true });
12842 this.changed = {};
12843 this._silent = {};
12844 this._pending = {};
12845 this._hasData = true;
12846 this._previousAttributes = _.clone(this.attributes);
12847 this.initialize.apply(this, arguments);
12848 };
12849
12850 /**
12851 * @lends AV.Object.prototype
12852 * @property {String} id The objectId of the AV Object.
12853 */
12854
12855 /**
12856 * Saves the given list of AV.Object.
12857 * If any error is encountered, stops and calls the error handler.
12858 *
12859 * @example
12860 * AV.Object.saveAll([object1, object2, ...]).then(function(list) {
12861 * // All the objects were saved.
12862 * }, function(error) {
12863 * // An error occurred while saving one of the objects.
12864 * });
12865 *
12866 * @param {Array} list A list of <code>AV.Object</code>.
12867 */
12868 AV.Object.saveAll = function (list, options) {
12869 return AV.Object._deepSaveAsync(list, null, options);
12870 };
12871
12872 /**
12873 * Fetch the given list of AV.Object.
12874 *
12875 * @param {AV.Object[]} objects A list of <code>AV.Object</code>
12876 * @param {AuthOptions} options
12877 * @return {Promise.<AV.Object[]>} The given list of <code>AV.Object</code>, updated
12878 */
12879
12880 AV.Object.fetchAll = function (objects, options) {
12881 return _promise2.default.resolve().then(function () {
12882 return _request('batch', null, null, 'POST', {
12883 requests: _.map(objects, function (object) {
12884 if (!object.className) throw new Error('object must have className to fetch');
12885 if (!object.id) throw new Error('object must have id to fetch');
12886 if (object.dirty()) throw new Error('object is modified but not saved');
12887 return {
12888 method: 'GET',
12889 path: '/1.1/classes/' + object.className + '/' + object.id
12890 };
12891 })
12892 }, options);
12893 }).then(function (response) {
12894 var results = _.map(objects, function (object, i) {
12895 if (response[i].success) {
12896 var fetchedAttrs = object.parse(response[i].success);
12897 object._cleanupUnsetKeys(fetchedAttrs);
12898 object._finishFetch(fetchedAttrs);
12899 return object;
12900 }
12901 if (response[i].success === null) {
12902 return new AVError(AVError.OBJECT_NOT_FOUND, 'Object not found.');
12903 }
12904 return new AVError(response[i].error.code, response[i].error.error);
12905 });
12906 return handleBatchResults(results);
12907 });
12908 };
12909
12910 // Attach all inheritable methods to the AV.Object prototype.
12911 _.extend(AV.Object.prototype, AV.Events,
12912 /** @lends AV.Object.prototype */{
12913 _fetchWhenSave: false,
12914
12915 /**
12916 * Initialize is an empty function by default. Override it with your own
12917 * initialization logic.
12918 */
12919 initialize: function initialize() {},
12920
12921 /**
12922 * Set whether to enable fetchWhenSave option when updating object.
12923 * When set true, SDK would fetch the latest object after saving.
12924 * Default is false.
12925 *
12926 * @deprecated use AV.Object#save with options.fetchWhenSave instead
12927 * @param {boolean} enable true to enable fetchWhenSave option.
12928 */
12929 fetchWhenSave: function fetchWhenSave(enable) {
12930 console.warn('AV.Object#fetchWhenSave is deprecated, use AV.Object#save with options.fetchWhenSave instead.');
12931 if (!_.isBoolean(enable)) {
12932 throw new Error('Expect boolean value for fetchWhenSave');
12933 }
12934 this._fetchWhenSave = enable;
12935 },
12936
12937 /**
12938 * Returns the object's objectId.
12939 * @return {String} the objectId.
12940 */
12941 getObjectId: function getObjectId() {
12942 return this.id;
12943 },
12944
12945 /**
12946 * Returns the object's createdAt attribute.
12947 * @return {Date}
12948 */
12949 getCreatedAt: function getCreatedAt() {
12950 return this.createdAt;
12951 },
12952
12953 /**
12954 * Returns the object's updatedAt attribute.
12955 * @return {Date}
12956 */
12957 getUpdatedAt: function getUpdatedAt() {
12958 return this.updatedAt;
12959 },
12960
12961 /**
12962 * Returns a JSON version of the object.
12963 * @return {Object}
12964 */
12965 toJSON: function toJSON(key, holder) {
12966 var seenObjects = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
12967
12968 return this._toFullJSON(seenObjects, false);
12969 },
12970
12971 /**
12972 * Returns a JSON version of the object with meta data.
12973 * Inverse to {@link AV.parseJSON}
12974 * @since 3.0.0
12975 * @return {Object}
12976 */
12977 toFullJSON: function toFullJSON() {
12978 var seenObjects = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
12979
12980 return this._toFullJSON(seenObjects);
12981 },
12982
12983
12984 _toFullJSON: function _toFullJSON(seenObjects) {
12985 var _this = this;
12986
12987 var full = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
12988
12989 var json = _.clone(this.attributes);
12990 if (_.isArray(seenObjects)) {
12991 var newSeenObjects = seenObjects.concat(this);
12992 }
12993 AV._objectEach(json, function (val, key) {
12994 json[key] = AV._encode(val, newSeenObjects, undefined, full);
12995 });
12996 AV._objectEach(this._operations, function (val, key) {
12997 json[key] = val;
12998 });
12999
13000 if (_.has(this, 'id')) {
13001 json.objectId = this.id;
13002 }
13003 ['createdAt', 'updatedAt'].forEach(function (key) {
13004 if (_.has(_this, key)) {
13005 var val = _this[key];
13006 json[key] = _.isDate(val) ? val.toJSON() : val;
13007 }
13008 });
13009 if (full) {
13010 json.__type = 'Object';
13011 if (_.isArray(seenObjects) && seenObjects.length) json.__type = 'Pointer';
13012 json.className = this.className;
13013 }
13014 return json;
13015 },
13016
13017 /**
13018 * Updates _hashedJSON to reflect the current state of this object.
13019 * Adds any changed hash values to the set of pending changes.
13020 * @private
13021 */
13022 _refreshCache: function _refreshCache() {
13023 var self = this;
13024 if (self._refreshingCache) {
13025 return;
13026 }
13027 self._refreshingCache = true;
13028 AV._objectEach(this.attributes, function (value, key) {
13029 if (value instanceof AV.Object) {
13030 value._refreshCache();
13031 } else if (_.isObject(value)) {
13032 if (self._resetCacheForKey(key)) {
13033 self.set(key, new AV.Op.Set(value), { silent: true });
13034 }
13035 }
13036 });
13037 delete self._refreshingCache;
13038 },
13039
13040 /**
13041 * Returns true if this object has been modified since its last
13042 * save/refresh. If an attribute is specified, it returns true only if that
13043 * particular attribute has been modified since the last save/refresh.
13044 * @param {String} attr An attribute name (optional).
13045 * @return {Boolean}
13046 */
13047 dirty: function dirty(attr) {
13048 this._refreshCache();
13049
13050 var currentChanges = _.last(this._opSetQueue);
13051
13052 if (attr) {
13053 return currentChanges[attr] ? true : false;
13054 }
13055 if (!this.id) {
13056 return true;
13057 }
13058 if (_.keys(currentChanges).length > 0) {
13059 return true;
13060 }
13061 return false;
13062 },
13063
13064 /**
13065 * Returns the keys of the modified attribute since its last save/refresh.
13066 * @return {String[]}
13067 */
13068 dirtyKeys: function dirtyKeys() {
13069 this._refreshCache();
13070 var currentChanges = _.last(this._opSetQueue);
13071 return _.keys(currentChanges);
13072 },
13073
13074 /**
13075 * Gets a Pointer referencing this Object.
13076 * @private
13077 */
13078 _toPointer: function _toPointer() {
13079 // if (!this.id) {
13080 // throw new Error("Can't serialize an unsaved AV.Object");
13081 // }
13082 return {
13083 __type: 'Pointer',
13084 className: this.className,
13085 objectId: this.id
13086 };
13087 },
13088
13089 /**
13090 * Gets the value of an attribute.
13091 * @param {String} attr The string name of an attribute.
13092 */
13093 get: function get(attr) {
13094 switch (attr) {
13095 case 'objectId':
13096 return this.id;
13097 case 'createdAt':
13098 case 'updatedAt':
13099 return this[attr];
13100 default:
13101 return this.attributes[attr];
13102 }
13103 },
13104
13105 /**
13106 * Gets a relation on the given class for the attribute.
13107 * @param {String} attr The attribute to get the relation for.
13108 * @return {AV.Relation}
13109 */
13110 relation: function relation(attr) {
13111 var value = this.get(attr);
13112 if (value) {
13113 if (!(value instanceof AV.Relation)) {
13114 throw new Error('Called relation() on non-relation field ' + attr);
13115 }
13116 value._ensureParentAndKey(this, attr);
13117 return value;
13118 } else {
13119 return new AV.Relation(this, attr);
13120 }
13121 },
13122
13123 /**
13124 * Gets the HTML-escaped value of an attribute.
13125 */
13126 escape: function escape(attr) {
13127 var html = this._escapedAttributes[attr];
13128 if (html) {
13129 return html;
13130 }
13131 var val = this.attributes[attr];
13132 var escaped;
13133 if (isNullOrUndefined(val)) {
13134 escaped = '';
13135 } else {
13136 escaped = _.escape(val.toString());
13137 }
13138 this._escapedAttributes[attr] = escaped;
13139 return escaped;
13140 },
13141
13142 /**
13143 * Returns <code>true</code> if the attribute contains a value that is not
13144 * null or undefined.
13145 * @param {String} attr The string name of the attribute.
13146 * @return {Boolean}
13147 */
13148 has: function has(attr) {
13149 return !isNullOrUndefined(this.attributes[attr]);
13150 },
13151
13152 /**
13153 * Pulls "special" fields like objectId, createdAt, etc. out of attrs
13154 * and puts them on "this" directly. Removes them from attrs.
13155 * @param attrs - A dictionary with the data for this AV.Object.
13156 * @private
13157 */
13158 _mergeMagicFields: function _mergeMagicFields(attrs) {
13159 // Check for changes of magic fields.
13160 var model = this;
13161 var specialFields = ['objectId', 'createdAt', 'updatedAt'];
13162 AV._arrayEach(specialFields, function (attr) {
13163 if (attrs[attr]) {
13164 if (attr === 'objectId') {
13165 model.id = attrs[attr];
13166 } else if ((attr === 'createdAt' || attr === 'updatedAt') && !_.isDate(attrs[attr])) {
13167 model[attr] = AV._parseDate(attrs[attr]);
13168 } else {
13169 model[attr] = attrs[attr];
13170 }
13171 delete attrs[attr];
13172 }
13173 });
13174 return attrs;
13175 },
13176
13177 /**
13178 * Returns the json to be sent to the server.
13179 * @private
13180 */
13181 _startSave: function _startSave() {
13182 this._opSetQueue.push({});
13183 },
13184
13185 /**
13186 * Called when a save fails because of an error. Any changes that were part
13187 * of the save need to be merged with changes made after the save. This
13188 * might throw an exception is you do conflicting operations. For example,
13189 * if you do:
13190 * object.set("foo", "bar");
13191 * object.set("invalid field name", "baz");
13192 * object.save();
13193 * object.increment("foo");
13194 * then this will throw when the save fails and the client tries to merge
13195 * "bar" with the +1.
13196 * @private
13197 */
13198 _cancelSave: function _cancelSave() {
13199 var failedChanges = _.first(this._opSetQueue);
13200 this._opSetQueue = _.rest(this._opSetQueue);
13201 var nextChanges = _.first(this._opSetQueue);
13202 AV._objectEach(failedChanges, function (op, key) {
13203 var op1 = failedChanges[key];
13204 var op2 = nextChanges[key];
13205 if (op1 && op2) {
13206 nextChanges[key] = op2._mergeWithPrevious(op1);
13207 } else if (op1) {
13208 nextChanges[key] = op1;
13209 }
13210 });
13211 this._saving = this._saving - 1;
13212 },
13213
13214 /**
13215 * Called when a save completes successfully. This merges the changes that
13216 * were saved into the known server data, and overrides it with any data
13217 * sent directly from the server.
13218 * @private
13219 */
13220 _finishSave: function _finishSave(serverData) {
13221 // Grab a copy of any object referenced by this object. These instances
13222 // may have already been fetched, and we don't want to lose their data.
13223 // Note that doing it like this means we will unify separate copies of the
13224 // same object, but that's a risk we have to take.
13225 var fetchedObjects = {};
13226 AV._traverse(this.attributes, function (object) {
13227 if (object instanceof AV.Object && object.id && object._hasData) {
13228 fetchedObjects[object.id] = object;
13229 }
13230 });
13231
13232 var savedChanges = _.first(this._opSetQueue);
13233 this._opSetQueue = _.rest(this._opSetQueue);
13234 this._applyOpSet(savedChanges, this._serverData);
13235 this._mergeMagicFields(serverData);
13236 var self = this;
13237 AV._objectEach(serverData, function (value, key) {
13238 self._serverData[key] = AV._decode(value, key);
13239
13240 // Look for any objects that might have become unfetched and fix them
13241 // by replacing their values with the previously observed values.
13242 var fetched = AV._traverse(self._serverData[key], function (object) {
13243 if (object instanceof AV.Object && fetchedObjects[object.id]) {
13244 return fetchedObjects[object.id];
13245 }
13246 });
13247 if (fetched) {
13248 self._serverData[key] = fetched;
13249 }
13250 });
13251 this._rebuildAllEstimatedData();
13252 var opSetQueue = this._opSetQueue.map(_.clone);
13253 this._refreshCache();
13254 this._opSetQueue = opSetQueue;
13255 this._saving = this._saving - 1;
13256 },
13257
13258 /**
13259 * Called when a fetch or login is complete to set the known server data to
13260 * the given object.
13261 * @private
13262 */
13263 _finishFetch: function _finishFetch(serverData, hasData) {
13264 // Clear out any changes the user might have made previously.
13265 this._opSetQueue = [{}];
13266
13267 // Bring in all the new server data.
13268 this._mergeMagicFields(serverData);
13269 var self = this;
13270 AV._objectEach(serverData, function (value, key) {
13271 self._serverData[key] = AV._decode(value, key);
13272 });
13273
13274 // Refresh the attributes.
13275 this._rebuildAllEstimatedData();
13276
13277 // Clear out the cache of mutable containers.
13278 this._refreshCache();
13279 this._opSetQueue = [{}];
13280
13281 this._hasData = hasData;
13282 },
13283
13284 /**
13285 * Applies the set of AV.Op in opSet to the object target.
13286 * @private
13287 */
13288 _applyOpSet: function _applyOpSet(opSet, target) {
13289 var self = this;
13290 AV._objectEach(opSet, function (change, key) {
13291 var _findValue = findValue(target, key),
13292 _findValue2 = (0, _slicedToArray3.default)(_findValue, 3),
13293 value = _findValue2[0],
13294 actualTarget = _findValue2[1],
13295 actualKey = _findValue2[2];
13296
13297 setValue(target, key, change._estimate(value, self, key));
13298 if (actualTarget && actualTarget[actualKey] === AV.Op._UNSET) {
13299 delete actualTarget[actualKey];
13300 }
13301 });
13302 },
13303
13304 /**
13305 * Replaces the cached value for key with the current value.
13306 * Returns true if the new value is different than the old value.
13307 * @private
13308 */
13309 _resetCacheForKey: function _resetCacheForKey(key) {
13310 var value = this.attributes[key];
13311 if (_.isObject(value) && !(value instanceof AV.Object) && !(value instanceof AV.File)) {
13312 var json = (0, _stringify2.default)(recursiveToPointer(value));
13313 if (this._hashedJSON[key] !== json) {
13314 var wasSet = !!this._hashedJSON[key];
13315 this._hashedJSON[key] = json;
13316 return wasSet;
13317 }
13318 }
13319 return false;
13320 },
13321
13322 /**
13323 * Populates attributes[key] by starting with the last known data from the
13324 * server, and applying all of the local changes that have been made to that
13325 * key since then.
13326 * @private
13327 */
13328 _rebuildEstimatedDataForKey: function _rebuildEstimatedDataForKey(key) {
13329 var self = this;
13330 delete this.attributes[key];
13331 if (this._serverData[key]) {
13332 this.attributes[key] = this._serverData[key];
13333 }
13334 AV._arrayEach(this._opSetQueue, function (opSet) {
13335 var op = opSet[key];
13336 if (op) {
13337 var _findValue3 = findValue(self.attributes, key),
13338 _findValue4 = (0, _slicedToArray3.default)(_findValue3, 4),
13339 value = _findValue4[0],
13340 actualTarget = _findValue4[1],
13341 actualKey = _findValue4[2],
13342 firstKey = _findValue4[3];
13343
13344 setValue(self.attributes, key, op._estimate(value, self, key));
13345 if (actualTarget && actualTarget[actualKey] === AV.Op._UNSET) {
13346 delete actualTarget[actualKey];
13347 }
13348 self._resetCacheForKey(firstKey);
13349 }
13350 });
13351 },
13352
13353 /**
13354 * Populates attributes by starting with the last known data from the
13355 * server, and applying all of the local changes that have been made since
13356 * then.
13357 * @private
13358 */
13359 _rebuildAllEstimatedData: function _rebuildAllEstimatedData() {
13360 var self = this;
13361
13362 var previousAttributes = _.clone(this.attributes);
13363
13364 this.attributes = _.clone(this._serverData);
13365 AV._arrayEach(this._opSetQueue, function (opSet) {
13366 self._applyOpSet(opSet, self.attributes);
13367 AV._objectEach(opSet, function (op, key) {
13368 self._resetCacheForKey(key);
13369 });
13370 });
13371
13372 // Trigger change events for anything that changed because of the fetch.
13373 AV._objectEach(previousAttributes, function (oldValue, key) {
13374 if (self.attributes[key] !== oldValue) {
13375 self.trigger('change:' + key, self, self.attributes[key], {});
13376 }
13377 });
13378 AV._objectEach(this.attributes, function (newValue, key) {
13379 if (!_.has(previousAttributes, key)) {
13380 self.trigger('change:' + key, self, newValue, {});
13381 }
13382 });
13383 },
13384
13385 /**
13386 * Sets a hash of model attributes on the object, firing
13387 * <code>"change"</code> unless you choose to silence it.
13388 *
13389 * <p>You can call it with an object containing keys and values, or with one
13390 * key and value. For example:</p>
13391 *
13392 * @example
13393 * gameTurn.set({
13394 * player: player1,
13395 * diceRoll: 2
13396 * });
13397 *
13398 * game.set("currentPlayer", player2);
13399 *
13400 * game.set("finished", true);
13401 *
13402 * @param {String} key The key to set.
13403 * @param {Any} value The value to give it.
13404 * @param {Object} [options]
13405 * @param {Boolean} [options.silent]
13406 * @return {AV.Object} self if succeeded, throws if the value is not valid.
13407 * @see AV.Object#validate
13408 */
13409 set: function set(key, value, options) {
13410 var attrs;
13411 if (_.isObject(key) || isNullOrUndefined(key)) {
13412 attrs = _.mapObject(key, function (v, k) {
13413 checkReservedKey(k);
13414 return AV._decode(v, k);
13415 });
13416 options = value;
13417 } else {
13418 attrs = {};
13419 checkReservedKey(key);
13420 attrs[key] = AV._decode(value, key);
13421 }
13422
13423 // Extract attributes and options.
13424 options = options || {};
13425 if (!attrs) {
13426 return this;
13427 }
13428 if (attrs instanceof AV.Object) {
13429 attrs = attrs.attributes;
13430 }
13431
13432 // If the unset option is used, every attribute should be a Unset.
13433 if (options.unset) {
13434 AV._objectEach(attrs, function (unused_value, key) {
13435 attrs[key] = new AV.Op.Unset();
13436 });
13437 }
13438
13439 // Apply all the attributes to get the estimated values.
13440 var dataToValidate = _.clone(attrs);
13441 var self = this;
13442 AV._objectEach(dataToValidate, function (value, key) {
13443 if (value instanceof AV.Op) {
13444 dataToValidate[key] = value._estimate(self.attributes[key], self, key);
13445 if (dataToValidate[key] === AV.Op._UNSET) {
13446 delete dataToValidate[key];
13447 }
13448 }
13449 });
13450
13451 // Run validation.
13452 this._validate(attrs, options);
13453
13454 options.changes = {};
13455 var escaped = this._escapedAttributes;
13456
13457 // Update attributes.
13458 AV._arrayEach(_.keys(attrs), function (attr) {
13459 var val = attrs[attr];
13460
13461 // If this is a relation object we need to set the parent correctly,
13462 // since the location where it was parsed does not have access to
13463 // this object.
13464 if (val instanceof AV.Relation) {
13465 val.parent = self;
13466 }
13467
13468 if (!(val instanceof AV.Op)) {
13469 val = new AV.Op.Set(val);
13470 }
13471
13472 // See if this change will actually have any effect.
13473 var isRealChange = true;
13474 if (val instanceof AV.Op.Set && _.isEqual(self.attributes[attr], val.value)) {
13475 isRealChange = false;
13476 }
13477
13478 if (isRealChange) {
13479 delete escaped[attr];
13480 if (options.silent) {
13481 self._silent[attr] = true;
13482 } else {
13483 options.changes[attr] = true;
13484 }
13485 }
13486
13487 var currentChanges = _.last(self._opSetQueue);
13488 currentChanges[attr] = val._mergeWithPrevious(currentChanges[attr]);
13489 self._rebuildEstimatedDataForKey(attr);
13490
13491 if (isRealChange) {
13492 self.changed[attr] = self.attributes[attr];
13493 if (!options.silent) {
13494 self._pending[attr] = true;
13495 }
13496 } else {
13497 delete self.changed[attr];
13498 delete self._pending[attr];
13499 }
13500 });
13501
13502 if (!options.silent) {
13503 this.change(options);
13504 }
13505 return this;
13506 },
13507
13508 /**
13509 * Remove an attribute from the model, firing <code>"change"</code> unless
13510 * you choose to silence it. This is a noop if the attribute doesn't
13511 * exist.
13512 * @param key {String} The key.
13513 */
13514 unset: function unset(attr, options) {
13515 options = options || {};
13516 options.unset = true;
13517 return this.set(attr, null, options);
13518 },
13519
13520 /**
13521 * Atomically increments the value of the given attribute the next time the
13522 * object is saved. If no amount is specified, 1 is used by default.
13523 *
13524 * @param key {String} The key.
13525 * @param amount {Number} The amount to increment by.
13526 */
13527 increment: function increment(attr, amount) {
13528 if (_.isUndefined(amount) || _.isNull(amount)) {
13529 amount = 1;
13530 }
13531 return this.set(attr, new AV.Op.Increment(amount));
13532 },
13533
13534 /**
13535 * Atomically add an object to the end of the array associated with a given
13536 * key.
13537 * @param key {String} The key.
13538 * @param item {} The item to add.
13539 */
13540 add: function add(attr, item) {
13541 return this.set(attr, new AV.Op.Add(ensureArray(item)));
13542 },
13543
13544 /**
13545 * Atomically add an object to the array associated with a given key, only
13546 * if it is not already present in the array. The position of the insert is
13547 * not guaranteed.
13548 *
13549 * @param key {String} The key.
13550 * @param item {} The object to add.
13551 */
13552 addUnique: function addUnique(attr, item) {
13553 return this.set(attr, new AV.Op.AddUnique(ensureArray(item)));
13554 },
13555
13556 /**
13557 * Atomically remove all instances of an object from the array associated
13558 * with a given key.
13559 *
13560 * @param key {String} The key.
13561 * @param item {} The object to remove.
13562 */
13563 remove: function remove(attr, item) {
13564 return this.set(attr, new AV.Op.Remove(ensureArray(item)));
13565 },
13566
13567 /**
13568 * Atomically apply a "bit and" operation on the value associated with a
13569 * given key.
13570 *
13571 * @param key {String} The key.
13572 * @param value {Number} The value to apply.
13573 */
13574 bitAnd: function bitAnd(attr, value) {
13575 return this.set(attr, new AV.Op.BitAnd(value));
13576 },
13577
13578
13579 /**
13580 * Atomically apply a "bit or" operation on the value associated with a
13581 * given key.
13582 *
13583 * @param key {String} The key.
13584 * @param value {Number} The value to apply.
13585 */
13586 bitOr: function bitOr(attr, value) {
13587 return this.set(attr, new AV.Op.BitOr(value));
13588 },
13589
13590
13591 /**
13592 * Atomically apply a "bit xor" operation on the value associated with a
13593 * given key.
13594 *
13595 * @param key {String} The key.
13596 * @param value {Number} The value to apply.
13597 */
13598 bitXor: function bitXor(attr, value) {
13599 return this.set(attr, new AV.Op.BitXor(value));
13600 },
13601
13602
13603 /**
13604 * Returns an instance of a subclass of AV.Op describing what kind of
13605 * modification has been performed on this field since the last time it was
13606 * saved. For example, after calling object.increment("x"), calling
13607 * object.op("x") would return an instance of AV.Op.Increment.
13608 *
13609 * @param key {String} The key.
13610 * @returns {AV.Op} The operation, or undefined if none.
13611 */
13612 op: function op(attr) {
13613 return _.last(this._opSetQueue)[attr];
13614 },
13615
13616 /**
13617 * Clear all attributes on the model, firing <code>"change"</code> unless
13618 * you choose to silence it.
13619 */
13620 clear: function clear(options) {
13621 options = options || {};
13622 options.unset = true;
13623 var keysToClear = _.extend(this.attributes, this._operations);
13624 return this.set(keysToClear, options);
13625 },
13626
13627 /**
13628 * Clears any (or specific) changes to the model made since the last save.
13629 * @param {string|string[]} [keys] specify keys to revert.
13630 */
13631 revert: function revert(keys) {
13632 var lastOp = _.last(this._opSetQueue);
13633 var _keys = ensureArray(keys || _.keys(lastOp));
13634 _keys.forEach(function (key) {
13635 delete lastOp[key];
13636 });
13637 this._rebuildAllEstimatedData();
13638 return this;
13639 },
13640
13641
13642 /**
13643 * Returns a JSON-encoded set of operations to be sent with the next save
13644 * request.
13645 * @private
13646 */
13647 _getSaveJSON: function _getSaveJSON() {
13648 var json = _.clone(_.first(this._opSetQueue));
13649 AV._objectEach(json, function (op, key) {
13650 json[key] = op.toJSON();
13651 });
13652 return json;
13653 },
13654
13655 /**
13656 * Returns true if this object can be serialized for saving.
13657 * @private
13658 */
13659 _canBeSerialized: function _canBeSerialized() {
13660 return AV.Object._canBeSerializedAsValue(this.attributes);
13661 },
13662
13663 /**
13664 * Fetch the model from the server. If the server's representation of the
13665 * model differs from its current attributes, they will be overriden,
13666 * triggering a <code>"change"</code> event.
13667 * @param {Object} fetchOptions Optional options to set 'keys',
13668 * 'include' and 'includeACL' option.
13669 * @param {AuthOptions} options
13670 * @return {Promise} A promise that is fulfilled when the fetch
13671 * completes.
13672 */
13673 fetch: function fetch() {
13674 var fetchOptions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
13675 var options = arguments[1];
13676
13677 if (!this.id) {
13678 throw new Error('Cannot fetch unsaved object');
13679 }
13680 var self = this;
13681 var request = _request('classes', this.className, this.id, 'GET', transformFetchOptions(fetchOptions), options);
13682 return request.then(function (response) {
13683 var fetchedAttrs = self.parse(response);
13684 self._cleanupUnsetKeys(fetchedAttrs, fetchOptions.keys ? ensureArray(fetchOptions.keys).join(',').split(',') : undefined);
13685 self._finishFetch(fetchedAttrs, true);
13686 return self;
13687 });
13688 },
13689
13690 _cleanupUnsetKeys: function _cleanupUnsetKeys(fetchedAttrs) {
13691 var _this2 = this;
13692
13693 var fetchedKeys = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _.keys(this._serverData);
13694
13695 _.forEach(fetchedKeys, function (key) {
13696 if (fetchedAttrs[key] === undefined) delete _this2._serverData[key];
13697 });
13698 },
13699
13700
13701 /**
13702 * Set a hash of model attributes, and save the model to the server.
13703 * updatedAt will be updated when the request returns.
13704 * You can either call it as:<pre>
13705 * object.save();</pre>
13706 * or<pre>
13707 * object.save(null, options);</pre>
13708 * or<pre>
13709 * object.save(attrs, options);</pre>
13710 * or<pre>
13711 * object.save(key, value, options);</pre>
13712 *
13713 * @example
13714 * gameTurn.save({
13715 * player: "Jake Cutter",
13716 * diceRoll: 2
13717 * }).then(function(gameTurnAgain) {
13718 * // The save was successful.
13719 * }, function(error) {
13720 * // The save failed. Error is an instance of AVError.
13721 * });
13722 *
13723 * @param {AuthOptions} options AuthOptions plus:
13724 * @param {Boolean} options.fetchWhenSave fetch and update object after save succeeded
13725 * @param {AV.Query} options.query Save object only when it matches the query
13726 * @return {Promise} A promise that is fulfilled when the save
13727 * completes.
13728 * @see AVError
13729 */
13730 save: function save(arg1, arg2, arg3) {
13731 var attrs, current, options;
13732 if (_.isObject(arg1) || isNullOrUndefined(arg1)) {
13733 attrs = arg1;
13734 options = arg2;
13735 } else {
13736 attrs = {};
13737 attrs[arg1] = arg2;
13738 options = arg3;
13739 }
13740
13741 options = _.clone(options) || {};
13742 if (options.wait) {
13743 current = _.clone(this.attributes);
13744 }
13745
13746 var setOptions = _.clone(options) || {};
13747 if (setOptions.wait) {
13748 setOptions.silent = true;
13749 }
13750 if (attrs) {
13751 this.set(attrs, setOptions);
13752 }
13753
13754 var model = this;
13755
13756 var unsavedChildren = [];
13757 var unsavedFiles = [];
13758 AV.Object._findUnsavedChildren(model, unsavedChildren, unsavedFiles);
13759 if (unsavedChildren.length + unsavedFiles.length > 1) {
13760 return AV.Object._deepSaveAsync(this, model, options);
13761 }
13762
13763 this._startSave();
13764 this._saving = (this._saving || 0) + 1;
13765
13766 this._allPreviousSaves = this._allPreviousSaves || _promise2.default.resolve();
13767 this._allPreviousSaves = this._allPreviousSaves.catch(function (e) {}).then(function () {
13768 var method = model.id ? 'PUT' : 'POST';
13769
13770 var json = model._getSaveJSON();
13771 var query = {};
13772
13773 if (model._fetchWhenSave || options.fetchWhenSave) {
13774 query['new'] = 'true';
13775 }
13776 // user login option
13777 if (options._failOnNotExist) {
13778 query.failOnNotExist = 'true';
13779 }
13780
13781 if (options.query) {
13782 var queryParams;
13783 if (typeof options.query._getParams === 'function') {
13784 queryParams = options.query._getParams();
13785 if (queryParams) {
13786 query.where = queryParams.where;
13787 }
13788 }
13789 if (!query.where) {
13790 var error = new Error('options.query is not an AV.Query');
13791 throw error;
13792 }
13793 }
13794
13795 _.extend(json, model._flags);
13796
13797 var route = 'classes';
13798 var className = model.className;
13799 if (model.className === '_User' && !model.id) {
13800 // Special-case user sign-up.
13801 route = 'users';
13802 className = null;
13803 }
13804 //hook makeRequest in options.
13805 var makeRequest = options._makeRequest || _request;
13806 var requestPromise = makeRequest(route, className, model.id, method, json, options, query);
13807
13808 requestPromise = requestPromise.then(function (resp) {
13809 var serverAttrs = model.parse(resp);
13810 if (options.wait) {
13811 serverAttrs = _.extend(attrs || {}, serverAttrs);
13812 }
13813 model._finishSave(serverAttrs);
13814 if (options.wait) {
13815 model.set(current, setOptions);
13816 }
13817 return model;
13818 }, function (error) {
13819 model._cancelSave();
13820 throw error;
13821 });
13822
13823 return requestPromise;
13824 });
13825 return this._allPreviousSaves;
13826 },
13827
13828 /**
13829 * Destroy this model on the server if it was already persisted.
13830 * Optimistically removes the model from its collection, if it has one.
13831 * @param {AuthOptions} options AuthOptions plus:
13832 * @param {Boolean} [options.wait] wait for the server to respond
13833 * before removal.
13834 *
13835 * @return {Promise} A promise that is fulfilled when the destroy
13836 * completes.
13837 */
13838 destroy: function destroy(options) {
13839 options = options || {};
13840 var model = this;
13841
13842 var triggerDestroy = function triggerDestroy() {
13843 model.trigger('destroy', model, model.collection, options);
13844 };
13845
13846 if (!this.id) {
13847 return triggerDestroy();
13848 }
13849
13850 if (!options.wait) {
13851 triggerDestroy();
13852 }
13853
13854 var request = _request('classes', this.className, this.id, 'DELETE', this._flags, options);
13855 return request.then(function () {
13856 if (options.wait) {
13857 triggerDestroy();
13858 }
13859 return model;
13860 });
13861 },
13862
13863 /**
13864 * Converts a response into the hash of attributes to be set on the model.
13865 * @ignore
13866 */
13867 parse: function parse(resp) {
13868 var output = _.clone(resp);
13869 ['createdAt', 'updatedAt'].forEach(function (key) {
13870 if (output[key]) {
13871 output[key] = AV._parseDate(output[key]);
13872 }
13873 });
13874 if (output.createdAt && !output.updatedAt) {
13875 output.updatedAt = output.createdAt;
13876 }
13877 return output;
13878 },
13879
13880 /**
13881 * Creates a new model with identical attributes to this one.
13882 * @return {AV.Object}
13883 */
13884 clone: function clone() {
13885 return new this.constructor(this.attributes);
13886 },
13887
13888 /**
13889 * Returns true if this object has never been saved to AV.
13890 * @return {Boolean}
13891 */
13892 isNew: function isNew() {
13893 return !this.id;
13894 },
13895
13896 /**
13897 * Call this method to manually fire a `"change"` event for this model and
13898 * a `"change:attribute"` event for each changed attribute.
13899 * Calling this will cause all objects observing the model to update.
13900 */
13901 change: function change(options) {
13902 options = options || {};
13903 var changing = this._changing;
13904 this._changing = true;
13905
13906 // Silent changes become pending changes.
13907 var self = this;
13908 AV._objectEach(this._silent, function (attr) {
13909 self._pending[attr] = true;
13910 });
13911
13912 // Silent changes are triggered.
13913 var changes = _.extend({}, options.changes, this._silent);
13914 this._silent = {};
13915 AV._objectEach(changes, function (unused_value, attr) {
13916 self.trigger('change:' + attr, self, self.get(attr), options);
13917 });
13918 if (changing) {
13919 return this;
13920 }
13921
13922 // This is to get around lint not letting us make a function in a loop.
13923 var deleteChanged = function deleteChanged(value, attr) {
13924 if (!self._pending[attr] && !self._silent[attr]) {
13925 delete self.changed[attr];
13926 }
13927 };
13928
13929 // Continue firing `"change"` events while there are pending changes.
13930 while (!_.isEmpty(this._pending)) {
13931 this._pending = {};
13932 this.trigger('change', this, options);
13933 // Pending and silent changes still remain.
13934 AV._objectEach(this.changed, deleteChanged);
13935 self._previousAttributes = _.clone(this.attributes);
13936 }
13937
13938 this._changing = false;
13939 return this;
13940 },
13941
13942 /**
13943 * Gets the previous value of an attribute, recorded at the time the last
13944 * <code>"change"</code> event was fired.
13945 * @param {String} attr Name of the attribute to get.
13946 */
13947 previous: function previous(attr) {
13948 if (!arguments.length || !this._previousAttributes) {
13949 return null;
13950 }
13951 return this._previousAttributes[attr];
13952 },
13953
13954 /**
13955 * Gets all of the attributes of the model at the time of the previous
13956 * <code>"change"</code> event.
13957 * @return {Object}
13958 */
13959 previousAttributes: function previousAttributes() {
13960 return _.clone(this._previousAttributes);
13961 },
13962
13963 /**
13964 * Checks if the model is currently in a valid state. It's only possible to
13965 * get into an *invalid* state if you're using silent changes.
13966 * @return {Boolean}
13967 */
13968 isValid: function isValid() {
13969 try {
13970 this.validate(this.attributes);
13971 } catch (error) {
13972 return false;
13973 }
13974 return true;
13975 },
13976
13977 /**
13978 * You should not call this function directly unless you subclass
13979 * <code>AV.Object</code>, in which case you can override this method
13980 * to provide additional validation on <code>set</code> and
13981 * <code>save</code>. Your implementation should throw an Error if
13982 * the attrs is invalid
13983 *
13984 * @param {Object} attrs The current data to validate.
13985 * @see AV.Object#set
13986 */
13987 validate: function validate(attrs) {
13988 if (_.has(attrs, 'ACL') && !(attrs.ACL instanceof AV.ACL)) {
13989 throw new AVError(AVError.OTHER_CAUSE, 'ACL must be a AV.ACL.');
13990 }
13991 },
13992
13993 /**
13994 * Run validation against a set of incoming attributes, returning `true`
13995 * if all is well. If a specific `error` callback has been passed,
13996 * call that instead of firing the general `"error"` event.
13997 * @private
13998 */
13999 _validate: function _validate(attrs, options) {
14000 if (options.silent || !this.validate) {
14001 return;
14002 }
14003 attrs = _.extend({}, this.attributes, attrs);
14004 this.validate(attrs);
14005 },
14006
14007 /**
14008 * Returns the ACL for this object.
14009 * @returns {AV.ACL} An instance of AV.ACL.
14010 * @see AV.Object#get
14011 */
14012 getACL: function getACL() {
14013 return this.get('ACL');
14014 },
14015
14016 /**
14017 * Sets the ACL to be used for this object.
14018 * @param {AV.ACL} acl An instance of AV.ACL.
14019 * @param {Object} options Optional Backbone-like options object to be
14020 * passed in to set.
14021 * @return {AV.Object} self
14022 * @see AV.Object#set
14023 */
14024 setACL: function setACL(acl, options) {
14025 return this.set('ACL', acl, options);
14026 },
14027
14028 disableBeforeHook: function disableBeforeHook() {
14029 this.ignoreHook('beforeSave');
14030 this.ignoreHook('beforeUpdate');
14031 this.ignoreHook('beforeDelete');
14032 },
14033
14034 disableAfterHook: function disableAfterHook() {
14035 this.ignoreHook('afterSave');
14036 this.ignoreHook('afterUpdate');
14037 this.ignoreHook('afterDelete');
14038 },
14039
14040 ignoreHook: function ignoreHook(hookName) {
14041 if (!_.contains(['beforeSave', 'afterSave', 'beforeUpdate', 'afterUpdate', 'beforeDelete', 'afterDelete'], hookName)) {
14042 throw new Error('Unsupported hookName: ' + hookName);
14043 }
14044
14045 if (!AV.hookKey) {
14046 throw new Error('ignoreHook required hookKey');
14047 }
14048
14049 if (!this._flags.__ignore_hooks) {
14050 this._flags.__ignore_hooks = [];
14051 }
14052
14053 this._flags.__ignore_hooks.push(hookName);
14054 }
14055 });
14056
14057 /**
14058 * Creates an instance of a subclass of AV.Object for the give classname
14059 * and id.
14060 * @param {String|Function} class the className or a subclass of AV.Object.
14061 * @param {String} id The object id of this model.
14062 * @return {AV.Object} A new subclass instance of AV.Object.
14063 */
14064 AV.Object.createWithoutData = function (klass, id, hasData) {
14065 var _klass = void 0;
14066 if (_.isString(klass)) {
14067 _klass = AV.Object._getSubclass(klass);
14068 } else if (klass.prototype && klass.prototype instanceof AV.Object) {
14069 _klass = klass;
14070 } else {
14071 throw new Error('class must be a string or a subclass of AV.Object.');
14072 }
14073 if (!id) {
14074 throw new TypeError('The objectId must be provided');
14075 }
14076 var object = new _klass();
14077 object.id = id;
14078 object._hasData = hasData;
14079 return object;
14080 };
14081 /**
14082 * Delete objects in batch.
14083 * @param {AV.Object[]} objects The <code>AV.Object</code> array to be deleted.
14084 * @param {AuthOptions} options
14085 * @return {Promise} A promise that is fulfilled when the save
14086 * completes.
14087 */
14088 AV.Object.destroyAll = function (objects) {
14089 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
14090
14091 if (!objects || objects.length === 0) {
14092 return _promise2.default.resolve();
14093 }
14094 var objectsByClassNameAndFlags = _.groupBy(objects, function (object) {
14095 return (0, _stringify2.default)({
14096 className: object.className,
14097 flags: object._flags
14098 });
14099 });
14100 var body = {
14101 requests: _.map(objectsByClassNameAndFlags, function (objects) {
14102 var ids = _.map(objects, 'id').join(',');
14103 return {
14104 method: 'DELETE',
14105 path: '/1.1/classes/' + objects[0].className + '/' + ids,
14106 body: objects[0]._flags
14107 };
14108 })
14109 };
14110 return _request('batch', null, null, 'POST', body, options).then(function (response) {
14111 var firstError = _.find(response, function (result) {
14112 return !result.success;
14113 });
14114 if (firstError) throw new AVError(firstError.error.code, firstError.error.error);
14115 return undefined;
14116 });
14117 };
14118
14119 /**
14120 * Returns the appropriate subclass for making new instances of the given
14121 * className string.
14122 * @private
14123 */
14124 AV.Object._getSubclass = function (className) {
14125 if (!_.isString(className)) {
14126 throw new Error('AV.Object._getSubclass requires a string argument.');
14127 }
14128 var ObjectClass = AV.Object._classMap[className];
14129 if (!ObjectClass) {
14130 ObjectClass = AV.Object.extend(className);
14131 AV.Object._classMap[className] = ObjectClass;
14132 }
14133 return ObjectClass;
14134 };
14135
14136 /**
14137 * Creates an instance of a subclass of AV.Object for the given classname.
14138 * @private
14139 */
14140 AV.Object._create = function (className, attributes, options) {
14141 var ObjectClass = AV.Object._getSubclass(className);
14142 return new ObjectClass(attributes, options);
14143 };
14144
14145 // Set up a map of className to class so that we can create new instances of
14146 // AV Objects from JSON automatically.
14147 AV.Object._classMap = {};
14148
14149 AV.Object._extend = AV._extend;
14150
14151 /**
14152 * Creates a new model with defined attributes,
14153 * It's the same with
14154 * <pre>
14155 * new AV.Object(attributes, options);
14156 * </pre>
14157 * @param {Object} attributes The initial set of data to store in the object.
14158 * @param {Object} options A set of Backbone-like options for creating the
14159 * object. The only option currently supported is "collection".
14160 * @return {AV.Object}
14161 * @since v0.4.4
14162 * @see AV.Object
14163 * @see AV.Object.extend
14164 */
14165 AV.Object['new'] = function (attributes, options) {
14166 return new AV.Object(attributes, options);
14167 };
14168
14169 /**
14170 * Creates a new subclass of AV.Object for the given AV class name.
14171 *
14172 * <p>Every extension of a AV class will inherit from the most recent
14173 * previous extension of that class. When a AV.Object is automatically
14174 * created by parsing JSON, it will use the most recent extension of that
14175 * class.</p>
14176 *
14177 * @example
14178 * var MyClass = AV.Object.extend("MyClass", {
14179 * // Instance properties
14180 * }, {
14181 * // Class properties
14182 * });
14183 *
14184 * @param {String} className The name of the AV class backing this model.
14185 * @param {Object} protoProps Instance properties to add to instances of the
14186 * class returned from this method.
14187 * @param {Object} classProps Class properties to add the class returned from
14188 * this method.
14189 * @return {Class} A new subclass of AV.Object.
14190 */
14191 AV.Object.extend = function (className, protoProps, classProps) {
14192 // Handle the case with only two args.
14193 if (!_.isString(className)) {
14194 if (className && _.has(className, 'className')) {
14195 return AV.Object.extend(className.className, className, protoProps);
14196 } else {
14197 throw new Error("AV.Object.extend's first argument should be the className.");
14198 }
14199 }
14200
14201 // If someone tries to subclass "User", coerce it to the right type.
14202 if (className === 'User') {
14203 className = '_User';
14204 }
14205
14206 var NewClassObject = null;
14207 if (_.has(AV.Object._classMap, className)) {
14208 var OldClassObject = AV.Object._classMap[className];
14209 // This new subclass has been told to extend both from "this" and from
14210 // OldClassObject. This is multiple inheritance, which isn't supported.
14211 // For now, let's just pick one.
14212 if (protoProps || classProps) {
14213 NewClassObject = OldClassObject._extend(protoProps, classProps);
14214 } else {
14215 return OldClassObject;
14216 }
14217 } else {
14218 protoProps = protoProps || {};
14219 protoProps._className = className;
14220 NewClassObject = this._extend(protoProps, classProps);
14221 }
14222 // Extending a subclass should reuse the classname automatically.
14223 NewClassObject.extend = function (arg0) {
14224 if (_.isString(arg0) || arg0 && _.has(arg0, 'className')) {
14225 return AV.Object.extend.apply(NewClassObject, arguments);
14226 }
14227 var newArguments = [className].concat(_.toArray(arguments));
14228 return AV.Object.extend.apply(NewClassObject, newArguments);
14229 };
14230 // Add the query property descriptor.
14231 Object.defineProperty(NewClassObject, 'query', (0, _getOwnPropertyDescriptor2.default)(AV.Object, 'query'));
14232 NewClassObject['new'] = function (attributes, options) {
14233 return new NewClassObject(attributes, options);
14234 };
14235 AV.Object._classMap[className] = NewClassObject;
14236 return NewClassObject;
14237 };
14238
14239 // ES6 class syntax support
14240 Object.defineProperty(AV.Object.prototype, 'className', {
14241 get: function get() {
14242 var className = this._className || this.constructor._LCClassName || this.constructor.name;
14243 // If someone tries to subclass "User", coerce it to the right type.
14244 if (className === 'User') {
14245 return '_User';
14246 }
14247 return className;
14248 }
14249 });
14250
14251 /**
14252 * Register a class.
14253 * If a subclass of <code>AV.Object</code> is defined with your own implement
14254 * rather then <code>AV.Object.extend</code>, the subclass must be registered.
14255 * @param {Function} klass A subclass of <code>AV.Object</code>
14256 * @param {String} [name] Specify the name of the class. Useful when the class might be uglified.
14257 * @example
14258 * class Person extend AV.Object {}
14259 * AV.Object.register(Person);
14260 */
14261 AV.Object.register = function (klass, name) {
14262 if (!(klass.prototype instanceof AV.Object)) {
14263 throw new Error('registered class is not a subclass of AV.Object');
14264 }
14265 var className = name || klass.name;
14266 if (!className.length) {
14267 throw new Error('registered class must be named');
14268 }
14269 if (name) {
14270 klass._LCClassName = name;
14271 }
14272 AV.Object._classMap[className] = klass;
14273 };
14274
14275 /**
14276 * Get a new Query of the current class
14277 * @name query
14278 * @memberof AV.Object
14279 * @type AV.Query
14280 * @readonly
14281 * @since v3.1.0
14282 * @example
14283 * const Post = AV.Object.extend('Post');
14284 * Post.query.equalTo('author', 'leancloud').find().then();
14285 */
14286 Object.defineProperty(AV.Object, 'query', {
14287 get: function get() {
14288 return new AV.Query(this.prototype.className);
14289 }
14290 });
14291
14292 AV.Object._findUnsavedChildren = function (objects, children, files) {
14293 AV._traverse(objects, function (object) {
14294 if (object instanceof AV.Object) {
14295 if (object.dirty()) {
14296 children.push(object);
14297 }
14298 return;
14299 }
14300
14301 if (object instanceof AV.File) {
14302 if (!object.id) {
14303 files.push(object);
14304 }
14305 return;
14306 }
14307 });
14308 };
14309
14310 AV.Object._canBeSerializedAsValue = function (object) {
14311 var canBeSerializedAsValue = true;
14312
14313 if (object instanceof AV.Object || object instanceof AV.File) {
14314 canBeSerializedAsValue = !!object.id;
14315 } else if (_.isArray(object)) {
14316 AV._arrayEach(object, function (child) {
14317 if (!AV.Object._canBeSerializedAsValue(child)) {
14318 canBeSerializedAsValue = false;
14319 }
14320 });
14321 } else if (_.isObject(object)) {
14322 AV._objectEach(object, function (child) {
14323 if (!AV.Object._canBeSerializedAsValue(child)) {
14324 canBeSerializedAsValue = false;
14325 }
14326 });
14327 }
14328
14329 return canBeSerializedAsValue;
14330 };
14331
14332 AV.Object._deepSaveAsync = function (object, model, options) {
14333 var unsavedChildren = [];
14334 var unsavedFiles = [];
14335 AV.Object._findUnsavedChildren(object, unsavedChildren, unsavedFiles);
14336
14337 unsavedFiles = _.uniq(unsavedFiles);
14338
14339 var promise = _promise2.default.resolve();
14340 _.each(unsavedFiles, function (file) {
14341 promise = promise.then(function () {
14342 return file.save();
14343 });
14344 });
14345
14346 var objects = _.uniq(unsavedChildren);
14347 var remaining = _.uniq(objects);
14348
14349 return promise.then(function () {
14350 return continueWhile(function () {
14351 return remaining.length > 0;
14352 }, function () {
14353 // Gather up all the objects that can be saved in this batch.
14354 var batch = [];
14355 var newRemaining = [];
14356 AV._arrayEach(remaining, function (object) {
14357 if (object._canBeSerialized()) {
14358 batch.push(object);
14359 } else {
14360 newRemaining.push(object);
14361 }
14362 });
14363 remaining = newRemaining;
14364
14365 // If we can't save any objects, there must be a circular reference.
14366 if (batch.length === 0) {
14367 return _promise2.default.reject(new AVError(AVError.OTHER_CAUSE, 'Tried to save a batch with a cycle.'));
14368 }
14369
14370 // Reserve a spot in every object's save queue.
14371 var readyToStart = _promise2.default.resolve(_.map(batch, function (object) {
14372 return object._allPreviousSaves || _promise2.default.resolve();
14373 }));
14374
14375 // Save a single batch, whether previous saves succeeded or failed.
14376 var bathSavePromise = readyToStart.then(function () {
14377 return _request('batch', null, null, 'POST', {
14378 requests: _.map(batch, function (object) {
14379 var method = object.id ? 'PUT' : 'POST';
14380
14381 var json = object._getSaveJSON();
14382
14383 _.extend(json, object._flags);
14384
14385 var route = 'classes';
14386 var className = object.className;
14387 var path = '/' + route + '/' + className;
14388 if (object.className === '_User' && !object.id) {
14389 // Special-case user sign-up.
14390 path = '/users';
14391 }
14392
14393 var path = '/1.1' + path;
14394 if (object.id) {
14395 path = path + '/' + object.id;
14396 }
14397
14398 object._startSave();
14399
14400 return {
14401 method: method,
14402 path: path,
14403 body: json,
14404 params: options && options.fetchWhenSave ? { fetchWhenSave: true } : undefined
14405 };
14406 })
14407 }, options).then(function (response) {
14408 var results = _.map(batch, function (object, i) {
14409 if (response[i].success) {
14410 object._finishSave(object.parse(response[i].success));
14411 return object;
14412 }
14413 object._cancelSave();
14414 return new AVError(response[i].error.code, response[i].error.error);
14415 });
14416 return handleBatchResults(results);
14417 });
14418 });
14419 AV._arrayEach(batch, function (object) {
14420 object._allPreviousSaves = bathSavePromise;
14421 });
14422 return bathSavePromise;
14423 });
14424 }).then(function () {
14425 return object;
14426 });
14427 };
14428};
14429
14430/***/ }),
14431/* 314 */
14432/***/ (function(module, exports, __webpack_require__) {
14433
14434module.exports = { "default": __webpack_require__(315), __esModule: true };
14435
14436/***/ }),
14437/* 315 */
14438/***/ (function(module, exports, __webpack_require__) {
14439
14440__webpack_require__(316);
14441var $Object = __webpack_require__(2).Object;
14442module.exports = function getOwnPropertyDescriptor(it, key) {
14443 return $Object.getOwnPropertyDescriptor(it, key);
14444};
14445
14446
14447/***/ }),
14448/* 316 */
14449/***/ (function(module, exports, __webpack_require__) {
14450
14451// 19.1.2.6 Object.getOwnPropertyDescriptor(O, P)
14452var toIObject = __webpack_require__(25);
14453var $getOwnPropertyDescriptor = __webpack_require__(90).f;
14454
14455__webpack_require__(85)('getOwnPropertyDescriptor', function () {
14456 return function getOwnPropertyDescriptor(it, key) {
14457 return $getOwnPropertyDescriptor(toIObject(it), key);
14458 };
14459});
14460
14461
14462/***/ }),
14463/* 317 */
14464/***/ (function(module, exports, __webpack_require__) {
14465
14466"use strict";
14467
14468
14469exports.__esModule = true;
14470
14471var _isIterable2 = __webpack_require__(318);
14472
14473var _isIterable3 = _interopRequireDefault(_isIterable2);
14474
14475var _getIterator2 = __webpack_require__(162);
14476
14477var _getIterator3 = _interopRequireDefault(_getIterator2);
14478
14479function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14480
14481exports.default = function () {
14482 function sliceIterator(arr, i) {
14483 var _arr = [];
14484 var _n = true;
14485 var _d = false;
14486 var _e = undefined;
14487
14488 try {
14489 for (var _i = (0, _getIterator3.default)(arr), _s; !(_n = (_s = _i.next()).done); _n = true) {
14490 _arr.push(_s.value);
14491
14492 if (i && _arr.length === i) break;
14493 }
14494 } catch (err) {
14495 _d = true;
14496 _e = err;
14497 } finally {
14498 try {
14499 if (!_n && _i["return"]) _i["return"]();
14500 } finally {
14501 if (_d) throw _e;
14502 }
14503 }
14504
14505 return _arr;
14506 }
14507
14508 return function (arr, i) {
14509 if (Array.isArray(arr)) {
14510 return arr;
14511 } else if ((0, _isIterable3.default)(Object(arr))) {
14512 return sliceIterator(arr, i);
14513 } else {
14514 throw new TypeError("Invalid attempt to destructure non-iterable instance");
14515 }
14516 };
14517}();
14518
14519/***/ }),
14520/* 318 */
14521/***/ (function(module, exports, __webpack_require__) {
14522
14523module.exports = { "default": __webpack_require__(319), __esModule: true };
14524
14525/***/ }),
14526/* 319 */
14527/***/ (function(module, exports, __webpack_require__) {
14528
14529__webpack_require__(54);
14530__webpack_require__(47);
14531module.exports = __webpack_require__(320);
14532
14533
14534/***/ }),
14535/* 320 */
14536/***/ (function(module, exports, __webpack_require__) {
14537
14538var classof = __webpack_require__(68);
14539var ITERATOR = __webpack_require__(7)('iterator');
14540var Iterators = __webpack_require__(30);
14541module.exports = __webpack_require__(2).isIterable = function (it) {
14542 var O = Object(it);
14543 return O[ITERATOR] !== undefined
14544 || '@@iterator' in O
14545 // eslint-disable-next-line no-prototype-builtins
14546 || Iterators.hasOwnProperty(classof(O));
14547};
14548
14549
14550/***/ }),
14551/* 321 */
14552/***/ (function(module, exports, __webpack_require__) {
14553
14554"use strict";
14555
14556
14557var _ = __webpack_require__(0);
14558var AVError = __webpack_require__(29);
14559
14560module.exports = function (AV) {
14561 AV.Role = AV.Object.extend('_Role',
14562 /** @lends AV.Role.prototype */{
14563 // Instance Methods
14564
14565 /**
14566 * Represents a Role on the AV server. Roles represent groupings of
14567 * Users for the purposes of granting permissions (e.g. specifying an ACL
14568 * for an Object). Roles are specified by their sets of child users and
14569 * child roles, all of which are granted any permissions that the parent
14570 * role has.
14571 *
14572 * <p>Roles must have a name (which cannot be changed after creation of the
14573 * role), and must specify an ACL.</p>
14574 * An AV.Role is a local representation of a role persisted to the AV
14575 * cloud.
14576 * @class AV.Role
14577 * @param {String} name The name of the Role to create.
14578 * @param {AV.ACL} acl The ACL for this role.
14579 */
14580 constructor: function constructor(name, acl) {
14581 if (_.isString(name)) {
14582 AV.Object.prototype.constructor.call(this, null, null);
14583 this.setName(name);
14584 } else {
14585 AV.Object.prototype.constructor.call(this, name, acl);
14586 }
14587 if (acl) {
14588 if (!(acl instanceof AV.ACL)) {
14589 throw new TypeError('acl must be an instance of AV.ACL');
14590 } else {
14591 this.setACL(acl);
14592 }
14593 }
14594 },
14595
14596 /**
14597 * Gets the name of the role. You can alternatively call role.get("name")
14598 *
14599 * @return {String} the name of the role.
14600 */
14601 getName: function getName() {
14602 return this.get('name');
14603 },
14604
14605 /**
14606 * Sets the name for a role. This value must be set before the role has
14607 * been saved to the server, and cannot be set once the role has been
14608 * saved.
14609 *
14610 * <p>
14611 * A role's name can only contain alphanumeric characters, _, -, and
14612 * spaces.
14613 * </p>
14614 *
14615 * <p>This is equivalent to calling role.set("name", name)</p>
14616 *
14617 * @param {String} name The name of the role.
14618 */
14619 setName: function setName(name, options) {
14620 return this.set('name', name, options);
14621 },
14622
14623 /**
14624 * Gets the AV.Relation for the AV.Users that are direct
14625 * children of this role. These users are granted any privileges that this
14626 * role has been granted (e.g. read or write access through ACLs). You can
14627 * add or remove users from the role through this relation.
14628 *
14629 * <p>This is equivalent to calling role.relation("users")</p>
14630 *
14631 * @return {AV.Relation} the relation for the users belonging to this
14632 * role.
14633 */
14634 getUsers: function getUsers() {
14635 return this.relation('users');
14636 },
14637
14638 /**
14639 * Gets the AV.Relation for the AV.Roles that are direct
14640 * children of this role. These roles' users are granted any privileges that
14641 * this role has been granted (e.g. read or write access through ACLs). You
14642 * can add or remove child roles from this role through this relation.
14643 *
14644 * <p>This is equivalent to calling role.relation("roles")</p>
14645 *
14646 * @return {AV.Relation} the relation for the roles belonging to this
14647 * role.
14648 */
14649 getRoles: function getRoles() {
14650 return this.relation('roles');
14651 },
14652
14653 /**
14654 * @ignore
14655 */
14656 validate: function validate(attrs, options) {
14657 if ('name' in attrs && attrs.name !== this.getName()) {
14658 var newName = attrs.name;
14659 if (this.id && this.id !== attrs.objectId) {
14660 // Check to see if the objectId being set matches this.id.
14661 // This happens during a fetch -- the id is set before calling fetch.
14662 // Let the name be set in this case.
14663 return new AVError(AVError.OTHER_CAUSE, "A role's name can only be set before it has been saved.");
14664 }
14665 if (!_.isString(newName)) {
14666 return new AVError(AVError.OTHER_CAUSE, "A role's name must be a String.");
14667 }
14668 if (!/^[0-9a-zA-Z\-_ ]+$/.test(newName)) {
14669 return new AVError(AVError.OTHER_CAUSE, "A role's name can only contain alphanumeric characters, _," + ' -, and spaces.');
14670 }
14671 }
14672 if (AV.Object.prototype.validate) {
14673 return AV.Object.prototype.validate.call(this, attrs, options);
14674 }
14675 return false;
14676 }
14677 });
14678};
14679
14680/***/ }),
14681/* 322 */
14682/***/ (function(module, exports, __webpack_require__) {
14683
14684"use strict";
14685
14686
14687var _stringify = __webpack_require__(18);
14688
14689var _stringify2 = _interopRequireDefault(_stringify);
14690
14691var _defineProperty2 = __webpack_require__(323);
14692
14693var _defineProperty3 = _interopRequireDefault(_defineProperty2);
14694
14695var _promise = __webpack_require__(4);
14696
14697var _promise2 = _interopRequireDefault(_promise);
14698
14699function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14700
14701var _ = __webpack_require__(0);
14702var uuid = __webpack_require__(154);
14703var AVError = __webpack_require__(29);
14704
14705var _require = __webpack_require__(12),
14706 AVRequest = _require._request,
14707 request = _require.request;
14708
14709var _require2 = __webpack_require__(36),
14710 getAdapter = _require2.getAdapter;
14711
14712var PLATFORM_ANONYMOUS = 'anonymous';
14713var PLATFORM_QQAPP = 'lc_qqapp';
14714
14715var mergeUnionDataIntoAuthData = function mergeUnionDataIntoAuthData() {
14716 var defaultUnionIdPlatform = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'weixin';
14717 return function (authData, unionId) {
14718 var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
14719 _ref$unionIdPlatform = _ref.unionIdPlatform,
14720 unionIdPlatform = _ref$unionIdPlatform === undefined ? defaultUnionIdPlatform : _ref$unionIdPlatform,
14721 _ref$asMainAccount = _ref.asMainAccount,
14722 asMainAccount = _ref$asMainAccount === undefined ? false : _ref$asMainAccount;
14723
14724 if (typeof unionId !== 'string') throw new AVError(AVError.OTHER_CAUSE, 'unionId is not a string');
14725 if (typeof unionIdPlatform !== 'string') throw new AVError(AVError.OTHER_CAUSE, 'unionIdPlatform is not a string');
14726
14727 return _.extend({}, authData, {
14728 platform: unionIdPlatform,
14729 unionid: unionId,
14730 main_account: Boolean(asMainAccount)
14731 });
14732 };
14733};
14734
14735module.exports = function (AV) {
14736 /**
14737 * @class
14738 *
14739 * <p>An AV.User object is a local representation of a user persisted to the
14740 * LeanCloud server. This class is a subclass of an AV.Object, and retains the
14741 * same functionality of an AV.Object, but also extends it with various
14742 * user specific methods, like authentication, signing up, and validation of
14743 * uniqueness.</p>
14744 */
14745 AV.User = AV.Object.extend('_User',
14746 /** @lends AV.User.prototype */{
14747 // Instance Variables
14748 _isCurrentUser: false,
14749
14750 // Instance Methods
14751
14752 /**
14753 * Internal method to handle special fields in a _User response.
14754 * @private
14755 */
14756 _mergeMagicFields: function _mergeMagicFields(attrs) {
14757 if (attrs.sessionToken) {
14758 this._sessionToken = attrs.sessionToken;
14759 delete attrs.sessionToken;
14760 }
14761 return AV.User.__super__._mergeMagicFields.call(this, attrs);
14762 },
14763
14764 /**
14765 * Removes null values from authData (which exist temporarily for
14766 * unlinking)
14767 * @private
14768 */
14769 _cleanupAuthData: function _cleanupAuthData() {
14770 if (!this.isCurrent()) {
14771 return;
14772 }
14773 var authData = this.get('authData');
14774 if (!authData) {
14775 return;
14776 }
14777 AV._objectEach(this.get('authData'), function (value, key) {
14778 if (!authData[key]) {
14779 delete authData[key];
14780 }
14781 });
14782 },
14783
14784 /**
14785 * Synchronizes authData for all providers.
14786 * @private
14787 */
14788 _synchronizeAllAuthData: function _synchronizeAllAuthData() {
14789 var authData = this.get('authData');
14790 if (!authData) {
14791 return;
14792 }
14793
14794 var self = this;
14795 AV._objectEach(this.get('authData'), function (value, key) {
14796 self._synchronizeAuthData(key);
14797 });
14798 },
14799
14800 /**
14801 * Synchronizes auth data for a provider (e.g. puts the access token in the
14802 * right place to be used by the Facebook SDK).
14803 * @private
14804 */
14805 _synchronizeAuthData: function _synchronizeAuthData(provider) {
14806 if (!this.isCurrent()) {
14807 return;
14808 }
14809 var authType;
14810 if (_.isString(provider)) {
14811 authType = provider;
14812 provider = AV.User._authProviders[authType];
14813 } else {
14814 authType = provider.getAuthType();
14815 }
14816 var authData = this.get('authData');
14817 if (!authData || !provider) {
14818 return;
14819 }
14820 var success = provider.restoreAuthentication(authData[authType]);
14821 if (!success) {
14822 this.dissociateAuthData(provider);
14823 }
14824 },
14825
14826 _handleSaveResult: function _handleSaveResult(makeCurrent) {
14827 // Clean up and synchronize the authData object, removing any unset values
14828 if (makeCurrent && !AV._config.disableCurrentUser) {
14829 this._isCurrentUser = true;
14830 }
14831 this._cleanupAuthData();
14832 this._synchronizeAllAuthData();
14833 // Don't keep the password around.
14834 delete this._serverData.password;
14835 this._rebuildEstimatedDataForKey('password');
14836 this._refreshCache();
14837 if ((makeCurrent || this.isCurrent()) && !AV._config.disableCurrentUser) {
14838 // Some old version of leanengine-node-sdk will overwrite
14839 // AV.User._saveCurrentUser which returns no Promise.
14840 // So we need a Promise wrapper.
14841 return _promise2.default.resolve(AV.User._saveCurrentUser(this));
14842 } else {
14843 return _promise2.default.resolve();
14844 }
14845 },
14846
14847 /**
14848 * Unlike in the Android/iOS SDKs, logInWith is unnecessary, since you can
14849 * call linkWith on the user (even if it doesn't exist yet on the server).
14850 * @private
14851 */
14852 _linkWith: function _linkWith(provider, data) {
14853 var _this = this;
14854
14855 var _ref2 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
14856 _ref2$failOnNotExist = _ref2.failOnNotExist,
14857 failOnNotExist = _ref2$failOnNotExist === undefined ? false : _ref2$failOnNotExist;
14858
14859 var authType;
14860 if (_.isString(provider)) {
14861 authType = provider;
14862 provider = AV.User._authProviders[provider];
14863 } else {
14864 authType = provider.getAuthType();
14865 }
14866 if (data) {
14867 return this.save({ authData: (0, _defineProperty3.default)({}, authType, data) }, {
14868 fetchWhenSave: !!this.get('authData'),
14869 _failOnNotExist: failOnNotExist
14870 }).then(function (model) {
14871 return model._handleSaveResult(true).then(function () {
14872 return model;
14873 });
14874 });
14875 } else {
14876 return provider.authenticate().then(function (result) {
14877 return _this._linkWith(provider, result);
14878 });
14879 }
14880 },
14881
14882 /**
14883 * Associate the user with a third party authData.
14884 * @since 3.3.0
14885 * @param {Object} authData The response json data returned from third party token, maybe like { openid: 'abc123', access_token: '123abc', expires_in: 1382686496 }
14886 * @param {string} platform Available platform for sign up.
14887 * @return {Promise<AV.User>} A promise that is fulfilled with the user when completed.
14888 * @example user.associateWithAuthData({
14889 * openid: 'abc123',
14890 * access_token: '123abc',
14891 * expires_in: 1382686496
14892 * }, 'weixin').then(function(user) {
14893 * //Access user here
14894 * }).catch(function(error) {
14895 * //console.error("error: ", error);
14896 * });
14897 */
14898 associateWithAuthData: function associateWithAuthData(authData, platform) {
14899 return this._linkWith(platform, authData);
14900 },
14901
14902
14903 /**
14904 * Associate the user with a third party authData and unionId.
14905 * @since 3.5.0
14906 * @param {Object} authData The response json data returned from third party token, maybe like { openid: 'abc123', access_token: '123abc', expires_in: 1382686496 }
14907 * @param {string} platform Available platform for sign up.
14908 * @param {string} unionId
14909 * @param {Object} [unionLoginOptions]
14910 * @param {string} [unionLoginOptions.unionIdPlatform = 'weixin'] unionId platform
14911 * @param {boolean} [unionLoginOptions.asMainAccount = false] If true, the unionId will be associated with the user.
14912 * @return {Promise<AV.User>} A promise that is fulfilled with the user when completed.
14913 * @example user.associateWithAuthDataAndUnionId({
14914 * openid: 'abc123',
14915 * access_token: '123abc',
14916 * expires_in: 1382686496
14917 * }, 'weixin', 'union123', {
14918 * unionIdPlatform: 'weixin',
14919 * asMainAccount: true,
14920 * }).then(function(user) {
14921 * //Access user here
14922 * }).catch(function(error) {
14923 * //console.error("error: ", error);
14924 * });
14925 */
14926 associateWithAuthDataAndUnionId: function associateWithAuthDataAndUnionId(authData, platform, unionId, unionOptions) {
14927 return this._linkWith(platform, mergeUnionDataIntoAuthData()(authData, unionId, unionOptions));
14928 },
14929
14930
14931 /**
14932 * Associate the user with the identity of the current mini-app.
14933 * @since 4.6.0
14934 * @param {Object} [authInfo]
14935 * @param {Object} [option]
14936 * @param {Boolean} [option.failOnNotExist] If true, the login request will fail when no user matches this authInfo.authData exists.
14937 * @return {Promise<AV.User>}
14938 */
14939 associateWithMiniApp: function associateWithMiniApp(authInfo, option) {
14940 var _this2 = this;
14941
14942 if (authInfo === undefined) {
14943 var getAuthInfo = getAdapter('getAuthInfo');
14944 return getAuthInfo().then(function (authInfo) {
14945 return _this2._linkWith(authInfo.provider, authInfo.authData, option);
14946 });
14947 }
14948 return this._linkWith(authInfo.provider, authInfo.authData, option);
14949 },
14950
14951
14952 /**
14953 * 将用户与 QQ 小程序用户进行关联。适用于为已经在用户系统中存在的用户关联当前使用 QQ 小程序的微信帐号。
14954 * 仅在 QQ 小程序中可用。
14955 *
14956 * @deprecated Please use {@link AV.User#associateWithMiniApp}
14957 * @since 4.2.0
14958 * @param {Object} [options]
14959 * @param {boolean} [options.preferUnionId = false] 如果服务端在登录时获取到了用户的 UnionId,是否将 UnionId 保存在用户账号中。
14960 * @param {string} [options.unionIdPlatform = 'qq'] (only take effect when preferUnionId) unionId platform
14961 * @param {boolean} [options.asMainAccount = true] (only take effect when preferUnionId) If true, the unionId will be associated with the user.
14962 * @return {Promise<AV.User>}
14963 */
14964 associateWithQQApp: function associateWithQQApp() {
14965 var _this3 = this;
14966
14967 var _ref3 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
14968 _ref3$preferUnionId = _ref3.preferUnionId,
14969 preferUnionId = _ref3$preferUnionId === undefined ? false : _ref3$preferUnionId,
14970 _ref3$unionIdPlatform = _ref3.unionIdPlatform,
14971 unionIdPlatform = _ref3$unionIdPlatform === undefined ? 'qq' : _ref3$unionIdPlatform,
14972 _ref3$asMainAccount = _ref3.asMainAccount,
14973 asMainAccount = _ref3$asMainAccount === undefined ? true : _ref3$asMainAccount;
14974
14975 var getAuthInfo = getAdapter('getAuthInfo');
14976 return getAuthInfo({
14977 preferUnionId: preferUnionId,
14978 asMainAccount: asMainAccount,
14979 platform: unionIdPlatform
14980 }).then(function (authInfo) {
14981 authInfo.provider = PLATFORM_QQAPP;
14982 return _this3.associateWithMiniApp(authInfo);
14983 });
14984 },
14985
14986
14987 /**
14988 * 将用户与微信小程序用户进行关联。适用于为已经在用户系统中存在的用户关联当前使用微信小程序的微信帐号。
14989 * 仅在微信小程序中可用。
14990 *
14991 * @deprecated Please use {@link AV.User#associateWithMiniApp}
14992 * @since 3.13.0
14993 * @param {Object} [options]
14994 * @param {boolean} [options.preferUnionId = false] 当用户满足 {@link https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/union-id.html 获取 UnionId 的条件} 时,是否将 UnionId 保存在用户账号中。
14995 * @param {string} [options.unionIdPlatform = 'weixin'] (only take effect when preferUnionId) unionId platform
14996 * @param {boolean} [options.asMainAccount = true] (only take effect when preferUnionId) If true, the unionId will be associated with the user.
14997 * @return {Promise<AV.User>}
14998 */
14999 associateWithWeapp: function associateWithWeapp() {
15000 var _this4 = this;
15001
15002 var _ref4 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
15003 _ref4$preferUnionId = _ref4.preferUnionId,
15004 preferUnionId = _ref4$preferUnionId === undefined ? false : _ref4$preferUnionId,
15005 _ref4$unionIdPlatform = _ref4.unionIdPlatform,
15006 unionIdPlatform = _ref4$unionIdPlatform === undefined ? 'weixin' : _ref4$unionIdPlatform,
15007 _ref4$asMainAccount = _ref4.asMainAccount,
15008 asMainAccount = _ref4$asMainAccount === undefined ? true : _ref4$asMainAccount;
15009
15010 var getAuthInfo = getAdapter('getAuthInfo');
15011 return getAuthInfo({
15012 preferUnionId: preferUnionId,
15013 asMainAccount: asMainAccount,
15014 platform: unionIdPlatform
15015 }).then(function (authInfo) {
15016 return _this4.associateWithMiniApp(authInfo);
15017 });
15018 },
15019
15020
15021 /**
15022 * @deprecated renamed to {@link AV.User#associateWithWeapp}
15023 * @return {Promise<AV.User>}
15024 */
15025 linkWithWeapp: function linkWithWeapp(options) {
15026 console.warn('DEPRECATED: User#linkWithWeapp 已废弃,请使用 User#associateWithWeapp 代替');
15027 return this.associateWithWeapp(options);
15028 },
15029
15030
15031 /**
15032 * 将用户与 QQ 小程序用户进行关联。适用于为已经在用户系统中存在的用户关联当前使用 QQ 小程序的 QQ 帐号。
15033 * 仅在 QQ 小程序中可用。
15034 *
15035 * @deprecated Please use {@link AV.User#associateWithMiniApp}
15036 * @since 4.2.0
15037 * @param {string} unionId
15038 * @param {Object} [unionOptions]
15039 * @param {string} [unionOptions.unionIdPlatform = 'qq'] unionId platform
15040 * @param {boolean} [unionOptions.asMainAccount = false] If true, the unionId will be associated with the user.
15041 * @return {Promise<AV.User>}
15042 */
15043 associateWithQQAppWithUnionId: function associateWithQQAppWithUnionId(unionId) {
15044 var _this5 = this;
15045
15046 var _ref5 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
15047 _ref5$unionIdPlatform = _ref5.unionIdPlatform,
15048 unionIdPlatform = _ref5$unionIdPlatform === undefined ? 'qq' : _ref5$unionIdPlatform,
15049 _ref5$asMainAccount = _ref5.asMainAccount,
15050 asMainAccount = _ref5$asMainAccount === undefined ? false : _ref5$asMainAccount;
15051
15052 var getAuthInfo = getAdapter('getAuthInfo');
15053 return getAuthInfo({ platform: unionIdPlatform }).then(function (authInfo) {
15054 authInfo = AV.User.mergeUnionId(authInfo, unionId, { asMainAccount: asMainAccount });
15055 authInfo.provider = PLATFORM_QQAPP;
15056 return _this5.associateWithMiniApp(authInfo);
15057 });
15058 },
15059
15060
15061 /**
15062 * 将用户与微信小程序用户进行关联。适用于为已经在用户系统中存在的用户关联当前使用微信小程序的微信帐号。
15063 * 仅在微信小程序中可用。
15064 *
15065 * @deprecated Please use {@link AV.User#associateWithMiniApp}
15066 * @since 3.13.0
15067 * @param {string} unionId
15068 * @param {Object} [unionOptions]
15069 * @param {string} [unionOptions.unionIdPlatform = 'weixin'] unionId platform
15070 * @param {boolean} [unionOptions.asMainAccount = false] If true, the unionId will be associated with the user.
15071 * @return {Promise<AV.User>}
15072 */
15073 associateWithWeappWithUnionId: function associateWithWeappWithUnionId(unionId) {
15074 var _this6 = this;
15075
15076 var _ref6 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
15077 _ref6$unionIdPlatform = _ref6.unionIdPlatform,
15078 unionIdPlatform = _ref6$unionIdPlatform === undefined ? 'weixin' : _ref6$unionIdPlatform,
15079 _ref6$asMainAccount = _ref6.asMainAccount,
15080 asMainAccount = _ref6$asMainAccount === undefined ? false : _ref6$asMainAccount;
15081
15082 var getAuthInfo = getAdapter('getAuthInfo');
15083 return getAuthInfo({ platform: unionIdPlatform }).then(function (authInfo) {
15084 authInfo = AV.User.mergeUnionId(authInfo, unionId, { asMainAccount: asMainAccount });
15085 return _this6.associateWithMiniApp(authInfo);
15086 });
15087 },
15088
15089
15090 /**
15091 * Unlinks a user from a service.
15092 * @param {string} platform
15093 * @return {Promise<AV.User>}
15094 * @since 3.3.0
15095 */
15096 dissociateAuthData: function dissociateAuthData(provider) {
15097 this.unset('authData.' + provider);
15098 return this.save().then(function (model) {
15099 return model._handleSaveResult(true).then(function () {
15100 return model;
15101 });
15102 });
15103 },
15104
15105
15106 /**
15107 * @private
15108 * @deprecated
15109 */
15110 _unlinkFrom: function _unlinkFrom(provider) {
15111 console.warn('DEPRECATED: User#_unlinkFrom 已废弃,请使用 User#dissociateAuthData 代替');
15112 return this.dissociateAuthData(provider);
15113 },
15114
15115
15116 /**
15117 * Checks whether a user is linked to a service.
15118 * @private
15119 */
15120 _isLinked: function _isLinked(provider) {
15121 var authType;
15122 if (_.isString(provider)) {
15123 authType = provider;
15124 } else {
15125 authType = provider.getAuthType();
15126 }
15127 var authData = this.get('authData') || {};
15128 return !!authData[authType];
15129 },
15130
15131 /**
15132 * Checks whether a user is anonymous.
15133 * @since 3.9.0
15134 * @return {boolean}
15135 */
15136 isAnonymous: function isAnonymous() {
15137 return this._isLinked(PLATFORM_ANONYMOUS);
15138 },
15139
15140
15141 logOut: function logOut() {
15142 this._logOutWithAll();
15143 this._isCurrentUser = false;
15144 },
15145
15146 /**
15147 * Deauthenticates all providers.
15148 * @private
15149 */
15150 _logOutWithAll: function _logOutWithAll() {
15151 var authData = this.get('authData');
15152 if (!authData) {
15153 return;
15154 }
15155 var self = this;
15156 AV._objectEach(this.get('authData'), function (value, key) {
15157 self._logOutWith(key);
15158 });
15159 },
15160
15161 /**
15162 * Deauthenticates a single provider (e.g. removing access tokens from the
15163 * Facebook SDK).
15164 * @private
15165 */
15166 _logOutWith: function _logOutWith(provider) {
15167 if (!this.isCurrent()) {
15168 return;
15169 }
15170 if (_.isString(provider)) {
15171 provider = AV.User._authProviders[provider];
15172 }
15173 if (provider && provider.deauthenticate) {
15174 provider.deauthenticate();
15175 }
15176 },
15177
15178 /**
15179 * Signs up a new user. You should call this instead of save for
15180 * new AV.Users. This will create a new AV.User on the server, and
15181 * also persist the session on disk so that you can access the user using
15182 * <code>current</code>.
15183 *
15184 * <p>A username and password must be set before calling signUp.</p>
15185 *
15186 * @param {Object} attrs Extra fields to set on the new user, or null.
15187 * @param {AuthOptions} options
15188 * @return {Promise} A promise that is fulfilled when the signup
15189 * finishes.
15190 * @see AV.User.signUp
15191 */
15192 signUp: function signUp(attrs, options) {
15193 var error;
15194
15195 var username = attrs && attrs.username || this.get('username');
15196 if (!username || username === '') {
15197 error = new AVError(AVError.OTHER_CAUSE, 'Cannot sign up user with an empty name.');
15198 throw error;
15199 }
15200
15201 var password = attrs && attrs.password || this.get('password');
15202 if (!password || password === '') {
15203 error = new AVError(AVError.OTHER_CAUSE, 'Cannot sign up user with an empty password.');
15204 throw error;
15205 }
15206
15207 return this.save(attrs, options).then(function (model) {
15208 if (model.isAnonymous()) {
15209 model.unset('authData.' + PLATFORM_ANONYMOUS);
15210 model._opSetQueue = [{}];
15211 }
15212 return model._handleSaveResult(true).then(function () {
15213 return model;
15214 });
15215 });
15216 },
15217
15218 /**
15219 * Signs up a new user with mobile phone and sms code.
15220 * You should call this instead of save for
15221 * new AV.Users. This will create a new AV.User on the server, and
15222 * also persist the session on disk so that you can access the user using
15223 * <code>current</code>.
15224 *
15225 * <p>A username and password must be set before calling signUp.</p>
15226 *
15227 * @param {Object} attrs Extra fields to set on the new user, or null.
15228 * @param {AuthOptions} options
15229 * @return {Promise} A promise that is fulfilled when the signup
15230 * finishes.
15231 * @see AV.User.signUpOrlogInWithMobilePhone
15232 * @see AV.Cloud.requestSmsCode
15233 */
15234 signUpOrlogInWithMobilePhone: function signUpOrlogInWithMobilePhone(attrs) {
15235 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
15236
15237 var error;
15238
15239 var mobilePhoneNumber = attrs && attrs.mobilePhoneNumber || this.get('mobilePhoneNumber');
15240 if (!mobilePhoneNumber || mobilePhoneNumber === '') {
15241 error = new AVError(AVError.OTHER_CAUSE, 'Cannot sign up or login user by mobilePhoneNumber ' + 'with an empty mobilePhoneNumber.');
15242 throw error;
15243 }
15244
15245 var smsCode = attrs && attrs.smsCode || this.get('smsCode');
15246 if (!smsCode || smsCode === '') {
15247 error = new AVError(AVError.OTHER_CAUSE, 'Cannot sign up or login user by mobilePhoneNumber ' + 'with an empty smsCode.');
15248 throw error;
15249 }
15250
15251 options._makeRequest = function (route, className, id, method, json) {
15252 return AVRequest('usersByMobilePhone', null, null, 'POST', json);
15253 };
15254 return this.save(attrs, options).then(function (model) {
15255 delete model.attributes.smsCode;
15256 delete model._serverData.smsCode;
15257 return model._handleSaveResult(true).then(function () {
15258 return model;
15259 });
15260 });
15261 },
15262
15263 /**
15264 * The same with {@link AV.User.loginWithAuthData}, except that you can set attributes before login.
15265 * @since 3.7.0
15266 */
15267 loginWithAuthData: function loginWithAuthData(authData, platform, options) {
15268 return this._linkWith(platform, authData, options);
15269 },
15270
15271
15272 /**
15273 * The same with {@link AV.User.loginWithAuthDataAndUnionId}, except that you can set attributes before login.
15274 * @since 3.7.0
15275 */
15276 loginWithAuthDataAndUnionId: function loginWithAuthDataAndUnionId(authData, platform, unionId, unionLoginOptions) {
15277 return this.loginWithAuthData(mergeUnionDataIntoAuthData()(authData, unionId, unionLoginOptions), platform, unionLoginOptions);
15278 },
15279
15280
15281 /**
15282 * The same with {@link AV.User.loginWithWeapp}, except that you can set attributes before login.
15283 * @deprecated please use {@link AV.User#loginWithMiniApp}
15284 * @since 3.7.0
15285 * @param {Object} [options]
15286 * @param {boolean} [options.failOnNotExist] If true, the login request will fail when no user matches this authData exists.
15287 * @param {boolean} [options.preferUnionId] 当用户满足 {@link https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/union-id.html 获取 UnionId 的条件} 时,是否使用 UnionId 登录。(since 3.13.0)
15288 * @param {string} [options.unionIdPlatform = 'weixin'] (only take effect when preferUnionId) unionId platform
15289 * @param {boolean} [options.asMainAccount = true] (only take effect when preferUnionId) If true, the unionId will be associated with the user.
15290 * @return {Promise<AV.User>}
15291 */
15292 loginWithWeapp: function loginWithWeapp() {
15293 var _this7 = this;
15294
15295 var _ref7 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
15296 _ref7$preferUnionId = _ref7.preferUnionId,
15297 preferUnionId = _ref7$preferUnionId === undefined ? false : _ref7$preferUnionId,
15298 _ref7$unionIdPlatform = _ref7.unionIdPlatform,
15299 unionIdPlatform = _ref7$unionIdPlatform === undefined ? 'weixin' : _ref7$unionIdPlatform,
15300 _ref7$asMainAccount = _ref7.asMainAccount,
15301 asMainAccount = _ref7$asMainAccount === undefined ? true : _ref7$asMainAccount,
15302 _ref7$failOnNotExist = _ref7.failOnNotExist,
15303 failOnNotExist = _ref7$failOnNotExist === undefined ? false : _ref7$failOnNotExist;
15304
15305 var getAuthInfo = getAdapter('getAuthInfo');
15306 return getAuthInfo({
15307 preferUnionId: preferUnionId,
15308 asMainAccount: asMainAccount,
15309 platform: unionIdPlatform
15310 }).then(function (authInfo) {
15311 return _this7.loginWithMiniApp(authInfo, { failOnNotExist: failOnNotExist });
15312 });
15313 },
15314
15315
15316 /**
15317 * The same with {@link AV.User.loginWithWeappWithUnionId}, except that you can set attributes before login.
15318 * @deprecated please use {@link AV.User#loginWithMiniApp}
15319 * @since 3.13.0
15320 */
15321 loginWithWeappWithUnionId: function loginWithWeappWithUnionId(unionId) {
15322 var _this8 = this;
15323
15324 var _ref8 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
15325 _ref8$unionIdPlatform = _ref8.unionIdPlatform,
15326 unionIdPlatform = _ref8$unionIdPlatform === undefined ? 'weixin' : _ref8$unionIdPlatform,
15327 _ref8$asMainAccount = _ref8.asMainAccount,
15328 asMainAccount = _ref8$asMainAccount === undefined ? false : _ref8$asMainAccount,
15329 _ref8$failOnNotExist = _ref8.failOnNotExist,
15330 failOnNotExist = _ref8$failOnNotExist === undefined ? false : _ref8$failOnNotExist;
15331
15332 var getAuthInfo = getAdapter('getAuthInfo');
15333 return getAuthInfo({ platform: unionIdPlatform }).then(function (authInfo) {
15334 authInfo = AV.User.mergeUnionId(authInfo, unionId, { asMainAccount: asMainAccount });
15335 return _this8.loginWithMiniApp(authInfo, { failOnNotExist: failOnNotExist });
15336 });
15337 },
15338
15339
15340 /**
15341 * The same with {@link AV.User.loginWithQQApp}, except that you can set attributes before login.
15342 * @deprecated please use {@link AV.User#loginWithMiniApp}
15343 * @since 4.2.0
15344 * @param {Object} [options]
15345 * @param {boolean} [options.failOnNotExist] If true, the login request will fail when no user matches this authData exists.
15346 * @param {boolean} [options.preferUnionId] 如果服务端在登录时获取到了用户的 UnionId,是否将 UnionId 保存在用户账号中。
15347 * @param {string} [options.unionIdPlatform = 'qq'] (only take effect when preferUnionId) unionId platform
15348 * @param {boolean} [options.asMainAccount = true] (only take effect when preferUnionId) If true, the unionId will be associated with the user.
15349 */
15350 loginWithQQApp: function loginWithQQApp() {
15351 var _this9 = this;
15352
15353 var _ref9 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
15354 _ref9$preferUnionId = _ref9.preferUnionId,
15355 preferUnionId = _ref9$preferUnionId === undefined ? false : _ref9$preferUnionId,
15356 _ref9$unionIdPlatform = _ref9.unionIdPlatform,
15357 unionIdPlatform = _ref9$unionIdPlatform === undefined ? 'qq' : _ref9$unionIdPlatform,
15358 _ref9$asMainAccount = _ref9.asMainAccount,
15359 asMainAccount = _ref9$asMainAccount === undefined ? true : _ref9$asMainAccount,
15360 _ref9$failOnNotExist = _ref9.failOnNotExist,
15361 failOnNotExist = _ref9$failOnNotExist === undefined ? false : _ref9$failOnNotExist;
15362
15363 var getAuthInfo = getAdapter('getAuthInfo');
15364 return getAuthInfo({
15365 preferUnionId: preferUnionId,
15366 asMainAccount: asMainAccount,
15367 platform: unionIdPlatform
15368 }).then(function (authInfo) {
15369 authInfo.provider = PLATFORM_QQAPP;
15370 return _this9.loginWithMiniApp(authInfo, { failOnNotExist: failOnNotExist });
15371 });
15372 },
15373
15374
15375 /**
15376 * The same with {@link AV.User.loginWithQQAppWithUnionId}, except that you can set attributes before login.
15377 * @deprecated please use {@link AV.User#loginWithMiniApp}
15378 * @since 4.2.0
15379 */
15380 loginWithQQAppWithUnionId: function loginWithQQAppWithUnionId(unionId) {
15381 var _this10 = this;
15382
15383 var _ref10 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
15384 _ref10$unionIdPlatfor = _ref10.unionIdPlatform,
15385 unionIdPlatform = _ref10$unionIdPlatfor === undefined ? 'qq' : _ref10$unionIdPlatfor,
15386 _ref10$asMainAccount = _ref10.asMainAccount,
15387 asMainAccount = _ref10$asMainAccount === undefined ? false : _ref10$asMainAccount,
15388 _ref10$failOnNotExist = _ref10.failOnNotExist,
15389 failOnNotExist = _ref10$failOnNotExist === undefined ? false : _ref10$failOnNotExist;
15390
15391 var getAuthInfo = getAdapter('getAuthInfo');
15392 return getAuthInfo({ platform: unionIdPlatform }).then(function (authInfo) {
15393 authInfo = AV.User.mergeUnionId(authInfo, unionId, { asMainAccount: asMainAccount });
15394 authInfo.provider = PLATFORM_QQAPP;
15395 return _this10.loginWithMiniApp(authInfo, { failOnNotExist: failOnNotExist });
15396 });
15397 },
15398
15399
15400 /**
15401 * The same with {@link AV.User.loginWithMiniApp}, except that you can set attributes before login.
15402 * @since 4.6.0
15403 */
15404 loginWithMiniApp: function loginWithMiniApp(authInfo, option) {
15405 var _this11 = this;
15406
15407 if (authInfo === undefined) {
15408 var getAuthInfo = getAdapter('getAuthInfo');
15409 return getAuthInfo().then(function (authInfo) {
15410 return _this11.loginWithAuthData(authInfo.authData, authInfo.provider, option);
15411 });
15412 }
15413 return this.loginWithAuthData(authInfo.authData, authInfo.provider, option);
15414 },
15415
15416
15417 /**
15418 * Logs in a AV.User. On success, this saves the session to localStorage,
15419 * so you can retrieve the currently logged in user using
15420 * <code>current</code>.
15421 *
15422 * <p>A username and password must be set before calling logIn.</p>
15423 *
15424 * @see AV.User.logIn
15425 * @return {Promise} A promise that is fulfilled with the user when
15426 * the login is complete.
15427 */
15428 logIn: function logIn() {
15429 var model = this;
15430 var request = AVRequest('login', null, null, 'POST', this.toJSON());
15431 return request.then(function (resp) {
15432 var serverAttrs = model.parse(resp);
15433 model._finishFetch(serverAttrs);
15434 return model._handleSaveResult(true).then(function () {
15435 if (!serverAttrs.smsCode) delete model.attributes['smsCode'];
15436 return model;
15437 });
15438 });
15439 },
15440 /**
15441 * @see AV.Object#save
15442 */
15443 save: function save(arg1, arg2, arg3) {
15444 var attrs, options;
15445 if (_.isObject(arg1) || _.isNull(arg1) || _.isUndefined(arg1)) {
15446 attrs = arg1;
15447 options = arg2;
15448 } else {
15449 attrs = {};
15450 attrs[arg1] = arg2;
15451 options = arg3;
15452 }
15453 options = options || {};
15454
15455 return AV.Object.prototype.save.call(this, attrs, options).then(function (model) {
15456 return model._handleSaveResult(false).then(function () {
15457 return model;
15458 });
15459 });
15460 },
15461
15462 /**
15463 * Follow a user
15464 * @since 0.3.0
15465 * @param {Object | AV.User | String} options if an AV.User or string is given, it will be used as the target user.
15466 * @param {AV.User | String} options.user The target user or user's objectId to follow.
15467 * @param {Object} [options.attributes] key-value attributes dictionary to be used as
15468 * conditions of followerQuery/followeeQuery.
15469 * @param {AuthOptions} [authOptions]
15470 */
15471 follow: function follow(options, authOptions) {
15472 if (!this.id) {
15473 throw new Error('Please signin.');
15474 }
15475 var user = void 0;
15476 var attributes = void 0;
15477 if (options.user) {
15478 user = options.user;
15479 attributes = options.attributes;
15480 } else {
15481 user = options;
15482 }
15483 var userObjectId = _.isString(user) ? user : user.id;
15484 if (!userObjectId) {
15485 throw new Error('Invalid target user.');
15486 }
15487 var route = 'users/' + this.id + '/friendship/' + userObjectId;
15488 var request = AVRequest(route, null, null, 'POST', AV._encode(attributes), authOptions);
15489 return request;
15490 },
15491
15492 /**
15493 * Unfollow a user.
15494 * @since 0.3.0
15495 * @param {Object | AV.User | String} options if an AV.User or string is given, it will be used as the target user.
15496 * @param {AV.User | String} options.user The target user or user's objectId to unfollow.
15497 * @param {AuthOptions} [authOptions]
15498 */
15499 unfollow: function unfollow(options, authOptions) {
15500 if (!this.id) {
15501 throw new Error('Please signin.');
15502 }
15503 var user = void 0;
15504 if (options.user) {
15505 user = options.user;
15506 } else {
15507 user = options;
15508 }
15509 var userObjectId = _.isString(user) ? user : user.id;
15510 if (!userObjectId) {
15511 throw new Error('Invalid target user.');
15512 }
15513 var route = 'users/' + this.id + '/friendship/' + userObjectId;
15514 var request = AVRequest(route, null, null, 'DELETE', null, authOptions);
15515 return request;
15516 },
15517
15518 /**
15519 * Get the user's followers and followees.
15520 * @since 4.8.0
15521 * @param {Object} [options]
15522 * @param {Number} [options.skip]
15523 * @param {Number} [options.limit]
15524 * @param {AuthOptions} [authOptions]
15525 */
15526 getFollowersAndFollowees: function getFollowersAndFollowees(options, authOptions) {
15527 if (!this.id) {
15528 throw new Error('Please signin.');
15529 }
15530 return request({
15531 method: 'GET',
15532 path: '/users/' + this.id + '/followersAndFollowees',
15533 query: {
15534 skip: options && options.skip,
15535 limit: options && options.limit,
15536 include: 'follower,followee',
15537 keys: 'follower,followee'
15538 },
15539 authOptions: authOptions
15540 }).then(function (_ref11) {
15541 var followers = _ref11.followers,
15542 followees = _ref11.followees;
15543 return {
15544 followers: followers.map(function (_ref12) {
15545 var follower = _ref12.follower;
15546 return AV._decode(follower);
15547 }),
15548 followees: followees.map(function (_ref13) {
15549 var followee = _ref13.followee;
15550 return AV._decode(followee);
15551 })
15552 };
15553 });
15554 },
15555
15556 /**
15557 *Create a follower query to query the user's followers.
15558 * @since 0.3.0
15559 * @see AV.User#followerQuery
15560 */
15561 followerQuery: function followerQuery() {
15562 return AV.User.followerQuery(this.id);
15563 },
15564
15565 /**
15566 *Create a followee query to query the user's followees.
15567 * @since 0.3.0
15568 * @see AV.User#followeeQuery
15569 */
15570 followeeQuery: function followeeQuery() {
15571 return AV.User.followeeQuery(this.id);
15572 },
15573
15574 /**
15575 * @see AV.Object#fetch
15576 */
15577 fetch: function fetch(fetchOptions, options) {
15578 return AV.Object.prototype.fetch.call(this, fetchOptions, options).then(function (model) {
15579 return model._handleSaveResult(false).then(function () {
15580 return model;
15581 });
15582 });
15583 },
15584
15585 /**
15586 * Update user's new password safely based on old password.
15587 * @param {String} oldPassword the old password.
15588 * @param {String} newPassword the new password.
15589 * @param {AuthOptions} options
15590 */
15591 updatePassword: function updatePassword(oldPassword, newPassword, options) {
15592 var _this12 = this;
15593
15594 var route = 'users/' + this.id + '/updatePassword';
15595 var params = {
15596 old_password: oldPassword,
15597 new_password: newPassword
15598 };
15599 var request = AVRequest(route, null, null, 'PUT', params, options);
15600 return request.then(function (resp) {
15601 _this12._finishFetch(_this12.parse(resp));
15602 return _this12._handleSaveResult(true).then(function () {
15603 return resp;
15604 });
15605 });
15606 },
15607
15608 /**
15609 * Returns true if <code>current</code> would return this user.
15610 * @see AV.User#current
15611 */
15612 isCurrent: function isCurrent() {
15613 return this._isCurrentUser;
15614 },
15615
15616 /**
15617 * Returns get("username").
15618 * @return {String}
15619 * @see AV.Object#get
15620 */
15621 getUsername: function getUsername() {
15622 return this.get('username');
15623 },
15624
15625 /**
15626 * Returns get("mobilePhoneNumber").
15627 * @return {String}
15628 * @see AV.Object#get
15629 */
15630 getMobilePhoneNumber: function getMobilePhoneNumber() {
15631 return this.get('mobilePhoneNumber');
15632 },
15633
15634 /**
15635 * Calls set("mobilePhoneNumber", phoneNumber, options) and returns the result.
15636 * @param {String} mobilePhoneNumber
15637 * @return {Boolean}
15638 * @see AV.Object#set
15639 */
15640 setMobilePhoneNumber: function setMobilePhoneNumber(phone, options) {
15641 return this.set('mobilePhoneNumber', phone, options);
15642 },
15643
15644 /**
15645 * Calls set("username", username, options) and returns the result.
15646 * @param {String} username
15647 * @return {Boolean}
15648 * @see AV.Object#set
15649 */
15650 setUsername: function setUsername(username, options) {
15651 return this.set('username', username, options);
15652 },
15653
15654 /**
15655 * Calls set("password", password, options) and returns the result.
15656 * @param {String} password
15657 * @return {Boolean}
15658 * @see AV.Object#set
15659 */
15660 setPassword: function setPassword(password, options) {
15661 return this.set('password', password, options);
15662 },
15663
15664 /**
15665 * Returns get("email").
15666 * @return {String}
15667 * @see AV.Object#get
15668 */
15669 getEmail: function getEmail() {
15670 return this.get('email');
15671 },
15672
15673 /**
15674 * Calls set("email", email, options) and returns the result.
15675 * @param {String} email
15676 * @param {AuthOptions} options
15677 * @return {Boolean}
15678 * @see AV.Object#set
15679 */
15680 setEmail: function setEmail(email, options) {
15681 return this.set('email', email, options);
15682 },
15683
15684 /**
15685 * Checks whether this user is the current user and has been authenticated.
15686 * @deprecated 如果要判断当前用户的登录状态是否有效,请使用 currentUser.isAuthenticated().then(),
15687 * 如果要判断该用户是否是当前登录用户,请使用 user.id === currentUser.id
15688 * @return (Boolean) whether this user is the current user and is logged in.
15689 */
15690 authenticated: function authenticated() {
15691 console.warn('DEPRECATED: 如果要判断当前用户的登录状态是否有效,请使用 currentUser.isAuthenticated().then(),如果要判断该用户是否是当前登录用户,请使用 user.id === currentUser.id。');
15692 return !!this._sessionToken && !AV._config.disableCurrentUser && AV.User.current() && AV.User.current().id === this.id;
15693 },
15694
15695 /**
15696 * Detects if current sessionToken is valid.
15697 *
15698 * @since 2.0.0
15699 * @return Promise.<Boolean>
15700 */
15701 isAuthenticated: function isAuthenticated() {
15702 var _this13 = this;
15703
15704 return _promise2.default.resolve().then(function () {
15705 return !!_this13._sessionToken && AV.User._fetchUserBySessionToken(_this13._sessionToken).then(function () {
15706 return true;
15707 }, function (error) {
15708 if (error.code === 211) {
15709 return false;
15710 }
15711 throw error;
15712 });
15713 });
15714 },
15715
15716
15717 /**
15718 * Get sessionToken of current user.
15719 * @return {String} sessionToken
15720 */
15721 getSessionToken: function getSessionToken() {
15722 return this._sessionToken;
15723 },
15724
15725
15726 /**
15727 * Refresh sessionToken of current user.
15728 * @since 2.1.0
15729 * @param {AuthOptions} [options]
15730 * @return {Promise.<AV.User>} user with refreshed sessionToken
15731 */
15732 refreshSessionToken: function refreshSessionToken(options) {
15733 var _this14 = this;
15734
15735 return AVRequest('users/' + this.id + '/refreshSessionToken', null, null, 'PUT', null, options).then(function (response) {
15736 _this14._finishFetch(response);
15737 return _this14._handleSaveResult(true).then(function () {
15738 return _this14;
15739 });
15740 });
15741 },
15742
15743
15744 /**
15745 * Get this user's Roles.
15746 * @param {AuthOptions} [options]
15747 * @return {Promise.<AV.Role[]>} A promise that is fulfilled with the roles when
15748 * the query is complete.
15749 */
15750 getRoles: function getRoles(options) {
15751 return AV.Relation.reverseQuery('_Role', 'users', this).find(options);
15752 }
15753 },
15754 /** @lends AV.User */{
15755 // Class Variables
15756
15757 // The currently logged-in user.
15758 _currentUser: null,
15759
15760 // Whether currentUser is known to match the serialized version on disk.
15761 // This is useful for saving a localstorage check if you try to load
15762 // _currentUser frequently while there is none stored.
15763 _currentUserMatchesDisk: false,
15764
15765 // The localStorage key suffix that the current user is stored under.
15766 _CURRENT_USER_KEY: 'currentUser',
15767
15768 // The mapping of auth provider names to actual providers
15769 _authProviders: {},
15770
15771 // Class Methods
15772
15773 /**
15774 * Signs up a new user with a username (or email) and password.
15775 * This will create a new AV.User on the server, and also persist the
15776 * session in localStorage so that you can access the user using
15777 * {@link #current}.
15778 *
15779 * @param {String} username The username (or email) to sign up with.
15780 * @param {String} password The password to sign up with.
15781 * @param {Object} [attrs] Extra fields to set on the new user.
15782 * @param {AuthOptions} [options]
15783 * @return {Promise} A promise that is fulfilled with the user when
15784 * the signup completes.
15785 * @see AV.User#signUp
15786 */
15787 signUp: function signUp(username, password, attrs, options) {
15788 attrs = attrs || {};
15789 attrs.username = username;
15790 attrs.password = password;
15791 var user = AV.Object._create('_User');
15792 return user.signUp(attrs, options);
15793 },
15794
15795 /**
15796 * Logs in a user with a username (or email) and password. On success, this
15797 * saves the session to disk, so you can retrieve the currently logged in
15798 * user using <code>current</code>.
15799 *
15800 * @param {String} username The username (or email) to log in with.
15801 * @param {String} password The password to log in with.
15802 * @return {Promise} A promise that is fulfilled with the user when
15803 * the login completes.
15804 * @see AV.User#logIn
15805 */
15806 logIn: function logIn(username, password) {
15807 var user = AV.Object._create('_User');
15808 user._finishFetch({ username: username, password: password });
15809 return user.logIn();
15810 },
15811
15812 /**
15813 * Logs in a user with a session token. On success, this saves the session
15814 * to disk, so you can retrieve the currently logged in user using
15815 * <code>current</code>.
15816 *
15817 * @param {String} sessionToken The sessionToken to log in with.
15818 * @return {Promise} A promise that is fulfilled with the user when
15819 * the login completes.
15820 */
15821 become: function become(sessionToken) {
15822 return this._fetchUserBySessionToken(sessionToken).then(function (user) {
15823 return user._handleSaveResult(true).then(function () {
15824 return user;
15825 });
15826 });
15827 },
15828
15829 _fetchUserBySessionToken: function _fetchUserBySessionToken(sessionToken) {
15830 if (sessionToken === undefined) {
15831 return _promise2.default.reject(new Error('The sessionToken cannot be undefined'));
15832 }
15833
15834 var user = AV.Object._create('_User');
15835 return request({
15836 method: 'GET',
15837 path: '/users/me',
15838 authOptions: {
15839 sessionToken: sessionToken
15840 }
15841 }).then(function (resp) {
15842 var serverAttrs = user.parse(resp);
15843 user._finishFetch(serverAttrs);
15844 return user;
15845 });
15846 },
15847
15848 /**
15849 * Logs in a user with a mobile phone number and sms code sent by
15850 * AV.User.requestLoginSmsCode.On success, this
15851 * saves the session to disk, so you can retrieve the currently logged in
15852 * user using <code>current</code>.
15853 *
15854 * @param {String} mobilePhone The user's mobilePhoneNumber
15855 * @param {String} smsCode The sms code sent by AV.User.requestLoginSmsCode
15856 * @return {Promise} A promise that is fulfilled with the user when
15857 * the login completes.
15858 * @see AV.User#logIn
15859 */
15860 logInWithMobilePhoneSmsCode: function logInWithMobilePhoneSmsCode(mobilePhone, smsCode) {
15861 var user = AV.Object._create('_User');
15862 user._finishFetch({ mobilePhoneNumber: mobilePhone, smsCode: smsCode });
15863 return user.logIn();
15864 },
15865
15866 /**
15867 * Signs up or logs in a user with a mobilePhoneNumber and smsCode.
15868 * On success, this saves the session to disk, so you can retrieve the currently
15869 * logged in user using <code>current</code>.
15870 *
15871 * @param {String} mobilePhoneNumber The user's mobilePhoneNumber.
15872 * @param {String} smsCode The sms code sent by AV.Cloud.requestSmsCode
15873 * @param {Object} attributes The user's other attributes such as username etc.
15874 * @param {AuthOptions} options
15875 * @return {Promise} A promise that is fulfilled with the user when
15876 * the login completes.
15877 * @see AV.User#signUpOrlogInWithMobilePhone
15878 * @see AV.Cloud.requestSmsCode
15879 */
15880 signUpOrlogInWithMobilePhone: function signUpOrlogInWithMobilePhone(mobilePhoneNumber, smsCode, attrs, options) {
15881 attrs = attrs || {};
15882 attrs.mobilePhoneNumber = mobilePhoneNumber;
15883 attrs.smsCode = smsCode;
15884 var user = AV.Object._create('_User');
15885 return user.signUpOrlogInWithMobilePhone(attrs, options);
15886 },
15887
15888 /**
15889 * Logs in a user with a mobile phone number and password. On success, this
15890 * saves the session to disk, so you can retrieve the currently logged in
15891 * user using <code>current</code>.
15892 *
15893 * @param {String} mobilePhone The user's mobilePhoneNumber
15894 * @param {String} password The password to log in with.
15895 * @return {Promise} A promise that is fulfilled with the user when
15896 * the login completes.
15897 * @see AV.User#logIn
15898 */
15899 logInWithMobilePhone: function logInWithMobilePhone(mobilePhone, password) {
15900 var user = AV.Object._create('_User');
15901 user._finishFetch({
15902 mobilePhoneNumber: mobilePhone,
15903 password: password
15904 });
15905 return user.logIn();
15906 },
15907
15908 /**
15909 * Logs in a user with email and password.
15910 *
15911 * @since 3.13.0
15912 * @param {String} email The user's email.
15913 * @param {String} password The password to log in with.
15914 * @return {Promise} A promise that is fulfilled with the user when
15915 * the login completes.
15916 */
15917 loginWithEmail: function loginWithEmail(email, password) {
15918 var user = AV.Object._create('_User');
15919 user._finishFetch({
15920 email: email,
15921 password: password
15922 });
15923 return user.logIn();
15924 },
15925
15926
15927 /**
15928 * Signs up or logs in a user with a third party auth data(AccessToken).
15929 * On success, this saves the session to disk, so you can retrieve the currently
15930 * logged in user using <code>current</code>.
15931 *
15932 * @since 3.7.0
15933 * @param {Object} authData The response json data returned from third party token, maybe like { openid: 'abc123', access_token: '123abc', expires_in: 1382686496 }
15934 * @param {string} platform Available platform for sign up.
15935 * @param {Object} [options]
15936 * @param {boolean} [options.failOnNotExist] If true, the login request will fail when no user matches this authData exists.
15937 * @return {Promise} A promise that is fulfilled with the user when
15938 * the login completes.
15939 * @example AV.User.loginWithAuthData({
15940 * openid: 'abc123',
15941 * access_token: '123abc',
15942 * expires_in: 1382686496
15943 * }, 'weixin').then(function(user) {
15944 * //Access user here
15945 * }).catch(function(error) {
15946 * //console.error("error: ", error);
15947 * });
15948 * @see {@link https://leancloud.cn/docs/js_guide.html#绑定第三方平台账户}
15949 */
15950 loginWithAuthData: function loginWithAuthData(authData, platform, options) {
15951 return AV.User._logInWith(platform, authData, options);
15952 },
15953
15954
15955 /**
15956 * @deprecated renamed to {@link AV.User.loginWithAuthData}
15957 */
15958 signUpOrlogInWithAuthData: function signUpOrlogInWithAuthData() {
15959 console.warn('DEPRECATED: User.signUpOrlogInWithAuthData 已废弃,请使用 User#loginWithAuthData 代替');
15960 return this.loginWithAuthData.apply(this, arguments);
15961 },
15962
15963
15964 /**
15965 * Signs up or logs in a user with a third party authData and unionId.
15966 * @since 3.7.0
15967 * @param {Object} authData The response json data returned from third party token, maybe like { openid: 'abc123', access_token: '123abc', expires_in: 1382686496 }
15968 * @param {string} platform Available platform for sign up.
15969 * @param {string} unionId
15970 * @param {Object} [unionLoginOptions]
15971 * @param {string} [unionLoginOptions.unionIdPlatform = 'weixin'] unionId platform
15972 * @param {boolean} [unionLoginOptions.asMainAccount = false] If true, the unionId will be associated with the user.
15973 * @param {boolean} [unionLoginOptions.failOnNotExist] If true, the login request will fail when no user matches this authData exists.
15974 * @return {Promise<AV.User>} A promise that is fulfilled with the user when completed.
15975 * @example AV.User.loginWithAuthDataAndUnionId({
15976 * openid: 'abc123',
15977 * access_token: '123abc',
15978 * expires_in: 1382686496
15979 * }, 'weixin', 'union123', {
15980 * unionIdPlatform: 'weixin',
15981 * asMainAccount: true,
15982 * }).then(function(user) {
15983 * //Access user here
15984 * }).catch(function(error) {
15985 * //console.error("error: ", error);
15986 * });
15987 */
15988 loginWithAuthDataAndUnionId: function loginWithAuthDataAndUnionId(authData, platform, unionId, unionLoginOptions) {
15989 return this.loginWithAuthData(mergeUnionDataIntoAuthData()(authData, unionId, unionLoginOptions), platform, unionLoginOptions);
15990 },
15991
15992
15993 /**
15994 * @deprecated renamed to {@link AV.User.loginWithAuthDataAndUnionId}
15995 * @since 3.5.0
15996 */
15997 signUpOrlogInWithAuthDataAndUnionId: function signUpOrlogInWithAuthDataAndUnionId() {
15998 console.warn('DEPRECATED: User.signUpOrlogInWithAuthDataAndUnionId 已废弃,请使用 User#loginWithAuthDataAndUnionId 代替');
15999 return this.loginWithAuthDataAndUnionId.apply(this, arguments);
16000 },
16001
16002
16003 /**
16004 * Merge unionId into authInfo.
16005 * @since 4.6.0
16006 * @param {Object} authInfo
16007 * @param {String} unionId
16008 * @param {Object} [unionIdOption]
16009 * @param {Boolean} [unionIdOption.asMainAccount] If true, the unionId will be associated with the user.
16010 */
16011 mergeUnionId: function mergeUnionId(authInfo, unionId) {
16012 var _ref14 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
16013 _ref14$asMainAccount = _ref14.asMainAccount,
16014 asMainAccount = _ref14$asMainAccount === undefined ? false : _ref14$asMainAccount;
16015
16016 authInfo = JSON.parse((0, _stringify2.default)(authInfo));
16017 var _authInfo = authInfo,
16018 authData = _authInfo.authData,
16019 platform = _authInfo.platform;
16020
16021 authData.platform = platform;
16022 authData.main_account = asMainAccount;
16023 authData.unionid = unionId;
16024 return authInfo;
16025 },
16026
16027
16028 /**
16029 * 使用当前使用微信小程序的微信用户身份注册或登录,成功后用户的 session 会在设备上持久化保存,之后可以使用 AV.User.current() 获取当前登录用户。
16030 * 仅在微信小程序中可用。
16031 *
16032 * @deprecated please use {@link AV.User.loginWithMiniApp}
16033 * @since 2.0.0
16034 * @param {Object} [options]
16035 * @param {boolean} [options.preferUnionId] 当用户满足 {@link https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/union-id.html 获取 UnionId 的条件} 时,是否使用 UnionId 登录。(since 3.13.0)
16036 * @param {string} [options.unionIdPlatform = 'weixin'] (only take effect when preferUnionId) unionId platform
16037 * @param {boolean} [options.asMainAccount = true] (only take effect when preferUnionId) If true, the unionId will be associated with the user.
16038 * @param {boolean} [options.failOnNotExist] If true, the login request will fail when no user matches this authData exists. (since v3.7.0)
16039 * @return {Promise.<AV.User>}
16040 */
16041 loginWithWeapp: function loginWithWeapp() {
16042 var _this15 = this;
16043
16044 var _ref15 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
16045 _ref15$preferUnionId = _ref15.preferUnionId,
16046 preferUnionId = _ref15$preferUnionId === undefined ? false : _ref15$preferUnionId,
16047 _ref15$unionIdPlatfor = _ref15.unionIdPlatform,
16048 unionIdPlatform = _ref15$unionIdPlatfor === undefined ? 'weixin' : _ref15$unionIdPlatfor,
16049 _ref15$asMainAccount = _ref15.asMainAccount,
16050 asMainAccount = _ref15$asMainAccount === undefined ? true : _ref15$asMainAccount,
16051 _ref15$failOnNotExist = _ref15.failOnNotExist,
16052 failOnNotExist = _ref15$failOnNotExist === undefined ? false : _ref15$failOnNotExist;
16053
16054 var getAuthInfo = getAdapter('getAuthInfo');
16055 return getAuthInfo({
16056 preferUnionId: preferUnionId,
16057 asMainAccount: asMainAccount,
16058 platform: unionIdPlatform
16059 }).then(function (authInfo) {
16060 return _this15.loginWithMiniApp(authInfo, { failOnNotExist: failOnNotExist });
16061 });
16062 },
16063
16064
16065 /**
16066 * 使用当前使用微信小程序的微信用户身份注册或登录,
16067 * 仅在微信小程序中可用。
16068 *
16069 * @deprecated please use {@link AV.User.loginWithMiniApp}
16070 * @since 3.13.0
16071 * @param {Object} [unionLoginOptions]
16072 * @param {string} [unionLoginOptions.unionIdPlatform = 'weixin'] unionId platform
16073 * @param {boolean} [unionLoginOptions.asMainAccount = false] If true, the unionId will be associated with the user.
16074 * @param {boolean} [unionLoginOptions.failOnNotExist] If true, the login request will fail when no user matches this authData exists. * @return {Promise.<AV.User>}
16075 */
16076 loginWithWeappWithUnionId: function loginWithWeappWithUnionId(unionId) {
16077 var _this16 = this;
16078
16079 var _ref16 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
16080 _ref16$unionIdPlatfor = _ref16.unionIdPlatform,
16081 unionIdPlatform = _ref16$unionIdPlatfor === undefined ? 'weixin' : _ref16$unionIdPlatfor,
16082 _ref16$asMainAccount = _ref16.asMainAccount,
16083 asMainAccount = _ref16$asMainAccount === undefined ? false : _ref16$asMainAccount,
16084 _ref16$failOnNotExist = _ref16.failOnNotExist,
16085 failOnNotExist = _ref16$failOnNotExist === undefined ? false : _ref16$failOnNotExist;
16086
16087 var getAuthInfo = getAdapter('getAuthInfo');
16088 return getAuthInfo({ platform: unionIdPlatform }).then(function (authInfo) {
16089 authInfo = AV.User.mergeUnionId(authInfo, unionId, { asMainAccount: asMainAccount });
16090 return _this16.loginWithMiniApp(authInfo, { failOnNotExist: failOnNotExist });
16091 });
16092 },
16093
16094
16095 /**
16096 * 使用当前使用 QQ 小程序的 QQ 用户身份注册或登录,成功后用户的 session 会在设备上持久化保存,之后可以使用 AV.User.current() 获取当前登录用户。
16097 * 仅在 QQ 小程序中可用。
16098 *
16099 * @deprecated please use {@link AV.User.loginWithMiniApp}
16100 * @since 4.2.0
16101 * @param {Object} [options]
16102 * @param {boolean} [options.preferUnionId] 如果服务端在登录时获取到了用户的 UnionId,是否将 UnionId 保存在用户账号中。
16103 * @param {string} [options.unionIdPlatform = 'qq'] (only take effect when preferUnionId) unionId platform
16104 * @param {boolean} [options.asMainAccount = true] (only take effect when preferUnionId) If true, the unionId will be associated with the user.
16105 * @param {boolean} [options.failOnNotExist] If true, the login request will fail when no user matches this authData exists. (since v3.7.0)
16106 * @return {Promise.<AV.User>}
16107 */
16108 loginWithQQApp: function loginWithQQApp() {
16109 var _this17 = this;
16110
16111 var _ref17 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
16112 _ref17$preferUnionId = _ref17.preferUnionId,
16113 preferUnionId = _ref17$preferUnionId === undefined ? false : _ref17$preferUnionId,
16114 _ref17$unionIdPlatfor = _ref17.unionIdPlatform,
16115 unionIdPlatform = _ref17$unionIdPlatfor === undefined ? 'qq' : _ref17$unionIdPlatfor,
16116 _ref17$asMainAccount = _ref17.asMainAccount,
16117 asMainAccount = _ref17$asMainAccount === undefined ? true : _ref17$asMainAccount,
16118 _ref17$failOnNotExist = _ref17.failOnNotExist,
16119 failOnNotExist = _ref17$failOnNotExist === undefined ? false : _ref17$failOnNotExist;
16120
16121 var getAuthInfo = getAdapter('getAuthInfo');
16122 return getAuthInfo({
16123 preferUnionId: preferUnionId,
16124 asMainAccount: asMainAccount,
16125 platform: unionIdPlatform
16126 }).then(function (authInfo) {
16127 authInfo.provider = PLATFORM_QQAPP;
16128 return _this17.loginWithMiniApp(authInfo, { failOnNotExist: failOnNotExist });
16129 });
16130 },
16131
16132
16133 /**
16134 * 使用当前使用 QQ 小程序的 QQ 用户身份注册或登录,
16135 * 仅在 QQ 小程序中可用。
16136 *
16137 * @deprecated please use {@link AV.User.loginWithMiniApp}
16138 * @since 4.2.0
16139 * @param {Object} [unionLoginOptions]
16140 * @param {string} [unionLoginOptions.unionIdPlatform = 'qq'] unionId platform
16141 * @param {boolean} [unionLoginOptions.asMainAccount = false] If true, the unionId will be associated with the user.
16142 * @param {boolean} [unionLoginOptions.failOnNotExist] If true, the login request will fail when no user matches this authData exists.
16143 * @return {Promise.<AV.User>}
16144 */
16145 loginWithQQAppWithUnionId: function loginWithQQAppWithUnionId(unionId) {
16146 var _this18 = this;
16147
16148 var _ref18 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
16149 _ref18$unionIdPlatfor = _ref18.unionIdPlatform,
16150 unionIdPlatform = _ref18$unionIdPlatfor === undefined ? 'qq' : _ref18$unionIdPlatfor,
16151 _ref18$asMainAccount = _ref18.asMainAccount,
16152 asMainAccount = _ref18$asMainAccount === undefined ? false : _ref18$asMainAccount,
16153 _ref18$failOnNotExist = _ref18.failOnNotExist,
16154 failOnNotExist = _ref18$failOnNotExist === undefined ? false : _ref18$failOnNotExist;
16155
16156 var getAuthInfo = getAdapter('getAuthInfo');
16157 return getAuthInfo({ platform: unionIdPlatform }).then(function (authInfo) {
16158 authInfo = AV.User.mergeUnionId(authInfo, unionId, { asMainAccount: asMainAccount });
16159 authInfo.provider = PLATFORM_QQAPP;
16160 return _this18.loginWithMiniApp(authInfo, { failOnNotExist: failOnNotExist });
16161 });
16162 },
16163
16164
16165 /**
16166 * Register or login using the identity of the current mini-app.
16167 * @param {Object} authInfo
16168 * @param {Object} [option]
16169 * @param {Boolean} [option.failOnNotExist] If true, the login request will fail when no user matches this authInfo.authData exists.
16170 */
16171 loginWithMiniApp: function loginWithMiniApp(authInfo, option) {
16172 var _this19 = this;
16173
16174 if (authInfo === undefined) {
16175 var getAuthInfo = getAdapter('getAuthInfo');
16176 return getAuthInfo().then(function (authInfo) {
16177 return _this19.loginWithAuthData(authInfo.authData, authInfo.provider, option);
16178 });
16179 }
16180 return this.loginWithAuthData(authInfo.authData, authInfo.provider, option);
16181 },
16182
16183
16184 /**
16185 * Only use for DI in tests to produce deterministic IDs.
16186 */
16187 _genId: function _genId() {
16188 return uuid();
16189 },
16190
16191
16192 /**
16193 * Creates an anonymous user.
16194 *
16195 * @since 3.9.0
16196 * @return {Promise.<AV.User>}
16197 */
16198 loginAnonymously: function loginAnonymously() {
16199 return this.loginWithAuthData({
16200 id: AV.User._genId()
16201 }, 'anonymous');
16202 },
16203 associateWithAuthData: function associateWithAuthData(userObj, platform, authData) {
16204 console.warn('DEPRECATED: User.associateWithAuthData 已废弃,请使用 User#associateWithAuthData 代替');
16205 return userObj._linkWith(platform, authData);
16206 },
16207
16208 /**
16209 * Logs out the currently logged in user session. This will remove the
16210 * session from disk, log out of linked services, and future calls to
16211 * <code>current</code> will return <code>null</code>.
16212 * @return {Promise}
16213 */
16214 logOut: function logOut() {
16215 if (AV._config.disableCurrentUser) {
16216 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');
16217 return _promise2.default.resolve(null);
16218 }
16219
16220 if (AV.User._currentUser !== null) {
16221 AV.User._currentUser._logOutWithAll();
16222 AV.User._currentUser._isCurrentUser = false;
16223 }
16224 AV.User._currentUserMatchesDisk = true;
16225 AV.User._currentUser = null;
16226 return AV.localStorage.removeItemAsync(AV._getAVPath(AV.User._CURRENT_USER_KEY)).then(function () {
16227 return AV._refreshSubscriptionId();
16228 });
16229 },
16230
16231 /**
16232 *Create a follower query for special user to query the user's followers.
16233 * @param {String} userObjectId The user object id.
16234 * @return {AV.FriendShipQuery}
16235 * @since 0.3.0
16236 */
16237 followerQuery: function followerQuery(userObjectId) {
16238 if (!userObjectId || !_.isString(userObjectId)) {
16239 throw new Error('Invalid user object id.');
16240 }
16241 var query = new AV.FriendShipQuery('_Follower');
16242 query._friendshipTag = 'follower';
16243 query.equalTo('user', AV.Object.createWithoutData('_User', userObjectId));
16244 return query;
16245 },
16246
16247 /**
16248 *Create a followee query for special user to query the user's followees.
16249 * @param {String} userObjectId The user object id.
16250 * @return {AV.FriendShipQuery}
16251 * @since 0.3.0
16252 */
16253 followeeQuery: function followeeQuery(userObjectId) {
16254 if (!userObjectId || !_.isString(userObjectId)) {
16255 throw new Error('Invalid user object id.');
16256 }
16257 var query = new AV.FriendShipQuery('_Followee');
16258 query._friendshipTag = 'followee';
16259 query.equalTo('user', AV.Object.createWithoutData('_User', userObjectId));
16260 return query;
16261 },
16262
16263 /**
16264 * Requests a password reset email to be sent to the specified email address
16265 * associated with the user account. This email allows the user to securely
16266 * reset their password on the AV site.
16267 *
16268 * @param {String} email The email address associated with the user that
16269 * forgot their password.
16270 * @return {Promise}
16271 */
16272 requestPasswordReset: function requestPasswordReset(email) {
16273 var json = { email: email };
16274 var request = AVRequest('requestPasswordReset', null, null, 'POST', json);
16275 return request;
16276 },
16277
16278 /**
16279 * Requests a verify email to be sent to the specified email address
16280 * associated with the user account. This email allows the user to securely
16281 * verify their email address on the AV site.
16282 *
16283 * @param {String} email The email address associated with the user that
16284 * doesn't verify their email address.
16285 * @return {Promise}
16286 */
16287 requestEmailVerify: function requestEmailVerify(email) {
16288 var json = { email: email };
16289 var request = AVRequest('requestEmailVerify', null, null, 'POST', json);
16290 return request;
16291 },
16292
16293 /**
16294 * Requests a verify sms code to be sent to the specified mobile phone
16295 * number associated with the user account. This sms code allows the user to
16296 * verify their mobile phone number by calling AV.User.verifyMobilePhone
16297 *
16298 * @param {String} mobilePhoneNumber The mobile phone number associated with the
16299 * user that doesn't verify their mobile phone number.
16300 * @param {SMSAuthOptions} [options]
16301 * @return {Promise}
16302 */
16303 requestMobilePhoneVerify: function requestMobilePhoneVerify(mobilePhoneNumber) {
16304 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
16305
16306 var data = {
16307 mobilePhoneNumber: mobilePhoneNumber
16308 };
16309 if (options.validateToken) {
16310 data.validate_token = options.validateToken;
16311 }
16312 var request = AVRequest('requestMobilePhoneVerify', null, null, 'POST', data, options);
16313 return request;
16314 },
16315
16316 /**
16317 * Requests a reset password sms code to be sent to the specified mobile phone
16318 * number associated with the user account. This sms code allows the user to
16319 * reset their account's password by calling AV.User.resetPasswordBySmsCode
16320 *
16321 * @param {String} mobilePhoneNumber The mobile phone number associated with the
16322 * user that doesn't verify their mobile phone number.
16323 * @param {SMSAuthOptions} [options]
16324 * @return {Promise}
16325 */
16326 requestPasswordResetBySmsCode: function requestPasswordResetBySmsCode(mobilePhoneNumber) {
16327 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
16328
16329 var data = {
16330 mobilePhoneNumber: mobilePhoneNumber
16331 };
16332 if (options.validateToken) {
16333 data.validate_token = options.validateToken;
16334 }
16335 var request = AVRequest('requestPasswordResetBySmsCode', null, null, 'POST', data, options);
16336 return request;
16337 },
16338
16339 /**
16340 * Requests a change mobile phone number sms code to be sent to the mobilePhoneNumber.
16341 * This sms code allows current user to reset it's mobilePhoneNumber by
16342 * calling {@link AV.User.changePhoneNumber}
16343 * @since 4.7.0
16344 * @param {String} mobilePhoneNumber
16345 * @param {Number} [ttl] ttl of sms code (default is 6 minutes)
16346 * @param {SMSAuthOptions} [options]
16347 * @return {Promise}
16348 */
16349 requestChangePhoneNumber: function requestChangePhoneNumber(mobilePhoneNumber, ttl, options) {
16350 var data = { mobilePhoneNumber: mobilePhoneNumber };
16351 if (ttl) {
16352 data.ttl = options.ttl;
16353 }
16354 if (options && options.validateToken) {
16355 data.validate_token = options.validateToken;
16356 }
16357 return AVRequest('requestChangePhoneNumber', null, null, 'POST', data, options);
16358 },
16359
16360
16361 /**
16362 * Makes a call to reset user's account mobilePhoneNumber by sms code.
16363 * The sms code is sent by {@link AV.User.requestChangePhoneNumber}
16364 * @since 4.7.0
16365 * @param {String} mobilePhoneNumber
16366 * @param {String} code The sms code.
16367 * @return {Promise}
16368 */
16369 changePhoneNumber: function changePhoneNumber(mobilePhoneNumber, code) {
16370 var data = { mobilePhoneNumber: mobilePhoneNumber, code: code };
16371 return AVRequest('changePhoneNumber', null, null, 'POST', data);
16372 },
16373
16374
16375 /**
16376 * Makes a call to reset user's account password by sms code and new password.
16377 * The sms code is sent by AV.User.requestPasswordResetBySmsCode.
16378 * @param {String} code The sms code sent by AV.User.Cloud.requestSmsCode
16379 * @param {String} password The new password.
16380 * @return {Promise} A promise that will be resolved with the result
16381 * of the function.
16382 */
16383 resetPasswordBySmsCode: function resetPasswordBySmsCode(code, password) {
16384 var json = { password: password };
16385 var request = AVRequest('resetPasswordBySmsCode', null, code, 'PUT', json);
16386 return request;
16387 },
16388
16389 /**
16390 * Makes a call to verify sms code that sent by AV.User.Cloud.requestSmsCode
16391 * If verify successfully,the user mobilePhoneVerified attribute will be true.
16392 * @param {String} code The sms code sent by AV.User.Cloud.requestSmsCode
16393 * @return {Promise} A promise that will be resolved with the result
16394 * of the function.
16395 */
16396 verifyMobilePhone: function verifyMobilePhone(code) {
16397 var request = AVRequest('verifyMobilePhone', null, code, 'POST', null);
16398 return request;
16399 },
16400
16401 /**
16402 * Requests a logIn sms code to be sent to the specified mobile phone
16403 * number associated with the user account. This sms code allows the user to
16404 * login by AV.User.logInWithMobilePhoneSmsCode function.
16405 *
16406 * @param {String} mobilePhoneNumber The mobile phone number associated with the
16407 * user that want to login by AV.User.logInWithMobilePhoneSmsCode
16408 * @param {SMSAuthOptions} [options]
16409 * @return {Promise}
16410 */
16411 requestLoginSmsCode: function requestLoginSmsCode(mobilePhoneNumber) {
16412 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
16413
16414 var data = {
16415 mobilePhoneNumber: mobilePhoneNumber
16416 };
16417 if (options.validateToken) {
16418 data.validate_token = options.validateToken;
16419 }
16420 var request = AVRequest('requestLoginSmsCode', null, null, 'POST', data, options);
16421 return request;
16422 },
16423
16424 /**
16425 * Retrieves the currently logged in AVUser with a valid session,
16426 * either from memory or localStorage, if necessary.
16427 * @return {Promise.<AV.User>} resolved with the currently logged in AV.User.
16428 */
16429 currentAsync: function currentAsync() {
16430 if (AV._config.disableCurrentUser) {
16431 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');
16432 return _promise2.default.resolve(null);
16433 }
16434
16435 if (AV.User._currentUser) {
16436 return _promise2.default.resolve(AV.User._currentUser);
16437 }
16438
16439 if (AV.User._currentUserMatchesDisk) {
16440 return _promise2.default.resolve(AV.User._currentUser);
16441 }
16442
16443 return AV.localStorage.getItemAsync(AV._getAVPath(AV.User._CURRENT_USER_KEY)).then(function (userData) {
16444 if (!userData) {
16445 return null;
16446 }
16447
16448 // Load the user from local storage.
16449 AV.User._currentUserMatchesDisk = true;
16450
16451 AV.User._currentUser = AV.Object._create('_User');
16452 AV.User._currentUser._isCurrentUser = true;
16453
16454 var json = JSON.parse(userData);
16455 AV.User._currentUser.id = json._id;
16456 delete json._id;
16457 AV.User._currentUser._sessionToken = json._sessionToken;
16458 delete json._sessionToken;
16459 AV.User._currentUser._finishFetch(json);
16460 //AV.User._currentUser.set(json);
16461
16462 AV.User._currentUser._synchronizeAllAuthData();
16463 AV.User._currentUser._refreshCache();
16464 AV.User._currentUser._opSetQueue = [{}];
16465 return AV.User._currentUser;
16466 });
16467 },
16468
16469 /**
16470 * Retrieves the currently logged in AVUser with a valid session,
16471 * either from memory or localStorage, if necessary.
16472 * @return {AV.User} The currently logged in AV.User.
16473 */
16474 current: function current() {
16475 if (AV._config.disableCurrentUser) {
16476 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');
16477 return null;
16478 }
16479
16480 if (AV.localStorage.async) {
16481 var error = new Error('Synchronous API User.current() is not available in this runtime. Use User.currentAsync() instead.');
16482 error.code = 'SYNC_API_NOT_AVAILABLE';
16483 throw error;
16484 }
16485
16486 if (AV.User._currentUser) {
16487 return AV.User._currentUser;
16488 }
16489
16490 if (AV.User._currentUserMatchesDisk) {
16491 return AV.User._currentUser;
16492 }
16493
16494 // Load the user from local storage.
16495 AV.User._currentUserMatchesDisk = true;
16496
16497 var userData = AV.localStorage.getItem(AV._getAVPath(AV.User._CURRENT_USER_KEY));
16498 if (!userData) {
16499 return null;
16500 }
16501 AV.User._currentUser = AV.Object._create('_User');
16502 AV.User._currentUser._isCurrentUser = true;
16503
16504 var json = JSON.parse(userData);
16505 AV.User._currentUser.id = json._id;
16506 delete json._id;
16507 AV.User._currentUser._sessionToken = json._sessionToken;
16508 delete json._sessionToken;
16509 AV.User._currentUser._finishFetch(json);
16510 //AV.User._currentUser.set(json);
16511
16512 AV.User._currentUser._synchronizeAllAuthData();
16513 AV.User._currentUser._refreshCache();
16514 AV.User._currentUser._opSetQueue = [{}];
16515 return AV.User._currentUser;
16516 },
16517
16518 /**
16519 * Persists a user as currentUser to localStorage, and into the singleton.
16520 * @private
16521 */
16522 _saveCurrentUser: function _saveCurrentUser(user) {
16523 var promise;
16524 if (AV.User._currentUser !== user) {
16525 promise = AV.User.logOut();
16526 } else {
16527 promise = _promise2.default.resolve();
16528 }
16529 return promise.then(function () {
16530 user._isCurrentUser = true;
16531 AV.User._currentUser = user;
16532
16533 var json = user._toFullJSON();
16534 json._id = user.id;
16535 json._sessionToken = user._sessionToken;
16536 return AV.localStorage.setItemAsync(AV._getAVPath(AV.User._CURRENT_USER_KEY), (0, _stringify2.default)(json)).then(function () {
16537 AV.User._currentUserMatchesDisk = true;
16538 return AV._refreshSubscriptionId();
16539 });
16540 });
16541 },
16542
16543 _registerAuthenticationProvider: function _registerAuthenticationProvider(provider) {
16544 AV.User._authProviders[provider.getAuthType()] = provider;
16545 // Synchronize the current user with the auth provider.
16546 if (!AV._config.disableCurrentUser && AV.User.current()) {
16547 AV.User.current()._synchronizeAuthData(provider.getAuthType());
16548 }
16549 },
16550
16551 _logInWith: function _logInWith(provider, authData, options) {
16552 var user = AV.Object._create('_User');
16553 return user._linkWith(provider, authData, options);
16554 }
16555 });
16556};
16557
16558/***/ }),
16559/* 323 */
16560/***/ (function(module, exports, __webpack_require__) {
16561
16562"use strict";
16563
16564
16565exports.__esModule = true;
16566
16567var _defineProperty = __webpack_require__(86);
16568
16569var _defineProperty2 = _interopRequireDefault(_defineProperty);
16570
16571function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
16572
16573exports.default = function (obj, key, value) {
16574 if (key in obj) {
16575 (0, _defineProperty2.default)(obj, key, {
16576 value: value,
16577 enumerable: true,
16578 configurable: true,
16579 writable: true
16580 });
16581 } else {
16582 obj[key] = value;
16583 }
16584
16585 return obj;
16586};
16587
16588/***/ }),
16589/* 324 */
16590/***/ (function(module, exports, __webpack_require__) {
16591
16592"use strict";
16593
16594
16595var _stringify = __webpack_require__(18);
16596
16597var _stringify2 = _interopRequireDefault(_stringify);
16598
16599var _promise = __webpack_require__(4);
16600
16601var _promise2 = _interopRequireDefault(_promise);
16602
16603function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
16604
16605var _ = __webpack_require__(0);
16606var debug = __webpack_require__(35)('leancloud:query');
16607var AVError = __webpack_require__(29);
16608
16609var _require = __webpack_require__(12),
16610 _request = _require._request,
16611 request = _require.request;
16612
16613var _require2 = __webpack_require__(15),
16614 ensureArray = _require2.ensureArray,
16615 transformFetchOptions = _require2.transformFetchOptions,
16616 continueWhile = _require2.continueWhile;
16617
16618var requires = function requires(value, message) {
16619 if (value === undefined) {
16620 throw new Error(message);
16621 }
16622};
16623
16624// AV.Query is a way to create a list of AV.Objects.
16625module.exports = function (AV) {
16626 /**
16627 * Creates a new AV.Query for the given AV.Object subclass.
16628 * @param {Class|String} objectClass An instance of a subclass of AV.Object, or a AV className string.
16629 * @class
16630 *
16631 * <p>AV.Query defines a query that is used to fetch AV.Objects. The
16632 * most common use case is finding all objects that match a query through the
16633 * <code>find</code> method. For example, this sample code fetches all objects
16634 * of class <code>MyClass</code>. It calls a different function depending on
16635 * whether the fetch succeeded or not.
16636 *
16637 * <pre>
16638 * var query = new AV.Query(MyClass);
16639 * query.find().then(function(results) {
16640 * // results is an array of AV.Object.
16641 * }, function(error) {
16642 * // error is an instance of AVError.
16643 * });</pre></p>
16644 *
16645 * <p>An AV.Query can also be used to retrieve a single object whose id is
16646 * known, through the get method. For example, this sample code fetches an
16647 * object of class <code>MyClass</code> and id <code>myId</code>. It calls a
16648 * different function depending on whether the fetch succeeded or not.
16649 *
16650 * <pre>
16651 * var query = new AV.Query(MyClass);
16652 * query.get(myId).then(function(object) {
16653 * // object is an instance of AV.Object.
16654 * }, function(error) {
16655 * // error is an instance of AVError.
16656 * });</pre></p>
16657 *
16658 * <p>An AV.Query can also be used to count the number of objects that match
16659 * the query without retrieving all of those objects. For example, this
16660 * sample code counts the number of objects of the class <code>MyClass</code>
16661 * <pre>
16662 * var query = new AV.Query(MyClass);
16663 * query.count().then(function(number) {
16664 * // There are number instances of MyClass.
16665 * }, function(error) {
16666 * // error is an instance of AVError.
16667 * });</pre></p>
16668 */
16669 AV.Query = function (objectClass) {
16670 if (_.isString(objectClass)) {
16671 objectClass = AV.Object._getSubclass(objectClass);
16672 }
16673
16674 this.objectClass = objectClass;
16675
16676 this.className = objectClass.prototype.className;
16677
16678 this._where = {};
16679 this._include = [];
16680 this._select = [];
16681 this._limit = -1; // negative limit means, do not send a limit
16682 this._skip = 0;
16683 this._defaultParams = {};
16684 };
16685
16686 /**
16687 * Constructs a AV.Query that is the OR of the passed in queries. For
16688 * example:
16689 * <pre>var compoundQuery = AV.Query.or(query1, query2, query3);</pre>
16690 *
16691 * will create a compoundQuery that is an or of the query1, query2, and
16692 * query3.
16693 * @param {...AV.Query} var_args The list of queries to OR.
16694 * @return {AV.Query} The query that is the OR of the passed in queries.
16695 */
16696 AV.Query.or = function () {
16697 var queries = _.toArray(arguments);
16698 var className = null;
16699 AV._arrayEach(queries, function (q) {
16700 if (_.isNull(className)) {
16701 className = q.className;
16702 }
16703
16704 if (className !== q.className) {
16705 throw new Error('All queries must be for the same class');
16706 }
16707 });
16708 var query = new AV.Query(className);
16709 query._orQuery(queries);
16710 return query;
16711 };
16712
16713 /**
16714 * Constructs a AV.Query that is the AND of the passed in queries. For
16715 * example:
16716 * <pre>var compoundQuery = AV.Query.and(query1, query2, query3);</pre>
16717 *
16718 * will create a compoundQuery that is an 'and' of the query1, query2, and
16719 * query3.
16720 * @param {...AV.Query} var_args The list of queries to AND.
16721 * @return {AV.Query} The query that is the AND of the passed in queries.
16722 */
16723 AV.Query.and = function () {
16724 var queries = _.toArray(arguments);
16725 var className = null;
16726 AV._arrayEach(queries, function (q) {
16727 if (_.isNull(className)) {
16728 className = q.className;
16729 }
16730
16731 if (className !== q.className) {
16732 throw new Error('All queries must be for the same class');
16733 }
16734 });
16735 var query = new AV.Query(className);
16736 query._andQuery(queries);
16737 return query;
16738 };
16739
16740 /**
16741 * Retrieves a list of AVObjects that satisfy the CQL.
16742 * CQL syntax please see {@link https://leancloud.cn/docs/cql_guide.html CQL Guide}.
16743 *
16744 * @param {String} cql A CQL string, see {@link https://leancloud.cn/docs/cql_guide.html CQL Guide}.
16745 * @param {Array} pvalues An array contains placeholder values.
16746 * @param {AuthOptions} options
16747 * @return {Promise} A promise that is resolved with the results when
16748 * the query completes.
16749 */
16750 AV.Query.doCloudQuery = function (cql, pvalues, options) {
16751 var params = { cql: cql };
16752 if (_.isArray(pvalues)) {
16753 params.pvalues = pvalues;
16754 } else {
16755 options = pvalues;
16756 }
16757
16758 var request = _request('cloudQuery', null, null, 'GET', params, options);
16759 return request.then(function (response) {
16760 //query to process results.
16761 var query = new AV.Query(response.className);
16762 var results = _.map(response.results, function (json) {
16763 var obj = query._newObject(response);
16764 if (obj._finishFetch) {
16765 obj._finishFetch(query._processResult(json), true);
16766 }
16767 return obj;
16768 });
16769 return {
16770 results: results,
16771 count: response.count,
16772 className: response.className
16773 };
16774 });
16775 };
16776
16777 /**
16778 * Return a query with conditions from json.
16779 * This can be useful to send a query from server side to client side.
16780 * @since 4.0.0
16781 * @param {Object} json from {@link AV.Query#toJSON}
16782 * @return {AV.Query}
16783 */
16784 AV.Query.fromJSON = function (_ref) {
16785 var className = _ref.className,
16786 where = _ref.where,
16787 include = _ref.include,
16788 select = _ref.select,
16789 includeACL = _ref.includeACL,
16790 limit = _ref.limit,
16791 skip = _ref.skip,
16792 order = _ref.order;
16793
16794 if (typeof className !== 'string') {
16795 throw new TypeError('Invalid Query JSON, className must be a String.');
16796 }
16797 var query = new AV.Query(className);
16798 _.extend(query, {
16799 _where: where,
16800 _include: include,
16801 _select: select,
16802 _includeACL: includeACL,
16803 _limit: limit,
16804 _skip: skip,
16805 _order: order
16806 });
16807 return query;
16808 };
16809
16810 AV.Query._extend = AV._extend;
16811
16812 _.extend(AV.Query.prototype,
16813 /** @lends AV.Query.prototype */{
16814 //hook to iterate result. Added by dennis<xzhuang@avoscloud.com>.
16815 _processResult: function _processResult(obj) {
16816 return obj;
16817 },
16818
16819 /**
16820 * Constructs an AV.Object whose id is already known by fetching data from
16821 * the server.
16822 *
16823 * @param {String} objectId The id of the object to be fetched.
16824 * @param {AuthOptions} options
16825 * @return {Promise.<AV.Object>}
16826 */
16827 get: function get(objectId, options) {
16828 if (!_.isString(objectId)) {
16829 throw new Error('objectId must be a string');
16830 }
16831 if (objectId === '') {
16832 return _promise2.default.reject(new AVError(AVError.OBJECT_NOT_FOUND, 'Object not found.'));
16833 }
16834
16835 var obj = this._newObject();
16836 obj.id = objectId;
16837
16838 var queryJSON = this._getParams();
16839 var fetchOptions = {};
16840
16841 if (queryJSON.keys) fetchOptions.keys = queryJSON.keys;
16842 if (queryJSON.include) fetchOptions.include = queryJSON.include;
16843 if (queryJSON.includeACL) fetchOptions.includeACL = queryJSON.includeACL;
16844
16845 return _request('classes', this.className, objectId, 'GET', transformFetchOptions(fetchOptions), options).then(function (response) {
16846 if (_.isEmpty(response)) throw new AVError(AVError.OBJECT_NOT_FOUND, 'Object not found.');
16847 obj._finishFetch(obj.parse(response), true);
16848 return obj;
16849 });
16850 },
16851
16852 /**
16853 * Returns a JSON representation of this query.
16854 * @return {Object}
16855 */
16856 toJSON: function toJSON() {
16857 var className = this.className,
16858 where = this._where,
16859 include = this._include,
16860 select = this._select,
16861 includeACL = this._includeACL,
16862 limit = this._limit,
16863 skip = this._skip,
16864 order = this._order;
16865
16866 return {
16867 className: className,
16868 where: where,
16869 include: include,
16870 select: select,
16871 includeACL: includeACL,
16872 limit: limit,
16873 skip: skip,
16874 order: order
16875 };
16876 },
16877
16878
16879 _getParams: function _getParams() {
16880 var params = _.extend({}, this._defaultParams, {
16881 where: this._where
16882 });
16883
16884 if (this._include.length > 0) {
16885 params.include = this._include.join(',');
16886 }
16887 if (this._select.length > 0) {
16888 params.keys = this._select.join(',');
16889 }
16890 if (this._includeACL !== undefined) {
16891 params.returnACL = this._includeACL;
16892 }
16893 if (this._limit >= 0) {
16894 params.limit = this._limit;
16895 }
16896 if (this._skip > 0) {
16897 params.skip = this._skip;
16898 }
16899 if (this._order !== undefined) {
16900 params.order = this._order;
16901 }
16902
16903 return params;
16904 },
16905
16906 _newObject: function _newObject(response) {
16907 var obj;
16908 if (response && response.className) {
16909 obj = new AV.Object(response.className);
16910 } else {
16911 obj = new this.objectClass();
16912 }
16913 return obj;
16914 },
16915 _createRequest: function _createRequest() {
16916 var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this._getParams();
16917 var options = arguments[1];
16918 var path = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '/classes/' + this.className;
16919
16920 if (encodeURIComponent((0, _stringify2.default)(params)).length > 2000) {
16921 var body = {
16922 requests: [{
16923 method: 'GET',
16924 path: '/1.1' + path,
16925 params: params
16926 }]
16927 };
16928 return request({
16929 path: '/batch',
16930 method: 'POST',
16931 data: body,
16932 authOptions: options
16933 }).then(function (response) {
16934 var result = response[0];
16935 if (result.success) {
16936 return result.success;
16937 }
16938 var error = new Error(result.error.error || 'Unknown batch error');
16939 error.code = result.error.code;
16940 throw error;
16941 });
16942 }
16943 return request({
16944 method: 'GET',
16945 path: path,
16946 query: params,
16947 authOptions: options
16948 });
16949 },
16950 _parseResponse: function _parseResponse(response) {
16951 var _this = this;
16952
16953 return _.map(response.results, function (json) {
16954 var obj = _this._newObject(response);
16955 if (obj._finishFetch) {
16956 obj._finishFetch(_this._processResult(json), true);
16957 }
16958 return obj;
16959 });
16960 },
16961
16962
16963 /**
16964 * Retrieves a list of AVObjects that satisfy this query.
16965 *
16966 * @param {AuthOptions} options
16967 * @return {Promise} A promise that is resolved with the results when
16968 * the query completes.
16969 */
16970 find: function find(options) {
16971 var request = this._createRequest(undefined, options);
16972 return request.then(this._parseResponse.bind(this));
16973 },
16974
16975
16976 /**
16977 * Retrieves both AVObjects and total count.
16978 *
16979 * @since 4.12.0
16980 * @param {AuthOptions} options
16981 * @return {Promise} A tuple contains results and count.
16982 */
16983 findAndCount: function findAndCount(options) {
16984 var _this2 = this;
16985
16986 var params = this._getParams();
16987 params.count = 1;
16988 var request = this._createRequest(params, options);
16989
16990 return request.then(function (response) {
16991 return [_this2._parseResponse(response), response.count];
16992 });
16993 },
16994
16995
16996 /**
16997 * scan a Query. masterKey required.
16998 *
16999 * @since 2.1.0
17000 * @param {object} [options]
17001 * @param {string} [options.orderedBy] specify the key to sort
17002 * @param {number} [options.batchSize] specify the batch size for each request
17003 * @param {AuthOptions} [authOptions]
17004 * @return {AsyncIterator.<AV.Object>}
17005 * @example const testIterator = {
17006 * [Symbol.asyncIterator]() {
17007 * return new Query('Test').scan(undefined, { useMasterKey: true });
17008 * },
17009 * };
17010 * for await (const test of testIterator) {
17011 * console.log(test.id);
17012 * }
17013 */
17014 scan: function scan() {
17015 var _this3 = this;
17016
17017 var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
17018 orderedBy = _ref2.orderedBy,
17019 batchSize = _ref2.batchSize;
17020
17021 var authOptions = arguments[1];
17022
17023 var condition = this._getParams();
17024 debug('scan %O', condition);
17025 if (condition.order) {
17026 console.warn('The order of the query is ignored for Query#scan. Checkout the orderedBy option of Query#scan.');
17027 delete condition.order;
17028 }
17029 if (condition.skip) {
17030 console.warn('The skip option of the query is ignored for Query#scan.');
17031 delete condition.skip;
17032 }
17033 if (condition.limit) {
17034 console.warn('The limit option of the query is ignored for Query#scan.');
17035 delete condition.limit;
17036 }
17037 if (orderedBy) condition.scan_key = orderedBy;
17038 if (batchSize) condition.limit = batchSize;
17039 var promise = _promise2.default.resolve([]);
17040 var cursor = void 0;
17041 var endReached = false;
17042 return {
17043 next: function next() {
17044 promise = promise.then(function (remainResults) {
17045 if (endReached) return [];
17046 if (remainResults.length > 1) return remainResults;
17047 // no cursor means we have reached the end
17048 // except for the first time
17049 if (!cursor && remainResults.length !== 0) {
17050 endReached = true;
17051 return remainResults;
17052 }
17053 // when only 1 item left in queue
17054 // start the next request to see if it is the last one
17055 return _request('scan/classes', _this3.className, null, 'GET', cursor ? _.extend({}, condition, { cursor: cursor }) : condition, authOptions).then(function (response) {
17056 cursor = response.cursor;
17057 return _this3._parseResponse(response);
17058 }).then(function (results) {
17059 if (!results.length) endReached = true;
17060 return remainResults.concat(results);
17061 });
17062 });
17063 return promise.then(function (remainResults) {
17064 return remainResults.shift();
17065 }).then(function (result) {
17066 return {
17067 value: result,
17068 done: result === undefined
17069 };
17070 });
17071 }
17072 };
17073 },
17074
17075
17076 /**
17077 * Delete objects retrieved by this query.
17078 * @param {AuthOptions} options
17079 * @return {Promise} A promise that is fulfilled when the save
17080 * completes.
17081 */
17082 destroyAll: function destroyAll(options) {
17083 var self = this;
17084 return self.find(options).then(function (objects) {
17085 return AV.Object.destroyAll(objects, options);
17086 });
17087 },
17088
17089 /**
17090 * Counts the number of objects that match this query.
17091 *
17092 * @param {AuthOptions} options
17093 * @return {Promise} A promise that is resolved with the count when
17094 * the query completes.
17095 */
17096 count: function count(options) {
17097 var params = this._getParams();
17098 params.limit = 0;
17099 params.count = 1;
17100 var request = this._createRequest(params, options);
17101
17102 return request.then(function (response) {
17103 return response.count;
17104 });
17105 },
17106
17107 /**
17108 * Retrieves at most one AV.Object that satisfies this query.
17109 *
17110 * @param {AuthOptions} options
17111 * @return {Promise} A promise that is resolved with the object when
17112 * the query completes.
17113 */
17114 first: function first(options) {
17115 var self = this;
17116
17117 var params = this._getParams();
17118 params.limit = 1;
17119 var request = this._createRequest(params, options);
17120
17121 return request.then(function (response) {
17122 return _.map(response.results, function (json) {
17123 var obj = self._newObject();
17124 if (obj._finishFetch) {
17125 obj._finishFetch(self._processResult(json), true);
17126 }
17127 return obj;
17128 })[0];
17129 });
17130 },
17131
17132 /**
17133 * Sets the number of results to skip before returning any results.
17134 * This is useful for pagination.
17135 * Default is to skip zero results.
17136 * @param {Number} n the number of results to skip.
17137 * @return {AV.Query} Returns the query, so you can chain this call.
17138 */
17139 skip: function skip(n) {
17140 requires(n, 'undefined is not a valid skip value');
17141 this._skip = n;
17142 return this;
17143 },
17144
17145 /**
17146 * Sets the limit of the number of results to return. The default limit is
17147 * 100, with a maximum of 1000 results being returned at a time.
17148 * @param {Number} n the number of results to limit to.
17149 * @return {AV.Query} Returns the query, so you can chain this call.
17150 */
17151 limit: function limit(n) {
17152 requires(n, 'undefined is not a valid limit value');
17153 this._limit = n;
17154 return this;
17155 },
17156
17157 /**
17158 * Add a constraint to the query that requires a particular key's value to
17159 * be equal to the provided value.
17160 * @param {String} key The key to check.
17161 * @param value The value that the AV.Object must contain.
17162 * @return {AV.Query} Returns the query, so you can chain this call.
17163 */
17164 equalTo: function equalTo(key, value) {
17165 requires(key, 'undefined is not a valid key');
17166 requires(value, 'undefined is not a valid value');
17167 this._where[key] = AV._encode(value);
17168 return this;
17169 },
17170
17171 /**
17172 * Helper for condition queries
17173 * @private
17174 */
17175 _addCondition: function _addCondition(key, condition, value) {
17176 requires(key, 'undefined is not a valid condition key');
17177 requires(condition, 'undefined is not a valid condition');
17178 requires(value, 'undefined is not a valid condition value');
17179
17180 // Check if we already have a condition
17181 if (!this._where[key]) {
17182 this._where[key] = {};
17183 }
17184 this._where[key][condition] = AV._encode(value);
17185 return this;
17186 },
17187
17188 /**
17189 * Add a constraint to the query that requires a particular
17190 * <strong>array</strong> key's length to be equal to the provided value.
17191 * @param {String} key The array key to check.
17192 * @param value The length value.
17193 * @return {AV.Query} Returns the query, so you can chain this call.
17194 */
17195 sizeEqualTo: function sizeEqualTo(key, value) {
17196 this._addCondition(key, '$size', value);
17197 return this;
17198 },
17199
17200 /**
17201 * Add a constraint to the query that requires a particular key's value to
17202 * be not equal to the provided value.
17203 * @param {String} key The key to check.
17204 * @param value The value that must not be equalled.
17205 * @return {AV.Query} Returns the query, so you can chain this call.
17206 */
17207 notEqualTo: function notEqualTo(key, value) {
17208 this._addCondition(key, '$ne', value);
17209 return this;
17210 },
17211
17212 /**
17213 * Add a constraint to the query that requires a particular key's value to
17214 * be less than the provided value.
17215 * @param {String} key The key to check.
17216 * @param value The value that provides an upper bound.
17217 * @return {AV.Query} Returns the query, so you can chain this call.
17218 */
17219 lessThan: function lessThan(key, value) {
17220 this._addCondition(key, '$lt', value);
17221 return this;
17222 },
17223
17224 /**
17225 * Add a constraint to the query that requires a particular key's value to
17226 * be greater than the provided value.
17227 * @param {String} key The key to check.
17228 * @param value The value that provides an lower bound.
17229 * @return {AV.Query} Returns the query, so you can chain this call.
17230 */
17231 greaterThan: function greaterThan(key, value) {
17232 this._addCondition(key, '$gt', value);
17233 return this;
17234 },
17235
17236 /**
17237 * Add a constraint to the query that requires a particular key's value to
17238 * be less than or equal to the provided value.
17239 * @param {String} key The key to check.
17240 * @param value The value that provides an upper bound.
17241 * @return {AV.Query} Returns the query, so you can chain this call.
17242 */
17243 lessThanOrEqualTo: function lessThanOrEqualTo(key, value) {
17244 this._addCondition(key, '$lte', value);
17245 return this;
17246 },
17247
17248 /**
17249 * Add a constraint to the query that requires a particular key's value to
17250 * be greater than or equal to the provided value.
17251 * @param {String} key The key to check.
17252 * @param value The value that provides an lower bound.
17253 * @return {AV.Query} Returns the query, so you can chain this call.
17254 */
17255 greaterThanOrEqualTo: function greaterThanOrEqualTo(key, value) {
17256 this._addCondition(key, '$gte', value);
17257 return this;
17258 },
17259
17260 /**
17261 * Add a constraint to the query that requires a particular key's value to
17262 * be contained in the provided list of values.
17263 * @param {String} key The key to check.
17264 * @param {Array} values The values that will match.
17265 * @return {AV.Query} Returns the query, so you can chain this call.
17266 */
17267 containedIn: function containedIn(key, values) {
17268 this._addCondition(key, '$in', values);
17269 return this;
17270 },
17271
17272 /**
17273 * Add a constraint to the query that requires a particular key's value to
17274 * not be contained in the provided list of values.
17275 * @param {String} key The key to check.
17276 * @param {Array} values The values that will not match.
17277 * @return {AV.Query} Returns the query, so you can chain this call.
17278 */
17279 notContainedIn: function notContainedIn(key, values) {
17280 this._addCondition(key, '$nin', values);
17281 return this;
17282 },
17283
17284 /**
17285 * Add a constraint to the query that requires a particular key's value to
17286 * contain each one of the provided list of values.
17287 * @param {String} key The key to check. This key's value must be an array.
17288 * @param {Array} values The values that will match.
17289 * @return {AV.Query} Returns the query, so you can chain this call.
17290 */
17291 containsAll: function containsAll(key, values) {
17292 this._addCondition(key, '$all', values);
17293 return this;
17294 },
17295
17296 /**
17297 * Add a constraint for finding objects that contain the given key.
17298 * @param {String} key The key that should exist.
17299 * @return {AV.Query} Returns the query, so you can chain this call.
17300 */
17301 exists: function exists(key) {
17302 this._addCondition(key, '$exists', true);
17303 return this;
17304 },
17305
17306 /**
17307 * Add a constraint for finding objects that do not contain a given key.
17308 * @param {String} key The key that should not exist
17309 * @return {AV.Query} Returns the query, so you can chain this call.
17310 */
17311 doesNotExist: function doesNotExist(key) {
17312 this._addCondition(key, '$exists', false);
17313 return this;
17314 },
17315
17316 /**
17317 * Add a regular expression constraint for finding string values that match
17318 * the provided regular expression.
17319 * This may be slow for large datasets.
17320 * @param {String} key The key that the string to match is stored in.
17321 * @param {RegExp} regex The regular expression pattern to match.
17322 * @return {AV.Query} Returns the query, so you can chain this call.
17323 */
17324 matches: function matches(key, regex, modifiers) {
17325 this._addCondition(key, '$regex', regex);
17326 if (!modifiers) {
17327 modifiers = '';
17328 }
17329 // Javascript regex options support mig as inline options but store them
17330 // as properties of the object. We support mi & should migrate them to
17331 // modifiers
17332 if (regex.ignoreCase) {
17333 modifiers += 'i';
17334 }
17335 if (regex.multiline) {
17336 modifiers += 'm';
17337 }
17338
17339 if (modifiers && modifiers.length) {
17340 this._addCondition(key, '$options', modifiers);
17341 }
17342 return this;
17343 },
17344
17345 /**
17346 * Add a constraint that requires that a key's value matches a AV.Query
17347 * constraint.
17348 * @param {String} key The key that the contains the object to match the
17349 * query.
17350 * @param {AV.Query} query The query that should match.
17351 * @return {AV.Query} Returns the query, so you can chain this call.
17352 */
17353 matchesQuery: function matchesQuery(key, query) {
17354 var queryJSON = query._getParams();
17355 queryJSON.className = query.className;
17356 this._addCondition(key, '$inQuery', queryJSON);
17357 return this;
17358 },
17359
17360 /**
17361 * Add a constraint that requires that a key's value not matches a
17362 * AV.Query constraint.
17363 * @param {String} key The key that the contains the object to match the
17364 * query.
17365 * @param {AV.Query} query The query that should not match.
17366 * @return {AV.Query} Returns the query, so you can chain this call.
17367 */
17368 doesNotMatchQuery: function doesNotMatchQuery(key, query) {
17369 var queryJSON = query._getParams();
17370 queryJSON.className = query.className;
17371 this._addCondition(key, '$notInQuery', queryJSON);
17372 return this;
17373 },
17374
17375 /**
17376 * Add a constraint that requires that a key's value matches a value in
17377 * an object returned by a different AV.Query.
17378 * @param {String} key The key that contains the value that is being
17379 * matched.
17380 * @param {String} queryKey The key in the objects returned by the query to
17381 * match against.
17382 * @param {AV.Query} query The query to run.
17383 * @return {AV.Query} Returns the query, so you can chain this call.
17384 */
17385 matchesKeyInQuery: function matchesKeyInQuery(key, queryKey, query) {
17386 var queryJSON = query._getParams();
17387 queryJSON.className = query.className;
17388 this._addCondition(key, '$select', { key: queryKey, query: queryJSON });
17389 return this;
17390 },
17391
17392 /**
17393 * Add a constraint that requires that a key's value not match a value in
17394 * an object returned by a different AV.Query.
17395 * @param {String} key The key that contains the value that is being
17396 * excluded.
17397 * @param {String} queryKey The key in the objects returned by the query to
17398 * match against.
17399 * @param {AV.Query} query The query to run.
17400 * @return {AV.Query} Returns the query, so you can chain this call.
17401 */
17402 doesNotMatchKeyInQuery: function doesNotMatchKeyInQuery(key, queryKey, query) {
17403 var queryJSON = query._getParams();
17404 queryJSON.className = query.className;
17405 this._addCondition(key, '$dontSelect', {
17406 key: queryKey,
17407 query: queryJSON
17408 });
17409 return this;
17410 },
17411
17412 /**
17413 * Add constraint that at least one of the passed in queries matches.
17414 * @param {Array} queries
17415 * @return {AV.Query} Returns the query, so you can chain this call.
17416 * @private
17417 */
17418 _orQuery: function _orQuery(queries) {
17419 var queryJSON = _.map(queries, function (q) {
17420 return q._getParams().where;
17421 });
17422
17423 this._where.$or = queryJSON;
17424 return this;
17425 },
17426
17427 /**
17428 * Add constraint that both of the passed in queries matches.
17429 * @param {Array} queries
17430 * @return {AV.Query} Returns the query, so you can chain this call.
17431 * @private
17432 */
17433 _andQuery: function _andQuery(queries) {
17434 var queryJSON = _.map(queries, function (q) {
17435 return q._getParams().where;
17436 });
17437
17438 this._where.$and = queryJSON;
17439 return this;
17440 },
17441
17442 /**
17443 * Converts a string into a regex that matches it.
17444 * Surrounding with \Q .. \E does this, we just need to escape \E's in
17445 * the text separately.
17446 * @private
17447 */
17448 _quote: function _quote(s) {
17449 return '\\Q' + s.replace('\\E', '\\E\\\\E\\Q') + '\\E';
17450 },
17451
17452 /**
17453 * Add a constraint for finding string values that contain a provided
17454 * string. This may be slow for large datasets.
17455 * @param {String} key The key that the string to match is stored in.
17456 * @param {String} substring The substring that the value must contain.
17457 * @return {AV.Query} Returns the query, so you can chain this call.
17458 */
17459 contains: function contains(key, value) {
17460 this._addCondition(key, '$regex', this._quote(value));
17461 return this;
17462 },
17463
17464 /**
17465 * Add a constraint for finding string values that start with a provided
17466 * string. This query will use the backend index, so it will be fast even
17467 * for large datasets.
17468 * @param {String} key The key that the string to match is stored in.
17469 * @param {String} prefix The substring that the value must start with.
17470 * @return {AV.Query} Returns the query, so you can chain this call.
17471 */
17472 startsWith: function startsWith(key, value) {
17473 this._addCondition(key, '$regex', '^' + this._quote(value));
17474 return this;
17475 },
17476
17477 /**
17478 * Add a constraint for finding string values that end with a provided
17479 * string. This will be slow for large datasets.
17480 * @param {String} key The key that the string to match is stored in.
17481 * @param {String} suffix The substring that the value must end with.
17482 * @return {AV.Query} Returns the query, so you can chain this call.
17483 */
17484 endsWith: function endsWith(key, value) {
17485 this._addCondition(key, '$regex', this._quote(value) + '$');
17486 return this;
17487 },
17488
17489 /**
17490 * Sorts the results in ascending order by the given key.
17491 *
17492 * @param {String} key The key to order by.
17493 * @return {AV.Query} Returns the query, so you can chain this call.
17494 */
17495 ascending: function ascending(key) {
17496 requires(key, 'undefined is not a valid key');
17497 this._order = key;
17498 return this;
17499 },
17500
17501 /**
17502 * Also sorts the results in ascending order by the given key. The previous sort keys have
17503 * precedence over this key.
17504 *
17505 * @param {String} key The key to order by
17506 * @return {AV.Query} Returns the query so you can chain this call.
17507 */
17508 addAscending: function addAscending(key) {
17509 requires(key, 'undefined is not a valid key');
17510 if (this._order) this._order += ',' + key;else this._order = key;
17511 return this;
17512 },
17513
17514 /**
17515 * Sorts the results in descending order by the given key.
17516 *
17517 * @param {String} key The key to order by.
17518 * @return {AV.Query} Returns the query, so you can chain this call.
17519 */
17520 descending: function descending(key) {
17521 requires(key, 'undefined is not a valid key');
17522 this._order = '-' + key;
17523 return this;
17524 },
17525
17526 /**
17527 * Also sorts the results in descending order by the given key. The previous sort keys have
17528 * precedence over this key.
17529 *
17530 * @param {String} key The key to order by
17531 * @return {AV.Query} Returns the query so you can chain this call.
17532 */
17533 addDescending: function addDescending(key) {
17534 requires(key, 'undefined is not a valid key');
17535 if (this._order) this._order += ',-' + key;else this._order = '-' + key;
17536 return this;
17537 },
17538
17539 /**
17540 * Add a proximity based constraint for finding objects with key point
17541 * values near the point given.
17542 * @param {String} key The key that the AV.GeoPoint is stored in.
17543 * @param {AV.GeoPoint} point The reference AV.GeoPoint that is used.
17544 * @return {AV.Query} Returns the query, so you can chain this call.
17545 */
17546 near: function near(key, point) {
17547 if (!(point instanceof AV.GeoPoint)) {
17548 // Try to cast it to a GeoPoint, so that near("loc", [20,30]) works.
17549 point = new AV.GeoPoint(point);
17550 }
17551 this._addCondition(key, '$nearSphere', point);
17552 return this;
17553 },
17554
17555 /**
17556 * Add a proximity based constraint for finding objects with key point
17557 * values near the point given and within the maximum distance given.
17558 * @param {String} key The key that the AV.GeoPoint is stored in.
17559 * @param {AV.GeoPoint} point The reference AV.GeoPoint that is used.
17560 * @param maxDistance Maximum distance (in radians) of results to return.
17561 * @return {AV.Query} Returns the query, so you can chain this call.
17562 */
17563 withinRadians: function withinRadians(key, point, distance) {
17564 this.near(key, point);
17565 this._addCondition(key, '$maxDistance', distance);
17566 return this;
17567 },
17568
17569 /**
17570 * Add a proximity based constraint for finding objects with key point
17571 * values near the point given and within the maximum distance given.
17572 * Radius of earth used is 3958.8 miles.
17573 * @param {String} key The key that the AV.GeoPoint is stored in.
17574 * @param {AV.GeoPoint} point The reference AV.GeoPoint that is used.
17575 * @param {Number} maxDistance Maximum distance (in miles) of results to
17576 * return.
17577 * @return {AV.Query} Returns the query, so you can chain this call.
17578 */
17579 withinMiles: function withinMiles(key, point, distance) {
17580 return this.withinRadians(key, point, distance / 3958.8);
17581 },
17582
17583 /**
17584 * Add a proximity based constraint for finding objects with key point
17585 * values near the point given and within the maximum distance given.
17586 * Radius of earth used is 6371.0 kilometers.
17587 * @param {String} key The key that the AV.GeoPoint is stored in.
17588 * @param {AV.GeoPoint} point The reference AV.GeoPoint that is used.
17589 * @param {Number} maxDistance Maximum distance (in kilometers) of results
17590 * to return.
17591 * @return {AV.Query} Returns the query, so you can chain this call.
17592 */
17593 withinKilometers: function withinKilometers(key, point, distance) {
17594 return this.withinRadians(key, point, distance / 6371.0);
17595 },
17596
17597 /**
17598 * Add a constraint to the query that requires a particular key's
17599 * coordinates be contained within a given rectangular geographic bounding
17600 * box.
17601 * @param {String} key The key to be constrained.
17602 * @param {AV.GeoPoint} southwest
17603 * The lower-left inclusive corner of the box.
17604 * @param {AV.GeoPoint} northeast
17605 * The upper-right inclusive corner of the box.
17606 * @return {AV.Query} Returns the query, so you can chain this call.
17607 */
17608 withinGeoBox: function withinGeoBox(key, southwest, northeast) {
17609 if (!(southwest instanceof AV.GeoPoint)) {
17610 southwest = new AV.GeoPoint(southwest);
17611 }
17612 if (!(northeast instanceof AV.GeoPoint)) {
17613 northeast = new AV.GeoPoint(northeast);
17614 }
17615 this._addCondition(key, '$within', { $box: [southwest, northeast] });
17616 return this;
17617 },
17618
17619 /**
17620 * Include nested AV.Objects for the provided key. You can use dot
17621 * notation to specify which fields in the included object are also fetch.
17622 * @param {String[]} keys The name of the key to include.
17623 * @return {AV.Query} Returns the query, so you can chain this call.
17624 */
17625 include: function include(keys) {
17626 var _this4 = this;
17627
17628 requires(keys, 'undefined is not a valid key');
17629 _.forEach(arguments, function (keys) {
17630 _this4._include = _this4._include.concat(ensureArray(keys));
17631 });
17632 return this;
17633 },
17634
17635 /**
17636 * Include the ACL.
17637 * @param {Boolean} [value=true] Whether to include the ACL
17638 * @return {AV.Query} Returns the query, so you can chain this call.
17639 */
17640 includeACL: function includeACL() {
17641 var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
17642
17643 this._includeACL = value;
17644 return this;
17645 },
17646
17647 /**
17648 * Restrict the fields of the returned AV.Objects to include only the
17649 * provided keys. If this is called multiple times, then all of the keys
17650 * specified in each of the calls will be included.
17651 * @param {String[]} keys The names of the keys to include.
17652 * @return {AV.Query} Returns the query, so you can chain this call.
17653 */
17654 select: function select(keys) {
17655 var _this5 = this;
17656
17657 requires(keys, 'undefined is not a valid key');
17658 _.forEach(arguments, function (keys) {
17659 _this5._select = _this5._select.concat(ensureArray(keys));
17660 });
17661 return this;
17662 },
17663
17664 /**
17665 * Iterates over each result of a query, calling a callback for each one. If
17666 * the callback returns a promise, the iteration will not continue until
17667 * that promise has been fulfilled. If the callback returns a rejected
17668 * promise, then iteration will stop with that error. The items are
17669 * processed in an unspecified order. The query may not have any sort order,
17670 * and may not use limit or skip.
17671 * @param callback {Function} Callback that will be called with each result
17672 * of the query.
17673 * @return {Promise} A promise that will be fulfilled once the
17674 * iteration has completed.
17675 */
17676 each: function each(callback) {
17677 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
17678
17679 if (this._order || this._skip || this._limit >= 0) {
17680 var error = new Error('Cannot iterate on a query with sort, skip, or limit.');
17681 return _promise2.default.reject(error);
17682 }
17683
17684 var query = new AV.Query(this.objectClass);
17685 // We can override the batch size from the options.
17686 // This is undocumented, but useful for testing.
17687 query._limit = options.batchSize || 100;
17688 query._where = _.clone(this._where);
17689 query._include = _.clone(this._include);
17690
17691 query.ascending('objectId');
17692
17693 var finished = false;
17694 return continueWhile(function () {
17695 return !finished;
17696 }, function () {
17697 return query.find(options).then(function (results) {
17698 var callbacksDone = _promise2.default.resolve();
17699 _.each(results, function (result) {
17700 callbacksDone = callbacksDone.then(function () {
17701 return callback(result);
17702 });
17703 });
17704
17705 return callbacksDone.then(function () {
17706 if (results.length >= query._limit) {
17707 query.greaterThan('objectId', results[results.length - 1].id);
17708 } else {
17709 finished = true;
17710 }
17711 });
17712 });
17713 });
17714 },
17715
17716 /**
17717 * Subscribe the changes of this query.
17718 *
17719 * LiveQuery is not included in the default bundle: {@link https://url.leanapp.cn/enable-live-query}.
17720 *
17721 * @since 3.0.0
17722 * @return {AV.LiveQuery} An eventemitter which can be used to get LiveQuery updates;
17723 */
17724 subscribe: function subscribe(options) {
17725 return AV.LiveQuery.init(this, options);
17726 }
17727 });
17728
17729 AV.FriendShipQuery = AV.Query._extend({
17730 _newObject: function _newObject() {
17731 var UserClass = AV.Object._getSubclass('_User');
17732 return new UserClass();
17733 },
17734 _processResult: function _processResult(json) {
17735 if (json && json[this._friendshipTag]) {
17736 var user = json[this._friendshipTag];
17737 if (user.__type === 'Pointer' && user.className === '_User') {
17738 delete user.__type;
17739 delete user.className;
17740 }
17741 return user;
17742 } else {
17743 return null;
17744 }
17745 }
17746 });
17747};
17748
17749/***/ }),
17750/* 325 */
17751/***/ (function(module, exports, __webpack_require__) {
17752
17753"use strict";
17754
17755
17756var _promise = __webpack_require__(4);
17757
17758var _promise2 = _interopRequireDefault(_promise);
17759
17760function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17761
17762var _ = __webpack_require__(0);
17763var EventEmitter = __webpack_require__(157);
17764
17765var _require = __webpack_require__(15),
17766 inherits = _require.inherits;
17767
17768var _require2 = __webpack_require__(12),
17769 request = _require2.request;
17770
17771var subscribe = function subscribe(queryJSON, subscriptionId) {
17772 return request({
17773 method: 'POST',
17774 path: '/LiveQuery/subscribe',
17775 data: {
17776 query: queryJSON,
17777 id: subscriptionId
17778 }
17779 });
17780};
17781
17782module.exports = function (AV) {
17783 var requireRealtime = function requireRealtime() {
17784 if (!AV._config.realtime) {
17785 throw new Error('LiveQuery not supported. Please use the LiveQuery bundle. https://url.leanapp.cn/enable-live-query');
17786 }
17787 };
17788 /**
17789 * @class
17790 * A LiveQuery, created by {@link AV.Query#subscribe} is an EventEmitter notifies changes of the Query.
17791 * @since 3.0.0
17792 */
17793 AV.LiveQuery = inherits(EventEmitter,
17794 /** @lends AV.LiveQuery.prototype */{
17795 constructor: function constructor(id, client, queryJSON, subscriptionId) {
17796 var _this = this;
17797
17798 EventEmitter.apply(this);
17799 this.id = id;
17800 this._client = client;
17801 this._client.register(this);
17802 this._queryJSON = queryJSON;
17803 this._subscriptionId = subscriptionId;
17804 this._onMessage = this._dispatch.bind(this);
17805 this._onReconnect = function () {
17806 subscribe(_this._queryJSON, _this._subscriptionId).catch(function (error) {
17807 return console.error('LiveQuery resubscribe error: ' + error.message);
17808 });
17809 };
17810 client.on('message', this._onMessage);
17811 client.on('reconnect', this._onReconnect);
17812 },
17813 _dispatch: function _dispatch(message) {
17814 var _this2 = this;
17815
17816 message.forEach(function (_ref) {
17817 var op = _ref.op,
17818 object = _ref.object,
17819 queryId = _ref.query_id,
17820 updatedKeys = _ref.updatedKeys;
17821
17822 if (queryId !== _this2.id) return;
17823 var target = AV.parseJSON(_.extend({
17824 __type: object.className === '_File' ? 'File' : 'Object'
17825 }, object));
17826 if (updatedKeys) {
17827 /**
17828 * An existing AV.Object which fulfills the Query you subscribe is updated.
17829 * @event AV.LiveQuery#update
17830 * @param {AV.Object|AV.File} target updated object
17831 * @param {String[]} updatedKeys updated keys
17832 */
17833 /**
17834 * An existing AV.Object which doesn't fulfill the Query is updated and now it fulfills the Query.
17835 * @event AV.LiveQuery#enter
17836 * @param {AV.Object|AV.File} target updated object
17837 * @param {String[]} updatedKeys updated keys
17838 */
17839 /**
17840 * An existing AV.Object which fulfills the Query is updated and now it doesn't fulfill the Query.
17841 * @event AV.LiveQuery#leave
17842 * @param {AV.Object|AV.File} target updated object
17843 * @param {String[]} updatedKeys updated keys
17844 */
17845 _this2.emit(op, target, updatedKeys);
17846 } else {
17847 /**
17848 * A new AV.Object which fulfills the Query you subscribe is created.
17849 * @event AV.LiveQuery#create
17850 * @param {AV.Object|AV.File} target updated object
17851 */
17852 /**
17853 * An existing AV.Object which fulfills the Query you subscribe is deleted.
17854 * @event AV.LiveQuery#delete
17855 * @param {AV.Object|AV.File} target updated object
17856 */
17857 _this2.emit(op, target);
17858 }
17859 });
17860 },
17861
17862 /**
17863 * unsubscribe the query
17864 *
17865 * @return {Promise}
17866 */
17867 unsubscribe: function unsubscribe() {
17868 var client = this._client;
17869 client.off('message', this._onMessage);
17870 client.off('reconnect', this._onReconnect);
17871 client.deregister(this);
17872 return request({
17873 method: 'POST',
17874 path: '/LiveQuery/unsubscribe',
17875 data: {
17876 id: client.id,
17877 query_id: this.id
17878 }
17879 });
17880 }
17881 },
17882 /** @lends AV.LiveQuery */
17883 {
17884 init: function init(query) {
17885 var _ref2 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
17886 _ref2$subscriptionId = _ref2.subscriptionId,
17887 userDefinedSubscriptionId = _ref2$subscriptionId === undefined ? AV._getSubscriptionId() : _ref2$subscriptionId;
17888
17889 requireRealtime();
17890 if (!(query instanceof AV.Query)) throw new TypeError('LiveQuery must be inited with a Query');
17891 return _promise2.default.resolve(userDefinedSubscriptionId).then(function (subscriptionId) {
17892 return AV._config.realtime.createLiveQueryClient(subscriptionId).then(function (liveQueryClient) {
17893 var _query$_getParams = query._getParams(),
17894 where = _query$_getParams.where,
17895 keys = _query$_getParams.keys,
17896 returnACL = _query$_getParams.returnACL;
17897
17898 var queryJSON = {
17899 where: where,
17900 keys: keys,
17901 returnACL: returnACL,
17902 className: query.className
17903 };
17904 var promise = subscribe(queryJSON, subscriptionId).then(function (_ref3) {
17905 var queryId = _ref3.query_id;
17906 return new AV.LiveQuery(queryId, liveQueryClient, queryJSON, subscriptionId);
17907 }).finally(function () {
17908 liveQueryClient.deregister(promise);
17909 });
17910 liveQueryClient.register(promise);
17911 return promise;
17912 });
17913 });
17914 },
17915
17916 /**
17917 * Pause the LiveQuery connection. This is useful to deactivate the SDK when the app is swtiched to background.
17918 * @static
17919 * @return void
17920 */
17921 pause: function pause() {
17922 requireRealtime();
17923 return AV._config.realtime.pause();
17924 },
17925
17926 /**
17927 * Resume the LiveQuery connection. All subscriptions will be restored after reconnection.
17928 * @static
17929 * @return void
17930 */
17931 resume: function resume() {
17932 requireRealtime();
17933 return AV._config.realtime.resume();
17934 }
17935 });
17936};
17937
17938/***/ }),
17939/* 326 */
17940/***/ (function(module, exports, __webpack_require__) {
17941
17942"use strict";
17943
17944
17945var _ = __webpack_require__(0);
17946
17947var _require = __webpack_require__(15),
17948 tap = _require.tap;
17949
17950module.exports = function (AV) {
17951 /**
17952 * @class
17953 * @example
17954 * AV.Captcha.request().then(captcha => {
17955 * captcha.bind({
17956 * textInput: 'code', // the id for textInput
17957 * image: 'captcha',
17958 * verifyButton: 'verify',
17959 * }, {
17960 * success: (validateCode) => {}, // next step
17961 * error: (error) => {}, // present error.message to user
17962 * });
17963 * });
17964 */
17965 AV.Captcha = function Captcha(options, authOptions) {
17966 this._options = options;
17967 this._authOptions = authOptions;
17968 /**
17969 * The image url of the captcha
17970 * @type string
17971 */
17972 this.url = undefined;
17973 /**
17974 * The captchaToken of the captcha.
17975 * @type string
17976 */
17977 this.captchaToken = undefined;
17978 /**
17979 * The validateToken of the captcha.
17980 * @type string
17981 */
17982 this.validateToken = undefined;
17983 };
17984
17985 /**
17986 * Refresh the captcha
17987 * @return {Promise.<string>} a new capcha url
17988 */
17989 AV.Captcha.prototype.refresh = function refresh() {
17990 var _this = this;
17991
17992 return AV.Cloud._requestCaptcha(this._options, this._authOptions).then(function (_ref) {
17993 var captchaToken = _ref.captchaToken,
17994 url = _ref.url;
17995
17996 _.extend(_this, { captchaToken: captchaToken, url: url });
17997 return url;
17998 });
17999 };
18000
18001 /**
18002 * Verify the captcha
18003 * @param {String} code The code from user input
18004 * @return {Promise.<string>} validateToken if the code is valid
18005 */
18006 AV.Captcha.prototype.verify = function verify(code) {
18007 var _this2 = this;
18008
18009 return AV.Cloud.verifyCaptcha(code, this.captchaToken).then(tap(function (validateToken) {
18010 return _this2.validateToken = validateToken;
18011 }));
18012 };
18013
18014 if (undefined === 'Browser') {
18015 /**
18016 * Bind the captcha to HTMLElements. <b>ONLY AVAILABLE in browsers</b>.
18017 * @param [elements]
18018 * @param {String|HTMLInputElement} [elements.textInput] An input element typed text, or the id for the element.
18019 * @param {String|HTMLImageElement} [elements.image] An image element, or the id for the element.
18020 * @param {String|HTMLElement} [elements.verifyButton] A button element, or the id for the element.
18021 * @param [callbacks]
18022 * @param {Function} [callbacks.success] Success callback will be called if the code is verified. The param `validateCode` can be used for further SMS request.
18023 * @param {Function} [callbacks.error] Error callback will be called if something goes wrong, detailed in param `error.message`.
18024 */
18025 AV.Captcha.prototype.bind = function bind(_ref2, _ref3) {
18026 var _this3 = this;
18027
18028 var textInput = _ref2.textInput,
18029 image = _ref2.image,
18030 verifyButton = _ref2.verifyButton;
18031 var success = _ref3.success,
18032 error = _ref3.error;
18033
18034 if (typeof textInput === 'string') {
18035 textInput = document.getElementById(textInput);
18036 if (!textInput) throw new Error('textInput with id ' + textInput + ' not found');
18037 }
18038 if (typeof image === 'string') {
18039 image = document.getElementById(image);
18040 if (!image) throw new Error('image with id ' + image + ' not found');
18041 }
18042 if (typeof verifyButton === 'string') {
18043 verifyButton = document.getElementById(verifyButton);
18044 if (!verifyButton) throw new Error('verifyButton with id ' + verifyButton + ' not found');
18045 }
18046
18047 this.__refresh = function () {
18048 return _this3.refresh().then(function (url) {
18049 image.src = url;
18050 if (textInput) {
18051 textInput.value = '';
18052 textInput.focus();
18053 }
18054 }).catch(function (err) {
18055 return console.warn('refresh captcha fail: ' + err.message);
18056 });
18057 };
18058 if (image) {
18059 this.__image = image;
18060 image.src = this.url;
18061 image.addEventListener('click', this.__refresh);
18062 }
18063
18064 this.__verify = function () {
18065 var code = textInput.value;
18066 _this3.verify(code).catch(function (err) {
18067 _this3.__refresh();
18068 throw err;
18069 }).then(success, error).catch(function (err) {
18070 return console.warn('verify captcha fail: ' + err.message);
18071 });
18072 };
18073 if (textInput && verifyButton) {
18074 this.__verifyButton = verifyButton;
18075 verifyButton.addEventListener('click', this.__verify);
18076 }
18077 };
18078
18079 /**
18080 * unbind the captcha from HTMLElements. <b>ONLY AVAILABLE in browsers</b>.
18081 */
18082 AV.Captcha.prototype.unbind = function unbind() {
18083 if (this.__image) this.__image.removeEventListener('click', this.__refresh);
18084 if (this.__verifyButton) this.__verifyButton.removeEventListener('click', this.__verify);
18085 };
18086 }
18087
18088 /**
18089 * Request a captcha
18090 * @param [options]
18091 * @param {Number} [options.width] width(px) of the captcha, ranged 60-200
18092 * @param {Number} [options.height] height(px) of the captcha, ranged 30-100
18093 * @param {Number} [options.size=4] length of the captcha, ranged 3-6. MasterKey required.
18094 * @param {Number} [options.ttl=60] time to live(s), ranged 10-180. MasterKey required.
18095 * @return {Promise.<AV.Captcha>}
18096 */
18097 AV.Captcha.request = function (options, authOptions) {
18098 var captcha = new AV.Captcha(options, authOptions);
18099 return captcha.refresh().then(function () {
18100 return captcha;
18101 });
18102 };
18103};
18104
18105/***/ }),
18106/* 327 */
18107/***/ (function(module, exports, __webpack_require__) {
18108
18109"use strict";
18110
18111
18112var _promise = __webpack_require__(4);
18113
18114var _promise2 = _interopRequireDefault(_promise);
18115
18116function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
18117
18118var _ = __webpack_require__(0);
18119
18120var _require = __webpack_require__(12),
18121 _request = _require._request,
18122 request = _require.request;
18123
18124module.exports = function (AV) {
18125 /**
18126 * Contains functions for calling and declaring
18127 * <p><strong><em>
18128 * Some functions are only available from Cloud Code.
18129 * </em></strong></p>
18130 *
18131 * @namespace
18132 * @borrows AV.Captcha.request as requestCaptcha
18133 */
18134 AV.Cloud = AV.Cloud || {};
18135
18136 _.extend(AV.Cloud,
18137 /** @lends AV.Cloud */{
18138 /**
18139 * Makes a call to a cloud function.
18140 * @param {String} name The function name.
18141 * @param {Object} [data] The parameters to send to the cloud function.
18142 * @param {AuthOptions} [options]
18143 * @return {Promise} A promise that will be resolved with the result
18144 * of the function.
18145 */
18146 run: function run(name, data, options) {
18147 return request({
18148 service: 'engine',
18149 method: 'POST',
18150 path: '/functions/' + name,
18151 data: AV._encode(data, null, true),
18152 authOptions: options
18153 }).then(function (resp) {
18154 return AV._decode(resp).result;
18155 });
18156 },
18157
18158
18159 /**
18160 * Makes a call to a cloud function, you can send {AV.Object} as param or a field of param; the response
18161 * from server will also be parsed as an {AV.Object}, array of {AV.Object}, or object includes {AV.Object}
18162 * @param {String} name The function name.
18163 * @param {Object} [data] The parameters to send to the cloud function.
18164 * @param {AuthOptions} [options]
18165 * @return {Promise} A promise that will be resolved with the result of the function.
18166 */
18167 rpc: function rpc(name, data, options) {
18168 if (_.isArray(data)) {
18169 return _promise2.default.reject(new Error("Can't pass Array as the param of rpc function in JavaScript SDK."));
18170 }
18171
18172 return request({
18173 service: 'engine',
18174 method: 'POST',
18175 path: '/call/' + name,
18176 data: AV._encodeObjectOrArray(data),
18177 authOptions: options
18178 }).then(function (resp) {
18179 return AV._decode(resp).result;
18180 });
18181 },
18182
18183
18184 /**
18185 * Make a call to request server date time.
18186 * @return {Promise.<Date>} A promise that will be resolved with the result
18187 * of the function.
18188 * @since 0.5.9
18189 */
18190 getServerDate: function getServerDate() {
18191 return _request('date', null, null, 'GET').then(function (resp) {
18192 return AV._decode(resp);
18193 });
18194 },
18195
18196
18197 /**
18198 * Makes a call to request an sms code for operation verification.
18199 * @param {String|Object} data The mobile phone number string or a JSON
18200 * object that contains mobilePhoneNumber,template,sign,op,ttl,name etc.
18201 * @param {String} data.mobilePhoneNumber
18202 * @param {String} [data.template] sms template name
18203 * @param {String} [data.sign] sms signature name
18204 * @param {String} [data.smsType] sending code by `sms` (default) or `voice` call
18205 * @param {SMSAuthOptions} [options]
18206 * @return {Promise} A promise that will be resolved if the request succeed
18207 */
18208 requestSmsCode: function requestSmsCode(data) {
18209 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
18210
18211 if (_.isString(data)) {
18212 data = { mobilePhoneNumber: data };
18213 }
18214 if (!data.mobilePhoneNumber) {
18215 throw new Error('Missing mobilePhoneNumber.');
18216 }
18217 if (options.validateToken) {
18218 data = _.extend({}, data, {
18219 validate_token: options.validateToken
18220 });
18221 }
18222 return _request('requestSmsCode', null, null, 'POST', data, options);
18223 },
18224
18225
18226 /**
18227 * Makes a call to verify sms code that sent by AV.Cloud.requestSmsCode
18228 * @param {String} code The sms code sent by AV.Cloud.requestSmsCode
18229 * @param {phone} phone The mobile phoner number.
18230 * @return {Promise} A promise that will be resolved with the result
18231 * of the function.
18232 */
18233 verifySmsCode: function verifySmsCode(code, phone) {
18234 if (!code) throw new Error('Missing sms code.');
18235 var params = {};
18236 if (_.isString(phone)) {
18237 params['mobilePhoneNumber'] = phone;
18238 }
18239
18240 return _request('verifySmsCode', code, null, 'POST', params);
18241 },
18242 _requestCaptcha: function _requestCaptcha(options, authOptions) {
18243 return _request('requestCaptcha', null, null, 'GET', options, authOptions).then(function (_ref) {
18244 var url = _ref.captcha_url,
18245 captchaToken = _ref.captcha_token;
18246 return {
18247 captchaToken: captchaToken,
18248 url: url
18249 };
18250 });
18251 },
18252
18253
18254 /**
18255 * Request a captcha.
18256 */
18257 requestCaptcha: AV.Captcha.request,
18258
18259 /**
18260 * Verify captcha code. This is the low-level API for captcha.
18261 * Checkout {@link AV.Captcha} for high abstract APIs.
18262 * @param {String} code the code from user input
18263 * @param {String} captchaToken captchaToken returned by {@link AV.Cloud.requestCaptcha}
18264 * @return {Promise.<String>} validateToken if the code is valid
18265 */
18266 verifyCaptcha: function verifyCaptcha(code, captchaToken) {
18267 return _request('verifyCaptcha', null, null, 'POST', {
18268 captcha_code: code,
18269 captcha_token: captchaToken
18270 }).then(function (_ref2) {
18271 var validateToken = _ref2.validate_token;
18272 return validateToken;
18273 });
18274 }
18275 });
18276};
18277
18278/***/ }),
18279/* 328 */
18280/***/ (function(module, exports, __webpack_require__) {
18281
18282"use strict";
18283
18284
18285var request = __webpack_require__(12).request;
18286
18287module.exports = function (AV) {
18288 AV.Installation = AV.Object.extend('_Installation');
18289
18290 /**
18291 * @namespace
18292 */
18293 AV.Push = AV.Push || {};
18294
18295 /**
18296 * Sends a push notification.
18297 * @param {Object} data The data of the push notification.
18298 * @param {String[]} [data.channels] An Array of channels to push to.
18299 * @param {Date} [data.push_time] A Date object for when to send the push.
18300 * @param {Date} [data.expiration_time] A Date object for when to expire
18301 * the push.
18302 * @param {Number} [data.expiration_interval] The seconds from now to expire the push.
18303 * @param {Number} [data.flow_control] The clients to notify per second
18304 * @param {AV.Query} [data.where] An AV.Query over AV.Installation that is used to match
18305 * a set of installations to push to.
18306 * @param {String} [data.cql] A CQL statement over AV.Installation that is used to match
18307 * a set of installations to push to.
18308 * @param {Object} data.data The data to send as part of the push.
18309 More details: https://url.leanapp.cn/pushData
18310 * @param {AuthOptions} [options]
18311 * @return {Promise}
18312 */
18313 AV.Push.send = function (data, options) {
18314 if (data.where) {
18315 data.where = data.where._getParams().where;
18316 }
18317
18318 if (data.where && data.cql) {
18319 throw new Error("Both where and cql can't be set");
18320 }
18321
18322 if (data.push_time) {
18323 data.push_time = data.push_time.toJSON();
18324 }
18325
18326 if (data.expiration_time) {
18327 data.expiration_time = data.expiration_time.toJSON();
18328 }
18329
18330 if (data.expiration_time && data.expiration_interval) {
18331 throw new Error("Both expiration_time and expiration_interval can't be set");
18332 }
18333
18334 return request({
18335 service: 'push',
18336 method: 'POST',
18337 path: '/push',
18338 data: data,
18339 authOptions: options
18340 });
18341 };
18342};
18343
18344/***/ }),
18345/* 329 */
18346/***/ (function(module, exports, __webpack_require__) {
18347
18348"use strict";
18349
18350
18351var _promise = __webpack_require__(4);
18352
18353var _promise2 = _interopRequireDefault(_promise);
18354
18355var _typeof2 = __webpack_require__(59);
18356
18357var _typeof3 = _interopRequireDefault(_typeof2);
18358
18359function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
18360
18361var _ = __webpack_require__(0);
18362var AVRequest = __webpack_require__(12)._request;
18363
18364var _require = __webpack_require__(15),
18365 getSessionToken = _require.getSessionToken;
18366
18367module.exports = function (AV) {
18368 var getUser = function getUser() {
18369 var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
18370
18371 var sessionToken = getSessionToken(options);
18372 if (sessionToken) {
18373 return AV.User._fetchUserBySessionToken(getSessionToken(options));
18374 }
18375 return AV.User.currentAsync();
18376 };
18377
18378 var getUserPointer = function getUserPointer(options) {
18379 return getUser(options).then(function (currUser) {
18380 return AV.Object.createWithoutData('_User', currUser.id)._toPointer();
18381 });
18382 };
18383
18384 /**
18385 * Contains functions to deal with Status in LeanCloud.
18386 * @class
18387 */
18388 AV.Status = function (imageUrl, message) {
18389 this.data = {};
18390 this.inboxType = 'default';
18391 this.query = null;
18392 if (imageUrl && (typeof imageUrl === 'undefined' ? 'undefined' : (0, _typeof3.default)(imageUrl)) === 'object') {
18393 this.data = imageUrl;
18394 } else {
18395 if (imageUrl) {
18396 this.data.image = imageUrl;
18397 }
18398 if (message) {
18399 this.data.message = message;
18400 }
18401 }
18402 return this;
18403 };
18404
18405 _.extend(AV.Status.prototype,
18406 /** @lends AV.Status.prototype */{
18407 /**
18408 * Gets the value of an attribute in status data.
18409 * @param {String} attr The string name of an attribute.
18410 */
18411 get: function get(attr) {
18412 return this.data[attr];
18413 },
18414 /**
18415 * Sets a hash of model attributes on the status data.
18416 * @param {String} key The key to set.
18417 * @param {} value The value to give it.
18418 */
18419 set: function set(key, value) {
18420 this.data[key] = value;
18421 return this;
18422 },
18423 /**
18424 * Destroy this status,then it will not be avaiable in other user's inboxes.
18425 * @param {AuthOptions} options
18426 * @return {Promise} A promise that is fulfilled when the destroy
18427 * completes.
18428 */
18429 destroy: function destroy(options) {
18430 if (!this.id) return _promise2.default.reject(new Error('The status id is not exists.'));
18431 var request = AVRequest('statuses', null, this.id, 'DELETE', options);
18432 return request;
18433 },
18434 /**
18435 * Cast the AV.Status object to an AV.Object pointer.
18436 * @return {AV.Object} A AV.Object pointer.
18437 */
18438 toObject: function toObject() {
18439 if (!this.id) return null;
18440 return AV.Object.createWithoutData('_Status', this.id);
18441 },
18442 _getDataJSON: function _getDataJSON() {
18443 var json = _.clone(this.data);
18444 return AV._encode(json);
18445 },
18446 /**
18447 * Send a status by a AV.Query object.
18448 * @since 0.3.0
18449 * @param {AuthOptions} options
18450 * @return {Promise} A promise that is fulfilled when the send
18451 * completes.
18452 * @example
18453 * // send a status to male users
18454 * var status = new AVStatus('image url', 'a message');
18455 * status.query = new AV.Query('_User');
18456 * status.query.equalTo('gender', 'male');
18457 * status.send().then(function(){
18458 * //send status successfully.
18459 * }, function(err){
18460 * //an error threw.
18461 * console.dir(err);
18462 * });
18463 */
18464 send: function send() {
18465 var _this = this;
18466
18467 var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
18468
18469 if (!getSessionToken(options) && !AV.User.current()) {
18470 throw new Error('Please signin an user.');
18471 }
18472 if (!this.query) {
18473 return AV.Status.sendStatusToFollowers(this, options);
18474 }
18475
18476 return getUserPointer(options).then(function (currUser) {
18477 var query = _this.query._getParams();
18478 query.className = _this.query.className;
18479 var data = {};
18480 data.query = query;
18481 _this.data = _this.data || {};
18482 _this.data.source = _this.data.source || currUser;
18483 data.data = _this._getDataJSON();
18484 data.inboxType = _this.inboxType || 'default';
18485
18486 return AVRequest('statuses', null, null, 'POST', data, options);
18487 }).then(function (response) {
18488 _this.id = response.objectId;
18489 _this.createdAt = AV._parseDate(response.createdAt);
18490 return _this;
18491 });
18492 },
18493
18494 _finishFetch: function _finishFetch(serverData) {
18495 this.id = serverData.objectId;
18496 this.createdAt = AV._parseDate(serverData.createdAt);
18497 this.updatedAt = AV._parseDate(serverData.updatedAt);
18498 this.messageId = serverData.messageId;
18499 delete serverData.messageId;
18500 delete serverData.objectId;
18501 delete serverData.createdAt;
18502 delete serverData.updatedAt;
18503 this.data = AV._decode(serverData);
18504 }
18505 });
18506
18507 /**
18508 * Send a status to current signined user's followers.
18509 * @since 0.3.0
18510 * @param {AV.Status} status A status object to be send to followers.
18511 * @param {AuthOptions} options
18512 * @return {Promise} A promise that is fulfilled when the send
18513 * completes.
18514 * @example
18515 * var status = new AVStatus('image url', 'a message');
18516 * AV.Status.sendStatusToFollowers(status).then(function(){
18517 * //send status successfully.
18518 * }, function(err){
18519 * //an error threw.
18520 * console.dir(err);
18521 * });
18522 */
18523 AV.Status.sendStatusToFollowers = function (status) {
18524 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
18525
18526 if (!getSessionToken(options) && !AV.User.current()) {
18527 throw new Error('Please signin an user.');
18528 }
18529 return getUserPointer(options).then(function (currUser) {
18530 var query = {};
18531 query.className = '_Follower';
18532 query.keys = 'follower';
18533 query.where = { user: currUser };
18534 var data = {};
18535 data.query = query;
18536 status.data = status.data || {};
18537 status.data.source = status.data.source || currUser;
18538 data.data = status._getDataJSON();
18539 data.inboxType = status.inboxType || 'default';
18540
18541 var request = AVRequest('statuses', null, null, 'POST', data, options);
18542 return request.then(function (response) {
18543 status.id = response.objectId;
18544 status.createdAt = AV._parseDate(response.createdAt);
18545 return status;
18546 });
18547 });
18548 };
18549
18550 /**
18551 * <p>Send a status from current signined user to other user's private status inbox.</p>
18552 * @since 0.3.0
18553 * @param {AV.Status} status A status object to be send to followers.
18554 * @param {String} target The target user or user's objectId.
18555 * @param {AuthOptions} options
18556 * @return {Promise} A promise that is fulfilled when the send
18557 * completes.
18558 * @example
18559 * // send a private status to user '52e84e47e4b0f8de283b079b'
18560 * var status = new AVStatus('image url', 'a message');
18561 * AV.Status.sendPrivateStatus(status, '52e84e47e4b0f8de283b079b').then(function(){
18562 * //send status successfully.
18563 * }, function(err){
18564 * //an error threw.
18565 * console.dir(err);
18566 * });
18567 */
18568 AV.Status.sendPrivateStatus = function (status, target) {
18569 var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
18570
18571 if (!getSessionToken(options) && !AV.User.current()) {
18572 throw new Error('Please signin an user.');
18573 }
18574 if (!target) {
18575 throw new Error('Invalid target user.');
18576 }
18577 var userObjectId = _.isString(target) ? target : target.id;
18578 if (!userObjectId) {
18579 throw new Error('Invalid target user.');
18580 }
18581 return getUserPointer(options).then(function (currUser) {
18582 var query = {};
18583 query.className = '_User';
18584 query.where = { objectId: userObjectId };
18585 var data = {};
18586 data.query = query;
18587 status.data = status.data || {};
18588 status.data.source = status.data.source || currUser;
18589 data.data = status._getDataJSON();
18590 data.inboxType = 'private';
18591 status.inboxType = 'private';
18592
18593 var request = AVRequest('statuses', null, null, 'POST', data, options);
18594 return request.then(function (response) {
18595 status.id = response.objectId;
18596 status.createdAt = AV._parseDate(response.createdAt);
18597 return status;
18598 });
18599 });
18600 };
18601
18602 /**
18603 * Count unread statuses in someone's inbox.
18604 * @since 0.3.0
18605 * @param {AV.User} owner The status owner.
18606 * @param {String} inboxType The inbox type, 'default' by default.
18607 * @param {AuthOptions} options
18608 * @return {Promise} A promise that is fulfilled when the count
18609 * completes.
18610 * @example
18611 * AV.Status.countUnreadStatuses(AV.User.current()).then(function(response){
18612 * console.log(response.unread); //unread statuses number.
18613 * console.log(response.total); //total statuses number.
18614 * });
18615 */
18616 AV.Status.countUnreadStatuses = function (owner) {
18617 var inboxType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'default';
18618 var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
18619
18620 if (!_.isString(inboxType)) options = inboxType;
18621 if (!getSessionToken(options) && owner == null && !AV.User.current()) {
18622 throw new Error('Please signin an user or pass the owner objectId.');
18623 }
18624 return _promise2.default.resolve(owner || getUser(options)).then(function (owner) {
18625 var params = {};
18626 params.inboxType = AV._encode(inboxType);
18627 params.owner = AV._encode(owner);
18628 return AVRequest('subscribe/statuses/count', null, null, 'GET', params, options);
18629 });
18630 };
18631
18632 /**
18633 * reset unread statuses count in someone's inbox.
18634 * @since 2.1.0
18635 * @param {AV.User} owner The status owner.
18636 * @param {String} inboxType The inbox type, 'default' by default.
18637 * @param {AuthOptions} options
18638 * @return {Promise} A promise that is fulfilled when the reset
18639 * completes.
18640 * @example
18641 * AV.Status.resetUnreadCount(AV.User.current()).then(function(response){
18642 * console.log(response.unread); //unread statuses number.
18643 * console.log(response.total); //total statuses number.
18644 * });
18645 */
18646 AV.Status.resetUnreadCount = function (owner) {
18647 var inboxType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'default';
18648 var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
18649
18650 if (!_.isString(inboxType)) options = inboxType;
18651 if (!getSessionToken(options) && owner == null && !AV.User.current()) {
18652 throw new Error('Please signin an user or pass the owner objectId.');
18653 }
18654 return _promise2.default.resolve(owner || getUser(options)).then(function (owner) {
18655 var params = {};
18656 params.inboxType = AV._encode(inboxType);
18657 params.owner = AV._encode(owner);
18658 return AVRequest('subscribe/statuses/resetUnreadCount', null, null, 'POST', params, options);
18659 });
18660 };
18661
18662 /**
18663 * Create a status query to find someone's published statuses.
18664 * @since 0.3.0
18665 * @param {AV.User} source The status source, typically the publisher.
18666 * @return {AV.Query} The query object for status.
18667 * @example
18668 * //Find current user's published statuses.
18669 * var query = AV.Status.statusQuery(AV.User.current());
18670 * query.find().then(function(statuses){
18671 * //process statuses
18672 * });
18673 */
18674 AV.Status.statusQuery = function (source) {
18675 var query = new AV.Query('_Status');
18676 if (source) {
18677 query.equalTo('source', source);
18678 }
18679 return query;
18680 };
18681
18682 /**
18683 * <p>AV.InboxQuery defines a query that is used to fetch somebody's inbox statuses.</p>
18684 * @class
18685 */
18686 AV.InboxQuery = AV.Query._extend(
18687 /** @lends AV.InboxQuery.prototype */{
18688 _objectClass: AV.Status,
18689 _sinceId: 0,
18690 _maxId: 0,
18691 _inboxType: 'default',
18692 _owner: null,
18693 _newObject: function _newObject() {
18694 return new AV.Status();
18695 },
18696 _createRequest: function _createRequest(params, options) {
18697 return AV.InboxQuery.__super__._createRequest.call(this, params, options, '/subscribe/statuses');
18698 },
18699
18700 /**
18701 * Sets the messageId of results to skip before returning any results.
18702 * This is useful for pagination.
18703 * Default is zero.
18704 * @param {Number} n the mesage id.
18705 * @return {AV.InboxQuery} Returns the query, so you can chain this call.
18706 */
18707 sinceId: function sinceId(id) {
18708 this._sinceId = id;
18709 return this;
18710 },
18711 /**
18712 * Sets the maximal messageId of results。
18713 * This is useful for pagination.
18714 * Default is zero that is no limition.
18715 * @param {Number} n the mesage id.
18716 * @return {AV.InboxQuery} Returns the query, so you can chain this call.
18717 */
18718 maxId: function maxId(id) {
18719 this._maxId = id;
18720 return this;
18721 },
18722 /**
18723 * Sets the owner of the querying inbox.
18724 * @param {AV.User} owner The inbox owner.
18725 * @return {AV.InboxQuery} Returns the query, so you can chain this call.
18726 */
18727 owner: function owner(_owner) {
18728 this._owner = _owner;
18729 return this;
18730 },
18731 /**
18732 * Sets the querying inbox type.default is 'default'.
18733 * @param {Object} type The inbox type.
18734 * @return {AV.InboxQuery} Returns the query, so you can chain this call.
18735 */
18736 inboxType: function inboxType(type) {
18737 this._inboxType = type;
18738 return this;
18739 },
18740 _getParams: function _getParams() {
18741 var params = AV.InboxQuery.__super__._getParams.call(this);
18742 params.owner = AV._encode(this._owner);
18743 params.inboxType = AV._encode(this._inboxType);
18744 params.sinceId = AV._encode(this._sinceId);
18745 params.maxId = AV._encode(this._maxId);
18746 return params;
18747 }
18748 });
18749
18750 /**
18751 * Create a inbox status query to find someone's inbox statuses.
18752 * @since 0.3.0
18753 * @param {AV.User} owner The inbox's owner
18754 * @param {String} inboxType The inbox type,'default' by default.
18755 * @return {AV.InboxQuery} The inbox query object.
18756 * @see AV.InboxQuery
18757 * @example
18758 * //Find current user's default inbox statuses.
18759 * var query = AV.Status.inboxQuery(AV.User.current());
18760 * //find the statuses after the last message id
18761 * query.sinceId(lastMessageId);
18762 * query.find().then(function(statuses){
18763 * //process statuses
18764 * });
18765 */
18766 AV.Status.inboxQuery = function (owner, inboxType) {
18767 var query = new AV.InboxQuery(AV.Status);
18768 if (owner) {
18769 query._owner = owner;
18770 }
18771 if (inboxType) {
18772 query._inboxType = inboxType;
18773 }
18774 return query;
18775 };
18776};
18777
18778/***/ }),
18779/* 330 */
18780/***/ (function(module, exports, __webpack_require__) {
18781
18782"use strict";
18783
18784
18785var _stringify = __webpack_require__(18);
18786
18787var _stringify2 = _interopRequireDefault(_stringify);
18788
18789function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
18790
18791var _ = __webpack_require__(0);
18792var AVRequest = __webpack_require__(12)._request;
18793
18794module.exports = function (AV) {
18795 /**
18796 * A builder to generate sort string for app searching.For example:
18797 * @class
18798 * @since 0.5.1
18799 * @example
18800 * var builder = new AV.SearchSortBuilder();
18801 * builder.ascending('key1').descending('key2','max');
18802 * var query = new AV.SearchQuery('Player');
18803 * query.sortBy(builder);
18804 * query.find().then();
18805 */
18806 AV.SearchSortBuilder = function () {
18807 this._sortFields = [];
18808 };
18809
18810 _.extend(AV.SearchSortBuilder.prototype,
18811 /** @lends AV.SearchSortBuilder.prototype */{
18812 _addField: function _addField(key, order, mode, missing) {
18813 var field = {};
18814 field[key] = {
18815 order: order || 'asc',
18816 mode: mode || 'avg',
18817 missing: '_' + (missing || 'last')
18818 };
18819 this._sortFields.push(field);
18820 return this;
18821 },
18822
18823 /**
18824 * Sorts the results in ascending order by the given key and options.
18825 *
18826 * @param {String} key The key to order by.
18827 * @param {String} mode The sort mode, default is 'avg', you can choose
18828 * 'max' or 'min' too.
18829 * @param {String} missing The missing key behaviour, default is 'last',
18830 * you can choose 'first' too.
18831 * @return {AV.SearchSortBuilder} Returns the builder, so you can chain this call.
18832 */
18833 ascending: function ascending(key, mode, missing) {
18834 return this._addField(key, 'asc', mode, missing);
18835 },
18836
18837 /**
18838 * Sorts the results in descending order by the given key and options.
18839 *
18840 * @param {String} key The key to order by.
18841 * @param {String} mode The sort mode, default is 'avg', you can choose
18842 * 'max' or 'min' too.
18843 * @param {String} missing The missing key behaviour, default is 'last',
18844 * you can choose 'first' too.
18845 * @return {AV.SearchSortBuilder} Returns the builder, so you can chain this call.
18846 */
18847 descending: function descending(key, mode, missing) {
18848 return this._addField(key, 'desc', mode, missing);
18849 },
18850
18851 /**
18852 * Add a proximity based constraint for finding objects with key point
18853 * values near the point given.
18854 * @param {String} key The key that the AV.GeoPoint is stored in.
18855 * @param {AV.GeoPoint} point The reference AV.GeoPoint that is used.
18856 * @param {Object} options The other options such as mode,order, unit etc.
18857 * @return {AV.SearchSortBuilder} Returns the builder, so you can chain this call.
18858 */
18859 whereNear: function whereNear(key, point, options) {
18860 options = options || {};
18861 var field = {};
18862 var geo = {
18863 lat: point.latitude,
18864 lon: point.longitude
18865 };
18866 var m = {
18867 order: options.order || 'asc',
18868 mode: options.mode || 'avg',
18869 unit: options.unit || 'km'
18870 };
18871 m[key] = geo;
18872 field['_geo_distance'] = m;
18873
18874 this._sortFields.push(field);
18875 return this;
18876 },
18877
18878 /**
18879 * Build a sort string by configuration.
18880 * @return {String} the sort string.
18881 */
18882 build: function build() {
18883 return (0, _stringify2.default)(AV._encode(this._sortFields));
18884 }
18885 });
18886
18887 /**
18888 * App searching query.Use just like AV.Query:
18889 *
18890 * Visit <a href='https://leancloud.cn/docs/app_search_guide.html'>App Searching Guide</a>
18891 * for more details.
18892 * @class
18893 * @since 0.5.1
18894 * @example
18895 * var query = new AV.SearchQuery('Player');
18896 * query.queryString('*');
18897 * query.find().then(function(results) {
18898 * console.log('Found %d objects', query.hits());
18899 * //Process results
18900 * });
18901 */
18902 AV.SearchQuery = AV.Query._extend(
18903 /** @lends AV.SearchQuery.prototype */{
18904 _sid: null,
18905 _hits: 0,
18906 _queryString: null,
18907 _highlights: null,
18908 _sortBuilder: null,
18909 _clazz: null,
18910
18911 constructor: function constructor(className) {
18912 if (className) {
18913 this._clazz = className;
18914 } else {
18915 className = '__INVALID_CLASS';
18916 }
18917 AV.Query.call(this, className);
18918 },
18919
18920 _createRequest: function _createRequest(params, options) {
18921 return AVRequest('search/select', null, null, 'GET', params || this._getParams(), options);
18922 },
18923
18924 /**
18925 * Sets the sid of app searching query.Default is null.
18926 * @param {String} sid Scroll id for searching.
18927 * @return {AV.SearchQuery} Returns the query, so you can chain this call.
18928 */
18929 sid: function sid(_sid) {
18930 this._sid = _sid;
18931 return this;
18932 },
18933
18934 /**
18935 * Sets the query string of app searching.
18936 * @param {String} q The query string.
18937 * @return {AV.SearchQuery} Returns the query, so you can chain this call.
18938 */
18939 queryString: function queryString(q) {
18940 this._queryString = q;
18941 return this;
18942 },
18943
18944 /**
18945 * Sets the highlight fields. Such as
18946 * <pre><code>
18947 * query.highlights('title');
18948 * //or pass an array.
18949 * query.highlights(['title', 'content'])
18950 * </code></pre>
18951 * @param {String|String[]} highlights a list of fields.
18952 * @return {AV.SearchQuery} Returns the query, so you can chain this call.
18953 */
18954 highlights: function highlights(_highlights) {
18955 var objects;
18956 if (_highlights && _.isString(_highlights)) {
18957 objects = _.toArray(arguments);
18958 } else {
18959 objects = _highlights;
18960 }
18961 this._highlights = objects;
18962 return this;
18963 },
18964
18965 /**
18966 * Sets the sort builder for this query.
18967 * @see AV.SearchSortBuilder
18968 * @param { AV.SearchSortBuilder} builder The sort builder.
18969 * @return {AV.SearchQuery} Returns the query, so you can chain this call.
18970 *
18971 */
18972 sortBy: function sortBy(builder) {
18973 this._sortBuilder = builder;
18974 return this;
18975 },
18976
18977 /**
18978 * Returns the number of objects that match this query.
18979 * @return {Number}
18980 */
18981 hits: function hits() {
18982 if (!this._hits) {
18983 this._hits = 0;
18984 }
18985 return this._hits;
18986 },
18987
18988 _processResult: function _processResult(json) {
18989 delete json['className'];
18990 delete json['_app_url'];
18991 delete json['_deeplink'];
18992 return json;
18993 },
18994
18995 /**
18996 * Returns true when there are more documents can be retrieved by this
18997 * query instance, you can call find function to get more results.
18998 * @see AV.SearchQuery#find
18999 * @return {Boolean}
19000 */
19001 hasMore: function hasMore() {
19002 return !this._hitEnd;
19003 },
19004
19005 /**
19006 * Reset current query instance state(such as sid, hits etc) except params
19007 * for a new searching. After resetting, hasMore() will return true.
19008 */
19009 reset: function reset() {
19010 this._hitEnd = false;
19011 this._sid = null;
19012 this._hits = 0;
19013 },
19014
19015 /**
19016 * Retrieves a list of AVObjects that satisfy this query.
19017 * Either options.success or options.error is called when the find
19018 * completes.
19019 *
19020 * @see AV.Query#find
19021 * @param {AuthOptions} options
19022 * @return {Promise} A promise that is resolved with the results when
19023 * the query completes.
19024 */
19025 find: function find(options) {
19026 var self = this;
19027
19028 var request = this._createRequest(undefined, options);
19029
19030 return request.then(function (response) {
19031 //update sid for next querying.
19032 if (response.sid) {
19033 self._oldSid = self._sid;
19034 self._sid = response.sid;
19035 } else {
19036 self._sid = null;
19037 self._hitEnd = true;
19038 }
19039 self._hits = response.hits || 0;
19040
19041 return _.map(response.results, function (json) {
19042 if (json.className) {
19043 response.className = json.className;
19044 }
19045 var obj = self._newObject(response);
19046 obj.appURL = json['_app_url'];
19047 obj._finishFetch(self._processResult(json), true);
19048 return obj;
19049 });
19050 });
19051 },
19052
19053 _getParams: function _getParams() {
19054 var params = AV.SearchQuery.__super__._getParams.call(this);
19055 delete params.where;
19056 if (this._clazz) {
19057 params.clazz = this.className;
19058 }
19059 if (this._sid) {
19060 params.sid = this._sid;
19061 }
19062 if (!this._queryString) {
19063 throw new Error('Please set query string.');
19064 } else {
19065 params.q = this._queryString;
19066 }
19067 if (this._highlights) {
19068 params.highlights = this._highlights.join(',');
19069 }
19070 if (this._sortBuilder && params.order) {
19071 throw new Error('sort and order can not be set at same time.');
19072 }
19073 if (this._sortBuilder) {
19074 params.sort = this._sortBuilder.build();
19075 }
19076
19077 return params;
19078 }
19079 });
19080};
19081
19082/**
19083 * Sorts the results in ascending order by the given key.
19084 *
19085 * @method AV.SearchQuery#ascending
19086 * @param {String} key The key to order by.
19087 * @return {AV.SearchQuery} Returns the query, so you can chain this call.
19088 */
19089/**
19090 * Also sorts the results in ascending order by the given key. The previous sort keys have
19091 * precedence over this key.
19092 *
19093 * @method AV.SearchQuery#addAscending
19094 * @param {String} key The key to order by
19095 * @return {AV.SearchQuery} Returns the query so you can chain this call.
19096 */
19097/**
19098 * Sorts the results in descending order by the given key.
19099 *
19100 * @method AV.SearchQuery#descending
19101 * @param {String} key The key to order by.
19102 * @return {AV.SearchQuery} Returns the query, so you can chain this call.
19103 */
19104/**
19105 * Also sorts the results in descending order by the given key. The previous sort keys have
19106 * precedence over this key.
19107 *
19108 * @method AV.SearchQuery#addDescending
19109 * @param {String} key The key to order by
19110 * @return {AV.SearchQuery} Returns the query so you can chain this call.
19111 */
19112/**
19113 * Include nested AV.Objects for the provided key. You can use dot
19114 * notation to specify which fields in the included object are also fetch.
19115 * @method AV.SearchQuery#include
19116 * @param {String[]} keys The name of the key to include.
19117 * @return {AV.SearchQuery} Returns the query, so you can chain this call.
19118 */
19119/**
19120 * Sets the number of results to skip before returning any results.
19121 * This is useful for pagination.
19122 * Default is to skip zero results.
19123 * @method AV.SearchQuery#skip
19124 * @param {Number} n the number of results to skip.
19125 * @return {AV.SearchQuery} Returns the query, so you can chain this call.
19126 */
19127/**
19128 * Sets the limit of the number of results to return. The default limit is
19129 * 100, with a maximum of 1000 results being returned at a time.
19130 * @method AV.SearchQuery#limit
19131 * @param {Number} n the number of results to limit to.
19132 * @return {AV.SearchQuery} Returns the query, so you can chain this call.
19133 */
19134
19135/***/ }),
19136/* 331 */
19137/***/ (function(module, exports, __webpack_require__) {
19138
19139"use strict";
19140
19141
19142var _promise = __webpack_require__(4);
19143
19144var _promise2 = _interopRequireDefault(_promise);
19145
19146function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19147
19148var _ = __webpack_require__(0);
19149var AVError = __webpack_require__(29);
19150
19151var _require = __webpack_require__(12),
19152 request = _require.request;
19153
19154module.exports = function (AV) {
19155 /**
19156 * 包含了使用了 LeanCloud
19157 * <a href='/docs/leaninsight_guide.html'>离线数据分析功能</a>的函数。
19158 * <p><strong><em>
19159 * 仅在云引擎运行环境下有效。
19160 * </em></strong></p>
19161 * @namespace
19162 */
19163 AV.Insight = AV.Insight || {};
19164
19165 _.extend(AV.Insight,
19166 /** @lends AV.Insight */{
19167 /**
19168 * 开始一个 Insight 任务。结果里将返回 Job id,你可以拿得到的 id 使用
19169 * AV.Insight.JobQuery 查询任务状态和结果。
19170 * @param {Object} jobConfig 任务配置的 JSON 对象,例如:<code><pre>
19171 * { "sql" : "select count(*) as c,gender from _User group by gender",
19172 * "saveAs": {
19173 * "className" : "UserGender",
19174 * "limit": 1
19175 * }
19176 * }
19177 * </pre></code>
19178 * sql 指定任务执行的 SQL 语句, saveAs(可选) 指定将结果保存在哪张表里,limit 最大 1000。
19179 * @param {AuthOptions} [options]
19180 * @return {Promise} A promise that will be resolved with the result
19181 * of the function.
19182 */
19183 startJob: function startJob(jobConfig, options) {
19184 if (!jobConfig || !jobConfig.sql) {
19185 throw new Error('Please provide the sql to run the job.');
19186 }
19187 var data = {
19188 jobConfig: jobConfig,
19189 appId: AV.applicationId
19190 };
19191 return request({
19192 path: '/bigquery/jobs',
19193 method: 'POST',
19194 data: AV._encode(data, null, true),
19195 authOptions: options,
19196 signKey: false
19197 }).then(function (resp) {
19198 return AV._decode(resp).id;
19199 });
19200 },
19201
19202 /**
19203 * 监听 Insight 任务事件(未来推出独立部署的离线分析服务后开放)
19204 * <p><strong><em>
19205 * 仅在云引擎运行环境下有效。
19206 * </em></strong></p>
19207 * @param {String} event 监听的事件,目前尚不支持。
19208 * @param {Function} 监听回调函数,接收 (err, id) 两个参数,err 表示错误信息,
19209 * id 表示任务 id。接下来你可以拿这个 id 使用AV.Insight.JobQuery 查询任务状态和结果。
19210 *
19211 */
19212 on: function on(event, cb) {}
19213 });
19214
19215 /**
19216 * 创建一个对象,用于查询 Insight 任务状态和结果。
19217 * @class
19218 * @param {String} id 任务 id
19219 * @since 0.5.5
19220 */
19221 AV.Insight.JobQuery = function (id, className) {
19222 if (!id) {
19223 throw new Error('Please provide the job id.');
19224 }
19225 this.id = id;
19226 this.className = className;
19227 this._skip = 0;
19228 this._limit = 100;
19229 };
19230
19231 _.extend(AV.Insight.JobQuery.prototype,
19232 /** @lends AV.Insight.JobQuery.prototype */{
19233 /**
19234 * Sets the number of results to skip before returning any results.
19235 * This is useful for pagination.
19236 * Default is to skip zero results.
19237 * @param {Number} n the number of results to skip.
19238 * @return {AV.Query} Returns the query, so you can chain this call.
19239 */
19240 skip: function skip(n) {
19241 this._skip = n;
19242 return this;
19243 },
19244
19245 /**
19246 * Sets the limit of the number of results to return. The default limit is
19247 * 100, with a maximum of 1000 results being returned at a time.
19248 * @param {Number} n the number of results to limit to.
19249 * @return {AV.Query} Returns the query, so you can chain this call.
19250 */
19251 limit: function limit(n) {
19252 this._limit = n;
19253 return this;
19254 },
19255
19256 /**
19257 * 查询任务状态和结果,任务结果为一个 JSON 对象,包括 status 表示任务状态, totalCount 表示总数,
19258 * results 数组表示任务结果数组,previewCount 表示可以返回的结果总数,任务的开始和截止时间
19259 * startTime、endTime 等信息。
19260 *
19261 * @param {AuthOptions} [options]
19262 * @return {Promise} A promise that will be resolved with the result
19263 * of the function.
19264 *
19265 */
19266 find: function find(options) {
19267 var params = {
19268 skip: this._skip,
19269 limit: this._limit
19270 };
19271
19272 return request({
19273 path: '/bigquery/jobs/' + this.id,
19274 method: 'GET',
19275 query: params,
19276 authOptions: options,
19277 signKey: false
19278 }).then(function (response) {
19279 if (response.error) {
19280 return _promise2.default.reject(new AVError(response.code, response.error));
19281 }
19282 return _promise2.default.resolve(response);
19283 });
19284 }
19285 });
19286};
19287
19288/***/ }),
19289/* 332 */
19290/***/ (function(module, exports, __webpack_require__) {
19291
19292"use strict";
19293
19294
19295var _ = __webpack_require__(0);
19296
19297var _require = __webpack_require__(12),
19298 LCRequest = _require.request;
19299
19300var _require2 = __webpack_require__(15),
19301 getSessionToken = _require2.getSessionToken;
19302
19303module.exports = function (AV) {
19304 /**
19305 * Contains functions to deal with Friendship in LeanCloud.
19306 * @class
19307 */
19308 AV.Friendship = {
19309 /**
19310 * Request friendship.
19311 * @since 4.8.0
19312 * @param {String | AV.User | Object} options if an AV.User or string is given, it will be used as the friend.
19313 * @param {AV.User | string} options.friend The friend (or friend's objectId) to follow.
19314 * @param {Object} [options.attributes] key-value attributes dictionary to be used as conditions of followeeQuery.
19315 * @param {*} [authOptions]
19316 * @return {Promise<void>}
19317 */
19318 request: function request(options, authOptions) {
19319 if (!AV.User.current()) {
19320 throw new Error('Please signin an user.');
19321 }
19322 var friend = void 0;
19323 var attributes = void 0;
19324 if (options.friend) {
19325 friend = options.friend;
19326 attributes = options.attributes;
19327 } else {
19328 friend = options;
19329 }
19330 var friendObject = _.isString(friend) ? AV.Object.createWithoutData('_User', friend) : friend;
19331 return LCRequest({
19332 method: 'POST',
19333 path: '/users/friendshipRequests',
19334 data: AV._encode({
19335 user: AV.User.current(),
19336 friend: friendObject,
19337 friendship: attributes
19338 }),
19339 authOptions: authOptions
19340 });
19341 },
19342
19343 /**
19344 * Accept a friendship request.
19345 * @since 4.8.0
19346 * @param {AV.Object | string | Object} options if an AV.Object or string is given, it will be used as the request in _FriendshipRequest.
19347 * @param {AV.Object} options.request The request (or it's objectId) to be accepted.
19348 * @param {Object} [options.attributes] key-value attributes dictionary to be used as conditions of {@link AV#followeeQuery}.
19349 * @param {AuthOptions} [authOptions]
19350 * @return {Promise<void>}
19351 */
19352 acceptRequest: function acceptRequest(options) {
19353 var authOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
19354
19355 if (!getSessionToken(authOptions) && !AV.User.current()) {
19356 throw new Error('Please signin an user.');
19357 }
19358 var request = void 0;
19359 var attributes = void 0;
19360 if (options.request) {
19361 request = options.request;
19362 attributes = options.attributes;
19363 } else {
19364 request = options;
19365 }
19366 var requestId = _.isString(request) ? request : request.id;
19367 return LCRequest({
19368 method: 'PUT',
19369 path: '/users/friendshipRequests/' + requestId + '/accept',
19370 data: {
19371 friendship: AV._encode(attributes)
19372 },
19373 authOptions: authOptions
19374 });
19375 },
19376
19377 /**
19378 * Decline a friendship request.
19379 * @param {AV.Object | string} request The request (or it's objectId) to be declined.
19380 * @param {AuthOptions} [authOptions]
19381 * @return {Promise<void>}
19382 */
19383 declineRequest: function declineRequest(request) {
19384 var authOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
19385
19386 if (!getSessionToken(authOptions) && !AV.User.current()) {
19387 throw new Error('Please signin an user.');
19388 }
19389 var requestId = _.isString(request) ? request : request.id;
19390 return LCRequest({
19391 method: 'PUT',
19392 path: '/users/friendshipRequests/' + requestId + '/decline',
19393 authOptions: authOptions
19394 });
19395 }
19396 };
19397};
19398
19399/***/ }),
19400/* 333 */
19401/***/ (function(module, exports, __webpack_require__) {
19402
19403"use strict";
19404
19405
19406var _stringify = __webpack_require__(18);
19407
19408var _stringify2 = _interopRequireDefault(_stringify);
19409
19410function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19411
19412var _ = __webpack_require__(0);
19413
19414var _require = __webpack_require__(12),
19415 _request = _require._request;
19416
19417var AV = __webpack_require__(34);
19418
19419var serializeMessage = function serializeMessage(message) {
19420 if (typeof message === 'string') {
19421 return message;
19422 }
19423 if (typeof message.getPayload === 'function') {
19424 return (0, _stringify2.default)(message.getPayload());
19425 }
19426 return (0, _stringify2.default)(message);
19427};
19428
19429/**
19430 * <p>An AV.Conversation is a local representation of a LeanCloud realtime's
19431 * conversation. This class is a subclass of AV.Object, and retains the
19432 * same functionality of an AV.Object, but also extends it with various
19433 * conversation specific methods, like get members, creators of this conversation.
19434 * </p>
19435 *
19436 * @class AV.Conversation
19437 * @param {String} name The name of the Role to create.
19438 * @param {Object} [options]
19439 * @param {Boolean} [options.isSystem] Set this conversation as system conversation.
19440 * @param {Boolean} [options.isTransient] Set this conversation as transient conversation.
19441 */
19442module.exports = AV.Object.extend('_Conversation',
19443/** @lends AV.Conversation.prototype */{
19444 constructor: function constructor(name) {
19445 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
19446
19447 AV.Object.prototype.constructor.call(this, null, null);
19448 this.set('name', name);
19449 if (options.isSystem !== undefined) {
19450 this.set('sys', options.isSystem ? true : false);
19451 }
19452 if (options.isTransient !== undefined) {
19453 this.set('tr', options.isTransient ? true : false);
19454 }
19455 },
19456
19457 /**
19458 * Get current conversation's creator.
19459 *
19460 * @return {String}
19461 */
19462 getCreator: function getCreator() {
19463 return this.get('c');
19464 },
19465
19466
19467 /**
19468 * Get the last message's time.
19469 *
19470 * @return {Date}
19471 */
19472 getLastMessageAt: function getLastMessageAt() {
19473 return this.get('lm');
19474 },
19475
19476
19477 /**
19478 * Get this conversation's members
19479 *
19480 * @return {String[]}
19481 */
19482 getMembers: function getMembers() {
19483 return this.get('m');
19484 },
19485
19486
19487 /**
19488 * Add a member to this conversation
19489 *
19490 * @param {String} member
19491 */
19492 addMember: function addMember(member) {
19493 return this.add('m', member);
19494 },
19495
19496
19497 /**
19498 * Get this conversation's members who set this conversation as muted.
19499 *
19500 * @return {String[]}
19501 */
19502 getMutedMembers: function getMutedMembers() {
19503 return this.get('mu');
19504 },
19505
19506
19507 /**
19508 * Get this conversation's name field.
19509 *
19510 * @return String
19511 */
19512 getName: function getName() {
19513 return this.get('name');
19514 },
19515
19516
19517 /**
19518 * Returns true if this conversation is transient conversation.
19519 *
19520 * @return {Boolean}
19521 */
19522 isTransient: function isTransient() {
19523 return this.get('tr');
19524 },
19525
19526
19527 /**
19528 * Returns true if this conversation is system conversation.
19529 *
19530 * @return {Boolean}
19531 */
19532 isSystem: function isSystem() {
19533 return this.get('sys');
19534 },
19535
19536
19537 /**
19538 * Send realtime message to this conversation, using HTTP request.
19539 *
19540 * @param {String} fromClient Sender's client id.
19541 * @param {String|Object} message The message which will send to conversation.
19542 * It could be a raw string, or an object with a `toJSON` method, like a
19543 * realtime SDK's Message object. See more: {@link https://leancloud.cn/docs/realtime_guide-js.html#消息}
19544 * @param {Object} [options]
19545 * @param {Boolean} [options.transient] Whether send this message as transient message or not.
19546 * @param {String[]} [options.toClients] Ids of clients to send to. This option can be used only in system conversation.
19547 * @param {Object} [options.pushData] Push data to this message. See more: {@link https://url.leanapp.cn/pushData 推送消息内容}
19548 * @param {AuthOptions} [authOptions]
19549 * @return {Promise}
19550 */
19551 send: function send(fromClient, message) {
19552 var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
19553 var authOptions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
19554
19555 var data = {
19556 from_peer: fromClient,
19557 conv_id: this.id,
19558 transient: false,
19559 message: serializeMessage(message)
19560 };
19561 if (options.toClients !== undefined) {
19562 data.to_peers = options.toClients;
19563 }
19564 if (options.transient !== undefined) {
19565 data.transient = options.transient ? true : false;
19566 }
19567 if (options.pushData !== undefined) {
19568 data.push_data = options.pushData;
19569 }
19570 return _request('rtm', 'messages', null, 'POST', data, authOptions);
19571 },
19572
19573
19574 /**
19575 * Send realtime broadcast message to all clients, via this conversation, using HTTP request.
19576 *
19577 * @param {String} fromClient Sender's client id.
19578 * @param {String|Object} message The message which will send to conversation.
19579 * It could be a raw string, or an object with a `toJSON` method, like a
19580 * realtime SDK's Message object. See more: {@link https://leancloud.cn/docs/realtime_guide-js.html#消息}.
19581 * @param {Object} [options]
19582 * @param {Object} [options.pushData] Push data to this message. See more: {@link https://url.leanapp.cn/pushData 推送消息内容}.
19583 * @param {Object} [options.validTill] The message will valid till this time.
19584 * @param {AuthOptions} [authOptions]
19585 * @return {Promise}
19586 */
19587 broadcast: function broadcast(fromClient, message) {
19588 var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
19589 var authOptions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
19590
19591 var data = {
19592 from_peer: fromClient,
19593 conv_id: this.id,
19594 message: serializeMessage(message)
19595 };
19596 if (options.pushData !== undefined) {
19597 data.push = options.pushData;
19598 }
19599 if (options.validTill !== undefined) {
19600 var ts = options.validTill;
19601 if (_.isDate(ts)) {
19602 ts = ts.getTime();
19603 }
19604 options.valid_till = ts;
19605 }
19606 return _request('rtm', 'broadcast', null, 'POST', data, authOptions);
19607 }
19608});
19609
19610/***/ }),
19611/* 334 */
19612/***/ (function(module, exports, __webpack_require__) {
19613
19614"use strict";
19615
19616
19617var _promise = __webpack_require__(4);
19618
19619var _promise2 = _interopRequireDefault(_promise);
19620
19621function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19622
19623var _ = __webpack_require__(0);
19624
19625var _require = __webpack_require__(12),
19626 request = _require.request;
19627
19628var _require2 = __webpack_require__(15),
19629 ensureArray = _require2.ensureArray,
19630 parseDate = _require2.parseDate;
19631
19632var AV = __webpack_require__(34);
19633
19634/**
19635 * The version change interval for Leaderboard
19636 * @enum
19637 */
19638AV.LeaderboardVersionChangeInterval = {
19639 NEVER: 'never',
19640 DAY: 'day',
19641 WEEK: 'week',
19642 MONTH: 'month'
19643};
19644
19645/**
19646 * The order of the leaderboard results
19647 * @enum
19648 */
19649AV.LeaderboardOrder = {
19650 ASCENDING: 'ascending',
19651 DESCENDING: 'descending'
19652};
19653
19654/**
19655 * The update strategy for Leaderboard
19656 * @enum
19657 */
19658AV.LeaderboardUpdateStrategy = {
19659 /** Only keep the best statistic. If the leaderboard is in descending order, the best statistic is the highest one. */
19660 BETTER: 'better',
19661 /** Keep the last updated statistic */
19662 LAST: 'last',
19663 /** Keep the sum of all updated statistics */
19664 SUM: 'sum'
19665};
19666
19667/**
19668 * @typedef {Object} Ranking
19669 * @property {number} rank Starts at 0
19670 * @property {number} value the statistic value of this ranking
19671 * @property {AV.User} user The user of this ranking
19672 * @property {Statistic[]} [includedStatistics] Other statistics of the user, specified by the `includeStatistic` option of `AV.Leaderboard.getResults()`
19673 */
19674
19675/**
19676 * @typedef {Object} LeaderboardArchive
19677 * @property {string} statisticName
19678 * @property {number} version version of the leaderboard
19679 * @property {string} status
19680 * @property {string} url URL for the downloadable archive
19681 * @property {Date} activatedAt time when this version became active
19682 * @property {Date} deactivatedAt time when this version was deactivated by a version incrementing
19683 */
19684
19685/**
19686 * @class
19687 */
19688function Statistic(_ref) {
19689 var name = _ref.name,
19690 value = _ref.value,
19691 version = _ref.version;
19692
19693 /**
19694 * @type {string}
19695 */
19696 this.name = name;
19697 /**
19698 * @type {number}
19699 */
19700 this.value = value;
19701 /**
19702 * @type {number?}
19703 */
19704 this.version = version;
19705}
19706
19707var parseStatisticData = function parseStatisticData(statisticData) {
19708 var _AV$_decode = AV._decode(statisticData),
19709 name = _AV$_decode.statisticName,
19710 value = _AV$_decode.statisticValue,
19711 version = _AV$_decode.version;
19712
19713 return new Statistic({ name: name, value: value, version: version });
19714};
19715
19716/**
19717 * @class
19718 */
19719AV.Leaderboard = function Leaderboard(statisticName) {
19720 /**
19721 * @type {string}
19722 */
19723 this.statisticName = statisticName;
19724 /**
19725 * @type {AV.LeaderboardOrder}
19726 */
19727 this.order = undefined;
19728 /**
19729 * @type {AV.LeaderboardUpdateStrategy}
19730 */
19731 this.updateStrategy = undefined;
19732 /**
19733 * @type {AV.LeaderboardVersionChangeInterval}
19734 */
19735 this.versionChangeInterval = undefined;
19736 /**
19737 * @type {number}
19738 */
19739 this.version = undefined;
19740 /**
19741 * @type {Date?}
19742 */
19743 this.nextResetAt = undefined;
19744 /**
19745 * @type {Date?}
19746 */
19747 this.createdAt = undefined;
19748};
19749var Leaderboard = AV.Leaderboard;
19750
19751/**
19752 * Create an instance of Leaderboard for the give statistic name.
19753 * @param {string} statisticName
19754 * @return {AV.Leaderboard}
19755 */
19756AV.Leaderboard.createWithoutData = function (statisticName) {
19757 return new Leaderboard(statisticName);
19758};
19759/**
19760 * (masterKey required) Create a new Leaderboard.
19761 * @param {Object} options
19762 * @param {string} options.statisticName
19763 * @param {AV.LeaderboardOrder} options.order
19764 * @param {AV.LeaderboardVersionChangeInterval} [options.versionChangeInterval] default to WEEK
19765 * @param {AV.LeaderboardUpdateStrategy} [options.updateStrategy] default to BETTER
19766 * @param {AuthOptions} [authOptions]
19767 * @return {Promise<AV.Leaderboard>}
19768 */
19769AV.Leaderboard.createLeaderboard = function (_ref2, authOptions) {
19770 var statisticName = _ref2.statisticName,
19771 order = _ref2.order,
19772 versionChangeInterval = _ref2.versionChangeInterval,
19773 updateStrategy = _ref2.updateStrategy;
19774 return request({
19775 method: 'POST',
19776 path: '/leaderboard/leaderboards',
19777 data: {
19778 statisticName: statisticName,
19779 order: order,
19780 versionChangeInterval: versionChangeInterval,
19781 updateStrategy: updateStrategy
19782 },
19783 authOptions: authOptions
19784 }).then(function (data) {
19785 var leaderboard = new Leaderboard(statisticName);
19786 return leaderboard._finishFetch(data);
19787 });
19788};
19789/**
19790 * Get the Leaderboard with the specified statistic name.
19791 * @param {string} statisticName
19792 * @param {AuthOptions} [authOptions]
19793 * @return {Promise<AV.Leaderboard>}
19794 */
19795AV.Leaderboard.getLeaderboard = function (statisticName, authOptions) {
19796 return Leaderboard.createWithoutData(statisticName).fetch(authOptions);
19797};
19798/**
19799 * Get Statistics for the specified user.
19800 * @param {AV.User} user The specified AV.User pointer.
19801 * @param {Object} [options]
19802 * @param {string[]} [options.statisticNames] Specify the statisticNames. If not set, all statistics of the user will be fetched.
19803 * @param {AuthOptions} [authOptions]
19804 * @return {Promise<Statistic[]>}
19805 */
19806AV.Leaderboard.getStatistics = function (user) {
19807 var _ref3 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
19808 statisticNames = _ref3.statisticNames;
19809
19810 var authOptions = arguments[2];
19811 return _promise2.default.resolve().then(function () {
19812 if (!(user && user.id)) throw new Error('user must be an AV.User');
19813 return request({
19814 method: 'GET',
19815 path: '/leaderboard/users/' + user.id + '/statistics',
19816 query: {
19817 statistics: statisticNames ? ensureArray(statisticNames).join(',') : undefined
19818 },
19819 authOptions: authOptions
19820 }).then(function (_ref4) {
19821 var results = _ref4.results;
19822 return results.map(parseStatisticData);
19823 });
19824 });
19825};
19826
19827/**
19828 * Update Statistics for the specified user.
19829 * @param {AV.User} user The specified AV.User pointer.
19830 * @param {Object} statistics A name-value pair representing the statistics to update.
19831 * @param {AuthOptions} [options] AuthOptions plus:
19832 * @param {boolean} [options.overwrite] Wethere to overwrite these statistics disregarding the updateStrategy of there leaderboards
19833 * @return {Promise<Statistic[]>}
19834 */
19835AV.Leaderboard.updateStatistics = function (user, statistics) {
19836 var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
19837 return _promise2.default.resolve().then(function () {
19838 if (!(user && user.id)) throw new Error('user must be an AV.User');
19839 var data = _.map(statistics, function (value, key) {
19840 return {
19841 statisticName: key,
19842 statisticValue: value
19843 };
19844 });
19845 var overwrite = options.overwrite;
19846
19847 return request({
19848 method: 'POST',
19849 path: '/leaderboard/users/' + user.id + '/statistics',
19850 query: {
19851 overwrite: overwrite ? 1 : undefined
19852 },
19853 data: data,
19854 authOptions: options
19855 }).then(function (_ref5) {
19856 var results = _ref5.results;
19857 return results.map(parseStatisticData);
19858 });
19859 });
19860};
19861
19862/**
19863 * Delete Statistics for the specified user.
19864 * @param {AV.User} user The specified AV.User pointer.
19865 * @param {Object} statistics A name-value pair representing the statistics to delete.
19866 * @param {AuthOptions} [options]
19867 * @return {Promise<void>}
19868 */
19869AV.Leaderboard.deleteStatistics = function (user, statisticNames, authOptions) {
19870 return _promise2.default.resolve().then(function () {
19871 if (!(user && user.id)) throw new Error('user must be an AV.User');
19872 return request({
19873 method: 'DELETE',
19874 path: '/leaderboard/users/' + user.id + '/statistics',
19875 query: {
19876 statistics: ensureArray(statisticNames).join(',')
19877 },
19878 authOptions: authOptions
19879 }).then(function () {
19880 return undefined;
19881 });
19882 });
19883};
19884
19885_.extend(Leaderboard.prototype,
19886/** @lends AV.Leaderboard.prototype */{
19887 _finishFetch: function _finishFetch(data) {
19888 var _this = this;
19889
19890 _.forEach(data, function (value, key) {
19891 if (key === 'updatedAt' || key === 'objectId') return;
19892 if (key === 'expiredAt') {
19893 key = 'nextResetAt';
19894 }
19895 if (key === 'createdAt') {
19896 value = parseDate(value);
19897 }
19898 if (value && value.__type === 'Date') {
19899 value = parseDate(value.iso);
19900 }
19901 _this[key] = value;
19902 });
19903 return this;
19904 },
19905
19906 /**
19907 * Fetch data from the srever.
19908 * @param {AuthOptions} [authOptions]
19909 * @return {Promise<AV.Leaderboard>}
19910 */
19911 fetch: function fetch(authOptions) {
19912 var _this2 = this;
19913
19914 return request({
19915 method: 'GET',
19916 path: '/leaderboard/leaderboards/' + this.statisticName,
19917 authOptions: authOptions
19918 }).then(function (data) {
19919 return _this2._finishFetch(data);
19920 });
19921 },
19922
19923 /**
19924 * Counts the number of users participated in this leaderboard
19925 * @param {Object} [options]
19926 * @param {number} [options.version] Specify the version of the leaderboard
19927 * @param {AuthOptions} [authOptions]
19928 * @return {Promise<number>}
19929 */
19930 count: function count() {
19931 var _ref6 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
19932 version = _ref6.version;
19933
19934 var authOptions = arguments[1];
19935
19936 return request({
19937 method: 'GET',
19938 path: '/leaderboard/leaderboards/' + this.statisticName + '/ranks',
19939 query: {
19940 count: 1,
19941 limit: 0,
19942 version: version
19943 },
19944 authOptions: authOptions
19945 }).then(function (_ref7) {
19946 var count = _ref7.count;
19947 return count;
19948 });
19949 },
19950 _getResults: function _getResults(_ref8, authOptions, userId) {
19951 var skip = _ref8.skip,
19952 limit = _ref8.limit,
19953 selectUserKeys = _ref8.selectUserKeys,
19954 includeUserKeys = _ref8.includeUserKeys,
19955 includeStatistics = _ref8.includeStatistics,
19956 version = _ref8.version;
19957
19958 return request({
19959 method: 'GET',
19960 path: '/leaderboard/leaderboards/' + this.statisticName + '/ranks' + (userId ? '/' + userId : ''),
19961 query: {
19962 skip: skip,
19963 limit: limit,
19964 selectUserKeys: _.union(ensureArray(selectUserKeys), ensureArray(includeUserKeys)).join(',') || undefined,
19965 includeUser: includeUserKeys ? ensureArray(includeUserKeys).join(',') : undefined,
19966 includeStatistics: includeStatistics ? ensureArray(includeStatistics).join(',') : undefined,
19967 version: version
19968 },
19969 authOptions: authOptions
19970 }).then(function (_ref9) {
19971 var rankings = _ref9.results;
19972 return rankings.map(function (rankingData) {
19973 var _AV$_decode2 = AV._decode(rankingData),
19974 user = _AV$_decode2.user,
19975 value = _AV$_decode2.statisticValue,
19976 rank = _AV$_decode2.rank,
19977 _AV$_decode2$statisti = _AV$_decode2.statistics,
19978 statistics = _AV$_decode2$statisti === undefined ? [] : _AV$_decode2$statisti;
19979
19980 return {
19981 user: user,
19982 value: value,
19983 rank: rank,
19984 includedStatistics: statistics.map(parseStatisticData)
19985 };
19986 });
19987 });
19988 },
19989
19990 /**
19991 * Retrieve a list of ranked users for this Leaderboard.
19992 * @param {Object} [options]
19993 * @param {number} [options.skip] The number of results to skip. This is useful for pagination.
19994 * @param {number} [options.limit] The limit of the number of results.
19995 * @param {string[]} [options.selectUserKeys] Specify keys of the users to include in the Rankings
19996 * @param {string[]} [options.includeUserKeys] If the value of a selected user keys is a Pointer, use this options to include its value.
19997 * @param {string[]} [options.includeStatistics] Specify other statistics to include in the Rankings
19998 * @param {number} [options.version] Specify the version of the leaderboard
19999 * @param {AuthOptions} [authOptions]
20000 * @return {Promise<Ranking[]>}
20001 */
20002 getResults: function getResults() {
20003 var _ref10 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
20004 skip = _ref10.skip,
20005 limit = _ref10.limit,
20006 selectUserKeys = _ref10.selectUserKeys,
20007 includeUserKeys = _ref10.includeUserKeys,
20008 includeStatistics = _ref10.includeStatistics,
20009 version = _ref10.version;
20010
20011 var authOptions = arguments[1];
20012
20013 return this._getResults({
20014 skip: skip,
20015 limit: limit,
20016 selectUserKeys: selectUserKeys,
20017 includeUserKeys: includeUserKeys,
20018 includeStatistics: includeStatistics,
20019 version: version
20020 }, authOptions);
20021 },
20022
20023 /**
20024 * Retrieve a list of ranked users for this Leaderboard, centered on the specified user.
20025 * @param {AV.User} user The specified AV.User pointer.
20026 * @param {Object} [options]
20027 * @param {number} [options.limit] The limit of the number of results.
20028 * @param {string[]} [options.selectUserKeys] Specify keys of the users to include in the Rankings
20029 * @param {string[]} [options.includeUserKeys] If the value of a selected user keys is a Pointer, use this options to include its value.
20030 * @param {string[]} [options.includeStatistics] Specify other statistics to include in the Rankings
20031 * @param {number} [options.version] Specify the version of the leaderboard
20032 * @param {AuthOptions} [authOptions]
20033 * @return {Promise<Ranking[]>}
20034 */
20035 getResultsAroundUser: function getResultsAroundUser(user) {
20036 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
20037 var authOptions = arguments[2];
20038
20039 // getResultsAroundUser(options, authOptions)
20040 if (user && typeof user.id !== 'string') {
20041 return this.getResultsAroundUser(undefined, user, options);
20042 }
20043 var limit = options.limit,
20044 selectUserKeys = options.selectUserKeys,
20045 includeUserKeys = options.includeUserKeys,
20046 includeStatistics = options.includeStatistics,
20047 version = options.version;
20048
20049 return this._getResults({ limit: limit, selectUserKeys: selectUserKeys, includeUserKeys: includeUserKeys, includeStatistics: includeStatistics, version: version }, authOptions, user ? user.id : 'self');
20050 },
20051 _update: function _update(data, authOptions) {
20052 var _this3 = this;
20053
20054 return request({
20055 method: 'PUT',
20056 path: '/leaderboard/leaderboards/' + this.statisticName,
20057 data: data,
20058 authOptions: authOptions
20059 }).then(function (result) {
20060 return _this3._finishFetch(result);
20061 });
20062 },
20063
20064 /**
20065 * (masterKey required) Update the version change interval of the Leaderboard.
20066 * @param {AV.LeaderboardVersionChangeInterval} versionChangeInterval
20067 * @param {AuthOptions} [authOptions]
20068 * @return {Promise<AV.Leaderboard>}
20069 */
20070 updateVersionChangeInterval: function updateVersionChangeInterval(versionChangeInterval, authOptions) {
20071 return this._update({ versionChangeInterval: versionChangeInterval }, authOptions);
20072 },
20073
20074 /**
20075 * (masterKey required) Update the version change interval of the Leaderboard.
20076 * @param {AV.LeaderboardUpdateStrategy} updateStrategy
20077 * @param {AuthOptions} [authOptions]
20078 * @return {Promise<AV.Leaderboard>}
20079 */
20080 updateUpdateStrategy: function updateUpdateStrategy(updateStrategy, authOptions) {
20081 return this._update({ updateStrategy: updateStrategy }, authOptions);
20082 },
20083
20084 /**
20085 * (masterKey required) Reset the Leaderboard. The version of the Leaderboard will be incremented by 1.
20086 * @param {AuthOptions} [authOptions]
20087 * @return {Promise<AV.Leaderboard>}
20088 */
20089 reset: function reset(authOptions) {
20090 var _this4 = this;
20091
20092 return request({
20093 method: 'PUT',
20094 path: '/leaderboard/leaderboards/' + this.statisticName + '/incrementVersion',
20095 authOptions: authOptions
20096 }).then(function (data) {
20097 return _this4._finishFetch(data);
20098 });
20099 },
20100
20101 /**
20102 * (masterKey required) Delete the Leaderboard and its all archived versions.
20103 * @param {AuthOptions} [authOptions]
20104 * @return {void}
20105 */
20106 destroy: function destroy(authOptions) {
20107 return AV.request({
20108 method: 'DELETE',
20109 path: '/leaderboard/leaderboards/' + this.statisticName,
20110 authOptions: authOptions
20111 }).then(function () {
20112 return undefined;
20113 });
20114 },
20115
20116 /**
20117 * (masterKey required) Get archived versions.
20118 * @param {Object} [options]
20119 * @param {number} [options.skip] The number of results to skip. This is useful for pagination.
20120 * @param {number} [options.limit] The limit of the number of results.
20121 * @param {AuthOptions} [authOptions]
20122 * @return {Promise<LeaderboardArchive[]>}
20123 */
20124 getArchives: function getArchives() {
20125 var _this5 = this;
20126
20127 var _ref11 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
20128 skip = _ref11.skip,
20129 limit = _ref11.limit;
20130
20131 var authOptions = arguments[1];
20132
20133 return request({
20134 method: 'GET',
20135 path: '/leaderboard/leaderboards/' + this.statisticName + '/archives',
20136 query: {
20137 skip: skip,
20138 limit: limit
20139 },
20140 authOptions: authOptions
20141 }).then(function (_ref12) {
20142 var results = _ref12.results;
20143 return results.map(function (_ref13) {
20144 var version = _ref13.version,
20145 status = _ref13.status,
20146 url = _ref13.url,
20147 activatedAt = _ref13.activatedAt,
20148 deactivatedAt = _ref13.deactivatedAt;
20149 return {
20150 statisticName: _this5.statisticName,
20151 version: version,
20152 status: status,
20153 url: url,
20154 activatedAt: parseDate(activatedAt.iso),
20155 deactivatedAt: parseDate(deactivatedAt.iso)
20156 };
20157 });
20158 });
20159 }
20160});
20161
20162/***/ })
20163/******/ ]);
20164});
20165//# sourceMappingURL=av-core.js.map
\No newline at end of file