document-model 1.1.0-experimental.4 → 1.2.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-DGWOisRG.js} +1 -1
  5. package/dist/{node/cjs/internal/index-B31DqWHj.js → browser/cjs/internal/index-Dl3D9TzG.js} +1 -1
  6. package/dist/browser/cjs/internal/object-DQmy6ar9.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-2Qq00NLA.js → index-BnpyOR6R.js} +1 -1
  11. package/dist/browser/es/internal/{index-BD2hB9El.js → index-DynAX_OS.js} +1 -1
  12. package/dist/browser/es/internal/{object-BW-G4r5m.js → object-DenwvByi.js} +1106 -1066
  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/{browser/cjs/internal/index-BLpgsifL.js → node/cjs/internal/index-B96klT84.js} +1 -1
  20. package/dist/node/cjs/internal/{index-BBm_wnUa.js → index-CtqbrEO2.js} +1 -1
  21. package/dist/node/cjs/internal/object-CXx7IaXb.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-DEAJDDrx.js} +1 -1
  26. package/dist/node/es/internal/{index-BPCSW4M1.js → index-pNw-lk-q.js} +1 -1
  27. package/dist/node/es/internal/{object-C-_SkpQ0.js → object-2jyfnUeK.js} +763 -723
  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,150 +1,150 @@
1
- var ce = Object.defineProperty;
2
- var le = (t, e, i) => e in t ? ce(t, e, { enumerable: !0, configurable: !0, writable: !0, value: i }) : t[e] = i;
3
- var st = (t, e, i) => (le(t, typeof e != "symbol" ? e + "" : e, i), i);
4
- import { produce as pt, castDraft as at, castImmutable as me, freeze as ue } from "immer";
5
- import { z as f } from "zod";
6
- import Dt from "jszip";
7
- import fe from "crypto";
8
- import ut from "fs";
9
- import de from "https";
10
- import { join as ge } from "path";
11
- const Tt = (t) => t != null, he = f.any().refine((t) => Tt(t)), _t = f.enum(["LOAD_STATE"]), vt = f.enum(["PRUNE"]), Nt = f.enum(["REDO"]), It = f.enum(["SET_NAME"]), At = f.enum(["UNDO"]);
12
- function xe() {
13
- return f.object({
14
- __typename: f.literal("Action").optional(),
15
- type: f.string()
1
+ var fe = Object.defineProperty;
2
+ var de = (t, e, n) => e in t ? fe(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
3
+ var rt = (t, e, n) => (de(t, typeof e != "symbol" ? e + "" : e, n), n);
4
+ import { produce as lt, castDraft as ct, castImmutable as ge, freeze as he } from "immer";
5
+ import { z as d } from "zod";
6
+ import vt from "jszip";
7
+ import xe from "crypto";
8
+ import dt from "fs";
9
+ import ye from "https";
10
+ import { join as be } from "path";
11
+ const It = (t) => t != null, we = d.any().refine((t) => It(t)), Nt = d.enum(["LOAD_STATE"]), At = d.enum(["PRUNE"]), Pt = d.enum(["REDO"]), Mt = d.enum(["SET_NAME"]), Rt = d.enum(["UNDO"]);
12
+ function Oe() {
13
+ return d.object({
14
+ __typename: d.literal("Action").optional(),
15
+ type: d.string()
16
16
  });
17
17
  }
18
- function Y() {
19
- return f.literal("global").or(f.literal("local"));
18
+ function tt() {
19
+ return d.literal("global").or(d.literal("local"));
20
20
  }
21
- function Pt() {
22
- return f.union([
23
- Mt(),
24
- Rt(),
25
- Ct(),
21
+ function zt() {
22
+ return d.union([
23
+ Ut(),
26
24
  Ft(),
27
- Lt()
25
+ Lt(),
26
+ qt(),
27
+ Jt()
28
28
  ]);
29
29
  }
30
- function ye() {
31
- return f.object({
32
- __typename: f.literal("DocumentFile").optional(),
33
- data: f.string(),
34
- extension: f.string().nullable(),
35
- fileName: f.string().nullable(),
36
- mimeType: f.string()
30
+ function Se() {
31
+ return d.object({
32
+ __typename: d.literal("DocumentFile").optional(),
33
+ data: d.string(),
34
+ extension: d.string().nullable(),
35
+ fileName: d.string().nullable(),
36
+ mimeType: d.string()
37
37
  });
38
38
  }
39
- function Mt() {
40
- return f.object({
41
- input: f.lazy(() => ht()),
42
- type: _t,
43
- scope: Y()
39
+ function Ut() {
40
+ return d.object({
41
+ input: d.lazy(() => yt()),
42
+ type: Nt,
43
+ scope: tt()
44
44
  });
45
45
  }
46
- function ht() {
47
- return f.object({
48
- operations: f.number(),
49
- state: f.lazy(() => zt())
46
+ function yt() {
47
+ return d.object({
48
+ operations: d.number(),
49
+ state: d.lazy(() => Ct())
50
50
  });
51
51
  }
52
- function zt() {
53
- return f.object({
54
- data: f.unknown().nullish(),
55
- name: f.string()
52
+ function Ct() {
53
+ return d.object({
54
+ data: d.unknown().nullish(),
55
+ name: d.string()
56
56
  });
57
57
  }
58
- function be() {
59
- return f.object({
60
- __typename: f.literal("Operation").optional(),
61
- hash: f.string(),
62
- index: f.number(),
63
- timestamp: f.string().datetime(),
64
- type: f.string()
58
+ function je() {
59
+ return d.object({
60
+ __typename: d.literal("Operation").optional(),
61
+ hash: d.string(),
62
+ index: d.number(),
63
+ timestamp: d.string().datetime(),
64
+ type: d.string()
65
65
  });
66
66
  }
67
- function Rt() {
68
- return f.object({
69
- input: f.lazy(() => xt()),
70
- type: vt,
71
- scope: Y()
67
+ function Ft() {
68
+ return d.object({
69
+ input: d.lazy(() => bt()),
70
+ type: At,
71
+ scope: tt()
72
72
  });
73
73
  }
74
- function xt() {
75
- return f.object({
76
- end: f.number().nullish(),
77
- start: f.number().nullish()
74
+ function bt() {
75
+ return d.object({
76
+ end: d.number().nullish(),
77
+ start: d.number().nullish()
78
78
  });
79
79
  }
80
- const yt = f.number;
81
- function Ct() {
82
- return f.object({
83
- input: yt(),
84
- type: Nt,
85
- scope: Y()
80
+ const wt = d.number;
81
+ function Lt() {
82
+ return d.object({
83
+ input: wt(),
84
+ type: Pt,
85
+ scope: tt()
86
86
  });
87
87
  }
88
- const bt = f.string;
89
- function Ft() {
90
- return f.object({
91
- input: bt(),
92
- type: It,
93
- scope: f.literal("global")
88
+ const Ot = d.string;
89
+ function qt() {
90
+ return d.object({
91
+ input: Ot(),
92
+ type: Mt,
93
+ scope: d.literal("global")
94
94
  });
95
95
  }
96
- function we() {
97
- return f.object({
98
- __typename: f.literal("SetNameOperation").optional(),
99
- hash: f.string(),
100
- index: f.number(),
101
- input: f.string(),
102
- timestamp: f.string().datetime(),
103
- type: f.string()
96
+ function Ee() {
97
+ return d.object({
98
+ __typename: d.literal("SetNameOperation").optional(),
99
+ hash: d.string(),
100
+ index: d.number(),
101
+ input: d.string(),
102
+ timestamp: d.string().datetime(),
103
+ type: d.string()
104
104
  });
105
105
  }
106
- const wt = f.number;
107
- function Lt() {
108
- return f.object({
109
- input: wt(),
110
- type: At,
111
- scope: Y()
106
+ const St = d.number;
107
+ function Jt() {
108
+ return d.object({
109
+ input: St(),
110
+ type: Rt,
111
+ scope: tt()
112
112
  });
113
113
  }
114
- const ci = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
114
+ const bn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
115
115
  __proto__: null,
116
- ActionSchema: xe,
117
- BaseActionSchema: Pt,
118
- DocumentFileSchema: ye,
119
- LoadStateActionInputSchema: ht,
120
- LoadStateActionSchema: Mt,
121
- LoadStateActionStateInputSchema: zt,
122
- Load_StateSchema: _t,
123
- OperationSchema: be,
124
- OperationScopeSchema: Y,
125
- PruneActionInputSchema: xt,
126
- PruneActionSchema: Rt,
127
- PruneSchema: vt,
128
- RedoActionInputSchema: yt,
129
- RedoActionSchema: Ct,
130
- RedoSchema: Nt,
131
- SetNameActionInputSchema: bt,
132
- SetNameActionSchema: Ft,
133
- SetNameOperationSchema: we,
134
- Set_NameSchema: It,
135
- UndoActionInputSchema: wt,
136
- UndoActionSchema: Lt,
137
- UndoSchema: At,
138
- definedNonNullAnySchema: he,
139
- isDefinedNonNullAny: Tt
116
+ ActionSchema: Oe,
117
+ BaseActionSchema: zt,
118
+ DocumentFileSchema: Se,
119
+ LoadStateActionInputSchema: yt,
120
+ LoadStateActionSchema: Ut,
121
+ LoadStateActionStateInputSchema: Ct,
122
+ Load_StateSchema: Nt,
123
+ OperationSchema: je,
124
+ OperationScopeSchema: tt,
125
+ PruneActionInputSchema: bt,
126
+ PruneActionSchema: Ft,
127
+ PruneSchema: At,
128
+ RedoActionInputSchema: wt,
129
+ RedoActionSchema: Lt,
130
+ RedoSchema: Pt,
131
+ SetNameActionInputSchema: Ot,
132
+ SetNameActionSchema: qt,
133
+ SetNameOperationSchema: Ee,
134
+ Set_NameSchema: Mt,
135
+ UndoActionInputSchema: St,
136
+ UndoActionSchema: Jt,
137
+ UndoSchema: Rt,
138
+ definedNonNullAnySchema: we,
139
+ isDefinedNonNullAny: It
140
140
  }, Symbol.toStringTag, { value: "Module" }));
141
- function Oe(t) {
141
+ function $e(t) {
142
142
  return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
143
143
  }
144
- var ft = { exports: {} };
144
+ var gt = { exports: {} };
145
145
  (function(t, e) {
146
- const { hasOwnProperty: i } = Object.prototype, n = C();
147
- n.configure = C, n.stringify = n, n.default = n, e.stringify = n, e.configure = C, t.exports = n;
146
+ const { hasOwnProperty: n } = Object.prototype, i = C();
147
+ i.configure = C, i.stringify = i, i.default = i, e.stringify = i, e.configure = C, t.exports = i;
148
148
  const o = /[\u0000-\u001f\u0022\u005c\ud800-\udfff]|[\ud800-\udbff](?![\udc00-\udfff])|(?:[^\ud800-\udbff]|^)[\udc00-\udfff]/;
149
149
  function a(c) {
150
150
  return c.length < 5e3 && !o.test(c) ? `"${c}"` : JSON.stringify(c);
@@ -153,11 +153,11 @@ var ft = { exports: {} };
153
153
  if (c.length > 200)
154
154
  return c.sort();
155
155
  for (let l = 1; l < c.length; l++) {
156
- const u = c[l];
157
- let D = l;
158
- for (; D !== 0 && c[D - 1] > u; )
159
- c[D] = c[D - 1], D--;
160
- c[D] = u;
156
+ const f = c[l];
157
+ let k = l;
158
+ for (; k !== 0 && c[k - 1] > f; )
159
+ c[k] = c[k - 1], k--;
160
+ c[k] = f;
161
161
  }
162
162
  return c;
163
163
  }
@@ -172,16 +172,16 @@ var ft = { exports: {} };
172
172
  function m(c) {
173
173
  return p.call(c) !== void 0 && c.length !== 0;
174
174
  }
175
- function d(c, l, u) {
176
- c.length < u && (u = c.length);
177
- const D = l === "," ? "" : " ";
178
- let F = `"0":${D}${c[0]}`;
179
- for (let M = 1; M < u; M++)
180
- F += `${l}"${M}":${D}${c[M]}`;
175
+ function u(c, l, f) {
176
+ c.length < f && (f = c.length);
177
+ const k = l === "," ? "" : " ";
178
+ let F = `"0":${k}${c[0]}`;
179
+ for (let R = 1; R < f; R++)
180
+ F += `${l}"${R}":${k}${c[R]}`;
181
181
  return F;
182
182
  }
183
183
  function h(c) {
184
- if (i.call(c, "circularValue")) {
184
+ if (n.call(c, "circularValue")) {
185
185
  const l = c.circularValue;
186
186
  if (typeof l == "string")
187
187
  return `"${l}"`;
@@ -198,101 +198,101 @@ var ft = { exports: {} };
198
198
  return '"[Circular]"';
199
199
  }
200
200
  function b(c, l) {
201
- let u;
202
- if (i.call(c, l) && (u = c[l], typeof u != "boolean"))
201
+ let f;
202
+ if (n.call(c, l) && (f = c[l], typeof f != "boolean"))
203
203
  throw new TypeError(`The "${l}" argument must be of type boolean`);
204
- return u === void 0 ? !0 : u;
204
+ return f === void 0 ? !0 : f;
205
205
  }
206
206
  function w(c, l) {
207
- let u;
208
- if (i.call(c, l)) {
209
- if (u = c[l], typeof u != "number")
207
+ let f;
208
+ if (n.call(c, l)) {
209
+ if (f = c[l], typeof f != "number")
210
210
  throw new TypeError(`The "${l}" argument must be of type number`);
211
- if (!Number.isInteger(u))
211
+ if (!Number.isInteger(f))
212
212
  throw new TypeError(`The "${l}" argument must be an integer`);
213
- if (u < 1)
213
+ if (f < 1)
214
214
  throw new RangeError(`The "${l}" argument must be >= 1`);
215
215
  }
216
- return u === void 0 ? 1 / 0 : u;
216
+ return f === void 0 ? 1 / 0 : f;
217
217
  }
218
- function N(c) {
218
+ function I(c) {
219
219
  return c === 1 ? "1 item" : `${c} items`;
220
220
  }
221
221
  function $(c) {
222
222
  const l = /* @__PURE__ */ new Set();
223
- for (const u of c)
224
- (typeof u == "string" || typeof u == "number") && l.add(String(u));
223
+ for (const f of c)
224
+ (typeof f == "string" || typeof f == "number") && l.add(String(f));
225
225
  return l;
226
226
  }
227
- function P(c) {
228
- if (i.call(c, "strict")) {
227
+ function M(c) {
228
+ if (n.call(c, "strict")) {
229
229
  const l = c.strict;
230
230
  if (typeof l != "boolean")
231
231
  throw new TypeError('The "strict" argument must be of type boolean');
232
232
  if (l)
233
- return (u) => {
234
- let D = `Object can not safely be stringified. Received type ${typeof u}`;
235
- throw typeof u != "function" && (D += ` (${u.toString()})`), new Error(D);
233
+ return (f) => {
234
+ let k = `Object can not safely be stringified. Received type ${typeof f}`;
235
+ throw typeof f != "function" && (k += ` (${f.toString()})`), new Error(k);
236
236
  };
237
237
  }
238
238
  }
239
239
  function C(c) {
240
240
  c = { ...c };
241
- const l = P(c);
241
+ const l = M(c);
242
242
  l && (c.bigint === void 0 && (c.bigint = !1), "circularValue" in c || (c.circularValue = Error));
243
- const u = h(c), D = b(c, "bigint"), F = b(c, "deterministic"), M = w(c, "maximumDepth"), T = w(c, "maximumBreadth");
244
- function it(A, s, g, O, y, j) {
245
- let x = s[A];
246
- switch (typeof x == "object" && x !== null && typeof x.toJSON == "function" && (x = x.toJSON(A)), x = O.call(s, A, x), typeof x) {
243
+ const f = h(c), k = b(c, "bigint"), F = b(c, "deterministic"), R = w(c, "maximumDepth"), T = w(c, "maximumBreadth");
244
+ function it(P, s, g, O, y, j) {
245
+ let x = s[P];
246
+ switch (typeof x == "object" && x !== null && typeof x.toJSON == "function" && (x = x.toJSON(P)), x = O.call(s, P, x), typeof x) {
247
247
  case "string":
248
248
  return a(x);
249
249
  case "object": {
250
250
  if (x === null)
251
251
  return "null";
252
252
  if (g.indexOf(x) !== -1)
253
- return u;
254
- let S = "", k = ",";
253
+ return f;
254
+ let S = "", D = ",";
255
255
  const _ = j;
256
256
  if (Array.isArray(x)) {
257
257
  if (x.length === 0)
258
258
  return "[]";
259
- if (M < g.length + 1)
259
+ if (R < g.length + 1)
260
260
  return '"[Array]"';
261
261
  g.push(x), y !== "" && (j += y, S += `
262
- ${j}`, k = `,
262
+ ${j}`, D = `,
263
263
  ${j}`);
264
- const R = Math.min(x.length, T);
265
- let U = 0;
266
- for (; U < R - 1; U++) {
267
- const ot = it(String(U), x, g, O, y, j);
268
- S += ot !== void 0 ? ot : "null", S += k;
264
+ const U = Math.min(x.length, T);
265
+ let J = 0;
266
+ for (; J < U - 1; J++) {
267
+ const st = it(String(J), x, g, O, y, j);
268
+ S += st !== void 0 ? st : "null", S += D;
269
269
  }
270
- const J = it(String(U), x, g, O, y, j);
271
- if (S += J !== void 0 ? J : "null", x.length - 1 > T) {
272
- const ot = x.length - T - 1;
273
- S += `${k}"... ${N(ot)} not stringified"`;
270
+ const V = it(String(J), x, g, O, y, j);
271
+ if (S += V !== void 0 ? V : "null", x.length - 1 > T) {
272
+ const st = x.length - T - 1;
273
+ S += `${D}"... ${I(st)} not stringified"`;
274
274
  }
275
275
  return y !== "" && (S += `
276
276
  ${_}`), g.pop(), `[${S}]`;
277
277
  }
278
278
  let v = Object.keys(x);
279
- const I = v.length;
280
- if (I === 0)
279
+ const N = v.length;
280
+ if (N === 0)
281
281
  return "{}";
282
- if (M < g.length + 1)
282
+ if (R < g.length + 1)
283
283
  return '"[Object]"';
284
284
  let E = "", z = "";
285
- y !== "" && (j += y, k = `,
285
+ y !== "" && (j += y, D = `,
286
286
  ${j}`, E = " ");
287
- const q = Math.min(I, T);
287
+ const q = Math.min(N, T);
288
288
  F && !m(x) && (v = r(v)), g.push(x);
289
- for (let R = 0; R < q; R++) {
290
- const U = v[R], J = it(U, x, g, O, y, j);
291
- J !== void 0 && (S += `${z}${a(U)}:${E}${J}`, z = k);
289
+ for (let U = 0; U < q; U++) {
290
+ const J = v[U], V = it(J, x, g, O, y, j);
291
+ V !== void 0 && (S += `${z}${a(J)}:${E}${V}`, z = D);
292
292
  }
293
- if (I > T) {
294
- const R = I - T;
295
- S += `${z}"...":${E}"${N(R)} not stringified"`, z = k;
293
+ if (N > T) {
294
+ const U = N - T;
295
+ S += `${z}"...":${E}"${I(U)} not stringified"`, z = D;
296
296
  }
297
297
  return y !== "" && z.length > 1 && (S = `
298
298
  ${j}${S}
@@ -305,53 +305,53 @@ ${_}`), g.pop(), `{${S}}`;
305
305
  case "undefined":
306
306
  return;
307
307
  case "bigint":
308
- if (D)
308
+ if (k)
309
309
  return String(x);
310
310
  default:
311
311
  return l ? l(x) : void 0;
312
312
  }
313
313
  }
314
- function nt(A, s, g, O, y, j) {
315
- switch (typeof s == "object" && s !== null && typeof s.toJSON == "function" && (s = s.toJSON(A)), typeof s) {
314
+ function ot(P, s, g, O, y, j) {
315
+ switch (typeof s == "object" && s !== null && typeof s.toJSON == "function" && (s = s.toJSON(P)), typeof s) {
316
316
  case "string":
317
317
  return a(s);
318
318
  case "object": {
319
319
  if (s === null)
320
320
  return "null";
321
321
  if (g.indexOf(s) !== -1)
322
- return u;
322
+ return f;
323
323
  const x = j;
324
- let S = "", k = ",";
324
+ let S = "", D = ",";
325
325
  if (Array.isArray(s)) {
326
326
  if (s.length === 0)
327
327
  return "[]";
328
- if (M < g.length + 1)
328
+ if (R < g.length + 1)
329
329
  return '"[Array]"';
330
330
  g.push(s), y !== "" && (j += y, S += `
331
- ${j}`, k = `,
331
+ ${j}`, D = `,
332
332
  ${j}`);
333
- const I = Math.min(s.length, T);
333
+ const N = Math.min(s.length, T);
334
334
  let E = 0;
335
- for (; E < I - 1; E++) {
336
- const q = nt(String(E), s[E], g, O, y, j);
337
- S += q !== void 0 ? q : "null", S += k;
335
+ for (; E < N - 1; E++) {
336
+ const q = ot(String(E), s[E], g, O, y, j);
337
+ S += q !== void 0 ? q : "null", S += D;
338
338
  }
339
- const z = nt(String(E), s[E], g, O, y, j);
339
+ const z = ot(String(E), s[E], g, O, y, j);
340
340
  if (S += z !== void 0 ? z : "null", s.length - 1 > T) {
341
341
  const q = s.length - T - 1;
342
- S += `${k}"... ${N(q)} not stringified"`;
342
+ S += `${D}"... ${I(q)} not stringified"`;
343
343
  }
344
344
  return y !== "" && (S += `
345
345
  ${x}`), g.pop(), `[${S}]`;
346
346
  }
347
347
  g.push(s);
348
348
  let _ = "";
349
- y !== "" && (j += y, k = `,
349
+ y !== "" && (j += y, D = `,
350
350
  ${j}`, _ = " ");
351
351
  let v = "";
352
- for (const I of O) {
353
- const E = nt(I, s[I], g, O, y, j);
354
- E !== void 0 && (S += `${v}${a(I)}:${_}${E}`, v = k);
352
+ for (const N of O) {
353
+ const E = ot(N, s[N], g, O, y, j);
354
+ E !== void 0 && (S += `${v}${a(N)}:${_}${E}`, v = D);
355
355
  }
356
356
  return y !== "" && v.length > 1 && (S = `
357
357
  ${j}${S}
@@ -364,13 +364,13 @@ ${x}`), g.pop(), `{${S}}`;
364
364
  case "undefined":
365
365
  return;
366
366
  case "bigint":
367
- if (D)
367
+ if (k)
368
368
  return String(s);
369
369
  default:
370
370
  return l ? l(s) : void 0;
371
371
  }
372
372
  }
373
- function G(A, s, g, O, y) {
373
+ function Z(P, s, g, O, y) {
374
374
  switch (typeof s) {
375
375
  case "string":
376
376
  return a(s);
@@ -378,33 +378,33 @@ ${x}`), g.pop(), `{${S}}`;
378
378
  if (s === null)
379
379
  return "null";
380
380
  if (typeof s.toJSON == "function") {
381
- if (s = s.toJSON(A), typeof s != "object")
382
- return G(A, s, g, O, y);
381
+ if (s = s.toJSON(P), typeof s != "object")
382
+ return Z(P, s, g, O, y);
383
383
  if (s === null)
384
384
  return "null";
385
385
  }
386
386
  if (g.indexOf(s) !== -1)
387
- return u;
387
+ return f;
388
388
  const j = y;
389
389
  if (Array.isArray(s)) {
390
390
  if (s.length === 0)
391
391
  return "[]";
392
- if (M < g.length + 1)
392
+ if (R < g.length + 1)
393
393
  return '"[Array]"';
394
394
  g.push(s), y += O;
395
395
  let E = `
396
396
  ${y}`;
397
397
  const z = `,
398
398
  ${y}`, q = Math.min(s.length, T);
399
- let R = 0;
400
- for (; R < q - 1; R++) {
401
- const J = G(String(R), s[R], g, O, y);
402
- E += J !== void 0 ? J : "null", E += z;
399
+ let U = 0;
400
+ for (; U < q - 1; U++) {
401
+ const V = Z(String(U), s[U], g, O, y);
402
+ E += V !== void 0 ? V : "null", E += z;
403
403
  }
404
- const U = G(String(R), s[R], g, O, y);
405
- if (E += U !== void 0 ? U : "null", s.length - 1 > T) {
406
- const J = s.length - T - 1;
407
- E += `${z}"... ${N(J)} not stringified"`;
404
+ const J = Z(String(U), s[U], g, O, y);
405
+ if (E += J !== void 0 ? J : "null", s.length - 1 > T) {
406
+ const V = s.length - T - 1;
407
+ E += `${z}"... ${I(V)} not stringified"`;
408
408
  }
409
409
  return E += `
410
410
  ${j}`, g.pop(), `[${E}]`;
@@ -413,20 +413,20 @@ ${j}`, g.pop(), `[${E}]`;
413
413
  const S = x.length;
414
414
  if (S === 0)
415
415
  return "{}";
416
- if (M < g.length + 1)
416
+ if (R < g.length + 1)
417
417
  return '"[Object]"';
418
418
  y += O;
419
- const k = `,
419
+ const D = `,
420
420
  ${y}`;
421
- let _ = "", v = "", I = Math.min(S, T);
422
- m(s) && (_ += d(s, k, T), x = x.slice(s.length), I -= s.length, v = k), F && (x = r(x)), g.push(s);
423
- for (let E = 0; E < I; E++) {
424
- const z = x[E], q = G(z, s[z], g, O, y);
425
- q !== void 0 && (_ += `${v}${a(z)}: ${q}`, v = k);
421
+ let _ = "", v = "", N = Math.min(S, T);
422
+ m(s) && (_ += u(s, D, T), x = x.slice(s.length), N -= s.length, v = D), F && (x = r(x)), g.push(s);
423
+ for (let E = 0; E < N; E++) {
424
+ const z = x[E], q = Z(z, s[z], g, O, y);
425
+ q !== void 0 && (_ += `${v}${a(z)}: ${q}`, v = D);
426
426
  }
427
427
  if (S > T) {
428
428
  const E = S - T;
429
- _ += `${v}"...": "${N(E)} not stringified"`, v = k;
429
+ _ += `${v}"...": "${I(E)} not stringified"`, v = D;
430
430
  }
431
431
  return v !== "" && (_ = `
432
432
  ${y}${_}
@@ -439,13 +439,13 @@ ${j}`), g.pop(), `{${_}}`;
439
439
  case "undefined":
440
440
  return;
441
441
  case "bigint":
442
- if (D)
442
+ if (k)
443
443
  return String(s);
444
444
  default:
445
445
  return l ? l(s) : void 0;
446
446
  }
447
447
  }
448
- function Z(A, s, g) {
448
+ function Q(P, s, g) {
449
449
  switch (typeof s) {
450
450
  case "string":
451
451
  return a(s);
@@ -453,30 +453,30 @@ ${j}`), g.pop(), `{${_}}`;
453
453
  if (s === null)
454
454
  return "null";
455
455
  if (typeof s.toJSON == "function") {
456
- if (s = s.toJSON(A), typeof s != "object")
457
- return Z(A, s, g);
456
+ if (s = s.toJSON(P), typeof s != "object")
457
+ return Q(P, s, g);
458
458
  if (s === null)
459
459
  return "null";
460
460
  }
461
461
  if (g.indexOf(s) !== -1)
462
- return u;
462
+ return f;
463
463
  let O = "";
464
464
  if (Array.isArray(s)) {
465
465
  if (s.length === 0)
466
466
  return "[]";
467
- if (M < g.length + 1)
467
+ if (R < g.length + 1)
468
468
  return '"[Array]"';
469
469
  g.push(s);
470
- const k = Math.min(s.length, T);
470
+ const D = Math.min(s.length, T);
471
471
  let _ = 0;
472
- for (; _ < k - 1; _++) {
473
- const I = Z(String(_), s[_], g);
474
- O += I !== void 0 ? I : "null", O += ",";
472
+ for (; _ < D - 1; _++) {
473
+ const N = Q(String(_), s[_], g);
474
+ O += N !== void 0 ? N : "null", O += ",";
475
475
  }
476
- const v = Z(String(_), s[_], g);
476
+ const v = Q(String(_), s[_], g);
477
477
  if (O += v !== void 0 ? v : "null", s.length - 1 > T) {
478
- const I = s.length - T - 1;
479
- O += `,"... ${N(I)} not stringified"`;
478
+ const N = s.length - T - 1;
479
+ O += `,"... ${I(N)} not stringified"`;
480
480
  }
481
481
  return g.pop(), `[${O}]`;
482
482
  }
@@ -484,17 +484,17 @@ ${j}`), g.pop(), `{${_}}`;
484
484
  const j = y.length;
485
485
  if (j === 0)
486
486
  return "{}";
487
- if (M < g.length + 1)
487
+ if (R < g.length + 1)
488
488
  return '"[Object]"';
489
489
  let x = "", S = Math.min(j, T);
490
- m(s) && (O += d(s, ",", T), y = y.slice(s.length), S -= s.length, x = ","), F && (y = r(y)), g.push(s);
491
- for (let k = 0; k < S; k++) {
492
- const _ = y[k], v = Z(_, s[_], g);
490
+ m(s) && (O += u(s, ",", T), y = y.slice(s.length), S -= s.length, x = ","), F && (y = r(y)), g.push(s);
491
+ for (let D = 0; D < S; D++) {
492
+ const _ = y[D], v = Q(_, s[_], g);
493
493
  v !== void 0 && (O += `${x}${a(_)}:${v}`, x = ",");
494
494
  }
495
495
  if (j > T) {
496
- const k = j - T;
497
- O += `${x}"...":"${N(k)} not stringified"`;
496
+ const D = j - T;
497
+ O += `${x}"...":"${I(D)} not stringified"`;
498
498
  }
499
499
  return g.pop(), `{${O}}`;
500
500
  }
@@ -505,45 +505,74 @@ ${j}`), g.pop(), `{${_}}`;
505
505
  case "undefined":
506
506
  return;
507
507
  case "bigint":
508
- if (D)
508
+ if (k)
509
509
  return String(s);
510
510
  default:
511
511
  return l ? l(s) : void 0;
512
512
  }
513
513
  }
514
- function pe(A, s, g) {
514
+ function ue(P, s, g) {
515
515
  if (arguments.length > 1) {
516
516
  let O = "";
517
517
  if (typeof g == "number" ? O = " ".repeat(Math.min(g, 10)) : typeof g == "string" && (O = g.slice(0, 10)), s != null) {
518
518
  if (typeof s == "function")
519
- return it("", { "": A }, [], s, O, "");
519
+ return it("", { "": P }, [], s, O, "");
520
520
  if (Array.isArray(s))
521
- return nt("", A, [], $(s), O, "");
521
+ return ot("", P, [], $(s), O, "");
522
522
  }
523
523
  if (O.length !== 0)
524
- return G("", A, [], O, "");
524
+ return Z("", P, [], O, "");
525
525
  }
526
- return Z("", A, []);
526
+ return Q("", P, []);
527
527
  }
528
- return pe;
528
+ return ue;
529
529
  }
530
- })(ft, ft.exports);
531
- var Se = ft.exports;
532
- const K = /* @__PURE__ */ Oe(Se);
533
- K.configure;
534
- function je(t, e) {
530
+ })(gt, gt.exports);
531
+ var De = gt.exports;
532
+ const W = /* @__PURE__ */ $e(De);
533
+ W.configure;
534
+ let at;
535
+ const ke = new Uint8Array(16);
536
+ function Te() {
537
+ if (!at && (at = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !at))
538
+ throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
539
+ return at(ke);
540
+ }
541
+ const A = [];
542
+ for (let t = 0; t < 256; ++t)
543
+ A.push((t + 256).toString(16).slice(1));
544
+ function _e(t, e = 0) {
545
+ return A[t[e + 0]] + A[t[e + 1]] + A[t[e + 2]] + A[t[e + 3]] + "-" + A[t[e + 4]] + A[t[e + 5]] + "-" + A[t[e + 6]] + A[t[e + 7]] + "-" + A[t[e + 8]] + A[t[e + 9]] + "-" + A[t[e + 10]] + A[t[e + 11]] + A[t[e + 12]] + A[t[e + 13]] + A[t[e + 14]] + A[t[e + 15]];
546
+ }
547
+ const ve = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), kt = {
548
+ randomUUID: ve
549
+ };
550
+ function Ie(t, e, n) {
551
+ if (kt.randomUUID && !e && !t)
552
+ return kt.randomUUID();
553
+ t = t || {};
554
+ const i = t.random || (t.rng || Te)();
555
+ if (i[6] = i[6] & 15 | 64, i[8] = i[8] & 63 | 128, e) {
556
+ n = n || 0;
557
+ for (let o = 0; o < 16; ++o)
558
+ e[n + o] = i[o];
559
+ return e;
560
+ }
561
+ return _e(i);
562
+ }
563
+ function Ne(t, e) {
535
564
  return { ...t, name: e };
536
565
  }
537
- function Ee(t, e, i) {
538
- const { scope: n, input: o } = e;
539
- return pt({
566
+ function Ae(t, e, n) {
567
+ const { scope: i, input: o } = e;
568
+ return lt({
540
569
  document: t,
541
570
  action: e,
542
- skip: i
571
+ skip: n
543
572
  }, (r) => {
544
- if (r.document.operations[n].length < 1)
573
+ if (r.document.operations[i].length < 1)
545
574
  throw new Error(
546
- `Cannot undo: no operations in history for scope "${n}"`
575
+ `Cannot undo: no operations in history for scope "${i}"`
547
576
  );
548
577
  if (o < 1)
549
578
  throw new Error(
@@ -553,35 +582,35 @@ function Ee(t, e, i) {
553
582
  throw new Error(
554
583
  "Cannot undo: skip value from reducer cannot be used with UNDO action"
555
584
  );
556
- const p = r.document.operations[n].at(-1), m = p && p.type === "NOOP" && p.skip > 0;
585
+ const p = r.document.operations[i].at(-1), m = p && p.type === "NOOP" && p.skip > 0;
557
586
  if (r.skip += o, m) {
558
587
  r.skip += p.skip;
559
- const w = r.document.operations[n][r.document.operations[n].length - 2];
560
- w && p.index - w.index === 1 && r.document.operations[n].pop();
588
+ const w = r.document.operations[i][r.document.operations[i].length - 2];
589
+ w && p.index - w.index === 1 && r.document.operations[i].pop();
561
590
  }
562
- if (r.document.operations[n].length < r.skip)
591
+ if (r.document.operations[i].length < r.skip)
563
592
  throw new Error(
564
593
  "Cannot undo: you can't undo more operations than the ones in the scope history"
565
594
  );
566
- const d = r.document.operations[n].length - 1;
567
- let h = o, b = m ? d - p.skip : d;
595
+ const u = r.document.operations[i].length - 1;
596
+ let h = o, b = m ? u - p.skip : u;
568
597
  for (; h > 0 && b >= 0; ) {
569
- const w = r.document.operations[n][b];
598
+ const w = r.document.operations[i][b];
570
599
  if (!w) {
571
600
  h--, b--;
572
601
  continue;
573
602
  }
574
603
  w.type === "NOOP" && w.skip > 0 ? (b = b - (w.skip + 1), r.skip += w.skip + 1) : (r.document.clipboard.push({ ...w }), h--, b--);
575
604
  }
576
- r.action = ae(n);
605
+ r.action = me(i);
577
606
  });
578
607
  }
579
- function $e(t, e, i) {
580
- const { scope: n, input: o } = e;
581
- return pt({
608
+ function Pe(t, e, n) {
609
+ const { scope: i, input: o } = e;
610
+ return lt({
582
611
  document: t,
583
612
  action: e,
584
- skip: i
613
+ skip: n
585
614
  }, (r) => {
586
615
  if (r.skip > 0)
587
616
  throw new Error(
@@ -596,93 +625,93 @@ function $e(t, e, i) {
596
625
  if (r.document.clipboard.length < 1)
597
626
  throw new Error("Cannot redo: no operations in the clipboard");
598
627
  const p = r.document.clipboard.findLastIndex(
599
- (d) => d.scope === n
628
+ (u) => u.scope === i
600
629
  );
601
630
  if (p < 0)
602
631
  throw new Error(
603
- `Cannot redo: no operations in clipboard for scope "${n}"`
632
+ `Cannot redo: no operations in clipboard for scope "${i}"`
604
633
  );
605
634
  const m = r.document.clipboard.splice(p, 1)[0];
606
- r.action = at({
635
+ r.action = ct({
607
636
  type: m.type,
608
637
  scope: m.scope,
609
638
  input: m.input
610
639
  });
611
640
  });
612
641
  }
613
- function ke(t, e, i) {
614
- const { scope: n } = e, o = t.operations[n];
642
+ function Me(t, e, n) {
643
+ const { scope: i } = e, o = t.operations[i];
615
644
  let {
616
645
  input: { start: a, end: r }
617
646
  } = e;
618
647
  a = a || 0, r = r || o.length;
619
- const p = o.slice(a, r), m = o.slice(0, a), d = o.slice(r), h = gt(
648
+ const p = o.slice(a, r), m = o.slice(0, a), u = o.slice(r), h = xt(
620
649
  t.initialState,
621
650
  {
622
651
  ...t.operations,
623
- [n]: m.concat(p)
652
+ [i]: m.concat(p)
624
653
  },
625
- i
626
- ), { name: b, state: w } = h, N = m.length, $ = m.length ? m[m.length - 1].timestamp : d.length ? d[0].timestamp : (/* @__PURE__ */ new Date()).toISOString();
627
- return gt(
654
+ n
655
+ ), { name: b, state: w } = h, I = m.length, $ = m.length ? m[m.length - 1].timestamp : u.length ? u[0].timestamp : (/* @__PURE__ */ new Date()).toISOString();
656
+ return xt(
628
657
  t.initialState,
629
658
  {
630
659
  ...t.operations,
631
- [n]: [
660
+ [i]: [
632
661
  ...m,
633
662
  {
634
- ...Et(
663
+ ...Dt(
635
664
  { name: b, state: w },
636
665
  p.length
637
666
  ),
638
667
  timestamp: $,
639
- index: N,
640
- hash: jt({ state: w }, "global")
668
+ index: I,
669
+ hash: $t({ state: w }, "global")
641
670
  },
642
- ...d.map((P, C) => ({
643
- ...P,
644
- index: N + C + 1
671
+ ...u.map((M, C) => ({
672
+ ...M,
673
+ index: I + C + 1
645
674
  }))
646
675
  ]
647
676
  },
648
- i
677
+ n
649
678
  );
650
679
  }
651
- function De(t, e) {
680
+ function Re(t, e) {
652
681
  return {
653
682
  ...t,
654
683
  name: e.name,
655
684
  state: e.state ?? { global: {}, local: {} }
656
685
  };
657
686
  }
658
- const qt = "SET_NAME", tt = "UNDO", et = "REDO", ct = "PRUNE", Ut = "LOAD_STATE", Te = "NOOP", Jt = { "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"] };
659
- Object.freeze(Jt);
660
- var L = function(t, e, i, n) {
661
- if (i === "a" && !n)
687
+ const Vt = "SET_NAME", et = "UNDO", nt = "REDO", mt = "PRUNE", Ht = "LOAD_STATE", ze = "NOOP", Xt = { "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"] };
688
+ Object.freeze(Xt);
689
+ var L = function(t, e, n, i) {
690
+ if (n === "a" && !i)
662
691
  throw new TypeError("Private accessor was defined without a getter");
663
- if (typeof e == "function" ? t !== e || !n : !e.has(t))
692
+ if (typeof e == "function" ? t !== e || !i : !e.has(t))
664
693
  throw new TypeError("Cannot read private member from an object whose class did not declare it");
665
- return i === "m" ? n : i === "a" ? n.call(t) : n ? n.value : e.get(t);
666
- }, B, Q, X;
667
- class _e {
694
+ return n === "m" ? i : n === "a" ? i.call(t) : i ? i.value : e.get(t);
695
+ }, K, Y, B;
696
+ class Ue {
668
697
  constructor(...e) {
669
- B.set(this, /* @__PURE__ */ new Map()), Q.set(this, /* @__PURE__ */ new Map()), X.set(this, /* @__PURE__ */ new Map());
670
- for (const i of e)
671
- this.define(i);
698
+ K.set(this, /* @__PURE__ */ new Map()), Y.set(this, /* @__PURE__ */ new Map()), B.set(this, /* @__PURE__ */ new Map());
699
+ for (const n of e)
700
+ this.define(n);
672
701
  }
673
- define(e, i = !1) {
674
- for (let [n, o] of Object.entries(e)) {
675
- n = n.toLowerCase(), o = o.map((p) => p.toLowerCase()), L(this, X, "f").has(n) || L(this, X, "f").set(n, /* @__PURE__ */ new Set());
676
- const a = L(this, X, "f").get(n);
702
+ define(e, n = !1) {
703
+ for (let [i, o] of Object.entries(e)) {
704
+ i = i.toLowerCase(), o = o.map((p) => p.toLowerCase()), L(this, B, "f").has(i) || L(this, B, "f").set(i, /* @__PURE__ */ new Set());
705
+ const a = L(this, B, "f").get(i);
677
706
  let r = !0;
678
707
  for (let p of o) {
679
708
  const m = p.startsWith("*");
680
- if (p = m ? p.slice(1) : p, a == null || a.add(p), r && L(this, Q, "f").set(n, p), r = !1, m)
709
+ if (p = m ? p.slice(1) : p, a == null || a.add(p), r && L(this, Y, "f").set(i, p), r = !1, m)
681
710
  continue;
682
- const d = L(this, B, "f").get(p);
683
- if (d && d != n && !i)
684
- throw new Error(`"${n} -> ${p}" conflicts with "${d} -> ${p}". Pass \`force=true\` to override this definition.`);
685
- L(this, B, "f").set(p, n);
711
+ const u = L(this, K, "f").get(p);
712
+ if (u && u != i && !n)
713
+ throw new Error(`"${i} -> ${p}" conflicts with "${u} -> ${p}". Pass \`force=true\` to override this definition.`);
714
+ L(this, K, "f").set(p, i);
686
715
  }
687
716
  }
688
717
  return this;
@@ -690,67 +719,67 @@ class _e {
690
719
  getType(e) {
691
720
  if (typeof e != "string")
692
721
  return null;
693
- const i = e.replace(/^.*[/\\]/, "").toLowerCase(), n = i.replace(/^.*\./, "").toLowerCase(), o = i.length < e.length;
694
- return !(n.length < i.length - 1) && o ? null : L(this, B, "f").get(n) ?? null;
722
+ const n = e.replace(/^.*[/\\]/, "").toLowerCase(), i = n.replace(/^.*\./, "").toLowerCase(), o = n.length < e.length;
723
+ return !(i.length < n.length - 1) && o ? null : L(this, K, "f").get(i) ?? null;
695
724
  }
696
725
  getExtension(e) {
697
- var i;
698
- return typeof e != "string" ? null : (e = (i = e == null ? void 0 : e.split) == null ? void 0 : i.call(e, ";")[0], (e && L(this, Q, "f").get(e.trim().toLowerCase())) ?? null);
726
+ var n;
727
+ return typeof e != "string" ? null : (e = (n = e == null ? void 0 : e.split) == null ? void 0 : n.call(e, ";")[0], (e && L(this, Y, "f").get(e.trim().toLowerCase())) ?? null);
699
728
  }
700
729
  getAllExtensions(e) {
701
- return typeof e != "string" ? null : L(this, X, "f").get(e.toLowerCase()) ?? null;
730
+ return typeof e != "string" ? null : L(this, B, "f").get(e.toLowerCase()) ?? null;
702
731
  }
703
732
  _freeze() {
704
733
  this.define = () => {
705
734
  throw new Error("define() not allowed for built-in Mime objects. See https://github.com/broofa/mime/blob/main/README.md#custom-mime-instances");
706
735
  }, Object.freeze(this);
707
- for (const e of L(this, X, "f").values())
736
+ for (const e of L(this, B, "f").values())
708
737
  Object.freeze(e);
709
738
  return this;
710
739
  }
711
740
  _getTestState() {
712
741
  return {
713
- types: L(this, B, "f"),
714
- extensions: L(this, Q, "f")
742
+ types: L(this, K, "f"),
743
+ extensions: L(this, Y, "f")
715
744
  };
716
745
  }
717
746
  }
718
- B = /* @__PURE__ */ new WeakMap(), Q = /* @__PURE__ */ new WeakMap(), X = /* @__PURE__ */ new WeakMap();
719
- const ve = new _e(Jt)._freeze();
720
- function Ne(t, e, i) {
721
- const n = ge(t, e);
722
- return ut.mkdirSync(t, { recursive: !0 }), new Promise((o, a) => {
747
+ K = /* @__PURE__ */ new WeakMap(), Y = /* @__PURE__ */ new WeakMap(), B = /* @__PURE__ */ new WeakMap();
748
+ const Ce = new Ue(Xt)._freeze();
749
+ function Fe(t, e, n) {
750
+ const i = be(t, e);
751
+ return dt.mkdirSync(t, { recursive: !0 }), new Promise((o, a) => {
723
752
  try {
724
- ut.writeFile(n, i, {}, (r) => {
725
- r ? a(r) : o(n);
753
+ dt.writeFile(i, n, {}, (r) => {
754
+ r ? a(r) : o(i);
726
755
  });
727
756
  } catch (r) {
728
757
  a(r);
729
758
  }
730
759
  });
731
760
  }
732
- function Vt(t) {
733
- return ut.readFileSync(t);
761
+ function Bt(t) {
762
+ return dt.readFileSync(t);
734
763
  }
735
- function Ie(t) {
736
- return new Promise((e, i) => {
737
- de.get(t, (n) => {
738
- const o = [], a = n.headers["content-type"];
739
- n.on("data", (r) => {
764
+ function Le(t) {
765
+ return new Promise((e, n) => {
766
+ ye.get(t, (i) => {
767
+ const o = [], a = i.headers["content-type"];
768
+ i.on("data", (r) => {
740
769
  o.push(r);
741
- }), n.on("end", () => {
770
+ }), i.on("end", () => {
742
771
  e({ buffer: Buffer.concat(o), mimeType: a });
743
772
  });
744
- }).on("error", (n) => {
745
- i(n);
773
+ }).on("error", (i) => {
774
+ n(i);
746
775
  });
747
776
  });
748
777
  }
749
- const Ae = async (t) => Vt(t), lt = (t, e = "sha1") => fe.createHash(e).update(t).digest("base64");
750
- function Pe(t) {
751
- const e = [], i = Object.keys(t);
752
- for (const n of i) {
753
- const o = t[n].sort((a, r) => a.index - r.index);
778
+ const qe = async (t) => Bt(t), ut = (t, e = "sha1") => xe.createHash(e).update(t).digest("base64");
779
+ function Je(t) {
780
+ const e = [], n = Object.keys(t);
781
+ for (const i of n) {
782
+ const o = t[i].sort((a, r) => a.index - r.index);
754
783
  for (let a = 0; a < o.length; a++)
755
784
  o[a].index !== a && e.push({
756
785
  message: `Invalid operation index ${o[a].index} at position ${a}`,
@@ -763,10 +792,10 @@ function Pe(t) {
763
792
  }
764
793
  return e;
765
794
  }
766
- const Ht = async (t) => {
767
- const e = new Dt(), { name: i, revision: n, documentType: o, created: a, lastModified: r } = t, p = {
768
- name: i,
769
- revision: n,
795
+ const Kt = async (t) => {
796
+ const e = new vt(), { name: n, revision: i, documentType: o, created: a, lastModified: r } = t, p = {
797
+ name: n,
798
+ revision: i,
770
799
  documentType: o,
771
800
  created: a,
772
801
  lastModified: r
@@ -774,394 +803,405 @@ const Ht = async (t) => {
774
803
  return e.file("header.json", JSON.stringify(p, null, 2)), e.file(
775
804
  "state.json",
776
805
  JSON.stringify(t.initialState || {}, null, 2)
777
- ), e.file("operations.json", JSON.stringify(t.operations, null, 2)), Object.keys(t.attachments).forEach((d) => {
778
- const { data: h, ...b } = t.attachments[d];
779
- e.file(d, h, {
806
+ ), e.file("operations.json", JSON.stringify(t.operations, null, 2)), Object.keys(t.attachments).forEach((u) => {
807
+ const { data: h, ...b } = t.attachments[u];
808
+ e.file(u, h, {
780
809
  base64: !0,
781
810
  createFolders: !0,
782
811
  comment: JSON.stringify(b)
783
812
  });
784
813
  }), e;
785
- }, Me = async (t, e, i, n) => {
786
- const a = await (await Ht(t)).generateAsync({
814
+ }, Ve = async (t, e, n, i) => {
815
+ const a = await (await Kt(t)).generateAsync({
787
816
  type: "uint8array",
788
817
  streamFiles: !0
789
- }), r = n ?? t.name, p = `.${i}.zip`;
790
- return Ne(
818
+ }), r = i ?? t.name, p = `.${n}.zip`;
819
+ return Fe(
791
820
  e,
792
821
  r.endsWith(p) ? r : `${r}${p}`,
793
822
  a
794
823
  );
795
- }, li = async (t, e) => {
796
- const n = await (await Ht(t)).generateAsync({ type: "blob" }), o = await e.createWritable();
797
- await o.write(n), await o.close();
798
- }, $t = async (t, e, i) => {
799
- const n = Vt(t);
800
- return ze(n, e, i);
801
- }, ze = async (t, e, i) => {
802
- const n = new Dt();
803
- return await n.loadAsync(t), Re(n, e, i);
824
+ }, wn = async (t, e) => {
825
+ const i = await (await Kt(t)).generateAsync({ type: "blob" }), o = await e.createWritable();
826
+ await o.write(i), await o.close();
827
+ }, Tt = async (t, e, n) => {
828
+ const i = Bt(t);
829
+ return He(i, e, n);
830
+ }, He = async (t, e, n) => {
831
+ const i = new vt();
832
+ return await i.loadAsync(t), Xe(i, e, n);
804
833
  };
805
- async function Re(t, e, i) {
806
- const n = t.file("state.json");
807
- if (!n)
834
+ async function Xe(t, e, n) {
835
+ const i = t.file("state.json");
836
+ if (!i)
808
837
  throw new Error("Initial state not found");
809
- const o = await n.async("string"), a = JSON.parse(o), r = t.file("header.json");
838
+ const o = await i.async("string"), a = JSON.parse(o), r = t.file("header.json");
810
839
  let p;
811
840
  r && (p = JSON.parse(await r.async("string")));
812
841
  const m = t.file("operations.json");
813
842
  if (!m)
814
843
  throw new Error("Operations history not found");
815
- const d = JSON.parse(
844
+ const u = JSON.parse(
816
845
  await m.async("string")
817
- ), h = Pe(d);
846
+ ), h = Je(u);
818
847
  if (h.length) {
819
- const w = h.map((N) => N.message);
848
+ const w = h.map((I) => I.message);
820
849
  throw new Error(w.join(`
821
850
  `));
822
851
  }
823
- let b = ee(
852
+ let b = se(
824
853
  a,
825
- d,
854
+ u,
826
855
  e,
827
856
  void 0,
828
857
  p,
829
858
  {},
830
- i
859
+ n
831
860
  );
832
861
  return p && (b = {
833
862
  ...b,
834
863
  ...p
835
864
  }), b;
836
865
  }
837
- function Xt(t) {
838
- const e = t.replace(/^.*\./, "") || void 0, i = t.replace(/^.*[/\\]/, "") || void 0;
839
- return { extension: e, fileName: i };
866
+ function Wt(t) {
867
+ const e = t.replace(/^.*\./, "") || void 0, n = t.replace(/^.*[/\\]/, "") || void 0;
868
+ return { extension: e, fileName: n };
840
869
  }
841
- async function mi(t) {
842
- const { buffer: e, mimeType: i = "application/octet-stream" } = await Ie(t), n = Xt(t), o = e.toString("base64");
870
+ async function On(t) {
871
+ const { buffer: e, mimeType: n = "application/octet-stream" } = await Le(t), i = Wt(t), o = e.toString("base64");
843
872
  return {
844
873
  data: o,
845
- hash: lt(o),
846
- mimeType: i,
847
- ...n
874
+ hash: ut(o),
875
+ mimeType: n,
876
+ ...i
848
877
  };
849
878
  }
850
- async function ui(t) {
851
- const e = await Ae(t), i = ve.getType(t) || "application/octet-stream", n = Xt(t), o = e.toString("base64");
852
- return { data: o, hash: lt(o), mimeType: i, ...n };
879
+ async function Sn(t) {
880
+ const e = await qe(t), n = Ce.getType(t) || "application/octet-stream", i = Wt(t), o = e.toString("base64");
881
+ return { data: o, hash: ut(o), mimeType: n, ...i };
853
882
  }
854
- var Bt = /* @__PURE__ */ ((t) => (t.UNEXPECTED_INDEX = "UNEXPECTED_INDEX", t))(Bt || {}), Kt = /* @__PURE__ */ ((t) => (t.DUPLICATED_INDEX = "DUPLICATED_INDEX", t.MISSING_INDEX = "MISSING_INDEX", t))(Kt || {});
855
- function Ot(t) {
883
+ var Gt = /* @__PURE__ */ ((t) => (t.UNEXPECTED_INDEX = "UNEXPECTED_INDEX", t))(Gt || {}), Zt = /* @__PURE__ */ ((t) => (t.DUPLICATED_INDEX = "DUPLICATED_INDEX", t.MISSING_INDEX = "MISSING_INDEX", t))(Zt || {});
884
+ function jt(t) {
856
885
  const e = [];
857
- let i = -1;
858
- for (const n of t) {
859
- const o = n.index - n.skip;
860
- o !== i + 1 && e.push({
886
+ let n = -1;
887
+ for (const i of t) {
888
+ const o = i.index - i.skip;
889
+ o !== n + 1 && e.push({
861
890
  operation: {
862
- index: n.index,
863
- skip: n.skip
891
+ index: i.index,
892
+ skip: i.skip
864
893
  },
865
894
  issue: "UNEXPECTED_INDEX",
866
- category: o > i + 1 ? "MISSING_INDEX" : "DUPLICATED_INDEX",
867
- message: `Expected index ${i + 1} with skip 0 or equivalent, got index ${n.index} with skip ${n.skip}`
868
- }), i = n.index;
895
+ category: o > n + 1 ? "MISSING_INDEX" : "DUPLICATED_INDEX",
896
+ message: `Expected index ${n + 1} with skip 0 or equivalent, got index ${i.index} with skip ${i.skip}`
897
+ }), n = i.index;
869
898
  }
870
899
  return e;
871
900
  }
872
- function V(t) {
873
- var n, o, a;
901
+ function H(t) {
902
+ var i, o, a;
874
903
  const e = [];
875
- let i = t.length - 1;
876
- for (; i > -1; ) {
877
- e.unshift(t[i]);
878
- const r = (((n = t[i]) == null ? void 0 : n.index) || 0) - (((o = t[i]) == null ? void 0 : o.skip) || 0) - 1;
879
- let p = i - 1;
904
+ let n = t.length - 1;
905
+ for (; n > -1; ) {
906
+ e.unshift(t[n]);
907
+ const r = (((i = t[n]) == null ? void 0 : i.index) || 0) - (((o = t[n]) == null ? void 0 : o.skip) || 0) - 1;
908
+ let p = n - 1;
880
909
  for (; p > -1 && (((a = t[p]) == null ? void 0 : a.index) || 0) > r; )
881
910
  p--;
882
- i = p;
911
+ n = p;
883
912
  }
884
913
  return e;
885
914
  }
886
- function Ce(t) {
887
- const e = [...t], i = e[e.length - 1];
888
- return i && (i.type === "NOOP" ? e.push({
889
- ...i,
890
- index: i.index,
915
+ function Be(t) {
916
+ const e = [...t], n = e[e.length - 1];
917
+ return n && (n.type === "NOOP" ? e.push({
918
+ ...n,
919
+ index: n.index,
891
920
  type: "NOOP",
892
- skip: Zt(t)
921
+ skip: te(t)
893
922
  }) : e.push({
894
923
  type: "NOOP",
895
- index: i.index + 1,
924
+ index: n.index + 1,
896
925
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
897
926
  input: {},
898
927
  skip: 1,
899
- scope: i.scope,
900
- hash: i.hash
928
+ scope: n.scope,
929
+ hash: n.hash
901
930
  })), e;
902
931
  }
903
- function H(t) {
904
- return t.slice().sort((e, i) => e.skip - i.skip).sort((e, i) => e.index - i.index);
932
+ function X(t) {
933
+ return t.slice().sort((e, n) => e.skip - n.skip).sort((e, n) => e.index - n.index);
905
934
  }
906
- const Fe = (t, e, i) => [...e, ...i].sort(
907
- (n, o) => new Date(n.timestamp).getTime() - new Date(o.timestamp).getTime()
908
- ).map((n, o) => ({
909
- ...n,
935
+ const Ke = (t, e, n) => [...e, ...n].sort(
936
+ (i, o) => new Date(i.timestamp).getTime() - new Date(o.timestamp).getTime()
937
+ ).map((i, o) => ({
938
+ ...i,
910
939
  index: t.index + o,
911
940
  skip: o === 0 ? t.skip : 0
912
- })), Le = (t, e, i) => [...e, ...i].sort(
913
- (n, o) => new Date(n.timestamp).getTime() - new Date(o.timestamp).getTime()
914
- ).sort((n, o) => n.index - o.index).map((n, o) => ({
915
- ...n,
941
+ })), We = (t, e, n) => [...e, ...n].sort(
942
+ (i, o) => new Date(i.timestamp).getTime() - new Date(o.timestamp).getTime()
943
+ ).sort((i, o) => i.index - o.index).map((i, o) => ({
944
+ ...i,
916
945
  index: t.index + o,
917
946
  skip: o === 0 ? t.skip : 0
918
947
  }));
919
- function St(t, e) {
920
- return K(t) === K(e);
948
+ function Et(t, e) {
949
+ return W(t) === W(e);
921
950
  }
922
- function qe(t, e) {
923
- const i = V(H(t.slice())), n = V(H(e.slice()));
924
- if (i.length < 1)
925
- return [n, []];
951
+ function Ge(t, e) {
952
+ const n = H(X(t.slice())), i = H(X(e.slice()));
953
+ if (n.length < 1)
954
+ return [i, []];
926
955
  const o = [];
927
956
  let a = !1;
928
- for (; n.length > 0; ) {
929
- const r = n[0];
930
- let p = i.shift();
931
- for (; p && Wt(p, r); )
932
- o.push(p), p = i.shift();
933
- if (p ? a || (St(p, r) ? (n.shift(), o.push(p)) : (i.unshift(p), a = !0)) : a = !0, a) {
934
- let m = n.shift();
957
+ for (; i.length > 0; ) {
958
+ const r = i[0];
959
+ let p = n.shift();
960
+ for (; p && Qt(p, r); )
961
+ o.push(p), p = n.shift();
962
+ if (p ? a || (Et(p, r) ? (i.shift(), o.push(p)) : (n.unshift(p), a = !0)) : a = !0, a) {
963
+ let m = i.shift();
935
964
  for (; m; )
936
- o.push(m), m = n.shift();
965
+ o.push(m), m = i.shift();
937
966
  }
938
967
  }
939
968
  if (!a) {
940
- let r = i.shift();
969
+ let r = n.shift();
941
970
  for (; r; )
942
- o.push(r), r = i.shift();
971
+ o.push(r), r = n.shift();
943
972
  }
944
- return [V(o), i];
973
+ return [H(o), n];
945
974
  }
946
- function Wt(t, e) {
947
- return t.index < e.index || t.index === e.index && t.skip < e.skip;
975
+ function Qt(t, e) {
976
+ return t.index < e.index || t.index === e.index && t.id === e.id && t.skip < e.skip;
948
977
  }
949
- function Gt(t, e) {
950
- const i = [], n = [], o = [], a = Math.max(
978
+ function Yt(t, e) {
979
+ const n = [], i = [], o = [], a = Math.max(
951
980
  t.length,
952
981
  e.length
953
982
  );
954
983
  let r = !1;
955
984
  for (let p = 0; p < a; p++) {
956
- const m = t[p], d = e[p];
957
- m && d ? !r && St(m, d) ? i.push(m) : (r = !0, n.push(m), o.push(d)) : m ? n.push(m) : d && o.push(d);
985
+ const m = t[p], u = e[p];
986
+ m && u ? !r && Et(m, u) ? n.push(m) : (r = !0, i.push(m), o.push(u)) : m ? i.push(m) : u && o.push(u);
958
987
  }
959
- return [i, n, o];
988
+ return [n, i, o];
960
989
  }
961
- function Ue(t, e, i) {
962
- const [n, o, a] = Gt(
963
- V(t),
964
- V(e)
965
- ), r = mt(n), p = 1 + Math.max(
990
+ function Ze(t, e, n) {
991
+ const [i, o, a] = Yt(
992
+ H(t),
993
+ H(e)
994
+ ), r = ft(i), p = 1 + Math.max(
966
995
  r,
967
- mt(o),
968
- mt(a)
969
- ), m = i(
996
+ ft(o),
997
+ ft(a)
998
+ ), m = ne(
999
+ a,
1000
+ o
1001
+ ), u = n(
970
1002
  {
971
1003
  index: p,
972
1004
  skip: p - (r + 1)
973
1005
  },
974
1006
  o,
975
- a
1007
+ m
976
1008
  );
977
- return n.concat(m);
1009
+ return i.concat(u);
978
1010
  }
979
- function mt(t) {
1011
+ function ft(t) {
980
1012
  const e = t[t.length - 1];
981
1013
  return e ? e.index : -1;
982
1014
  }
983
- function Zt(t) {
984
- var n, o, a;
1015
+ function te(t) {
1016
+ var i, o, a;
985
1017
  if (t.length < 1)
986
1018
  return -1;
987
- const e = V(t);
988
- let i = (((n = e[e.length - 1]) == null ? void 0 : n.skip) || 0) + 1;
989
- return e.length > 1 && (i += ((o = e[e.length - 2]) == null ? void 0 : o.skip) || 0), (((a = e[e.length - 1]) == null ? void 0 : a.index) || -1) < i ? -1 : i;
1019
+ const e = H(t);
1020
+ let n = (((i = e[e.length - 1]) == null ? void 0 : i.skip) || 0) + 1;
1021
+ return e.length > 1 && (n += ((o = e[e.length - 2]) == null ? void 0 : o.skip) || 0), (((a = e[e.length - 1]) == null ? void 0 : a.index) || -1) < n ? -1 : n;
990
1022
  }
991
- const Je = (t) => Ot(
992
- V(H(t))
993
- ), Ve = (t) => t.reduce((i, n) => {
1023
+ const Qe = (t) => jt(
1024
+ H(X(t))
1025
+ ), Ye = (t) => t.reduce((n, i) => {
994
1026
  var o;
995
- return i[n.scope] || (i[n.scope] = []), (o = i[n.scope]) == null || o.push(n), i;
996
- }, {}), He = (t, e) => {
1027
+ return n[i.scope] || (n[i.scope] = []), (o = n[i.scope]) == null || o.push(i), n;
1028
+ }, {}), tn = (t, e) => {
997
1029
  var m;
998
- const i = {
1030
+ const n = {
999
1031
  integrityIssues: [],
1000
1032
  validOperations: [],
1001
1033
  invalidOperations: [],
1002
1034
  duplicatedOperations: []
1003
- }, n = H(t), o = H(e), a = Ot([
1004
- ...n,
1035
+ }, i = X(t), o = X(e), a = jt([
1036
+ ...i,
1005
1037
  ...o
1006
1038
  ]), p = (m = [...a.filter(
1007
- (d) => d.category === "MISSING_INDEX"
1039
+ (u) => u.category === "MISSING_INDEX"
1008
1040
  /* MISSING_INDEX */
1009
- )].sort((d, h) => h.operation.index - d.operation.index).pop()) == null ? void 0 : m.operation;
1010
- for (const d of o) {
1011
- if (p && d.index >= p.index) {
1012
- i.invalidOperations.push(d);
1041
+ )].sort((u, h) => h.operation.index - u.operation.index).pop()) == null ? void 0 : m.operation;
1042
+ for (const u of o) {
1043
+ if (p && u.index >= p.index) {
1044
+ n.invalidOperations.push(u);
1013
1045
  continue;
1014
1046
  }
1015
- if (a.some((b) => b.operation.index === d.index && b.operation.skip === d.skip && b.category === "DUPLICATED_INDEX")) {
1016
- i.duplicatedOperations.push(d);
1047
+ if (a.some((b) => b.operation.index === u.index && b.operation.skip === u.skip && b.category === "DUPLICATED_INDEX")) {
1048
+ n.duplicatedOperations.push(u);
1017
1049
  continue;
1018
1050
  }
1019
- i.validOperations.push(d);
1051
+ n.validOperations.push(u);
1020
1052
  }
1021
- return i.integrityIssues.push(...a), i;
1053
+ return n.integrityIssues.push(...a), n;
1022
1054
  };
1023
- function Xe(t, e) {
1024
- return t.filter((i) => !e.some((n) => i.type === "NOOP" && i.skip === 0 && i.index === n.index || i.index === n.index && i.skip === n.skip && i.scope === n.scope && i.hash === n.hash && i.type === n.type));
1055
+ function en(t, e) {
1056
+ return t.filter((n) => !e.some((i) => n.type === "NOOP" && n.skip === 0 && n.index === i.index || n.index === i.index && n.skip === i.skip && n.scope === i.scope && n.hash === i.hash && n.type === i.type));
1025
1057
  }
1026
- function Qt(t, e) {
1027
- const [i] = H(t).slice(-1), n = (i == null ? void 0 : i.index) ?? -1, o = n + 1, a = {
1058
+ function ee(t, e) {
1059
+ const [n] = X(t).slice(-1), i = (n == null ? void 0 : n.index) ?? -1, o = i + 1, a = {
1028
1060
  ...e,
1029
1061
  index: e.index ?? o
1030
1062
  };
1031
- if (a.index < n)
1063
+ if (a.index < i)
1032
1064
  throw new Error(
1033
- `The skip header operation index must be greater than or equal to ${n}`
1065
+ `The skip header operation index must be greater than or equal to ${i}`
1034
1066
  );
1035
- return (V(
1036
- H([...t, a])
1067
+ return (H(
1068
+ X([...t, a])
1037
1069
  ) || []).slice(0, -1);
1038
1070
  }
1039
- function dt(t) {
1071
+ function ht(t) {
1040
1072
  return {
1041
1073
  ...Object.entries(t).reduce(
1042
- (i, n) => {
1043
- const [o, a] = n;
1074
+ (n, i) => {
1075
+ const [o, a] = i;
1044
1076
  return {
1045
- ...i,
1046
- [o]: V(H(a))
1077
+ ...n,
1078
+ [o]: H(X(a))
1047
1079
  };
1048
1080
  },
1049
1081
  {}
1050
1082
  )
1051
1083
  };
1052
1084
  }
1053
- const fi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1085
+ function ne(t, e) {
1086
+ return t.filter((n) => n.id ? !e.some((i) => i.id === n.id) : !0);
1087
+ }
1088
+ const jn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1054
1089
  __proto__: null,
1055
- IntegrityIssueSubType: Kt,
1056
- IntegrityIssueType: Bt,
1057
- addUndo: Ce,
1058
- attachBranch: qe,
1059
- checkCleanedOperationsIntegrity: Ot,
1060
- checkOperationsIntegrity: Je,
1061
- garbageCollect: V,
1062
- garbageCollectDocumentOperations: dt,
1063
- groupOperationsByScope: Ve,
1064
- merge: Ue,
1065
- nextSkipNumber: Zt,
1066
- operationsAreEqual: St,
1067
- precedes: Wt,
1068
- prepareOperations: He,
1069
- removeExistingOperations: Xe,
1070
- reshuffleByTimestamp: Fe,
1071
- reshuffleByTimestampAndIndex: Le,
1072
- skipHeaderOperations: Qt,
1073
- sortOperations: H,
1074
- split: Gt
1090
+ IntegrityIssueSubType: Zt,
1091
+ IntegrityIssueType: Gt,
1092
+ addUndo: Be,
1093
+ attachBranch: Ge,
1094
+ checkCleanedOperationsIntegrity: jt,
1095
+ checkOperationsIntegrity: Qe,
1096
+ filterDuplicatedOperations: ne,
1097
+ garbageCollect: H,
1098
+ garbageCollectDocumentOperations: ht,
1099
+ groupOperationsByScope: Ye,
1100
+ merge: Ze,
1101
+ nextSkipNumber: te,
1102
+ operationsAreEqual: Et,
1103
+ precedes: Qt,
1104
+ prepareOperations: tn,
1105
+ removeExistingOperations: en,
1106
+ reshuffleByTimestamp: Ke,
1107
+ reshuffleByTimestampAndIndex: We,
1108
+ skipHeaderOperations: ee,
1109
+ sortOperations: X,
1110
+ split: Yt
1075
1111
  }, Symbol.toStringTag, { value: "Module" }));
1076
- function Be(t, e) {
1077
- let i;
1078
- return "index" in e ? i = { ...e } : i = t.operations[e.scope].at(-1), ((i == null ? void 0 : i.index) ?? -1) + 1;
1112
+ function nn(t, e) {
1113
+ let n;
1114
+ return "index" in e ? n = { ...e } : n = t.operations[e.scope].at(-1), ((n == null ? void 0 : n.index) ?? -1) + 1;
1079
1115
  }
1080
- function Yt(t, e) {
1116
+ function ie(t, e) {
1081
1117
  return {
1082
1118
  ...t,
1083
1119
  revision: {
1084
1120
  ...t.revision,
1085
- [e.scope]: Be(t, e)
1121
+ [e.scope]: nn(t, e)
1086
1122
  },
1087
1123
  lastModified: (/* @__PURE__ */ new Date()).toISOString()
1088
1124
  };
1089
1125
  }
1090
- function Ke(t, e, i = 0) {
1091
- if ([tt, et, ct].includes(e.type))
1126
+ function on(t, e, n = 0) {
1127
+ if ([et, nt, mt].includes(e.type))
1092
1128
  return t;
1093
- const { scope: n } = e, o = t.operations[n].slice(), a = o.at(-1);
1094
- let r = ((a == null ? void 0 : a.index) ?? -1) + 1;
1129
+ const { scope: i } = e, o = t.operations[i].slice();
1130
+ let a;
1131
+ const r = o.at(-1);
1132
+ let p = ((r == null ? void 0 : r.index) ?? -1) + 1;
1095
1133
  if ("index" in e) {
1096
- if (e.index - i > r)
1134
+ if (e.index - n > p)
1097
1135
  throw new Error(
1098
- `Missing operations: expected ${r} with skip 0 or equivalent, got index ${e.index} with skip ${i}`
1136
+ `Missing operations: expected ${p} with skip 0 or equivalent, got index ${e.index} with skip ${n}`
1099
1137
  );
1100
- r = e.index;
1101
- }
1138
+ p = e.index, a = e.id;
1139
+ } else
1140
+ a = Ie();
1102
1141
  return o.push({
1103
1142
  ...e,
1104
- index: r,
1143
+ id: a,
1144
+ index: p,
1105
1145
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
1106
1146
  hash: "",
1107
- scope: n,
1108
- skip: i,
1147
+ scope: i,
1148
+ skip: n,
1109
1149
  error: void 0
1110
1150
  }), {
1111
1151
  ...t,
1112
- operations: { ...t.operations, [n]: o }
1152
+ operations: { ...t.operations, [i]: o }
1113
1153
  };
1114
1154
  }
1115
- function We(t, e, i = 0) {
1116
- let n = Ke(t, e, i);
1117
- return n = Yt(n, e), n;
1118
- }
1119
- function Ge(t, e, i) {
1120
- switch (Pt().parse(e), e.type) {
1121
- case qt:
1122
- return je(t, e.input);
1123
- case ct:
1124
- return ke(t, e, i);
1125
- case Ut:
1126
- return De(t, e.input.state);
1155
+ function sn(t, e, n = 0) {
1156
+ let i = on(t, e, n);
1157
+ return i = ie(i, e), i;
1158
+ }
1159
+ function rn(t, e, n) {
1160
+ switch (zt().parse(e), e.type) {
1161
+ case Vt:
1162
+ return Ne(t, e.input);
1163
+ case mt:
1164
+ return Me(t, e, n);
1165
+ case Ht:
1166
+ return Re(t, e.input.state);
1127
1167
  default:
1128
1168
  return t;
1129
1169
  }
1130
1170
  }
1131
- function di(t, e, i) {
1171
+ function En(t, e, n) {
1132
1172
  switch (e.type) {
1133
- case tt:
1134
- return Ee(t, e, i);
1135
1173
  case et:
1136
- return $e(t, e, i);
1174
+ return Ae(t, e, n);
1175
+ case nt:
1176
+ return Pe(t, e, n);
1137
1177
  default:
1138
- return { document: t, action: e, skip: i };
1178
+ return { document: t, action: e, skip: n };
1139
1179
  }
1140
1180
  }
1141
- function Ze(t, e, i, n, o = !1, a = ie) {
1181
+ function an(t, e, n, i, o = !1, a = re) {
1142
1182
  const r = e.scope, p = t.operations[r].at(-1);
1143
1183
  if (!p)
1144
1184
  return t;
1145
- const m = dt(
1185
+ const m = ht(
1146
1186
  {
1147
1187
  ...t.operations,
1148
- [r]: Qt(
1188
+ [r]: ee(
1149
1189
  t.operations[r],
1150
1190
  p
1151
1191
  )
1152
1192
  }
1153
1193
  );
1154
- let d;
1194
+ let u;
1155
1195
  const h = m[r].at(-1);
1156
1196
  if (o && (h != null && h.resultingState))
1157
- d = a(
1197
+ u = a(
1158
1198
  h.resultingState
1159
1199
  );
1160
1200
  else {
1161
- const { state: b } = gt(
1201
+ const { state: b } = xt(
1162
1202
  t.initialState,
1163
1203
  m,
1164
- i,
1204
+ n,
1165
1205
  void 0,
1166
1206
  void 0,
1167
1207
  void 0,
@@ -1172,52 +1212,52 @@ function Ze(t, e, i, n, o = !1, a = ie) {
1172
1212
  operationResultingStateParser: a
1173
1213
  }
1174
1214
  );
1175
- d = b[r];
1215
+ u = b[r];
1176
1216
  }
1177
1217
  return {
1178
1218
  ...t,
1179
1219
  state: {
1180
1220
  ...t.state,
1181
- [r]: d
1221
+ [r]: u
1182
1222
  },
1183
- operations: dt({
1223
+ operations: ht({
1184
1224
  ...t.operations
1185
1225
  })
1186
1226
  };
1187
1227
  }
1188
- function te(t, e, i, n, o = {}) {
1228
+ function oe(t, e, n, i, o = {}) {
1189
1229
  const {
1190
1230
  skip: a,
1191
1231
  ignoreSkipOperations: r = !1,
1192
1232
  reuseHash: p = !1,
1193
1233
  reuseOperationResultingState: m = !1,
1194
- operationResultingStateParser: d
1234
+ operationResultingStateParser: u
1195
1235
  } = o, h = { ...e }, b = a || 0;
1196
1236
  let w = { ...t };
1197
- const N = !r && (b > 0 || "index" in h && h.skip > 0);
1198
- return kt(h) && (w = Ge(w, h, i)), w = We(w, h, b), N && (w = Ze(
1237
+ const I = !r && (b > 0 || "index" in h && h.skip > 0);
1238
+ return _t(h) && (w = rn(w, h, n)), w = sn(w, h, b), I && (w = an(
1199
1239
  w,
1200
1240
  h,
1201
- i,
1241
+ n,
1202
1242
  b,
1203
1243
  m,
1204
- d
1205
- )), w = pt(w, ($) => {
1244
+ u
1245
+ )), w = lt(w, ($) => {
1206
1246
  try {
1207
- const P = i(
1247
+ const M = n(
1208
1248
  $.state,
1209
1249
  h,
1210
- n
1250
+ i
1211
1251
  );
1212
- if (P)
1213
- return at({
1252
+ if (M)
1253
+ return ct({
1214
1254
  ...w,
1215
1255
  // clipboard: [...clipboardValue],
1216
- state: P
1256
+ state: M
1217
1257
  });
1218
- } catch (P) {
1258
+ } catch (M) {
1219
1259
  const C = w.operations[h.scope].length - 1;
1220
- $.operations[h.scope][C].error = P.message, $.operations[h.scope][C].skip = 0, N && ($.state = at({ ...t.state }), $.operations = at({
1260
+ $.operations[h.scope][C].error = M.message, $.operations[h.scope][C].skip = 0, I && ($.state = ct({ ...t.state }), $.operations = ct({
1221
1261
  ...t.operations,
1222
1262
  [h.scope]: [
1223
1263
  ...t.operations[h.scope],
@@ -1227,45 +1267,45 @@ function te(t, e, i, n, o = {}) {
1227
1267
  ]
1228
1268
  }));
1229
1269
  }
1230
- }), pt(w, ($) => {
1231
- if ([tt, et, ct].includes(h.type))
1270
+ }), lt(w, ($) => {
1271
+ if ([et, nt, mt].includes(h.type))
1232
1272
  return $;
1233
- const P = h.scope || "global", C = p && Object.prototype.hasOwnProperty.call(h, "hash") ? h.hash : jt($, P), c = $.operations[P].at(-1);
1234
- c && (c.hash = C, m && (c.resultingState = $.state[P]), !kt(h) && h.attachments && h.attachments.forEach((l) => {
1235
- const { hash: u, ...D } = l;
1236
- $.attachments[u] = {
1237
- ...D
1273
+ const M = h.scope || "global", C = p && Object.prototype.hasOwnProperty.call(h, "hash") ? h.hash : $t($, M), c = $.operations[M].at(-1);
1274
+ c && (c.hash = C, m && (c.resultingState = $.state[M]), !_t(h) && h.attachments && h.attachments.forEach((l) => {
1275
+ const { hash: f, ...k } = l;
1276
+ $.attachments[f] = {
1277
+ ...k
1238
1278
  };
1239
1279
  }));
1240
1280
  });
1241
1281
  }
1242
- function gi(t) {
1243
- return t.type === Te && t.skip !== void 0 && t.skip > 0 && t.hash !== void 0;
1282
+ function $n(t) {
1283
+ return t.type === ze && t.skip !== void 0 && t.skip > 0 && t.hash !== void 0;
1244
1284
  }
1245
- function hi(t) {
1246
- return [tt, et].includes(t.type);
1285
+ function Dn(t) {
1286
+ return [et, nt].includes(t.type);
1247
1287
  }
1248
- function kt(t) {
1249
- return [qt, tt, et, ct, Ut].includes(t.type);
1288
+ function _t(t) {
1289
+ return [Vt, et, nt, mt, Ht].includes(t.type);
1250
1290
  }
1251
- function W(t, e, i, n, o = "global") {
1291
+ function G(t, e, n, i, o = "global") {
1252
1292
  if (!t)
1253
1293
  throw new Error("Empty action type");
1254
1294
  if (typeof t != "string")
1255
1295
  throw new Error(`Invalid action type: ${JSON.stringify(t)}`);
1256
1296
  const a = { type: t, input: e, scope: o };
1257
- i && (a.attachments = i);
1297
+ n && (a.attachments = n);
1258
1298
  try {
1259
- n == null || n().parse(a.input);
1299
+ i == null || i().parse(a.input);
1260
1300
  } catch (r) {
1261
1301
  throw new Error(`Invalid action input: ${r}`);
1262
1302
  }
1263
1303
  return a;
1264
1304
  }
1265
- function Qe(t, e = te) {
1266
- return (i, n, o, a) => e(i, n, t, o, a);
1305
+ function pn(t, e = oe) {
1306
+ return (n, i, o, a) => e(n, i, t, o, a);
1267
1307
  }
1268
- const Ye = (t, e) => ({
1308
+ const cn = (t, e) => ({
1269
1309
  name: "",
1270
1310
  documentType: "",
1271
1311
  revision: {
@@ -1277,51 +1317,51 @@ const Ye = (t, e) => ({
1277
1317
  attachments: {},
1278
1318
  ...t,
1279
1319
  state: (e == null ? void 0 : e(t == null ? void 0 : t.state)) ?? (t == null ? void 0 : t.state) ?? { global: {}, local: {} }
1280
- }), ti = (t, e) => {
1281
- const i = Ye(
1320
+ }), ln = (t, e) => {
1321
+ const n = cn(
1282
1322
  t,
1283
1323
  e
1284
1324
  );
1285
1325
  return {
1286
- ...i,
1287
- initialState: i,
1326
+ ...n,
1327
+ initialState: n,
1288
1328
  operations: { global: [], local: [] },
1289
1329
  clipboard: []
1290
1330
  };
1291
- }, jt = (t, e = "global") => lt(K(t.state[e] || "")), xi = (t, e = 1e3) => {
1292
- const i = Math.random() * e;
1293
- return lt(`${(t ?? /* @__PURE__ */ new Date()).toISOString()}${i}`);
1331
+ }, $t = (t, e = "global") => ut(W(t.state[e] || "")), kn = (t, e = 1e3) => {
1332
+ const n = Math.random() * e;
1333
+ return ut(`${(t ?? /* @__PURE__ */ new Date()).toISOString()}${n}`);
1294
1334
  };
1295
- function rt(t) {
1296
- return me(ue(t, !0));
1335
+ function pt(t) {
1336
+ return ge(he(t, !0));
1297
1337
  }
1298
- function yi(t, e) {
1299
- const i = [...t];
1300
- let n = e || 0, o = i.length > 0 ? i[i.length - 1].index : 0;
1338
+ function Tn(t, e) {
1339
+ const n = [...t];
1340
+ let i = e || 0, o = n.length > 0 ? n[n.length - 1].index : 0;
1301
1341
  const a = [];
1302
- for (const r of i.reverse()) {
1303
- if (n > 0) {
1304
- const d = o - r.index;
1305
- n -= d;
1342
+ for (const r of n.reverse()) {
1343
+ if (i > 0) {
1344
+ const u = o - r.index;
1345
+ i -= u;
1306
1346
  }
1307
- if (n < 0)
1347
+ if (i < 0)
1308
1348
  throw new Error("Invalid operation index, missing operations");
1309
1349
  const p = {
1310
- ignore: n > 0,
1350
+ ignore: i > 0,
1311
1351
  operation: r
1312
1352
  }, m = r.skip > 0 ? r.skip + 1 : 0;
1313
- if (m > 0 && m > n) {
1314
- const d = m - n;
1315
- n = n + d;
1353
+ if (m > 0 && m > i) {
1354
+ const u = m - i;
1355
+ i = i + u;
1316
1356
  }
1317
1357
  o = r.index, a.push(p);
1318
1358
  }
1319
1359
  return a.reverse();
1320
1360
  }
1321
- function bi(t, e, i) {
1322
- const n = t.slice().sort((p, m) => p.skip - m.skip).sort((p, m) => p.index - m.index);
1323
- let o = i, a = 0, r = e;
1324
- for (const p of n.reverse()) {
1361
+ function _n(t, e, n) {
1362
+ const i = t.slice().sort((p, m) => p.skip - m.skip).sort((p, m) => p.index - m.index);
1363
+ let o = n, a = 0, r = e;
1364
+ for (const p of i.reverse()) {
1325
1365
  const m = r - p.index;
1326
1366
  if (o = o - m, o > -1)
1327
1367
  a++, r = p.index;
@@ -1330,33 +1370,33 @@ function bi(t, e, i) {
1330
1370
  }
1331
1371
  return a;
1332
1372
  }
1333
- function wi(t) {
1373
+ function vn(t) {
1334
1374
  return Object.values(t).flatMap((e) => e).sort(
1335
- (e, i) => new Date(e.timestamp).getTime() - new Date(i.timestamp).getTime()
1375
+ (e, n) => new Date(e.timestamp).getTime() - new Date(n.timestamp).getTime()
1336
1376
  );
1337
1377
  }
1338
- function Oi(t) {
1378
+ function In(t) {
1339
1379
  return Object.values(t).flatMap((e) => e).sort(
1340
- (e, i) => new Date(e.operation.timestamp).getTime() - new Date(i.operation.timestamp).getTime()
1380
+ (e, n) => new Date(e.operation.timestamp).getTime() - new Date(n.operation.timestamp).getTime()
1341
1381
  );
1342
1382
  }
1343
- function gt(t, e, i, n, o, a = te, r = {}, p) {
1344
- const m = Qe(i, a);
1345
- return ee(
1383
+ function xt(t, e, n, i, o, a = oe, r = {}, p) {
1384
+ const m = pn(n, a);
1385
+ return se(
1346
1386
  t,
1347
1387
  e,
1348
1388
  m,
1349
- n,
1389
+ i,
1350
1390
  o,
1351
1391
  r,
1352
1392
  p
1353
1393
  );
1354
1394
  }
1355
- function ee(t, e, i, n, o, a = {}, r) {
1395
+ function se(t, e, n, i, o, a = {}, r) {
1356
1396
  const {
1357
1397
  checkHashes: p = !0,
1358
1398
  reuseOperationResultingState: m,
1359
- operationResultingStateParser: d = ie
1399
+ operationResultingStateParser: u = re
1360
1400
  } = r || {};
1361
1401
  let h = t;
1362
1402
  const b = [], w = {
@@ -1365,18 +1405,18 @@ function ee(t, e, i, n, o, a = {}, r) {
1365
1405
  };
1366
1406
  if (m)
1367
1407
  for (const [c, l] of Object.entries(e)) {
1368
- const u = l.findLastIndex(
1408
+ const f = l.findLastIndex(
1369
1409
  (F) => !!F.resultingState
1370
1410
  );
1371
- if (u < 0) {
1411
+ if (f < 0) {
1372
1412
  b.push(...l);
1373
1413
  continue;
1374
1414
  }
1375
- const D = l[u];
1415
+ const k = l[f];
1376
1416
  try {
1377
- const F = d(
1417
+ const F = u(
1378
1418
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-unnecessary-type-assertion
1379
- D.resultingState
1419
+ k.resultingState
1380
1420
  );
1381
1421
  h = {
1382
1422
  ...h,
@@ -1386,67 +1426,67 @@ function ee(t, e, i, n, o, a = {}, r) {
1386
1426
  [c]: F
1387
1427
  }
1388
1428
  }, w[c].push(
1389
- ...l.slice(0, u + 1)
1390
- ), b.push(...l.slice(u + 1));
1429
+ ...l.slice(0, f + 1)
1430
+ ), b.push(...l.slice(f + 1));
1391
1431
  } catch {
1392
1432
  b.push(...l);
1393
1433
  }
1394
1434
  }
1395
1435
  else
1396
1436
  b.push(...Object.values(e).flat());
1397
- const N = ti(h);
1398
- N.initialState = t, N.operations = w;
1399
- let $ = N;
1437
+ const I = ln(h);
1438
+ I.initialState = t, I.operations = w;
1439
+ let $ = I;
1400
1440
  if (b.length)
1401
- $ = b.reduce((c, l) => i(c, l, n, {
1441
+ $ = b.reduce((c, l) => n(c, l, i, {
1402
1442
  skip: l.skip,
1403
1443
  ignoreSkipOperations: !0,
1404
1444
  reuseHash: !p
1405
- }), N);
1445
+ }), I);
1406
1446
  else
1407
1447
  for (const c of Object.values(w)) {
1408
1448
  const l = c.at(-1);
1409
- l && ($ = Yt($, l));
1449
+ l && ($ = ie($, l));
1410
1450
  }
1411
1451
  if (!p)
1412
1452
  for (const c of Object.keys($.state))
1413
1453
  for (let l = b.length - 1; l >= 0; l--) {
1414
- const u = b[l];
1415
- if (u.scope === c) {
1416
- if (u.hash !== jt($, c))
1454
+ const f = b[l];
1455
+ if (f.scope === c) {
1456
+ if (f.hash !== $t($, c))
1417
1457
  throw new Error(`Hash mismatch for scope ${c}`);
1418
1458
  break;
1419
1459
  }
1420
1460
  }
1421
- const P = Object.keys(
1461
+ const M = Object.keys(
1422
1462
  $.operations
1423
1463
  ).reduce(
1424
1464
  (c, l) => {
1425
- const u = l;
1465
+ const f = l;
1426
1466
  return {
1427
1467
  ...c,
1428
- [u]: [
1429
- ...$.operations[u].map((D, F) => {
1430
- var M;
1468
+ [f]: [
1469
+ ...$.operations[f].map((k, F) => {
1470
+ var R;
1431
1471
  return {
1432
- ...D,
1433
- timestamp: ((M = e[u][F]) == null ? void 0 : M.timestamp) ?? D.timestamp
1472
+ ...k,
1473
+ timestamp: ((R = e[f][F]) == null ? void 0 : R.timestamp) ?? k.timestamp
1434
1474
  };
1435
1475
  })
1436
1476
  ]
1437
1477
  };
1438
1478
  },
1439
1479
  { global: [], local: [] }
1440
- ), C = Object.values(P).reduce((c, l) => {
1441
- const u = l[l.length - 1];
1442
- return (u == null ? void 0 : u.timestamp) > c && (c = u.timestamp), c;
1480
+ ), C = Object.values(M).reduce((c, l) => {
1481
+ const f = l[l.length - 1];
1482
+ return (f == null ? void 0 : f.timestamp) > c && (c = f.timestamp), c;
1443
1483
  }, t.lastModified);
1444
- return { ...$, operations: P, lastModified: C };
1484
+ return { ...$, operations: M, lastModified: C };
1445
1485
  }
1446
- function Si(t, e) {
1447
- return K(t) === K(e);
1486
+ function Nn(t, e) {
1487
+ return W(t) === W(e);
1448
1488
  }
1449
- function ie(t) {
1489
+ function re(t) {
1450
1490
  const e = typeof t;
1451
1491
  if (e === "string")
1452
1492
  return JSON.parse(t);
@@ -1454,67 +1494,67 @@ function ie(t) {
1454
1494
  return t;
1455
1495
  throw new Error(`Providing resulting state is of type: ${e}`);
1456
1496
  }
1457
- const ne = (t) => W(
1497
+ const ae = (t) => G(
1458
1498
  "SET_NAME",
1459
1499
  t,
1460
1500
  void 0,
1461
- bt,
1501
+ Ot,
1462
1502
  void 0
1463
- ), oe = (t = 1, e = "global") => W(
1503
+ ), pe = (t = 1, e = "global") => G(
1464
1504
  "UNDO",
1465
1505
  t,
1466
1506
  void 0,
1467
- wt,
1507
+ St,
1468
1508
  e
1469
- ), se = (t = 1, e = "global") => W(
1509
+ ), ce = (t = 1, e = "global") => G(
1470
1510
  "REDO",
1471
1511
  t,
1472
1512
  void 0,
1473
- yt,
1513
+ wt,
1474
1514
  e
1475
- ), re = (t, e, i = "global") => W(
1515
+ ), le = (t, e, n = "global") => G(
1476
1516
  "PRUNE",
1477
1517
  { start: t, end: e },
1478
1518
  void 0,
1479
- xt,
1480
- i
1481
- ), Et = (t, e) => W(
1519
+ bt,
1520
+ n
1521
+ ), Dt = (t, e) => G(
1482
1522
  "LOAD_STATE",
1483
1523
  { state: t, operations: e },
1484
1524
  void 0,
1485
- ht
1486
- ), ae = (t = "global") => W("NOOP", {}, void 0, void 0, t), ji = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1525
+ yt
1526
+ ), me = (t = "global") => G("NOOP", {}, void 0, void 0, t), An = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1487
1527
  __proto__: null,
1488
- loadState: Et,
1489
- noop: ae,
1490
- prune: re,
1491
- redo: se,
1492
- setName: ne,
1493
- undo: oe
1528
+ loadState: Dt,
1529
+ noop: me,
1530
+ prune: le,
1531
+ redo: ce,
1532
+ setName: ae,
1533
+ undo: pe
1494
1534
  }, Symbol.toStringTag, { value: "Module" }));
1495
- class Ei {
1535
+ class Pn {
1496
1536
  /**
1497
1537
  * Constructs a BaseDocument instance with an initial state.
1498
1538
  * @param reducer - The reducer function that updates the state.
1499
1539
  * @param document - The initial state of the document.
1500
1540
  */
1501
- constructor(e, i, n) {
1502
- st(this, "_document");
1503
- st(this, "_reducer");
1504
- st(this, "_signalDispatch");
1505
- this._reducer = e, this._document = i, this._signalDispatch = n;
1541
+ constructor(e, n, i) {
1542
+ rt(this, "_document");
1543
+ rt(this, "_reducer");
1544
+ rt(this, "_signalDispatch");
1545
+ this._reducer = e, this._document = n, this._signalDispatch = i;
1506
1546
  }
1507
1547
  /**
1508
1548
  * Dispatches an action to update the state of the document.
1509
1549
  * @param action - The action to dispatch.
1510
1550
  * @returns The Document instance.
1511
1551
  */
1512
- dispatch(e, i) {
1552
+ dispatch(e, n) {
1513
1553
  return this._document = this._reducer(
1514
1554
  this._document,
1515
1555
  e,
1516
1556
  this._signalDispatch,
1517
- i
1557
+ n
1518
1558
  ), this;
1519
1559
  }
1520
1560
  /**
@@ -1523,15 +1563,15 @@ class Ei {
1523
1563
  * @param extension - The file extension to use when saving the state.
1524
1564
  * @returns The file path where the state was saved.
1525
1565
  */
1526
- saveToFile(e, i, n) {
1527
- return Me(this._document, e, i, n);
1566
+ saveToFile(e, n, i) {
1567
+ return Ve(this._document, e, n, i);
1528
1568
  }
1529
1569
  /**
1530
1570
  * Loads the state of the document from a file.
1531
1571
  * @param path - The file path where the state is stored.
1532
1572
  */
1533
1573
  async loadFromFile(e) {
1534
- this._document = await $t(e, this._reducer);
1574
+ this._document = await Tt(e, this._reducer);
1535
1575
  }
1536
1576
  /**
1537
1577
  * Loads the state of the document from a file and returns it.
@@ -1539,20 +1579,20 @@ class Ei {
1539
1579
  * @param reducer - The reducer function that updates the state.
1540
1580
  * @returns The state of the document.
1541
1581
  */
1542
- static async stateFromFile(e, i) {
1543
- return await $t(e, i);
1582
+ static async stateFromFile(e, n) {
1583
+ return await Tt(e, n);
1544
1584
  }
1545
1585
  /**
1546
1586
  * Gets the current state of the document.
1547
1587
  */
1548
1588
  get state() {
1549
- return rt(this._document.state);
1589
+ return pt(this._document.state);
1550
1590
  }
1551
1591
  /**
1552
1592
  * Gets the list of operations performed on the document.
1553
1593
  */
1554
1594
  get operations() {
1555
- return rt(this._document.operations);
1595
+ return pt(this._document.operations);
1556
1596
  }
1557
1597
  /**
1558
1598
  * Gets the name of the document.
@@ -1591,13 +1631,13 @@ class Ei {
1591
1631
  * Gets the initial state of the document.
1592
1632
  */
1593
1633
  get initialState() {
1594
- return rt(this._document.initialState);
1634
+ return pt(this._document.initialState);
1595
1635
  }
1596
1636
  /**
1597
1637
  * Returns the current document as an object
1598
1638
  */
1599
1639
  toDocument() {
1600
- return rt(this._document);
1640
+ return pt(this._document);
1601
1641
  }
1602
1642
  /**
1603
1643
  * Gets the attachment associated with the given key.
@@ -1611,86 +1651,86 @@ class Ei {
1611
1651
  * @param name - The new name of the document.
1612
1652
  */
1613
1653
  setName(e) {
1614
- return this.dispatch(ne(e)), this;
1654
+ return this.dispatch(ae(e)), this;
1615
1655
  }
1616
1656
  /**
1617
1657
  * Reverts a number of actions from the document.
1618
1658
  * @param count - The number of actions to revert.
1619
1659
  */
1620
1660
  undo(e) {
1621
- return this.dispatch(oe(e)), this;
1661
+ return this.dispatch(pe(e)), this;
1622
1662
  }
1623
1663
  /**
1624
1664
  * Reapplies a number of actions to the document.
1625
1665
  * @param count - The number of actions to reapply.
1626
1666
  */
1627
1667
  redo(e) {
1628
- return this.dispatch(se(e)), this;
1668
+ return this.dispatch(ce(e)), this;
1629
1669
  }
1630
1670
  /**
1631
1671
  * Removes a range of operations from the document.
1632
1672
  * @param start - The starting index of the range to remove.
1633
1673
  * @param end - The ending index of the range to remove.
1634
1674
  */
1635
- prune(e, i) {
1636
- return this.dispatch(re(e, i)), this;
1675
+ prune(e, n) {
1676
+ return this.dispatch(le(e, n)), this;
1637
1677
  }
1638
1678
  /**
1639
1679
  * Loads a document state and a set of operations.
1640
1680
  * @param state - The state to load.
1641
1681
  * @param operations - The operations to apply to the document.
1642
1682
  */
1643
- loadState(e, i) {
1644
- return this.dispatch(Et(e, i)), this;
1683
+ loadState(e, n) {
1684
+ return this.dispatch(Dt(e, n)), this;
1645
1685
  }
1646
1686
  }
1647
- function $i(t, e) {
1648
- e.forEach((i) => {
1649
- Object.getOwnPropertyNames(i.prototype).forEach((n) => {
1687
+ function Mn(t, e) {
1688
+ e.forEach((n) => {
1689
+ Object.getOwnPropertyNames(n.prototype).forEach((i) => {
1650
1690
  Object.defineProperty(
1651
1691
  // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
1652
1692
  t.prototype,
1653
- n,
1693
+ i,
1654
1694
  // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access
1655
- Object.getOwnPropertyDescriptor(i.prototype, n) || /* @__PURE__ */ Object.create(null)
1695
+ Object.getOwnPropertyDescriptor(n.prototype, i) || /* @__PURE__ */ Object.create(null)
1656
1696
  );
1657
1697
  });
1658
1698
  });
1659
1699
  }
1660
1700
  export {
1661
- Oi as A,
1662
- Ei as B,
1663
- wi as C,
1664
- Pe as D,
1665
- te as E,
1666
- di as F,
1667
- We as G,
1668
- Yt as H,
1669
- ci as I,
1670
- Ye as a,
1671
- ti as b,
1672
- Qe as c,
1673
- li as d,
1674
- ze as e,
1675
- W as f,
1676
- $i as g,
1677
- ji as h,
1678
- kt as i,
1679
- bi as j,
1680
- Ht as k,
1681
- $t as l,
1682
- fi as m,
1683
- ui as n,
1684
- mi as o,
1685
- jt as p,
1686
- xi as q,
1687
- gi as r,
1688
- Me as s,
1689
- Si as t,
1690
- hi as u,
1691
- yi as v,
1692
- ie as w,
1693
- rt as x,
1694
- ee as y,
1695
- gt as z
1701
+ In as A,
1702
+ Pn as B,
1703
+ vn as C,
1704
+ Je as D,
1705
+ oe as E,
1706
+ En as F,
1707
+ sn as G,
1708
+ ie as H,
1709
+ bn as I,
1710
+ cn as a,
1711
+ ln as b,
1712
+ pn as c,
1713
+ wn as d,
1714
+ He as e,
1715
+ G as f,
1716
+ Mn as g,
1717
+ An as h,
1718
+ _t as i,
1719
+ _n as j,
1720
+ Kt as k,
1721
+ Tt as l,
1722
+ jn as m,
1723
+ Sn as n,
1724
+ On as o,
1725
+ $t as p,
1726
+ kn as q,
1727
+ $n as r,
1728
+ Ve as s,
1729
+ Nn as t,
1730
+ Dn as u,
1731
+ Tn as v,
1732
+ re as w,
1733
+ pt as x,
1734
+ se as y,
1735
+ xt as z
1696
1736
  };