@datapos/datapos-tool-file-operators 0.0.5 → 0.0.7

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,7 +1,7 @@
1
- function S0(i) {
1
+ function F0(i) {
2
2
  return i && i.__esModule && Object.prototype.hasOwnProperty.call(i, "default") ? i.default : i;
3
3
  }
4
- var E = {}, G = {}, n0;
4
+ var O = {}, G = {}, n0;
5
5
  function B0() {
6
6
  return n0 || (n0 = 1, Object.defineProperty(G, "__esModule", { value: !0 }), G.default = () => {
7
7
  throw new Error("File system is not available");
@@ -41,7 +41,7 @@ function I0() {
41
41
  return R.default = x, R;
42
42
  }
43
43
  var P = {}, o0;
44
- function O0() {
44
+ function A0() {
45
45
  if (o0) return P;
46
46
  o0 = 1;
47
47
  var i = P && P.__importDefault || function(t) {
@@ -102,14 +102,14 @@ function O0() {
102
102
  }
103
103
  return P.default = x, P;
104
104
  }
105
- var O = {}, f0;
106
- function E0() {
107
- if (f0) return O;
105
+ var A = {}, f0;
106
+ function O0() {
107
+ if (f0) return A;
108
108
  f0 = 1;
109
- var i = O && O.__importDefault || function(m) {
109
+ var i = A && A.__importDefault || function(m) {
110
110
  return m && m.__esModule ? m : { default: m };
111
111
  };
112
- Object.defineProperty(O, "__esModule", { value: !0 }), O.UTF_32LE = O.UTF_32BE = O.UTF_16LE = O.UTF_16BE = void 0;
112
+ Object.defineProperty(A, "__esModule", { value: !0 }), A.UTF_32LE = A.UTF_32BE = A.UTF_16LE = A.UTF_16BE = void 0;
113
113
  const e = i(N());
114
114
  class x {
115
115
  name() {
@@ -120,7 +120,7 @@ function E0() {
120
120
  return f.length >= 2 && (f[0] & 255) == 254 && (f[1] & 255) == 255 ? (0, e.default)(o, this, 100) : null;
121
121
  }
122
122
  }
123
- O.UTF_16BE = x;
123
+ A.UTF_16BE = x;
124
124
  class t {
125
125
  name() {
126
126
  return "UTF-16LE";
@@ -130,7 +130,7 @@ function E0() {
130
130
  return f.length >= 2 && (f[0] & 255) == 255 && (f[1] & 255) == 254 ? f.length >= 4 && f[2] == 0 && f[3] == 0 ? null : (0, e.default)(o, this, 100) : null;
131
131
  }
132
132
  }
133
- O.UTF_16LE = t;
133
+ A.UTF_16LE = t;
134
134
  class a {
135
135
  name() {
136
136
  return "UTF-32";
@@ -159,7 +159,7 @@ function E0() {
159
159
  return (o[f + 0] & 255) << 24 | (o[f + 1] & 255) << 16 | (o[f + 2] & 255) << 8 | o[f + 3] & 255;
160
160
  }
161
161
  }
162
- O.UTF_32BE = n;
162
+ A.UTF_32BE = n;
163
163
  class s extends a {
164
164
  name() {
165
165
  return "UTF-32LE";
@@ -168,16 +168,16 @@ function E0() {
168
168
  return (o[f + 3] & 255) << 24 | (o[f + 2] & 255) << 16 | (o[f + 1] & 255) << 8 | o[f + 0] & 255;
169
169
  }
170
170
  }
171
- return O.UTF_32LE = s, O;
171
+ return A.UTF_32LE = s, A;
172
172
  }
173
- var D = {}, d0;
174
- function L0() {
175
- if (d0) return D;
173
+ var _ = {}, d0;
174
+ function E0() {
175
+ if (d0) return _;
176
176
  d0 = 1;
177
- var i = D && D.__importDefault || function(r) {
177
+ var i = _ && _.__importDefault || function(r) {
178
178
  return r && r.__esModule ? r : { default: r };
179
179
  };
180
- Object.defineProperty(D, "__esModule", { value: !0 }), D.gb_18030 = D.euc_kr = D.euc_jp = D.big5 = D.sjis = void 0;
180
+ Object.defineProperty(_, "__esModule", { value: !0 }), _.gb_18030 = _.euc_kr = _.euc_jp = _.big5 = _.sjis = void 0;
181
181
  const e = i(N());
182
182
  function x(r, c) {
183
183
  const u = (h, g, k, b) => {
@@ -320,7 +320,7 @@ function L0() {
320
320
  return g < 0 ? !1 : (c.charValue = h << 8 | g, g >= 64 && g <= 127 || g >= 128 && g <= 255 || (c.error = !0), !0);
321
321
  }
322
322
  }
323
- D.sjis = n;
323
+ _.sjis = n;
324
324
  class s extends a {
325
325
  constructor() {
326
326
  super(...arguments), this.commonChars = [
@@ -439,7 +439,7 @@ function L0() {
439
439
  return g < 0 ? !1 : (c.charValue = c.charValue << 8 | g, (g < 64 || g == 127 || g == 255) && (c.error = !0), !0);
440
440
  }
441
441
  }
442
- D.big5 = s;
442
+ _.big5 = s;
443
443
  function m(r, c) {
444
444
  r.index = r.nextIndex, r.error = !1;
445
445
  let u = 0, h = 0, g = 0;
@@ -574,7 +574,7 @@ function L0() {
574
574
  return "ja";
575
575
  }
576
576
  }
577
- D.euc_jp = o;
577
+ _.euc_jp = o;
578
578
  class f extends a {
579
579
  constructor() {
580
580
  super(...arguments), this.commonChars = [
@@ -687,7 +687,7 @@ function L0() {
687
687
  return "ko";
688
688
  }
689
689
  }
690
- D.euc_kr = f;
690
+ _.euc_kr = f;
691
691
  class d extends a {
692
692
  constructor() {
693
693
  super(...arguments), this.commonChars = [
@@ -823,16 +823,16 @@ function L0() {
823
823
  return c.done == !1;
824
824
  }
825
825
  }
826
- return D.gb_18030 = d, D;
826
+ return _.gb_18030 = d, _;
827
827
  }
828
- var F = {}, l0;
829
- function A0() {
830
- if (l0) return F;
828
+ var S = {}, l0;
829
+ function L0() {
830
+ if (l0) return S;
831
831
  l0 = 1;
832
- var i = F && F.__importDefault || function(b) {
832
+ var i = S && S.__importDefault || function(b) {
833
833
  return b && b.__esModule ? b : { default: b };
834
834
  };
835
- Object.defineProperty(F, "__esModule", { value: !0 }), F.KOI8_R = F.windows_1256 = F.windows_1251 = F.ISO_8859_9 = F.ISO_8859_8 = F.ISO_8859_7 = F.ISO_8859_6 = F.ISO_8859_5 = F.ISO_8859_2 = F.ISO_8859_1 = void 0;
835
+ Object.defineProperty(S, "__esModule", { value: !0 }), S.KOI8_R = S.windows_1256 = S.windows_1251 = S.ISO_8859_9 = S.ISO_8859_8 = S.ISO_8859_7 = S.ISO_8859_6 = S.ISO_8859_5 = S.ISO_8859_2 = S.ISO_8859_1 = void 0;
836
836
  const e = i(N()), x = 16777215;
837
837
  class t {
838
838
  constructor(l, p) {
@@ -854,12 +854,12 @@ function A0() {
854
854
  parse(l, p) {
855
855
  let w, y = !1;
856
856
  for (this.spaceChar = p; (w = this.nextByte(l)) >= 0; ) {
857
- const v = this.byteMap[w];
858
- v != 0 && (v == this.spaceChar && y || this.addByte(v), y = v == this.spaceChar);
857
+ const C = this.byteMap[w];
858
+ C != 0 && (C == this.spaceChar && y || this.addByte(C), y = C == this.spaceChar);
859
859
  }
860
860
  this.addByte(this.spaceChar);
861
- const C = this.hitCount / this.ngramCount;
862
- return C > 0.33 ? 98 : Math.floor(C * 300);
861
+ const v = this.hitCount / this.ngramCount;
862
+ return v > 0.33 ? 98 : Math.floor(v * 300);
863
863
  }
864
864
  }
865
865
  class a {
@@ -888,13 +888,13 @@ function A0() {
888
888
  this.nGramLang = void 0;
889
889
  const p = this.ngrams();
890
890
  if (n(p)) {
891
- const C = new t(p, this.byteMap()).parse(l, this.spaceChar);
892
- return C <= 0 ? null : (0, e.default)(l, this, C);
891
+ const v = new t(p, this.byteMap()).parse(l, this.spaceChar);
892
+ return v <= 0 ? null : (0, e.default)(l, this, v);
893
893
  }
894
894
  let w = -1;
895
895
  for (let y = p.length - 1; y >= 0; y--) {
896
- const C = p[y], A = new t(C.fNGrams, this.byteMap()).parse(l, this.spaceChar);
897
- A > w && (w = A, this.nGramLang = C.fLang);
896
+ const v = p[y], L = new t(v.fNGrams, this.byteMap()).parse(l, this.spaceChar);
897
+ L > w && (w = L, this.nGramLang = v.fLang);
898
898
  }
899
899
  return w <= 0 ? null : (0, e.default)(l, this, w);
900
900
  }
@@ -1828,7 +1828,7 @@ function A0() {
1828
1828
  return l && l.c1Bytes ? "windows-1252" : "ISO-8859-1";
1829
1829
  }
1830
1830
  }
1831
- F.ISO_8859_1 = m;
1831
+ S.ISO_8859_1 = m;
1832
1832
  class o extends s {
1833
1833
  byteMap() {
1834
1834
  return [
@@ -2362,7 +2362,7 @@ function A0() {
2362
2362
  return l && l.c1Bytes ? "windows-1250" : "ISO-8859-2";
2363
2363
  }
2364
2364
  }
2365
- F.ISO_8859_2 = o;
2365
+ S.ISO_8859_2 = o;
2366
2366
  class f extends s {
2367
2367
  byteMap() {
2368
2368
  return [
@@ -2699,7 +2699,7 @@ function A0() {
2699
2699
  return "ru";
2700
2700
  }
2701
2701
  }
2702
- F.ISO_8859_5 = f;
2702
+ S.ISO_8859_5 = f;
2703
2703
  class d extends s {
2704
2704
  byteMap() {
2705
2705
  return [
@@ -3036,7 +3036,7 @@ function A0() {
3036
3036
  return "ar";
3037
3037
  }
3038
3038
  }
3039
- F.ISO_8859_6 = d;
3039
+ S.ISO_8859_6 = d;
3040
3040
  class r extends s {
3041
3041
  byteMap() {
3042
3042
  return [
@@ -3373,7 +3373,7 @@ function A0() {
3373
3373
  return "el";
3374
3374
  }
3375
3375
  }
3376
- F.ISO_8859_7 = r;
3376
+ S.ISO_8859_7 = r;
3377
3377
  class c extends s {
3378
3378
  byteMap() {
3379
3379
  return [
@@ -3778,7 +3778,7 @@ function A0() {
3778
3778
  return "he";
3779
3779
  }
3780
3780
  }
3781
- F.ISO_8859_8 = c;
3781
+ S.ISO_8859_8 = c;
3782
3782
  class u extends s {
3783
3783
  byteMap() {
3784
3784
  return [
@@ -4115,7 +4115,7 @@ function A0() {
4115
4115
  return "tr";
4116
4116
  }
4117
4117
  }
4118
- F.ISO_8859_9 = u;
4118
+ S.ISO_8859_9 = u;
4119
4119
  class h extends s {
4120
4120
  byteMap() {
4121
4121
  return [
@@ -4452,7 +4452,7 @@ function A0() {
4452
4452
  return "ru";
4453
4453
  }
4454
4454
  }
4455
- F.windows_1251 = h;
4455
+ S.windows_1251 = h;
4456
4456
  class g extends s {
4457
4457
  byteMap() {
4458
4458
  return [
@@ -4789,7 +4789,7 @@ function A0() {
4789
4789
  return "ar";
4790
4790
  }
4791
4791
  }
4792
- F.windows_1256 = g;
4792
+ S.windows_1256 = g;
4793
4793
  class k extends s {
4794
4794
  byteMap() {
4795
4795
  return [
@@ -5126,16 +5126,16 @@ function A0() {
5126
5126
  return "ru";
5127
5127
  }
5128
5128
  }
5129
- return F.KOI8_R = k, F;
5129
+ return S.KOI8_R = k, S;
5130
5130
  }
5131
- var L = {}, u0;
5131
+ var E = {}, u0;
5132
5132
  function T0() {
5133
- if (u0) return L;
5133
+ if (u0) return E;
5134
5134
  u0 = 1;
5135
- var i = L && L.__importDefault || function(s) {
5135
+ var i = E && E.__importDefault || function(s) {
5136
5136
  return s && s.__esModule ? s : { default: s };
5137
5137
  };
5138
- Object.defineProperty(L, "__esModule", { value: !0 }), L.ISO_2022_CN = L.ISO_2022_KR = L.ISO_2022_JP = void 0;
5138
+ Object.defineProperty(E, "__esModule", { value: !0 }), E.ISO_2022_CN = E.ISO_2022_KR = E.ISO_2022_JP = void 0;
5139
5139
  const e = i(N());
5140
5140
  class x {
5141
5141
  constructor() {
@@ -5190,7 +5190,7 @@ function T0() {
5190
5190
  return "ja";
5191
5191
  }
5192
5192
  }
5193
- L.ISO_2022_JP = t;
5193
+ E.ISO_2022_JP = t;
5194
5194
  class a extends x {
5195
5195
  constructor() {
5196
5196
  super(...arguments), this.escapeSequences = [[27, 36, 41, 67]];
@@ -5202,7 +5202,7 @@ function T0() {
5202
5202
  return "kr";
5203
5203
  }
5204
5204
  }
5205
- L.ISO_2022_KR = a;
5205
+ E.ISO_2022_KR = a;
5206
5206
  class n extends x {
5207
5207
  constructor() {
5208
5208
  super(...arguments), this.escapeSequences = [
@@ -5226,7 +5226,7 @@ function T0() {
5226
5226
  return "zh";
5227
5227
  }
5228
5228
  }
5229
- return L.ISO_2022_CN = n, L;
5229
+ return E.ISO_2022_CN = n, E;
5230
5230
  }
5231
5231
  var H = {}, m0;
5232
5232
  function M0() {
@@ -5238,37 +5238,37 @@ function M0() {
5238
5238
  var p0;
5239
5239
  function z0() {
5240
5240
  return p0 || (p0 = 1, (function(i) {
5241
- var e = E && E.__createBinding || (Object.create ? (function(l, p, w, y) {
5241
+ var e = O && O.__createBinding || (Object.create ? (function(l, p, w, y) {
5242
5242
  y === void 0 && (y = w);
5243
- var C = Object.getOwnPropertyDescriptor(p, w);
5244
- (!C || ("get" in C ? !p.__esModule : C.writable || C.configurable)) && (C = { enumerable: !0, get: function() {
5243
+ var v = Object.getOwnPropertyDescriptor(p, w);
5244
+ (!v || ("get" in v ? !p.__esModule : v.writable || v.configurable)) && (v = { enumerable: !0, get: function() {
5245
5245
  return p[w];
5246
- } }), Object.defineProperty(l, y, C);
5246
+ } }), Object.defineProperty(l, y, v);
5247
5247
  }) : (function(l, p, w, y) {
5248
5248
  y === void 0 && (y = w), l[y] = p[w];
5249
- })), x = E && E.__setModuleDefault || (Object.create ? (function(l, p) {
5249
+ })), x = O && O.__setModuleDefault || (Object.create ? (function(l, p) {
5250
5250
  Object.defineProperty(l, "default", { enumerable: !0, value: p });
5251
5251
  }) : function(l, p) {
5252
5252
  l.default = p;
5253
- }), t = E && E.__importStar || /* @__PURE__ */ (function() {
5253
+ }), t = O && O.__importStar || /* @__PURE__ */ (function() {
5254
5254
  var l = function(p) {
5255
5255
  return l = Object.getOwnPropertyNames || function(w) {
5256
5256
  var y = [];
5257
- for (var C in w) Object.prototype.hasOwnProperty.call(w, C) && (y[y.length] = C);
5257
+ for (var v in w) Object.prototype.hasOwnProperty.call(w, v) && (y[y.length] = v);
5258
5258
  return y;
5259
5259
  }, l(p);
5260
5260
  };
5261
5261
  return function(p) {
5262
5262
  if (p && p.__esModule) return p;
5263
5263
  var w = {};
5264
- if (p != null) for (var y = l(p), C = 0; C < y.length; C++) y[C] !== "default" && e(w, p, y[C]);
5264
+ if (p != null) for (var y = l(p), v = 0; v < y.length; v++) y[v] !== "default" && e(w, p, y[v]);
5265
5265
  return x(w, p), w;
5266
5266
  };
5267
- })(), a = E && E.__importDefault || function(l) {
5267
+ })(), a = O && O.__importDefault || function(l) {
5268
5268
  return l && l.__esModule ? l : { default: l };
5269
5269
  };
5270
5270
  Object.defineProperty(i, "__esModule", { value: !0 }), i.detectFileSync = i.detectFile = i.analyse = i.detect = void 0;
5271
- const n = a(B0()), s = a(I0()), m = a(O0()), o = t(E0()), f = t(L0()), d = t(A0()), r = t(T0()), c = M0(), u = [
5271
+ const n = a(B0()), s = a(I0()), m = a(A0()), o = t(O0()), f = t(E0()), d = t(L0()), r = t(T0()), c = M0(), u = [
5272
5272
  new m.default(),
5273
5273
  new o.UTF_16BE(),
5274
5274
  new o.UTF_16LE(),
@@ -5302,13 +5302,13 @@ function z0() {
5302
5302
  if (!(0, c.isByteArray)(l))
5303
5303
  throw new Error("Input must be a byte array, e.g. Buffer or Uint8Array");
5304
5304
  const p = [];
5305
- for (let v = 0; v < 256; v++)
5306
- p[v] = 0;
5307
- for (let v = l.length - 1; v >= 0; v--)
5308
- p[l[v] & 255]++;
5305
+ for (let C = 0; C < 256; C++)
5306
+ p[C] = 0;
5307
+ for (let C = l.length - 1; C >= 0; C--)
5308
+ p[l[C] & 255]++;
5309
5309
  let w = !1;
5310
- for (let v = 128; v <= 159; v += 1)
5311
- if (p[v] !== 0) {
5310
+ for (let C = 128; C <= 159; C += 1)
5311
+ if (p[C] !== 0) {
5312
5312
  w = !0;
5313
5313
  break;
5314
5314
  }
@@ -5320,32 +5320,32 @@ function z0() {
5320
5320
  inputBytes: l,
5321
5321
  inputLen: l.length
5322
5322
  };
5323
- return u.map((v) => v.match(y)).filter((v) => !!v).sort((v, A) => A.confidence - v.confidence);
5323
+ return u.map((C) => C.match(y)).filter((C) => !!C).sort((C, L) => L.confidence - C.confidence);
5324
5324
  };
5325
5325
  i.analyse = g;
5326
5326
  const k = (l, p = {}) => new Promise((w, y) => {
5327
- let C;
5328
- const v = (0, n.default)(), A = (z, V) => {
5329
- C && v.closeSync(C), z ? y(z) : V ? w((0, i.detect)(V)) : y(new Error("No error and no buffer received"));
5327
+ let v;
5328
+ const C = (0, n.default)(), L = (z, V) => {
5329
+ v && C.closeSync(v), z ? y(z) : V ? w((0, i.detect)(V)) : y(new Error("No error and no buffer received"));
5330
5330
  }, j = p?.sampleSize || 0;
5331
5331
  if (j > 0) {
5332
- C = v.openSync(l, "r");
5332
+ v = C.openSync(l, "r");
5333
5333
  let z = Buffer.allocUnsafe(j);
5334
- v.read(C, z, 0, j, p.offset, (V, r0) => {
5335
- V ? A(V, null) : (r0 < j && (z = z.subarray(0, r0)), A(null, z));
5334
+ C.read(v, z, 0, j, p.offset, (V, r0) => {
5335
+ V ? L(V, null) : (r0 < j && (z = z.subarray(0, r0)), L(null, z));
5336
5336
  });
5337
5337
  return;
5338
5338
  }
5339
- v.readFile(l, A);
5339
+ C.readFile(l, L);
5340
5340
  });
5341
5341
  i.detectFile = k;
5342
5342
  const b = (l, p = {}) => {
5343
5343
  const w = (0, n.default)();
5344
5344
  if (p && p.sampleSize) {
5345
5345
  const y = w.openSync(l, "r");
5346
- let C = Buffer.allocUnsafe(p.sampleSize);
5347
- const v = w.readSync(y, C, 0, p.sampleSize, p.offset);
5348
- return v < p.sampleSize && (C = C.subarray(0, v)), w.closeSync(y), (0, i.detect)(C);
5346
+ let v = Buffer.allocUnsafe(p.sampleSize);
5347
+ const C = w.readSync(y, v, 0, p.sampleSize, p.offset);
5348
+ return C < p.sampleSize && (v = v.subarray(0, C)), w.closeSync(y), (0, i.detect)(v);
5349
5349
  }
5350
5350
  return (0, i.detect)(w.readFileSync(l));
5351
5351
  };
@@ -5355,10 +5355,10 @@ function z0() {
5355
5355
  detectFileSync: i.detectFileSync,
5356
5356
  detectFile: i.detectFile
5357
5357
  };
5358
- })(E)), E;
5358
+ })(O)), O;
5359
5359
  }
5360
5360
  var U0 = z0();
5361
- const j0 = /* @__PURE__ */ S0(U0);
5361
+ const j0 = /* @__PURE__ */ F0(U0);
5362
5362
  var K = {};
5363
5363
  var h0;
5364
5364
  function R0() {
@@ -5484,7 +5484,7 @@ const G0 = {
5484
5484
  put(i, e, x) {
5485
5485
  return I(i).setUint8(e, x), e + 1;
5486
5486
  }
5487
- }, S = {
5487
+ }, F = {
5488
5488
  len: 2,
5489
5489
  get(i, e) {
5490
5490
  return I(i).getUint16(e, !0);
@@ -5500,7 +5500,7 @@ const G0 = {
5500
5500
  put(i, e, x) {
5501
5501
  return I(i).setUint16(e, x), e + 2;
5502
5502
  }
5503
- }, _ = {
5503
+ }, D = {
5504
5504
  len: 4,
5505
5505
  get(i, e) {
5506
5506
  return I(i).getUint32(e, !0);
@@ -5542,18 +5542,18 @@ class U {
5542
5542
  return P0(t, this.encoding);
5543
5543
  }
5544
5544
  }
5545
- const $0 = "End-Of-Stream";
5545
+ const Q0 = "End-Of-Stream";
5546
5546
  class B extends Error {
5547
5547
  constructor() {
5548
- super($0), this.name = "EndOfStreamError";
5548
+ super(Q0), this.name = "EndOfStreamError";
5549
5549
  }
5550
5550
  }
5551
- class Q0 extends Error {
5551
+ class $0 extends Error {
5552
5552
  constructor(e = "The operation was aborted") {
5553
5553
  super(e), this.name = "AbortError";
5554
5554
  }
5555
5555
  }
5556
- class _0 {
5556
+ class D0 {
5557
5557
  constructor() {
5558
5558
  this.endOfStream = !1, this.interrupted = !1, this.peekQueue = [];
5559
5559
  }
@@ -5589,7 +5589,7 @@ class _0 {
5589
5589
  let t = 0;
5590
5590
  for (; t < e.length && !this.endOfStream; ) {
5591
5591
  if (this.interrupted)
5592
- throw new Q0();
5592
+ throw new $0();
5593
5593
  const a = await this.readFromStream(e.subarray(t), x);
5594
5594
  if (a === 0)
5595
5595
  break;
@@ -5600,7 +5600,7 @@ class _0 {
5600
5600
  return t;
5601
5601
  }
5602
5602
  }
5603
- class X0 extends _0 {
5603
+ class X0 extends D0 {
5604
5604
  constructor(e) {
5605
5605
  super(), this.reader = e;
5606
5606
  }
@@ -5625,7 +5625,7 @@ class Y0 extends X0 {
5625
5625
  return t.done && (this.endOfStream = t.done), t.value ? (e.set(t.value), t.value.length) : 0;
5626
5626
  }
5627
5627
  }
5628
- class b0 extends _0 {
5628
+ class b0 extends D0 {
5629
5629
  constructor(e) {
5630
5630
  super(), this.reader = e, this.buffer = null;
5631
5631
  }
@@ -5940,12 +5940,12 @@ function ne(i, e) {
5940
5940
  function ce(i, e) {
5941
5941
  return new ae(i, e);
5942
5942
  }
5943
- var Z = { exports: {} }, Q, g0;
5943
+ var Z = { exports: {} }, $, g0;
5944
5944
  function se() {
5945
- if (g0) return Q;
5945
+ if (g0) return $;
5946
5946
  g0 = 1;
5947
5947
  var i = 1e3, e = i * 60, x = e * 60, t = x * 24, a = t * 7, n = t * 365.25;
5948
- Q = function(d, r) {
5948
+ $ = function(d, r) {
5949
5949
  r = r || {};
5950
5950
  var c = typeof d;
5951
5951
  if (c === "string" && d.length > 0)
@@ -6020,7 +6020,7 @@ function se() {
6020
6020
  var h = r >= c * 1.5;
6021
6021
  return Math.round(d / c) + " " + u + (h ? "s" : "");
6022
6022
  }
6023
- return Q;
6023
+ return $;
6024
6024
  }
6025
6025
  var X, w0;
6026
6026
  function oe() {
@@ -6045,16 +6045,16 @@ function oe() {
6045
6045
  const l = k, p = Number(/* @__PURE__ */ new Date()), w = p - (c || p);
6046
6046
  l.diff = w, l.prev = c, l.curr = p, c = p, b[0] = t.coerce(b[0]), typeof b[0] != "string" && b.unshift("%O");
6047
6047
  let y = 0;
6048
- b[0] = b[0].replace(/%([a-zA-Z%])/g, (v, A) => {
6049
- if (v === "%%")
6048
+ b[0] = b[0].replace(/%([a-zA-Z%])/g, (C, L) => {
6049
+ if (C === "%%")
6050
6050
  return "%";
6051
6051
  y++;
6052
- const j = t.formatters[A];
6052
+ const j = t.formatters[L];
6053
6053
  if (typeof j == "function") {
6054
6054
  const z = b[y];
6055
- v = j.call(l, z), b.splice(y, 1), y--;
6055
+ C = j.call(l, z), b.splice(y, 1), y--;
6056
6056
  }
6057
- return v;
6057
+ return C;
6058
6058
  }), t.formatArgs.call(l, b), (l.log || t.log).apply(l, b);
6059
6059
  }
6060
6060
  return k.namespace = r, k.useColors = t.useColors(), k.color = t.selectColor(r), k.extend = a, k.destroy = t.destroy, Object.defineProperty(k, "enabled", {
@@ -6257,7 +6257,7 @@ function fe() {
6257
6257
  })(Z, Z.exports)), Z.exports;
6258
6258
  }
6259
6259
  var de = fe();
6260
- const le = /* @__PURE__ */ S0(de), q = {
6260
+ const le = /* @__PURE__ */ F0(de), q = {
6261
6261
  LocalFileHeader: 67324752,
6262
6262
  DataDescriptor: 134695760,
6263
6263
  CentralFileHeader: 33639248,
@@ -6265,24 +6265,24 @@ const le = /* @__PURE__ */ S0(de), q = {
6265
6265
  }, y0 = {
6266
6266
  get(i) {
6267
6267
  return {
6268
- signature: _.get(i, 0),
6269
- compressedSize: _.get(i, 8),
6270
- uncompressedSize: _.get(i, 12)
6268
+ signature: D.get(i, 0),
6269
+ compressedSize: D.get(i, 8),
6270
+ uncompressedSize: D.get(i, 12)
6271
6271
  };
6272
6272
  },
6273
6273
  len: 16
6274
6274
  }, ue = {
6275
6275
  get(i) {
6276
- const e = S.get(i, 6);
6276
+ const e = F.get(i, 6);
6277
6277
  return {
6278
- signature: _.get(i, 0),
6279
- minVersion: S.get(i, 4),
6278
+ signature: D.get(i, 0),
6279
+ minVersion: F.get(i, 4),
6280
6280
  dataDescriptor: !!(e & 8),
6281
- compressedMethod: S.get(i, 8),
6282
- compressedSize: _.get(i, 18),
6283
- uncompressedSize: _.get(i, 22),
6284
- filenameLength: S.get(i, 26),
6285
- extraFieldLength: S.get(i, 28),
6281
+ compressedMethod: F.get(i, 8),
6282
+ compressedSize: D.get(i, 18),
6283
+ uncompressedSize: D.get(i, 22),
6284
+ filenameLength: F.get(i, 26),
6285
+ extraFieldLength: F.get(i, 28),
6286
6286
  filename: null
6287
6287
  };
6288
6288
  },
@@ -6290,41 +6290,41 @@ const le = /* @__PURE__ */ S0(de), q = {
6290
6290
  }, me = {
6291
6291
  get(i) {
6292
6292
  return {
6293
- signature: _.get(i, 0),
6294
- nrOfThisDisk: S.get(i, 4),
6295
- nrOfThisDiskWithTheStart: S.get(i, 6),
6296
- nrOfEntriesOnThisDisk: S.get(i, 8),
6297
- nrOfEntriesOfSize: S.get(i, 10),
6298
- sizeOfCd: _.get(i, 12),
6299
- offsetOfStartOfCd: _.get(i, 16),
6300
- zipFileCommentLength: S.get(i, 20)
6293
+ signature: D.get(i, 0),
6294
+ nrOfThisDisk: F.get(i, 4),
6295
+ nrOfThisDiskWithTheStart: F.get(i, 6),
6296
+ nrOfEntriesOnThisDisk: F.get(i, 8),
6297
+ nrOfEntriesOfSize: F.get(i, 10),
6298
+ sizeOfCd: D.get(i, 12),
6299
+ offsetOfStartOfCd: D.get(i, 16),
6300
+ zipFileCommentLength: F.get(i, 20)
6301
6301
  };
6302
6302
  },
6303
6303
  len: 22
6304
6304
  }, pe = {
6305
6305
  get(i) {
6306
- const e = S.get(i, 8);
6306
+ const e = F.get(i, 8);
6307
6307
  return {
6308
- signature: _.get(i, 0),
6309
- minVersion: S.get(i, 6),
6308
+ signature: D.get(i, 0),
6309
+ minVersion: F.get(i, 6),
6310
6310
  dataDescriptor: !!(e & 8),
6311
- compressedMethod: S.get(i, 10),
6312
- compressedSize: _.get(i, 20),
6313
- uncompressedSize: _.get(i, 24),
6314
- filenameLength: S.get(i, 28),
6315
- extraFieldLength: S.get(i, 30),
6316
- fileCommentLength: S.get(i, 32),
6317
- relativeOffsetOfLocalHeader: _.get(i, 42),
6311
+ compressedMethod: F.get(i, 10),
6312
+ compressedSize: D.get(i, 20),
6313
+ uncompressedSize: D.get(i, 24),
6314
+ filenameLength: F.get(i, 28),
6315
+ extraFieldLength: F.get(i, 30),
6316
+ fileCommentLength: F.get(i, 32),
6317
+ relativeOffsetOfLocalHeader: D.get(i, 42),
6318
6318
  filename: null
6319
6319
  };
6320
6320
  },
6321
6321
  len: 46
6322
6322
  };
6323
- function D0(i) {
6324
- const e = new Uint8Array(_.len);
6325
- return _.put(e, 0, i), e;
6323
+ function _0(i) {
6324
+ const e = new Uint8Array(D.len);
6325
+ return D.put(e, 0, i), e;
6326
6326
  }
6327
- const T = le("tokenizer:inflate"), Y = 256 * 1024, he = D0(q.DataDescriptor), $ = D0(q.EndOfCentralDirectory);
6327
+ const T = le("tokenizer:inflate"), Y = 256 * 1024, he = _0(q.DataDescriptor), Q = _0(q.EndOfCentralDirectory);
6328
6328
  class a0 {
6329
6329
  constructor(e) {
6330
6330
  this.tokenizer = e, this.syncBuffer = new Uint8Array(Y);
@@ -6333,13 +6333,13 @@ class a0 {
6333
6333
  return await this.peekSignature() === q.LocalFileHeader;
6334
6334
  }
6335
6335
  peekSignature() {
6336
- return this.tokenizer.peekToken(_);
6336
+ return this.tokenizer.peekToken(D);
6337
6337
  }
6338
6338
  async findEndOfCentralDirectoryLocator() {
6339
6339
  const e = this.tokenizer, x = Math.min(16 * 1024, e.fileInfo.size), t = this.syncBuffer.subarray(0, x);
6340
6340
  await this.tokenizer.readBuffer(t, { position: e.fileInfo.size - x });
6341
6341
  for (let a = t.length - 4; a >= 0; a--)
6342
- if (t[a] === $[0] && t[a + 1] === $[1] && t[a + 2] === $[2] && t[a + 3] === $[3])
6342
+ if (t[a] === Q[0] && t[a + 1] === Q[1] && t[a + 2] === Q[2] && t[a + 3] === Q[3])
6343
6343
  return e.fileInfo.size - x + a;
6344
6344
  return -1;
6345
6345
  }
@@ -6437,7 +6437,7 @@ class a0 {
6437
6437
  }
6438
6438
  }
6439
6439
  async readLocalFileHeader() {
6440
- const e = await this.tokenizer.peekToken(_);
6440
+ const e = await this.tokenizer.peekToken(D);
6441
6441
  if (e === q.LocalFileHeader) {
6442
6442
  const x = await this.tokenizer.readToken(ue);
6443
6443
  return x.filename = await this.tokenizer.readToken(new U(x.filenameLength, "utf-8")), x;
@@ -6491,7 +6491,7 @@ class we {
6491
6491
  new globalThis.TextDecoder("utf8");
6492
6492
  new globalThis.TextEncoder();
6493
6493
  Array.from({ length: 256 }, (i, e) => e.toString(16).padStart(2, "0"));
6494
- function C0(i) {
6494
+ function v0(i) {
6495
6495
  const { byteLength: e } = i;
6496
6496
  if (e === 6)
6497
6497
  return i.getUint16(0) * 2 ** 32 + i.getUint32(2);
@@ -6536,10 +6536,10 @@ function ye(i, e = 0) {
6536
6536
  t += i[a];
6537
6537
  return x === t;
6538
6538
  }
6539
- const Ce = {
6539
+ const ve = {
6540
6540
  get: (i, e) => i[e + 3] & 127 | i[e + 2] << 7 | i[e + 1] << 14 | i[e] << 21,
6541
6541
  len: 4
6542
- }, ve = [
6542
+ }, Ce = [
6543
6543
  "jpg",
6544
6544
  "png",
6545
6545
  "apng",
@@ -6720,7 +6720,7 @@ const Ce = {
6720
6720
  "tar.gz",
6721
6721
  "reg",
6722
6722
  "dat"
6723
- ], Fe = [
6723
+ ], Se = [
6724
6724
  "image/jpeg",
6725
6725
  "image/png",
6726
6726
  "image/gif",
@@ -6904,8 +6904,8 @@ const Ce = {
6904
6904
  "application/x-ft-windows-registry-hive",
6905
6905
  "application/x-jmp-data"
6906
6906
  ], e0 = 4100;
6907
- async function Se(i, e) {
6908
- return new _e(e).fromBuffer(i);
6907
+ async function Fe(i, e) {
6908
+ return new De(e).fromBuffer(i);
6909
6909
  }
6910
6910
  function x0(i) {
6911
6911
  switch (i = i.toLowerCase(), i) {
@@ -7049,7 +7049,7 @@ function M(i, e, x) {
7049
7049
  return !1;
7050
7050
  return !0;
7051
7051
  }
7052
- class _e {
7052
+ class De {
7053
7053
  constructor(e) {
7054
7054
  this.options = {
7055
7055
  mpegOffsetTolerance: 0,
@@ -7216,7 +7216,7 @@ class _e {
7216
7216
  };
7217
7217
  if (this.checkString("ID3")) {
7218
7218
  await e.ignore(6);
7219
- const x = await e.readToken(Ce);
7219
+ const x = await e.readToken(ve);
7220
7220
  return e.position + x > e.fileInfo.size ? {
7221
7221
  ext: "mp3",
7222
7222
  mime: "audio/mpeg"
@@ -7442,8 +7442,8 @@ class _e {
7442
7442
  o[0] ^= 128 >> o.length - 1;
7443
7443
  const f = Math.min(6, o.length), d = new DataView(m.buffer), r = new DataView(o.buffer, o.length - f, f);
7444
7444
  return {
7445
- id: C0(d),
7446
- len: C0(r)
7445
+ id: v0(d),
7446
+ len: v0(r)
7447
7447
  };
7448
7448
  }
7449
7449
  async function a(m) {
@@ -8061,7 +8061,7 @@ class _e {
8061
8061
  }
8062
8062
  };
8063
8063
  async readTiffTag(e) {
8064
- const x = await this.tokenizer.readToken(e ? W : S);
8064
+ const x = await this.tokenizer.readToken(e ? W : F);
8065
8065
  switch (this.tokenizer.ignore(10), x) {
8066
8066
  case 50341:
8067
8067
  return {
@@ -8076,7 +8076,7 @@ class _e {
8076
8076
  }
8077
8077
  }
8078
8078
  async readTiffIFD(e) {
8079
- const x = await this.tokenizer.readToken(e ? W : S);
8079
+ const x = await this.tokenizer.readToken(e ? W : F);
8080
8080
  for (let t = 0; t < x; ++t) {
8081
8081
  const a = await this.readTiffTag(e);
8082
8082
  if (a)
@@ -8084,7 +8084,7 @@ class _e {
8084
8084
  }
8085
8085
  }
8086
8086
  async readTiffHeader(e) {
8087
- const x = (e ? W : S).get(this.buffer, 2), t = (e ? J0 : _).get(this.buffer, 4);
8087
+ const x = (e ? W : F).get(this.buffer, 2), t = (e ? J0 : D).get(this.buffer, 4);
8088
8088
  if (x === 42) {
8089
8089
  if (t >= 6) {
8090
8090
  if (this.checkString("CR", { offset: 8 }))
@@ -8093,7 +8093,7 @@ class _e {
8093
8093
  mime: "image/x-canon-cr2"
8094
8094
  };
8095
8095
  if (t >= 8) {
8096
- const n = (e ? W : S).get(this.buffer, 8), s = (e ? W : S).get(this.buffer, 10);
8096
+ const n = (e ? W : F).get(this.buffer, 8), s = (e ? W : F).get(this.buffer, 10);
8097
8097
  if (n === 28 && s === 254 || n === 31 && s === 11)
8098
8098
  return {
8099
8099
  ext: "nef",
@@ -8146,35 +8146,34 @@ class _e {
8146
8146
  }
8147
8147
  }
8148
8148
  }
8149
- new Set(ve);
8150
- new Set(Fe);
8151
- class De extends Error {
8149
+ new Set(Ce);
8150
+ new Set(Se);
8151
+ class _e extends Error {
8152
8152
  locator;
8153
8153
  /** Logical source of the error. */
8154
8154
  constructor(e, x, t) {
8155
8155
  super(e, t), this.name = new.target.name, this.locator = x;
8156
8156
  }
8157
8157
  }
8158
- class Be extends De {
8159
- }
8160
- let Ie = class extends Be {
8158
+ let Be = class extends _e {
8159
+ }, Ie = class extends Be {
8161
8160
  body;
8162
8161
  /** Sanitized HTTP response body. */
8163
8162
  constructor(e, x, t, a) {
8164
- super(e, x, a), this.name = new.target.name, this.body = Le(t ?? void 0);
8163
+ super(e, x, a), this.name = new.target.name, this.body = Ee(t ?? void 0);
8165
8164
  }
8166
8165
  };
8167
- async function Oe(i, e, x) {
8166
+ async function Ae(i, e, x) {
8168
8167
  const t = ` - ${i.statusText}`, a = `${e} Response status '${i.status}${i.statusText ? t : ""}' received.`;
8169
8168
  let n;
8170
8169
  try {
8171
8170
  n = await i.text();
8172
8171
  } catch (s) {
8173
- n = `<body unavailable: ${Ee(s).message}>`;
8172
+ n = `<body unavailable: ${Oe(s).message}>`;
8174
8173
  }
8175
8174
  return new Ie(a, x, n);
8176
8175
  }
8177
- function Ee(i) {
8176
+ function Oe(i) {
8178
8177
  if (i instanceof Error) return i;
8179
8178
  if (typeof i == "string") return new Error(i);
8180
8179
  if (typeof i == "number" || typeof i == "boolean" || typeof i == "bigint") return new Error(String(i));
@@ -8187,12 +8186,12 @@ function Ee(i) {
8187
8186
  }
8188
8187
  return new Error("Unknown error");
8189
8188
  }
8190
- function Le(i) {
8189
+ function Ee(i) {
8191
8190
  if (!(i == null || i === ""))
8192
8191
  return i.length > 2048 ? `${i.slice(0, 2048)}... [truncated]` : i;
8193
8192
  }
8194
- const Ae = { id: "ascii", groupLabel: "", label: "ascii", isDetectable: !1, isDecodable: !0 }, Te = { id: "big5", groupLabel: "Chinese Traditional", label: "Chinese Traditional (big5)", isDetectable: !0, isDecodable: !0 }, Me = { id: "gb18030", groupLabel: "Chinese Simplified", label: "Chinese Simplified (gb18030)", isDetectable: !0, isDecodable: !0 }, ze = { id: "gbk", groupLabel: "Chinese Simplified", label: "Chinese Simplified (gbk)", isDetectable: !1, isDecodable: !0 }, Ue = { id: "ibm866", groupLabel: "Cyrillic", label: "Cyrillic (ibm866)", isDetectable: !1, isDecodable: !0 }, je = { id: "latin1", groupLabel: "Western", label: "Western (latin1)", isDetectable: !1, isDecodable: !0 }, Re = { id: "macintosh", groupLabel: "Western", label: "Western (macintosh)", isDetectable: !1, isDecodable: !0 }, Pe = { id: "shift_jis", groupLabel: "Japanese", label: "Japanese (shift_jis)", isDetectable: !0, isDecodable: !0 }, qe = { id: "utf16", groupLabel: "Unicode 16", label: "Unicode 16 (utf16)", isDetectable: !1, isDecodable: !0 }, Ne = { id: "utf16be", groupLabel: "Unicode 16", label: "Unicode 16 (utf16be)", isDetectable: !0, isDecodable: !0 }, Ve = { id: "utf16le", groupLabel: "Unicode 16", label: "Unicode 16 (utf16le)", isDetectable: !0, isDecodable: !0 }, He = { id: "utf32be", groupLabel: "Unicode 32", label: "Unicode 32 (utf32be)", isDetectable: !0, isDecodable: !1 }, We = { id: "utf32le", groupLabel: "Unicode 32", label: "Unicode 32 (utf32le)", isDetectable: !0, isDecodable: !1 }, Ge = { id: "utf8", groupLabel: "", label: "utf8", isDetectable: !0, isDecodable: !0 }, Je = {
8195
- ascii: Ae,
8193
+ const Le = { id: "ascii", groupLabel: "", label: "ascii", isDetectable: !1, isDecodable: !0 }, Te = { id: "big5", groupLabel: "Chinese Traditional", label: "Chinese Traditional (big5)", isDetectable: !0, isDecodable: !0 }, Me = { id: "gb18030", groupLabel: "Chinese Simplified", label: "Chinese Simplified (gb18030)", isDetectable: !0, isDecodable: !0 }, ze = { id: "gbk", groupLabel: "Chinese Simplified", label: "Chinese Simplified (gbk)", isDetectable: !1, isDecodable: !0 }, Ue = { id: "ibm866", groupLabel: "Cyrillic", label: "Cyrillic (ibm866)", isDetectable: !1, isDecodable: !0 }, je = { id: "latin1", groupLabel: "Western", label: "Western (latin1)", isDetectable: !1, isDecodable: !0 }, Re = { id: "macintosh", groupLabel: "Western", label: "Western (macintosh)", isDetectable: !1, isDecodable: !0 }, Pe = { id: "shift_jis", groupLabel: "Japanese", label: "Japanese (shift_jis)", isDetectable: !0, isDecodable: !0 }, qe = { id: "utf16", groupLabel: "Unicode 16", label: "Unicode 16 (utf16)", isDetectable: !1, isDecodable: !0 }, Ne = { id: "utf16be", groupLabel: "Unicode 16", label: "Unicode 16 (utf16be)", isDetectable: !0, isDecodable: !0 }, Ve = { id: "utf16le", groupLabel: "Unicode 16", label: "Unicode 16 (utf16le)", isDetectable: !0, isDecodable: !0 }, He = { id: "utf32be", groupLabel: "Unicode 32", label: "Unicode 32 (utf32be)", isDetectable: !0, isDecodable: !1 }, We = { id: "utf32le", groupLabel: "Unicode 32", label: "Unicode 32 (utf32le)", isDetectable: !0, isDecodable: !1 }, Ge = { id: "utf8", groupLabel: "", label: "utf8", isDetectable: !0, isDecodable: !0 }, Je = {
8194
+ ascii: Le,
8196
8195
  big5: Te,
8197
8196
  "euc-jp": { id: "euc-jp", groupLabel: "Japanese", label: "Japanese (euc-jp)", isDetectable: !0, isDecodable: !0 },
8198
8197
  "euc-kr": { id: "euc-kr", groupLabel: "Korean", label: "Korean (euc-kr)", isDetectable: !0, isDecodable: !0 },
@@ -8241,49 +8240,86 @@ const Ae = { id: "ascii", groupLabel: "", label: "ascii", isDetectable: !1, isDe
8241
8240
  "windows-874": { id: "windows-874", groupLabel: "Thai", label: "Thai (windows-874)", isDetectable: !1, isDecodable: !0 },
8242
8241
  "x-mac-cyrillic": { id: "x-mac-cyrillic", groupLabel: "Cyrillic", label: "Cyrillic (x-mac-cyrillic)", isDetectable: !1, isDecodable: !0 },
8243
8242
  "x-user-defined": { id: "x-user-defined", groupLabel: "Other", label: "Other (x-user-defined)", isDetectable: !1, isDecodable: !0 }
8244
- }, Ke = 4096, v0 = { id: "utf8", confidenceLevel: void 0 };
8245
- class xx {
8243
+ }, Ke = Je, Ze = 4096, C0 = { id: "utf8", confidenceLevel: void 0 }, Qe = {
8244
+ arrow: { label: "Columnar format for tables of data.", isAutoDetectable: !0, isSupported: !1, notes: "" },
8245
+ avro: { label: "Object container file developed by Apache Avro.", isAutoDetectable: !0, isSupported: !1, notes: "" },
8246
+ docx: { label: "Microsoft Word document.", isAutoDetectable: !0, isSupported: !1, notes: "" },
8247
+ ics: { label: "iCalendar.", isAutoDetectable: !0, isSupported: !1, notes: "" },
8248
+ jmp: { label: "JMP data file format by SAS Institute.", isAutoDetectable: !0, isSupported: !1, notes: "" },
8249
+ json: { label: "JavaScript object notation.", isAutoDetectable: !1, isSupported: !1, notes: "" },
8250
+ ods: { label: "OpenDocument for spreadsheets.", isAutoDetectable: !0, isSupported: !1, notes: "" },
8251
+ ots: { label: "OpenDocument for word processing.", isAutoDetectable: !0, isSupported: !1, notes: "" },
8252
+ parquet: { label: "Apache Parquet.", isAutoDetectable: !0, isSupported: !1, notes: "" },
8253
+ pcap: { label: "Libpcap file format.", isAutoDetectable: !0, isSupported: !1, notes: "" },
8254
+ pdf: { label: "Portable document format.", isAutoDetectable: !0, isSupported: !1, notes: "" },
8255
+ por: { label: "SPSS portable file.", isAutoDetectable: !1, isSupported: !1, magicBytes: [83, 80, 83, 83, 80, 79, 82, 84], notes: "" },
8256
+ sav: { label: "SPSS statistical data file.", isAutoDetectable: !0, isSupported: !1, magicBytes: [36, 70, 76, 50], notes: "" },
8257
+ shp: { label: "Geospatial vector data format.", isAutoDetectable: !0, isSupported: !1, notes: "" },
8258
+ sqlite: { label: "SQLite file.", isAutoDetectable: !0, isSupported: !1, notes: "" },
8259
+ vcf: { label: "vCard.", isAutoDetectable: !0, isSupported: !1, notes: "" },
8260
+ vtt: { label: "WebVTT File (for video captions).", isAutoDetectable: !0, isSupported: !1, notes: "" },
8261
+ xls: { label: "Microsoft Excel legacy document.", isAutoDetectable: !1, isSupported: !1, magicBytes: [208, 207, 17, 224, 161, 177, 26, 225], notes: "" },
8262
+ xlsx: { label: "Microsoft Excel document.", isAutoDetectable: !0, isSupported: !1, magicBytes: [80, 75, 3, 4], notes: "" },
8263
+ xlsm: { label: "Microsoft Excel macro-enabled document.", isAutoDetectable: !0, isSupported: !1, notes: "" },
8264
+ xltx: { label: "Microsoft Excel template.", isAutoDetectable: !0, isSupported: !1, notes: "" },
8265
+ xltm: { label: "Microsoft Excel macro-enabled template.", isAutoDetectable: !0, isSupported: !1, notes: "" },
8266
+ xml: { label: "eXtensible markup language.", isAutoDetectable: !0, isSupported: !1, notes: "" }
8267
+ };
8268
+ class rx {
8246
8269
  /**
8247
- * Preview remote file.
8270
+ * Preview file.
8248
8271
  */
8249
- async previewRemoteFile(e, x, t) {
8250
- const a = await fetch(encodeURI(e), { headers: { Range: `bytes=0-${t ?? Ke - 1}` }, signal: x });
8272
+ async previewFile(e, x, t) {
8273
+ const a = await fetch(encodeURI(e), { headers: { Range: `bytes=0-${t ?? Ze - 1}` }, signal: x });
8251
8274
  if (!a.ok)
8252
- throw await Oe(a, `Failed to fetch '${e}' file.`, "datapos-tool-file-operators.previewRemoteFile");
8253
- const n = new Uint8Array(await a.arrayBuffer()), s = await Se(n);
8254
- if (s && !s.mime.startsWith("text/"))
8255
- throw new Error(`Files of type '${s.ext}' (mine '${s.mime}') not supported.`);
8256
- return Ze(n);
8275
+ throw await Ae(a, `Failed to fetch '${e}' file.`, "datapos-tool-file-operators.previewRemoteFile");
8276
+ const n = new Uint8Array(await a.arrayBuffer());
8277
+ return await $e(n);
8257
8278
  }
8258
8279
  }
8259
- function Ze(i) {
8260
- const e = $e(i), x = Qe(i, e);
8261
- return {
8280
+ async function $e(i) {
8281
+ let e;
8282
+ const x = await Fe(i);
8283
+ if (x == null)
8284
+ e = "dtv";
8285
+ else {
8286
+ const n = Qe[x.ext];
8287
+ n == null ? e = x.mime.startsWith("text/") ? "dtv" : void 0 : n.isSupported ? e = x.ext : e = void 0;
8288
+ }
8289
+ const t = Xe(i), a = Ye(i, t);
8290
+ return e == null && ex(a.text) && (e = "json"), {
8262
8291
  bytes: i,
8263
- dataFormatId: "dtv",
8264
- encodingId: x.encoding.id,
8265
- encodingConfidenceLevel: x.encoding.confidenceLevel,
8266
- size: i.length,
8267
- text: x.text
8292
+ dataFormatId: e,
8293
+ encodingId: a.encoding.id,
8294
+ encodingConfidenceLevel: a.encoding.confidenceLevel,
8295
+ text: a.text
8268
8296
  };
8269
8297
  }
8270
- function $e(i) {
8298
+ function Xe(i) {
8271
8299
  if (i[0] === 239 && i[1] === 187 && i[2] === 191) return { confidenceLevel: 100, id: "utf8" };
8272
8300
  if (i[0] === 254 && i[1] === 255) return { confidenceLevel: 100, id: "utf-16be" };
8273
8301
  if (i[0] === 255 && i[1] === 254) return { confidenceLevel: 100, id: "utf-16le" };
8274
- const x = j0.analyse(i)[0] ?? { confidence: void 0, name: "utf8" }, t = Je[x.name.toLowerCase()], a = t == null ? "utf8" : t.id;
8302
+ const x = j0.analyse(i)[0] ?? { confidence: void 0, name: "utf8" }, t = Ke[x.name.toLowerCase()], a = t == null ? "utf8" : t.id;
8275
8303
  return { confidenceLevel: x.confidence, id: a };
8276
8304
  }
8277
- function Qe(i, e) {
8305
+ function Ye(i, e) {
8278
8306
  try {
8279
- const x = new TextDecoder(e.id).decode(F0(i));
8307
+ const x = new TextDecoder(e.id).decode(S0(i));
8280
8308
  return { encoding: e, text: x };
8281
8309
  } catch {
8282
- const x = new TextDecoder(v0.id, { fatal: !1 }).decode(F0(i));
8283
- return { encoding: v0, text: x };
8310
+ const x = new TextDecoder(C0.id, { fatal: !1 }).decode(S0(i));
8311
+ return { encoding: C0, text: x };
8284
8312
  }
8285
8313
  }
8286
- function F0(i) {
8314
+ function ex(i) {
8315
+ const e = i.trimStart();
8316
+ if (e.length > 2) {
8317
+ const x = e[0], t = x === "{", a = x === "[", n = /"\s*:\s*/.test(e), s = /\b(true|false|null)\b/.test(e), m = e.includes('"');
8318
+ return (t || a) && (n || s || m);
8319
+ }
8320
+ return !1;
8321
+ }
8322
+ function S0(i) {
8287
8323
  let e = i;
8288
8324
  const x = e.length;
8289
8325
  for (let t = x - 1; t >= 0; t--) {
@@ -8304,5 +8340,5 @@ function F0(i) {
8304
8340
  return e;
8305
8341
  }
8306
8342
  export {
8307
- xx as Tool
8343
+ rx as Tool
8308
8344
  };
@@ -1,16 +1,18 @@
1
1
  import { DataFormatId } from '@datapos/datapos-shared';
2
2
  interface PreviewConfig {
3
3
  bytes: Uint8Array;
4
- dataFormatId: DataFormatId;
4
+ dataFormatId: DataFormatId | undefined;
5
5
  encodingId: string | undefined;
6
6
  encodingConfidenceLevel: number | undefined;
7
- size: number;
8
7
  text: string;
9
8
  }
9
+ /**
10
+ * Tool.
11
+ */
10
12
  declare class Tool {
11
13
  /**
12
- * Preview remote file.
14
+ * Preview file.
13
15
  */
14
- previewRemoteFile(url: string, signal: AbortSignal, chunkSize?: number): Promise<PreviewConfig>;
16
+ previewFile(url: string, signal: AbortSignal, chunkSize?: number): Promise<PreviewConfig>;
15
17
  }
16
18
  export { type PreviewConfig, Tool };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datapos/datapos-tool-file-operators",
3
- "version": "0.0.5",
3
+ "version": "0.0.7",
4
4
  "description": "",
5
5
  "license": "MIT",
6
6
  "private": false,
@@ -65,7 +65,7 @@
65
65
  "update": "node -e \"import('@datapos/datapos-development').then(m => m.updateDataPosDependencies(['development']))\""
66
66
  },
67
67
  "dependencies": {
68
- "@datapos/datapos-shared": "^0.3.430",
68
+ "@datapos/datapos-shared": "^0.3.434",
69
69
  "chardet": "^2.1.1",
70
70
  "file-type": "^21.2.0"
71
71
  }