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