@freelog/tools-lib 0.1.104 → 0.1.107

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