@thescaffold/jsx-blobs 0.2.21 → 0.2.30

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.
package/jsx-blobs.esm.js CHANGED
@@ -76,306 +76,113 @@ function _extends() {
76
76
  return n;
77
77
  }, _extends.apply(null, arguments);
78
78
  }
79
- function _regeneratorRuntime() {
80
- _regeneratorRuntime = function () {
81
- return e;
82
- };
83
- var t,
84
- e = {},
85
- r = Object.prototype,
86
- n = r.hasOwnProperty,
87
- o = Object.defineProperty || function (t, e, r) {
88
- t[e] = r.value;
89
- },
90
- i = "function" == typeof Symbol ? Symbol : {},
91
- a = i.iterator || "@@iterator",
92
- c = i.asyncIterator || "@@asyncIterator",
93
- u = i.toStringTag || "@@toStringTag";
94
- function define(t, e, r) {
95
- return Object.defineProperty(t, e, {
96
- value: r,
97
- enumerable: !0,
98
- configurable: !0,
99
- writable: !0
100
- }), t[e];
101
- }
102
- try {
103
- define({}, "");
104
- } catch (t) {
105
- define = function (t, e, r) {
106
- return t[e] = r;
107
- };
108
- }
109
- function wrap(t, e, r, n) {
110
- var i = e && e.prototype instanceof Generator ? e : Generator,
111
- a = Object.create(i.prototype),
112
- c = new Context(n || []);
113
- return o(a, "_invoke", {
114
- value: makeInvokeMethod(t, r, c)
115
- }), a;
116
- }
117
- function tryCatch(t, e, r) {
118
- try {
119
- return {
120
- type: "normal",
121
- arg: t.call(e, r)
122
- };
123
- } catch (t) {
124
- return {
125
- type: "throw",
126
- arg: t
127
- };
128
- }
129
- }
130
- e.wrap = wrap;
131
- var h = "suspendedStart",
132
- l = "suspendedYield",
133
- f = "executing",
134
- s = "completed",
135
- y = {};
136
- function Generator() {}
137
- function GeneratorFunction() {}
138
- function GeneratorFunctionPrototype() {}
139
- var p = {};
140
- define(p, a, function () {
141
- return this;
142
- });
143
- var d = Object.getPrototypeOf,
144
- v = d && d(d(values([])));
145
- v && v !== r && n.call(v, a) && (p = v);
146
- var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p);
147
- function defineIteratorMethods(t) {
148
- ["next", "throw", "return"].forEach(function (e) {
149
- define(t, e, function (t) {
150
- return this._invoke(e, t);
151
- });
152
- });
153
- }
154
- function AsyncIterator(t, e) {
155
- function invoke(r, o, i, a) {
156
- var c = tryCatch(t[r], t, o);
157
- if ("throw" !== c.type) {
158
- var u = c.arg,
159
- h = u.value;
160
- return h && "object" == typeof h && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) {
161
- invoke("next", t, i, a);
162
- }, function (t) {
163
- invoke("throw", t, i, a);
164
- }) : e.resolve(h).then(function (t) {
165
- u.value = t, i(u);
166
- }, function (t) {
167
- return invoke("throw", t, i, a);
168
- });
169
- }
170
- a(c.arg);
171
- }
172
- var r;
173
- o(this, "_invoke", {
174
- value: function (t, n) {
175
- function callInvokeWithMethodAndArg() {
176
- return new e(function (e, r) {
177
- invoke(t, n, e, r);
178
- });
79
+ function _regenerator() {
80
+ /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
81
+ var e,
82
+ t,
83
+ r = "function" == typeof Symbol ? Symbol : {},
84
+ n = r.iterator || "@@iterator",
85
+ o = r.toStringTag || "@@toStringTag";
86
+ function i(r, n, o, i) {
87
+ var c = n && n.prototype instanceof Generator ? n : Generator,
88
+ u = Object.create(c.prototype);
89
+ return _regeneratorDefine(u, "_invoke", function (r, n, o) {
90
+ var i,
91
+ c,
92
+ u,
93
+ f = 0,
94
+ p = o || [],
95
+ y = !1,
96
+ G = {
97
+ p: 0,
98
+ n: 0,
99
+ v: e,
100
+ a: d,
101
+ f: d.bind(e, 4),
102
+ d: function (t, r) {
103
+ return i = t, c = 0, u = e, G.n = r, a;
104
+ }
105
+ };
106
+ function d(r, n) {
107
+ for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) {
108
+ var o,
109
+ i = p[t],
110
+ d = G.p,
111
+ l = i[2];
112
+ r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0));
179
113
  }
180
- return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
114
+ if (o || r > 1) return a;
115
+ throw y = !0, n;
181
116
  }
182
- });
183
- }
184
- function makeInvokeMethod(e, r, n) {
185
- var o = h;
186
- return function (i, a) {
187
- if (o === f) throw Error("Generator is already running");
188
- if (o === s) {
189
- if ("throw" === i) throw a;
117
+ return function (o, p, l) {
118
+ if (f > 1) throw TypeError("Generator is already running");
119
+ for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) {
120
+ i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u);
121
+ try {
122
+ if (f = 2, i) {
123
+ if (c || (o = "next"), t = i[o]) {
124
+ if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object");
125
+ if (!t.done) return t;
126
+ u = t.value, c < 2 && (c = 0);
127
+ } else 1 === c && (t = i.return) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1);
128
+ i = e;
129
+ } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break;
130
+ } catch (t) {
131
+ i = e, c = 1, u = t;
132
+ } finally {
133
+ f = 1;
134
+ }
135
+ }
190
136
  return {
191
137
  value: t,
192
- done: !0
138
+ done: y
193
139
  };
194
- }
195
- for (n.method = i, n.arg = a;;) {
196
- var c = n.delegate;
197
- if (c) {
198
- var u = maybeInvokeDelegate(c, n);
199
- if (u) {
200
- if (u === y) continue;
201
- return u;
202
- }
203
- }
204
- if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) {
205
- if (o === h) throw o = s, n.arg;
206
- n.dispatchException(n.arg);
207
- } else "return" === n.method && n.abrupt("return", n.arg);
208
- o = f;
209
- var p = tryCatch(e, r, n);
210
- if ("normal" === p.type) {
211
- if (o = n.done ? s : l, p.arg === y) continue;
212
- return {
213
- value: p.arg,
214
- done: n.done
215
- };
216
- }
217
- "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg);
218
- }
219
- };
220
- }
221
- function maybeInvokeDelegate(e, r) {
222
- var n = r.method,
223
- o = e.iterator[n];
224
- if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y;
225
- var i = tryCatch(o, e.iterator, r.arg);
226
- if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y;
227
- var a = i.arg;
228
- return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y);
229
- }
230
- function pushTryEntry(t) {
231
- var e = {
232
- tryLoc: t[0]
233
- };
234
- 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e);
235
- }
236
- function resetTryEntry(t) {
237
- var e = t.completion || {};
238
- e.type = "normal", delete e.arg, t.completion = e;
239
- }
240
- function Context(t) {
241
- this.tryEntries = [{
242
- tryLoc: "root"
243
- }], t.forEach(pushTryEntry, this), this.reset(!0);
140
+ };
141
+ }(r, o, i), !0), u;
244
142
  }
245
- function values(e) {
246
- if (e || "" === e) {
247
- var r = e[a];
248
- if (r) return r.call(e);
249
- if ("function" == typeof e.next) return e;
250
- if (!isNaN(e.length)) {
251
- var o = -1,
252
- i = function next() {
253
- for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next;
254
- return next.value = t, next.done = !0, next;
255
- };
256
- return i.next = i;
257
- }
258
- }
259
- throw new TypeError(typeof e + " is not iterable");
143
+ var a = {};
144
+ function Generator() {}
145
+ function GeneratorFunction() {}
146
+ function GeneratorFunctionPrototype() {}
147
+ t = Object.getPrototypeOf;
148
+ var c = [][n] ? t(t([][n]())) : (_regeneratorDefine(t = {}, n, function () {
149
+ return this;
150
+ }), t),
151
+ u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c);
152
+ function f(e) {
153
+ return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e;
260
154
  }
261
- return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", {
262
- value: GeneratorFunctionPrototype,
263
- configurable: !0
264
- }), o(GeneratorFunctionPrototype, "constructor", {
265
- value: GeneratorFunction,
266
- configurable: !0
267
- }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) {
268
- var e = "function" == typeof t && t.constructor;
269
- return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name));
270
- }, e.mark = function (t) {
271
- return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t;
272
- }, e.awrap = function (t) {
273
- return {
274
- __await: t
275
- };
276
- }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () {
155
+ return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine(u), _regeneratorDefine(u, o, "Generator"), _regeneratorDefine(u, n, function () {
277
156
  return this;
278
- }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) {
279
- void 0 === i && (i = Promise);
280
- var a = new AsyncIterator(wrap(t, r, n, o), i);
281
- return e.isGeneratorFunction(r) ? a : a.next().then(function (t) {
282
- return t.done ? t.value : a.next();
283
- });
284
- }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () {
285
- return this;
286
- }), define(g, "toString", function () {
157
+ }), _regeneratorDefine(u, "toString", function () {
287
158
  return "[object Generator]";
288
- }), e.keys = function (t) {
289
- var e = Object(t),
290
- r = [];
291
- for (var n in e) r.push(n);
292
- return r.reverse(), function next() {
293
- for (; r.length;) {
294
- var t = r.pop();
295
- if (t in e) return next.value = t, next.done = !1, next;
296
- }
297
- return next.done = !0, next;
159
+ }), (_regenerator = function () {
160
+ return {
161
+ w: i,
162
+ m: f
298
163
  };
299
- }, e.values = values, Context.prototype = {
300
- constructor: Context,
301
- reset: function (e) {
302
- if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t);
303
- },
304
- stop: function () {
305
- this.done = !0;
306
- var t = this.tryEntries[0].completion;
307
- if ("throw" === t.type) throw t.arg;
308
- return this.rval;
309
- },
310
- dispatchException: function (e) {
311
- if (this.done) throw e;
312
- var r = this;
313
- function handle(n, o) {
314
- return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o;
315
- }
316
- for (var o = this.tryEntries.length - 1; o >= 0; --o) {
317
- var i = this.tryEntries[o],
318
- a = i.completion;
319
- if ("root" === i.tryLoc) return handle("end");
320
- if (i.tryLoc <= this.prev) {
321
- var c = n.call(i, "catchLoc"),
322
- u = n.call(i, "finallyLoc");
323
- if (c && u) {
324
- if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
325
- if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
326
- } else if (c) {
327
- if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
328
- } else {
329
- if (!u) throw Error("try statement without catch or finally");
330
- if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
331
- }
332
- }
333
- }
334
- },
335
- abrupt: function (t, e) {
336
- for (var r = this.tryEntries.length - 1; r >= 0; --r) {
337
- var o = this.tryEntries[r];
338
- if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) {
339
- var i = o;
340
- break;
341
- }
342
- }
343
- i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null);
344
- var a = i ? i.completion : {};
345
- return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a);
346
- },
347
- complete: function (t, e) {
348
- if ("throw" === t.type) throw t.arg;
349
- return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y;
350
- },
351
- finish: function (t) {
352
- for (var e = this.tryEntries.length - 1; e >= 0; --e) {
353
- var r = this.tryEntries[e];
354
- if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y;
355
- }
356
- },
357
- catch: function (t) {
358
- for (var e = this.tryEntries.length - 1; e >= 0; --e) {
359
- var r = this.tryEntries[e];
360
- if (r.tryLoc === t) {
361
- var n = r.completion;
362
- if ("throw" === n.type) {
363
- var o = n.arg;
364
- resetTryEntry(r);
365
- }
366
- return o;
367
- }
368
- }
369
- throw Error("illegal catch attempt");
370
- },
371
- delegateYield: function (e, r, n) {
372
- return this.delegate = {
373
- iterator: values(e),
374
- resultName: r,
375
- nextLoc: n
376
- }, "next" === this.method && (this.arg = t), y;
164
+ })();
165
+ }
166
+ function _regeneratorDefine(e, r, n, t) {
167
+ var i = Object.defineProperty;
168
+ try {
169
+ i({}, "", {});
170
+ } catch (e) {
171
+ i = 0;
172
+ }
173
+ _regeneratorDefine = function (e, r, n, t) {
174
+ function o(r, n) {
175
+ _regeneratorDefine(e, r, function (e) {
176
+ return this._invoke(r, n, e);
177
+ });
377
178
  }
378
- }, e;
179
+ r ? i ? i(e, r, {
180
+ value: n,
181
+ enumerable: !t,
182
+ configurable: !t,
183
+ writable: !t
184
+ }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2));
185
+ }, _regeneratorDefine(e, r, n, t);
379
186
  }
380
187
 
381
188
  var config = {
@@ -386,6 +193,9 @@ var config = {
386
193
  var getConfig = function getConfig() {
387
194
  return config;
388
195
  };
196
+ var setConfig = function setConfig(newConfig) {
197
+ config = newConfig;
198
+ };
389
199
 
390
200
  var CategoryType;
391
201
  (function (CategoryType) {
@@ -534,30 +344,27 @@ var isFunction = function isFunction(value) {
534
344
  return typeof value === 'function';
535
345
  };
536
346
  var streamFileChunks = /*#__PURE__*/function () {
537
- var _ref = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(input, callback, chunkSize) {
538
- return _regeneratorRuntime().wrap(function _callee$(_context) {
539
- while (1) switch (_context.prev = _context.next) {
347
+ var _ref = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(input, callback, chunkSize) {
348
+ return _regenerator().w(function (_context) {
349
+ while (1) switch (_context.n) {
540
350
  case 0:
541
351
  if (chunkSize === void 0) {
542
352
  chunkSize = 512 * 1024;
543
353
  }
544
354
  if (!isNode()) {
545
- _context.next = 3;
355
+ _context.n = 1;
546
356
  break;
547
357
  }
548
- return _context.abrupt("return", streamFileChunksForNode(input, callback, chunkSize));
549
- case 3:
358
+ return _context.a(2, streamFileChunksForNode(input, callback, chunkSize));
359
+ case 1:
550
360
  if (!isBrowser()) {
551
- _context.next = 5;
361
+ _context.n = 2;
552
362
  break;
553
363
  }
554
- return _context.abrupt("return", streamFileChunksForBrowser(input, callback, chunkSize));
555
- case 5:
364
+ return _context.a(2, streamFileChunksForBrowser(input, callback, chunkSize));
365
+ case 2:
556
366
  console.error('Unknown environment for streamChunks');
557
- return _context.abrupt("return", 0);
558
- case 7:
559
- case "end":
560
- return _context.stop();
367
+ return _context.a(2, 0);
561
368
  }
562
369
  }, _callee);
563
370
  }));
@@ -566,153 +373,147 @@ var streamFileChunks = /*#__PURE__*/function () {
566
373
  };
567
374
  }();
568
375
  var streamFileChunksForNode = /*#__PURE__*/function () {
569
- var _ref2 = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(path, callback, chunkSize) {
570
- var fs, stream, index, _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, chunk, base64;
571
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
572
- while (1) switch (_context2.prev = _context2.next) {
376
+ var _ref2 = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(path, callback, chunkSize) {
377
+ var fs, stream, index, _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, chunk, base64, _t;
378
+ return _regenerator().w(function (_context2) {
379
+ while (1) switch (_context2.p = _context2.n) {
573
380
  case 0:
574
381
  if (chunkSize === void 0) {
575
382
  chunkSize = 512 * 1024;
576
383
  }
577
384
  if (!(typeof path !== 'string' || path.length < 1)) {
578
- _context2.next = 3;
385
+ _context2.n = 1;
579
386
  break;
580
387
  }
581
- return _context2.abrupt("return", 0);
582
- case 3:
583
- _context2.next = 5;
388
+ return _context2.a(2, 0);
389
+ case 1:
390
+ _context2.n = 2;
584
391
  return import('fs');
585
- case 5:
586
- fs = _context2.sent;
392
+ case 2:
393
+ fs = _context2.v;
587
394
  stream = fs.createReadStream(path, {
588
395
  highWaterMark: chunkSize
589
396
  });
590
397
  index = 0;
591
398
  _iteratorAbruptCompletion = false;
592
399
  _didIteratorError = false;
593
- _context2.prev = 10;
400
+ _context2.p = 3;
594
401
  _iterator = _asyncIterator(stream);
595
- case 12:
596
- _context2.next = 14;
402
+ case 4:
403
+ _context2.n = 5;
597
404
  return _iterator.next();
598
- case 14:
599
- if (!(_iteratorAbruptCompletion = !(_step = _context2.sent).done)) {
600
- _context2.next = 22;
405
+ case 5:
406
+ if (!(_iteratorAbruptCompletion = !(_step = _context2.v).done)) {
407
+ _context2.n = 7;
601
408
  break;
602
409
  }
603
410
  chunk = _step.value;
604
411
  base64 = chunk.toString('base64');
605
- _context2.next = 19;
412
+ _context2.n = 6;
606
413
  return callback(base64, index++);
607
- case 19:
414
+ case 6:
608
415
  _iteratorAbruptCompletion = false;
609
- _context2.next = 12;
416
+ _context2.n = 4;
610
417
  break;
611
- case 22:
612
- _context2.next = 28;
418
+ case 7:
419
+ _context2.n = 9;
613
420
  break;
614
- case 24:
615
- _context2.prev = 24;
616
- _context2.t0 = _context2["catch"](10);
421
+ case 8:
422
+ _context2.p = 8;
423
+ _t = _context2.v;
617
424
  _didIteratorError = true;
618
- _iteratorError = _context2.t0;
619
- case 28:
620
- _context2.prev = 28;
621
- _context2.prev = 29;
425
+ _iteratorError = _t;
426
+ case 9:
427
+ _context2.p = 9;
428
+ _context2.p = 10;
622
429
  if (!(_iteratorAbruptCompletion && _iterator["return"] != null)) {
623
- _context2.next = 33;
430
+ _context2.n = 11;
624
431
  break;
625
432
  }
626
- _context2.next = 33;
433
+ _context2.n = 11;
627
434
  return _iterator["return"]();
628
- case 33:
629
- _context2.prev = 33;
435
+ case 11:
436
+ _context2.p = 11;
630
437
  if (!_didIteratorError) {
631
- _context2.next = 36;
438
+ _context2.n = 12;
632
439
  break;
633
440
  }
634
441
  throw _iteratorError;
635
- case 36:
636
- return _context2.finish(33);
637
- case 37:
638
- return _context2.finish(28);
639
- case 38:
640
- return _context2.abrupt("return", index);
641
- case 39:
642
- case "end":
643
- return _context2.stop();
442
+ case 12:
443
+ return _context2.f(11);
444
+ case 13:
445
+ return _context2.f(9);
446
+ case 14:
447
+ return _context2.a(2, index);
644
448
  }
645
- }, _callee2, null, [[10, 24, 28, 38], [29,, 33, 37]]);
449
+ }, _callee2, null, [[10,, 11, 13], [3, 8, 9, 14]]);
646
450
  }));
647
451
  return function streamFileChunksForNode(_x4, _x5, _x6) {
648
452
  return _ref2.apply(this, arguments);
649
453
  };
650
454
  }();
651
455
  var streamFileChunksForBrowser = /*#__PURE__*/function () {
652
- var _ref3 = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(files, callback, chunkSize) {
456
+ var _ref3 = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(files, callback, chunkSize) {
653
457
  var file, reader, index, buffer, _yield$reader$read, done, value, combined, chunk, base64, _base;
654
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
655
- while (1) switch (_context3.prev = _context3.next) {
458
+ return _regenerator().w(function (_context3) {
459
+ while (1) switch (_context3.n) {
656
460
  case 0:
657
461
  if (chunkSize === void 0) {
658
462
  chunkSize = 512 * 1024;
659
463
  }
660
464
  if (!(!(files instanceof FileList) || files.length < 1)) {
661
- _context3.next = 3;
465
+ _context3.n = 1;
662
466
  break;
663
467
  }
664
- return _context3.abrupt("return", 0);
665
- case 3:
468
+ return _context3.a(2, 0);
469
+ case 1:
666
470
  file = files[0];
667
471
  reader = file.stream().getReader();
668
472
  index = 0;
669
473
  buffer = new Uint8Array();
670
- case 7:
671
- _context3.next = 10;
474
+ case 2:
475
+ _context3.n = 3;
672
476
  return reader.read();
673
- case 10:
674
- _yield$reader$read = _context3.sent;
477
+ case 3:
478
+ _yield$reader$read = _context3.v;
675
479
  done = _yield$reader$read.done;
676
480
  value = _yield$reader$read.value;
677
481
  if (!done) {
678
- _context3.next = 15;
482
+ _context3.n = 4;
679
483
  break;
680
484
  }
681
- return _context3.abrupt("break", 29);
682
- case 15:
485
+ return _context3.a(3, 8);
486
+ case 4:
683
487
  combined = new Uint8Array(buffer.length + value.length);
684
488
  combined.set(buffer);
685
489
  combined.set(value, buffer.length);
686
490
  buffer = combined;
687
- case 19:
491
+ case 5:
688
492
  if (!(buffer.length >= chunkSize)) {
689
- _context3.next = 27;
493
+ _context3.n = 7;
690
494
  break;
691
495
  }
692
496
  chunk = buffer.slice(0, chunkSize);
693
497
  buffer = buffer.slice(chunkSize);
694
498
  base64 = uint8ToBase64(chunk);
695
- _context3.next = 25;
499
+ _context3.n = 6;
696
500
  return callback(base64, index++);
697
- case 25:
698
- _context3.next = 19;
501
+ case 6:
502
+ _context3.n = 5;
699
503
  break;
700
- case 27:
701
- _context3.next = 7;
504
+ case 7:
505
+ _context3.n = 2;
702
506
  break;
703
- case 29:
507
+ case 8:
704
508
  if (!(buffer.length > 0)) {
705
- _context3.next = 33;
509
+ _context3.n = 9;
706
510
  break;
707
511
  }
708
512
  _base = uint8ToBase64(buffer);
709
- _context3.next = 33;
513
+ _context3.n = 9;
710
514
  return callback(_base, index++);
711
- case 33:
712
- return _context3.abrupt("return", index);
713
- case 34:
714
- case "end":
715
- return _context3.stop();
515
+ case 9:
516
+ return _context3.a(2, index);
716
517
  }
717
518
  }, _callee3);
718
519
  }));
@@ -721,105 +522,96 @@ var streamFileChunksForBrowser = /*#__PURE__*/function () {
721
522
  };
722
523
  }();
723
524
  var getFileMeta = /*#__PURE__*/function () {
724
- var _ref4 = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4(input) {
725
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
726
- while (1) switch (_context4.prev = _context4.next) {
525
+ var _ref4 = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(input) {
526
+ return _regenerator().w(function (_context4) {
527
+ while (1) switch (_context4.n) {
727
528
  case 0:
728
529
  if (!isNode()) {
729
- _context4.next = 2;
530
+ _context4.n = 1;
730
531
  break;
731
532
  }
732
- return _context4.abrupt("return", getFileMetaForNode(input));
733
- case 2:
533
+ return _context4.a(2, getFileMetaForNode(input));
534
+ case 1:
734
535
  if (!isBrowser()) {
735
- _context4.next = 4;
536
+ _context4.n = 2;
736
537
  break;
737
538
  }
738
- return _context4.abrupt("return", getFileMetaForBrowser(input));
739
- case 4:
539
+ return _context4.a(2, getFileMetaForBrowser(input));
540
+ case 2:
740
541
  console.error('Unknown environment for getFileMeta');
741
- return _context4.abrupt("return", []);
742
- case 6:
743
- case "end":
744
- return _context4.stop();
542
+ return _context4.a(2, []);
745
543
  }
746
544
  }, _callee4);
747
545
  }));
748
- return function getFileMeta(_x10) {
546
+ return function getFileMeta(_x0) {
749
547
  return _ref4.apply(this, arguments);
750
548
  };
751
549
  }();
752
550
  var getFileMetaForNode = /*#__PURE__*/function () {
753
- var _ref5 = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5(path) {
754
- var fs, p, stats, size, ext, name, mimeType;
755
- return _regeneratorRuntime().wrap(function _callee5$(_context5) {
756
- while (1) switch (_context5.prev = _context5.next) {
551
+ var _ref5 = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(path) {
552
+ var fs, p, stats, size, ext, name, mimeType, _t2;
553
+ return _regenerator().w(function (_context5) {
554
+ while (1) switch (_context5.p = _context5.n) {
757
555
  case 0:
758
556
  if (!(typeof path !== 'string' || path.length < 1)) {
759
- _context5.next = 2;
557
+ _context5.n = 1;
760
558
  break;
761
559
  }
762
- return _context5.abrupt("return", []);
763
- case 2:
764
- _context5.next = 4;
560
+ return _context5.a(2, []);
561
+ case 1:
562
+ _context5.n = 2;
765
563
  return import('fs');
766
- case 4:
767
- fs = _context5.sent;
768
- _context5.next = 7;
564
+ case 2:
565
+ fs = _context5.v;
566
+ _context5.n = 3;
769
567
  return import('path');
770
- case 7:
771
- p = _context5.sent;
772
- _context5.prev = 8;
773
- _context5.next = 11;
568
+ case 3:
569
+ p = _context5.v;
570
+ _context5.p = 4;
571
+ _context5.n = 5;
774
572
  return fs.promises.stat(path);
775
- case 11:
776
- stats = _context5.sent;
573
+ case 5:
574
+ stats = _context5.v;
777
575
  size = stats.size;
778
576
  ext = p.extname(path).replace('.', '').toLowerCase();
779
577
  name = p.basename(path);
780
578
  mimeType = mimeMap[ext] || 'application/octet-stream';
781
- return _context5.abrupt("return", [ext, mimeType, size, name]);
782
- case 19:
783
- _context5.prev = 19;
784
- _context5.t0 = _context5["catch"](8);
785
- console.error("Error getting file meta for " + path + ":", _context5.t0);
786
- return _context5.abrupt("return", []);
787
- case 23:
788
- case "end":
789
- return _context5.stop();
579
+ return _context5.a(2, [ext, mimeType, size, name]);
580
+ case 6:
581
+ _context5.p = 6;
582
+ _t2 = _context5.v;
583
+ console.error("Error getting file meta for " + path + ":", _t2);
584
+ return _context5.a(2, []);
790
585
  }
791
- }, _callee5, null, [[8, 19]]);
586
+ }, _callee5, null, [[4, 6]]);
792
587
  }));
793
- return function getFileMetaForNode(_x11) {
588
+ return function getFileMetaForNode(_x1) {
794
589
  return _ref5.apply(this, arguments);
795
590
  };
796
591
  }();
797
592
  var getFileMetaForBrowser = /*#__PURE__*/function () {
798
- var _ref6 = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee6(files) {
593
+ var _ref6 = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6(files) {
799
594
  var _file$name$split$pop;
800
595
  var file, ext, mimeType, size, name;
801
- return _regeneratorRuntime().wrap(function _callee6$(_context6) {
802
- while (1) switch (_context6.prev = _context6.next) {
596
+ return _regenerator().w(function (_context6) {
597
+ while (1) switch (_context6.n) {
803
598
  case 0:
804
599
  if (!(!(files instanceof FileList) || files.length < 1)) {
805
- _context6.next = 2;
600
+ _context6.n = 1;
806
601
  break;
807
602
  }
808
- return _context6.abrupt("return", []);
809
- case 2:
603
+ return _context6.a(2, []);
604
+ case 1:
810
605
  file = files[0];
811
606
  ext = ((_file$name$split$pop = file.name.split('.').pop()) == null ? void 0 : _file$name$split$pop.toLowerCase()) || '';
812
607
  mimeType = file.type || "application/" + (ext || 'octet-stream');
813
608
  size = file.size;
814
609
  name = file.name;
815
- return _context6.abrupt("return", [ext, mimeType, size, name]);
816
- case 8:
817
- case "end":
818
- return _context6.stop();
610
+ return _context6.a(2, [ext, mimeType, size, name]);
819
611
  }
820
612
  }, _callee6);
821
613
  }));
822
- return function getFileMetaForBrowser(_x12) {
614
+ return function getFileMetaForBrowser(_x10) {
823
615
  return _ref6.apply(this, arguments);
824
616
  };
825
617
  }();
@@ -837,13 +629,13 @@ var uint8ToBase64 = function uint8ToBase64(bytes) {
837
629
  var axios = /*#__PURE__*/require('axios');
838
630
  var raw = axios;
839
631
  var request = /*#__PURE__*/function () {
840
- var _ref = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(method, url, body, queries, headers) {
841
- var config, _request, response, _response;
842
- return _regeneratorRuntime().wrap(function _callee$(_context) {
843
- while (1) switch (_context.prev = _context.next) {
632
+ var _ref = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(method, url, body, queries, headers) {
633
+ var config, _request, response, _response, _t;
634
+ return _regenerator().w(function (_context) {
635
+ while (1) switch (_context.p = _context.n) {
844
636
  case 0:
845
637
  config = getConfig();
846
- _context.prev = 1;
638
+ _context.p = 1;
847
639
  _request = {
848
640
  method: method,
849
641
  url: url,
@@ -855,75 +647,71 @@ var request = /*#__PURE__*/function () {
855
647
  params: queries
856
648
  };
857
649
  managedLog('BATCH REQUEST', _request, config, LogType.INFO);
858
- _context.next = 6;
650
+ _context.n = 2;
859
651
  return raw.request(_request, {
860
652
  validateStatus: function validateStatus(status) {
861
653
  return status < 500;
862
654
  }
863
655
  });
864
- case 6:
865
- response = _context.sent;
656
+ case 2:
657
+ response = _context.v;
866
658
  managedLog('BATCH RESPONSE', response.data, config, LogType.INFO);
867
- return _context.abrupt("return", [true, response.status, response.statusText, null, response.data]);
868
- case 11:
869
- _context.prev = 11;
870
- _context.t0 = _context["catch"](1);
871
- managedLog('BATCH ERROR', _context.t0, config, LogType.ERROR);
872
- if (!_context.t0.response) {
873
- _context.next = 19;
659
+ return _context.a(2, [true, response.status, response.statusText, null, response.data]);
660
+ case 3:
661
+ _context.p = 3;
662
+ _t = _context.v;
663
+ managedLog('BATCH ERROR', _t, config, LogType.ERROR);
664
+ if (!_t.response) {
665
+ _context.n = 4;
874
666
  break;
875
667
  }
876
668
  // The request was made and the server responded with a status code
877
669
  // that falls out of the range of 2xx
878
- _response = _context.t0.response;
879
- return _context.abrupt("return", [false, _response.status, _response.statusText, null, _response.data]);
880
- case 19:
881
- if (!_context.t0.request) {
882
- _context.next = 23;
670
+ _response = _t.response;
671
+ return _context.a(2, [false, _response.status, _response.statusText, null, _response.data]);
672
+ case 4:
673
+ if (!_t.request) {
674
+ _context.n = 5;
883
675
  break;
884
676
  }
885
- return _context.abrupt("return", [false, 503, 'Service is Down', 'Unable to get any response from the ', _context.t0]);
886
- case 23:
887
- return _context.abrupt("return", [false, 403, 'Service is Down', 'Could not make the request, check and try again.', _context.t0]);
888
- case 24:
889
- case "end":
890
- return _context.stop();
677
+ return _context.a(2, [false, 503, 'Service is Down', 'Unable to get any response from the ', _t]);
678
+ case 5:
679
+ return _context.a(2, [false, 403, 'Service is Down', 'Could not make the request, check and try again.', _t]);
680
+ case 6:
681
+ return _context.a(2);
891
682
  }
892
- }, _callee, null, [[1, 11]]);
683
+ }, _callee, null, [[1, 3]]);
893
684
  }));
894
685
  return function request(_x, _x2, _x3, _x4, _x5) {
895
686
  return _ref.apply(this, arguments);
896
687
  };
897
688
  }();
898
689
  var requestWithError = /*#__PURE__*/function () {
899
- var _ref2 = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(method, url, body, queries, headers) {
690
+ var _ref2 = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(method, url, body, queries, headers) {
900
691
  var _yield$request, status, httpStatus, title, message, response, _response$message;
901
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
902
- while (1) switch (_context2.prev = _context2.next) {
692
+ return _regenerator().w(function (_context2) {
693
+ while (1) switch (_context2.n) {
903
694
  case 0:
904
- _context2.next = 2;
695
+ _context2.n = 1;
905
696
  return request(method, url, body, queries, headers);
906
- case 2:
907
- _yield$request = _context2.sent;
697
+ case 1:
698
+ _yield$request = _context2.v;
908
699
  status = _yield$request[0];
909
700
  httpStatus = _yield$request[1];
910
701
  title = _yield$request[2];
911
702
  message = _yield$request[3];
912
703
  response = _yield$request[4];
913
704
  if (!(status !== true)) {
914
- _context2.next = 10;
705
+ _context2.n = 2;
915
706
  break;
916
707
  }
917
708
  throw new Error(httpStatus + ": " + title + " " + ((_response$message = response == null ? void 0 : response.message) != null ? _response$message : message));
918
- case 10:
919
- return _context2.abrupt("return", response);
920
- case 11:
921
- case "end":
922
- return _context2.stop();
709
+ case 2:
710
+ return _context2.a(2, response);
923
711
  }
924
712
  }, _callee2);
925
713
  }));
926
- return function requestWithError(_x6, _x7, _x8, _x9, _x10) {
714
+ return function requestWithError(_x6, _x7, _x8, _x9, _x0) {
927
715
  return _ref2.apply(this, arguments);
928
716
  };
929
717
  }();
@@ -944,32 +732,29 @@ var remove = function remove(url, body, queries, headers) {
944
732
  };
945
733
 
946
734
  var init$1 = /*#__PURE__*/function () {
947
- var _ref = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(file) {
735
+ var _ref = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(file) {
948
736
  var config, _yield$post, status, httpStatus, title, message, response;
949
- return _regeneratorRuntime().wrap(function _callee$(_context) {
950
- while (1) switch (_context.prev = _context.next) {
737
+ return _regenerator().w(function (_context) {
738
+ while (1) switch (_context.n) {
951
739
  case 0:
952
740
  config = getConfig();
953
- _context.next = 3;
741
+ _context.n = 1;
954
742
  return post(config.server + "/apps/blobs/upload/init", _extends({}, file));
955
- case 3:
956
- _yield$post = _context.sent;
743
+ case 1:
744
+ _yield$post = _context.v;
957
745
  status = _yield$post[0];
958
746
  httpStatus = _yield$post[1];
959
747
  title = _yield$post[2];
960
748
  message = _yield$post[3];
961
749
  response = _yield$post[4];
962
750
  if (!(status !== true)) {
963
- _context.next = 12;
751
+ _context.n = 2;
964
752
  break;
965
753
  }
966
754
  console.error('INIT ERROR', title, message, httpStatus);
967
- return _context.abrupt("return", null);
968
- case 12:
969
- return _context.abrupt("return", response);
970
- case 13:
971
- case "end":
972
- return _context.stop();
755
+ return _context.a(2, null);
756
+ case 2:
757
+ return _context.a(2, response);
973
758
  }
974
759
  }, _callee);
975
760
  }));
@@ -978,34 +763,31 @@ var init$1 = /*#__PURE__*/function () {
978
763
  };
979
764
  }();
980
765
  var batch = /*#__PURE__*/function () {
981
- var _ref2 = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(pages) {
766
+ var _ref2 = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(pages) {
982
767
  var config, _yield$post2, status, httpStatus, title, message, response;
983
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
984
- while (1) switch (_context2.prev = _context2.next) {
768
+ return _regenerator().w(function (_context2) {
769
+ while (1) switch (_context2.n) {
985
770
  case 0:
986
771
  config = getConfig();
987
- _context2.next = 3;
772
+ _context2.n = 1;
988
773
  return post(config.server + "/apps/blobs/upload/batch", {
989
774
  pages: pages
990
775
  });
991
- case 3:
992
- _yield$post2 = _context2.sent;
776
+ case 1:
777
+ _yield$post2 = _context2.v;
993
778
  status = _yield$post2[0];
994
779
  httpStatus = _yield$post2[1];
995
780
  title = _yield$post2[2];
996
781
  message = _yield$post2[3];
997
782
  response = _yield$post2[4];
998
783
  if (!(status !== true)) {
999
- _context2.next = 12;
784
+ _context2.n = 2;
1000
785
  break;
1001
786
  }
1002
787
  console.error('BATCH ERROR', title, message, httpStatus);
1003
- return _context2.abrupt("return", null);
1004
- case 12:
1005
- return _context2.abrupt("return", response);
1006
- case 13:
1007
- case "end":
1008
- return _context2.stop();
788
+ return _context2.a(2, null);
789
+ case 2:
790
+ return _context2.a(2, response);
1009
791
  }
1010
792
  }, _callee2);
1011
793
  }));
@@ -1014,32 +796,29 @@ var batch = /*#__PURE__*/function () {
1014
796
  };
1015
797
  }();
1016
798
  var verify = /*#__PURE__*/function () {
1017
- var _ref3 = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(file) {
799
+ var _ref3 = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(file) {
1018
800
  var config, _yield$post3, status, httpStatus, title, message, response;
1019
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
1020
- while (1) switch (_context3.prev = _context3.next) {
801
+ return _regenerator().w(function (_context3) {
802
+ while (1) switch (_context3.n) {
1021
803
  case 0:
1022
804
  config = getConfig();
1023
- _context3.next = 3;
805
+ _context3.n = 1;
1024
806
  return post(config.server + "/apps/blobs/upload/verify", _extends({}, file));
1025
- case 3:
1026
- _yield$post3 = _context3.sent;
807
+ case 1:
808
+ _yield$post3 = _context3.v;
1027
809
  status = _yield$post3[0];
1028
810
  httpStatus = _yield$post3[1];
1029
811
  title = _yield$post3[2];
1030
812
  message = _yield$post3[3];
1031
813
  response = _yield$post3[4];
1032
814
  if (!(status !== true)) {
1033
- _context3.next = 12;
815
+ _context3.n = 2;
1034
816
  break;
1035
817
  }
1036
818
  console.error('VERIFY ERROR', title, message, httpStatus);
1037
- return _context3.abrupt("return", null);
1038
- case 12:
1039
- return _context3.abrupt("return", response);
1040
- case 13:
1041
- case "end":
1042
- return _context3.stop();
819
+ return _context3.a(2, null);
820
+ case 2:
821
+ return _context3.a(2, response);
1043
822
  }
1044
823
  }, _callee3);
1045
824
  }));
@@ -1048,29 +827,29 @@ var verify = /*#__PURE__*/function () {
1048
827
  };
1049
828
  }();
1050
829
  var upload = /*#__PURE__*/function () {
1051
- var _ref4 = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5(input, parentId, tags) {
830
+ var _ref4 = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(input, parentId, tags) {
1052
831
  var meta, ext, mimeType, size, name, file, totalChunks, nFile;
1053
- return _regeneratorRuntime().wrap(function _callee5$(_context5) {
1054
- while (1) switch (_context5.prev = _context5.next) {
832
+ return _regenerator().w(function (_context5) {
833
+ while (1) switch (_context5.n) {
1055
834
  case 0:
1056
- _context5.next = 2;
835
+ _context5.n = 1;
1057
836
  return getFileMeta(input);
1058
- case 2:
1059
- meta = _context5.sent;
837
+ case 1:
838
+ meta = _context5.v;
1060
839
  if (meta) {
1061
- _context5.next = 5;
840
+ _context5.n = 2;
1062
841
  break;
1063
842
  }
1064
- return _context5.abrupt("return", [false, 'Failed to read file metadata']);
1065
- case 5:
843
+ return _context5.a(2, [false, 'Failed to read file metadata']);
844
+ case 2:
1066
845
  ext = meta[0], mimeType = meta[1], size = meta[2], name = meta[3];
1067
846
  if (!(!ext || !mimeType || !size || !name)) {
1068
- _context5.next = 8;
847
+ _context5.n = 3;
1069
848
  break;
1070
849
  }
1071
- return _context5.abrupt("return", [false, 'Invalid file metadata']);
1072
- case 8:
1073
- _context5.next = 10;
850
+ return _context5.a(2, [false, 'Invalid file metadata']);
851
+ case 3:
852
+ _context5.n = 4;
1074
853
  return init$1({
1075
854
  type: ext,
1076
855
  parentId: parentId,
@@ -1079,29 +858,28 @@ var upload = /*#__PURE__*/function () {
1079
858
  size: size,
1080
859
  mime: mimeType
1081
860
  });
1082
- case 10:
1083
- file = _context5.sent;
861
+ case 4:
862
+ file = _context5.v;
1084
863
  if (!(!file || !file.id)) {
1085
- _context5.next = 13;
864
+ _context5.n = 5;
1086
865
  break;
1087
866
  }
1088
- return _context5.abrupt("return", [false, 'Failed to init file upload']);
1089
- case 13:
1090
- _context5.next = 15;
867
+ return _context5.a(2, [false, 'Failed to init file upload']);
868
+ case 5:
869
+ _context5.n = 6;
1091
870
  return streamFileChunks(input, /*#__PURE__*/function () {
1092
- var _ref5 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4(chunk, index) {
1093
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
1094
- while (1) switch (_context4.prev = _context4.next) {
871
+ var _ref5 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(chunk, index) {
872
+ return _regenerator().w(function (_context4) {
873
+ while (1) switch (_context4.n) {
1095
874
  case 0:
1096
- _context4.next = 2;
875
+ _context4.n = 1;
1097
876
  return batch([{
1098
877
  fileId: file.id,
1099
878
  index: index,
1100
879
  raw: chunk
1101
880
  }]);
1102
- case 2:
1103
- case "end":
1104
- return _context4.stop();
881
+ case 1:
882
+ return _context4.a(2);
1105
883
  }
1106
884
  }, _callee4);
1107
885
  }));
@@ -1109,15 +887,15 @@ var upload = /*#__PURE__*/function () {
1109
887
  return _ref5.apply(this, arguments);
1110
888
  };
1111
889
  }());
1112
- case 15:
1113
- totalChunks = _context5.sent;
890
+ case 6:
891
+ totalChunks = _context5.v;
1114
892
  if (totalChunks) {
1115
- _context5.next = 18;
893
+ _context5.n = 7;
1116
894
  break;
1117
895
  }
1118
- return _context5.abrupt("return", [false, 'Failed to upload file chunks']);
1119
- case 18:
1120
- _context5.next = 20;
896
+ return _context5.a(2, [false, 'Failed to upload file chunks']);
897
+ case 7:
898
+ _context5.n = 8;
1121
899
  return verify({
1122
900
  type: ext,
1123
901
  parentId: parentId,
@@ -1126,24 +904,21 @@ var upload = /*#__PURE__*/function () {
1126
904
  size: size,
1127
905
  mime: mimeType
1128
906
  });
1129
- case 20:
1130
- nFile = _context5.sent;
907
+ case 8:
908
+ nFile = _context5.v;
1131
909
  if (!(!nFile || !nFile.url)) {
1132
- _context5.next = 23;
910
+ _context5.n = 9;
1133
911
  break;
1134
912
  }
1135
- return _context5.abrupt("return", [false, 'Failed to verify file upload']);
1136
- case 23:
913
+ return _context5.a(2, [false, 'Failed to verify file upload']);
914
+ case 9:
1137
915
  if (!((nFile == null ? void 0 : nFile.pagesCount) !== totalChunks)) {
1138
- _context5.next = 25;
916
+ _context5.n = 10;
1139
917
  break;
1140
918
  }
1141
- return _context5.abrupt("return", [false, 'Uploaded chunks count does not match']);
1142
- case 25:
1143
- return _context5.abrupt("return", [true, nFile.url]);
1144
- case 26:
1145
- case "end":
1146
- return _context5.stop();
919
+ return _context5.a(2, [false, 'Uploaded chunks count does not match']);
920
+ case 10:
921
+ return _context5.a(2, [true, nFile.url]);
1147
922
  }
1148
923
  }, _callee5);
1149
924
  }));
@@ -1172,6 +947,7 @@ var init = function init(c) {
1172
947
  throw new Error('Invalid configuration - sourceId not defined');
1173
948
  }
1174
949
  managedLog('INIT ACTIVE CONFIG', config, config, LogType.INFO);
950
+ setConfig(config);
1175
951
  // register SDK as source
1176
952
  // push({
1177
953
  // category: CategoryType.Event,