document-model 1.1.0-experimental.4 → 1.1.0

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.
Files changed (102) hide show
  1. package/dist/browser/cjs/document-model.js +1 -1
  2. package/dist/browser/cjs/document.js +1 -1
  3. package/dist/browser/cjs/index.js +1 -1
  4. package/dist/browser/cjs/internal/{index-BTG_-qY6.js → index-Bqu_Uzaf.js} +1 -1
  5. package/dist/{node/cjs/internal/index-B31DqWHj.js → browser/cjs/internal/index-DD_uV5_l.js} +1 -1
  6. package/dist/browser/cjs/internal/object-CHFtJl_E.js +25 -0
  7. package/dist/browser/es/document-model.js +2 -2
  8. package/dist/browser/es/document.js +2 -2
  9. package/dist/browser/es/index.js +3 -3
  10. package/dist/browser/es/internal/{index-BD2hB9El.js → index-C9_nWw6z.js} +1 -1
  11. package/dist/browser/es/internal/{index-2Qq00NLA.js → index-CNILoLzv.js} +1 -1
  12. package/dist/browser/es/internal/{object-BW-G4r5m.js → object-CJvDhUxl.js} +1105 -1065
  13. package/dist/browser/src/document/object.d.ts +35 -0
  14. package/dist/browser/src/document/types.d.ts +2 -0
  15. package/dist/browser/src/document/utils/document-helpers.d.ts +9 -0
  16. package/dist/node/cjs/document-model.js +1 -1
  17. package/dist/node/cjs/document.js +1 -1
  18. package/dist/node/cjs/index.js +1 -1
  19. package/dist/node/cjs/internal/{index-BBm_wnUa.js → index-DSsY5px9.js} +1 -1
  20. package/dist/{browser/cjs/internal/index-BLpgsifL.js → node/cjs/internal/index-eJODAZgf.js} +1 -1
  21. package/dist/node/cjs/internal/object-9bv72oJK.js +20 -0
  22. package/dist/node/es/document-model.js +2 -2
  23. package/dist/node/es/document.js +2 -2
  24. package/dist/node/es/index.js +3 -3
  25. package/dist/node/es/internal/{index-C7I4OGkU.js → index-Dug-2E00.js} +1 -1
  26. package/dist/node/es/internal/{index-BPCSW4M1.js → index-nccvxxIw.js} +1 -1
  27. package/dist/node/es/internal/{object-C-_SkpQ0.js → object-B9OVOSMl.js} +762 -722
  28. package/dist/node/src/document/object.d.ts +35 -0
  29. package/dist/node/src/document/types.d.ts +2 -0
  30. package/dist/node/src/document/utils/document-helpers.d.ts +9 -0
  31. package/package.json +3 -1
  32. package/CHANGELOG.md +0 -33
  33. package/dist/browser/cjs/internal/object-BHB7lY3H.js +0 -25
  34. package/dist/node/cjs/internal/object-CxVzP-Xe.js +0 -20
  35. package/dist/src/document/actions/creators.d.ts +0 -47
  36. package/dist/src/document/actions/index.d.ts +0 -14
  37. package/dist/src/document/actions/types.d.ts +0 -15
  38. package/dist/src/document/index.d.ts +0 -6
  39. package/dist/src/document/object.d.ts +0 -1210
  40. package/dist/src/document/reducer.d.ts +0 -60
  41. package/dist/src/document/schema/index.d.ts +0 -2
  42. package/dist/src/document/schema/types.d.ts +0 -176
  43. package/dist/src/document/schema/zod.d.ts +0 -113
  44. package/dist/src/document/signal.d.ts +0 -29
  45. package/dist/src/document/types.d.ts +0 -255
  46. package/dist/src/document/utils/base.d.ts +0 -86
  47. package/dist/src/document/utils/document-helpers.d.ts +0 -53
  48. package/dist/src/document/utils/file.d.ts +0 -48
  49. package/dist/src/document/utils/index.d.ts +0 -5
  50. package/dist/src/document/utils/node.d.ts +0 -9
  51. package/dist/src/document/utils/validation.d.ts +0 -2
  52. package/dist/src/document-model/custom/reducers/header.d.ts +0 -2
  53. package/dist/src/document-model/custom/reducers/module.d.ts +0 -2
  54. package/dist/src/document-model/custom/reducers/operation-error.d.ts +0 -2
  55. package/dist/src/document-model/custom/reducers/operation-example.d.ts +0 -2
  56. package/dist/src/document-model/custom/reducers/operation.d.ts +0 -2
  57. package/dist/src/document-model/custom/reducers/state.d.ts +0 -2
  58. package/dist/src/document-model/custom/reducers/versioning.d.ts +0 -7
  59. package/dist/src/document-model/custom/utils.d.ts +0 -7
  60. package/dist/src/document-model/gen/actions.d.ts +0 -15
  61. package/dist/src/document-model/gen/creators.d.ts +0 -7
  62. package/dist/src/document-model/gen/document-model.d.ts +0 -2
  63. package/dist/src/document-model/gen/header/actions.d.ts +0 -9
  64. package/dist/src/document-model/gen/header/creators.d.ts +0 -8
  65. package/dist/src/document-model/gen/header/object.d.ts +0 -12
  66. package/dist/src/document-model/gen/header/operations.d.ts +0 -10
  67. package/dist/src/document-model/gen/index.d.ts +0 -5
  68. package/dist/src/document-model/gen/module/actions.d.ts +0 -8
  69. package/dist/src/document-model/gen/module/creators.d.ts +0 -7
  70. package/dist/src/document-model/gen/module/object.d.ts +0 -11
  71. package/dist/src/document-model/gen/module/operations.d.ts +0 -9
  72. package/dist/src/document-model/gen/object.d.ts +0 -28
  73. package/dist/src/document-model/gen/operation/actions.d.ts +0 -13
  74. package/dist/src/document-model/gen/operation/creators.d.ts +0 -12
  75. package/dist/src/document-model/gen/operation/object.d.ts +0 -16
  76. package/dist/src/document-model/gen/operation/operations.d.ts +0 -14
  77. package/dist/src/document-model/gen/operation-error/actions.d.ts +0 -10
  78. package/dist/src/document-model/gen/operation-error/creators.d.ts +0 -9
  79. package/dist/src/document-model/gen/operation-error/object.d.ts +0 -13
  80. package/dist/src/document-model/gen/operation-error/operations.d.ts +0 -11
  81. package/dist/src/document-model/gen/operation-example/actions.d.ts +0 -7
  82. package/dist/src/document-model/gen/operation-example/creators.d.ts +0 -6
  83. package/dist/src/document-model/gen/operation-example/object.d.ts +0 -10
  84. package/dist/src/document-model/gen/operation-example/operations.d.ts +0 -8
  85. package/dist/src/document-model/gen/reducer.d.ts +0 -5
  86. package/dist/src/document-model/gen/schema/index.d.ts +0 -2
  87. package/dist/src/document-model/gen/schema/types.d.ts +0 -453
  88. package/dist/src/document-model/gen/schema/zod.d.ts +0 -453
  89. package/dist/src/document-model/gen/state/actions.d.ts +0 -9
  90. package/dist/src/document-model/gen/state/creators.d.ts +0 -8
  91. package/dist/src/document-model/gen/state/object.d.ts +0 -12
  92. package/dist/src/document-model/gen/state/operations.d.ts +0 -10
  93. package/dist/src/document-model/gen/types.d.ts +0 -8
  94. package/dist/src/document-model/gen/utils.d.ts +0 -6
  95. package/dist/src/document-model/gen/versioning/actions.d.ts +0 -8
  96. package/dist/src/document-model/gen/versioning/creators.d.ts +0 -7
  97. package/dist/src/document-model/gen/versioning/object.d.ts +0 -11
  98. package/dist/src/document-model/gen/versioning/operations.d.ts +0 -9
  99. package/dist/src/document-model/index.d.ts +0 -80
  100. package/dist/src/index.d.ts +0 -25
  101. package/dist/vite.config.d.ts +0 -2
  102. package/dist/vitest.config.d.ts +0 -2
@@ -1,29 +1,29 @@
1
- var Ve = Object.defineProperty;
2
- var Ke = (i, r, o) => r in i ? Ve(i, r, { enumerable: !0, configurable: !0, writable: !0, value: o }) : i[r] = o;
3
- var At = (i, r, o) => (Ke(i, typeof r != "symbol" ? r + "" : r, o), o);
4
- import { produce as Bt, castDraft as Ot, castImmutable as Ge, freeze as Ze } from "immer";
1
+ var Ye = Object.defineProperty;
2
+ var Qe = (i, r, o) => r in i ? Ye(i, r, { enumerable: !0, configurable: !0, writable: !0, value: o }) : i[r] = o;
3
+ var Ft = (i, r, o) => (Qe(i, typeof r != "symbol" ? r + "" : r, o), o);
4
+ import { produce as jt, castDraft as It, castImmutable as ti, freeze as ei } from "immer";
5
5
  import { z as _ } from "zod";
6
- import oe from "jszip";
7
- const ae = (i) => i != null, Ye = _.any().refine((i) => ae(i)), se = _.enum(["LOAD_STATE"]), pe = _.enum(["PRUNE"]), ce = _.enum(["REDO"]), le = _.enum(["SET_NAME"]), ue = _.enum(["UNDO"]);
8
- function Qe() {
6
+ import pe from "jszip";
7
+ const ce = (i) => i != null, ii = _.any().refine((i) => ce(i)), le = _.enum(["LOAD_STATE"]), ue = _.enum(["PRUNE"]), fe = _.enum(["REDO"]), he = _.enum(["SET_NAME"]), me = _.enum(["UNDO"]);
8
+ function ri() {
9
9
  return _.object({
10
10
  __typename: _.literal("Action").optional(),
11
11
  type: _.string()
12
12
  });
13
13
  }
14
- function yt() {
14
+ function wt() {
15
15
  return _.literal("global").or(_.literal("local"));
16
16
  }
17
- function fe() {
17
+ function xe() {
18
18
  return _.union([
19
- he(),
20
- xe(),
21
19
  de(),
22
- ge(),
23
- ye()
20
+ ye(),
21
+ we(),
22
+ Ee(),
23
+ be()
24
24
  ]);
25
25
  }
26
- function ti() {
26
+ function ni() {
27
27
  return _.object({
28
28
  __typename: _.literal("DocumentFile").optional(),
29
29
  data: _.string(),
@@ -32,26 +32,26 @@ function ti() {
32
32
  mimeType: _.string()
33
33
  });
34
34
  }
35
- function he() {
35
+ function de() {
36
36
  return _.object({
37
- input: _.lazy(() => zt()),
38
- type: se,
39
- scope: yt()
37
+ input: _.lazy(() => Ht()),
38
+ type: le,
39
+ scope: wt()
40
40
  });
41
41
  }
42
- function zt() {
42
+ function Ht() {
43
43
  return _.object({
44
44
  operations: _.number(),
45
- state: _.lazy(() => me())
45
+ state: _.lazy(() => ge())
46
46
  });
47
47
  }
48
- function me() {
48
+ function ge() {
49
49
  return _.object({
50
50
  data: _.unknown().nullish(),
51
51
  name: _.string()
52
52
  });
53
53
  }
54
- function ei() {
54
+ function oi() {
55
55
  return _.object({
56
56
  __typename: _.literal("Operation").optional(),
57
57
  hash: _.string(),
@@ -60,36 +60,36 @@ function ei() {
60
60
  type: _.string()
61
61
  });
62
62
  }
63
- function xe() {
63
+ function ye() {
64
64
  return _.object({
65
- input: _.lazy(() => qt()),
66
- type: pe,
67
- scope: yt()
65
+ input: _.lazy(() => Jt()),
66
+ type: ue,
67
+ scope: wt()
68
68
  });
69
69
  }
70
- function qt() {
70
+ function Jt() {
71
71
  return _.object({
72
72
  end: _.number().nullish(),
73
73
  start: _.number().nullish()
74
74
  });
75
75
  }
76
- const Ht = _.number;
77
- function de() {
76
+ const Vt = _.number;
77
+ function we() {
78
78
  return _.object({
79
- input: Ht(),
80
- type: ce,
81
- scope: yt()
79
+ input: Vt(),
80
+ type: fe,
81
+ scope: wt()
82
82
  });
83
83
  }
84
- const Jt = _.string;
85
- function ge() {
84
+ const Wt = _.string;
85
+ function Ee() {
86
86
  return _.object({
87
- input: Jt(),
88
- type: le,
87
+ input: Wt(),
88
+ type: he,
89
89
  scope: _.literal("global")
90
90
  });
91
91
  }
92
- function ii() {
92
+ function ai() {
93
93
  return _.object({
94
94
  __typename: _.literal("SetNameOperation").optional(),
95
95
  hash: _.string(),
@@ -99,51 +99,51 @@ function ii() {
99
99
  type: _.string()
100
100
  });
101
101
  }
102
- const Wt = _.number;
103
- function ye() {
102
+ const Xt = _.number;
103
+ function be() {
104
104
  return _.object({
105
- input: Wt(),
106
- type: ue,
107
- scope: yt()
105
+ input: Xt(),
106
+ type: me,
107
+ scope: wt()
108
108
  });
109
109
  }
110
- const gr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
110
+ const Fr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
111
111
  __proto__: null,
112
- ActionSchema: Qe,
113
- BaseActionSchema: fe,
114
- DocumentFileSchema: ti,
115
- LoadStateActionInputSchema: zt,
116
- LoadStateActionSchema: he,
117
- LoadStateActionStateInputSchema: me,
118
- Load_StateSchema: se,
119
- OperationSchema: ei,
120
- OperationScopeSchema: yt,
121
- PruneActionInputSchema: qt,
122
- PruneActionSchema: xe,
123
- PruneSchema: pe,
124
- RedoActionInputSchema: Ht,
125
- RedoActionSchema: de,
126
- RedoSchema: ce,
127
- SetNameActionInputSchema: Jt,
128
- SetNameActionSchema: ge,
129
- SetNameOperationSchema: ii,
130
- Set_NameSchema: le,
131
- UndoActionInputSchema: Wt,
132
- UndoActionSchema: ye,
133
- UndoSchema: ue,
134
- definedNonNullAnySchema: Ye,
135
- isDefinedNonNullAny: ae
112
+ ActionSchema: ri,
113
+ BaseActionSchema: xe,
114
+ DocumentFileSchema: ni,
115
+ LoadStateActionInputSchema: Ht,
116
+ LoadStateActionSchema: de,
117
+ LoadStateActionStateInputSchema: ge,
118
+ Load_StateSchema: le,
119
+ OperationSchema: oi,
120
+ OperationScopeSchema: wt,
121
+ PruneActionInputSchema: Jt,
122
+ PruneActionSchema: ye,
123
+ PruneSchema: ue,
124
+ RedoActionInputSchema: Vt,
125
+ RedoActionSchema: we,
126
+ RedoSchema: fe,
127
+ SetNameActionInputSchema: Wt,
128
+ SetNameActionSchema: Ee,
129
+ SetNameOperationSchema: ai,
130
+ Set_NameSchema: he,
131
+ UndoActionInputSchema: Xt,
132
+ UndoActionSchema: be,
133
+ UndoSchema: me,
134
+ definedNonNullAnySchema: ii,
135
+ isDefinedNonNullAny: ce
136
136
  }, Symbol.toStringTag, { value: "Module" }));
137
- function Xt(i) {
137
+ function Kt(i) {
138
138
  return i && i.__esModule && Object.prototype.hasOwnProperty.call(i, "default") ? i.default : i;
139
139
  }
140
- var Nt = { exports: {} };
140
+ var Rt = { exports: {} };
141
141
  (function(i, r) {
142
- const { hasOwnProperty: o } = Object.prototype, p = Z();
143
- p.configure = Z, p.stringify = p, p.default = p, r.stringify = p, r.configure = Z, i.exports = p;
144
- const u = /[\u0000-\u001f\u0022\u005c\ud800-\udfff]|[\ud800-\udbff](?![\udc00-\udfff])|(?:[^\ud800-\udbff]|^)[\udc00-\udfff]/;
142
+ const { hasOwnProperty: o } = Object.prototype, p = Y();
143
+ p.configure = Y, p.stringify = p, p.default = p, r.stringify = p, r.configure = Y, i.exports = p;
144
+ const l = /[\u0000-\u001f\u0022\u005c\ud800-\udfff]|[\ud800-\udbff](?![\udc00-\udfff])|(?:[^\ud800-\udbff]|^)[\udc00-\udfff]/;
145
145
  function f(w) {
146
- return w.length < 5e3 && !u.test(w) ? `"${w}"` : JSON.stringify(w);
146
+ return w.length < 5e3 && !l.test(w) ? `"${w}"` : JSON.stringify(w);
147
147
  }
148
148
  function c(w) {
149
149
  if (w.length > 200)
@@ -157,7 +157,7 @@ var Nt = { exports: {} };
157
157
  }
158
158
  return w;
159
159
  }
160
- const s = Object.getOwnPropertyDescriptor(
160
+ const a = Object.getOwnPropertyDescriptor(
161
161
  Object.getPrototypeOf(
162
162
  Object.getPrototypeOf(
163
163
  new Int8Array()
@@ -166,14 +166,14 @@ var Nt = { exports: {} };
166
166
  Symbol.toStringTag
167
167
  ).get;
168
168
  function h(w) {
169
- return s.call(w) !== void 0 && w.length !== 0;
169
+ return a.call(w) !== void 0 && w.length !== 0;
170
170
  }
171
171
  function g(w, E, v) {
172
172
  w.length < v && (v = w.length);
173
173
  const M = E === "," ? "" : " ";
174
174
  let J = `"0":${M}${w[0]}`;
175
- for (let W = 1; W < v; W++)
176
- J += `${E}"${W}":${M}${w[W]}`;
175
+ for (let V = 1; V < v; V++)
176
+ J += `${E}"${V}":${M}${w[V]}`;
177
177
  return J;
178
178
  }
179
179
  function y(w) {
@@ -214,7 +214,7 @@ var Nt = { exports: {} };
214
214
  function j(w) {
215
215
  return w === 1 ? "1 item" : `${w} items`;
216
216
  }
217
- function C(w) {
217
+ function U(w) {
218
218
  const E = /* @__PURE__ */ new Set();
219
219
  for (const v of w)
220
220
  (typeof v == "string" || typeof v == "number") && E.add(String(v));
@@ -232,14 +232,14 @@ var Nt = { exports: {} };
232
232
  };
233
233
  }
234
234
  }
235
- function Z(w) {
235
+ function Y(w) {
236
236
  w = { ...w };
237
237
  const E = q(w);
238
238
  E && (w.bigint === void 0 && (w.bigint = !1), "circularValue" in w || (w.circularValue = Error));
239
- const v = y(w), M = b(w, "bigint"), J = b(w, "deterministic"), W = F(w, "maximumDepth"), R = F(w, "maximumBreadth");
240
- function ut(X, m, S, T, B, U) {
241
- let A = m[X];
242
- switch (typeof A == "object" && A !== null && typeof A.toJSON == "function" && (A = A.toJSON(X)), A = T.call(m, X, A), typeof A) {
239
+ const v = y(w), M = b(w, "bigint"), J = b(w, "deterministic"), V = F(w, "maximumDepth"), R = F(w, "maximumBreadth");
240
+ function ft(W, m, S, D, B, C) {
241
+ let A = m[W];
242
+ switch (typeof A == "object" && A !== null && typeof A.toJSON == "function" && (A = A.toJSON(W)), A = D.call(m, W, A), typeof A) {
243
243
  case "string":
244
244
  return f(A);
245
245
  case "object": {
@@ -247,52 +247,52 @@ var Nt = { exports: {} };
247
247
  return "null";
248
248
  if (S.indexOf(A) !== -1)
249
249
  return v;
250
- let k = "", O = ",";
251
- const I = U;
250
+ let T = "", O = ",";
251
+ const I = C;
252
252
  if (Array.isArray(A)) {
253
253
  if (A.length === 0)
254
254
  return "[]";
255
- if (W < S.length + 1)
255
+ if (V < S.length + 1)
256
256
  return '"[Array]"';
257
- S.push(A), B !== "" && (U += B, k += `
258
- ${U}`, O = `,
259
- ${U}`);
260
- const V = Math.min(A.length, R);
261
- let Q = 0;
262
- for (; Q < V - 1; Q++) {
263
- const ct = ut(String(Q), A, S, T, B, U);
264
- k += ct !== void 0 ? ct : "null", k += O;
257
+ S.push(A), B !== "" && (C += B, T += `
258
+ ${C}`, O = `,
259
+ ${C}`);
260
+ const X = Math.min(A.length, R);
261
+ let tt = 0;
262
+ for (; tt < X - 1; tt++) {
263
+ const lt = ft(String(tt), A, S, D, B, C);
264
+ T += lt !== void 0 ? lt : "null", T += O;
265
265
  }
266
- const tt = ut(String(Q), A, S, T, B, U);
267
- if (k += tt !== void 0 ? tt : "null", A.length - 1 > R) {
268
- const ct = A.length - R - 1;
269
- k += `${O}"... ${j(ct)} not stringified"`;
266
+ const et = ft(String(tt), A, S, D, B, C);
267
+ if (T += et !== void 0 ? et : "null", A.length - 1 > R) {
268
+ const lt = A.length - R - 1;
269
+ T += `${O}"... ${j(lt)} not stringified"`;
270
270
  }
271
- return B !== "" && (k += `
272
- ${I}`), S.pop(), `[${k}]`;
271
+ return B !== "" && (T += `
272
+ ${I}`), S.pop(), `[${T}]`;
273
273
  }
274
274
  let L = Object.keys(A);
275
275
  const H = L.length;
276
276
  if (H === 0)
277
277
  return "{}";
278
- if (W < S.length + 1)
278
+ if (V < S.length + 1)
279
279
  return '"[Object]"';
280
280
  let $ = "", K = "";
281
- B !== "" && (U += B, O = `,
282
- ${U}`, $ = " ");
283
- const Y = Math.min(H, R);
281
+ B !== "" && (C += B, O = `,
282
+ ${C}`, $ = " ");
283
+ const Q = Math.min(H, R);
284
284
  J && !h(A) && (L = c(L)), S.push(A);
285
- for (let V = 0; V < Y; V++) {
286
- const Q = L[V], tt = ut(Q, A, S, T, B, U);
287
- tt !== void 0 && (k += `${K}${f(Q)}:${$}${tt}`, K = O);
285
+ for (let X = 0; X < Q; X++) {
286
+ const tt = L[X], et = ft(tt, A, S, D, B, C);
287
+ et !== void 0 && (T += `${K}${f(tt)}:${$}${et}`, K = O);
288
288
  }
289
289
  if (H > R) {
290
- const V = H - R;
291
- k += `${K}"...":${$}"${j(V)} not stringified"`, K = O;
290
+ const X = H - R;
291
+ T += `${K}"...":${$}"${j(X)} not stringified"`, K = O;
292
292
  }
293
- return B !== "" && K.length > 1 && (k = `
294
- ${U}${k}
295
- ${I}`), S.pop(), `{${k}}`;
293
+ return B !== "" && K.length > 1 && (T = `
294
+ ${C}${T}
295
+ ${I}`), S.pop(), `{${T}}`;
296
296
  }
297
297
  case "number":
298
298
  return isFinite(A) ? String(A) : E ? E(A) : "null";
@@ -307,8 +307,8 @@ ${I}`), S.pop(), `{${k}}`;
307
307
  return E ? E(A) : void 0;
308
308
  }
309
309
  }
310
- function ft(X, m, S, T, B, U) {
311
- switch (typeof m == "object" && m !== null && typeof m.toJSON == "function" && (m = m.toJSON(X)), typeof m) {
310
+ function ht(W, m, S, D, B, C) {
311
+ switch (typeof m == "object" && m !== null && typeof m.toJSON == "function" && (m = m.toJSON(W)), typeof m) {
312
312
  case "string":
313
313
  return f(m);
314
314
  case "object": {
@@ -316,42 +316,42 @@ ${I}`), S.pop(), `{${k}}`;
316
316
  return "null";
317
317
  if (S.indexOf(m) !== -1)
318
318
  return v;
319
- const A = U;
320
- let k = "", O = ",";
319
+ const A = C;
320
+ let T = "", O = ",";
321
321
  if (Array.isArray(m)) {
322
322
  if (m.length === 0)
323
323
  return "[]";
324
- if (W < S.length + 1)
324
+ if (V < S.length + 1)
325
325
  return '"[Array]"';
326
- S.push(m), B !== "" && (U += B, k += `
327
- ${U}`, O = `,
328
- ${U}`);
326
+ S.push(m), B !== "" && (C += B, T += `
327
+ ${C}`, O = `,
328
+ ${C}`);
329
329
  const H = Math.min(m.length, R);
330
330
  let $ = 0;
331
331
  for (; $ < H - 1; $++) {
332
- const Y = ft(String($), m[$], S, T, B, U);
333
- k += Y !== void 0 ? Y : "null", k += O;
332
+ const Q = ht(String($), m[$], S, D, B, C);
333
+ T += Q !== void 0 ? Q : "null", T += O;
334
334
  }
335
- const K = ft(String($), m[$], S, T, B, U);
336
- if (k += K !== void 0 ? K : "null", m.length - 1 > R) {
337
- const Y = m.length - R - 1;
338
- k += `${O}"... ${j(Y)} not stringified"`;
335
+ const K = ht(String($), m[$], S, D, B, C);
336
+ if (T += K !== void 0 ? K : "null", m.length - 1 > R) {
337
+ const Q = m.length - R - 1;
338
+ T += `${O}"... ${j(Q)} not stringified"`;
339
339
  }
340
- return B !== "" && (k += `
341
- ${A}`), S.pop(), `[${k}]`;
340
+ return B !== "" && (T += `
341
+ ${A}`), S.pop(), `[${T}]`;
342
342
  }
343
343
  S.push(m);
344
344
  let I = "";
345
- B !== "" && (U += B, O = `,
346
- ${U}`, I = " ");
345
+ B !== "" && (C += B, O = `,
346
+ ${C}`, I = " ");
347
347
  let L = "";
348
- for (const H of T) {
349
- const $ = ft(H, m[H], S, T, B, U);
350
- $ !== void 0 && (k += `${L}${f(H)}:${I}${$}`, L = O);
348
+ for (const H of D) {
349
+ const $ = ht(H, m[H], S, D, B, C);
350
+ $ !== void 0 && (T += `${L}${f(H)}:${I}${$}`, L = O);
351
351
  }
352
- return B !== "" && L.length > 1 && (k = `
353
- ${U}${k}
354
- ${A}`), S.pop(), `{${k}}`;
352
+ return B !== "" && L.length > 1 && (T = `
353
+ ${C}${T}
354
+ ${A}`), S.pop(), `{${T}}`;
355
355
  }
356
356
  case "number":
357
357
  return isFinite(m) ? String(m) : E ? E(m) : "null";
@@ -366,7 +366,7 @@ ${A}`), S.pop(), `{${k}}`;
366
366
  return E ? E(m) : void 0;
367
367
  }
368
368
  }
369
- function st(X, m, S, T, B) {
369
+ function pt(W, m, S, D, B) {
370
370
  switch (typeof m) {
371
371
  case "string":
372
372
  return f(m);
@@ -374,59 +374,59 @@ ${A}`), S.pop(), `{${k}}`;
374
374
  if (m === null)
375
375
  return "null";
376
376
  if (typeof m.toJSON == "function") {
377
- if (m = m.toJSON(X), typeof m != "object")
378
- return st(X, m, S, T, B);
377
+ if (m = m.toJSON(W), typeof m != "object")
378
+ return pt(W, m, S, D, B);
379
379
  if (m === null)
380
380
  return "null";
381
381
  }
382
382
  if (S.indexOf(m) !== -1)
383
383
  return v;
384
- const U = B;
384
+ const C = B;
385
385
  if (Array.isArray(m)) {
386
386
  if (m.length === 0)
387
387
  return "[]";
388
- if (W < S.length + 1)
388
+ if (V < S.length + 1)
389
389
  return '"[Array]"';
390
- S.push(m), B += T;
390
+ S.push(m), B += D;
391
391
  let $ = `
392
392
  ${B}`;
393
393
  const K = `,
394
- ${B}`, Y = Math.min(m.length, R);
395
- let V = 0;
396
- for (; V < Y - 1; V++) {
397
- const tt = st(String(V), m[V], S, T, B);
398
- $ += tt !== void 0 ? tt : "null", $ += K;
394
+ ${B}`, Q = Math.min(m.length, R);
395
+ let X = 0;
396
+ for (; X < Q - 1; X++) {
397
+ const et = pt(String(X), m[X], S, D, B);
398
+ $ += et !== void 0 ? et : "null", $ += K;
399
399
  }
400
- const Q = st(String(V), m[V], S, T, B);
401
- if ($ += Q !== void 0 ? Q : "null", m.length - 1 > R) {
402
- const tt = m.length - R - 1;
403
- $ += `${K}"... ${j(tt)} not stringified"`;
400
+ const tt = pt(String(X), m[X], S, D, B);
401
+ if ($ += tt !== void 0 ? tt : "null", m.length - 1 > R) {
402
+ const et = m.length - R - 1;
403
+ $ += `${K}"... ${j(et)} not stringified"`;
404
404
  }
405
405
  return $ += `
406
- ${U}`, S.pop(), `[${$}]`;
406
+ ${C}`, S.pop(), `[${$}]`;
407
407
  }
408
408
  let A = Object.keys(m);
409
- const k = A.length;
410
- if (k === 0)
409
+ const T = A.length;
410
+ if (T === 0)
411
411
  return "{}";
412
- if (W < S.length + 1)
412
+ if (V < S.length + 1)
413
413
  return '"[Object]"';
414
- B += T;
414
+ B += D;
415
415
  const O = `,
416
416
  ${B}`;
417
- let I = "", L = "", H = Math.min(k, R);
417
+ let I = "", L = "", H = Math.min(T, R);
418
418
  h(m) && (I += g(m, O, R), A = A.slice(m.length), H -= m.length, L = O), J && (A = c(A)), S.push(m);
419
419
  for (let $ = 0; $ < H; $++) {
420
- const K = A[$], Y = st(K, m[K], S, T, B);
421
- Y !== void 0 && (I += `${L}${f(K)}: ${Y}`, L = O);
420
+ const K = A[$], Q = pt(K, m[K], S, D, B);
421
+ Q !== void 0 && (I += `${L}${f(K)}: ${Q}`, L = O);
422
422
  }
423
- if (k > R) {
424
- const $ = k - R;
423
+ if (T > R) {
424
+ const $ = T - R;
425
425
  I += `${L}"...": "${j($)} not stringified"`, L = O;
426
426
  }
427
427
  return L !== "" && (I = `
428
428
  ${B}${I}
429
- ${U}`), S.pop(), `{${I}}`;
429
+ ${C}`), S.pop(), `{${I}}`;
430
430
  }
431
431
  case "number":
432
432
  return isFinite(m) ? String(m) : E ? E(m) : "null";
@@ -441,7 +441,7 @@ ${U}`), S.pop(), `{${I}}`;
441
441
  return E ? E(m) : void 0;
442
442
  }
443
443
  }
444
- function pt(X, m, S) {
444
+ function ct(W, m, S) {
445
445
  switch (typeof m) {
446
446
  case "string":
447
447
  return f(m);
@@ -449,50 +449,50 @@ ${U}`), S.pop(), `{${I}}`;
449
449
  if (m === null)
450
450
  return "null";
451
451
  if (typeof m.toJSON == "function") {
452
- if (m = m.toJSON(X), typeof m != "object")
453
- return pt(X, m, S);
452
+ if (m = m.toJSON(W), typeof m != "object")
453
+ return ct(W, m, S);
454
454
  if (m === null)
455
455
  return "null";
456
456
  }
457
457
  if (S.indexOf(m) !== -1)
458
458
  return v;
459
- let T = "";
459
+ let D = "";
460
460
  if (Array.isArray(m)) {
461
461
  if (m.length === 0)
462
462
  return "[]";
463
- if (W < S.length + 1)
463
+ if (V < S.length + 1)
464
464
  return '"[Array]"';
465
465
  S.push(m);
466
466
  const O = Math.min(m.length, R);
467
467
  let I = 0;
468
468
  for (; I < O - 1; I++) {
469
- const H = pt(String(I), m[I], S);
470
- T += H !== void 0 ? H : "null", T += ",";
469
+ const H = ct(String(I), m[I], S);
470
+ D += H !== void 0 ? H : "null", D += ",";
471
471
  }
472
- const L = pt(String(I), m[I], S);
473
- if (T += L !== void 0 ? L : "null", m.length - 1 > R) {
472
+ const L = ct(String(I), m[I], S);
473
+ if (D += L !== void 0 ? L : "null", m.length - 1 > R) {
474
474
  const H = m.length - R - 1;
475
- T += `,"... ${j(H)} not stringified"`;
475
+ D += `,"... ${j(H)} not stringified"`;
476
476
  }
477
- return S.pop(), `[${T}]`;
477
+ return S.pop(), `[${D}]`;
478
478
  }
479
479
  let B = Object.keys(m);
480
- const U = B.length;
481
- if (U === 0)
480
+ const C = B.length;
481
+ if (C === 0)
482
482
  return "{}";
483
- if (W < S.length + 1)
483
+ if (V < S.length + 1)
484
484
  return '"[Object]"';
485
- let A = "", k = Math.min(U, R);
486
- h(m) && (T += g(m, ",", R), B = B.slice(m.length), k -= m.length, A = ","), J && (B = c(B)), S.push(m);
487
- for (let O = 0; O < k; O++) {
488
- const I = B[O], L = pt(I, m[I], S);
489
- L !== void 0 && (T += `${A}${f(I)}:${L}`, A = ",");
485
+ let A = "", T = Math.min(C, R);
486
+ h(m) && (D += g(m, ",", R), B = B.slice(m.length), T -= m.length, A = ","), J && (B = c(B)), S.push(m);
487
+ for (let O = 0; O < T; O++) {
488
+ const I = B[O], L = ct(I, m[I], S);
489
+ L !== void 0 && (D += `${A}${f(I)}:${L}`, A = ",");
490
490
  }
491
- if (U > R) {
492
- const O = U - R;
493
- T += `${A}"...":"${j(O)} not stringified"`;
491
+ if (C > R) {
492
+ const O = C - R;
493
+ D += `${A}"...":"${j(O)} not stringified"`;
494
494
  }
495
- return S.pop(), `{${T}}`;
495
+ return S.pop(), `{${D}}`;
496
496
  }
497
497
  case "number":
498
498
  return isFinite(m) ? String(m) : E ? E(m) : "null";
@@ -507,32 +507,61 @@ ${U}`), S.pop(), `{${I}}`;
507
507
  return E ? E(m) : void 0;
508
508
  }
509
509
  }
510
- function Dt(X, m, S) {
510
+ function Ct(W, m, S) {
511
511
  if (arguments.length > 1) {
512
- let T = "";
513
- if (typeof S == "number" ? T = " ".repeat(Math.min(S, 10)) : typeof S == "string" && (T = S.slice(0, 10)), m != null) {
512
+ let D = "";
513
+ if (typeof S == "number" ? D = " ".repeat(Math.min(S, 10)) : typeof S == "string" && (D = S.slice(0, 10)), m != null) {
514
514
  if (typeof m == "function")
515
- return ut("", { "": X }, [], m, T, "");
515
+ return ft("", { "": W }, [], m, D, "");
516
516
  if (Array.isArray(m))
517
- return ft("", X, [], C(m), T, "");
517
+ return ht("", W, [], U(m), D, "");
518
518
  }
519
- if (T.length !== 0)
520
- return st("", X, [], T, "");
519
+ if (D.length !== 0)
520
+ return pt("", W, [], D, "");
521
521
  }
522
- return pt("", X, []);
522
+ return ct("", W, []);
523
523
  }
524
- return Dt;
524
+ return Ct;
525
525
  }
526
- })(Nt, Nt.exports);
527
- var ri = Nt.exports;
528
- const xt = /* @__PURE__ */ Xt(ri);
529
- xt.configure;
530
- function ni(i, r) {
526
+ })(Rt, Rt.exports);
527
+ var si = Rt.exports;
528
+ const dt = /* @__PURE__ */ Kt(si);
529
+ dt.configure;
530
+ let Ot;
531
+ const pi = new Uint8Array(16);
532
+ function ci() {
533
+ if (!Ot && (Ot = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !Ot))
534
+ throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
535
+ return Ot(pi);
536
+ }
537
+ const G = [];
538
+ for (let i = 0; i < 256; ++i)
539
+ G.push((i + 256).toString(16).slice(1));
540
+ function li(i, r = 0) {
541
+ return G[i[r + 0]] + G[i[r + 1]] + G[i[r + 2]] + G[i[r + 3]] + "-" + G[i[r + 4]] + G[i[r + 5]] + "-" + G[i[r + 6]] + G[i[r + 7]] + "-" + G[i[r + 8]] + G[i[r + 9]] + "-" + G[i[r + 10]] + G[i[r + 11]] + G[i[r + 12]] + G[i[r + 13]] + G[i[r + 14]] + G[i[r + 15]];
542
+ }
543
+ const ui = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), oe = {
544
+ randomUUID: ui
545
+ };
546
+ function fi(i, r, o) {
547
+ if (oe.randomUUID && !r && !i)
548
+ return oe.randomUUID();
549
+ i = i || {};
550
+ const p = i.random || (i.rng || ci)();
551
+ if (p[6] = p[6] & 15 | 64, p[8] = p[8] & 63 | 128, r) {
552
+ o = o || 0;
553
+ for (let l = 0; l < 16; ++l)
554
+ r[o + l] = p[l];
555
+ return r;
556
+ }
557
+ return li(p);
558
+ }
559
+ function hi(i, r) {
531
560
  return { ...i, name: r };
532
561
  }
533
- function oi(i, r, o) {
534
- const { scope: p, input: u } = r;
535
- return Bt({
562
+ function mi(i, r, o) {
563
+ const { scope: p, input: l } = r;
564
+ return jt({
536
565
  document: i,
537
566
  action: r,
538
567
  skip: o
@@ -541,7 +570,7 @@ function oi(i, r, o) {
541
570
  throw new Error(
542
571
  `Cannot undo: no operations in history for scope "${p}"`
543
572
  );
544
- if (u < 1)
573
+ if (l < 1)
545
574
  throw new Error(
546
575
  "Invalid UNDO action: input value must be greater than 0"
547
576
  );
@@ -549,18 +578,18 @@ function oi(i, r, o) {
549
578
  throw new Error(
550
579
  "Cannot undo: skip value from reducer cannot be used with UNDO action"
551
580
  );
552
- const s = c.document.operations[p].at(-1), h = s && s.type === "NOOP" && s.skip > 0;
553
- if (c.skip += u, h) {
554
- c.skip += s.skip;
581
+ const a = c.document.operations[p].at(-1), h = a && a.type === "NOOP" && a.skip > 0;
582
+ if (c.skip += l, h) {
583
+ c.skip += a.skip;
555
584
  const F = c.document.operations[p][c.document.operations[p].length - 2];
556
- F && s.index - F.index === 1 && c.document.operations[p].pop();
585
+ F && a.index - F.index === 1 && c.document.operations[p].pop();
557
586
  }
558
587
  if (c.document.operations[p].length < c.skip)
559
588
  throw new Error(
560
589
  "Cannot undo: you can't undo more operations than the ones in the scope history"
561
590
  );
562
591
  const g = c.document.operations[p].length - 1;
563
- let y = u, b = h ? g - s.skip : g;
592
+ let y = l, b = h ? g - a.skip : g;
564
593
  for (; y > 0 && b >= 0; ) {
565
594
  const F = c.document.operations[p][b];
566
595
  if (!F) {
@@ -569,12 +598,12 @@ function oi(i, r, o) {
569
598
  }
570
599
  F.type === "NOOP" && F.skip > 0 ? (b = b - (F.skip + 1), c.skip += F.skip + 1) : (c.document.clipboard.push({ ...F }), y--, b--);
571
600
  }
572
- c.action = We(p);
601
+ c.action = Ge(p);
573
602
  });
574
603
  }
575
- function ai(i, r, o) {
576
- const { scope: p, input: u } = r;
577
- return Bt({
604
+ function xi(i, r, o) {
605
+ const { scope: p, input: l } = r;
606
+ return jt({
578
607
  document: i,
579
608
  action: r,
580
609
  skip: o
@@ -583,102 +612,102 @@ function ai(i, r, o) {
583
612
  throw new Error(
584
613
  "Cannot redo: skip value from reducer cannot be used with REDO action"
585
614
  );
586
- if (u > 1)
615
+ if (l > 1)
587
616
  throw new Error(
588
617
  "Cannot redo: you can only redo one operation at a time"
589
618
  );
590
- if (u < 1)
619
+ if (l < 1)
591
620
  throw new Error("Invalid REDO action: invalid redo input value");
592
621
  if (c.document.clipboard.length < 1)
593
622
  throw new Error("Cannot redo: no operations in the clipboard");
594
- const s = c.document.clipboard.findLastIndex(
623
+ const a = c.document.clipboard.findLastIndex(
595
624
  (g) => g.scope === p
596
625
  );
597
- if (s < 0)
626
+ if (a < 0)
598
627
  throw new Error(
599
628
  `Cannot redo: no operations in clipboard for scope "${p}"`
600
629
  );
601
- const h = c.document.clipboard.splice(s, 1)[0];
602
- c.action = Ot({
630
+ const h = c.document.clipboard.splice(a, 1)[0];
631
+ c.action = It({
603
632
  type: h.type,
604
633
  scope: h.scope,
605
634
  input: h.input
606
635
  });
607
636
  });
608
637
  }
609
- function si(i, r, o) {
610
- const { scope: p } = r, u = i.operations[p];
638
+ function di(i, r, o) {
639
+ const { scope: p } = r, l = i.operations[p];
611
640
  let {
612
641
  input: { start: f, end: c }
613
642
  } = r;
614
- f = f || 0, c = c || u.length;
615
- const s = u.slice(f, c), h = u.slice(0, f), g = u.slice(c), y = Pt(
643
+ f = f || 0, c = c || l.length;
644
+ const a = l.slice(f, c), h = l.slice(0, f), g = l.slice(c), y = qt(
616
645
  i.initialState,
617
646
  {
618
647
  ...i.operations,
619
- [p]: h.concat(s)
648
+ [p]: h.concat(a)
620
649
  },
621
650
  o
622
- ), { name: b, state: F } = y, j = h.length, C = h.length ? h[h.length - 1].timestamp : g.length ? g[0].timestamp : (/* @__PURE__ */ new Date()).toISOString();
623
- return Pt(
651
+ ), { name: b, state: F } = y, j = h.length, U = h.length ? h[h.length - 1].timestamp : g.length ? g[0].timestamp : (/* @__PURE__ */ new Date()).toISOString();
652
+ return qt(
624
653
  i.initialState,
625
654
  {
626
655
  ...i.operations,
627
656
  [p]: [
628
657
  ...h,
629
658
  {
630
- ...te(
659
+ ...ie(
631
660
  { name: b, state: F },
632
- s.length
661
+ a.length
633
662
  ),
634
- timestamp: C,
663
+ timestamp: U,
635
664
  index: j,
636
- hash: Qt({ state: F }, "global")
665
+ hash: ee({ state: F }, "global")
637
666
  },
638
- ...g.map((q, Z) => ({
667
+ ...g.map((q, Y) => ({
639
668
  ...q,
640
- index: j + Z + 1
669
+ index: j + Y + 1
641
670
  }))
642
671
  ]
643
672
  },
644
673
  o
645
674
  );
646
675
  }
647
- function pi(i, r) {
676
+ function gi(i, r) {
648
677
  return {
649
678
  ...i,
650
679
  name: r.name,
651
680
  state: r.state ?? { global: {}, local: {} }
652
681
  };
653
682
  }
654
- const we = "SET_NAME", wt = "UNDO", Et = "REDO", It = "PRUNE", Ee = "LOAD_STATE", ci = "NOOP", be = { "application/andrew-inset": ["ez"], "application/appinstaller": ["appinstaller"], "application/applixware": ["aw"], "application/appx": ["appx"], "application/appxbundle": ["appxbundle"], "application/atom+xml": ["atom"], "application/atomcat+xml": ["atomcat"], "application/atomdeleted+xml": ["atomdeleted"], "application/atomsvc+xml": ["atomsvc"], "application/atsc-dwd+xml": ["dwd"], "application/atsc-held+xml": ["held"], "application/atsc-rsat+xml": ["rsat"], "application/automationml-aml+xml": ["aml"], "application/automationml-amlx+zip": ["amlx"], "application/bdoc": ["bdoc"], "application/calendar+xml": ["xcs"], "application/ccxml+xml": ["ccxml"], "application/cdfx+xml": ["cdfx"], "application/cdmi-capability": ["cdmia"], "application/cdmi-container": ["cdmic"], "application/cdmi-domain": ["cdmid"], "application/cdmi-object": ["cdmio"], "application/cdmi-queue": ["cdmiq"], "application/cpl+xml": ["cpl"], "application/cu-seeme": ["cu"], "application/cwl": ["cwl"], "application/dash+xml": ["mpd"], "application/dash-patch+xml": ["mpp"], "application/davmount+xml": ["davmount"], "application/docbook+xml": ["dbk"], "application/dssc+der": ["dssc"], "application/dssc+xml": ["xdssc"], "application/ecmascript": ["ecma"], "application/emma+xml": ["emma"], "application/emotionml+xml": ["emotionml"], "application/epub+zip": ["epub"], "application/exi": ["exi"], "application/express": ["exp"], "application/fdf": ["fdf"], "application/fdt+xml": ["fdt"], "application/font-tdpfr": ["pfr"], "application/geo+json": ["geojson"], "application/gml+xml": ["gml"], "application/gpx+xml": ["gpx"], "application/gxf": ["gxf"], "application/gzip": ["gz"], "application/hjson": ["hjson"], "application/hyperstudio": ["stk"], "application/inkml+xml": ["ink", "inkml"], "application/ipfix": ["ipfix"], "application/its+xml": ["its"], "application/java-archive": ["jar", "war", "ear"], "application/java-serialized-object": ["ser"], "application/java-vm": ["class"], "application/javascript": ["*js"], "application/json": ["json", "map"], "application/json5": ["json5"], "application/jsonml+json": ["jsonml"], "application/ld+json": ["jsonld"], "application/lgr+xml": ["lgr"], "application/lost+xml": ["lostxml"], "application/mac-binhex40": ["hqx"], "application/mac-compactpro": ["cpt"], "application/mads+xml": ["mads"], "application/manifest+json": ["webmanifest"], "application/marc": ["mrc"], "application/marcxml+xml": ["mrcx"], "application/mathematica": ["ma", "nb", "mb"], "application/mathml+xml": ["mathml"], "application/mbox": ["mbox"], "application/media-policy-dataset+xml": ["mpf"], "application/mediaservercontrol+xml": ["mscml"], "application/metalink+xml": ["metalink"], "application/metalink4+xml": ["meta4"], "application/mets+xml": ["mets"], "application/mmt-aei+xml": ["maei"], "application/mmt-usd+xml": ["musd"], "application/mods+xml": ["mods"], "application/mp21": ["m21", "mp21"], "application/mp4": ["*mp4", "*mpg4", "mp4s", "m4p"], "application/msix": ["msix"], "application/msixbundle": ["msixbundle"], "application/msword": ["doc", "dot"], "application/mxf": ["mxf"], "application/n-quads": ["nq"], "application/n-triples": ["nt"], "application/node": ["cjs"], "application/octet-stream": ["bin", "dms", "lrf", "mar", "so", "dist", "distz", "pkg", "bpk", "dump", "elc", "deploy", "exe", "dll", "deb", "dmg", "iso", "img", "msi", "msp", "msm", "buffer"], "application/oda": ["oda"], "application/oebps-package+xml": ["opf"], "application/ogg": ["ogx"], "application/omdoc+xml": ["omdoc"], "application/onenote": ["onetoc", "onetoc2", "onetmp", "onepkg"], "application/oxps": ["oxps"], "application/p2p-overlay+xml": ["relo"], "application/patch-ops-error+xml": ["xer"], "application/pdf": ["pdf"], "application/pgp-encrypted": ["pgp"], "application/pgp-keys": ["asc"], "application/pgp-signature": ["sig", "*asc"], "application/pics-rules": ["prf"], "application/pkcs10": ["p10"], "application/pkcs7-mime": ["p7m", "p7c"], "application/pkcs7-signature": ["p7s"], "application/pkcs8": ["p8"], "application/pkix-attr-cert": ["ac"], "application/pkix-cert": ["cer"], "application/pkix-crl": ["crl"], "application/pkix-pkipath": ["pkipath"], "application/pkixcmp": ["pki"], "application/pls+xml": ["pls"], "application/postscript": ["ai", "eps", "ps"], "application/provenance+xml": ["provx"], "application/pskc+xml": ["pskcxml"], "application/raml+yaml": ["raml"], "application/rdf+xml": ["rdf", "owl"], "application/reginfo+xml": ["rif"], "application/relax-ng-compact-syntax": ["rnc"], "application/resource-lists+xml": ["rl"], "application/resource-lists-diff+xml": ["rld"], "application/rls-services+xml": ["rs"], "application/route-apd+xml": ["rapd"], "application/route-s-tsid+xml": ["sls"], "application/route-usd+xml": ["rusd"], "application/rpki-ghostbusters": ["gbr"], "application/rpki-manifest": ["mft"], "application/rpki-roa": ["roa"], "application/rsd+xml": ["rsd"], "application/rss+xml": ["rss"], "application/rtf": ["rtf"], "application/sbml+xml": ["sbml"], "application/scvp-cv-request": ["scq"], "application/scvp-cv-response": ["scs"], "application/scvp-vp-request": ["spq"], "application/scvp-vp-response": ["spp"], "application/sdp": ["sdp"], "application/senml+xml": ["senmlx"], "application/sensml+xml": ["sensmlx"], "application/set-payment-initiation": ["setpay"], "application/set-registration-initiation": ["setreg"], "application/shf+xml": ["shf"], "application/sieve": ["siv", "sieve"], "application/smil+xml": ["smi", "smil"], "application/sparql-query": ["rq"], "application/sparql-results+xml": ["srx"], "application/sql": ["sql"], "application/srgs": ["gram"], "application/srgs+xml": ["grxml"], "application/sru+xml": ["sru"], "application/ssdl+xml": ["ssdl"], "application/ssml+xml": ["ssml"], "application/swid+xml": ["swidtag"], "application/tei+xml": ["tei", "teicorpus"], "application/thraud+xml": ["tfi"], "application/timestamped-data": ["tsd"], "application/toml": ["toml"], "application/trig": ["trig"], "application/ttml+xml": ["ttml"], "application/ubjson": ["ubj"], "application/urc-ressheet+xml": ["rsheet"], "application/urc-targetdesc+xml": ["td"], "application/voicexml+xml": ["vxml"], "application/wasm": ["wasm"], "application/watcherinfo+xml": ["wif"], "application/widget": ["wgt"], "application/winhlp": ["hlp"], "application/wsdl+xml": ["wsdl"], "application/wspolicy+xml": ["wspolicy"], "application/xaml+xml": ["xaml"], "application/xcap-att+xml": ["xav"], "application/xcap-caps+xml": ["xca"], "application/xcap-diff+xml": ["xdf"], "application/xcap-el+xml": ["xel"], "application/xcap-ns+xml": ["xns"], "application/xenc+xml": ["xenc"], "application/xfdf": ["xfdf"], "application/xhtml+xml": ["xhtml", "xht"], "application/xliff+xml": ["xlf"], "application/xml": ["xml", "xsl", "xsd", "rng"], "application/xml-dtd": ["dtd"], "application/xop+xml": ["xop"], "application/xproc+xml": ["xpl"], "application/xslt+xml": ["*xsl", "xslt"], "application/xspf+xml": ["xspf"], "application/xv+xml": ["mxml", "xhvml", "xvml", "xvm"], "application/yang": ["yang"], "application/yin+xml": ["yin"], "application/zip": ["zip"], "audio/3gpp": ["*3gpp"], "audio/aac": ["adts", "aac"], "audio/adpcm": ["adp"], "audio/amr": ["amr"], "audio/basic": ["au", "snd"], "audio/midi": ["mid", "midi", "kar", "rmi"], "audio/mobile-xmf": ["mxmf"], "audio/mp3": ["*mp3"], "audio/mp4": ["m4a", "mp4a"], "audio/mpeg": ["mpga", "mp2", "mp2a", "mp3", "m2a", "m3a"], "audio/ogg": ["oga", "ogg", "spx", "opus"], "audio/s3m": ["s3m"], "audio/silk": ["sil"], "audio/wav": ["wav"], "audio/wave": ["*wav"], "audio/webm": ["weba"], "audio/xm": ["xm"], "font/collection": ["ttc"], "font/otf": ["otf"], "font/ttf": ["ttf"], "font/woff": ["woff"], "font/woff2": ["woff2"], "image/aces": ["exr"], "image/apng": ["apng"], "image/avci": ["avci"], "image/avcs": ["avcs"], "image/avif": ["avif"], "image/bmp": ["bmp", "dib"], "image/cgm": ["cgm"], "image/dicom-rle": ["drle"], "image/dpx": ["dpx"], "image/emf": ["emf"], "image/fits": ["fits"], "image/g3fax": ["g3"], "image/gif": ["gif"], "image/heic": ["heic"], "image/heic-sequence": ["heics"], "image/heif": ["heif"], "image/heif-sequence": ["heifs"], "image/hej2k": ["hej2"], "image/hsj2": ["hsj2"], "image/ief": ["ief"], "image/jls": ["jls"], "image/jp2": ["jp2", "jpg2"], "image/jpeg": ["jpeg", "jpg", "jpe"], "image/jph": ["jph"], "image/jphc": ["jhc"], "image/jpm": ["jpm", "jpgm"], "image/jpx": ["jpx", "jpf"], "image/jxr": ["jxr"], "image/jxra": ["jxra"], "image/jxrs": ["jxrs"], "image/jxs": ["jxs"], "image/jxsc": ["jxsc"], "image/jxsi": ["jxsi"], "image/jxss": ["jxss"], "image/ktx": ["ktx"], "image/ktx2": ["ktx2"], "image/png": ["png"], "image/sgi": ["sgi"], "image/svg+xml": ["svg", "svgz"], "image/t38": ["t38"], "image/tiff": ["tif", "tiff"], "image/tiff-fx": ["tfx"], "image/webp": ["webp"], "image/wmf": ["wmf"], "message/disposition-notification": ["disposition-notification"], "message/global": ["u8msg"], "message/global-delivery-status": ["u8dsn"], "message/global-disposition-notification": ["u8mdn"], "message/global-headers": ["u8hdr"], "message/rfc822": ["eml", "mime"], "model/3mf": ["3mf"], "model/gltf+json": ["gltf"], "model/gltf-binary": ["glb"], "model/iges": ["igs", "iges"], "model/jt": ["jt"], "model/mesh": ["msh", "mesh", "silo"], "model/mtl": ["mtl"], "model/obj": ["obj"], "model/prc": ["prc"], "model/step+xml": ["stpx"], "model/step+zip": ["stpz"], "model/step-xml+zip": ["stpxz"], "model/stl": ["stl"], "model/u3d": ["u3d"], "model/vrml": ["wrl", "vrml"], "model/x3d+binary": ["*x3db", "x3dbz"], "model/x3d+fastinfoset": ["x3db"], "model/x3d+vrml": ["*x3dv", "x3dvz"], "model/x3d+xml": ["x3d", "x3dz"], "model/x3d-vrml": ["x3dv"], "text/cache-manifest": ["appcache", "manifest"], "text/calendar": ["ics", "ifb"], "text/coffeescript": ["coffee", "litcoffee"], "text/css": ["css"], "text/csv": ["csv"], "text/html": ["html", "htm", "shtml"], "text/jade": ["jade"], "text/javascript": ["js", "mjs"], "text/jsx": ["jsx"], "text/less": ["less"], "text/markdown": ["md", "markdown"], "text/mathml": ["mml"], "text/mdx": ["mdx"], "text/n3": ["n3"], "text/plain": ["txt", "text", "conf", "def", "list", "log", "in", "ini"], "text/richtext": ["rtx"], "text/rtf": ["*rtf"], "text/sgml": ["sgml", "sgm"], "text/shex": ["shex"], "text/slim": ["slim", "slm"], "text/spdx": ["spdx"], "text/stylus": ["stylus", "styl"], "text/tab-separated-values": ["tsv"], "text/troff": ["t", "tr", "roff", "man", "me", "ms"], "text/turtle": ["ttl"], "text/uri-list": ["uri", "uris", "urls"], "text/vcard": ["vcard"], "text/vtt": ["vtt"], "text/wgsl": ["wgsl"], "text/xml": ["*xml"], "text/yaml": ["yaml", "yml"], "video/3gpp": ["3gp", "3gpp"], "video/3gpp2": ["3g2"], "video/h261": ["h261"], "video/h263": ["h263"], "video/h264": ["h264"], "video/iso.segment": ["m4s"], "video/jpeg": ["jpgv"], "video/jpm": ["*jpm", "*jpgm"], "video/mj2": ["mj2", "mjp2"], "video/mp2t": ["ts"], "video/mp4": ["mp4", "mp4v", "mpg4"], "video/mpeg": ["mpeg", "mpg", "mpe", "m1v", "m2v"], "video/ogg": ["ogv"], "video/quicktime": ["qt", "mov"], "video/webm": ["webm"] };
655
- Object.freeze(be);
656
- var et = function(i, r, o, p) {
683
+ const ve = "SET_NAME", Et = "UNDO", bt = "REDO", Dt = "PRUNE", Se = "LOAD_STATE", yi = "NOOP", _e = { "application/andrew-inset": ["ez"], "application/appinstaller": ["appinstaller"], "application/applixware": ["aw"], "application/appx": ["appx"], "application/appxbundle": ["appxbundle"], "application/atom+xml": ["atom"], "application/atomcat+xml": ["atomcat"], "application/atomdeleted+xml": ["atomdeleted"], "application/atomsvc+xml": ["atomsvc"], "application/atsc-dwd+xml": ["dwd"], "application/atsc-held+xml": ["held"], "application/atsc-rsat+xml": ["rsat"], "application/automationml-aml+xml": ["aml"], "application/automationml-amlx+zip": ["amlx"], "application/bdoc": ["bdoc"], "application/calendar+xml": ["xcs"], "application/ccxml+xml": ["ccxml"], "application/cdfx+xml": ["cdfx"], "application/cdmi-capability": ["cdmia"], "application/cdmi-container": ["cdmic"], "application/cdmi-domain": ["cdmid"], "application/cdmi-object": ["cdmio"], "application/cdmi-queue": ["cdmiq"], "application/cpl+xml": ["cpl"], "application/cu-seeme": ["cu"], "application/cwl": ["cwl"], "application/dash+xml": ["mpd"], "application/dash-patch+xml": ["mpp"], "application/davmount+xml": ["davmount"], "application/docbook+xml": ["dbk"], "application/dssc+der": ["dssc"], "application/dssc+xml": ["xdssc"], "application/ecmascript": ["ecma"], "application/emma+xml": ["emma"], "application/emotionml+xml": ["emotionml"], "application/epub+zip": ["epub"], "application/exi": ["exi"], "application/express": ["exp"], "application/fdf": ["fdf"], "application/fdt+xml": ["fdt"], "application/font-tdpfr": ["pfr"], "application/geo+json": ["geojson"], "application/gml+xml": ["gml"], "application/gpx+xml": ["gpx"], "application/gxf": ["gxf"], "application/gzip": ["gz"], "application/hjson": ["hjson"], "application/hyperstudio": ["stk"], "application/inkml+xml": ["ink", "inkml"], "application/ipfix": ["ipfix"], "application/its+xml": ["its"], "application/java-archive": ["jar", "war", "ear"], "application/java-serialized-object": ["ser"], "application/java-vm": ["class"], "application/javascript": ["*js"], "application/json": ["json", "map"], "application/json5": ["json5"], "application/jsonml+json": ["jsonml"], "application/ld+json": ["jsonld"], "application/lgr+xml": ["lgr"], "application/lost+xml": ["lostxml"], "application/mac-binhex40": ["hqx"], "application/mac-compactpro": ["cpt"], "application/mads+xml": ["mads"], "application/manifest+json": ["webmanifest"], "application/marc": ["mrc"], "application/marcxml+xml": ["mrcx"], "application/mathematica": ["ma", "nb", "mb"], "application/mathml+xml": ["mathml"], "application/mbox": ["mbox"], "application/media-policy-dataset+xml": ["mpf"], "application/mediaservercontrol+xml": ["mscml"], "application/metalink+xml": ["metalink"], "application/metalink4+xml": ["meta4"], "application/mets+xml": ["mets"], "application/mmt-aei+xml": ["maei"], "application/mmt-usd+xml": ["musd"], "application/mods+xml": ["mods"], "application/mp21": ["m21", "mp21"], "application/mp4": ["*mp4", "*mpg4", "mp4s", "m4p"], "application/msix": ["msix"], "application/msixbundle": ["msixbundle"], "application/msword": ["doc", "dot"], "application/mxf": ["mxf"], "application/n-quads": ["nq"], "application/n-triples": ["nt"], "application/node": ["cjs"], "application/octet-stream": ["bin", "dms", "lrf", "mar", "so", "dist", "distz", "pkg", "bpk", "dump", "elc", "deploy", "exe", "dll", "deb", "dmg", "iso", "img", "msi", "msp", "msm", "buffer"], "application/oda": ["oda"], "application/oebps-package+xml": ["opf"], "application/ogg": ["ogx"], "application/omdoc+xml": ["omdoc"], "application/onenote": ["onetoc", "onetoc2", "onetmp", "onepkg"], "application/oxps": ["oxps"], "application/p2p-overlay+xml": ["relo"], "application/patch-ops-error+xml": ["xer"], "application/pdf": ["pdf"], "application/pgp-encrypted": ["pgp"], "application/pgp-keys": ["asc"], "application/pgp-signature": ["sig", "*asc"], "application/pics-rules": ["prf"], "application/pkcs10": ["p10"], "application/pkcs7-mime": ["p7m", "p7c"], "application/pkcs7-signature": ["p7s"], "application/pkcs8": ["p8"], "application/pkix-attr-cert": ["ac"], "application/pkix-cert": ["cer"], "application/pkix-crl": ["crl"], "application/pkix-pkipath": ["pkipath"], "application/pkixcmp": ["pki"], "application/pls+xml": ["pls"], "application/postscript": ["ai", "eps", "ps"], "application/provenance+xml": ["provx"], "application/pskc+xml": ["pskcxml"], "application/raml+yaml": ["raml"], "application/rdf+xml": ["rdf", "owl"], "application/reginfo+xml": ["rif"], "application/relax-ng-compact-syntax": ["rnc"], "application/resource-lists+xml": ["rl"], "application/resource-lists-diff+xml": ["rld"], "application/rls-services+xml": ["rs"], "application/route-apd+xml": ["rapd"], "application/route-s-tsid+xml": ["sls"], "application/route-usd+xml": ["rusd"], "application/rpki-ghostbusters": ["gbr"], "application/rpki-manifest": ["mft"], "application/rpki-roa": ["roa"], "application/rsd+xml": ["rsd"], "application/rss+xml": ["rss"], "application/rtf": ["rtf"], "application/sbml+xml": ["sbml"], "application/scvp-cv-request": ["scq"], "application/scvp-cv-response": ["scs"], "application/scvp-vp-request": ["spq"], "application/scvp-vp-response": ["spp"], "application/sdp": ["sdp"], "application/senml+xml": ["senmlx"], "application/sensml+xml": ["sensmlx"], "application/set-payment-initiation": ["setpay"], "application/set-registration-initiation": ["setreg"], "application/shf+xml": ["shf"], "application/sieve": ["siv", "sieve"], "application/smil+xml": ["smi", "smil"], "application/sparql-query": ["rq"], "application/sparql-results+xml": ["srx"], "application/sql": ["sql"], "application/srgs": ["gram"], "application/srgs+xml": ["grxml"], "application/sru+xml": ["sru"], "application/ssdl+xml": ["ssdl"], "application/ssml+xml": ["ssml"], "application/swid+xml": ["swidtag"], "application/tei+xml": ["tei", "teicorpus"], "application/thraud+xml": ["tfi"], "application/timestamped-data": ["tsd"], "application/toml": ["toml"], "application/trig": ["trig"], "application/ttml+xml": ["ttml"], "application/ubjson": ["ubj"], "application/urc-ressheet+xml": ["rsheet"], "application/urc-targetdesc+xml": ["td"], "application/voicexml+xml": ["vxml"], "application/wasm": ["wasm"], "application/watcherinfo+xml": ["wif"], "application/widget": ["wgt"], "application/winhlp": ["hlp"], "application/wsdl+xml": ["wsdl"], "application/wspolicy+xml": ["wspolicy"], "application/xaml+xml": ["xaml"], "application/xcap-att+xml": ["xav"], "application/xcap-caps+xml": ["xca"], "application/xcap-diff+xml": ["xdf"], "application/xcap-el+xml": ["xel"], "application/xcap-ns+xml": ["xns"], "application/xenc+xml": ["xenc"], "application/xfdf": ["xfdf"], "application/xhtml+xml": ["xhtml", "xht"], "application/xliff+xml": ["xlf"], "application/xml": ["xml", "xsl", "xsd", "rng"], "application/xml-dtd": ["dtd"], "application/xop+xml": ["xop"], "application/xproc+xml": ["xpl"], "application/xslt+xml": ["*xsl", "xslt"], "application/xspf+xml": ["xspf"], "application/xv+xml": ["mxml", "xhvml", "xvml", "xvm"], "application/yang": ["yang"], "application/yin+xml": ["yin"], "application/zip": ["zip"], "audio/3gpp": ["*3gpp"], "audio/aac": ["adts", "aac"], "audio/adpcm": ["adp"], "audio/amr": ["amr"], "audio/basic": ["au", "snd"], "audio/midi": ["mid", "midi", "kar", "rmi"], "audio/mobile-xmf": ["mxmf"], "audio/mp3": ["*mp3"], "audio/mp4": ["m4a", "mp4a"], "audio/mpeg": ["mpga", "mp2", "mp2a", "mp3", "m2a", "m3a"], "audio/ogg": ["oga", "ogg", "spx", "opus"], "audio/s3m": ["s3m"], "audio/silk": ["sil"], "audio/wav": ["wav"], "audio/wave": ["*wav"], "audio/webm": ["weba"], "audio/xm": ["xm"], "font/collection": ["ttc"], "font/otf": ["otf"], "font/ttf": ["ttf"], "font/woff": ["woff"], "font/woff2": ["woff2"], "image/aces": ["exr"], "image/apng": ["apng"], "image/avci": ["avci"], "image/avcs": ["avcs"], "image/avif": ["avif"], "image/bmp": ["bmp", "dib"], "image/cgm": ["cgm"], "image/dicom-rle": ["drle"], "image/dpx": ["dpx"], "image/emf": ["emf"], "image/fits": ["fits"], "image/g3fax": ["g3"], "image/gif": ["gif"], "image/heic": ["heic"], "image/heic-sequence": ["heics"], "image/heif": ["heif"], "image/heif-sequence": ["heifs"], "image/hej2k": ["hej2"], "image/hsj2": ["hsj2"], "image/ief": ["ief"], "image/jls": ["jls"], "image/jp2": ["jp2", "jpg2"], "image/jpeg": ["jpeg", "jpg", "jpe"], "image/jph": ["jph"], "image/jphc": ["jhc"], "image/jpm": ["jpm", "jpgm"], "image/jpx": ["jpx", "jpf"], "image/jxr": ["jxr"], "image/jxra": ["jxra"], "image/jxrs": ["jxrs"], "image/jxs": ["jxs"], "image/jxsc": ["jxsc"], "image/jxsi": ["jxsi"], "image/jxss": ["jxss"], "image/ktx": ["ktx"], "image/ktx2": ["ktx2"], "image/png": ["png"], "image/sgi": ["sgi"], "image/svg+xml": ["svg", "svgz"], "image/t38": ["t38"], "image/tiff": ["tif", "tiff"], "image/tiff-fx": ["tfx"], "image/webp": ["webp"], "image/wmf": ["wmf"], "message/disposition-notification": ["disposition-notification"], "message/global": ["u8msg"], "message/global-delivery-status": ["u8dsn"], "message/global-disposition-notification": ["u8mdn"], "message/global-headers": ["u8hdr"], "message/rfc822": ["eml", "mime"], "model/3mf": ["3mf"], "model/gltf+json": ["gltf"], "model/gltf-binary": ["glb"], "model/iges": ["igs", "iges"], "model/jt": ["jt"], "model/mesh": ["msh", "mesh", "silo"], "model/mtl": ["mtl"], "model/obj": ["obj"], "model/prc": ["prc"], "model/step+xml": ["stpx"], "model/step+zip": ["stpz"], "model/step-xml+zip": ["stpxz"], "model/stl": ["stl"], "model/u3d": ["u3d"], "model/vrml": ["wrl", "vrml"], "model/x3d+binary": ["*x3db", "x3dbz"], "model/x3d+fastinfoset": ["x3db"], "model/x3d+vrml": ["*x3dv", "x3dvz"], "model/x3d+xml": ["x3d", "x3dz"], "model/x3d-vrml": ["x3dv"], "text/cache-manifest": ["appcache", "manifest"], "text/calendar": ["ics", "ifb"], "text/coffeescript": ["coffee", "litcoffee"], "text/css": ["css"], "text/csv": ["csv"], "text/html": ["html", "htm", "shtml"], "text/jade": ["jade"], "text/javascript": ["js", "mjs"], "text/jsx": ["jsx"], "text/less": ["less"], "text/markdown": ["md", "markdown"], "text/mathml": ["mml"], "text/mdx": ["mdx"], "text/n3": ["n3"], "text/plain": ["txt", "text", "conf", "def", "list", "log", "in", "ini"], "text/richtext": ["rtx"], "text/rtf": ["*rtf"], "text/sgml": ["sgml", "sgm"], "text/shex": ["shex"], "text/slim": ["slim", "slm"], "text/spdx": ["spdx"], "text/stylus": ["stylus", "styl"], "text/tab-separated-values": ["tsv"], "text/troff": ["t", "tr", "roff", "man", "me", "ms"], "text/turtle": ["ttl"], "text/uri-list": ["uri", "uris", "urls"], "text/vcard": ["vcard"], "text/vtt": ["vtt"], "text/wgsl": ["wgsl"], "text/xml": ["*xml"], "text/yaml": ["yaml", "yml"], "video/3gpp": ["3gp", "3gpp"], "video/3gpp2": ["3g2"], "video/h261": ["h261"], "video/h263": ["h263"], "video/h264": ["h264"], "video/iso.segment": ["m4s"], "video/jpeg": ["jpgv"], "video/jpm": ["*jpm", "*jpgm"], "video/mj2": ["mj2", "mjp2"], "video/mp2t": ["ts"], "video/mp4": ["mp4", "mp4v", "mpg4"], "video/mpeg": ["mpeg", "mpg", "mpe", "m1v", "m2v"], "video/ogg": ["ogv"], "video/quicktime": ["qt", "mov"], "video/webm": ["webm"] };
684
+ Object.freeze(_e);
685
+ var it = function(i, r, o, p) {
657
686
  if (o === "a" && !p)
658
687
  throw new TypeError("Private accessor was defined without a getter");
659
688
  if (typeof r == "function" ? i !== r || !p : !r.has(i))
660
689
  throw new TypeError("Cannot read private member from an object whose class did not declare it");
661
690
  return o === "m" ? p : o === "a" ? p.call(i) : p ? p.value : r.get(i);
662
- }, mt, gt, lt;
663
- class li {
691
+ }, xt, yt, ut;
692
+ class wi {
664
693
  constructor(...r) {
665
- mt.set(this, /* @__PURE__ */ new Map()), gt.set(this, /* @__PURE__ */ new Map()), lt.set(this, /* @__PURE__ */ new Map());
694
+ xt.set(this, /* @__PURE__ */ new Map()), yt.set(this, /* @__PURE__ */ new Map()), ut.set(this, /* @__PURE__ */ new Map());
666
695
  for (const o of r)
667
696
  this.define(o);
668
697
  }
669
698
  define(r, o = !1) {
670
- for (let [p, u] of Object.entries(r)) {
671
- p = p.toLowerCase(), u = u.map((s) => s.toLowerCase()), et(this, lt, "f").has(p) || et(this, lt, "f").set(p, /* @__PURE__ */ new Set());
672
- const f = et(this, lt, "f").get(p);
699
+ for (let [p, l] of Object.entries(r)) {
700
+ p = p.toLowerCase(), l = l.map((a) => a.toLowerCase()), it(this, ut, "f").has(p) || it(this, ut, "f").set(p, /* @__PURE__ */ new Set());
701
+ const f = it(this, ut, "f").get(p);
673
702
  let c = !0;
674
- for (let s of u) {
675
- const h = s.startsWith("*");
676
- if (s = h ? s.slice(1) : s, f == null || f.add(s), c && et(this, gt, "f").set(p, s), c = !1, h)
703
+ for (let a of l) {
704
+ const h = a.startsWith("*");
705
+ if (a = h ? a.slice(1) : a, f == null || f.add(a), c && it(this, yt, "f").set(p, a), c = !1, h)
677
706
  continue;
678
- const g = et(this, mt, "f").get(s);
707
+ const g = it(this, xt, "f").get(a);
679
708
  if (g && g != p && !o)
680
- throw new Error(`"${p} -> ${s}" conflicts with "${g} -> ${s}". Pass \`force=true\` to override this definition.`);
681
- et(this, mt, "f").set(s, p);
709
+ throw new Error(`"${p} -> ${a}" conflicts with "${g} -> ${a}". Pass \`force=true\` to override this definition.`);
710
+ it(this, xt, "f").set(a, p);
682
711
  }
683
712
  }
684
713
  return this;
@@ -686,35 +715,35 @@ class li {
686
715
  getType(r) {
687
716
  if (typeof r != "string")
688
717
  return null;
689
- const o = r.replace(/^.*[/\\]/, "").toLowerCase(), p = o.replace(/^.*\./, "").toLowerCase(), u = o.length < r.length;
690
- return !(p.length < o.length - 1) && u ? null : et(this, mt, "f").get(p) ?? null;
718
+ const o = r.replace(/^.*[/\\]/, "").toLowerCase(), p = o.replace(/^.*\./, "").toLowerCase(), l = o.length < r.length;
719
+ return !(p.length < o.length - 1) && l ? null : it(this, xt, "f").get(p) ?? null;
691
720
  }
692
721
  getExtension(r) {
693
722
  var o;
694
- return typeof r != "string" ? null : (r = (o = r == null ? void 0 : r.split) == null ? void 0 : o.call(r, ";")[0], (r && et(this, gt, "f").get(r.trim().toLowerCase())) ?? null);
723
+ return typeof r != "string" ? null : (r = (o = r == null ? void 0 : r.split) == null ? void 0 : o.call(r, ";")[0], (r && it(this, yt, "f").get(r.trim().toLowerCase())) ?? null);
695
724
  }
696
725
  getAllExtensions(r) {
697
- return typeof r != "string" ? null : et(this, lt, "f").get(r.toLowerCase()) ?? null;
726
+ return typeof r != "string" ? null : it(this, ut, "f").get(r.toLowerCase()) ?? null;
698
727
  }
699
728
  _freeze() {
700
729
  this.define = () => {
701
730
  throw new Error("define() not allowed for built-in Mime objects. See https://github.com/broofa/mime/blob/main/README.md#custom-mime-instances");
702
731
  }, Object.freeze(this);
703
- for (const r of et(this, lt, "f").values())
732
+ for (const r of it(this, ut, "f").values())
704
733
  Object.freeze(r);
705
734
  return this;
706
735
  }
707
736
  _getTestState() {
708
737
  return {
709
- types: et(this, mt, "f"),
710
- extensions: et(this, gt, "f")
738
+ types: it(this, xt, "f"),
739
+ extensions: it(this, yt, "f")
711
740
  };
712
741
  }
713
742
  }
714
- mt = /* @__PURE__ */ new WeakMap(), gt = /* @__PURE__ */ new WeakMap(), lt = /* @__PURE__ */ new WeakMap();
715
- const ui = new li(be)._freeze();
716
- var Mt = { exports: {} };
717
- typeof Object.create == "function" ? Mt.exports = function(r, o) {
743
+ xt = /* @__PURE__ */ new WeakMap(), yt = /* @__PURE__ */ new WeakMap(), ut = /* @__PURE__ */ new WeakMap();
744
+ const Ei = new wi(_e)._freeze();
745
+ var Lt = { exports: {} };
746
+ typeof Object.create == "function" ? Lt.exports = function(r, o) {
718
747
  o && (r.super_ = o, r.prototype = Object.create(o.prototype, {
719
748
  constructor: {
720
749
  value: r,
@@ -723,7 +752,7 @@ typeof Object.create == "function" ? Mt.exports = function(r, o) {
723
752
  configurable: !0
724
753
  }
725
754
  }));
726
- } : Mt.exports = function(r, o) {
755
+ } : Lt.exports = function(r, o) {
727
756
  if (o) {
728
757
  r.super_ = o;
729
758
  var p = function() {
@@ -731,16 +760,16 @@ typeof Object.create == "function" ? Mt.exports = function(r, o) {
731
760
  p.prototype = o.prototype, r.prototype = new p(), r.prototype.constructor = r;
732
761
  }
733
762
  };
734
- var ve = Mt.exports, Rt = { exports: {} }, Se = {}, jt = {};
735
- jt.byteLength = mi;
736
- jt.toByteArray = di;
737
- jt.fromByteArray = wi;
738
- var nt = [], it = [], fi = typeof Uint8Array < "u" ? Uint8Array : Array, Ut = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
739
- for (var ht = 0, hi = Ut.length; ht < hi; ++ht)
740
- nt[ht] = Ut[ht], it[Ut.charCodeAt(ht)] = ht;
741
- it[45] = 62;
742
- it[95] = 63;
743
- function _e(i) {
763
+ var Ae = Lt.exports, Pt = { exports: {} }, Fe = {}, Tt = {};
764
+ Tt.byteLength = Si;
765
+ Tt.toByteArray = Ai;
766
+ Tt.fromByteArray = Bi;
767
+ var ot = [], rt = [], bi = typeof Uint8Array < "u" ? Uint8Array : Array, Nt = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
768
+ for (var mt = 0, vi = Nt.length; mt < vi; ++mt)
769
+ ot[mt] = Nt[mt], rt[Nt.charCodeAt(mt)] = mt;
770
+ rt[45] = 62;
771
+ rt[95] = 63;
772
+ function Oe(i) {
744
773
  var r = i.length;
745
774
  if (r % 4 > 0)
746
775
  throw new Error("Invalid string. Length must be a multiple of 4");
@@ -749,41 +778,41 @@ function _e(i) {
749
778
  var p = o === r ? 0 : 4 - o % 4;
750
779
  return [o, p];
751
780
  }
752
- function mi(i) {
753
- var r = _e(i), o = r[0], p = r[1];
781
+ function Si(i) {
782
+ var r = Oe(i), o = r[0], p = r[1];
754
783
  return (o + p) * 3 / 4 - p;
755
784
  }
756
- function xi(i, r, o) {
785
+ function _i(i, r, o) {
757
786
  return (r + o) * 3 / 4 - o;
758
787
  }
759
- function di(i) {
760
- var r, o = _e(i), p = o[0], u = o[1], f = new fi(xi(i, p, u)), c = 0, s = u > 0 ? p - 4 : p, h;
761
- for (h = 0; h < s; h += 4)
762
- r = it[i.charCodeAt(h)] << 18 | it[i.charCodeAt(h + 1)] << 12 | it[i.charCodeAt(h + 2)] << 6 | it[i.charCodeAt(h + 3)], f[c++] = r >> 16 & 255, f[c++] = r >> 8 & 255, f[c++] = r & 255;
763
- return u === 2 && (r = it[i.charCodeAt(h)] << 2 | it[i.charCodeAt(h + 1)] >> 4, f[c++] = r & 255), u === 1 && (r = it[i.charCodeAt(h)] << 10 | it[i.charCodeAt(h + 1)] << 4 | it[i.charCodeAt(h + 2)] >> 2, f[c++] = r >> 8 & 255, f[c++] = r & 255), f;
764
- }
765
- function gi(i) {
766
- return nt[i >> 18 & 63] + nt[i >> 12 & 63] + nt[i >> 6 & 63] + nt[i & 63];
767
- }
768
- function yi(i, r, o) {
769
- for (var p, u = [], f = r; f < o; f += 3)
770
- p = (i[f] << 16 & 16711680) + (i[f + 1] << 8 & 65280) + (i[f + 2] & 255), u.push(gi(p));
771
- return u.join("");
772
- }
773
- function wi(i) {
774
- for (var r, o = i.length, p = o % 3, u = [], f = 16383, c = 0, s = o - p; c < s; c += f)
775
- u.push(yi(i, c, c + f > s ? s : c + f));
776
- return p === 1 ? (r = i[o - 1], u.push(
777
- nt[r >> 2] + nt[r << 4 & 63] + "=="
778
- )) : p === 2 && (r = (i[o - 2] << 8) + i[o - 1], u.push(
779
- nt[r >> 10] + nt[r >> 4 & 63] + nt[r << 2 & 63] + "="
780
- )), u.join("");
781
- }
782
- var Vt = {};
788
+ function Ai(i) {
789
+ var r, o = Oe(i), p = o[0], l = o[1], f = new bi(_i(i, p, l)), c = 0, a = l > 0 ? p - 4 : p, h;
790
+ for (h = 0; h < a; h += 4)
791
+ r = rt[i.charCodeAt(h)] << 18 | rt[i.charCodeAt(h + 1)] << 12 | rt[i.charCodeAt(h + 2)] << 6 | rt[i.charCodeAt(h + 3)], f[c++] = r >> 16 & 255, f[c++] = r >> 8 & 255, f[c++] = r & 255;
792
+ return l === 2 && (r = rt[i.charCodeAt(h)] << 2 | rt[i.charCodeAt(h + 1)] >> 4, f[c++] = r & 255), l === 1 && (r = rt[i.charCodeAt(h)] << 10 | rt[i.charCodeAt(h + 1)] << 4 | rt[i.charCodeAt(h + 2)] >> 2, f[c++] = r >> 8 & 255, f[c++] = r & 255), f;
793
+ }
794
+ function Fi(i) {
795
+ return ot[i >> 18 & 63] + ot[i >> 12 & 63] + ot[i >> 6 & 63] + ot[i & 63];
796
+ }
797
+ function Oi(i, r, o) {
798
+ for (var p, l = [], f = r; f < o; f += 3)
799
+ p = (i[f] << 16 & 16711680) + (i[f + 1] << 8 & 65280) + (i[f + 2] & 255), l.push(Fi(p));
800
+ return l.join("");
801
+ }
802
+ function Bi(i) {
803
+ for (var r, o = i.length, p = o % 3, l = [], f = 16383, c = 0, a = o - p; c < a; c += f)
804
+ l.push(Oi(i, c, c + f > a ? a : c + f));
805
+ return p === 1 ? (r = i[o - 1], l.push(
806
+ ot[r >> 2] + ot[r << 4 & 63] + "=="
807
+ )) : p === 2 && (r = (i[o - 2] << 8) + i[o - 1], l.push(
808
+ ot[r >> 10] + ot[r >> 4 & 63] + ot[r << 2 & 63] + "="
809
+ )), l.join("");
810
+ }
811
+ var Gt = {};
783
812
  /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
784
- Vt.read = function(i, r, o, p, u) {
785
- var f, c, s = u * 8 - p - 1, h = (1 << s) - 1, g = h >> 1, y = -7, b = o ? u - 1 : 0, F = o ? -1 : 1, j = i[r + b];
786
- for (b += F, f = j & (1 << -y) - 1, j >>= -y, y += s; y > 0; f = f * 256 + i[r + b], b += F, y -= 8)
813
+ Gt.read = function(i, r, o, p, l) {
814
+ var f, c, a = l * 8 - p - 1, h = (1 << a) - 1, g = h >> 1, y = -7, b = o ? l - 1 : 0, F = o ? -1 : 1, j = i[r + b];
815
+ for (b += F, f = j & (1 << -y) - 1, j >>= -y, y += a; y > 0; f = f * 256 + i[r + b], b += F, y -= 8)
787
816
  ;
788
817
  for (c = f & (1 << -y) - 1, f >>= -y, y += p; y > 0; c = c * 256 + i[r + b], b += F, y -= 8)
789
818
  ;
@@ -796,13 +825,13 @@ Vt.read = function(i, r, o, p, u) {
796
825
  }
797
826
  return (j ? -1 : 1) * c * Math.pow(2, f - p);
798
827
  };
799
- Vt.write = function(i, r, o, p, u, f) {
800
- var c, s, h, g = f * 8 - u - 1, y = (1 << g) - 1, b = y >> 1, F = u === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0, j = p ? 0 : f - 1, C = p ? 1 : -1, q = r < 0 || r === 0 && 1 / r < 0 ? 1 : 0;
801
- for (r = Math.abs(r), isNaN(r) || r === 1 / 0 ? (s = isNaN(r) ? 1 : 0, c = y) : (c = Math.floor(Math.log(r) / Math.LN2), r * (h = Math.pow(2, -c)) < 1 && (c--, h *= 2), c + b >= 1 ? r += F / h : r += F * Math.pow(2, 1 - b), r * h >= 2 && (c++, h /= 2), c + b >= y ? (s = 0, c = y) : c + b >= 1 ? (s = (r * h - 1) * Math.pow(2, u), c = c + b) : (s = r * Math.pow(2, b - 1) * Math.pow(2, u), c = 0)); u >= 8; i[o + j] = s & 255, j += C, s /= 256, u -= 8)
828
+ Gt.write = function(i, r, o, p, l, f) {
829
+ var c, a, h, g = f * 8 - l - 1, y = (1 << g) - 1, b = y >> 1, F = l === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0, j = p ? 0 : f - 1, U = p ? 1 : -1, q = r < 0 || r === 0 && 1 / r < 0 ? 1 : 0;
830
+ for (r = Math.abs(r), isNaN(r) || r === 1 / 0 ? (a = isNaN(r) ? 1 : 0, c = y) : (c = Math.floor(Math.log(r) / Math.LN2), r * (h = Math.pow(2, -c)) < 1 && (c--, h *= 2), c + b >= 1 ? r += F / h : r += F * Math.pow(2, 1 - b), r * h >= 2 && (c++, h /= 2), c + b >= y ? (a = 0, c = y) : c + b >= 1 ? (a = (r * h - 1) * Math.pow(2, l), c = c + b) : (a = r * Math.pow(2, b - 1) * Math.pow(2, l), c = 0)); l >= 8; i[o + j] = a & 255, j += U, a /= 256, l -= 8)
802
831
  ;
803
- for (c = c << u | s, g += u; g > 0; i[o + j] = c & 255, j += C, c /= 256, g -= 8)
832
+ for (c = c << l | a, g += l; g > 0; i[o + j] = c & 255, j += U, c /= 256, g -= 8)
804
833
  ;
805
- i[o + j - C] |= q * 128;
834
+ i[o + j - U] |= q * 128;
806
835
  };
807
836
  /*!
808
837
  * The buffer module from node.js, for the browser.
@@ -811,10 +840,10 @@ Vt.write = function(i, r, o, p, u, f) {
811
840
  * @license MIT
812
841
  */
813
842
  (function(i) {
814
- var r = jt, o = Vt, p = typeof Symbol == "function" && typeof Symbol.for == "function" ? Symbol.for("nodejs.util.inspect.custom") : null;
815
- i.Buffer = s, i.SlowBuffer = E, i.INSPECT_MAX_BYTES = 50;
816
- var u = 2147483647;
817
- i.kMaxLength = u, s.TYPED_ARRAY_SUPPORT = f(), !s.TYPED_ARRAY_SUPPORT && typeof console < "u" && typeof console.error == "function" && console.error(
843
+ var r = Tt, o = Gt, p = typeof Symbol == "function" && typeof Symbol.for == "function" ? Symbol.for("nodejs.util.inspect.custom") : null;
844
+ i.Buffer = a, i.SlowBuffer = E, i.INSPECT_MAX_BYTES = 50;
845
+ var l = 2147483647;
846
+ i.kMaxLength = l, a.TYPED_ARRAY_SUPPORT = f(), !a.TYPED_ARRAY_SUPPORT && typeof console < "u" && typeof console.error == "function" && console.error(
818
847
  "This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."
819
848
  );
820
849
  function f() {
@@ -827,26 +856,26 @@ Vt.write = function(i, r, o, p, u, f) {
827
856
  return !1;
828
857
  }
829
858
  }
830
- Object.defineProperty(s.prototype, "parent", {
859
+ Object.defineProperty(a.prototype, "parent", {
831
860
  enumerable: !0,
832
861
  get: function() {
833
- if (s.isBuffer(this))
862
+ if (a.isBuffer(this))
834
863
  return this.buffer;
835
864
  }
836
- }), Object.defineProperty(s.prototype, "offset", {
865
+ }), Object.defineProperty(a.prototype, "offset", {
837
866
  enumerable: !0,
838
867
  get: function() {
839
- if (s.isBuffer(this))
868
+ if (a.isBuffer(this))
840
869
  return this.byteOffset;
841
870
  }
842
871
  });
843
872
  function c(n) {
844
- if (n > u)
873
+ if (n > l)
845
874
  throw new RangeError('The value "' + n + '" is invalid for option "size"');
846
875
  var t = new Uint8Array(n);
847
- return Object.setPrototypeOf(t, s.prototype), t;
876
+ return Object.setPrototypeOf(t, a.prototype), t;
848
877
  }
849
- function s(n, t, e) {
878
+ function a(n, t, e) {
850
879
  if (typeof n == "number") {
851
880
  if (typeof t == "string")
852
881
  throw new TypeError(
@@ -856,30 +885,30 @@ Vt.write = function(i, r, o, p, u, f) {
856
885
  }
857
886
  return h(n, t, e);
858
887
  }
859
- s.poolSize = 8192;
888
+ a.poolSize = 8192;
860
889
  function h(n, t, e) {
861
890
  if (typeof n == "string")
862
891
  return F(n, t);
863
892
  if (ArrayBuffer.isView(n))
864
- return C(n);
893
+ return U(n);
865
894
  if (n == null)
866
895
  throw new TypeError(
867
896
  "The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof n
868
897
  );
869
- if (rt(n, ArrayBuffer) || n && rt(n.buffer, ArrayBuffer) || typeof SharedArrayBuffer < "u" && (rt(n, SharedArrayBuffer) || n && rt(n.buffer, SharedArrayBuffer)))
898
+ if (nt(n, ArrayBuffer) || n && nt(n.buffer, ArrayBuffer) || typeof SharedArrayBuffer < "u" && (nt(n, SharedArrayBuffer) || n && nt(n.buffer, SharedArrayBuffer)))
870
899
  return q(n, t, e);
871
900
  if (typeof n == "number")
872
901
  throw new TypeError(
873
902
  'The "value" argument must not be of type number. Received type number'
874
903
  );
875
- var a = n.valueOf && n.valueOf();
876
- if (a != null && a !== n)
877
- return s.from(a, t, e);
878
- var l = Z(n);
879
- if (l)
880
- return l;
904
+ var s = n.valueOf && n.valueOf();
905
+ if (s != null && s !== n)
906
+ return a.from(s, t, e);
907
+ var u = Y(n);
908
+ if (u)
909
+ return u;
881
910
  if (typeof Symbol < "u" && Symbol.toPrimitive != null && typeof n[Symbol.toPrimitive] == "function")
882
- return s.from(
911
+ return a.from(
883
912
  n[Symbol.toPrimitive]("string"),
884
913
  t,
885
914
  e
@@ -888,9 +917,9 @@ Vt.write = function(i, r, o, p, u, f) {
888
917
  "The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof n
889
918
  );
890
919
  }
891
- s.from = function(n, t, e) {
920
+ a.from = function(n, t, e) {
892
921
  return h(n, t, e);
893
- }, Object.setPrototypeOf(s.prototype, Uint8Array.prototype), Object.setPrototypeOf(s, Uint8Array);
922
+ }, Object.setPrototypeOf(a.prototype, Uint8Array.prototype), Object.setPrototypeOf(a, Uint8Array);
894
923
  function g(n) {
895
924
  if (typeof n != "number")
896
925
  throw new TypeError('"size" argument must be of type number');
@@ -900,30 +929,30 @@ Vt.write = function(i, r, o, p, u, f) {
900
929
  function y(n, t, e) {
901
930
  return g(n), n <= 0 ? c(n) : t !== void 0 ? typeof e == "string" ? c(n).fill(t, e) : c(n).fill(t) : c(n);
902
931
  }
903
- s.alloc = function(n, t, e) {
932
+ a.alloc = function(n, t, e) {
904
933
  return y(n, t, e);
905
934
  };
906
935
  function b(n) {
907
936
  return g(n), c(n < 0 ? 0 : w(n) | 0);
908
937
  }
909
- s.allocUnsafe = function(n) {
938
+ a.allocUnsafe = function(n) {
910
939
  return b(n);
911
- }, s.allocUnsafeSlow = function(n) {
940
+ }, a.allocUnsafeSlow = function(n) {
912
941
  return b(n);
913
942
  };
914
943
  function F(n, t) {
915
- if ((typeof t != "string" || t === "") && (t = "utf8"), !s.isEncoding(t))
944
+ if ((typeof t != "string" || t === "") && (t = "utf8"), !a.isEncoding(t))
916
945
  throw new TypeError("Unknown encoding: " + t);
917
- var e = v(n, t) | 0, a = c(e), l = a.write(n, t);
918
- return l !== e && (a = a.slice(0, l)), a;
946
+ var e = v(n, t) | 0, s = c(e), u = s.write(n, t);
947
+ return u !== e && (s = s.slice(0, u)), s;
919
948
  }
920
949
  function j(n) {
921
- for (var t = n.length < 0 ? 0 : w(n.length) | 0, e = c(t), a = 0; a < t; a += 1)
922
- e[a] = n[a] & 255;
950
+ for (var t = n.length < 0 ? 0 : w(n.length) | 0, e = c(t), s = 0; s < t; s += 1)
951
+ e[s] = n[s] & 255;
923
952
  return e;
924
953
  }
925
- function C(n) {
926
- if (rt(n, Uint8Array)) {
954
+ function U(n) {
955
+ if (nt(n, Uint8Array)) {
927
956
  var t = new Uint8Array(n);
928
957
  return q(t.buffer, t.byteOffset, t.byteLength);
929
958
  }
@@ -934,43 +963,43 @@ Vt.write = function(i, r, o, p, u, f) {
934
963
  throw new RangeError('"offset" is outside of buffer bounds');
935
964
  if (n.byteLength < t + (e || 0))
936
965
  throw new RangeError('"length" is outside of buffer bounds');
937
- var a;
938
- return t === void 0 && e === void 0 ? a = new Uint8Array(n) : e === void 0 ? a = new Uint8Array(n, t) : a = new Uint8Array(n, t, e), Object.setPrototypeOf(a, s.prototype), a;
966
+ var s;
967
+ return t === void 0 && e === void 0 ? s = new Uint8Array(n) : e === void 0 ? s = new Uint8Array(n, t) : s = new Uint8Array(n, t, e), Object.setPrototypeOf(s, a.prototype), s;
939
968
  }
940
- function Z(n) {
941
- if (s.isBuffer(n)) {
969
+ function Y(n) {
970
+ if (a.isBuffer(n)) {
942
971
  var t = w(n.length) | 0, e = c(t);
943
972
  return e.length === 0 || n.copy(e, 0, 0, t), e;
944
973
  }
945
974
  if (n.length !== void 0)
946
- return typeof n.length != "number" || Ct(n.length) ? c(0) : j(n);
975
+ return typeof n.length != "number" || $t(n.length) ? c(0) : j(n);
947
976
  if (n.type === "Buffer" && Array.isArray(n.data))
948
977
  return j(n.data);
949
978
  }
950
979
  function w(n) {
951
- if (n >= u)
952
- throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x" + u.toString(16) + " bytes");
980
+ if (n >= l)
981
+ throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x" + l.toString(16) + " bytes");
953
982
  return n | 0;
954
983
  }
955
984
  function E(n) {
956
- return +n != n && (n = 0), s.alloc(+n);
985
+ return +n != n && (n = 0), a.alloc(+n);
957
986
  }
958
- s.isBuffer = function(t) {
959
- return t != null && t._isBuffer === !0 && t !== s.prototype;
960
- }, s.compare = function(t, e) {
961
- if (rt(t, Uint8Array) && (t = s.from(t, t.offset, t.byteLength)), rt(e, Uint8Array) && (e = s.from(e, e.offset, e.byteLength)), !s.isBuffer(t) || !s.isBuffer(e))
987
+ a.isBuffer = function(t) {
988
+ return t != null && t._isBuffer === !0 && t !== a.prototype;
989
+ }, a.compare = function(t, e) {
990
+ if (nt(t, Uint8Array) && (t = a.from(t, t.offset, t.byteLength)), nt(e, Uint8Array) && (e = a.from(e, e.offset, e.byteLength)), !a.isBuffer(t) || !a.isBuffer(e))
962
991
  throw new TypeError(
963
992
  'The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array'
964
993
  );
965
994
  if (t === e)
966
995
  return 0;
967
- for (var a = t.length, l = e.length, x = 0, d = Math.min(a, l); x < d; ++x)
996
+ for (var s = t.length, u = e.length, x = 0, d = Math.min(s, u); x < d; ++x)
968
997
  if (t[x] !== e[x]) {
969
- a = t[x], l = e[x];
998
+ s = t[x], u = e[x];
970
999
  break;
971
1000
  }
972
- return a < l ? -1 : l < a ? 1 : 0;
973
- }, s.isEncoding = function(t) {
1001
+ return s < u ? -1 : u < s ? 1 : 0;
1002
+ }, a.isEncoding = function(t) {
974
1003
  switch (String(t).toLowerCase()) {
975
1004
  case "hex":
976
1005
  case "utf8":
@@ -987,45 +1016,45 @@ Vt.write = function(i, r, o, p, u, f) {
987
1016
  default:
988
1017
  return !1;
989
1018
  }
990
- }, s.concat = function(t, e) {
1019
+ }, a.concat = function(t, e) {
991
1020
  if (!Array.isArray(t))
992
1021
  throw new TypeError('"list" argument must be an Array of Buffers');
993
1022
  if (t.length === 0)
994
- return s.alloc(0);
995
- var a;
1023
+ return a.alloc(0);
1024
+ var s;
996
1025
  if (e === void 0)
997
- for (e = 0, a = 0; a < t.length; ++a)
998
- e += t[a].length;
999
- var l = s.allocUnsafe(e), x = 0;
1000
- for (a = 0; a < t.length; ++a) {
1001
- var d = t[a];
1002
- if (rt(d, Uint8Array))
1003
- x + d.length > l.length ? s.from(d).copy(l, x) : Uint8Array.prototype.set.call(
1004
- l,
1026
+ for (e = 0, s = 0; s < t.length; ++s)
1027
+ e += t[s].length;
1028
+ var u = a.allocUnsafe(e), x = 0;
1029
+ for (s = 0; s < t.length; ++s) {
1030
+ var d = t[s];
1031
+ if (nt(d, Uint8Array))
1032
+ x + d.length > u.length ? a.from(d).copy(u, x) : Uint8Array.prototype.set.call(
1033
+ u,
1005
1034
  d,
1006
1035
  x
1007
1036
  );
1008
- else if (s.isBuffer(d))
1009
- d.copy(l, x);
1037
+ else if (a.isBuffer(d))
1038
+ d.copy(u, x);
1010
1039
  else
1011
1040
  throw new TypeError('"list" argument must be an Array of Buffers');
1012
1041
  x += d.length;
1013
1042
  }
1014
- return l;
1043
+ return u;
1015
1044
  };
1016
1045
  function v(n, t) {
1017
- if (s.isBuffer(n))
1046
+ if (a.isBuffer(n))
1018
1047
  return n.length;
1019
- if (ArrayBuffer.isView(n) || rt(n, ArrayBuffer))
1048
+ if (ArrayBuffer.isView(n) || nt(n, ArrayBuffer))
1020
1049
  return n.byteLength;
1021
1050
  if (typeof n != "string")
1022
1051
  throw new TypeError(
1023
1052
  'The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type ' + typeof n
1024
1053
  );
1025
- var e = n.length, a = arguments.length > 2 && arguments[2] === !0;
1026
- if (!a && e === 0)
1054
+ var e = n.length, s = arguments.length > 2 && arguments[2] === !0;
1055
+ if (!s && e === 0)
1027
1056
  return 0;
1028
- for (var l = !1; ; )
1057
+ for (var u = !1; ; )
1029
1058
  switch (t) {
1030
1059
  case "ascii":
1031
1060
  case "latin1":
@@ -1033,7 +1062,7 @@ Vt.write = function(i, r, o, p, u, f) {
1033
1062
  return e;
1034
1063
  case "utf8":
1035
1064
  case "utf-8":
1036
- return V(n).length;
1065
+ return X(n).length;
1037
1066
  case "ucs2":
1038
1067
  case "ucs-2":
1039
1068
  case "utf16le":
@@ -1042,16 +1071,16 @@ Vt.write = function(i, r, o, p, u, f) {
1042
1071
  case "hex":
1043
1072
  return e >>> 1;
1044
1073
  case "base64":
1045
- return ct(n).length;
1074
+ return lt(n).length;
1046
1075
  default:
1047
- if (l)
1048
- return a ? -1 : V(n).length;
1049
- t = ("" + t).toLowerCase(), l = !0;
1076
+ if (u)
1077
+ return s ? -1 : X(n).length;
1078
+ t = ("" + t).toLowerCase(), u = !0;
1050
1079
  }
1051
1080
  }
1052
- s.byteLength = v;
1081
+ a.byteLength = v;
1053
1082
  function M(n, t, e) {
1054
- var a = !1;
1083
+ var s = !1;
1055
1084
  if ((t === void 0 || t < 0) && (t = 0), t > this.length || ((e === void 0 || e > this.length) && (e = this.length), e <= 0) || (e >>>= 0, t >>>= 0, e <= t))
1056
1085
  return "";
1057
1086
  for (n || (n = "utf8"); ; )
@@ -1065,119 +1094,119 @@ Vt.write = function(i, r, o, p, u, f) {
1065
1094
  return B(this, t, e);
1066
1095
  case "latin1":
1067
1096
  case "binary":
1068
- return U(this, t, e);
1097
+ return C(this, t, e);
1069
1098
  case "base64":
1070
- return X(this, t, e);
1099
+ return W(this, t, e);
1071
1100
  case "ucs2":
1072
1101
  case "ucs-2":
1073
1102
  case "utf16le":
1074
1103
  case "utf-16le":
1075
- return k(this, t, e);
1104
+ return T(this, t, e);
1076
1105
  default:
1077
- if (a)
1106
+ if (s)
1078
1107
  throw new TypeError("Unknown encoding: " + n);
1079
- n = (n + "").toLowerCase(), a = !0;
1108
+ n = (n + "").toLowerCase(), s = !0;
1080
1109
  }
1081
1110
  }
1082
- s.prototype._isBuffer = !0;
1111
+ a.prototype._isBuffer = !0;
1083
1112
  function J(n, t, e) {
1084
- var a = n[t];
1085
- n[t] = n[e], n[e] = a;
1113
+ var s = n[t];
1114
+ n[t] = n[e], n[e] = s;
1086
1115
  }
1087
- s.prototype.swap16 = function() {
1116
+ a.prototype.swap16 = function() {
1088
1117
  var t = this.length;
1089
1118
  if (t % 2 !== 0)
1090
1119
  throw new RangeError("Buffer size must be a multiple of 16-bits");
1091
1120
  for (var e = 0; e < t; e += 2)
1092
1121
  J(this, e, e + 1);
1093
1122
  return this;
1094
- }, s.prototype.swap32 = function() {
1123
+ }, a.prototype.swap32 = function() {
1095
1124
  var t = this.length;
1096
1125
  if (t % 4 !== 0)
1097
1126
  throw new RangeError("Buffer size must be a multiple of 32-bits");
1098
1127
  for (var e = 0; e < t; e += 4)
1099
1128
  J(this, e, e + 3), J(this, e + 1, e + 2);
1100
1129
  return this;
1101
- }, s.prototype.swap64 = function() {
1130
+ }, a.prototype.swap64 = function() {
1102
1131
  var t = this.length;
1103
1132
  if (t % 8 !== 0)
1104
1133
  throw new RangeError("Buffer size must be a multiple of 64-bits");
1105
1134
  for (var e = 0; e < t; e += 8)
1106
1135
  J(this, e, e + 7), J(this, e + 1, e + 6), J(this, e + 2, e + 5), J(this, e + 3, e + 4);
1107
1136
  return this;
1108
- }, s.prototype.toString = function() {
1137
+ }, a.prototype.toString = function() {
1109
1138
  var t = this.length;
1110
1139
  return t === 0 ? "" : arguments.length === 0 ? m(this, 0, t) : M.apply(this, arguments);
1111
- }, s.prototype.toLocaleString = s.prototype.toString, s.prototype.equals = function(t) {
1112
- if (!s.isBuffer(t))
1140
+ }, a.prototype.toLocaleString = a.prototype.toString, a.prototype.equals = function(t) {
1141
+ if (!a.isBuffer(t))
1113
1142
  throw new TypeError("Argument must be a Buffer");
1114
- return this === t ? !0 : s.compare(this, t) === 0;
1115
- }, s.prototype.inspect = function() {
1143
+ return this === t ? !0 : a.compare(this, t) === 0;
1144
+ }, a.prototype.inspect = function() {
1116
1145
  var t = "", e = i.INSPECT_MAX_BYTES;
1117
1146
  return t = this.toString("hex", 0, e).replace(/(.{2})/g, "$1 ").trim(), this.length > e && (t += " ... "), "<Buffer " + t + ">";
1118
- }, p && (s.prototype[p] = s.prototype.inspect), s.prototype.compare = function(t, e, a, l, x) {
1119
- if (rt(t, Uint8Array) && (t = s.from(t, t.offset, t.byteLength)), !s.isBuffer(t))
1147
+ }, p && (a.prototype[p] = a.prototype.inspect), a.prototype.compare = function(t, e, s, u, x) {
1148
+ if (nt(t, Uint8Array) && (t = a.from(t, t.offset, t.byteLength)), !a.isBuffer(t))
1120
1149
  throw new TypeError(
1121
1150
  'The "target" argument must be one of type Buffer or Uint8Array. Received type ' + typeof t
1122
1151
  );
1123
- if (e === void 0 && (e = 0), a === void 0 && (a = t ? t.length : 0), l === void 0 && (l = 0), x === void 0 && (x = this.length), e < 0 || a > t.length || l < 0 || x > this.length)
1152
+ if (e === void 0 && (e = 0), s === void 0 && (s = t ? t.length : 0), u === void 0 && (u = 0), x === void 0 && (x = this.length), e < 0 || s > t.length || u < 0 || x > this.length)
1124
1153
  throw new RangeError("out of range index");
1125
- if (l >= x && e >= a)
1154
+ if (u >= x && e >= s)
1126
1155
  return 0;
1127
- if (l >= x)
1156
+ if (u >= x)
1128
1157
  return -1;
1129
- if (e >= a)
1158
+ if (e >= s)
1130
1159
  return 1;
1131
- if (e >>>= 0, a >>>= 0, l >>>= 0, x >>>= 0, this === t)
1160
+ if (e >>>= 0, s >>>= 0, u >>>= 0, x >>>= 0, this === t)
1132
1161
  return 0;
1133
- for (var d = x - l, D = a - e, N = Math.min(d, D), P = this.slice(l, x), G = t.slice(e, a), z = 0; z < N; ++z)
1134
- if (P[z] !== G[z]) {
1135
- d = P[z], D = G[z];
1162
+ for (var d = x - u, k = s - e, N = Math.min(d, k), P = this.slice(u, x), Z = t.slice(e, s), z = 0; z < N; ++z)
1163
+ if (P[z] !== Z[z]) {
1164
+ d = P[z], k = Z[z];
1136
1165
  break;
1137
1166
  }
1138
- return d < D ? -1 : D < d ? 1 : 0;
1167
+ return d < k ? -1 : k < d ? 1 : 0;
1139
1168
  };
1140
- function W(n, t, e, a, l) {
1169
+ function V(n, t, e, s, u) {
1141
1170
  if (n.length === 0)
1142
1171
  return -1;
1143
- if (typeof e == "string" ? (a = e, e = 0) : e > 2147483647 ? e = 2147483647 : e < -2147483648 && (e = -2147483648), e = +e, Ct(e) && (e = l ? 0 : n.length - 1), e < 0 && (e = n.length + e), e >= n.length) {
1144
- if (l)
1172
+ if (typeof e == "string" ? (s = e, e = 0) : e > 2147483647 ? e = 2147483647 : e < -2147483648 && (e = -2147483648), e = +e, $t(e) && (e = u ? 0 : n.length - 1), e < 0 && (e = n.length + e), e >= n.length) {
1173
+ if (u)
1145
1174
  return -1;
1146
1175
  e = n.length - 1;
1147
1176
  } else if (e < 0)
1148
- if (l)
1177
+ if (u)
1149
1178
  e = 0;
1150
1179
  else
1151
1180
  return -1;
1152
- if (typeof t == "string" && (t = s.from(t, a)), s.isBuffer(t))
1153
- return t.length === 0 ? -1 : R(n, t, e, a, l);
1181
+ if (typeof t == "string" && (t = a.from(t, s)), a.isBuffer(t))
1182
+ return t.length === 0 ? -1 : R(n, t, e, s, u);
1154
1183
  if (typeof t == "number")
1155
- return t = t & 255, typeof Uint8Array.prototype.indexOf == "function" ? l ? Uint8Array.prototype.indexOf.call(n, t, e) : Uint8Array.prototype.lastIndexOf.call(n, t, e) : R(n, [t], e, a, l);
1184
+ return t = t & 255, typeof Uint8Array.prototype.indexOf == "function" ? u ? Uint8Array.prototype.indexOf.call(n, t, e) : Uint8Array.prototype.lastIndexOf.call(n, t, e) : R(n, [t], e, s, u);
1156
1185
  throw new TypeError("val must be string, number or Buffer");
1157
1186
  }
1158
- function R(n, t, e, a, l) {
1159
- var x = 1, d = n.length, D = t.length;
1160
- if (a !== void 0 && (a = String(a).toLowerCase(), a === "ucs2" || a === "ucs-2" || a === "utf16le" || a === "utf-16le")) {
1187
+ function R(n, t, e, s, u) {
1188
+ var x = 1, d = n.length, k = t.length;
1189
+ if (s !== void 0 && (s = String(s).toLowerCase(), s === "ucs2" || s === "ucs-2" || s === "utf16le" || s === "utf-16le")) {
1161
1190
  if (n.length < 2 || t.length < 2)
1162
1191
  return -1;
1163
- x = 2, d /= 2, D /= 2, e /= 2;
1192
+ x = 2, d /= 2, k /= 2, e /= 2;
1164
1193
  }
1165
- function N(ee, ie) {
1166
- return x === 1 ? ee[ie] : ee.readUInt16BE(ie * x);
1194
+ function N(re, ne) {
1195
+ return x === 1 ? re[ne] : re.readUInt16BE(ne * x);
1167
1196
  }
1168
1197
  var P;
1169
- if (l) {
1170
- var G = -1;
1198
+ if (u) {
1199
+ var Z = -1;
1171
1200
  for (P = e; P < d; P++)
1172
- if (N(n, P) === N(t, G === -1 ? 0 : P - G)) {
1173
- if (G === -1 && (G = P), P - G + 1 === D)
1174
- return G * x;
1201
+ if (N(n, P) === N(t, Z === -1 ? 0 : P - Z)) {
1202
+ if (Z === -1 && (Z = P), P - Z + 1 === k)
1203
+ return Z * x;
1175
1204
  } else
1176
- G !== -1 && (P -= P - G), G = -1;
1205
+ Z !== -1 && (P -= P - Z), Z = -1;
1177
1206
  } else
1178
- for (e + D > d && (e = d - D), P = e; P >= 0; P--) {
1179
- for (var z = !0, _t = 0; _t < D; _t++)
1180
- if (N(n, P + _t) !== N(t, _t)) {
1207
+ for (e + k > d && (e = d - k), P = e; P >= 0; P--) {
1208
+ for (var z = !0, At = 0; At < k; At++)
1209
+ if (N(n, P + At) !== N(t, At)) {
1181
1210
  z = !1;
1182
1211
  break;
1183
1212
  }
@@ -1186,153 +1215,153 @@ Vt.write = function(i, r, o, p, u, f) {
1186
1215
  }
1187
1216
  return -1;
1188
1217
  }
1189
- s.prototype.includes = function(t, e, a) {
1190
- return this.indexOf(t, e, a) !== -1;
1191
- }, s.prototype.indexOf = function(t, e, a) {
1192
- return W(this, t, e, a, !0);
1193
- }, s.prototype.lastIndexOf = function(t, e, a) {
1194
- return W(this, t, e, a, !1);
1218
+ a.prototype.includes = function(t, e, s) {
1219
+ return this.indexOf(t, e, s) !== -1;
1220
+ }, a.prototype.indexOf = function(t, e, s) {
1221
+ return V(this, t, e, s, !0);
1222
+ }, a.prototype.lastIndexOf = function(t, e, s) {
1223
+ return V(this, t, e, s, !1);
1195
1224
  };
1196
- function ut(n, t, e, a) {
1225
+ function ft(n, t, e, s) {
1197
1226
  e = Number(e) || 0;
1198
- var l = n.length - e;
1199
- a ? (a = Number(a), a > l && (a = l)) : a = l;
1227
+ var u = n.length - e;
1228
+ s ? (s = Number(s), s > u && (s = u)) : s = u;
1200
1229
  var x = t.length;
1201
- a > x / 2 && (a = x / 2);
1202
- for (var d = 0; d < a; ++d) {
1203
- var D = parseInt(t.substr(d * 2, 2), 16);
1204
- if (Ct(D))
1230
+ s > x / 2 && (s = x / 2);
1231
+ for (var d = 0; d < s; ++d) {
1232
+ var k = parseInt(t.substr(d * 2, 2), 16);
1233
+ if ($t(k))
1205
1234
  return d;
1206
- n[e + d] = D;
1235
+ n[e + d] = k;
1207
1236
  }
1208
1237
  return d;
1209
1238
  }
1210
- function ft(n, t, e, a) {
1211
- return St(V(t, n.length - e), n, e, a);
1239
+ function ht(n, t, e, s) {
1240
+ return _t(X(t, n.length - e), n, e, s);
1212
1241
  }
1213
- function st(n, t, e, a) {
1214
- return St(Q(t), n, e, a);
1242
+ function pt(n, t, e, s) {
1243
+ return _t(tt(t), n, e, s);
1215
1244
  }
1216
- function pt(n, t, e, a) {
1217
- return St(ct(t), n, e, a);
1245
+ function ct(n, t, e, s) {
1246
+ return _t(lt(t), n, e, s);
1218
1247
  }
1219
- function Dt(n, t, e, a) {
1220
- return St(tt(t, n.length - e), n, e, a);
1248
+ function Ct(n, t, e, s) {
1249
+ return _t(et(t, n.length - e), n, e, s);
1221
1250
  }
1222
- s.prototype.write = function(t, e, a, l) {
1251
+ a.prototype.write = function(t, e, s, u) {
1223
1252
  if (e === void 0)
1224
- l = "utf8", a = this.length, e = 0;
1225
- else if (a === void 0 && typeof e == "string")
1226
- l = e, a = this.length, e = 0;
1253
+ u = "utf8", s = this.length, e = 0;
1254
+ else if (s === void 0 && typeof e == "string")
1255
+ u = e, s = this.length, e = 0;
1227
1256
  else if (isFinite(e))
1228
- e = e >>> 0, isFinite(a) ? (a = a >>> 0, l === void 0 && (l = "utf8")) : (l = a, a = void 0);
1257
+ e = e >>> 0, isFinite(s) ? (s = s >>> 0, u === void 0 && (u = "utf8")) : (u = s, s = void 0);
1229
1258
  else
1230
1259
  throw new Error(
1231
1260
  "Buffer.write(string, encoding, offset[, length]) is no longer supported"
1232
1261
  );
1233
1262
  var x = this.length - e;
1234
- if ((a === void 0 || a > x) && (a = x), t.length > 0 && (a < 0 || e < 0) || e > this.length)
1263
+ if ((s === void 0 || s > x) && (s = x), t.length > 0 && (s < 0 || e < 0) || e > this.length)
1235
1264
  throw new RangeError("Attempt to write outside buffer bounds");
1236
- l || (l = "utf8");
1265
+ u || (u = "utf8");
1237
1266
  for (var d = !1; ; )
1238
- switch (l) {
1267
+ switch (u) {
1239
1268
  case "hex":
1240
- return ut(this, t, e, a);
1269
+ return ft(this, t, e, s);
1241
1270
  case "utf8":
1242
1271
  case "utf-8":
1243
- return ft(this, t, e, a);
1272
+ return ht(this, t, e, s);
1244
1273
  case "ascii":
1245
1274
  case "latin1":
1246
1275
  case "binary":
1247
- return st(this, t, e, a);
1276
+ return pt(this, t, e, s);
1248
1277
  case "base64":
1249
- return pt(this, t, e, a);
1278
+ return ct(this, t, e, s);
1250
1279
  case "ucs2":
1251
1280
  case "ucs-2":
1252
1281
  case "utf16le":
1253
1282
  case "utf-16le":
1254
- return Dt(this, t, e, a);
1283
+ return Ct(this, t, e, s);
1255
1284
  default:
1256
1285
  if (d)
1257
- throw new TypeError("Unknown encoding: " + l);
1258
- l = ("" + l).toLowerCase(), d = !0;
1286
+ throw new TypeError("Unknown encoding: " + u);
1287
+ u = ("" + u).toLowerCase(), d = !0;
1259
1288
  }
1260
- }, s.prototype.toJSON = function() {
1289
+ }, a.prototype.toJSON = function() {
1261
1290
  return {
1262
1291
  type: "Buffer",
1263
1292
  data: Array.prototype.slice.call(this._arr || this, 0)
1264
1293
  };
1265
1294
  };
1266
- function X(n, t, e) {
1295
+ function W(n, t, e) {
1267
1296
  return t === 0 && e === n.length ? r.fromByteArray(n) : r.fromByteArray(n.slice(t, e));
1268
1297
  }
1269
1298
  function m(n, t, e) {
1270
1299
  e = Math.min(n.length, e);
1271
- for (var a = [], l = t; l < e; ) {
1272
- var x = n[l], d = null, D = x > 239 ? 4 : x > 223 ? 3 : x > 191 ? 2 : 1;
1273
- if (l + D <= e) {
1274
- var N, P, G, z;
1275
- switch (D) {
1300
+ for (var s = [], u = t; u < e; ) {
1301
+ var x = n[u], d = null, k = x > 239 ? 4 : x > 223 ? 3 : x > 191 ? 2 : 1;
1302
+ if (u + k <= e) {
1303
+ var N, P, Z, z;
1304
+ switch (k) {
1276
1305
  case 1:
1277
1306
  x < 128 && (d = x);
1278
1307
  break;
1279
1308
  case 2:
1280
- N = n[l + 1], (N & 192) === 128 && (z = (x & 31) << 6 | N & 63, z > 127 && (d = z));
1309
+ N = n[u + 1], (N & 192) === 128 && (z = (x & 31) << 6 | N & 63, z > 127 && (d = z));
1281
1310
  break;
1282
1311
  case 3:
1283
- N = n[l + 1], P = n[l + 2], (N & 192) === 128 && (P & 192) === 128 && (z = (x & 15) << 12 | (N & 63) << 6 | P & 63, z > 2047 && (z < 55296 || z > 57343) && (d = z));
1312
+ N = n[u + 1], P = n[u + 2], (N & 192) === 128 && (P & 192) === 128 && (z = (x & 15) << 12 | (N & 63) << 6 | P & 63, z > 2047 && (z < 55296 || z > 57343) && (d = z));
1284
1313
  break;
1285
1314
  case 4:
1286
- N = n[l + 1], P = n[l + 2], G = n[l + 3], (N & 192) === 128 && (P & 192) === 128 && (G & 192) === 128 && (z = (x & 15) << 18 | (N & 63) << 12 | (P & 63) << 6 | G & 63, z > 65535 && z < 1114112 && (d = z));
1315
+ N = n[u + 1], P = n[u + 2], Z = n[u + 3], (N & 192) === 128 && (P & 192) === 128 && (Z & 192) === 128 && (z = (x & 15) << 18 | (N & 63) << 12 | (P & 63) << 6 | Z & 63, z > 65535 && z < 1114112 && (d = z));
1287
1316
  }
1288
1317
  }
1289
- d === null ? (d = 65533, D = 1) : d > 65535 && (d -= 65536, a.push(d >>> 10 & 1023 | 55296), d = 56320 | d & 1023), a.push(d), l += D;
1318
+ d === null ? (d = 65533, k = 1) : d > 65535 && (d -= 65536, s.push(d >>> 10 & 1023 | 55296), d = 56320 | d & 1023), s.push(d), u += k;
1290
1319
  }
1291
- return T(a);
1320
+ return D(s);
1292
1321
  }
1293
1322
  var S = 4096;
1294
- function T(n) {
1323
+ function D(n) {
1295
1324
  var t = n.length;
1296
1325
  if (t <= S)
1297
1326
  return String.fromCharCode.apply(String, n);
1298
- for (var e = "", a = 0; a < t; )
1327
+ for (var e = "", s = 0; s < t; )
1299
1328
  e += String.fromCharCode.apply(
1300
1329
  String,
1301
- n.slice(a, a += S)
1330
+ n.slice(s, s += S)
1302
1331
  );
1303
1332
  return e;
1304
1333
  }
1305
1334
  function B(n, t, e) {
1306
- var a = "";
1335
+ var s = "";
1307
1336
  e = Math.min(n.length, e);
1308
- for (var l = t; l < e; ++l)
1309
- a += String.fromCharCode(n[l] & 127);
1310
- return a;
1337
+ for (var u = t; u < e; ++u)
1338
+ s += String.fromCharCode(n[u] & 127);
1339
+ return s;
1311
1340
  }
1312
- function U(n, t, e) {
1313
- var a = "";
1341
+ function C(n, t, e) {
1342
+ var s = "";
1314
1343
  e = Math.min(n.length, e);
1315
- for (var l = t; l < e; ++l)
1316
- a += String.fromCharCode(n[l]);
1317
- return a;
1344
+ for (var u = t; u < e; ++u)
1345
+ s += String.fromCharCode(n[u]);
1346
+ return s;
1318
1347
  }
1319
1348
  function A(n, t, e) {
1320
- var a = n.length;
1321
- (!t || t < 0) && (t = 0), (!e || e < 0 || e > a) && (e = a);
1322
- for (var l = "", x = t; x < e; ++x)
1323
- l += Xe[n[x]];
1324
- return l;
1325
- }
1326
- function k(n, t, e) {
1327
- for (var a = n.slice(t, e), l = "", x = 0; x < a.length - 1; x += 2)
1328
- l += String.fromCharCode(a[x] + a[x + 1] * 256);
1329
- return l;
1330
- }
1331
- s.prototype.slice = function(t, e) {
1332
- var a = this.length;
1333
- t = ~~t, e = e === void 0 ? a : ~~e, t < 0 ? (t += a, t < 0 && (t = 0)) : t > a && (t = a), e < 0 ? (e += a, e < 0 && (e = 0)) : e > a && (e = a), e < t && (e = t);
1334
- var l = this.subarray(t, e);
1335
- return Object.setPrototypeOf(l, s.prototype), l;
1349
+ var s = n.length;
1350
+ (!t || t < 0) && (t = 0), (!e || e < 0 || e > s) && (e = s);
1351
+ for (var u = "", x = t; x < e; ++x)
1352
+ u += Ze[n[x]];
1353
+ return u;
1354
+ }
1355
+ function T(n, t, e) {
1356
+ for (var s = n.slice(t, e), u = "", x = 0; x < s.length - 1; x += 2)
1357
+ u += String.fromCharCode(s[x] + s[x + 1] * 256);
1358
+ return u;
1359
+ }
1360
+ a.prototype.slice = function(t, e) {
1361
+ var s = this.length;
1362
+ t = ~~t, e = e === void 0 ? s : ~~e, t < 0 ? (t += s, t < 0 && (t = 0)) : t > s && (t = s), e < 0 ? (e += s, e < 0 && (e = 0)) : e > s && (e = s), e < t && (e = t);
1363
+ var u = this.subarray(t, e);
1364
+ return Object.setPrototypeOf(u, a.prototype), u;
1336
1365
  };
1337
1366
  function O(n, t, e) {
1338
1367
  if (n % 1 !== 0 || n < 0)
@@ -1340,224 +1369,224 @@ Vt.write = function(i, r, o, p, u, f) {
1340
1369
  if (n + t > e)
1341
1370
  throw new RangeError("Trying to access beyond buffer length");
1342
1371
  }
1343
- s.prototype.readUintLE = s.prototype.readUIntLE = function(t, e, a) {
1344
- t = t >>> 0, e = e >>> 0, a || O(t, e, this.length);
1345
- for (var l = this[t], x = 1, d = 0; ++d < e && (x *= 256); )
1346
- l += this[t + d] * x;
1347
- return l;
1348
- }, s.prototype.readUintBE = s.prototype.readUIntBE = function(t, e, a) {
1349
- t = t >>> 0, e = e >>> 0, a || O(t, e, this.length);
1350
- for (var l = this[t + --e], x = 1; e > 0 && (x *= 256); )
1351
- l += this[t + --e] * x;
1352
- return l;
1353
- }, s.prototype.readUint8 = s.prototype.readUInt8 = function(t, e) {
1372
+ a.prototype.readUintLE = a.prototype.readUIntLE = function(t, e, s) {
1373
+ t = t >>> 0, e = e >>> 0, s || O(t, e, this.length);
1374
+ for (var u = this[t], x = 1, d = 0; ++d < e && (x *= 256); )
1375
+ u += this[t + d] * x;
1376
+ return u;
1377
+ }, a.prototype.readUintBE = a.prototype.readUIntBE = function(t, e, s) {
1378
+ t = t >>> 0, e = e >>> 0, s || O(t, e, this.length);
1379
+ for (var u = this[t + --e], x = 1; e > 0 && (x *= 256); )
1380
+ u += this[t + --e] * x;
1381
+ return u;
1382
+ }, a.prototype.readUint8 = a.prototype.readUInt8 = function(t, e) {
1354
1383
  return t = t >>> 0, e || O(t, 1, this.length), this[t];
1355
- }, s.prototype.readUint16LE = s.prototype.readUInt16LE = function(t, e) {
1384
+ }, a.prototype.readUint16LE = a.prototype.readUInt16LE = function(t, e) {
1356
1385
  return t = t >>> 0, e || O(t, 2, this.length), this[t] | this[t + 1] << 8;
1357
- }, s.prototype.readUint16BE = s.prototype.readUInt16BE = function(t, e) {
1386
+ }, a.prototype.readUint16BE = a.prototype.readUInt16BE = function(t, e) {
1358
1387
  return t = t >>> 0, e || O(t, 2, this.length), this[t] << 8 | this[t + 1];
1359
- }, s.prototype.readUint32LE = s.prototype.readUInt32LE = function(t, e) {
1388
+ }, a.prototype.readUint32LE = a.prototype.readUInt32LE = function(t, e) {
1360
1389
  return t = t >>> 0, e || O(t, 4, this.length), (this[t] | this[t + 1] << 8 | this[t + 2] << 16) + this[t + 3] * 16777216;
1361
- }, s.prototype.readUint32BE = s.prototype.readUInt32BE = function(t, e) {
1390
+ }, a.prototype.readUint32BE = a.prototype.readUInt32BE = function(t, e) {
1362
1391
  return t = t >>> 0, e || O(t, 4, this.length), this[t] * 16777216 + (this[t + 1] << 16 | this[t + 2] << 8 | this[t + 3]);
1363
- }, s.prototype.readIntLE = function(t, e, a) {
1364
- t = t >>> 0, e = e >>> 0, a || O(t, e, this.length);
1365
- for (var l = this[t], x = 1, d = 0; ++d < e && (x *= 256); )
1366
- l += this[t + d] * x;
1367
- return x *= 128, l >= x && (l -= Math.pow(2, 8 * e)), l;
1368
- }, s.prototype.readIntBE = function(t, e, a) {
1369
- t = t >>> 0, e = e >>> 0, a || O(t, e, this.length);
1370
- for (var l = e, x = 1, d = this[t + --l]; l > 0 && (x *= 256); )
1371
- d += this[t + --l] * x;
1392
+ }, a.prototype.readIntLE = function(t, e, s) {
1393
+ t = t >>> 0, e = e >>> 0, s || O(t, e, this.length);
1394
+ for (var u = this[t], x = 1, d = 0; ++d < e && (x *= 256); )
1395
+ u += this[t + d] * x;
1396
+ return x *= 128, u >= x && (u -= Math.pow(2, 8 * e)), u;
1397
+ }, a.prototype.readIntBE = function(t, e, s) {
1398
+ t = t >>> 0, e = e >>> 0, s || O(t, e, this.length);
1399
+ for (var u = e, x = 1, d = this[t + --u]; u > 0 && (x *= 256); )
1400
+ d += this[t + --u] * x;
1372
1401
  return x *= 128, d >= x && (d -= Math.pow(2, 8 * e)), d;
1373
- }, s.prototype.readInt8 = function(t, e) {
1402
+ }, a.prototype.readInt8 = function(t, e) {
1374
1403
  return t = t >>> 0, e || O(t, 1, this.length), this[t] & 128 ? (255 - this[t] + 1) * -1 : this[t];
1375
- }, s.prototype.readInt16LE = function(t, e) {
1404
+ }, a.prototype.readInt16LE = function(t, e) {
1376
1405
  t = t >>> 0, e || O(t, 2, this.length);
1377
- var a = this[t] | this[t + 1] << 8;
1378
- return a & 32768 ? a | 4294901760 : a;
1379
- }, s.prototype.readInt16BE = function(t, e) {
1406
+ var s = this[t] | this[t + 1] << 8;
1407
+ return s & 32768 ? s | 4294901760 : s;
1408
+ }, a.prototype.readInt16BE = function(t, e) {
1380
1409
  t = t >>> 0, e || O(t, 2, this.length);
1381
- var a = this[t + 1] | this[t] << 8;
1382
- return a & 32768 ? a | 4294901760 : a;
1383
- }, s.prototype.readInt32LE = function(t, e) {
1410
+ var s = this[t + 1] | this[t] << 8;
1411
+ return s & 32768 ? s | 4294901760 : s;
1412
+ }, a.prototype.readInt32LE = function(t, e) {
1384
1413
  return t = t >>> 0, e || O(t, 4, this.length), this[t] | this[t + 1] << 8 | this[t + 2] << 16 | this[t + 3] << 24;
1385
- }, s.prototype.readInt32BE = function(t, e) {
1414
+ }, a.prototype.readInt32BE = function(t, e) {
1386
1415
  return t = t >>> 0, e || O(t, 4, this.length), this[t] << 24 | this[t + 1] << 16 | this[t + 2] << 8 | this[t + 3];
1387
- }, s.prototype.readFloatLE = function(t, e) {
1416
+ }, a.prototype.readFloatLE = function(t, e) {
1388
1417
  return t = t >>> 0, e || O(t, 4, this.length), o.read(this, t, !0, 23, 4);
1389
- }, s.prototype.readFloatBE = function(t, e) {
1418
+ }, a.prototype.readFloatBE = function(t, e) {
1390
1419
  return t = t >>> 0, e || O(t, 4, this.length), o.read(this, t, !1, 23, 4);
1391
- }, s.prototype.readDoubleLE = function(t, e) {
1420
+ }, a.prototype.readDoubleLE = function(t, e) {
1392
1421
  return t = t >>> 0, e || O(t, 8, this.length), o.read(this, t, !0, 52, 8);
1393
- }, s.prototype.readDoubleBE = function(t, e) {
1422
+ }, a.prototype.readDoubleBE = function(t, e) {
1394
1423
  return t = t >>> 0, e || O(t, 8, this.length), o.read(this, t, !1, 52, 8);
1395
1424
  };
1396
- function I(n, t, e, a, l, x) {
1397
- if (!s.isBuffer(n))
1425
+ function I(n, t, e, s, u, x) {
1426
+ if (!a.isBuffer(n))
1398
1427
  throw new TypeError('"buffer" argument must be a Buffer instance');
1399
- if (t > l || t < x)
1428
+ if (t > u || t < x)
1400
1429
  throw new RangeError('"value" argument is out of bounds');
1401
- if (e + a > n.length)
1430
+ if (e + s > n.length)
1402
1431
  throw new RangeError("Index out of range");
1403
1432
  }
1404
- s.prototype.writeUintLE = s.prototype.writeUIntLE = function(t, e, a, l) {
1405
- if (t = +t, e = e >>> 0, a = a >>> 0, !l) {
1406
- var x = Math.pow(2, 8 * a) - 1;
1407
- I(this, t, e, a, x, 0);
1433
+ a.prototype.writeUintLE = a.prototype.writeUIntLE = function(t, e, s, u) {
1434
+ if (t = +t, e = e >>> 0, s = s >>> 0, !u) {
1435
+ var x = Math.pow(2, 8 * s) - 1;
1436
+ I(this, t, e, s, x, 0);
1408
1437
  }
1409
- var d = 1, D = 0;
1410
- for (this[e] = t & 255; ++D < a && (d *= 256); )
1411
- this[e + D] = t / d & 255;
1412
- return e + a;
1413
- }, s.prototype.writeUintBE = s.prototype.writeUIntBE = function(t, e, a, l) {
1414
- if (t = +t, e = e >>> 0, a = a >>> 0, !l) {
1415
- var x = Math.pow(2, 8 * a) - 1;
1416
- I(this, t, e, a, x, 0);
1438
+ var d = 1, k = 0;
1439
+ for (this[e] = t & 255; ++k < s && (d *= 256); )
1440
+ this[e + k] = t / d & 255;
1441
+ return e + s;
1442
+ }, a.prototype.writeUintBE = a.prototype.writeUIntBE = function(t, e, s, u) {
1443
+ if (t = +t, e = e >>> 0, s = s >>> 0, !u) {
1444
+ var x = Math.pow(2, 8 * s) - 1;
1445
+ I(this, t, e, s, x, 0);
1417
1446
  }
1418
- var d = a - 1, D = 1;
1419
- for (this[e + d] = t & 255; --d >= 0 && (D *= 256); )
1420
- this[e + d] = t / D & 255;
1421
- return e + a;
1422
- }, s.prototype.writeUint8 = s.prototype.writeUInt8 = function(t, e, a) {
1423
- return t = +t, e = e >>> 0, a || I(this, t, e, 1, 255, 0), this[e] = t & 255, e + 1;
1424
- }, s.prototype.writeUint16LE = s.prototype.writeUInt16LE = function(t, e, a) {
1425
- return t = +t, e = e >>> 0, a || I(this, t, e, 2, 65535, 0), this[e] = t & 255, this[e + 1] = t >>> 8, e + 2;
1426
- }, s.prototype.writeUint16BE = s.prototype.writeUInt16BE = function(t, e, a) {
1427
- return t = +t, e = e >>> 0, a || I(this, t, e, 2, 65535, 0), this[e] = t >>> 8, this[e + 1] = t & 255, e + 2;
1428
- }, s.prototype.writeUint32LE = s.prototype.writeUInt32LE = function(t, e, a) {
1429
- return t = +t, e = e >>> 0, a || I(this, t, e, 4, 4294967295, 0), this[e + 3] = t >>> 24, this[e + 2] = t >>> 16, this[e + 1] = t >>> 8, this[e] = t & 255, e + 4;
1430
- }, s.prototype.writeUint32BE = s.prototype.writeUInt32BE = function(t, e, a) {
1431
- return t = +t, e = e >>> 0, a || I(this, t, e, 4, 4294967295, 0), this[e] = t >>> 24, this[e + 1] = t >>> 16, this[e + 2] = t >>> 8, this[e + 3] = t & 255, e + 4;
1432
- }, s.prototype.writeIntLE = function(t, e, a, l) {
1433
- if (t = +t, e = e >>> 0, !l) {
1434
- var x = Math.pow(2, 8 * a - 1);
1435
- I(this, t, e, a, x - 1, -x);
1447
+ var d = s - 1, k = 1;
1448
+ for (this[e + d] = t & 255; --d >= 0 && (k *= 256); )
1449
+ this[e + d] = t / k & 255;
1450
+ return e + s;
1451
+ }, a.prototype.writeUint8 = a.prototype.writeUInt8 = function(t, e, s) {
1452
+ return t = +t, e = e >>> 0, s || I(this, t, e, 1, 255, 0), this[e] = t & 255, e + 1;
1453
+ }, a.prototype.writeUint16LE = a.prototype.writeUInt16LE = function(t, e, s) {
1454
+ return t = +t, e = e >>> 0, s || I(this, t, e, 2, 65535, 0), this[e] = t & 255, this[e + 1] = t >>> 8, e + 2;
1455
+ }, a.prototype.writeUint16BE = a.prototype.writeUInt16BE = function(t, e, s) {
1456
+ return t = +t, e = e >>> 0, s || I(this, t, e, 2, 65535, 0), this[e] = t >>> 8, this[e + 1] = t & 255, e + 2;
1457
+ }, a.prototype.writeUint32LE = a.prototype.writeUInt32LE = function(t, e, s) {
1458
+ return t = +t, e = e >>> 0, s || I(this, t, e, 4, 4294967295, 0), this[e + 3] = t >>> 24, this[e + 2] = t >>> 16, this[e + 1] = t >>> 8, this[e] = t & 255, e + 4;
1459
+ }, a.prototype.writeUint32BE = a.prototype.writeUInt32BE = function(t, e, s) {
1460
+ return t = +t, e = e >>> 0, s || I(this, t, e, 4, 4294967295, 0), this[e] = t >>> 24, this[e + 1] = t >>> 16, this[e + 2] = t >>> 8, this[e + 3] = t & 255, e + 4;
1461
+ }, a.prototype.writeIntLE = function(t, e, s, u) {
1462
+ if (t = +t, e = e >>> 0, !u) {
1463
+ var x = Math.pow(2, 8 * s - 1);
1464
+ I(this, t, e, s, x - 1, -x);
1436
1465
  }
1437
- var d = 0, D = 1, N = 0;
1438
- for (this[e] = t & 255; ++d < a && (D *= 256); )
1439
- t < 0 && N === 0 && this[e + d - 1] !== 0 && (N = 1), this[e + d] = (t / D >> 0) - N & 255;
1440
- return e + a;
1441
- }, s.prototype.writeIntBE = function(t, e, a, l) {
1442
- if (t = +t, e = e >>> 0, !l) {
1443
- var x = Math.pow(2, 8 * a - 1);
1444
- I(this, t, e, a, x - 1, -x);
1466
+ var d = 0, k = 1, N = 0;
1467
+ for (this[e] = t & 255; ++d < s && (k *= 256); )
1468
+ t < 0 && N === 0 && this[e + d - 1] !== 0 && (N = 1), this[e + d] = (t / k >> 0) - N & 255;
1469
+ return e + s;
1470
+ }, a.prototype.writeIntBE = function(t, e, s, u) {
1471
+ if (t = +t, e = e >>> 0, !u) {
1472
+ var x = Math.pow(2, 8 * s - 1);
1473
+ I(this, t, e, s, x - 1, -x);
1445
1474
  }
1446
- var d = a - 1, D = 1, N = 0;
1447
- for (this[e + d] = t & 255; --d >= 0 && (D *= 256); )
1448
- t < 0 && N === 0 && this[e + d + 1] !== 0 && (N = 1), this[e + d] = (t / D >> 0) - N & 255;
1449
- return e + a;
1450
- }, s.prototype.writeInt8 = function(t, e, a) {
1451
- return t = +t, e = e >>> 0, a || I(this, t, e, 1, 127, -128), t < 0 && (t = 255 + t + 1), this[e] = t & 255, e + 1;
1452
- }, s.prototype.writeInt16LE = function(t, e, a) {
1453
- return t = +t, e = e >>> 0, a || I(this, t, e, 2, 32767, -32768), this[e] = t & 255, this[e + 1] = t >>> 8, e + 2;
1454
- }, s.prototype.writeInt16BE = function(t, e, a) {
1455
- return t = +t, e = e >>> 0, a || I(this, t, e, 2, 32767, -32768), this[e] = t >>> 8, this[e + 1] = t & 255, e + 2;
1456
- }, s.prototype.writeInt32LE = function(t, e, a) {
1457
- return t = +t, e = e >>> 0, a || I(this, t, e, 4, 2147483647, -2147483648), this[e] = t & 255, this[e + 1] = t >>> 8, this[e + 2] = t >>> 16, this[e + 3] = t >>> 24, e + 4;
1458
- }, s.prototype.writeInt32BE = function(t, e, a) {
1459
- return t = +t, e = e >>> 0, a || I(this, t, e, 4, 2147483647, -2147483648), t < 0 && (t = 4294967295 + t + 1), this[e] = t >>> 24, this[e + 1] = t >>> 16, this[e + 2] = t >>> 8, this[e + 3] = t & 255, e + 4;
1475
+ var d = s - 1, k = 1, N = 0;
1476
+ for (this[e + d] = t & 255; --d >= 0 && (k *= 256); )
1477
+ t < 0 && N === 0 && this[e + d + 1] !== 0 && (N = 1), this[e + d] = (t / k >> 0) - N & 255;
1478
+ return e + s;
1479
+ }, a.prototype.writeInt8 = function(t, e, s) {
1480
+ return t = +t, e = e >>> 0, s || I(this, t, e, 1, 127, -128), t < 0 && (t = 255 + t + 1), this[e] = t & 255, e + 1;
1481
+ }, a.prototype.writeInt16LE = function(t, e, s) {
1482
+ return t = +t, e = e >>> 0, s || I(this, t, e, 2, 32767, -32768), this[e] = t & 255, this[e + 1] = t >>> 8, e + 2;
1483
+ }, a.prototype.writeInt16BE = function(t, e, s) {
1484
+ return t = +t, e = e >>> 0, s || I(this, t, e, 2, 32767, -32768), this[e] = t >>> 8, this[e + 1] = t & 255, e + 2;
1485
+ }, a.prototype.writeInt32LE = function(t, e, s) {
1486
+ return t = +t, e = e >>> 0, s || I(this, t, e, 4, 2147483647, -2147483648), this[e] = t & 255, this[e + 1] = t >>> 8, this[e + 2] = t >>> 16, this[e + 3] = t >>> 24, e + 4;
1487
+ }, a.prototype.writeInt32BE = function(t, e, s) {
1488
+ return t = +t, e = e >>> 0, s || I(this, t, e, 4, 2147483647, -2147483648), t < 0 && (t = 4294967295 + t + 1), this[e] = t >>> 24, this[e + 1] = t >>> 16, this[e + 2] = t >>> 8, this[e + 3] = t & 255, e + 4;
1460
1489
  };
1461
- function L(n, t, e, a, l, x) {
1462
- if (e + a > n.length)
1490
+ function L(n, t, e, s, u, x) {
1491
+ if (e + s > n.length)
1463
1492
  throw new RangeError("Index out of range");
1464
1493
  if (e < 0)
1465
1494
  throw new RangeError("Index out of range");
1466
1495
  }
1467
- function H(n, t, e, a, l) {
1468
- return t = +t, e = e >>> 0, l || L(n, t, e, 4), o.write(n, t, e, a, 23, 4), e + 4;
1496
+ function H(n, t, e, s, u) {
1497
+ return t = +t, e = e >>> 0, u || L(n, t, e, 4), o.write(n, t, e, s, 23, 4), e + 4;
1469
1498
  }
1470
- s.prototype.writeFloatLE = function(t, e, a) {
1471
- return H(this, t, e, !0, a);
1472
- }, s.prototype.writeFloatBE = function(t, e, a) {
1473
- return H(this, t, e, !1, a);
1499
+ a.prototype.writeFloatLE = function(t, e, s) {
1500
+ return H(this, t, e, !0, s);
1501
+ }, a.prototype.writeFloatBE = function(t, e, s) {
1502
+ return H(this, t, e, !1, s);
1474
1503
  };
1475
- function $(n, t, e, a, l) {
1476
- return t = +t, e = e >>> 0, l || L(n, t, e, 8), o.write(n, t, e, a, 52, 8), e + 8;
1477
- }
1478
- s.prototype.writeDoubleLE = function(t, e, a) {
1479
- return $(this, t, e, !0, a);
1480
- }, s.prototype.writeDoubleBE = function(t, e, a) {
1481
- return $(this, t, e, !1, a);
1482
- }, s.prototype.copy = function(t, e, a, l) {
1483
- if (!s.isBuffer(t))
1504
+ function $(n, t, e, s, u) {
1505
+ return t = +t, e = e >>> 0, u || L(n, t, e, 8), o.write(n, t, e, s, 52, 8), e + 8;
1506
+ }
1507
+ a.prototype.writeDoubleLE = function(t, e, s) {
1508
+ return $(this, t, e, !0, s);
1509
+ }, a.prototype.writeDoubleBE = function(t, e, s) {
1510
+ return $(this, t, e, !1, s);
1511
+ }, a.prototype.copy = function(t, e, s, u) {
1512
+ if (!a.isBuffer(t))
1484
1513
  throw new TypeError("argument should be a Buffer");
1485
- if (a || (a = 0), !l && l !== 0 && (l = this.length), e >= t.length && (e = t.length), e || (e = 0), l > 0 && l < a && (l = a), l === a || t.length === 0 || this.length === 0)
1514
+ if (s || (s = 0), !u && u !== 0 && (u = this.length), e >= t.length && (e = t.length), e || (e = 0), u > 0 && u < s && (u = s), u === s || t.length === 0 || this.length === 0)
1486
1515
  return 0;
1487
1516
  if (e < 0)
1488
1517
  throw new RangeError("targetStart out of bounds");
1489
- if (a < 0 || a >= this.length)
1518
+ if (s < 0 || s >= this.length)
1490
1519
  throw new RangeError("Index out of range");
1491
- if (l < 0)
1520
+ if (u < 0)
1492
1521
  throw new RangeError("sourceEnd out of bounds");
1493
- l > this.length && (l = this.length), t.length - e < l - a && (l = t.length - e + a);
1494
- var x = l - a;
1495
- return this === t && typeof Uint8Array.prototype.copyWithin == "function" ? this.copyWithin(e, a, l) : Uint8Array.prototype.set.call(
1522
+ u > this.length && (u = this.length), t.length - e < u - s && (u = t.length - e + s);
1523
+ var x = u - s;
1524
+ return this === t && typeof Uint8Array.prototype.copyWithin == "function" ? this.copyWithin(e, s, u) : Uint8Array.prototype.set.call(
1496
1525
  t,
1497
- this.subarray(a, l),
1526
+ this.subarray(s, u),
1498
1527
  e
1499
1528
  ), x;
1500
- }, s.prototype.fill = function(t, e, a, l) {
1529
+ }, a.prototype.fill = function(t, e, s, u) {
1501
1530
  if (typeof t == "string") {
1502
- if (typeof e == "string" ? (l = e, e = 0, a = this.length) : typeof a == "string" && (l = a, a = this.length), l !== void 0 && typeof l != "string")
1531
+ if (typeof e == "string" ? (u = e, e = 0, s = this.length) : typeof s == "string" && (u = s, s = this.length), u !== void 0 && typeof u != "string")
1503
1532
  throw new TypeError("encoding must be a string");
1504
- if (typeof l == "string" && !s.isEncoding(l))
1505
- throw new TypeError("Unknown encoding: " + l);
1533
+ if (typeof u == "string" && !a.isEncoding(u))
1534
+ throw new TypeError("Unknown encoding: " + u);
1506
1535
  if (t.length === 1) {
1507
1536
  var x = t.charCodeAt(0);
1508
- (l === "utf8" && x < 128 || l === "latin1") && (t = x);
1537
+ (u === "utf8" && x < 128 || u === "latin1") && (t = x);
1509
1538
  }
1510
1539
  } else
1511
1540
  typeof t == "number" ? t = t & 255 : typeof t == "boolean" && (t = Number(t));
1512
- if (e < 0 || this.length < e || this.length < a)
1541
+ if (e < 0 || this.length < e || this.length < s)
1513
1542
  throw new RangeError("Out of range index");
1514
- if (a <= e)
1543
+ if (s <= e)
1515
1544
  return this;
1516
- e = e >>> 0, a = a === void 0 ? this.length : a >>> 0, t || (t = 0);
1545
+ e = e >>> 0, s = s === void 0 ? this.length : s >>> 0, t || (t = 0);
1517
1546
  var d;
1518
1547
  if (typeof t == "number")
1519
- for (d = e; d < a; ++d)
1548
+ for (d = e; d < s; ++d)
1520
1549
  this[d] = t;
1521
1550
  else {
1522
- var D = s.isBuffer(t) ? t : s.from(t, l), N = D.length;
1551
+ var k = a.isBuffer(t) ? t : a.from(t, u), N = k.length;
1523
1552
  if (N === 0)
1524
1553
  throw new TypeError('The value "' + t + '" is invalid for argument "value"');
1525
- for (d = 0; d < a - e; ++d)
1526
- this[d + e] = D[d % N];
1554
+ for (d = 0; d < s - e; ++d)
1555
+ this[d + e] = k[d % N];
1527
1556
  }
1528
1557
  return this;
1529
1558
  };
1530
1559
  var K = /[^+/0-9A-Za-z-_]/g;
1531
- function Y(n) {
1560
+ function Q(n) {
1532
1561
  if (n = n.split("=")[0], n = n.trim().replace(K, ""), n.length < 2)
1533
1562
  return "";
1534
1563
  for (; n.length % 4 !== 0; )
1535
1564
  n = n + "=";
1536
1565
  return n;
1537
1566
  }
1538
- function V(n, t) {
1567
+ function X(n, t) {
1539
1568
  t = t || 1 / 0;
1540
- for (var e, a = n.length, l = null, x = [], d = 0; d < a; ++d) {
1569
+ for (var e, s = n.length, u = null, x = [], d = 0; d < s; ++d) {
1541
1570
  if (e = n.charCodeAt(d), e > 55295 && e < 57344) {
1542
- if (!l) {
1571
+ if (!u) {
1543
1572
  if (e > 56319) {
1544
1573
  (t -= 3) > -1 && x.push(239, 191, 189);
1545
1574
  continue;
1546
- } else if (d + 1 === a) {
1575
+ } else if (d + 1 === s) {
1547
1576
  (t -= 3) > -1 && x.push(239, 191, 189);
1548
1577
  continue;
1549
1578
  }
1550
- l = e;
1579
+ u = e;
1551
1580
  continue;
1552
1581
  }
1553
1582
  if (e < 56320) {
1554
- (t -= 3) > -1 && x.push(239, 191, 189), l = e;
1583
+ (t -= 3) > -1 && x.push(239, 191, 189), u = e;
1555
1584
  continue;
1556
1585
  }
1557
- e = (l - 55296 << 10 | e - 56320) + 65536;
1586
+ e = (u - 55296 << 10 | e - 56320) + 65536;
1558
1587
  } else
1559
- l && (t -= 3) > -1 && x.push(239, 191, 189);
1560
- if (l = null, e < 128) {
1588
+ u && (t -= 3) > -1 && x.push(239, 191, 189);
1589
+ if (u = null, e < 128) {
1561
1590
  if ((t -= 1) < 0)
1562
1591
  break;
1563
1592
  x.push(e);
@@ -1590,57 +1619,57 @@ Vt.write = function(i, r, o, p, u, f) {
1590
1619
  }
1591
1620
  return x;
1592
1621
  }
1593
- function Q(n) {
1622
+ function tt(n) {
1594
1623
  for (var t = [], e = 0; e < n.length; ++e)
1595
1624
  t.push(n.charCodeAt(e) & 255);
1596
1625
  return t;
1597
1626
  }
1598
- function tt(n, t) {
1599
- for (var e, a, l, x = [], d = 0; d < n.length && !((t -= 2) < 0); ++d)
1600
- e = n.charCodeAt(d), a = e >> 8, l = e % 256, x.push(l), x.push(a);
1627
+ function et(n, t) {
1628
+ for (var e, s, u, x = [], d = 0; d < n.length && !((t -= 2) < 0); ++d)
1629
+ e = n.charCodeAt(d), s = e >> 8, u = e % 256, x.push(u), x.push(s);
1601
1630
  return x;
1602
1631
  }
1603
- function ct(n) {
1604
- return r.toByteArray(Y(n));
1632
+ function lt(n) {
1633
+ return r.toByteArray(Q(n));
1605
1634
  }
1606
- function St(n, t, e, a) {
1607
- for (var l = 0; l < a && !(l + e >= t.length || l >= n.length); ++l)
1608
- t[l + e] = n[l];
1609
- return l;
1635
+ function _t(n, t, e, s) {
1636
+ for (var u = 0; u < s && !(u + e >= t.length || u >= n.length); ++u)
1637
+ t[u + e] = n[u];
1638
+ return u;
1610
1639
  }
1611
- function rt(n, t) {
1640
+ function nt(n, t) {
1612
1641
  return n instanceof t || n != null && n.constructor != null && n.constructor.name != null && n.constructor.name === t.name;
1613
1642
  }
1614
- function Ct(n) {
1643
+ function $t(n) {
1615
1644
  return n !== n;
1616
1645
  }
1617
- var Xe = function() {
1646
+ var Ze = function() {
1618
1647
  for (var n = "0123456789abcdef", t = new Array(256), e = 0; e < 16; ++e)
1619
- for (var a = e * 16, l = 0; l < 16; ++l)
1620
- t[a + l] = n[e] + n[l];
1648
+ for (var s = e * 16, u = 0; u < 16; ++u)
1649
+ t[s + u] = n[e] + n[u];
1621
1650
  return t;
1622
1651
  }();
1623
- })(Se);
1652
+ })(Fe);
1624
1653
  /*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
1625
1654
  (function(i, r) {
1626
- var o = Se, p = o.Buffer;
1627
- function u(c, s) {
1655
+ var o = Fe, p = o.Buffer;
1656
+ function l(c, a) {
1628
1657
  for (var h in c)
1629
- s[h] = c[h];
1658
+ a[h] = c[h];
1630
1659
  }
1631
- p.from && p.alloc && p.allocUnsafe && p.allocUnsafeSlow ? i.exports = o : (u(o, r), r.Buffer = f);
1632
- function f(c, s, h) {
1633
- return p(c, s, h);
1660
+ p.from && p.alloc && p.allocUnsafe && p.allocUnsafeSlow ? i.exports = o : (l(o, r), r.Buffer = f);
1661
+ function f(c, a, h) {
1662
+ return p(c, a, h);
1634
1663
  }
1635
- f.prototype = Object.create(p.prototype), u(p, f), f.from = function(c, s, h) {
1664
+ f.prototype = Object.create(p.prototype), l(p, f), f.from = function(c, a, h) {
1636
1665
  if (typeof c == "number")
1637
1666
  throw new TypeError("Argument must not be a number");
1638
- return p(c, s, h);
1639
- }, f.alloc = function(c, s, h) {
1667
+ return p(c, a, h);
1668
+ }, f.alloc = function(c, a, h) {
1640
1669
  if (typeof c != "number")
1641
1670
  throw new TypeError("Argument must be a number");
1642
1671
  var g = p(c);
1643
- return s !== void 0 ? typeof h == "string" ? g.fill(s, h) : g.fill(s) : g.fill(0), g;
1672
+ return a !== void 0 ? typeof h == "string" ? g.fill(a, h) : g.fill(a) : g.fill(0), g;
1644
1673
  }, f.allocUnsafe = function(c) {
1645
1674
  if (typeof c != "number")
1646
1675
  throw new TypeError("Argument must be a number");
@@ -1650,80 +1679,80 @@ Vt.write = function(i, r, o, p, u, f) {
1650
1679
  throw new TypeError("Argument must be a number");
1651
1680
  return o.SlowBuffer(c);
1652
1681
  };
1653
- })(Rt, Rt.exports);
1654
- var Kt = Rt.exports, Ae = Kt.Buffer;
1655
- function Tt(i, r) {
1656
- this._block = Ae.alloc(i), this._finalSize = r, this._blockSize = i, this._len = 0;
1657
- }
1658
- Tt.prototype.update = function(i, r) {
1659
- typeof i == "string" && (r = r || "utf8", i = Ae.from(i, r));
1660
- for (var o = this._block, p = this._blockSize, u = i.length, f = this._len, c = 0; c < u; ) {
1661
- for (var s = f % p, h = Math.min(u - c, p - s), g = 0; g < h; g++)
1662
- o[s + g] = i[c + g];
1682
+ })(Pt, Pt.exports);
1683
+ var Zt = Pt.exports, Be = Zt.Buffer;
1684
+ function kt(i, r) {
1685
+ this._block = Be.alloc(i), this._finalSize = r, this._blockSize = i, this._len = 0;
1686
+ }
1687
+ kt.prototype.update = function(i, r) {
1688
+ typeof i == "string" && (r = r || "utf8", i = Be.from(i, r));
1689
+ for (var o = this._block, p = this._blockSize, l = i.length, f = this._len, c = 0; c < l; ) {
1690
+ for (var a = f % p, h = Math.min(l - c, p - a), g = 0; g < h; g++)
1691
+ o[a + g] = i[c + g];
1663
1692
  f += h, c += h, f % p === 0 && this._update(o);
1664
1693
  }
1665
- return this._len += u, this;
1694
+ return this._len += l, this;
1666
1695
  };
1667
- Tt.prototype.digest = function(i) {
1696
+ kt.prototype.digest = function(i) {
1668
1697
  var r = this._len % this._blockSize;
1669
1698
  this._block[r] = 128, this._block.fill(0, r + 1), r >= this._finalSize && (this._update(this._block), this._block.fill(0));
1670
1699
  var o = this._len * 8;
1671
1700
  if (o <= 4294967295)
1672
1701
  this._block.writeUInt32BE(o, this._blockSize - 4);
1673
1702
  else {
1674
- var p = (o & 4294967295) >>> 0, u = (o - p) / 4294967296;
1675
- this._block.writeUInt32BE(u, this._blockSize - 8), this._block.writeUInt32BE(p, this._blockSize - 4);
1703
+ var p = (o & 4294967295) >>> 0, l = (o - p) / 4294967296;
1704
+ this._block.writeUInt32BE(l, this._blockSize - 8), this._block.writeUInt32BE(p, this._blockSize - 4);
1676
1705
  }
1677
1706
  this._update(this._block);
1678
1707
  var f = this._hash();
1679
1708
  return i ? f.toString(i) : f;
1680
1709
  };
1681
- Tt.prototype._update = function() {
1710
+ kt.prototype._update = function() {
1682
1711
  throw new Error("_update must be implemented by subclass");
1683
1712
  };
1684
- var Fe = Tt, Ei = ve, Oe = Fe, bi = Kt.Buffer, vi = [
1713
+ var Ie = kt, Ii = Ae, je = Ie, ji = Zt.Buffer, Di = [
1685
1714
  1518500249,
1686
1715
  1859775393,
1687
1716
  -1894007588,
1688
1717
  -899497514
1689
- ], Si = new Array(80);
1690
- function bt() {
1691
- this.init(), this._w = Si, Oe.call(this, 64, 56);
1718
+ ], Ti = new Array(80);
1719
+ function vt() {
1720
+ this.init(), this._w = Ti, je.call(this, 64, 56);
1692
1721
  }
1693
- Ei(bt, Oe);
1694
- bt.prototype.init = function() {
1722
+ Ii(vt, je);
1723
+ vt.prototype.init = function() {
1695
1724
  return this._a = 1732584193, this._b = 4023233417, this._c = 2562383102, this._d = 271733878, this._e = 3285377520, this;
1696
1725
  };
1697
- function _i(i) {
1726
+ function ki(i) {
1698
1727
  return i << 1 | i >>> 31;
1699
1728
  }
1700
- function Ai(i) {
1729
+ function Ui(i) {
1701
1730
  return i << 5 | i >>> 27;
1702
1731
  }
1703
- function Fi(i) {
1732
+ function Ci(i) {
1704
1733
  return i << 30 | i >>> 2;
1705
1734
  }
1706
- function Oi(i, r, o, p) {
1735
+ function $i(i, r, o, p) {
1707
1736
  return i === 0 ? r & o | ~r & p : i === 2 ? r & o | r & p | o & p : r ^ o ^ p;
1708
1737
  }
1709
- bt.prototype._update = function(i) {
1710
- for (var r = this._w, o = this._a | 0, p = this._b | 0, u = this._c | 0, f = this._d | 0, c = this._e | 0, s = 0; s < 16; ++s)
1711
- r[s] = i.readInt32BE(s * 4);
1712
- for (; s < 80; ++s)
1713
- r[s] = _i(r[s - 3] ^ r[s - 8] ^ r[s - 14] ^ r[s - 16]);
1738
+ vt.prototype._update = function(i) {
1739
+ for (var r = this._w, o = this._a | 0, p = this._b | 0, l = this._c | 0, f = this._d | 0, c = this._e | 0, a = 0; a < 16; ++a)
1740
+ r[a] = i.readInt32BE(a * 4);
1741
+ for (; a < 80; ++a)
1742
+ r[a] = ki(r[a - 3] ^ r[a - 8] ^ r[a - 14] ^ r[a - 16]);
1714
1743
  for (var h = 0; h < 80; ++h) {
1715
- var g = ~~(h / 20), y = Ai(o) + Oi(g, p, u, f) + c + r[h] + vi[g] | 0;
1716
- c = f, f = u, u = Fi(p), p = o, o = y;
1744
+ var g = ~~(h / 20), y = Ui(o) + $i(g, p, l, f) + c + r[h] + Di[g] | 0;
1745
+ c = f, f = l, l = Ci(p), p = o, o = y;
1717
1746
  }
1718
- this._a = o + this._a | 0, this._b = p + this._b | 0, this._c = u + this._c | 0, this._d = f + this._d | 0, this._e = c + this._e | 0;
1747
+ this._a = o + this._a | 0, this._b = p + this._b | 0, this._c = l + this._c | 0, this._d = f + this._d | 0, this._e = c + this._e | 0;
1719
1748
  };
1720
- bt.prototype._hash = function() {
1721
- var i = bi.allocUnsafe(20);
1749
+ vt.prototype._hash = function() {
1750
+ var i = ji.allocUnsafe(20);
1722
1751
  return i.writeInt32BE(this._a | 0, 0), i.writeInt32BE(this._b | 0, 4), i.writeInt32BE(this._c | 0, 8), i.writeInt32BE(this._d | 0, 12), i.writeInt32BE(this._e | 0, 16), i;
1723
1752
  };
1724
- var Bi = bt;
1725
- const Ii = /* @__PURE__ */ Xt(Bi);
1726
- var ji = ve, Be = Fe, Ti = Kt.Buffer, ki = [
1753
+ var Ni = vt;
1754
+ const Mi = /* @__PURE__ */ Kt(Ni);
1755
+ var Ri = Ae, De = Ie, Li = Zt.Buffer, Pi = [
1727
1756
  1116352408,
1728
1757
  1899447441,
1729
1758
  3049323471,
@@ -1788,92 +1817,92 @@ var ji = ve, Be = Fe, Ti = Kt.Buffer, ki = [
1788
1817
  2756734187,
1789
1818
  3204031479,
1790
1819
  3329325298
1791
- ], Di = new Array(64);
1792
- function vt() {
1793
- this.init(), this._w = Di, Be.call(this, 64, 56);
1820
+ ], zi = new Array(64);
1821
+ function St() {
1822
+ this.init(), this._w = zi, De.call(this, 64, 56);
1794
1823
  }
1795
- ji(vt, Be);
1796
- vt.prototype.init = function() {
1824
+ Ri(St, De);
1825
+ St.prototype.init = function() {
1797
1826
  return this._a = 1779033703, this._b = 3144134277, this._c = 1013904242, this._d = 2773480762, this._e = 1359893119, this._f = 2600822924, this._g = 528734635, this._h = 1541459225, this;
1798
1827
  };
1799
- function Ci(i, r, o) {
1828
+ function qi(i, r, o) {
1800
1829
  return o ^ i & (r ^ o);
1801
1830
  }
1802
- function Ui(i, r, o) {
1831
+ function Hi(i, r, o) {
1803
1832
  return i & r | o & (i | r);
1804
1833
  }
1805
- function $i(i) {
1834
+ function Ji(i) {
1806
1835
  return (i >>> 2 | i << 30) ^ (i >>> 13 | i << 19) ^ (i >>> 22 | i << 10);
1807
1836
  }
1808
- function Ni(i) {
1837
+ function Vi(i) {
1809
1838
  return (i >>> 6 | i << 26) ^ (i >>> 11 | i << 21) ^ (i >>> 25 | i << 7);
1810
1839
  }
1811
- function Mi(i) {
1840
+ function Wi(i) {
1812
1841
  return (i >>> 7 | i << 25) ^ (i >>> 18 | i << 14) ^ i >>> 3;
1813
1842
  }
1814
- function Ri(i) {
1843
+ function Xi(i) {
1815
1844
  return (i >>> 17 | i << 15) ^ (i >>> 19 | i << 13) ^ i >>> 10;
1816
1845
  }
1817
- vt.prototype._update = function(i) {
1818
- for (var r = this._w, o = this._a | 0, p = this._b | 0, u = this._c | 0, f = this._d | 0, c = this._e | 0, s = this._f | 0, h = this._g | 0, g = this._h | 0, y = 0; y < 16; ++y)
1846
+ St.prototype._update = function(i) {
1847
+ for (var r = this._w, o = this._a | 0, p = this._b | 0, l = this._c | 0, f = this._d | 0, c = this._e | 0, a = this._f | 0, h = this._g | 0, g = this._h | 0, y = 0; y < 16; ++y)
1819
1848
  r[y] = i.readInt32BE(y * 4);
1820
1849
  for (; y < 64; ++y)
1821
- r[y] = Ri(r[y - 2]) + r[y - 7] + Mi(r[y - 15]) + r[y - 16] | 0;
1850
+ r[y] = Xi(r[y - 2]) + r[y - 7] + Wi(r[y - 15]) + r[y - 16] | 0;
1822
1851
  for (var b = 0; b < 64; ++b) {
1823
- var F = g + Ni(c) + Ci(c, s, h) + ki[b] + r[b] | 0, j = $i(o) + Ui(o, p, u) | 0;
1824
- g = h, h = s, s = c, c = f + F | 0, f = u, u = p, p = o, o = F + j | 0;
1852
+ var F = g + Vi(c) + qi(c, a, h) + Pi[b] + r[b] | 0, j = Ji(o) + Hi(o, p, l) | 0;
1853
+ g = h, h = a, a = c, c = f + F | 0, f = l, l = p, p = o, o = F + j | 0;
1825
1854
  }
1826
- this._a = o + this._a | 0, this._b = p + this._b | 0, this._c = u + this._c | 0, this._d = f + this._d | 0, this._e = c + this._e | 0, this._f = s + this._f | 0, this._g = h + this._g | 0, this._h = g + this._h | 0;
1855
+ this._a = o + this._a | 0, this._b = p + this._b | 0, this._c = l + this._c | 0, this._d = f + this._d | 0, this._e = c + this._e | 0, this._f = a + this._f | 0, this._g = h + this._g | 0, this._h = g + this._h | 0;
1827
1856
  };
1828
- vt.prototype._hash = function() {
1829
- var i = Ti.allocUnsafe(32);
1857
+ St.prototype._hash = function() {
1858
+ var i = Li.allocUnsafe(32);
1830
1859
  return i.writeInt32BE(this._a, 0), i.writeInt32BE(this._b, 4), i.writeInt32BE(this._c, 8), i.writeInt32BE(this._d, 12), i.writeInt32BE(this._e, 16), i.writeInt32BE(this._f, 20), i.writeInt32BE(this._g, 24), i.writeInt32BE(this._h, 28), i;
1831
1860
  };
1832
- var Li = vt;
1833
- const Pi = /* @__PURE__ */ Xt(Li), Gt = new Error("File system not available.");
1834
- function zi(i, r, o) {
1835
- throw Gt;
1861
+ var Ki = St;
1862
+ const Gi = /* @__PURE__ */ Kt(Ki), Yt = new Error("File system not available.");
1863
+ function Zi(i, r, o) {
1864
+ throw Yt;
1836
1865
  }
1837
- function Ie(i) {
1838
- throw Gt;
1866
+ function Te(i) {
1867
+ throw Yt;
1839
1868
  }
1840
- function qi(i) {
1841
- throw Gt;
1869
+ function Yi(i) {
1870
+ throw Yt;
1842
1871
  }
1843
- const Hi = async (i) => Ie(), Ji = {
1844
- sha1: Ii,
1845
- sha256: Pi
1846
- }, kt = (i, r = "sha1") => {
1872
+ const Qi = async (i) => Te(), tr = {
1873
+ sha1: Mi,
1874
+ sha256: Gi
1875
+ }, Ut = (i, r = "sha1") => {
1847
1876
  if (!["sha1", "sha256"].includes(r))
1848
1877
  throw new Error("Hashing algorithm not supported: Available: sha1, sha256");
1849
- const o = Ji[r];
1878
+ const o = tr[r];
1850
1879
  return new o().update(i).digest("base64");
1851
1880
  };
1852
- function Wi(i) {
1881
+ function er(i) {
1853
1882
  const r = [], o = Object.keys(i);
1854
1883
  for (const p of o) {
1855
- const u = i[p].sort((f, c) => f.index - c.index);
1856
- for (let f = 0; f < u.length; f++)
1857
- u[f].index !== f && r.push({
1858
- message: `Invalid operation index ${u[f].index} at position ${f}`,
1884
+ const l = i[p].sort((f, c) => f.index - c.index);
1885
+ for (let f = 0; f < l.length; f++)
1886
+ l[f].index !== f && r.push({
1887
+ message: `Invalid operation index ${l[f].index} at position ${f}`,
1859
1888
  details: {
1860
1889
  position: f,
1861
- operation: u[f],
1862
- scope: u[f].scope
1890
+ operation: l[f],
1891
+ scope: l[f].scope
1863
1892
  }
1864
1893
  });
1865
1894
  }
1866
1895
  return r;
1867
1896
  }
1868
- const je = async (i) => {
1869
- const r = new oe(), { name: o, revision: p, documentType: u, created: f, lastModified: c } = i, s = {
1897
+ const ke = async (i) => {
1898
+ const r = new pe(), { name: o, revision: p, documentType: l, created: f, lastModified: c } = i, a = {
1870
1899
  name: o,
1871
1900
  revision: p,
1872
- documentType: u,
1901
+ documentType: l,
1873
1902
  created: f,
1874
1903
  lastModified: c
1875
1904
  };
1876
- return r.file("header.json", JSON.stringify(s, null, 2)), r.file(
1905
+ return r.file("header.json", JSON.stringify(a, null, 2)), r.file(
1877
1906
  "state.json",
1878
1907
  JSON.stringify(i.initialState || {}, null, 2)
1879
1908
  ), r.file("operations.json", JSON.stringify(i.operations, null, 2)), Object.keys(i.attachments).forEach((g) => {
@@ -1884,114 +1913,114 @@ const je = async (i) => {
1884
1913
  comment: JSON.stringify(b)
1885
1914
  });
1886
1915
  }), r;
1887
- }, Xi = async (i, r, o, p) => {
1888
- await (await je(i)).generateAsync({
1916
+ }, ir = async (i, r, o, p) => {
1917
+ await (await ke(i)).generateAsync({
1889
1918
  type: "uint8array",
1890
1919
  streamFiles: !0
1891
1920
  });
1892
1921
  const f = p ?? i.name, c = `.${o}.zip`;
1893
- return zi(
1922
+ return Zi(
1894
1923
  r,
1895
1924
  f.endsWith(c) ? f : `${f}${c}`
1896
1925
  );
1897
- }, yr = async (i, r) => {
1898
- const p = await (await je(i)).generateAsync({ type: "blob" }), u = await r.createWritable();
1899
- await u.write(p), await u.close();
1900
- }, re = async (i, r, o) => {
1901
- const p = Ie();
1902
- return Vi(p, r, o);
1903
- }, Vi = async (i, r, o) => {
1904
- const p = new oe();
1905
- return await p.loadAsync(i), Ki(p, r, o);
1926
+ }, Or = async (i, r) => {
1927
+ const p = await (await ke(i)).generateAsync({ type: "blob" }), l = await r.createWritable();
1928
+ await l.write(p), await l.close();
1929
+ }, ae = async (i, r, o) => {
1930
+ const p = Te();
1931
+ return rr(p, r, o);
1932
+ }, rr = async (i, r, o) => {
1933
+ const p = new pe();
1934
+ return await p.loadAsync(i), nr(p, r, o);
1906
1935
  };
1907
- async function Ki(i, r, o) {
1936
+ async function nr(i, r, o) {
1908
1937
  const p = i.file("state.json");
1909
1938
  if (!p)
1910
1939
  throw new Error("Initial state not found");
1911
- const u = await p.async("string"), f = JSON.parse(u), c = i.file("header.json");
1912
- let s;
1913
- c && (s = JSON.parse(await c.async("string")));
1940
+ const l = await p.async("string"), f = JSON.parse(l), c = i.file("header.json");
1941
+ let a;
1942
+ c && (a = JSON.parse(await c.async("string")));
1914
1943
  const h = i.file("operations.json");
1915
1944
  if (!h)
1916
1945
  throw new Error("Operations history not found");
1917
1946
  const g = JSON.parse(
1918
1947
  await h.async("string")
1919
- ), y = Wi(g);
1948
+ ), y = er(g);
1920
1949
  if (y.length) {
1921
1950
  const F = y.map((j) => j.message);
1922
1951
  throw new Error(F.join(`
1923
1952
  `));
1924
1953
  }
1925
- let b = Le(
1954
+ let b = He(
1926
1955
  f,
1927
1956
  g,
1928
1957
  r,
1929
1958
  void 0,
1930
- s,
1959
+ a,
1931
1960
  {},
1932
1961
  o
1933
1962
  );
1934
- return s && (b = {
1963
+ return a && (b = {
1935
1964
  ...b,
1936
- ...s
1965
+ ...a
1937
1966
  }), b;
1938
1967
  }
1939
- function Te(i) {
1968
+ function Ue(i) {
1940
1969
  const r = i.replace(/^.*\./, "") || void 0, o = i.replace(/^.*[/\\]/, "") || void 0;
1941
1970
  return { extension: r, fileName: o };
1942
1971
  }
1943
- async function wr(i) {
1944
- const { buffer: r, mimeType: o = "application/octet-stream" } = await qi(), p = Te(i), u = r.toString("base64");
1972
+ async function Br(i) {
1973
+ const { buffer: r, mimeType: o = "application/octet-stream" } = await Yi(), p = Ue(i), l = r.toString("base64");
1945
1974
  return {
1946
- data: u,
1947
- hash: kt(u),
1975
+ data: l,
1976
+ hash: Ut(l),
1948
1977
  mimeType: o,
1949
1978
  ...p
1950
1979
  };
1951
1980
  }
1952
- async function Er(i) {
1953
- const r = await Hi(), o = ui.getType(i) || "application/octet-stream", p = Te(i), u = r.toString("base64");
1954
- return { data: u, hash: kt(u), mimeType: o, ...p };
1981
+ async function Ir(i) {
1982
+ const r = await Qi(), o = Ei.getType(i) || "application/octet-stream", p = Ue(i), l = r.toString("base64");
1983
+ return { data: l, hash: Ut(l), mimeType: o, ...p };
1955
1984
  }
1956
- var ke = /* @__PURE__ */ ((i) => (i.UNEXPECTED_INDEX = "UNEXPECTED_INDEX", i))(ke || {}), De = /* @__PURE__ */ ((i) => (i.DUPLICATED_INDEX = "DUPLICATED_INDEX", i.MISSING_INDEX = "MISSING_INDEX", i))(De || {});
1957
- function Zt(i) {
1985
+ var Ce = /* @__PURE__ */ ((i) => (i.UNEXPECTED_INDEX = "UNEXPECTED_INDEX", i))(Ce || {}), $e = /* @__PURE__ */ ((i) => (i.DUPLICATED_INDEX = "DUPLICATED_INDEX", i.MISSING_INDEX = "MISSING_INDEX", i))($e || {});
1986
+ function Qt(i) {
1958
1987
  const r = [];
1959
1988
  let o = -1;
1960
1989
  for (const p of i) {
1961
- const u = p.index - p.skip;
1962
- u !== o + 1 && r.push({
1990
+ const l = p.index - p.skip;
1991
+ l !== o + 1 && r.push({
1963
1992
  operation: {
1964
1993
  index: p.index,
1965
1994
  skip: p.skip
1966
1995
  },
1967
1996
  issue: "UNEXPECTED_INDEX",
1968
- category: u > o + 1 ? "MISSING_INDEX" : "DUPLICATED_INDEX",
1997
+ category: l > o + 1 ? "MISSING_INDEX" : "DUPLICATED_INDEX",
1969
1998
  message: `Expected index ${o + 1} with skip 0 or equivalent, got index ${p.index} with skip ${p.skip}`
1970
1999
  }), o = p.index;
1971
2000
  }
1972
2001
  return r;
1973
2002
  }
1974
- function ot(i) {
1975
- var p, u, f;
2003
+ function at(i) {
2004
+ var p, l, f;
1976
2005
  const r = [];
1977
2006
  let o = i.length - 1;
1978
2007
  for (; o > -1; ) {
1979
2008
  r.unshift(i[o]);
1980
- const c = (((p = i[o]) == null ? void 0 : p.index) || 0) - (((u = i[o]) == null ? void 0 : u.skip) || 0) - 1;
1981
- let s = o - 1;
1982
- for (; s > -1 && (((f = i[s]) == null ? void 0 : f.index) || 0) > c; )
1983
- s--;
1984
- o = s;
2009
+ const c = (((p = i[o]) == null ? void 0 : p.index) || 0) - (((l = i[o]) == null ? void 0 : l.skip) || 0) - 1;
2010
+ let a = o - 1;
2011
+ for (; a > -1 && (((f = i[a]) == null ? void 0 : f.index) || 0) > c; )
2012
+ a--;
2013
+ o = a;
1985
2014
  }
1986
2015
  return r;
1987
2016
  }
1988
- function Gi(i) {
2017
+ function or(i) {
1989
2018
  const r = [...i], o = r[r.length - 1];
1990
2019
  return o && (o.type === "NOOP" ? r.push({
1991
2020
  ...o,
1992
2021
  index: o.index,
1993
2022
  type: "NOOP",
1994
- skip: $e(i)
2023
+ skip: Re(i)
1995
2024
  }) : r.push({
1996
2025
  type: "NOOP",
1997
2026
  index: o.index + 1,
@@ -2002,115 +2031,118 @@ function Gi(i) {
2002
2031
  hash: o.hash
2003
2032
  })), r;
2004
2033
  }
2005
- function at(i) {
2034
+ function st(i) {
2006
2035
  return i.slice().sort((r, o) => r.skip - o.skip).sort((r, o) => r.index - o.index);
2007
2036
  }
2008
- const Zi = (i, r, o) => [...r, ...o].sort(
2009
- (p, u) => new Date(p.timestamp).getTime() - new Date(u.timestamp).getTime()
2010
- ).map((p, u) => ({
2037
+ const ar = (i, r, o) => [...r, ...o].sort(
2038
+ (p, l) => new Date(p.timestamp).getTime() - new Date(l.timestamp).getTime()
2039
+ ).map((p, l) => ({
2011
2040
  ...p,
2012
- index: i.index + u,
2013
- skip: u === 0 ? i.skip : 0
2014
- })), Yi = (i, r, o) => [...r, ...o].sort(
2015
- (p, u) => new Date(p.timestamp).getTime() - new Date(u.timestamp).getTime()
2016
- ).sort((p, u) => p.index - u.index).map((p, u) => ({
2041
+ index: i.index + l,
2042
+ skip: l === 0 ? i.skip : 0
2043
+ })), sr = (i, r, o) => [...r, ...o].sort(
2044
+ (p, l) => new Date(p.timestamp).getTime() - new Date(l.timestamp).getTime()
2045
+ ).sort((p, l) => p.index - l.index).map((p, l) => ({
2017
2046
  ...p,
2018
- index: i.index + u,
2019
- skip: u === 0 ? i.skip : 0
2047
+ index: i.index + l,
2048
+ skip: l === 0 ? i.skip : 0
2020
2049
  }));
2021
- function Yt(i, r) {
2022
- return xt(i) === xt(r);
2050
+ function te(i, r) {
2051
+ return dt(i) === dt(r);
2023
2052
  }
2024
- function Qi(i, r) {
2025
- const o = ot(at(i.slice())), p = ot(at(r.slice()));
2053
+ function pr(i, r) {
2054
+ const o = at(st(i.slice())), p = at(st(r.slice()));
2026
2055
  if (o.length < 1)
2027
2056
  return [p, []];
2028
- const u = [];
2057
+ const l = [];
2029
2058
  let f = !1;
2030
2059
  for (; p.length > 0; ) {
2031
2060
  const c = p[0];
2032
- let s = o.shift();
2033
- for (; s && Ce(s, c); )
2034
- u.push(s), s = o.shift();
2035
- if (s ? f || (Yt(s, c) ? (p.shift(), u.push(s)) : (o.unshift(s), f = !0)) : f = !0, f) {
2061
+ let a = o.shift();
2062
+ for (; a && Ne(a, c); )
2063
+ l.push(a), a = o.shift();
2064
+ if (a ? f || (te(a, c) ? (p.shift(), l.push(a)) : (o.unshift(a), f = !0)) : f = !0, f) {
2036
2065
  let h = p.shift();
2037
2066
  for (; h; )
2038
- u.push(h), h = p.shift();
2067
+ l.push(h), h = p.shift();
2039
2068
  }
2040
2069
  }
2041
2070
  if (!f) {
2042
2071
  let c = o.shift();
2043
2072
  for (; c; )
2044
- u.push(c), c = o.shift();
2073
+ l.push(c), c = o.shift();
2045
2074
  }
2046
- return [ot(u), o];
2075
+ return [at(l), o];
2047
2076
  }
2048
- function Ce(i, r) {
2077
+ function Ne(i, r) {
2049
2078
  return i.index < r.index || i.index === r.index && i.skip < r.skip;
2050
2079
  }
2051
- function Ue(i, r) {
2052
- const o = [], p = [], u = [], f = Math.max(
2080
+ function Me(i, r) {
2081
+ const o = [], p = [], l = [], f = Math.max(
2053
2082
  i.length,
2054
2083
  r.length
2055
2084
  );
2056
2085
  let c = !1;
2057
- for (let s = 0; s < f; s++) {
2058
- const h = i[s], g = r[s];
2059
- h && g ? !c && Yt(h, g) ? o.push(h) : (c = !0, p.push(h), u.push(g)) : h ? p.push(h) : g && u.push(g);
2086
+ for (let a = 0; a < f; a++) {
2087
+ const h = i[a], g = r[a];
2088
+ h && g ? !c && te(h, g) ? o.push(h) : (c = !0, p.push(h), l.push(g)) : h ? p.push(h) : g && l.push(g);
2060
2089
  }
2061
- return [o, p, u];
2090
+ return [o, p, l];
2062
2091
  }
2063
- function tr(i, r, o) {
2064
- const [p, u, f] = Ue(
2065
- ot(i),
2066
- ot(r)
2067
- ), c = $t(p), s = 1 + Math.max(
2092
+ function cr(i, r, o) {
2093
+ const [p, l, f] = Me(
2094
+ at(i),
2095
+ at(r)
2096
+ ), c = Mt(p), a = 1 + Math.max(
2068
2097
  c,
2069
- $t(u),
2070
- $t(f)
2071
- ), h = o(
2098
+ Mt(l),
2099
+ Mt(f)
2100
+ ), h = Pe(
2101
+ f,
2102
+ l
2103
+ ), g = o(
2072
2104
  {
2073
- index: s,
2074
- skip: s - (c + 1)
2105
+ index: a,
2106
+ skip: a - (c + 1)
2075
2107
  },
2076
- u,
2077
- f
2108
+ l,
2109
+ h
2078
2110
  );
2079
- return p.concat(h);
2111
+ return p.concat(g);
2080
2112
  }
2081
- function $t(i) {
2113
+ function Mt(i) {
2082
2114
  const r = i[i.length - 1];
2083
2115
  return r ? r.index : -1;
2084
2116
  }
2085
- function $e(i) {
2086
- var p, u, f;
2117
+ function Re(i) {
2118
+ var p, l, f;
2087
2119
  if (i.length < 1)
2088
2120
  return -1;
2089
- const r = ot(i);
2121
+ const r = at(i);
2090
2122
  let o = (((p = r[r.length - 1]) == null ? void 0 : p.skip) || 0) + 1;
2091
- return r.length > 1 && (o += ((u = r[r.length - 2]) == null ? void 0 : u.skip) || 0), (((f = r[r.length - 1]) == null ? void 0 : f.index) || -1) < o ? -1 : o;
2092
- }
2093
- const er = (i) => Zt(
2094
- ot(at(i))
2095
- ), ir = (i) => i.reduce((o, p) => {
2096
- var u;
2097
- return o[p.scope] || (o[p.scope] = []), (u = o[p.scope]) == null || u.push(p), o;
2098
- }, {}), rr = (i, r) => {
2123
+ return r.length > 1 && (o += ((l = r[r.length - 2]) == null ? void 0 : l.skip) || 0), (((f = r[r.length - 1]) == null ? void 0 : f.index) || -1) < o ? -1 : o;
2124
+ }
2125
+ const lr = (i) => Qt(
2126
+ at(st(i))
2127
+ ), ur = (i) => i.reduce((o, p) => {
2128
+ var l;
2129
+ return o[p.scope] || (o[p.scope] = []), (l = o[p.scope]) == null || l.push(p), o;
2130
+ }, {}), fr = (i, r) => {
2099
2131
  var h;
2100
2132
  const o = {
2101
2133
  integrityIssues: [],
2102
2134
  validOperations: [],
2103
2135
  invalidOperations: [],
2104
2136
  duplicatedOperations: []
2105
- }, p = at(i), u = at(r), f = Zt([
2137
+ }, p = st(i), l = st(r), f = Qt([
2106
2138
  ...p,
2107
- ...u
2108
- ]), s = (h = [...f.filter(
2139
+ ...l
2140
+ ]), a = (h = [...f.filter(
2109
2141
  (g) => g.category === "MISSING_INDEX"
2110
2142
  /* MISSING_INDEX */
2111
2143
  )].sort((g, y) => y.operation.index - g.operation.index).pop()) == null ? void 0 : h.operation;
2112
- for (const g of u) {
2113
- if (s && g.index >= s.index) {
2144
+ for (const g of l) {
2145
+ if (a && g.index >= a.index) {
2114
2146
  o.invalidOperations.push(g);
2115
2147
  continue;
2116
2148
  }
@@ -2122,88 +2154,96 @@ const er = (i) => Zt(
2122
2154
  }
2123
2155
  return o.integrityIssues.push(...f), o;
2124
2156
  };
2125
- function nr(i, r) {
2157
+ function hr(i, r) {
2126
2158
  return i.filter((o) => !r.some((p) => o.type === "NOOP" && o.skip === 0 && o.index === p.index || o.index === p.index && o.skip === p.skip && o.scope === p.scope && o.hash === p.hash && o.type === p.type));
2127
2159
  }
2128
- function Ne(i, r) {
2129
- const [o] = at(i).slice(-1), p = (o == null ? void 0 : o.index) ?? -1, u = p + 1, f = {
2160
+ function Le(i, r) {
2161
+ const [o] = st(i).slice(-1), p = (o == null ? void 0 : o.index) ?? -1, l = p + 1, f = {
2130
2162
  ...r,
2131
- index: r.index ?? u
2163
+ index: r.index ?? l
2132
2164
  };
2133
2165
  if (f.index < p)
2134
2166
  throw new Error(
2135
2167
  `The skip header operation index must be greater than or equal to ${p}`
2136
2168
  );
2137
- return (ot(
2138
- at([...i, f])
2169
+ return (at(
2170
+ st([...i, f])
2139
2171
  ) || []).slice(0, -1);
2140
2172
  }
2141
- function Lt(i) {
2173
+ function zt(i) {
2142
2174
  return {
2143
2175
  ...Object.entries(i).reduce(
2144
2176
  (o, p) => {
2145
- const [u, f] = p;
2177
+ const [l, f] = p;
2146
2178
  return {
2147
2179
  ...o,
2148
- [u]: ot(at(f))
2180
+ [l]: at(st(f))
2149
2181
  };
2150
2182
  },
2151
2183
  {}
2152
2184
  )
2153
2185
  };
2154
2186
  }
2155
- const br = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2187
+ function Pe(i, r) {
2188
+ return i.filter((o) => o.id ? !r.some((p) => p.id === o.id) : !0);
2189
+ }
2190
+ const jr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2156
2191
  __proto__: null,
2157
- IntegrityIssueSubType: De,
2158
- IntegrityIssueType: ke,
2159
- addUndo: Gi,
2160
- attachBranch: Qi,
2161
- checkCleanedOperationsIntegrity: Zt,
2162
- checkOperationsIntegrity: er,
2163
- garbageCollect: ot,
2164
- garbageCollectDocumentOperations: Lt,
2165
- groupOperationsByScope: ir,
2166
- merge: tr,
2167
- nextSkipNumber: $e,
2168
- operationsAreEqual: Yt,
2169
- precedes: Ce,
2170
- prepareOperations: rr,
2171
- removeExistingOperations: nr,
2172
- reshuffleByTimestamp: Zi,
2173
- reshuffleByTimestampAndIndex: Yi,
2174
- skipHeaderOperations: Ne,
2175
- sortOperations: at,
2176
- split: Ue
2192
+ IntegrityIssueSubType: $e,
2193
+ IntegrityIssueType: Ce,
2194
+ addUndo: or,
2195
+ attachBranch: pr,
2196
+ checkCleanedOperationsIntegrity: Qt,
2197
+ checkOperationsIntegrity: lr,
2198
+ filterDuplicatedOperations: Pe,
2199
+ garbageCollect: at,
2200
+ garbageCollectDocumentOperations: zt,
2201
+ groupOperationsByScope: ur,
2202
+ merge: cr,
2203
+ nextSkipNumber: Re,
2204
+ operationsAreEqual: te,
2205
+ precedes: Ne,
2206
+ prepareOperations: fr,
2207
+ removeExistingOperations: hr,
2208
+ reshuffleByTimestamp: ar,
2209
+ reshuffleByTimestampAndIndex: sr,
2210
+ skipHeaderOperations: Le,
2211
+ sortOperations: st,
2212
+ split: Me
2177
2213
  }, Symbol.toStringTag, { value: "Module" }));
2178
- function or(i, r) {
2214
+ function mr(i, r) {
2179
2215
  let o;
2180
2216
  return "index" in r ? o = { ...r } : o = i.operations[r.scope].at(-1), ((o == null ? void 0 : o.index) ?? -1) + 1;
2181
2217
  }
2182
- function Me(i, r) {
2218
+ function ze(i, r) {
2183
2219
  return {
2184
2220
  ...i,
2185
2221
  revision: {
2186
2222
  ...i.revision,
2187
- [r.scope]: or(i, r)
2223
+ [r.scope]: mr(i, r)
2188
2224
  },
2189
2225
  lastModified: (/* @__PURE__ */ new Date()).toISOString()
2190
2226
  };
2191
2227
  }
2192
- function ar(i, r, o = 0) {
2193
- if ([wt, Et, It].includes(r.type))
2228
+ function xr(i, r, o = 0) {
2229
+ if ([Et, bt, Dt].includes(r.type))
2194
2230
  return i;
2195
- const { scope: p } = r, u = i.operations[p].slice(), f = u.at(-1);
2196
- let c = ((f == null ? void 0 : f.index) ?? -1) + 1;
2231
+ const { scope: p } = r, l = i.operations[p].slice();
2232
+ let f;
2233
+ const c = l.at(-1);
2234
+ let a = ((c == null ? void 0 : c.index) ?? -1) + 1;
2197
2235
  if ("index" in r) {
2198
- if (r.index - o > c)
2236
+ if (r.index - o > a)
2199
2237
  throw new Error(
2200
- `Missing operations: expected ${c} with skip 0 or equivalent, got index ${r.index} with skip ${o}`
2238
+ `Missing operations: expected ${a} with skip 0 or equivalent, got index ${r.index} with skip ${o}`
2201
2239
  );
2202
- c = r.index;
2203
- }
2204
- return u.push({
2240
+ a = r.index, f = r.id;
2241
+ } else
2242
+ f = fi();
2243
+ return l.push({
2205
2244
  ...r,
2206
- index: c,
2245
+ id: f,
2246
+ index: a,
2207
2247
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
2208
2248
  hash: "",
2209
2249
  scope: p,
@@ -2211,56 +2251,56 @@ function ar(i, r, o = 0) {
2211
2251
  error: void 0
2212
2252
  }), {
2213
2253
  ...i,
2214
- operations: { ...i.operations, [p]: u }
2254
+ operations: { ...i.operations, [p]: l }
2215
2255
  };
2216
2256
  }
2217
- function sr(i, r, o = 0) {
2218
- let p = ar(i, r, o);
2219
- return p = Me(p, r), p;
2220
- }
2221
- function pr(i, r, o) {
2222
- switch (fe().parse(r), r.type) {
2223
- case we:
2224
- return ni(i, r.input);
2225
- case It:
2226
- return si(i, r, o);
2227
- case Ee:
2228
- return pi(i, r.input.state);
2257
+ function dr(i, r, o = 0) {
2258
+ let p = xr(i, r, o);
2259
+ return p = ze(p, r), p;
2260
+ }
2261
+ function gr(i, r, o) {
2262
+ switch (xe().parse(r), r.type) {
2263
+ case ve:
2264
+ return hi(i, r.input);
2265
+ case Dt:
2266
+ return di(i, r, o);
2267
+ case Se:
2268
+ return gi(i, r.input.state);
2229
2269
  default:
2230
2270
  return i;
2231
2271
  }
2232
2272
  }
2233
- function vr(i, r, o) {
2273
+ function Dr(i, r, o) {
2234
2274
  switch (r.type) {
2235
- case wt:
2236
- return oi(i, r, o);
2237
2275
  case Et:
2238
- return ai(i, r, o);
2276
+ return mi(i, r, o);
2277
+ case bt:
2278
+ return xi(i, r, o);
2239
2279
  default:
2240
2280
  return { document: i, action: r, skip: o };
2241
2281
  }
2242
2282
  }
2243
- function cr(i, r, o, p, u = !1, f = Pe) {
2244
- const c = r.scope, s = i.operations[c].at(-1);
2245
- if (!s)
2283
+ function yr(i, r, o, p, l = !1, f = Je) {
2284
+ const c = r.scope, a = i.operations[c].at(-1);
2285
+ if (!a)
2246
2286
  return i;
2247
- const h = Lt(
2287
+ const h = zt(
2248
2288
  {
2249
2289
  ...i.operations,
2250
- [c]: Ne(
2290
+ [c]: Le(
2251
2291
  i.operations[c],
2252
- s
2292
+ a
2253
2293
  )
2254
2294
  }
2255
2295
  );
2256
2296
  let g;
2257
2297
  const y = h[c].at(-1);
2258
- if (u && (y != null && y.resultingState))
2298
+ if (l && (y != null && y.resultingState))
2259
2299
  g = f(
2260
2300
  y.resultingState
2261
2301
  );
2262
2302
  else {
2263
- const { state: b } = Pt(
2303
+ const { state: b } = qt(
2264
2304
  i.initialState,
2265
2305
  h,
2266
2306
  o,
@@ -2270,7 +2310,7 @@ function cr(i, r, o, p, u = !1, f = Pe) {
2270
2310
  void 0,
2271
2311
  {
2272
2312
  reuseHash: !0,
2273
- reuseOperationResultingState: u,
2313
+ reuseOperationResultingState: l,
2274
2314
  operationResultingStateParser: f
2275
2315
  }
2276
2316
  );
@@ -2282,80 +2322,80 @@ function cr(i, r, o, p, u = !1, f = Pe) {
2282
2322
  ...i.state,
2283
2323
  [c]: g
2284
2324
  },
2285
- operations: Lt({
2325
+ operations: zt({
2286
2326
  ...i.operations
2287
2327
  })
2288
2328
  };
2289
2329
  }
2290
- function Re(i, r, o, p, u = {}) {
2330
+ function qe(i, r, o, p, l = {}) {
2291
2331
  const {
2292
2332
  skip: f,
2293
2333
  ignoreSkipOperations: c = !1,
2294
- reuseHash: s = !1,
2334
+ reuseHash: a = !1,
2295
2335
  reuseOperationResultingState: h = !1,
2296
2336
  operationResultingStateParser: g
2297
- } = u, y = { ...r }, b = f || 0;
2337
+ } = l, y = { ...r }, b = f || 0;
2298
2338
  let F = { ...i };
2299
2339
  const j = !c && (b > 0 || "index" in y && y.skip > 0);
2300
- return ne(y) && (F = pr(F, y, o)), F = sr(F, y, b), j && (F = cr(
2340
+ return se(y) && (F = gr(F, y, o)), F = dr(F, y, b), j && (F = yr(
2301
2341
  F,
2302
2342
  y,
2303
2343
  o,
2304
2344
  b,
2305
2345
  h,
2306
2346
  g
2307
- )), F = Bt(F, (C) => {
2347
+ )), F = jt(F, (U) => {
2308
2348
  try {
2309
2349
  const q = o(
2310
- C.state,
2350
+ U.state,
2311
2351
  y,
2312
2352
  p
2313
2353
  );
2314
2354
  if (q)
2315
- return Ot({
2355
+ return It({
2316
2356
  ...F,
2317
2357
  // clipboard: [...clipboardValue],
2318
2358
  state: q
2319
2359
  });
2320
2360
  } catch (q) {
2321
- const Z = F.operations[y.scope].length - 1;
2322
- C.operations[y.scope][Z].error = q.message, C.operations[y.scope][Z].skip = 0, j && (C.state = Ot({ ...i.state }), C.operations = Ot({
2361
+ const Y = F.operations[y.scope].length - 1;
2362
+ U.operations[y.scope][Y].error = q.message, U.operations[y.scope][Y].skip = 0, j && (U.state = It({ ...i.state }), U.operations = It({
2323
2363
  ...i.operations,
2324
2364
  [y.scope]: [
2325
2365
  ...i.operations[y.scope],
2326
2366
  {
2327
- ...C.operations[y.scope][Z]
2367
+ ...U.operations[y.scope][Y]
2328
2368
  }
2329
2369
  ]
2330
2370
  }));
2331
2371
  }
2332
- }), Bt(F, (C) => {
2333
- if ([wt, Et, It].includes(y.type))
2334
- return C;
2335
- const q = y.scope || "global", Z = s && Object.prototype.hasOwnProperty.call(y, "hash") ? y.hash : Qt(C, q), w = C.operations[q].at(-1);
2336
- w && (w.hash = Z, h && (w.resultingState = C.state[q]), !ne(y) && y.attachments && y.attachments.forEach((E) => {
2372
+ }), jt(F, (U) => {
2373
+ if ([Et, bt, Dt].includes(y.type))
2374
+ return U;
2375
+ const q = y.scope || "global", Y = a && Object.prototype.hasOwnProperty.call(y, "hash") ? y.hash : ee(U, q), w = U.operations[q].at(-1);
2376
+ w && (w.hash = Y, h && (w.resultingState = U.state[q]), !se(y) && y.attachments && y.attachments.forEach((E) => {
2337
2377
  const { hash: v, ...M } = E;
2338
- C.attachments[v] = {
2378
+ U.attachments[v] = {
2339
2379
  ...M
2340
2380
  };
2341
2381
  }));
2342
2382
  });
2343
2383
  }
2344
- function Sr(i) {
2345
- return i.type === ci && i.skip !== void 0 && i.skip > 0 && i.hash !== void 0;
2384
+ function Tr(i) {
2385
+ return i.type === yi && i.skip !== void 0 && i.skip > 0 && i.hash !== void 0;
2346
2386
  }
2347
- function _r(i) {
2348
- return [wt, Et].includes(i.type);
2387
+ function kr(i) {
2388
+ return [Et, bt].includes(i.type);
2349
2389
  }
2350
- function ne(i) {
2351
- return [we, wt, Et, It, Ee].includes(i.type);
2390
+ function se(i) {
2391
+ return [ve, Et, bt, Dt, Se].includes(i.type);
2352
2392
  }
2353
- function dt(i, r, o, p, u = "global") {
2393
+ function gt(i, r, o, p, l = "global") {
2354
2394
  if (!i)
2355
2395
  throw new Error("Empty action type");
2356
2396
  if (typeof i != "string")
2357
2397
  throw new Error(`Invalid action type: ${JSON.stringify(i)}`);
2358
- const f = { type: i, input: r, scope: u };
2398
+ const f = { type: i, input: r, scope: l };
2359
2399
  o && (f.attachments = o);
2360
2400
  try {
2361
2401
  p == null || p().parse(f.input);
@@ -2364,10 +2404,10 @@ function dt(i, r, o, p, u = "global") {
2364
2404
  }
2365
2405
  return f;
2366
2406
  }
2367
- function lr(i, r = Re) {
2368
- return (o, p, u, f) => r(o, p, i, u, f);
2407
+ function wr(i, r = qe) {
2408
+ return (o, p, l, f) => r(o, p, i, l, f);
2369
2409
  }
2370
- const ur = (i, r) => ({
2410
+ const Er = (i, r) => ({
2371
2411
  name: "",
2372
2412
  documentType: "",
2373
2413
  revision: {
@@ -2379,8 +2419,8 @@ const ur = (i, r) => ({
2379
2419
  attachments: {},
2380
2420
  ...i,
2381
2421
  state: (r == null ? void 0 : r(i == null ? void 0 : i.state)) ?? (i == null ? void 0 : i.state) ?? { global: {}, local: {} }
2382
- }), fr = (i, r) => {
2383
- const o = ur(
2422
+ }), br = (i, r) => {
2423
+ const o = Er(
2384
2424
  i,
2385
2425
  r
2386
2426
  );
@@ -2390,25 +2430,25 @@ const ur = (i, r) => ({
2390
2430
  operations: { global: [], local: [] },
2391
2431
  clipboard: []
2392
2432
  };
2393
- }, Qt = (i, r = "global") => kt(xt(i.state[r] || "")), Ar = (i, r = 1e3) => {
2433
+ }, ee = (i, r = "global") => Ut(dt(i.state[r] || "")), Ur = (i, r = 1e3) => {
2394
2434
  const o = Math.random() * r;
2395
- return kt(`${(i ?? /* @__PURE__ */ new Date()).toISOString()}${o}`);
2435
+ return Ut(`${(i ?? /* @__PURE__ */ new Date()).toISOString()}${o}`);
2396
2436
  };
2397
- function Ft(i) {
2398
- return Ge(Ze(i, !0));
2437
+ function Bt(i) {
2438
+ return ti(ei(i, !0));
2399
2439
  }
2400
- function Fr(i, r) {
2440
+ function Cr(i, r) {
2401
2441
  const o = [...i];
2402
- let p = r || 0, u = o.length > 0 ? o[o.length - 1].index : 0;
2442
+ let p = r || 0, l = o.length > 0 ? o[o.length - 1].index : 0;
2403
2443
  const f = [];
2404
2444
  for (const c of o.reverse()) {
2405
2445
  if (p > 0) {
2406
- const g = u - c.index;
2446
+ const g = l - c.index;
2407
2447
  p -= g;
2408
2448
  }
2409
2449
  if (p < 0)
2410
2450
  throw new Error("Invalid operation index, missing operations");
2411
- const s = {
2451
+ const a = {
2412
2452
  ignore: p > 0,
2413
2453
  operation: c
2414
2454
  }, h = c.skip > 0 ? c.skip + 1 : 0;
@@ -2416,49 +2456,49 @@ function Fr(i, r) {
2416
2456
  const g = h - p;
2417
2457
  p = p + g;
2418
2458
  }
2419
- u = c.index, f.push(s);
2459
+ l = c.index, f.push(a);
2420
2460
  }
2421
2461
  return f.reverse();
2422
2462
  }
2423
- function Or(i, r, o) {
2424
- const p = i.slice().sort((s, h) => s.skip - h.skip).sort((s, h) => s.index - h.index);
2425
- let u = o, f = 0, c = r;
2426
- for (const s of p.reverse()) {
2427
- const h = c - s.index;
2428
- if (u = u - h, u > -1)
2429
- f++, c = s.index;
2463
+ function $r(i, r, o) {
2464
+ const p = i.slice().sort((a, h) => a.skip - h.skip).sort((a, h) => a.index - h.index);
2465
+ let l = o, f = 0, c = r;
2466
+ for (const a of p.reverse()) {
2467
+ const h = c - a.index;
2468
+ if (l = l - h, l > -1)
2469
+ f++, c = a.index;
2430
2470
  else
2431
2471
  break;
2432
2472
  }
2433
2473
  return f;
2434
2474
  }
2435
- function Br(i) {
2475
+ function Nr(i) {
2436
2476
  return Object.values(i).flatMap((r) => r).sort(
2437
2477
  (r, o) => new Date(r.timestamp).getTime() - new Date(o.timestamp).getTime()
2438
2478
  );
2439
2479
  }
2440
- function Ir(i) {
2480
+ function Mr(i) {
2441
2481
  return Object.values(i).flatMap((r) => r).sort(
2442
2482
  (r, o) => new Date(r.operation.timestamp).getTime() - new Date(o.operation.timestamp).getTime()
2443
2483
  );
2444
2484
  }
2445
- function Pt(i, r, o, p, u, f = Re, c = {}, s) {
2446
- const h = lr(o, f);
2447
- return Le(
2485
+ function qt(i, r, o, p, l, f = qe, c = {}, a) {
2486
+ const h = wr(o, f);
2487
+ return He(
2448
2488
  i,
2449
2489
  r,
2450
2490
  h,
2451
2491
  p,
2452
- u,
2492
+ l,
2453
2493
  c,
2454
- s
2494
+ a
2455
2495
  );
2456
2496
  }
2457
- function Le(i, r, o, p, u, f = {}, c) {
2497
+ function He(i, r, o, p, l, f = {}, c) {
2458
2498
  const {
2459
- checkHashes: s = !0,
2499
+ checkHashes: a = !0,
2460
2500
  reuseOperationResultingState: h,
2461
- operationResultingStateParser: g = Pe
2501
+ operationResultingStateParser: g = Je
2462
2502
  } = c || {};
2463
2503
  let y = i;
2464
2504
  const b = [], F = {
@@ -2496,59 +2536,59 @@ function Le(i, r, o, p, u, f = {}, c) {
2496
2536
  }
2497
2537
  else
2498
2538
  b.push(...Object.values(r).flat());
2499
- const j = fr(y);
2539
+ const j = br(y);
2500
2540
  j.initialState = i, j.operations = F;
2501
- let C = j;
2541
+ let U = j;
2502
2542
  if (b.length)
2503
- C = b.reduce((w, E) => o(w, E, p, {
2543
+ U = b.reduce((w, E) => o(w, E, p, {
2504
2544
  skip: E.skip,
2505
2545
  ignoreSkipOperations: !0,
2506
- reuseHash: !s
2546
+ reuseHash: !a
2507
2547
  }), j);
2508
2548
  else
2509
2549
  for (const w of Object.values(F)) {
2510
2550
  const E = w.at(-1);
2511
- E && (C = Me(C, E));
2551
+ E && (U = ze(U, E));
2512
2552
  }
2513
- if (!s)
2514
- for (const w of Object.keys(C.state))
2553
+ if (!a)
2554
+ for (const w of Object.keys(U.state))
2515
2555
  for (let E = b.length - 1; E >= 0; E--) {
2516
2556
  const v = b[E];
2517
2557
  if (v.scope === w) {
2518
- if (v.hash !== Qt(C, w))
2558
+ if (v.hash !== ee(U, w))
2519
2559
  throw new Error(`Hash mismatch for scope ${w}`);
2520
2560
  break;
2521
2561
  }
2522
2562
  }
2523
2563
  const q = Object.keys(
2524
- C.operations
2564
+ U.operations
2525
2565
  ).reduce(
2526
2566
  (w, E) => {
2527
2567
  const v = E;
2528
2568
  return {
2529
2569
  ...w,
2530
2570
  [v]: [
2531
- ...C.operations[v].map((M, J) => {
2532
- var W;
2571
+ ...U.operations[v].map((M, J) => {
2572
+ var V;
2533
2573
  return {
2534
2574
  ...M,
2535
- timestamp: ((W = r[v][J]) == null ? void 0 : W.timestamp) ?? M.timestamp
2575
+ timestamp: ((V = r[v][J]) == null ? void 0 : V.timestamp) ?? M.timestamp
2536
2576
  };
2537
2577
  })
2538
2578
  ]
2539
2579
  };
2540
2580
  },
2541
2581
  { global: [], local: [] }
2542
- ), Z = Object.values(q).reduce((w, E) => {
2582
+ ), Y = Object.values(q).reduce((w, E) => {
2543
2583
  const v = E[E.length - 1];
2544
2584
  return (v == null ? void 0 : v.timestamp) > w && (w = v.timestamp), w;
2545
2585
  }, i.lastModified);
2546
- return { ...C, operations: q, lastModified: Z };
2586
+ return { ...U, operations: q, lastModified: Y };
2547
2587
  }
2548
- function jr(i, r) {
2549
- return xt(i) === xt(r);
2588
+ function Rr(i, r) {
2589
+ return dt(i) === dt(r);
2550
2590
  }
2551
- function Pe(i) {
2591
+ function Je(i) {
2552
2592
  const r = typeof i;
2553
2593
  if (r === "string")
2554
2594
  return JSON.parse(i);
@@ -2556,54 +2596,54 @@ function Pe(i) {
2556
2596
  return i;
2557
2597
  throw new Error(`Providing resulting state is of type: ${r}`);
2558
2598
  }
2559
- const ze = (i) => dt(
2599
+ const Ve = (i) => gt(
2560
2600
  "SET_NAME",
2561
2601
  i,
2562
2602
  void 0,
2563
- Jt,
2603
+ Wt,
2564
2604
  void 0
2565
- ), qe = (i = 1, r = "global") => dt(
2605
+ ), We = (i = 1, r = "global") => gt(
2566
2606
  "UNDO",
2567
2607
  i,
2568
2608
  void 0,
2569
- Wt,
2609
+ Xt,
2570
2610
  r
2571
- ), He = (i = 1, r = "global") => dt(
2611
+ ), Xe = (i = 1, r = "global") => gt(
2572
2612
  "REDO",
2573
2613
  i,
2574
2614
  void 0,
2575
- Ht,
2615
+ Vt,
2576
2616
  r
2577
- ), Je = (i, r, o = "global") => dt(
2617
+ ), Ke = (i, r, o = "global") => gt(
2578
2618
  "PRUNE",
2579
2619
  { start: i, end: r },
2580
2620
  void 0,
2581
- qt,
2621
+ Jt,
2582
2622
  o
2583
- ), te = (i, r) => dt(
2623
+ ), ie = (i, r) => gt(
2584
2624
  "LOAD_STATE",
2585
2625
  { state: i, operations: r },
2586
2626
  void 0,
2587
- zt
2588
- ), We = (i = "global") => dt("NOOP", {}, void 0, void 0, i), Tr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2627
+ Ht
2628
+ ), Ge = (i = "global") => gt("NOOP", {}, void 0, void 0, i), Lr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2589
2629
  __proto__: null,
2590
- loadState: te,
2591
- noop: We,
2592
- prune: Je,
2593
- redo: He,
2594
- setName: ze,
2595
- undo: qe
2630
+ loadState: ie,
2631
+ noop: Ge,
2632
+ prune: Ke,
2633
+ redo: Xe,
2634
+ setName: Ve,
2635
+ undo: We
2596
2636
  }, Symbol.toStringTag, { value: "Module" }));
2597
- class kr {
2637
+ class Pr {
2598
2638
  /**
2599
2639
  * Constructs a BaseDocument instance with an initial state.
2600
2640
  * @param reducer - The reducer function that updates the state.
2601
2641
  * @param document - The initial state of the document.
2602
2642
  */
2603
2643
  constructor(r, o, p) {
2604
- At(this, "_document");
2605
- At(this, "_reducer");
2606
- At(this, "_signalDispatch");
2644
+ Ft(this, "_document");
2645
+ Ft(this, "_reducer");
2646
+ Ft(this, "_signalDispatch");
2607
2647
  this._reducer = r, this._document = o, this._signalDispatch = p;
2608
2648
  }
2609
2649
  /**
@@ -2626,14 +2666,14 @@ class kr {
2626
2666
  * @returns The file path where the state was saved.
2627
2667
  */
2628
2668
  saveToFile(r, o, p) {
2629
- return Xi(this._document, r, o, p);
2669
+ return ir(this._document, r, o, p);
2630
2670
  }
2631
2671
  /**
2632
2672
  * Loads the state of the document from a file.
2633
2673
  * @param path - The file path where the state is stored.
2634
2674
  */
2635
2675
  async loadFromFile(r) {
2636
- this._document = await re(r, this._reducer);
2676
+ this._document = await ae(r, this._reducer);
2637
2677
  }
2638
2678
  /**
2639
2679
  * Loads the state of the document from a file and returns it.
@@ -2642,19 +2682,19 @@ class kr {
2642
2682
  * @returns The state of the document.
2643
2683
  */
2644
2684
  static async stateFromFile(r, o) {
2645
- return await re(r, o);
2685
+ return await ae(r, o);
2646
2686
  }
2647
2687
  /**
2648
2688
  * Gets the current state of the document.
2649
2689
  */
2650
2690
  get state() {
2651
- return Ft(this._document.state);
2691
+ return Bt(this._document.state);
2652
2692
  }
2653
2693
  /**
2654
2694
  * Gets the list of operations performed on the document.
2655
2695
  */
2656
2696
  get operations() {
2657
- return Ft(this._document.operations);
2697
+ return Bt(this._document.operations);
2658
2698
  }
2659
2699
  /**
2660
2700
  * Gets the name of the document.
@@ -2693,13 +2733,13 @@ class kr {
2693
2733
  * Gets the initial state of the document.
2694
2734
  */
2695
2735
  get initialState() {
2696
- return Ft(this._document.initialState);
2736
+ return Bt(this._document.initialState);
2697
2737
  }
2698
2738
  /**
2699
2739
  * Returns the current document as an object
2700
2740
  */
2701
2741
  toDocument() {
2702
- return Ft(this._document);
2742
+ return Bt(this._document);
2703
2743
  }
2704
2744
  /**
2705
2745
  * Gets the attachment associated with the given key.
@@ -2713,21 +2753,21 @@ class kr {
2713
2753
  * @param name - The new name of the document.
2714
2754
  */
2715
2755
  setName(r) {
2716
- return this.dispatch(ze(r)), this;
2756
+ return this.dispatch(Ve(r)), this;
2717
2757
  }
2718
2758
  /**
2719
2759
  * Reverts a number of actions from the document.
2720
2760
  * @param count - The number of actions to revert.
2721
2761
  */
2722
2762
  undo(r) {
2723
- return this.dispatch(qe(r)), this;
2763
+ return this.dispatch(We(r)), this;
2724
2764
  }
2725
2765
  /**
2726
2766
  * Reapplies a number of actions to the document.
2727
2767
  * @param count - The number of actions to reapply.
2728
2768
  */
2729
2769
  redo(r) {
2730
- return this.dispatch(He(r)), this;
2770
+ return this.dispatch(Xe(r)), this;
2731
2771
  }
2732
2772
  /**
2733
2773
  * Removes a range of operations from the document.
@@ -2735,7 +2775,7 @@ class kr {
2735
2775
  * @param end - The ending index of the range to remove.
2736
2776
  */
2737
2777
  prune(r, o) {
2738
- return this.dispatch(Je(r, o)), this;
2778
+ return this.dispatch(Ke(r, o)), this;
2739
2779
  }
2740
2780
  /**
2741
2781
  * Loads a document state and a set of operations.
@@ -2743,10 +2783,10 @@ class kr {
2743
2783
  * @param operations - The operations to apply to the document.
2744
2784
  */
2745
2785
  loadState(r, o) {
2746
- return this.dispatch(te(r, o)), this;
2786
+ return this.dispatch(ie(r, o)), this;
2747
2787
  }
2748
2788
  }
2749
- function Dr(i, r) {
2789
+ function zr(i, r) {
2750
2790
  r.forEach((o) => {
2751
2791
  Object.getOwnPropertyNames(o.prototype).forEach((p) => {
2752
2792
  Object.defineProperty(
@@ -2760,39 +2800,39 @@ function Dr(i, r) {
2760
2800
  });
2761
2801
  }
2762
2802
  export {
2763
- Ir as A,
2764
- kr as B,
2765
- Br as C,
2766
- Wi as D,
2767
- Re as E,
2768
- vr as F,
2769
- sr as G,
2770
- Me as H,
2771
- gr as I,
2772
- ur as a,
2773
- fr as b,
2774
- lr as c,
2775
- yr as d,
2776
- Vi as e,
2777
- dt as f,
2778
- Dr as g,
2779
- Tr as h,
2780
- ne as i,
2781
- Or as j,
2782
- je as k,
2783
- re as l,
2784
- br as m,
2785
- Er as n,
2786
- wr as o,
2787
- Qt as p,
2788
- Ar as q,
2789
- Sr as r,
2790
- Xi as s,
2791
- jr as t,
2792
- _r as u,
2793
- Fr as v,
2794
- Pe as w,
2795
- Ft as x,
2796
- Le as y,
2797
- Pt as z
2803
+ Mr as A,
2804
+ Pr as B,
2805
+ Nr as C,
2806
+ er as D,
2807
+ qe as E,
2808
+ Dr as F,
2809
+ dr as G,
2810
+ ze as H,
2811
+ Fr as I,
2812
+ Er as a,
2813
+ br as b,
2814
+ wr as c,
2815
+ Or as d,
2816
+ rr as e,
2817
+ gt as f,
2818
+ zr as g,
2819
+ Lr as h,
2820
+ se as i,
2821
+ $r as j,
2822
+ ke as k,
2823
+ ae as l,
2824
+ jr as m,
2825
+ Ir as n,
2826
+ Br as o,
2827
+ ee as p,
2828
+ Ur as q,
2829
+ Tr as r,
2830
+ ir as s,
2831
+ Rr as t,
2832
+ kr as u,
2833
+ Cr as v,
2834
+ Je as w,
2835
+ Bt as x,
2836
+ He as y,
2837
+ qt as z
2798
2838
  };