@freelog/tools-lib 0.1.100 → 0.1.105

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,423 +5,834 @@ import axios from 'axios';
5
5
  import NProgress from 'nprogress';
6
6
  import 'nprogress/nprogress.css';
7
7
  import { lib, SHA1 } from 'crypto-js';
8
+ import i18next from 'i18next';
8
9
 
9
- function _regeneratorRuntime() {
10
- /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
10
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
11
+ try {
12
+ var info = gen[key](arg);
13
+ var value = info.value;
14
+ } catch (error) {
15
+ reject(error);
16
+ return;
17
+ }
18
+
19
+ if (info.done) {
20
+ resolve(value);
21
+ } else {
22
+ Promise.resolve(value).then(_next, _throw);
23
+ }
24
+ }
25
+
26
+ function _asyncToGenerator(fn) {
27
+ return function () {
28
+ var self = this,
29
+ args = arguments;
30
+ return new Promise(function (resolve, reject) {
31
+ var gen = fn.apply(self, args);
32
+
33
+ function _next(value) {
34
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
35
+ }
36
+
37
+ function _throw(err) {
38
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
39
+ }
40
+
41
+ _next(undefined);
42
+ });
43
+ };
44
+ }
45
+
46
+ function _extends() {
47
+ _extends = Object.assign || function (target) {
48
+ for (var i = 1; i < arguments.length; i++) {
49
+ var source = arguments[i];
50
+
51
+ for (var key in source) {
52
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
53
+ target[key] = source[key];
54
+ }
55
+ }
56
+ }
11
57
 
12
- _regeneratorRuntime = function () {
13
- return exports;
58
+ return target;
14
59
  };
15
60
 
16
- var exports = {},
17
- Op = Object.prototype,
18
- hasOwn = Op.hasOwnProperty,
19
- $Symbol = "function" == typeof Symbol ? Symbol : {},
20
- iteratorSymbol = $Symbol.iterator || "@@iterator",
21
- asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
22
- toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
61
+ return _extends.apply(this, arguments);
62
+ }
63
+
64
+ function _objectDestructuringEmpty(obj) {
65
+ if (obj == null) throw new TypeError("Cannot destructure undefined");
66
+ }
67
+
68
+ function _objectWithoutPropertiesLoose(source, excluded) {
69
+ if (source == null) return {};
70
+ var target = {};
71
+ var sourceKeys = Object.keys(source);
72
+ var key, i;
73
+
74
+ for (i = 0; i < sourceKeys.length; i++) {
75
+ key = sourceKeys[i];
76
+ if (excluded.indexOf(key) >= 0) continue;
77
+ target[key] = source[key];
78
+ }
79
+
80
+ return target;
81
+ }
82
+
83
+ function createCommonjsModule(fn, module) {
84
+ return module = { exports: {} }, fn(module, module.exports), module.exports;
85
+ }
86
+
87
+ var runtime_1 = createCommonjsModule(function (module) {
88
+ /**
89
+ * Copyright (c) 2014-present, Facebook, Inc.
90
+ *
91
+ * This source code is licensed under the MIT license found in the
92
+ * LICENSE file in the root directory of this source tree.
93
+ */
94
+
95
+ var runtime = (function (exports) {
96
+
97
+ var Op = Object.prototype;
98
+ var hasOwn = Op.hasOwnProperty;
99
+ var undefined$1; // More compressible than void 0.
100
+ var $Symbol = typeof Symbol === "function" ? Symbol : {};
101
+ var iteratorSymbol = $Symbol.iterator || "@@iterator";
102
+ var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
103
+ var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
23
104
 
24
105
  function define(obj, key, value) {
25
- return Object.defineProperty(obj, key, {
106
+ Object.defineProperty(obj, key, {
26
107
  value: value,
27
- enumerable: !0,
28
- configurable: !0,
29
- writable: !0
30
- }), obj[key];
108
+ enumerable: true,
109
+ configurable: true,
110
+ writable: true
111
+ });
112
+ return obj[key];
31
113
  }
32
-
33
114
  try {
115
+ // IE 8 has a broken Object.defineProperty that only works on DOM objects.
34
116
  define({}, "");
35
117
  } catch (err) {
36
- define = function (obj, key, value) {
118
+ define = function(obj, key, value) {
37
119
  return obj[key] = value;
38
120
  };
39
121
  }
40
122
 
41
123
  function wrap(innerFn, outerFn, self, tryLocsList) {
42
- var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
43
- generator = Object.create(protoGenerator.prototype),
44
- context = new Context(tryLocsList || []);
45
- return generator._invoke = function (innerFn, self, context) {
46
- var state = "suspendedStart";
47
- return function (method, arg) {
48
- if ("executing" === state) throw new Error("Generator is already running");
49
-
50
- if ("completed" === state) {
51
- if ("throw" === method) throw arg;
52
- return doneResult();
53
- }
54
-
55
- for (context.method = method, context.arg = arg;;) {
56
- var delegate = context.delegate;
124
+ // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.
125
+ var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
126
+ var generator = Object.create(protoGenerator.prototype);
127
+ var context = new Context(tryLocsList || []);
57
128
 
58
- if (delegate) {
59
- var delegateResult = maybeInvokeDelegate(delegate, context);
60
-
61
- if (delegateResult) {
62
- if (delegateResult === ContinueSentinel) continue;
63
- return delegateResult;
64
- }
65
- }
66
-
67
- if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
68
- if ("suspendedStart" === state) throw state = "completed", context.arg;
69
- context.dispatchException(context.arg);
70
- } else "return" === context.method && context.abrupt("return", context.arg);
71
- state = "executing";
72
- var record = tryCatch(innerFn, self, context);
73
-
74
- if ("normal" === record.type) {
75
- if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
76
- return {
77
- value: record.arg,
78
- done: context.done
79
- };
80
- }
129
+ // The ._invoke method unifies the implementations of the .next,
130
+ // .throw, and .return methods.
131
+ generator._invoke = makeInvokeMethod(innerFn, self, context);
81
132
 
82
- "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
83
- }
84
- };
85
- }(innerFn, self, context), generator;
133
+ return generator;
86
134
  }
135
+ exports.wrap = wrap;
87
136
 
137
+ // Try/catch helper to minimize deoptimizations. Returns a completion
138
+ // record like context.tryEntries[i].completion. This interface could
139
+ // have been (and was previously) designed to take a closure to be
140
+ // invoked without arguments, but in all the cases we care about we
141
+ // already have an existing method we want to call, so there's no need
142
+ // to create a new function object. We can even get away with assuming
143
+ // the method takes exactly one argument, since that happens to be true
144
+ // in every case, so we don't have to touch the arguments object. The
145
+ // only additional allocation required is the completion record, which
146
+ // has a stable shape and so hopefully should be cheap to allocate.
88
147
  function tryCatch(fn, obj, arg) {
89
148
  try {
90
- return {
91
- type: "normal",
92
- arg: fn.call(obj, arg)
93
- };
149
+ return { type: "normal", arg: fn.call(obj, arg) };
94
150
  } catch (err) {
95
- return {
96
- type: "throw",
97
- arg: err
98
- };
151
+ return { type: "throw", arg: err };
99
152
  }
100
153
  }
101
154
 
102
- exports.wrap = wrap;
155
+ var GenStateSuspendedStart = "suspendedStart";
156
+ var GenStateSuspendedYield = "suspendedYield";
157
+ var GenStateExecuting = "executing";
158
+ var GenStateCompleted = "completed";
159
+
160
+ // Returning this object from the innerFn has the same effect as
161
+ // breaking out of the dispatch switch statement.
103
162
  var ContinueSentinel = {};
104
163
 
164
+ // Dummy constructor functions that we use as the .constructor and
165
+ // .constructor.prototype properties for functions that return Generator
166
+ // objects. For full spec compliance, you may wish to configure your
167
+ // minifier not to mangle the names of these two functions.
105
168
  function Generator() {}
106
-
107
169
  function GeneratorFunction() {}
108
-
109
170
  function GeneratorFunctionPrototype() {}
110
171
 
172
+ // This is a polyfill for %IteratorPrototype% for environments that
173
+ // don't natively support it.
111
174
  var IteratorPrototype = {};
112
- define(IteratorPrototype, iteratorSymbol, function () {
175
+ IteratorPrototype[iteratorSymbol] = function () {
113
176
  return this;
114
- });
115
- var getProto = Object.getPrototypeOf,
116
- NativeIteratorPrototype = getProto && getProto(getProto(values([])));
117
- NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
118
- var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
177
+ };
119
178
 
179
+ var getProto = Object.getPrototypeOf;
180
+ var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
181
+ if (NativeIteratorPrototype &&
182
+ NativeIteratorPrototype !== Op &&
183
+ hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
184
+ // This environment has a native %IteratorPrototype%; use it instead
185
+ // of the polyfill.
186
+ IteratorPrototype = NativeIteratorPrototype;
187
+ }
188
+
189
+ var Gp = GeneratorFunctionPrototype.prototype =
190
+ Generator.prototype = Object.create(IteratorPrototype);
191
+ GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;
192
+ GeneratorFunctionPrototype.constructor = GeneratorFunction;
193
+ GeneratorFunction.displayName = define(
194
+ GeneratorFunctionPrototype,
195
+ toStringTagSymbol,
196
+ "GeneratorFunction"
197
+ );
198
+
199
+ // Helper for defining the .next, .throw, and .return methods of the
200
+ // Iterator interface in terms of a single ._invoke method.
120
201
  function defineIteratorMethods(prototype) {
121
- ["next", "throw", "return"].forEach(function (method) {
122
- define(prototype, method, function (arg) {
202
+ ["next", "throw", "return"].forEach(function(method) {
203
+ define(prototype, method, function(arg) {
123
204
  return this._invoke(method, arg);
124
205
  });
125
206
  });
126
207
  }
127
208
 
209
+ exports.isGeneratorFunction = function(genFun) {
210
+ var ctor = typeof genFun === "function" && genFun.constructor;
211
+ return ctor
212
+ ? ctor === GeneratorFunction ||
213
+ // For the native GeneratorFunction constructor, the best we can
214
+ // do is to check its .name property.
215
+ (ctor.displayName || ctor.name) === "GeneratorFunction"
216
+ : false;
217
+ };
218
+
219
+ exports.mark = function(genFun) {
220
+ if (Object.setPrototypeOf) {
221
+ Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
222
+ } else {
223
+ genFun.__proto__ = GeneratorFunctionPrototype;
224
+ define(genFun, toStringTagSymbol, "GeneratorFunction");
225
+ }
226
+ genFun.prototype = Object.create(Gp);
227
+ return genFun;
228
+ };
229
+
230
+ // Within the body of any async function, `await x` is transformed to
231
+ // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
232
+ // `hasOwn.call(value, "__await")` to determine if the yielded value is
233
+ // meant to be awaited.
234
+ exports.awrap = function(arg) {
235
+ return { __await: arg };
236
+ };
237
+
128
238
  function AsyncIterator(generator, PromiseImpl) {
129
239
  function invoke(method, arg, resolve, reject) {
130
240
  var record = tryCatch(generator[method], generator, arg);
241
+ if (record.type === "throw") {
242
+ reject(record.arg);
243
+ } else {
244
+ var result = record.arg;
245
+ var value = result.value;
246
+ if (value &&
247
+ typeof value === "object" &&
248
+ hasOwn.call(value, "__await")) {
249
+ return PromiseImpl.resolve(value.__await).then(function(value) {
250
+ invoke("next", value, resolve, reject);
251
+ }, function(err) {
252
+ invoke("throw", err, resolve, reject);
253
+ });
254
+ }
131
255
 
132
- if ("throw" !== record.type) {
133
- var result = record.arg,
134
- value = result.value;
135
- return value && "object" == typeof value && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
136
- invoke("next", value, resolve, reject);
137
- }, function (err) {
138
- invoke("throw", err, resolve, reject);
139
- }) : PromiseImpl.resolve(value).then(function (unwrapped) {
140
- result.value = unwrapped, resolve(result);
141
- }, function (error) {
256
+ return PromiseImpl.resolve(value).then(function(unwrapped) {
257
+ // When a yielded Promise is resolved, its final value becomes
258
+ // the .value of the Promise<{value,done}> result for the
259
+ // current iteration.
260
+ result.value = unwrapped;
261
+ resolve(result);
262
+ }, function(error) {
263
+ // If a rejected Promise was yielded, throw the rejection back
264
+ // into the async generator function so it can be handled there.
142
265
  return invoke("throw", error, resolve, reject);
143
266
  });
144
267
  }
145
-
146
- reject(record.arg);
147
268
  }
148
269
 
149
270
  var previousPromise;
150
271
 
151
- this._invoke = function (method, arg) {
272
+ function enqueue(method, arg) {
152
273
  function callInvokeWithMethodAndArg() {
153
- return new PromiseImpl(function (resolve, reject) {
274
+ return new PromiseImpl(function(resolve, reject) {
154
275
  invoke(method, arg, resolve, reject);
155
276
  });
156
277
  }
157
278
 
158
- return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
279
+ return previousPromise =
280
+ // If enqueue has been called before, then we want to wait until
281
+ // all previous Promises have been resolved before calling invoke,
282
+ // so that results are always delivered in the correct order. If
283
+ // enqueue has not been called before, then it is important to
284
+ // call invoke immediately, without waiting on a callback to fire,
285
+ // so that the async generator function has the opportunity to do
286
+ // any necessary setup in a predictable way. This predictability
287
+ // is why the Promise constructor synchronously invokes its
288
+ // executor callback, and why async functions synchronously
289
+ // execute code before the first await. Since we implement simple
290
+ // async functions in terms of async generators, it is especially
291
+ // important to get this right, even though it requires care.
292
+ previousPromise ? previousPromise.then(
293
+ callInvokeWithMethodAndArg,
294
+ // Avoid propagating failures to Promises returned by later
295
+ // invocations of the iterator.
296
+ callInvokeWithMethodAndArg
297
+ ) : callInvokeWithMethodAndArg();
298
+ }
299
+
300
+ // Define the unified helper method that is used to implement .next,
301
+ // .throw, and .return (see defineIteratorMethods).
302
+ this._invoke = enqueue;
303
+ }
304
+
305
+ defineIteratorMethods(AsyncIterator.prototype);
306
+ AsyncIterator.prototype[asyncIteratorSymbol] = function () {
307
+ return this;
308
+ };
309
+ exports.AsyncIterator = AsyncIterator;
310
+
311
+ // Note that simple async functions are implemented on top of
312
+ // AsyncIterator objects; they just return a Promise for the value of
313
+ // the final result produced by the iterator.
314
+ exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) {
315
+ if (PromiseImpl === void 0) PromiseImpl = Promise;
316
+
317
+ var iter = new AsyncIterator(
318
+ wrap(innerFn, outerFn, self, tryLocsList),
319
+ PromiseImpl
320
+ );
321
+
322
+ return exports.isGeneratorFunction(outerFn)
323
+ ? iter // If outerFn is a generator, return the full iterator.
324
+ : iter.next().then(function(result) {
325
+ return result.done ? result.value : iter.next();
326
+ });
327
+ };
328
+
329
+ function makeInvokeMethod(innerFn, self, context) {
330
+ var state = GenStateSuspendedStart;
331
+
332
+ return function invoke(method, arg) {
333
+ if (state === GenStateExecuting) {
334
+ throw new Error("Generator is already running");
335
+ }
336
+
337
+ if (state === GenStateCompleted) {
338
+ if (method === "throw") {
339
+ throw arg;
340
+ }
341
+
342
+ // Be forgiving, per 25.3.3.3.3 of the spec:
343
+ // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
344
+ return doneResult();
345
+ }
346
+
347
+ context.method = method;
348
+ context.arg = arg;
349
+
350
+ while (true) {
351
+ var delegate = context.delegate;
352
+ if (delegate) {
353
+ var delegateResult = maybeInvokeDelegate(delegate, context);
354
+ if (delegateResult) {
355
+ if (delegateResult === ContinueSentinel) continue;
356
+ return delegateResult;
357
+ }
358
+ }
359
+
360
+ if (context.method === "next") {
361
+ // Setting context._sent for legacy support of Babel's
362
+ // function.sent implementation.
363
+ context.sent = context._sent = context.arg;
364
+
365
+ } else if (context.method === "throw") {
366
+ if (state === GenStateSuspendedStart) {
367
+ state = GenStateCompleted;
368
+ throw context.arg;
369
+ }
370
+
371
+ context.dispatchException(context.arg);
372
+
373
+ } else if (context.method === "return") {
374
+ context.abrupt("return", context.arg);
375
+ }
376
+
377
+ state = GenStateExecuting;
378
+
379
+ var record = tryCatch(innerFn, self, context);
380
+ if (record.type === "normal") {
381
+ // If an exception is thrown from innerFn, we leave state ===
382
+ // GenStateExecuting and loop back for another invocation.
383
+ state = context.done
384
+ ? GenStateCompleted
385
+ : GenStateSuspendedYield;
386
+
387
+ if (record.arg === ContinueSentinel) {
388
+ continue;
389
+ }
390
+
391
+ return {
392
+ value: record.arg,
393
+ done: context.done
394
+ };
395
+
396
+ } else if (record.type === "throw") {
397
+ state = GenStateCompleted;
398
+ // Dispatch the exception by looping back around to the
399
+ // context.dispatchException(context.arg) call above.
400
+ context.method = "throw";
401
+ context.arg = record.arg;
402
+ }
403
+ }
159
404
  };
160
405
  }
161
406
 
407
+ // Call delegate.iterator[context.method](context.arg) and handle the
408
+ // result, either by returning a { value, done } result from the
409
+ // delegate iterator, or by modifying context.method and context.arg,
410
+ // setting context.delegate to null, and returning the ContinueSentinel.
162
411
  function maybeInvokeDelegate(delegate, context) {
163
412
  var method = delegate.iterator[context.method];
413
+ if (method === undefined$1) {
414
+ // A .throw or .return when the delegate iterator has no .throw
415
+ // method always terminates the yield* loop.
416
+ context.delegate = null;
417
+
418
+ if (context.method === "throw") {
419
+ // Note: ["return"] must be used for ES3 parsing compatibility.
420
+ if (delegate.iterator["return"]) {
421
+ // If the delegate iterator has a return method, give it a
422
+ // chance to clean up.
423
+ context.method = "return";
424
+ context.arg = undefined$1;
425
+ maybeInvokeDelegate(delegate, context);
426
+
427
+ if (context.method === "throw") {
428
+ // If maybeInvokeDelegate(context) changed context.method from
429
+ // "return" to "throw", let that override the TypeError below.
430
+ return ContinueSentinel;
431
+ }
432
+ }
164
433
 
165
- if (undefined === method) {
166
- if (context.delegate = null, "throw" === context.method) {
167
- if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel;
168
- context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method");
434
+ context.method = "throw";
435
+ context.arg = new TypeError(
436
+ "The iterator does not provide a 'throw' method");
169
437
  }
170
438
 
171
439
  return ContinueSentinel;
172
440
  }
173
441
 
174
442
  var record = tryCatch(method, delegate.iterator, context.arg);
175
- if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
443
+
444
+ if (record.type === "throw") {
445
+ context.method = "throw";
446
+ context.arg = record.arg;
447
+ context.delegate = null;
448
+ return ContinueSentinel;
449
+ }
450
+
176
451
  var info = record.arg;
177
- return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel);
452
+
453
+ if (! info) {
454
+ context.method = "throw";
455
+ context.arg = new TypeError("iterator result is not an object");
456
+ context.delegate = null;
457
+ return ContinueSentinel;
458
+ }
459
+
460
+ if (info.done) {
461
+ // Assign the result of the finished delegate to the temporary
462
+ // variable specified by delegate.resultName (see delegateYield).
463
+ context[delegate.resultName] = info.value;
464
+
465
+ // Resume execution at the desired location (see delegateYield).
466
+ context.next = delegate.nextLoc;
467
+
468
+ // If context.method was "throw" but the delegate handled the
469
+ // exception, let the outer generator proceed normally. If
470
+ // context.method was "next", forget context.arg since it has been
471
+ // "consumed" by the delegate iterator. If context.method was
472
+ // "return", allow the original .return call to continue in the
473
+ // outer generator.
474
+ if (context.method !== "return") {
475
+ context.method = "next";
476
+ context.arg = undefined$1;
477
+ }
478
+
479
+ } else {
480
+ // Re-yield the result returned by the delegate method.
481
+ return info;
482
+ }
483
+
484
+ // The delegate iterator is finished, so forget it and continue with
485
+ // the outer generator.
486
+ context.delegate = null;
487
+ return ContinueSentinel;
178
488
  }
179
489
 
490
+ // Define Generator.prototype.{next,throw,return} in terms of the
491
+ // unified ._invoke helper method.
492
+ defineIteratorMethods(Gp);
493
+
494
+ define(Gp, toStringTagSymbol, "Generator");
495
+
496
+ // A Generator should always return itself as the iterator object when the
497
+ // @@iterator function is called on it. Some browsers' implementations of the
498
+ // iterator prototype chain incorrectly implement this, causing the Generator
499
+ // object to not be returned from this call. This ensures that doesn't happen.
500
+ // See https://github.com/facebook/regenerator/issues/274 for more details.
501
+ Gp[iteratorSymbol] = function() {
502
+ return this;
503
+ };
504
+
505
+ Gp.toString = function() {
506
+ return "[object Generator]";
507
+ };
508
+
180
509
  function pushTryEntry(locs) {
181
- var entry = {
182
- tryLoc: locs[0]
183
- };
184
- 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
510
+ var entry = { tryLoc: locs[0] };
511
+
512
+ if (1 in locs) {
513
+ entry.catchLoc = locs[1];
514
+ }
515
+
516
+ if (2 in locs) {
517
+ entry.finallyLoc = locs[2];
518
+ entry.afterLoc = locs[3];
519
+ }
520
+
521
+ this.tryEntries.push(entry);
185
522
  }
186
523
 
187
524
  function resetTryEntry(entry) {
188
525
  var record = entry.completion || {};
189
- record.type = "normal", delete record.arg, entry.completion = record;
526
+ record.type = "normal";
527
+ delete record.arg;
528
+ entry.completion = record;
190
529
  }
191
530
 
192
531
  function Context(tryLocsList) {
193
- this.tryEntries = [{
194
- tryLoc: "root"
195
- }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0);
532
+ // The root entry object (effectively a try statement without a catch
533
+ // or a finally block) gives us a place to store values thrown from
534
+ // locations where there is no enclosing try statement.
535
+ this.tryEntries = [{ tryLoc: "root" }];
536
+ tryLocsList.forEach(pushTryEntry, this);
537
+ this.reset(true);
196
538
  }
197
539
 
540
+ exports.keys = function(object) {
541
+ var keys = [];
542
+ for (var key in object) {
543
+ keys.push(key);
544
+ }
545
+ keys.reverse();
546
+
547
+ // Rather than returning an object with a next method, we keep
548
+ // things simple and return the next function itself.
549
+ return function next() {
550
+ while (keys.length) {
551
+ var key = keys.pop();
552
+ if (key in object) {
553
+ next.value = key;
554
+ next.done = false;
555
+ return next;
556
+ }
557
+ }
558
+
559
+ // To avoid creating an additional object, we just hang the .value
560
+ // and .done properties off the next function object itself. This
561
+ // also ensures that the minifier will not anonymize the function.
562
+ next.done = true;
563
+ return next;
564
+ };
565
+ };
566
+
198
567
  function values(iterable) {
199
568
  if (iterable) {
200
569
  var iteratorMethod = iterable[iteratorSymbol];
201
- if (iteratorMethod) return iteratorMethod.call(iterable);
202
- if ("function" == typeof iterable.next) return iterable;
570
+ if (iteratorMethod) {
571
+ return iteratorMethod.call(iterable);
572
+ }
573
+
574
+ if (typeof iterable.next === "function") {
575
+ return iterable;
576
+ }
203
577
 
204
578
  if (!isNaN(iterable.length)) {
205
- var i = -1,
206
- next = function next() {
207
- for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
579
+ var i = -1, next = function next() {
580
+ while (++i < iterable.length) {
581
+ if (hasOwn.call(iterable, i)) {
582
+ next.value = iterable[i];
583
+ next.done = false;
584
+ return next;
585
+ }
586
+ }
587
+
588
+ next.value = undefined$1;
589
+ next.done = true;
208
590
 
209
- return next.value = undefined, next.done = !0, next;
591
+ return next;
210
592
  };
211
593
 
212
594
  return next.next = next;
213
595
  }
214
596
  }
215
597
 
216
- return {
217
- next: doneResult
218
- };
598
+ // Return an iterator with no values.
599
+ return { next: doneResult };
219
600
  }
601
+ exports.values = values;
220
602
 
221
603
  function doneResult() {
222
- return {
223
- value: undefined,
224
- done: !0
225
- };
604
+ return { value: undefined$1, done: true };
226
605
  }
227
606
 
228
- return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) {
229
- var ctor = "function" == typeof genFun && genFun.constructor;
230
- return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
231
- }, exports.mark = function (genFun) {
232
- return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun;
233
- }, exports.awrap = function (arg) {
234
- return {
235
- __await: arg
236
- };
237
- }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
238
- return this;
239
- }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
240
- void 0 === PromiseImpl && (PromiseImpl = Promise);
241
- var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
242
- return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) {
243
- return result.done ? result.value : iter.next();
244
- });
245
- }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () {
246
- return this;
247
- }), define(Gp, "toString", function () {
248
- return "[object Generator]";
249
- }), exports.keys = function (object) {
250
- var keys = [];
607
+ Context.prototype = {
608
+ constructor: Context,
251
609
 
252
- for (var key in object) keys.push(key);
610
+ reset: function(skipTempReset) {
611
+ this.prev = 0;
612
+ this.next = 0;
613
+ // Resetting context._sent for legacy support of Babel's
614
+ // function.sent implementation.
615
+ this.sent = this._sent = undefined$1;
616
+ this.done = false;
617
+ this.delegate = null;
618
+
619
+ this.method = "next";
620
+ this.arg = undefined$1;
621
+
622
+ this.tryEntries.forEach(resetTryEntry);
623
+
624
+ if (!skipTempReset) {
625
+ for (var name in this) {
626
+ // Not sure about the optimal order of these conditions:
627
+ if (name.charAt(0) === "t" &&
628
+ hasOwn.call(this, name) &&
629
+ !isNaN(+name.slice(1))) {
630
+ this[name] = undefined$1;
631
+ }
632
+ }
633
+ }
634
+ },
253
635
 
254
- return keys.reverse(), function next() {
255
- for (; keys.length;) {
256
- var key = keys.pop();
257
- if (key in object) return next.value = key, next.done = !1, next;
636
+ stop: function() {
637
+ this.done = true;
638
+
639
+ var rootEntry = this.tryEntries[0];
640
+ var rootRecord = rootEntry.completion;
641
+ if (rootRecord.type === "throw") {
642
+ throw rootRecord.arg;
258
643
  }
259
644
 
260
- return next.done = !0, next;
261
- };
262
- }, exports.values = values, Context.prototype = {
263
- constructor: Context,
264
- reset: function (skipTempReset) {
265
- if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined);
266
- },
267
- stop: function () {
268
- this.done = !0;
269
- var rootRecord = this.tryEntries[0].completion;
270
- if ("throw" === rootRecord.type) throw rootRecord.arg;
271
645
  return this.rval;
272
646
  },
273
- dispatchException: function (exception) {
274
- if (this.done) throw exception;
275
- var context = this;
276
647
 
648
+ dispatchException: function(exception) {
649
+ if (this.done) {
650
+ throw exception;
651
+ }
652
+
653
+ var context = this;
277
654
  function handle(loc, caught) {
278
- return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
655
+ record.type = "throw";
656
+ record.arg = exception;
657
+ context.next = loc;
658
+
659
+ if (caught) {
660
+ // If the dispatched exception was caught by a catch block,
661
+ // then let that catch block handle the exception normally.
662
+ context.method = "next";
663
+ context.arg = undefined$1;
664
+ }
665
+
666
+ return !! caught;
279
667
  }
280
668
 
281
669
  for (var i = this.tryEntries.length - 1; i >= 0; --i) {
282
- var entry = this.tryEntries[i],
283
- record = entry.completion;
284
- if ("root" === entry.tryLoc) return handle("end");
670
+ var entry = this.tryEntries[i];
671
+ var record = entry.completion;
672
+
673
+ if (entry.tryLoc === "root") {
674
+ // Exception thrown outside of any try block that could handle
675
+ // it, so set the completion value of the entire function to
676
+ // throw the exception.
677
+ return handle("end");
678
+ }
285
679
 
286
680
  if (entry.tryLoc <= this.prev) {
287
- var hasCatch = hasOwn.call(entry, "catchLoc"),
288
- hasFinally = hasOwn.call(entry, "finallyLoc");
681
+ var hasCatch = hasOwn.call(entry, "catchLoc");
682
+ var hasFinally = hasOwn.call(entry, "finallyLoc");
289
683
 
290
684
  if (hasCatch && hasFinally) {
291
- if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
292
- if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
685
+ if (this.prev < entry.catchLoc) {
686
+ return handle(entry.catchLoc, true);
687
+ } else if (this.prev < entry.finallyLoc) {
688
+ return handle(entry.finallyLoc);
689
+ }
690
+
293
691
  } else if (hasCatch) {
294
- if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
692
+ if (this.prev < entry.catchLoc) {
693
+ return handle(entry.catchLoc, true);
694
+ }
695
+
696
+ } else if (hasFinally) {
697
+ if (this.prev < entry.finallyLoc) {
698
+ return handle(entry.finallyLoc);
699
+ }
700
+
295
701
  } else {
296
- if (!hasFinally) throw new Error("try statement without catch or finally");
297
- if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
702
+ throw new Error("try statement without catch or finally");
298
703
  }
299
704
  }
300
705
  }
301
706
  },
302
- abrupt: function (type, arg) {
707
+
708
+ abrupt: function(type, arg) {
303
709
  for (var i = this.tryEntries.length - 1; i >= 0; --i) {
304
710
  var entry = this.tryEntries[i];
305
-
306
- if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
711
+ if (entry.tryLoc <= this.prev &&
712
+ hasOwn.call(entry, "finallyLoc") &&
713
+ this.prev < entry.finallyLoc) {
307
714
  var finallyEntry = entry;
308
715
  break;
309
716
  }
310
717
  }
311
718
 
312
- finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
719
+ if (finallyEntry &&
720
+ (type === "break" ||
721
+ type === "continue") &&
722
+ finallyEntry.tryLoc <= arg &&
723
+ arg <= finallyEntry.finallyLoc) {
724
+ // Ignore the finally entry if control is not jumping to a
725
+ // location outside the try/catch block.
726
+ finallyEntry = null;
727
+ }
728
+
313
729
  var record = finallyEntry ? finallyEntry.completion : {};
314
- return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
730
+ record.type = type;
731
+ record.arg = arg;
732
+
733
+ if (finallyEntry) {
734
+ this.method = "next";
735
+ this.next = finallyEntry.finallyLoc;
736
+ return ContinueSentinel;
737
+ }
738
+
739
+ return this.complete(record);
315
740
  },
316
- complete: function (record, afterLoc) {
317
- if ("throw" === record.type) throw record.arg;
318
- return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel;
741
+
742
+ complete: function(record, afterLoc) {
743
+ if (record.type === "throw") {
744
+ throw record.arg;
745
+ }
746
+
747
+ if (record.type === "break" ||
748
+ record.type === "continue") {
749
+ this.next = record.arg;
750
+ } else if (record.type === "return") {
751
+ this.rval = this.arg = record.arg;
752
+ this.method = "return";
753
+ this.next = "end";
754
+ } else if (record.type === "normal" && afterLoc) {
755
+ this.next = afterLoc;
756
+ }
757
+
758
+ return ContinueSentinel;
319
759
  },
320
- finish: function (finallyLoc) {
760
+
761
+ finish: function(finallyLoc) {
321
762
  for (var i = this.tryEntries.length - 1; i >= 0; --i) {
322
763
  var entry = this.tryEntries[i];
323
- if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;
764
+ if (entry.finallyLoc === finallyLoc) {
765
+ this.complete(entry.completion, entry.afterLoc);
766
+ resetTryEntry(entry);
767
+ return ContinueSentinel;
768
+ }
324
769
  }
325
770
  },
326
- catch: function (tryLoc) {
771
+
772
+ "catch": function(tryLoc) {
327
773
  for (var i = this.tryEntries.length - 1; i >= 0; --i) {
328
774
  var entry = this.tryEntries[i];
329
-
330
775
  if (entry.tryLoc === tryLoc) {
331
776
  var record = entry.completion;
332
-
333
- if ("throw" === record.type) {
777
+ if (record.type === "throw") {
334
778
  var thrown = record.arg;
335
779
  resetTryEntry(entry);
336
780
  }
337
-
338
781
  return thrown;
339
782
  }
340
783
  }
341
784
 
785
+ // The context.catch method must only be called with a location
786
+ // argument that corresponds to a known catch block.
342
787
  throw new Error("illegal catch attempt");
343
788
  },
344
- delegateYield: function (iterable, resultName, nextLoc) {
345
- return this.delegate = {
789
+
790
+ delegateYield: function(iterable, resultName, nextLoc) {
791
+ this.delegate = {
346
792
  iterator: values(iterable),
347
793
  resultName: resultName,
348
794
  nextLoc: nextLoc
349
- }, "next" === this.method && (this.arg = undefined), ContinueSentinel;
350
- }
351
- }, exports;
352
- }
353
-
354
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
355
- try {
356
- var info = gen[key](arg);
357
- var value = info.value;
358
- } catch (error) {
359
- reject(error);
360
- return;
361
- }
362
-
363
- if (info.done) {
364
- resolve(value);
365
- } else {
366
- Promise.resolve(value).then(_next, _throw);
367
- }
368
- }
369
-
370
- function _asyncToGenerator(fn) {
371
- return function () {
372
- var self = this,
373
- args = arguments;
374
- return new Promise(function (resolve, reject) {
375
- var gen = fn.apply(self, args);
376
-
377
- function _next(value) {
378
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
379
- }
795
+ };
380
796
 
381
- function _throw(err) {
382
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
797
+ if (this.method === "next") {
798
+ // Deliberately forget the last sent value so that we don't
799
+ // accidentally pass it on to the delegate.
800
+ this.arg = undefined$1;
383
801
  }
384
802
 
385
- _next(undefined);
386
- });
387
- };
388
- }
389
-
390
- function _extends() {
391
- _extends = Object.assign ? Object.assign.bind() : function (target) {
392
- for (var i = 1; i < arguments.length; i++) {
393
- var source = arguments[i];
394
-
395
- for (var key in source) {
396
- if (Object.prototype.hasOwnProperty.call(source, key)) {
397
- target[key] = source[key];
398
- }
399
- }
803
+ return ContinueSentinel;
400
804
  }
401
-
402
- return target;
403
805
  };
404
- return _extends.apply(this, arguments);
405
- }
406
806
 
407
- function _objectDestructuringEmpty(obj) {
408
- if (obj == null) throw new TypeError("Cannot destructure undefined");
409
- }
410
-
411
- function _objectWithoutPropertiesLoose(source, excluded) {
412
- if (source == null) return {};
413
- var target = {};
414
- var sourceKeys = Object.keys(source);
415
- var key, i;
416
-
417
- for (i = 0; i < sourceKeys.length; i++) {
418
- key = sourceKeys[i];
419
- if (excluded.indexOf(key) >= 0) continue;
420
- target[key] = source[key];
421
- }
422
-
423
- return target;
807
+ // Regardless of whether this script is executing as a CommonJS module
808
+ // or not, return the runtime object so that we can declare the variable
809
+ // regeneratorRuntime in the outer scope, which allows this module to be
810
+ // injected easily by `bin/regenerator --include-runtime script.js`.
811
+ return exports;
812
+
813
+ }(
814
+ // If this script is executing as a CommonJS module, use module.exports
815
+ // as the regeneratorRuntime namespace. Otherwise create a new empty
816
+ // object. Either way, the resulting object will be used to initialize
817
+ // the regeneratorRuntime variable at the top of this file.
818
+ module.exports
819
+ ));
820
+
821
+ try {
822
+ regeneratorRuntime = runtime;
823
+ } catch (accidentalStrictMode) {
824
+ // This module should not be running in strict mode, so the above
825
+ // assignment should always work unless something is misconfigured. Just
826
+ // in case runtime.js accidentally runs in strict mode, we can escape
827
+ // strict mode using a global Function call. This could conceivably fail
828
+ // if a Content Security Policy forbids using Function, but in that case
829
+ // the proper solution is to fix the accidental strict mode problem. If
830
+ // you've misconfigured your bundler to force strict mode and applied a
831
+ // CSP to forbid Function, and you're not willing to fix either of those
832
+ // problems, please detail your unique predicament in a GitHub issue.
833
+ Function("r", "regeneratorRuntime = r")(runtime);
424
834
  }
835
+ });
425
836
 
426
837
  var _require = /*#__PURE__*/require('@freelog/resource-policy-lang'),
427
838
  compile = _require.compile;
@@ -480,9 +891,9 @@ function policyCodeTranslationToText(_x, _x2) {
480
891
  }
481
892
 
482
893
  function _policyCodeTranslationToText() {
483
- _policyCodeTranslationToText = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(code, targetType) {
894
+ _policyCodeTranslationToText = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(code, targetType) {
484
895
  var result, contract, rrr;
485
- return _regeneratorRuntime().wrap(function _callee$(_context) {
896
+ return runtime_1.wrap(function _callee$(_context) {
486
897
  while (1) {
487
898
  switch (_context.prev = _context.next) {
488
899
  case 0:
@@ -736,10 +1147,19 @@ function nodeCreateSuccess(_ref24) {
736
1147
  var nodeID = _ref24.nodeID;
737
1148
  return "/result/node/create/success/" + nodeID;
738
1149
  }
739
- function exception403(_temp11) {
1150
+ function invitation(_temp11) {
740
1151
  var _ref25 = _temp11 === void 0 ? {} : _temp11,
741
1152
  params = _extends({}, _ref25);
742
1153
 
1154
+ // console.log(params.goTo, 'goTo9iowjefklsdj;flksdjflk')
1155
+ return "/invitation" + handleQuery({
1156
+ returnUrl: params.goTo ? encodeURIComponent(params.goTo) : undefined
1157
+ });
1158
+ }
1159
+ function exception403(_temp12) {
1160
+ var _ref26 = _temp12 === void 0 ? {} : _temp12,
1161
+ params = _extends({}, _ref26);
1162
+
743
1163
  var fromUrl = params.from || '';
744
1164
 
745
1165
  if (!fromUrl) {
@@ -753,56 +1173,56 @@ function exception403(_temp11) {
753
1173
  from: fromUrl
754
1174
  });
755
1175
  }
756
- function login(_temp12) {
757
- var _ref26 = _temp12 === void 0 ? {} : _temp12,
758
- goTo = _ref26.goTo;
1176
+ function login(_temp13) {
1177
+ var _ref27 = _temp13 === void 0 ? {} : _temp13,
1178
+ goTo = _ref27.goTo;
759
1179
 
760
1180
  return "/login" + handleQuery({
761
1181
  goTo: goTo ? encodeURIComponent(goTo) : undefined
762
1182
  });
763
1183
  }
764
- function logon(_temp13) {
765
- var _ref27 = _temp13 === void 0 ? {} : _temp13,
766
- goTo = _ref27.goTo;
1184
+ function logon(_temp14) {
1185
+ var _ref28 = _temp14 === void 0 ? {} : _temp14,
1186
+ goTo = _ref28.goTo;
767
1187
 
768
1188
  return "/logon" + handleQuery({
769
1189
  goTo: goTo ? encodeURIComponent(goTo) : undefined
770
1190
  });
771
1191
  }
772
- function retrieveUserPassword(_temp14) {
773
- var _ref28 = _temp14 === void 0 ? {} : _temp14,
774
- goTo = _ref28.goTo;
1192
+ function retrieveUserPassword(_temp15) {
1193
+ var _ref29 = _temp15 === void 0 ? {} : _temp15,
1194
+ goTo = _ref29.goTo;
775
1195
 
776
1196
  return "/retrieve" + handleQuery({
777
1197
  goTo: goTo ? encodeURIComponent(goTo) : undefined
778
1198
  });
779
1199
  }
780
- function retrievePayPassword(_temp15) {
781
- var _ref29 = _temp15 === void 0 ? {} : _temp15;
782
-
783
- _objectDestructuringEmpty(_ref29);
784
-
785
- return "/retrievePayPassword";
786
- }
787
- function wallet(_temp16) {
1200
+ function retrievePayPassword(_temp16) {
788
1201
  var _ref30 = _temp16 === void 0 ? {} : _temp16;
789
1202
 
790
1203
  _objectDestructuringEmpty(_ref30);
791
1204
 
792
- return "/logged/wallet";
1205
+ return "/retrievePayPassword";
793
1206
  }
794
- function contract(_temp17) {
1207
+ function wallet(_temp17) {
795
1208
  var _ref31 = _temp17 === void 0 ? {} : _temp17;
796
1209
 
797
1210
  _objectDestructuringEmpty(_ref31);
798
1211
 
799
- return "/logged/contract";
1212
+ return "/logged/wallet";
800
1213
  }
801
- function setting(_temp18) {
1214
+ function contract(_temp18) {
802
1215
  var _ref32 = _temp18 === void 0 ? {} : _temp18;
803
1216
 
804
1217
  _objectDestructuringEmpty(_ref32);
805
1218
 
1219
+ return "/logged/contract";
1220
+ }
1221
+ function setting(_temp19) {
1222
+ var _ref33 = _temp19 === void 0 ? {} : _temp19;
1223
+
1224
+ _objectDestructuringEmpty(_ref33);
1225
+
806
1226
  return "/logged/setting";
807
1227
  }
808
1228
  /************** user End ******************************************************/
@@ -850,6 +1270,7 @@ var LinkTo = {
850
1270
  resourceCreateSuccess: resourceCreateSuccess,
851
1271
  resourceVersionCreateSuccess: resourceVersionCreateSuccess,
852
1272
  nodeCreateSuccess: nodeCreateSuccess,
1273
+ invitation: invitation,
853
1274
  exception403: exception403,
854
1275
  login: login,
855
1276
  logon: logon,
@@ -1761,7 +2182,7 @@ function updatePassword(params) {
1761
2182
  data: params
1762
2183
  });
1763
2184
  }
1764
- function uploadHeadImg(params) {
2185
+ function uploadHeadImg(params, config) {
1765
2186
  var formData = new FormData();
1766
2187
 
1767
2188
  for (var _i = 0, _Object$entries = Object.entries(params); _i < _Object$entries.length; _i++) {
@@ -1774,11 +2195,11 @@ function uploadHeadImg(params) {
1774
2195
  }
1775
2196
  }
1776
2197
 
1777
- return FUtil.Request({
2198
+ return FUtil.Request(_extends({
1778
2199
  method: 'POST',
1779
2200
  url: "/v2/users/current/uploadHeadImg",
1780
- data: params
1781
- });
2201
+ data: formData
2202
+ }, config));
1782
2203
  }
1783
2204
  function updateDetailInfo(params) {
1784
2205
  return FUtil.Request({
@@ -2265,6 +2686,35 @@ var Statistic = {
2265
2686
  transactionsCommon: transactionsCommon
2266
2687
  };
2267
2688
 
2689
+ function configsList(params) {
2690
+ // console.log('####@30984i2o3jdsjflfkjsdl')
2691
+ return FUtil.Request({
2692
+ method: 'POST',
2693
+ url: "/v2/i18n/configs/list",
2694
+ data: params
2695
+ });
2696
+ } // oss保存的翻译
2697
+ // interface ConfigsListParamsType {
2698
+ // key: string;
2699
+ // content: string;
2700
+ // tagIds: string[];
2701
+ // status: 0 | 1 | 2 | 3; // 0:全部 1:待翻译 2:待发布 3:已发布
2702
+ // }
2703
+ //
2704
+ // export function configsList(params: ConfigsListParamsType) {
2705
+ // // console.log('####@30984i2o3jdsjflfkjsdl')
2706
+ // return FUtil.Request({
2707
+ // method: 'POST',
2708
+ // url: `/v2/i18n/configs/list`,
2709
+ // data: params,
2710
+ // });
2711
+ // }
2712
+
2713
+ var I18n = {
2714
+ __proto__: null,
2715
+ configsList: configsList
2716
+ };
2717
+
2268
2718
  var FServiceAPI = {
2269
2719
  Node: Node,
2270
2720
  Exhibit: Exhibit,
@@ -2279,7 +2729,8 @@ var FServiceAPI = {
2279
2729
  Event: Event,
2280
2730
  Activity: Activity,
2281
2731
  TestQualification: TestQualification,
2282
- Statistic: Statistic
2732
+ Statistic: Statistic,
2733
+ I18n: I18n
2283
2734
  };
2284
2735
 
2285
2736
  var codeMessage = {
@@ -2396,10 +2847,10 @@ function request(_x, _x2) {
2396
2847
  // }
2397
2848
 
2398
2849
  function _request() {
2399
- _request = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(config, _temp) {
2850
+ _request = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(config, _temp) {
2400
2851
  var _ref, _ref$noRedirect, noRedirect, _ref$noErrorAlert, noErrorAlert, result;
2401
2852
 
2402
- return _regeneratorRuntime().wrap(function _callee$(_context) {
2853
+ return runtime_1.wrap(function _callee$(_context) {
2403
2854
  while (1) {
2404
2855
  switch (_context.prev = _context.next) {
2405
2856
  case 0:
@@ -2532,5 +2983,242 @@ var FUtil = {
2532
2983
  Tool: Tool
2533
2984
  };
2534
2985
 
2535
- export { FServiceAPI, FUtil };
2986
+ var ossJsonUrl = 'https://freelog-i18n.oss-cn-shenzhen.aliyuncs.com/configs/i18n.json';
2987
+ var localStorage_i18nextLng_key = 'i18nextLng';
2988
+ var localStorage_i18nextResources_key = 'i18nextResources';
2989
+ var allLanguage = [{
2990
+ value: 'en_US',
2991
+ label: 'English'
2992
+ }, {
2993
+ value: 'zh_CN',
2994
+ label: '简体中文'
2995
+ }];
2996
+ var self;
2997
+
2998
+ var I18nNext = /*#__PURE__*/function () {
2999
+ function I18nNext() {
3000
+ this._loadingData = 'NotStart';
3001
+ this._taskQueue = [];
3002
+ this._currentLanguage = window.localStorage.getItem(localStorage_i18nextLng_key) || 'zh_CN';
3003
+ self = this;
3004
+ self.ready();
3005
+ }
3006
+
3007
+ var _proto = I18nNext.prototype;
3008
+
3009
+ _proto.ready = /*#__PURE__*/function () {
3010
+ var _ready = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2() {
3011
+ var exc, handleTasks, promise;
3012
+ return runtime_1.wrap(function _callee2$(_context2) {
3013
+ while (1) {
3014
+ switch (_context2.prev = _context2.next) {
3015
+ case 0:
3016
+ exc = function exc() {
3017
+ while (self._taskQueue.length > 0) {
3018
+ var task = self._taskQueue.shift();
3019
+
3020
+ task && task();
3021
+ }
3022
+ };
3023
+
3024
+ handleTasks = /*#__PURE__*/function () {
3025
+ var _ref = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
3026
+ return runtime_1.wrap(function _callee$(_context) {
3027
+ while (1) {
3028
+ switch (_context.prev = _context.next) {
3029
+ case 0:
3030
+ if (!(self._loadingData === 'End')) {
3031
+ _context.next = 3;
3032
+ break;
3033
+ }
3034
+
3035
+ exc();
3036
+ return _context.abrupt("return");
3037
+
3038
+ case 3:
3039
+ if (!(self._loadingData === 'Start')) {
3040
+ _context.next = 5;
3041
+ break;
3042
+ }
3043
+
3044
+ return _context.abrupt("return");
3045
+
3046
+ case 5:
3047
+ // NO_START
3048
+ self._loadingData = 'Start';
3049
+ _context.next = 8;
3050
+ return self._handleData();
3051
+
3052
+ case 8:
3053
+ // console.log('######');
3054
+ exc();
3055
+
3056
+ case 9:
3057
+ case "end":
3058
+ return _context.stop();
3059
+ }
3060
+ }
3061
+ }, _callee);
3062
+ }));
3063
+
3064
+ return function handleTasks() {
3065
+ return _ref.apply(this, arguments);
3066
+ };
3067
+ }();
3068
+
3069
+ promise = new Promise(function (resolve) {
3070
+ self._taskQueue.push(resolve);
3071
+ });
3072
+ handleTasks();
3073
+ return _context2.abrupt("return", promise);
3074
+
3075
+ case 5:
3076
+ case "end":
3077
+ return _context2.stop();
3078
+ }
3079
+ }
3080
+ }, _callee2);
3081
+ }));
3082
+
3083
+ function ready() {
3084
+ return _ready.apply(this, arguments);
3085
+ }
3086
+
3087
+ return ready;
3088
+ }();
3089
+
3090
+ _proto.t = function t(key, options) {
3091
+ return i18next.t(key, options);
3092
+ };
3093
+
3094
+ _proto.changeLanguage = function changeLanguage(lng) {
3095
+ // return i18next.changeLanguage(lng);
3096
+ window.localStorage.setItem(localStorage_i18nextLng_key, lng);
3097
+ };
3098
+
3099
+ _proto.getAllLanguage = function getAllLanguage() {
3100
+ return allLanguage;
3101
+ };
3102
+
3103
+ _proto.getCurrentLanguage = function getCurrentLanguage() {
3104
+ return self._currentLanguage;
3105
+ };
3106
+
3107
+ _proto._handleData = /*#__PURE__*/function () {
3108
+ var _handleData2 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3() {
3109
+ var lng, resource, i18nextResources;
3110
+ return runtime_1.wrap(function _callee3$(_context3) {
3111
+ while (1) {
3112
+ switch (_context3.prev = _context3.next) {
3113
+ case 0:
3114
+ lng = self._currentLanguage;
3115
+ resource = window.localStorage.getItem(localStorage_i18nextResources_key);
3116
+ i18nextResources = resource ? JSON.parse(resource) : null;
3117
+
3118
+ if (i18nextResources) {
3119
+ _context3.next = 9;
3120
+ break;
3121
+ }
3122
+
3123
+ _context3.next = 6;
3124
+ return self._fetchData();
3125
+
3126
+ case 6:
3127
+ i18nextResources = _context3.sent;
3128
+ _context3.next = 10;
3129
+ break;
3130
+
3131
+ case 9:
3132
+ self._fetchData();
3133
+
3134
+ case 10:
3135
+ _context3.next = 12;
3136
+ return i18next.init({
3137
+ // the translations
3138
+ // (tip move them in a JSON file and import them,
3139
+ // or even better, manage them via a UI: https://react.i18next.com/guides/multiple-translation-files#manage-your-translations-with-a-management-gui)
3140
+ resources: i18nextResources,
3141
+ lng: lng,
3142
+ fallbackLng: 'zh_CN',
3143
+ interpolation: {
3144
+ escapeValue: false
3145
+ }
3146
+ });
3147
+
3148
+ case 12:
3149
+ case "end":
3150
+ return _context3.stop();
3151
+ }
3152
+ }
3153
+ }, _callee3);
3154
+ }));
3155
+
3156
+ function _handleData() {
3157
+ return _handleData2.apply(this, arguments);
3158
+ }
3159
+
3160
+ return _handleData;
3161
+ }();
3162
+
3163
+ _proto._fetchData = /*#__PURE__*/function () {
3164
+ var _fetchData2 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee4() {
3165
+ var res, en_US, zh_CN, _i, _Object$entries, _Object$entries$_i, key, value, result;
3166
+
3167
+ return runtime_1.wrap(function _callee4$(_context4) {
3168
+ while (1) {
3169
+ switch (_context4.prev = _context4.next) {
3170
+ case 0:
3171
+ _context4.next = 2;
3172
+ return axios.get(ossJsonUrl, {
3173
+ withCredentials: false
3174
+ });
3175
+
3176
+ case 2:
3177
+ res = _context4.sent;
3178
+ // console.log(res, 'data09oiw3qjelsfkdfjlsdkfjl');
3179
+ en_US = {};
3180
+ zh_CN = {};
3181
+
3182
+ for (_i = 0, _Object$entries = Object.entries(res); _i < _Object$entries.length; _i++) {
3183
+ _Object$entries$_i = _Object$entries[_i], key = _Object$entries$_i[0], value = _Object$entries$_i[1];
3184
+ // console.log(key, value, 'key, value90iowsldfjlsdkj');
3185
+ en_US[key] = value['en_US'];
3186
+ zh_CN[key] = value['zh_CN'];
3187
+ }
3188
+
3189
+ result = {
3190
+ en_US: {
3191
+ translation: en_US
3192
+ },
3193
+ zh_CN: {
3194
+ translation: zh_CN
3195
+ }
3196
+ }; // console.log(result, 'result093sdolkfjlsdkjl');
3197
+
3198
+ window.localStorage.setItem(localStorage_i18nextResources_key, JSON.stringify(result));
3199
+ return _context4.abrupt("return", result);
3200
+
3201
+ case 9:
3202
+ case "end":
3203
+ return _context4.stop();
3204
+ }
3205
+ }
3206
+ }, _callee4);
3207
+ }));
3208
+
3209
+ function _fetchData() {
3210
+ return _fetchData2.apply(this, arguments);
3211
+ }
3212
+
3213
+ return _fetchData;
3214
+ }();
3215
+
3216
+ return I18nNext;
3217
+ }();
3218
+
3219
+ var FI18n = {
3220
+ i18nNext: /*#__PURE__*/new I18nNext()
3221
+ };
3222
+
3223
+ export { FI18n, FServiceAPI, FUtil };
2536
3224
  //# sourceMappingURL=tools-lib.esm.js.map