@realsee/five 6.4.0 → 6.4.2

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.
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * @license
3
3
  * @realsee/five
4
- * Generated: 2025/6/17
5
- * Version: 6.4.0
4
+ * Generated: 6/20/2025
5
+ * Version: 6.4.2
6
6
  * Terms:
7
7
  * Realsee SDK License Agreement
8
8
  * Update: July 28, 2021
@@ -252,22 +252,13 @@
252
252
  * No amendment to or modification of this Agreement will be binding unless in
253
253
  * writing and signed by Realsee. You and Realsee hereto confirm that this
254
254
  * Agreement and all related documents shall be drafted in English.
255
- */import { createWriteStream as K, existsSync as U } from "node:fs";
256
- import { mkdir as q, readFile as Q, writeFile as V } from "node:fs/promises";
257
- import { dirname as X, extname as Y, join as _, resolve as M } from "node:path";
258
- import { Readable as Z } from "node:stream";
259
- import x from "sharp";
260
- var I = function() {
261
- return I = Object.assign || function(e) {
262
- for (var r, i = 1, s = arguments.length; i < s; i++) {
263
- r = arguments[i];
264
- for (var n in r) Object.prototype.hasOwnProperty.call(r, n) && (e[n] = r[n]);
265
- }
266
- return e;
267
- }, I.apply(this, arguments);
268
- };
269
- function y(t, e, r, i) {
270
- function s(n) {
255
+ */import { createWriteStream as q, existsSync as D } from "node:fs";
256
+ import { writeFile as M, mkdir as A, readFile as H } from "node:fs/promises";
257
+ import { dirname as K, extname as Q, join as _, resolve as B } from "node:path";
258
+ import { Readable as V } from "node:stream";
259
+ import Y from "sharp";
260
+ function k(t, e, r, i) {
261
+ function a(n) {
271
262
  return n instanceof r ? n : new r(function(o) {
272
263
  o(n);
273
264
  });
@@ -275,183 +266,155 @@ function y(t, e, r, i) {
275
266
  return new (r || (r = Promise))(function(n, o) {
276
267
  function u(c) {
277
268
  try {
278
- a(i.next(c));
279
- } catch (f) {
280
- o(f);
269
+ s(i.next(c));
270
+ } catch (l) {
271
+ o(l);
281
272
  }
282
273
  }
283
- function l(c) {
274
+ function f(c) {
284
275
  try {
285
- a(i.throw(c));
286
- } catch (f) {
287
- o(f);
276
+ s(i.throw(c));
277
+ } catch (l) {
278
+ o(l);
288
279
  }
289
280
  }
290
- function a(c) {
291
- c.done ? n(c.value) : s(c.value).then(u, l);
281
+ function s(c) {
282
+ c.done ? n(c.value) : a(c.value).then(u, f);
292
283
  }
293
- a((i = i.apply(t, e || [])).next());
284
+ s((i = i.apply(t, e || [])).next());
294
285
  });
295
286
  }
296
- function p(t, e) {
287
+ function y(t, e) {
297
288
  var r = { label: 0, sent: function() {
298
289
  if (n[0] & 1) throw n[1];
299
290
  return n[1];
300
- }, trys: [], ops: [] }, i, s, n, o = Object.create((typeof Iterator == "function" ? Iterator : Object).prototype);
291
+ }, trys: [], ops: [] }, i, a, n, o = Object.create((typeof Iterator == "function" ? Iterator : Object).prototype);
301
292
  return o.next = u(0), o.throw = u(1), o.return = u(2), typeof Symbol == "function" && (o[Symbol.iterator] = function() {
302
293
  return this;
303
294
  }), o;
304
- function u(a) {
295
+ function u(s) {
305
296
  return function(c) {
306
- return l([a, c]);
297
+ return f([s, c]);
307
298
  };
308
299
  }
309
- function l(a) {
300
+ function f(s) {
310
301
  if (i) throw new TypeError("Generator is already executing.");
311
- for (; o && (o = 0, a[0] && (r = 0)), r; ) try {
312
- if (i = 1, s && (n = a[0] & 2 ? s.return : a[0] ? s.throw || ((n = s.return) && n.call(s), 0) : s.next) && !(n = n.call(s, a[1])).done) return n;
313
- switch (s = 0, n && (a = [a[0] & 2, n.value]), a[0]) {
302
+ for (; o && (o = 0, s[0] && (r = 0)), r; ) try {
303
+ if (i = 1, a && (n = s[0] & 2 ? a.return : s[0] ? a.throw || ((n = a.return) && n.call(a), 0) : a.next) && !(n = n.call(a, s[1])).done) return n;
304
+ switch (a = 0, n && (s = [s[0] & 2, n.value]), s[0]) {
314
305
  case 0:
315
306
  case 1:
316
- n = a;
307
+ n = s;
317
308
  break;
318
309
  case 4:
319
- return r.label++, { value: a[1], done: !1 };
310
+ return r.label++, { value: s[1], done: !1 };
320
311
  case 5:
321
- r.label++, s = a[1], a = [0];
312
+ r.label++, a = s[1], s = [0];
322
313
  continue;
323
314
  case 7:
324
- a = r.ops.pop(), r.trys.pop();
315
+ s = r.ops.pop(), r.trys.pop();
325
316
  continue;
326
317
  default:
327
- if (n = r.trys, !(n = n.length > 0 && n[n.length - 1]) && (a[0] === 6 || a[0] === 2)) {
318
+ if (n = r.trys, !(n = n.length > 0 && n[n.length - 1]) && (s[0] === 6 || s[0] === 2)) {
328
319
  r = 0;
329
320
  continue;
330
321
  }
331
- if (a[0] === 3 && (!n || a[1] > n[0] && a[1] < n[3])) {
332
- r.label = a[1];
322
+ if (s[0] === 3 && (!n || s[1] > n[0] && s[1] < n[3])) {
323
+ r.label = s[1];
333
324
  break;
334
325
  }
335
- if (a[0] === 6 && r.label < n[1]) {
336
- r.label = n[1], n = a;
326
+ if (s[0] === 6 && r.label < n[1]) {
327
+ r.label = n[1], n = s;
337
328
  break;
338
329
  }
339
330
  if (n && r.label < n[2]) {
340
- r.label = n[2], r.ops.push(a);
331
+ r.label = n[2], r.ops.push(s);
341
332
  break;
342
333
  }
343
334
  n[2] && r.ops.pop(), r.trys.pop();
344
335
  continue;
345
336
  }
346
- a = e.call(t, r);
337
+ s = e.call(t, r);
347
338
  } catch (c) {
348
- a = [6, c], s = 0;
339
+ s = [6, c], a = 0;
349
340
  } finally {
350
341
  i = n = 0;
351
342
  }
352
- if (a[0] & 5) throw a[1];
353
- return { value: a[0] ? a[1] : void 0, done: !0 };
343
+ if (s[0] & 5) throw s[1];
344
+ return { value: s[0] ? s[1] : void 0, done: !0 };
354
345
  }
355
346
  }
356
- function F(t, e) {
347
+ function j(t, e) {
357
348
  if (e && e[e.length - 1] !== "/" && (e += "/"), t.length > e.length && t.startsWith(e))
358
349
  return t.slice(e.length);
359
350
  throw new Error("".concat(t, " is not starting with ").concat(e));
360
351
  }
361
- function ee(t) {
362
- return new Promise(function(e) {
363
- return setTimeout(e, t);
364
- });
365
- }
366
- function A(t, e) {
367
- return y(this, void 0, void 0, function() {
368
- var r, i, s, n, o;
369
- return p(this, function(u) {
352
+ var Z = 1024 * 1024 * 5;
353
+ function S(t, e, r) {
354
+ return k(this, void 0, void 0, function() {
355
+ var i, a, n, o;
356
+ return y(this, function(u) {
370
357
  switch (u.label) {
371
358
  case 0:
372
- return u.trys.push([0, 2, , 7]), [4, fetch(t, e)];
359
+ return D(e) ? [2, e] : [4, r(t)];
373
360
  case 1:
374
- if (r = u.sent(), r.ok)
375
- return [2, r];
376
- throw new Error(r.statusText);
361
+ return i = u.sent(), i.ok && i.body ? [4, A(K(e), { recursive: !0 })] : [3, 6];
377
362
  case 2:
378
- if (i = u.sent(), s = (o = e == null ? void 0 : e.tries) !== null && o !== void 0 ? o : 2, !(s < 1)) return [3, 3];
379
- throw i;
363
+ return u.sent(), a = Number((o = i.headers.get("content-length")) !== null && o !== void 0 ? o : "Infinity"), a > Z ? [2, new Promise(function(f, s) {
364
+ var c = V.fromWeb(i.body), l = q(e);
365
+ c.pipe(l), c.on("error", s), l.on("finish", function() {
366
+ return f(e);
367
+ });
368
+ })] : [3, 3];
380
369
  case 3:
381
- return n = Math.floor(Math.random() * 1e3), [4, ee(n)];
370
+ return [4, i.arrayBuffer()];
382
371
  case 4:
383
- return u.sent(), [4, A(t, I(I({}, e), { tries: s - 1 }))];
372
+ return n = u.sent(), [4, M(e, Buffer.from(n))];
384
373
  case 5:
385
- return [2, u.sent()];
374
+ return u.sent(), [2, e];
386
375
  case 6:
387
- return [3, 7];
388
- case 7:
389
- return [
390
- 2
391
- /*return*/
392
- ];
376
+ throw new Error("url: ".concat(t, "(").concat(i.statusText, ")"));
393
377
  }
394
378
  });
395
379
  });
396
380
  }
397
- function j(t, e) {
398
- return y(this, void 0, void 0, function() {
399
- var r, i, s;
400
- return p(this, function(n) {
401
- switch (n.label) {
402
- case 0:
403
- return U(e) ? [2, e] : [4, A(t)];
404
- case 1:
405
- return r = n.sent(), r.ok && r.body ? (i = Z.fromWeb(r.body), [4, q(X(e), { recursive: !0 })]) : [3, 3];
406
- case 2:
407
- return n.sent(), s = K(e), [2, new Promise(function(o, u) {
408
- i.pipe(s), i.on("error", u), s.on("finish", function() {
409
- return o(e);
410
- });
411
- })];
412
- case 3:
413
- throw new Error(r.statusText);
414
- }
415
- });
416
- });
417
- }
418
- function J(t, e) {
419
- return y(this, void 0, void 0, function() {
420
- var r, i, s, n, o, u, l, a, c, f;
421
- return p(this, function(m) {
422
- return r = Y(t).slice(1) || "jpg", i = e.cut, s = e.size, n = e.format, o = n === void 0 ? r : n, u = x(t), i && (u = u.extract({
381
+ function W(t, e) {
382
+ return k(this, void 0, void 0, function() {
383
+ var r, i, a, n, o, u, f, s, c, l;
384
+ return y(this, function(d) {
385
+ return r = Q(t).slice(1) || "jpg", i = e.cut, a = e.size, n = e.format, o = n === void 0 ? r : n, u = Y(t), i && (u = u.extract({
423
386
  left: i[0],
424
387
  top: i[1],
425
388
  width: i[2],
426
389
  height: i[3]
427
- })), s && (u = u.resize(s)), o && (u = u.toFormat(o)), l = "", e.toFilename ? l = e.toFilename(t, { cut: e.cut, size: e.size, format: e.format }) : (a = "", c = "", f = o, i && (a = i.join("x")), s && (c = "".concat(s, "x")), f === r && !c && !a && (f = ""), l = [t, a, c, f].filter(function(v) {
428
- return v.length > 0;
429
- }).join(".")), l !== t && !U(l) ? [2, u.toFile(l).then(function() {
430
- return l;
431
- })] : [2, l];
390
+ })), a && (u = u.resize(a)), o && (u = u.toFormat(o)), f = "", e.toFilename ? f = e.toFilename(t, { cut: e.cut, size: e.size, format: e.format }) : (s = "", c = "", l = o, i && (s = i.join("x")), a && (c = "".concat(a, "x")), l === r && !c && !s && (l = ""), f = [t, s, c, l].filter(function(m) {
391
+ return m.length > 0;
392
+ }).join(".")), f !== t && !D(f) ? [2, u.toFile(f).then(function() {
393
+ return f;
394
+ })] : [2, f];
432
395
  });
433
396
  });
434
397
  }
435
- function B(t) {
398
+ function G(t) {
436
399
  var e = [];
437
400
  if (t.content && (t.content.uri ? e.push(t.content.uri) : t.content.url && e.push(t.content.url)), t.children)
438
401
  for (var r = 0, i = t.children; r < i.length; r++) {
439
- var s = i[r], n = B(s);
402
+ var a = i[r], n = G(a);
440
403
  n.length > 0 && e.push.apply(e, n);
441
404
  }
442
405
  return e;
443
406
  }
444
- function re(t, e, r) {
445
- return y(this, void 0, void 0, function() {
446
- var i, s, n;
447
- return p(this, function(o) {
407
+ function x(t, e, r) {
408
+ return k(this, void 0, void 0, function() {
409
+ var i, a, n;
410
+ return y(this, function(o) {
448
411
  switch (o.label) {
449
412
  case 0:
450
- return i = new URL(t, e).href, s = _(r.distPath, F(i, r.baseURL)), n = j(i, s), r.log(function(u) {
413
+ return i = new URL(t, e).href, a = _(r.distPath, j(i, r.baseURL)), n = S(i, a, r.fetch), r.log(function(u) {
451
414
  return "download: ".concat(i, " -> ").concat(u);
452
415
  }, n), [4, n];
453
416
  case 1:
454
- return o.sent(), /\.json$/.test(t) ? [4, H(i, r)] : [3, 3];
417
+ return o.sent(), /\.json$/.test(t) ? [4, X(i, r)] : [3, 3];
455
418
  case 2:
456
419
  o.sent(), o.label = 3;
457
420
  case 3:
@@ -463,53 +426,53 @@ function re(t, e, r) {
463
426
  });
464
427
  });
465
428
  }
466
- function H(t, e) {
467
- return y(this, void 0, void 0, function() {
468
- var r, i, s, n, o, u, l, a, c, f, m, v, w, g, d, b, P, k;
469
- return p(this, function(h) {
470
- switch (h.label) {
429
+ function X(t, e) {
430
+ return k(this, void 0, void 0, function() {
431
+ var r, i, a, n, o, u, f, s, c, l, d, m, w, v, h, p, P, z;
432
+ return y(this, function(g) {
433
+ switch (g.label) {
471
434
  case 0:
472
- return r = _(e.distPath, F(t, e.baseURL)), i = j(t, r), e.log(function(z) {
473
- return "download: ".concat(t, " -> ").concat(z);
435
+ return r = _(e.distPath, j(t, e.baseURL)), i = S(t, r, e.fetch), e.log(function(b) {
436
+ return "download: ".concat(t, " -> ").concat(b);
474
437
  }, i), [4, i];
475
438
  case 1:
476
- return h.sent(), o = (n = JSON).parse, [4, Q(r, "utf8")];
439
+ return g.sent(), o = (n = JSON).parse, [4, H(r, "utf8")];
477
440
  case 2:
478
- return s = o.apply(n, [h.sent()]), s.asset.overview ? (u = new URL(s.asset.overview.imageFile, t).href, l = _(e.distPath, F(u, e.baseURL)), a = j(u, l), e.log(function(z) {
479
- return "download: ".concat(u, " -> ").concat(z);
480
- }, a), [4, a]) : [3, 4];
441
+ return a = o.apply(n, [g.sent()]), a.asset.overview ? (u = new URL(a.asset.overview.imageFile, t).href, f = _(e.distPath, j(u, e.baseURL)), s = S(u, f, e.fetch), e.log(function(b) {
442
+ return "download: ".concat(u, " -> ").concat(b);
443
+ }, s), [4, s]) : [3, 4];
481
444
  case 3:
482
- h.sent(), h.label = 4;
445
+ g.sent(), g.label = 4;
483
446
  case 4:
484
- if (!s.asset.trajectories) return [3, 8];
485
- c = function(z) {
486
- var O, S, T;
487
- return p(this, function($) {
488
- switch ($.label) {
447
+ if (!a.asset.trajectories) return [3, 8];
448
+ c = function(b) {
449
+ var F, O, R;
450
+ return y(this, function(I) {
451
+ switch (I.label) {
489
452
  case 0:
490
- return O = new URL(z.file, t).href, S = _(e.distPath, F(O, e.baseURL)), T = j(O, S), e.log(function(R) {
491
- return "download: ".concat(O, " -> ").concat(R);
492
- }, T), [4, T];
453
+ return F = new URL(b.file, t).href, O = _(e.distPath, j(F, e.baseURL)), R = S(F, O, e.fetch), e.log(function(E) {
454
+ return "download: ".concat(F, " -> ").concat(E);
455
+ }, R), [4, R];
493
456
  case 1:
494
- return $.sent(), [
457
+ return I.sent(), [
495
458
  2
496
459
  /*return*/
497
460
  ];
498
461
  }
499
462
  });
500
- }, f = 0, m = s.asset.trajectories.list, h.label = 5;
463
+ }, l = 0, d = a.asset.trajectories.list, g.label = 5;
501
464
  case 5:
502
- return f < m.length ? (v = m[f], [5, c(v)]) : [3, 8];
465
+ return l < d.length ? (m = d[l], [5, c(m)]) : [3, 8];
503
466
  case 6:
504
- h.sent(), h.label = 7;
467
+ g.sent(), g.label = 7;
505
468
  case 7:
506
- return f++, [3, 5];
469
+ return l++, [3, 5];
507
470
  case 8:
508
- for (w = B(s.root), g = [], d = 0, b = w; d < b.length; d++)
509
- P = b[d], k = re(P, t, e), g.push(k);
510
- return [4, Promise.all(g)];
471
+ for (w = G(a.root), v = [], h = 0, p = w; h < p.length; h++)
472
+ P = p[h], z = x(P, t, e), v.push(z);
473
+ return [4, Promise.all(v)];
511
474
  case 9:
512
- return h.sent(), [
475
+ return g.sent(), [
513
476
  2
514
477
  /*return*/
515
478
  ];
@@ -517,59 +480,59 @@ function H(t, e) {
517
480
  });
518
481
  });
519
482
  }
520
- function ne(t, e) {
521
- return y(this, void 0, void 0, function() {
522
- var r, i, s, n, o, u, l, a, c, f, m, v, w, g;
523
- return p(this, function(d) {
524
- switch (d.label) {
483
+ function ee(t, e) {
484
+ return k(this, void 0, void 0, function() {
485
+ var r, i, a, n, o, u, f, s, c, l, d, m, w, v;
486
+ return y(this, function(h) {
487
+ switch (h.label) {
525
488
  case 0:
526
- return e.log("process model"), t.model ? (r = t.model, i = r.textures, s = r.layers, n = r.file, n ? (e.log("process model file"), o = _(e.distPath, F(n, e.baseURL)), u = j(n, o), e.log(function(b) {
527
- return "download: ".concat(n, " -> ").concat(b);
489
+ return e.log("process model"), t.model ? (r = t.model, i = r.textures, a = r.layers, n = r.file, n ? (e.log("process model file"), o = _(e.distPath, j(n, e.baseURL)), u = S(n, o, e.fetch), e.log(function(p) {
490
+ return "download: ".concat(n, " -> ").concat(p);
528
491
  }, u), [4, u]) : [3, 5]) : [3, 9];
529
492
  case 1:
530
- if (d.sent(), !i) return [3, 5];
531
- l = function(b) {
532
- var P, k, h, z, O, S, T, $, R, C, G, N;
533
- return p(this, function(W) {
534
- switch (W.label) {
493
+ if (h.sent(), !i) return [3, 5];
494
+ f = function(p) {
495
+ var P, z, g, b, F, O, R, I, E, $, J, N;
496
+ return y(this, function(C) {
497
+ switch (C.label) {
535
498
  case 0:
536
- return P = _(e.distPath, F(b, e.baseURL)), k = j(b, P), e.log(function(D) {
537
- return "download: ".concat(b, " -> ").concat(D);
538
- }, k), [4, k];
499
+ return P = _(e.distPath, j(p, e.baseURL)), z = S(p, P, e.fetch), e.log(function(U) {
500
+ return "download: ".concat(p, " -> ").concat(U);
501
+ }, z), [4, z];
539
502
  case 1:
540
- for (W.sent(), h = e.imageOptions.format, h.length === 0 && h.push(void 0), z = e.imageOptions.size, z.length === 0 && z.push(void 0), O = [], S = 0, T = h; S < T.length; S++)
541
- for ($ = T[S], R = 0, C = z; R < C.length; R++)
542
- G = C[R], N = J(P, {
543
- format: $,
544
- size: G,
503
+ for (C.sent(), g = e.imageOptions.format, g.length === 0 && g.push(void 0), b = e.imageOptions.size, b.length === 0 && b.push(void 0), F = [], O = 0, R = g; O < R.length; O++)
504
+ for (I = R[O], E = 0, $ = b; E < $.length; E++)
505
+ J = $[E], N = W(P, {
506
+ format: I,
507
+ size: J,
545
508
  toFilename: e.imageProcessingFilename
546
- }), e.log(function(D) {
547
- return "imageProcessing: ".concat(P, " -> ").concat(D);
548
- }, N), O.push(N);
549
- return [4, Promise.all(O)];
509
+ }), e.log(function(U) {
510
+ return "imageProcessing: ".concat(P, " -> ").concat(U);
511
+ }, N), F.push(N);
512
+ return [4, Promise.all(F)];
550
513
  case 2:
551
- return W.sent(), [
514
+ return C.sent(), [
552
515
  2
553
516
  /*return*/
554
517
  ];
555
518
  }
556
519
  });
557
- }, a = 0, c = i, d.label = 2;
520
+ }, s = 0, c = i, h.label = 2;
558
521
  case 2:
559
- return a < c.length ? (f = c[a], [5, l(f)]) : [3, 5];
522
+ return s < c.length ? (l = c[s], [5, f(l)]) : [3, 5];
560
523
  case 3:
561
- d.sent(), d.label = 4;
524
+ h.sent(), h.label = 4;
562
525
  case 4:
563
- return a++, [3, 2];
526
+ return s++, [3, 2];
564
527
  case 5:
565
- if (!s) return [3, 9];
566
- m = 0, v = s, d.label = 6;
528
+ if (!a) return [3, 9];
529
+ d = 0, m = a, h.label = 6;
567
530
  case 6:
568
- return m < v.length ? (w = v[m], g = w.tileset, e.log("process model layer"), [4, H(g, e)]) : [3, 9];
531
+ return d < m.length ? (w = m[d], v = w.tileset, e.log("process model layer"), [4, X(v, e)]) : [3, 9];
569
532
  case 7:
570
- d.sent(), d.label = 8;
533
+ h.sent(), h.label = 8;
571
534
  case 8:
572
- return m++, [3, 6];
535
+ return d++, [3, 6];
573
536
  case 9:
574
537
  return [
575
538
  2
@@ -579,36 +542,36 @@ function ne(t, e) {
579
542
  });
580
543
  });
581
544
  }
582
- function E(t, e, r) {
583
- return y(this, void 0, void 0, function() {
584
- var i, s, n, o, u, l, a, c, f, m, v, w, g;
585
- return p(this, function(d) {
586
- switch (d.label) {
545
+ function L(t, e, r) {
546
+ return k(this, void 0, void 0, function() {
547
+ var i, a, n, o, u, f, s, c, l, d, m, w, v;
548
+ return y(this, function(h) {
549
+ switch (h.label) {
587
550
  case 0:
588
- return i = _(r.distPath, F(t, r.baseURL)), s = j(t, i), r.log(function(b) {
589
- return "download: ".concat(t, " -> ").concat(b);
590
- }, s), [4, s];
551
+ return i = _(r.distPath, j(t, r.baseURL)), a = S(t, i, r.fetch), r.log(function(p) {
552
+ return "download: ".concat(t, " -> ").concat(p);
553
+ }, a), [4, a];
591
554
  case 1:
592
- if (d.sent(), n = Math.pow(2, e.level), o = r.imageOptions.format, o.length === 0 && o.push(void 0), u = [], n > 1)
593
- for (l = 0; l < n; l++)
594
- for (a = 0; a < n; a++)
595
- for (c = 0, f = o; c < f.length; c++)
596
- m = f[c], v = [
597
- e.size / n * a,
598
- e.size / n * l,
555
+ if (h.sent(), n = Math.pow(2, e.level), o = r.imageOptions.format, o.length === 0 && o.push(void 0), u = [], n > 1)
556
+ for (f = 0; f < n; f++)
557
+ for (s = 0; s < n; s++)
558
+ for (c = 0, l = o; c < l.length; c++)
559
+ d = l[c], m = [
560
+ e.size / n * s,
561
+ e.size / n * f,
599
562
  e.size / n,
600
563
  e.size / n
601
- ], w = e.scale >= 1 ? void 0 : e.scale * e.size / n, e.level === 1 && e.scale >= 0.5 && (m === "jpg" || /\.jpg$/.test(i)) && (w = void 0), g = J(i, {
602
- format: m,
564
+ ], w = e.scale >= 1 ? void 0 : e.scale * e.size / n, e.level === 1 && e.scale >= 0.5 && (d === "jpg" || /\.jpg$/.test(i)) && (w = void 0), v = W(i, {
565
+ format: d,
603
566
  size: w,
604
- cut: v,
567
+ cut: m,
605
568
  toFilename: r.imageProcessingFilename
606
- }), r.log(function(b) {
607
- return "imageProcessing: ".concat(i, " -> ").concat(b);
608
- }, g), u.push(g);
569
+ }), r.log(function(p) {
570
+ return "imageProcessing: ".concat(i, " -> ").concat(p);
571
+ }, v), u.push(v);
609
572
  return [4, Promise.all(u)];
610
573
  case 2:
611
- return d.sent(), [
574
+ return h.sent(), [
612
575
  2
613
576
  /*return*/
614
577
  ];
@@ -616,18 +579,18 @@ function E(t, e, r) {
616
579
  });
617
580
  });
618
581
  }
619
- function te(t, e) {
620
- return y(this, void 0, void 0, function() {
621
- return p(this, function(r) {
582
+ function re(t, e) {
583
+ return k(this, void 0, void 0, function() {
584
+ return y(this, function(r) {
622
585
  switch (r.label) {
623
586
  case 0:
624
587
  return [4, Promise.all([
625
- E(t.front, t, e),
626
- E(t.back, t, e),
627
- E(t.left, t, e),
628
- E(t.right, t, e),
629
- E(t.up, t, e),
630
- E(t.down, t, e)
588
+ L(t.front, t, e),
589
+ L(t.back, t, e),
590
+ L(t.left, t, e),
591
+ L(t.right, t, e),
592
+ L(t.up, t, e),
593
+ L(t.down, t, e)
631
594
  ])];
632
595
  case 1:
633
596
  return r.sent(), [
@@ -638,25 +601,25 @@ function te(t, e) {
638
601
  });
639
602
  });
640
603
  }
641
- function L(t, e) {
642
- return y(this, void 0, void 0, function() {
643
- var r, i, s, n, o, u, l, a, c, f, m, v;
644
- return p(this, function(w) {
604
+ function T(t, e) {
605
+ return k(this, void 0, void 0, function() {
606
+ var r, i, a, n, o, u, f, s, c, l, d, m;
607
+ return y(this, function(w) {
645
608
  switch (w.label) {
646
609
  case 0:
647
- return r = _(e.distPath, F(t, e.baseURL)), i = j(t, r), e.log(function(g) {
648
- return "download: ".concat(t, " -> ").concat(g);
610
+ return r = _(e.distPath, j(t, e.baseURL)), i = S(t, r, e.fetch), e.log(function(v) {
611
+ return "download: ".concat(t, " -> ").concat(v);
649
612
  }, i), [4, i];
650
613
  case 1:
651
- for (w.sent(), s = e.imageOptions.format, s.length === 0 && s.push(void 0), n = e.imageOptions.size, n.length === 0 && n.push(void 0), o = [], u = 0, l = s; u < l.length; u++)
652
- for (a = l[u], c = 0, f = n; c < f.length; c++)
653
- m = f[c], v = J(r, {
654
- format: a,
655
- size: m,
614
+ for (w.sent(), a = e.imageOptions.format, a.length === 0 && a.push(void 0), n = e.imageOptions.size, n.length === 0 && n.push(void 0), o = [], u = 0, f = a; u < f.length; u++)
615
+ for (s = f[u], c = 0, l = n; c < l.length; c++)
616
+ d = l[c], m = W(r, {
617
+ format: s,
618
+ size: d,
656
619
  toFilename: e.imageProcessingFilename
657
- }), e.log(function(g) {
658
- return "imageProcessing: ".concat(r, " -> ").concat(g);
659
- }, v), o.push(v);
620
+ }), e.log(function(v) {
621
+ return "imageProcessing: ".concat(r, " -> ").concat(v);
622
+ }, m), o.push(m);
660
623
  return [4, Promise.all(o)];
661
624
  case 2:
662
625
  return w.sent(), [
@@ -667,23 +630,23 @@ function L(t, e) {
667
630
  });
668
631
  });
669
632
  }
670
- function se(t, e) {
671
- return y(this, void 0, void 0, function() {
633
+ function ne(t, e) {
634
+ return k(this, void 0, void 0, function() {
672
635
  var r;
673
- return p(this, function(i) {
636
+ return y(this, function(i) {
674
637
  switch (i.label) {
675
638
  case 0:
676
639
  return r = t.images, [4, Promise.all([
677
- L(r.front, e),
678
- L(r.back, e),
679
- L(r.left, e),
680
- L(r.right, e),
681
- L(r.up, e),
682
- L(r.down, e)
640
+ T(r.front, e),
641
+ T(r.back, e),
642
+ T(r.left, e),
643
+ T(r.right, e),
644
+ T(r.up, e),
645
+ T(r.down, e)
683
646
  ])];
684
647
  case 1:
685
- return i.sent(), r.tiles ? [4, Promise.all(r.tiles.map(function(s) {
686
- return te(s, e);
648
+ return i.sent(), r.tiles ? [4, Promise.all(r.tiles.map(function(a) {
649
+ return re(a, e);
687
650
  }))] : [3, 3];
688
651
  case 2:
689
652
  i.sent(), i.label = 3;
@@ -696,15 +659,15 @@ function se(t, e) {
696
659
  });
697
660
  });
698
661
  }
699
- function ie(t, e) {
700
- return y(this, void 0, void 0, function() {
701
- var r, i, s, n, o;
702
- return p(this, function(u) {
662
+ function te(t, e) {
663
+ return k(this, void 0, void 0, function() {
664
+ var r, i, a, n, o;
665
+ return y(this, function(u) {
703
666
  switch (u.label) {
704
667
  case 0:
705
- r = t.observers, i = 0, s = r, u.label = 1;
668
+ r = t.observers, i = 0, a = r, u.label = 1;
706
669
  case 1:
707
- return i < s.length ? (n = s[i], o = se(n, e), e.log("process observer #".concat(n.index, " derived: ").concat(n.derivedIdStr), o), [4, o]) : [3, 4];
670
+ return i < a.length ? (n = a[i], o = ne(n, e), e.log("process observer #".concat(n.index, " derived: ").concat(n.derivedIdStr), o), [4, o]) : [3, 4];
708
671
  case 2:
709
672
  u.sent(), u.label = 3;
710
673
  case 3:
@@ -718,11 +681,11 @@ function ie(t, e) {
718
681
  });
719
682
  });
720
683
  }
721
- function ae(t, e) {
684
+ function ie(t, e) {
722
685
  if (e) {
723
686
  var r = Date.now();
724
- e.then(function(s) {
725
- var n = Date.now() - r, o = typeof t == "function" ? t(s) : t;
687
+ e.then(function(a) {
688
+ var n = Date.now() - r, o = typeof t == "function" ? t(a) : t;
726
689
  console.log(o + "(".concat(n, "ms)"));
727
690
  }).catch(function() {
728
691
  });
@@ -731,49 +694,50 @@ function ae(t, e) {
731
694
  console.log(i);
732
695
  }
733
696
  }
734
- function he(t) {
735
- return y(this, arguments, void 0, function(e, r) {
736
- var i, s, n, o, u, l, a, c, f, m, v, w, g, d, b, P, k;
737
- return r === void 0 && (r = {}), p(this, function(h) {
738
- switch (h.label) {
697
+ function fe(t) {
698
+ return k(this, arguments, void 0, function(e, r) {
699
+ var i, a, n, o, u, f, s, c, l, d, m, w, v, h, p, P, z, g;
700
+ return r === void 0 && (r = {}), y(this, function(b) {
701
+ switch (b.label) {
739
702
  case 0:
740
- if (i = e.baseURL, s = "", r.distPath)
741
- s = M(process.cwd(), r.distPath);
703
+ if (i = e.baseURL, a = "", r.distPath)
704
+ a = B(process.cwd(), r.distPath);
742
705
  else
743
- for (s = M(process.cwd(), (f = e.workCode) !== null && f !== void 0 ? f : "work-".concat(Date.now())); U(s); )
744
- /.-(\d+)$/.test(s) ? s = s.replace(/.-(\d+)$/, function(z, O) {
706
+ for (a = B(process.cwd(), (l = e.workCode) !== null && l !== void 0 ? l : "work-".concat(Date.now())); D(a); )
707
+ /.-(\d+)$/.test(a) ? a = a.replace(/.-(\d+)$/, function(F, O) {
745
708
  return "-" + (Number(O) + 1);
746
- }) : s = s + "-1";
709
+ }) : a = a + "-1";
747
710
  return n = {
748
711
  baseURL: i,
749
- distPath: s,
712
+ distPath: a,
713
+ fetch: (d = r.fetch) !== null && d !== void 0 ? d : fetch,
750
714
  imageOptions: {
751
- size: (v = (m = r.imageOptions) === null || m === void 0 ? void 0 : m.size) !== null && v !== void 0 ? v : [],
752
- format: (g = (w = r.imageOptions) === null || w === void 0 ? void 0 : w.format) !== null && g !== void 0 ? g : []
715
+ size: (w = (m = r.imageOptions) === null || m === void 0 ? void 0 : m.size) !== null && w !== void 0 ? w : [],
716
+ format: (h = (v = r.imageOptions) === null || v === void 0 ? void 0 : v.format) !== null && h !== void 0 ? h : []
753
717
  },
754
718
  textureOptions: {
755
- size: (b = (d = r.textureOptions) === null || d === void 0 ? void 0 : d.size) !== null && b !== void 0 ? b : [],
756
- format: (k = (P = r.textureOptions) === null || P === void 0 ? void 0 : P.format) !== null && k !== void 0 ? k : []
719
+ size: (P = (p = r.textureOptions) === null || p === void 0 ? void 0 : p.size) !== null && P !== void 0 ? P : [],
720
+ format: (g = (z = r.textureOptions) === null || z === void 0 ? void 0 : z.format) !== null && g !== void 0 ? g : []
757
721
  },
758
- log: r.log ? ae : function() {
722
+ log: r.log ? ie : function() {
759
723
  return Promise.resolve();
760
724
  },
761
725
  imageProcessingFilename: r.imageProcessingFilename
762
- }, n.log(JSON.stringify(n, null, " ")), [4, q(s, { recursive: !0 })];
726
+ }, n.log(JSON.stringify(n, null, " ")), [4, A(a, { recursive: !0 })];
763
727
  case 1:
764
- h.sent(), o = 0, h.label = 2;
728
+ b.sent(), o = 0, b.label = 2;
765
729
  case 2:
766
- return o < e.raw.works.length ? (u = e.raw.works[o], l = o > 0 ? "-".concat(o) : "", a = "work".concat(l, ".json"), c = M(s, a), [4, V(c, u)]) : [3, 5];
730
+ return o < e.raw.works.length ? (u = e.raw.works[o], f = o > 0 ? "-".concat(o) : "", s = "work".concat(f, ".json"), c = B(a, s), [4, M(c, u)]) : [3, 5];
767
731
  case 3:
768
- h.sent(), h.label = 4;
732
+ b.sent(), b.label = 4;
769
733
  case 4:
770
734
  return o++, [3, 2];
771
735
  case 5:
772
- return [4, ie(e, n)];
736
+ return [4, te(e, n)];
773
737
  case 6:
774
- return h.sent(), [4, ne(e, n)];
738
+ return b.sent(), [4, ee(e, n)];
775
739
  case 7:
776
- return h.sent(), [
740
+ return b.sent(), [
777
741
  2
778
742
  /*return*/
779
743
  ];
@@ -782,5 +746,5 @@ function he(t) {
782
746
  });
783
747
  }
784
748
  export {
785
- he as download
749
+ fe as download
786
750
  };