document-model 1.0.24 → 1.0.25

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 (128) hide show
  1. package/dist/browser/document-model.cjs +1 -1
  2. package/dist/browser/document-model.js +3 -3
  3. package/dist/browser/document.cjs +1 -1
  4. package/dist/browser/document.js +7 -6
  5. package/dist/browser/index.cjs +1 -1
  6. package/dist/browser/index.js +4 -4
  7. package/dist/browser/internal/{index-Xpydy6AU.js → index-3haD_DrE.js} +1 -1
  8. package/dist/browser/internal/index-7bSWIChK.js +38 -0
  9. package/dist/browser/internal/index-DQNkZhvL.js +1 -0
  10. package/dist/browser/internal/{index-sfNIE5tQ.js → index-TAPWNyA9.js} +2 -2
  11. package/dist/browser/internal/object-1BuggAcr.js +6 -0
  12. package/dist/browser/internal/object-jGU_rY7z.js +1895 -0
  13. package/dist/browser/src/document/actions/index.d.ts +3 -3
  14. package/dist/browser/src/document/object.d.ts +63 -0
  15. package/dist/browser/src/document/reducer.d.ts +16 -0
  16. package/dist/browser/src/document/schema/types.d.ts +1 -0
  17. package/dist/browser/src/document/types.d.ts +9 -0
  18. package/dist/browser/src/document/utils/base.d.ts +7 -4
  19. package/dist/node/document-model.cjs +1 -1
  20. package/dist/node/document-model.js +3 -3
  21. package/dist/node/document.cjs +1 -1
  22. package/dist/node/document.js +8 -7
  23. package/dist/node/index.cjs +1 -1
  24. package/dist/node/index.js +4 -4
  25. package/dist/node/internal/index-FmPDtpIY.js +38 -0
  26. package/dist/node/internal/{index-sNi-u40H.js → index-GpOpKG2W.js} +2 -2
  27. package/dist/node/internal/index-lh4jt_0f.js +1 -0
  28. package/dist/node/internal/{index-PkGY1BML.js → index-pZl431ni.js} +1 -1
  29. package/dist/node/internal/{object-T2hpMYZ4.js → object-evJm9vYN.js} +475 -411
  30. package/dist/node/internal/object-pZF_UDWv.js +1 -0
  31. package/dist/node/src/document/actions/index.d.ts +3 -3
  32. package/dist/node/src/document/object.d.ts +63 -0
  33. package/dist/node/src/document/reducer.d.ts +16 -0
  34. package/dist/node/src/document/schema/types.d.ts +1 -0
  35. package/dist/node/src/document/types.d.ts +9 -0
  36. package/dist/node/src/document/utils/base.d.ts +7 -4
  37. package/package.json +1 -1
  38. package/dist/browser/internal/index-e4O5HJBs.js +0 -1
  39. package/dist/browser/internal/index-v3lMuqpK.js +0 -36
  40. package/dist/browser/internal/object-U8CbkcSV.js +0 -6
  41. package/dist/browser/internal/object-YlWt1S0J.js +0 -1831
  42. package/dist/jest.config.d.ts +0 -8
  43. package/dist/node/internal/index-HgkfWSZk.js +0 -36
  44. package/dist/node/internal/index-aihhQ-ya.js +0 -1
  45. package/dist/node/internal/object-Nz1iEXFy.js +0 -1
  46. package/dist/node/test/document/redo.test.d.ts +0 -1
  47. package/dist/node/test/document/undo.test.d.ts +0 -1
  48. package/dist/src/document/actions/creators.d.ts +0 -47
  49. package/dist/src/document/actions/index.d.ts +0 -10
  50. package/dist/src/document/actions/types.d.ts +0 -8
  51. package/dist/src/document/index.d.ts +0 -6
  52. package/dist/src/document/object.d.ts +0 -447
  53. package/dist/src/document/reducer.d.ts +0 -16
  54. package/dist/src/document/schema/index.d.ts +0 -2
  55. package/dist/src/document/schema/types.d.ts +0 -180
  56. package/dist/src/document/schema/zod.d.ts +0 -113
  57. package/dist/src/document/signal.d.ts +0 -28
  58. package/dist/src/document/types.d.ts +0 -201
  59. package/dist/src/document/utils/base.d.ts +0 -74
  60. package/dist/src/document/utils/browser.d.ts +0 -10
  61. package/dist/src/document/utils/file.d.ts +0 -47
  62. package/dist/src/document/utils/index.d.ts +0 -2
  63. package/dist/src/document/utils/node.d.ts +0 -9
  64. package/dist/src/document-model/custom/reducers/header.d.ts +0 -2
  65. package/dist/src/document-model/custom/reducers/module.d.ts +0 -2
  66. package/dist/src/document-model/custom/reducers/operation-error.d.ts +0 -2
  67. package/dist/src/document-model/custom/reducers/operation-example.d.ts +0 -2
  68. package/dist/src/document-model/custom/reducers/operation.d.ts +0 -2
  69. package/dist/src/document-model/custom/reducers/state.d.ts +0 -2
  70. package/dist/src/document-model/custom/reducers/versioning.d.ts +0 -7
  71. package/dist/src/document-model/custom/utils.d.ts +0 -1
  72. package/dist/src/document-model/gen/actions.d.ts +0 -15
  73. package/dist/src/document-model/gen/creators.d.ts +0 -7
  74. package/dist/src/document-model/gen/document-model.d.ts +0 -2
  75. package/dist/src/document-model/gen/header/actions.d.ts +0 -9
  76. package/dist/src/document-model/gen/header/creators.d.ts +0 -8
  77. package/dist/src/document-model/gen/header/object.d.ts +0 -12
  78. package/dist/src/document-model/gen/header/operations.d.ts +0 -10
  79. package/dist/src/document-model/gen/index.d.ts +0 -5
  80. package/dist/src/document-model/gen/module/actions.d.ts +0 -8
  81. package/dist/src/document-model/gen/module/creators.d.ts +0 -7
  82. package/dist/src/document-model/gen/module/object.d.ts +0 -11
  83. package/dist/src/document-model/gen/module/operations.d.ts +0 -9
  84. package/dist/src/document-model/gen/object.d.ts +0 -28
  85. package/dist/src/document-model/gen/operation/actions.d.ts +0 -13
  86. package/dist/src/document-model/gen/operation/creators.d.ts +0 -12
  87. package/dist/src/document-model/gen/operation/object.d.ts +0 -16
  88. package/dist/src/document-model/gen/operation/operations.d.ts +0 -14
  89. package/dist/src/document-model/gen/operation-error/actions.d.ts +0 -10
  90. package/dist/src/document-model/gen/operation-error/creators.d.ts +0 -9
  91. package/dist/src/document-model/gen/operation-error/object.d.ts +0 -13
  92. package/dist/src/document-model/gen/operation-error/operations.d.ts +0 -11
  93. package/dist/src/document-model/gen/operation-example/actions.d.ts +0 -7
  94. package/dist/src/document-model/gen/operation-example/creators.d.ts +0 -6
  95. package/dist/src/document-model/gen/operation-example/object.d.ts +0 -10
  96. package/dist/src/document-model/gen/operation-example/operations.d.ts +0 -8
  97. package/dist/src/document-model/gen/reducer.d.ts +0 -5
  98. package/dist/src/document-model/gen/schema/index.d.ts +0 -2
  99. package/dist/src/document-model/gen/schema/types.d.ts +0 -453
  100. package/dist/src/document-model/gen/schema/zod.d.ts +0 -453
  101. package/dist/src/document-model/gen/state/actions.d.ts +0 -9
  102. package/dist/src/document-model/gen/state/creators.d.ts +0 -8
  103. package/dist/src/document-model/gen/state/object.d.ts +0 -12
  104. package/dist/src/document-model/gen/state/operations.d.ts +0 -10
  105. package/dist/src/document-model/gen/types.d.ts +0 -8
  106. package/dist/src/document-model/gen/utils.d.ts +0 -6
  107. package/dist/src/document-model/gen/versioning/actions.d.ts +0 -8
  108. package/dist/src/document-model/gen/versioning/creators.d.ts +0 -7
  109. package/dist/src/document-model/gen/versioning/object.d.ts +0 -11
  110. package/dist/src/document-model/gen/versioning/operations.d.ts +0 -9
  111. package/dist/src/document-model/index.d.ts +0 -75
  112. package/dist/src/index.d.ts +0 -25
  113. package/dist/test/document/local.test.d.ts +0 -1
  114. package/dist/test/document/object.test.d.ts +0 -1
  115. package/dist/test/document/prune.test.d.ts +0 -1
  116. package/dist/test/document/redo.test.d.ts +0 -1
  117. package/dist/test/document/reducer.test.d.ts +0 -1
  118. package/dist/test/document/skip-operations.test.d.ts +0 -1
  119. package/dist/test/document/undo.test.d.ts +0 -1
  120. package/dist/test/document/utils.test.d.ts +0 -1
  121. package/dist/test/document-model/object.test.d.ts +0 -1
  122. package/dist/test/document-model/skip-operations.test.d.ts +0 -1
  123. package/dist/test/document-model/zip.test.d.ts +0 -1
  124. package/dist/test/helpers.d.ts +0 -32
  125. package/dist/vite.config.d.ts +0 -2
  126. package/dist/vitest.config.d.ts +0 -2
  127. /package/dist/browser/test/document/{redo.test.d.ts → undo-redo.test.d.ts} +0 -0
  128. /package/dist/{browser/test/document/undo.test.d.ts → node/test/document/undo-redo.test.d.ts} +0 -0
@@ -1,261 +1,283 @@
1
- var mt = Object.defineProperty;
2
- var ut = (t, e, i) => e in t ? mt(t, e, { enumerable: !0, configurable: !0, writable: !0, value: i }) : t[e] = i;
3
- var w = (t, e, i) => (ut(t, typeof e != "symbol" ? e + "" : e, i), i);
4
- import dt from "json-stringify-deterministic";
5
- import { produce as M, castDraft as xt, castImmutable as gt, freeze as ft } from "immer";
6
- import { z as o } from "zod";
7
- import R from "jszip";
8
- import ht from "crypto";
9
- import E from "fs";
10
- import vt from "https";
11
- import { join as bt } from "path";
12
- const L = (t) => t != null, yt = o.any().refine((t) => L(t)), U = o.enum(["LOAD_STATE"]), J = o.enum(["PRUNE"]), $ = o.enum(["REDO"]), C = o.enum(["SET_NAME"]), B = o.enum(["UNDO"]);
13
- function jt() {
14
- return o.object({
15
- __typename: o.literal("Action").optional(),
16
- type: o.string()
1
+ var xt = Object.defineProperty;
2
+ var ft = (t, e, i) => e in t ? xt(t, e, { enumerable: !0, configurable: !0, writable: !0, value: i }) : t[e] = i;
3
+ var j = (t, e, i) => (ft(t, typeof e != "symbol" ? e + "" : e, i), i);
4
+ import { produce as S, castDraft as D, castImmutable as gt, freeze as ht } from "immer";
5
+ import bt from "json-stringify-deterministic";
6
+ import { z as s } from "zod";
7
+ import $ from "jszip";
8
+ import vt from "crypto";
9
+ import N from "fs";
10
+ import yt from "https";
11
+ import { join as wt } from "path";
12
+ const J = (t) => t != null, jt = s.any().refine((t) => J(t)), B = s.enum(["LOAD_STATE"]), Z = s.enum(["PRUNE"]), H = s.enum(["REDO"]), K = s.enum(["SET_NAME"]), W = s.enum(["UNDO"]);
13
+ function Ot() {
14
+ return s.object({
15
+ __typename: s.literal("Action").optional(),
16
+ type: s.string()
17
17
  });
18
18
  }
19
- function g() {
20
- return o.literal("global").or(o.literal("local"));
19
+ function y() {
20
+ return s.literal("global").or(s.literal("local"));
21
21
  }
22
- function Z() {
23
- return o.union([
24
- H(),
25
- W(),
22
+ function V() {
23
+ return s.union([
26
24
  G(),
27
- Q(),
28
- V()
25
+ X(),
26
+ Y(),
27
+ tt(),
28
+ et()
29
29
  ]);
30
30
  }
31
- function wt() {
32
- return o.object({
33
- __typename: o.literal("DocumentFile").optional(),
34
- data: o.string(),
35
- extension: o.string().nullable(),
36
- fileName: o.string().nullable(),
37
- mimeType: o.string()
31
+ function St() {
32
+ return s.object({
33
+ __typename: s.literal("DocumentFile").optional(),
34
+ data: s.string(),
35
+ extension: s.string().nullable(),
36
+ fileName: s.string().nullable(),
37
+ mimeType: s.string()
38
38
  });
39
39
  }
40
- function H() {
41
- return o.object({
42
- input: o.lazy(() => N()),
43
- type: U,
44
- scope: g()
40
+ function G() {
41
+ return s.object({
42
+ input: s.lazy(() => T()),
43
+ type: B,
44
+ scope: y()
45
45
  });
46
46
  }
47
- function N() {
48
- return o.object({
49
- operations: o.number(),
50
- state: o.lazy(() => K())
47
+ function T() {
48
+ return s.object({
49
+ operations: s.number(),
50
+ state: s.lazy(() => Q())
51
51
  });
52
52
  }
53
- function K() {
54
- return o.object({
55
- data: o.unknown().nullish(),
56
- name: o.string()
53
+ function Q() {
54
+ return s.object({
55
+ data: s.unknown().nullish(),
56
+ name: s.string()
57
57
  });
58
58
  }
59
- function St() {
60
- return o.object({
61
- __typename: o.literal("Operation").optional(),
62
- hash: o.string(),
63
- index: o.number(),
64
- timestamp: o.string().datetime(),
65
- type: o.string()
59
+ function kt() {
60
+ return s.object({
61
+ __typename: s.literal("Operation").optional(),
62
+ hash: s.string(),
63
+ index: s.number(),
64
+ timestamp: s.string().datetime(),
65
+ type: s.string()
66
66
  });
67
67
  }
68
- function W() {
69
- return o.object({
70
- input: o.lazy(() => T()),
71
- type: J,
72
- scope: g()
68
+ function X() {
69
+ return s.object({
70
+ input: s.lazy(() => z()),
71
+ type: Z,
72
+ scope: y()
73
73
  });
74
74
  }
75
- function T() {
76
- return o.object({
77
- end: o.number().nullish(),
78
- start: o.number().nullish()
75
+ function z() {
76
+ return s.object({
77
+ end: s.number().nullish(),
78
+ start: s.number().nullish()
79
79
  });
80
80
  }
81
- const A = o.number;
82
- function G() {
83
- return o.object({
84
- input: A(),
85
- type: $,
86
- scope: g()
81
+ const I = s.number;
82
+ function Y() {
83
+ return s.object({
84
+ input: I(),
85
+ type: H,
86
+ scope: y()
87
87
  });
88
88
  }
89
- const z = o.string;
90
- function Q() {
91
- return o.object({
92
- input: z(),
93
- type: C,
94
- scope: o.literal("global")
89
+ const F = s.string;
90
+ function tt() {
91
+ return s.object({
92
+ input: F(),
93
+ type: K,
94
+ scope: s.literal("global")
95
95
  });
96
96
  }
97
- function Ot() {
98
- return o.object({
99
- __typename: o.literal("SetNameOperation").optional(),
100
- hash: o.string(),
101
- index: o.number(),
102
- input: o.string(),
103
- timestamp: o.string().datetime(),
104
- type: o.string()
97
+ function _t() {
98
+ return s.object({
99
+ __typename: s.literal("SetNameOperation").optional(),
100
+ hash: s.string(),
101
+ index: s.number(),
102
+ input: s.string(),
103
+ timestamp: s.string().datetime(),
104
+ type: s.string()
105
105
  });
106
106
  }
107
- const F = o.number;
108
- function V() {
109
- return o.object({
110
- input: F(),
111
- type: B,
112
- scope: g()
107
+ const R = s.number;
108
+ function et() {
109
+ return s.object({
110
+ input: R(),
111
+ type: W,
112
+ scope: y()
113
113
  });
114
114
  }
115
- const pe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
115
+ const re = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
116
116
  __proto__: null,
117
- ActionSchema: jt,
118
- BaseActionSchema: Z,
119
- DocumentFileSchema: wt,
120
- LoadStateActionInputSchema: N,
121
- LoadStateActionSchema: H,
122
- LoadStateActionStateInputSchema: K,
123
- Load_StateSchema: U,
124
- OperationSchema: St,
125
- OperationScopeSchema: g,
126
- PruneActionInputSchema: T,
127
- PruneActionSchema: W,
128
- PruneSchema: J,
129
- RedoActionInputSchema: A,
130
- RedoActionSchema: G,
131
- RedoSchema: $,
132
- SetNameActionInputSchema: z,
133
- SetNameActionSchema: Q,
134
- SetNameOperationSchema: Ot,
135
- Set_NameSchema: C,
136
- UndoActionInputSchema: F,
137
- UndoActionSchema: V,
138
- UndoSchema: B,
139
- definedNonNullAnySchema: yt,
140
- isDefinedNonNullAny: L
117
+ ActionSchema: Ot,
118
+ BaseActionSchema: V,
119
+ DocumentFileSchema: St,
120
+ LoadStateActionInputSchema: T,
121
+ LoadStateActionSchema: G,
122
+ LoadStateActionStateInputSchema: Q,
123
+ Load_StateSchema: B,
124
+ OperationSchema: kt,
125
+ OperationScopeSchema: y,
126
+ PruneActionInputSchema: z,
127
+ PruneActionSchema: X,
128
+ PruneSchema: Z,
129
+ RedoActionInputSchema: I,
130
+ RedoActionSchema: Y,
131
+ RedoSchema: H,
132
+ SetNameActionInputSchema: F,
133
+ SetNameActionSchema: tt,
134
+ SetNameOperationSchema: _t,
135
+ Set_NameSchema: K,
136
+ UndoActionInputSchema: R,
137
+ UndoActionSchema: et,
138
+ UndoSchema: W,
139
+ definedNonNullAnySchema: jt,
140
+ isDefinedNonNullAny: J
141
141
  }, Symbol.toStringTag, { value: "Module" }));
142
- function _t(t, e) {
142
+ function Et(t, e) {
143
143
  return { ...t, name: e };
144
144
  }
145
- function kt(t, e, i) {
146
- const { scope: a, input: n } = e, s = t.revision[e.scope], p = Math.min(n, s), l = t.operations[a].slice(
147
- 0,
148
- s - p
149
- );
150
- return {
151
- ...O(
152
- t.initialState,
153
- {
154
- ...t.operations,
155
- [a]: l
156
- },
157
- i
158
- ),
159
- operations: t.operations,
160
- revision: {
161
- ...t.revision,
162
- [a]: t.revision[a] - p
163
- }
164
- };
165
- }
166
145
  function Dt(t, e, i) {
167
- const { scope: a, input: n } = e, s = t.operations[a].length - t.revision[a];
168
- if (!s)
169
- throw new Error("There is no UNDO operation to REDO");
170
- const p = n < s ? n : s, l = t.operations[a].slice(
171
- 0,
172
- t.revision[a] + p
173
- );
174
- return {
175
- ...O(
176
- t.initialState,
177
- {
178
- ...t.operations,
179
- [a]: l
180
- },
181
- i
182
- ),
183
- operations: t.operations,
184
- revision: {
185
- ...t.revision,
186
- [a]: t.revision[a] + p
146
+ const { scope: a, input: n } = e;
147
+ return S({
148
+ document: t,
149
+ action: e,
150
+ skip: i
151
+ }, (o) => {
152
+ if (o.document.operations[a].length < 1)
153
+ throw new Error(
154
+ `Cannot undo: no operations in history for scope "${a}"`
155
+ );
156
+ if (n < 1)
157
+ throw new Error(
158
+ "Invalid UNDO action: input value must be greater than 0"
159
+ );
160
+ if (o.skip > 0)
161
+ throw new Error(
162
+ "Cannot undo: skip value from reducer cannot be used with UNDO action"
163
+ );
164
+ const [c] = o.document.operations[a].slice(-1), u = c.type === "NOOP" && c.skip > 0;
165
+ if (o.skip += n, u && (o.skip += c.skip, o.document.operations[a].pop()), o.document.operations[a].length < o.skip)
166
+ throw new Error(
167
+ "Cannot undo: you can't undo more operations than the ones in the scope history"
168
+ );
169
+ const l = o.document.operations[a].length - 1;
170
+ let x = n, m = u ? l - c.skip : l;
171
+ for (; x > 0 && m >= 0; ) {
172
+ const d = o.document.operations[a][m];
173
+ d.type === "NOOP" && d.skip > 0 ? (m = m - (d.skip + 1), o.skip += d.skip + 1) : (o.document.clipboard.push({ ...d }), x--, m--);
187
174
  }
188
- };
175
+ o.action = M(a);
176
+ });
177
+ }
178
+ function Nt(t, e, i) {
179
+ const { scope: a, input: n } = e;
180
+ return S({
181
+ document: t,
182
+ action: e,
183
+ skip: i
184
+ }, (o) => {
185
+ if (o.skip > 0)
186
+ throw new Error(
187
+ "Cannot redo: skip value from reducer cannot be used with REDO action"
188
+ );
189
+ if (n > 1)
190
+ throw new Error(
191
+ "Cannot redo: you can only redo one operation at a time"
192
+ );
193
+ if (n < 1)
194
+ throw new Error("Invalid REDO action: invalid redo input value");
195
+ if (o.document.clipboard.length < 1)
196
+ throw new Error("Cannot redo: no operations in the clipboard");
197
+ const c = o.document.clipboard.findLastIndex(
198
+ (l) => l.scope === a
199
+ );
200
+ if (c < 0)
201
+ throw new Error(
202
+ `Cannot redo: no operations in clipboard for scope "${a}"`
203
+ );
204
+ const u = o.document.clipboard.splice(c, 1)[0];
205
+ o.action = D({
206
+ type: u.type,
207
+ scope: u.scope,
208
+ input: u.input
209
+ });
210
+ });
189
211
  }
190
- function Et(t, e, i) {
212
+ function At(t, e, i) {
191
213
  const { scope: a } = e, n = t.operations[a];
192
214
  let {
193
- input: { start: s, end: p }
215
+ input: { start: p, end: o }
194
216
  } = e;
195
- s = s || 0, p = p || n.length;
196
- const l = n.slice(s, p), c = n.slice(0, s), m = n.slice(p), u = O(
217
+ p = p || 0, o = o || n.length;
218
+ const c = n.slice(p, o), u = n.slice(0, p), l = n.slice(o), x = A(
197
219
  t.initialState,
198
220
  {
199
221
  ...t.operations,
200
- [a]: c.concat(l)
222
+ [a]: u.concat(c)
201
223
  },
202
224
  i
203
- ), { name: d, state: r } = u, b = c.length, y = c.length ? c[c.length - 1].timestamp : m.length ? m[0].timestamp : (/* @__PURE__ */ new Date()).toISOString();
204
- return O(
225
+ ), { name: m, state: d } = x, r = u.length, v = u.length ? u[u.length - 1].timestamp : l.length ? l[0].timestamp : (/* @__PURE__ */ new Date()).toISOString();
226
+ return A(
205
227
  t.initialState,
206
228
  {
207
229
  ...t.operations,
208
230
  [a]: [
209
- ...c,
231
+ ...u,
210
232
  {
211
- ...I(
212
- { name: d, state: r },
213
- l.length
233
+ ...P(
234
+ { name: m, state: d },
235
+ c.length
214
236
  ),
215
- timestamp: y,
216
- index: b,
217
- hash: nt({ state: r }, "global")
237
+ timestamp: v,
238
+ index: r,
239
+ hash: ct({ state: d }, "global")
218
240
  },
219
- ...m.map((D, j) => ({
220
- ...D,
221
- index: b + j + 1
241
+ ...l.map((f, E) => ({
242
+ ...f,
243
+ index: r + E + 1
222
244
  }))
223
245
  ]
224
246
  },
225
247
  i
226
248
  );
227
249
  }
228
- function Nt(t, e) {
250
+ function Tt(t, e) {
229
251
  return {
230
252
  ...t,
231
253
  name: e.name,
232
254
  state: e.state ?? { global: {}, local: {} }
233
255
  };
234
256
  }
235
- const X = "SET_NAME", f = "UNDO", h = "REDO", v = "PRUNE", Y = "LOAD_STATE";
236
- function Tt(t) {
257
+ const it = "SET_NAME", g = "UNDO", h = "REDO", w = "PRUNE", at = "LOAD_STATE";
258
+ function zt(t) {
237
259
  return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
238
260
  }
239
- function _() {
261
+ function k() {
240
262
  this._types = /* @__PURE__ */ Object.create(null), this._extensions = /* @__PURE__ */ Object.create(null);
241
263
  for (let t = 0; t < arguments.length; t++)
242
264
  this.define(arguments[t]);
243
265
  this.define = this.define.bind(this), this.getType = this.getType.bind(this), this.getExtension = this.getExtension.bind(this);
244
266
  }
245
- _.prototype.define = function(t, e) {
267
+ k.prototype.define = function(t, e) {
246
268
  for (let i in t) {
247
269
  let a = t[i].map(function(n) {
248
270
  return n.toLowerCase();
249
271
  });
250
272
  i = i.toLowerCase();
251
273
  for (let n = 0; n < a.length; n++) {
252
- const s = a[n];
253
- if (s[0] !== "*") {
254
- if (!e && s in this._types)
274
+ const p = a[n];
275
+ if (p[0] !== "*") {
276
+ if (!e && p in this._types)
255
277
  throw new Error(
256
- 'Attempt to change mapping for "' + s + '" extension from "' + this._types[s] + '" to "' + i + '". Pass `force=true` to allow this, otherwise remove "' + s + '" from the list of extensions for "' + i + '".'
278
+ 'Attempt to change mapping for "' + p + '" extension from "' + this._types[p] + '" to "' + i + '". Pass `force=true` to allow this, otherwise remove "' + p + '" from the list of extensions for "' + i + '".'
257
279
  );
258
- this._types[s] = i;
280
+ this._types[p] = i;
259
281
  }
260
282
  }
261
283
  if (e || !this._extensions[i]) {
@@ -264,144 +286,144 @@ _.prototype.define = function(t, e) {
264
286
  }
265
287
  }
266
288
  };
267
- _.prototype.getType = function(t) {
289
+ k.prototype.getType = function(t) {
268
290
  t = String(t);
269
291
  let e = t.replace(/^.*[/\\]/, "").toLowerCase(), i = e.replace(/^.*\./, "").toLowerCase(), a = e.length < t.length;
270
292
  return (i.length < e.length - 1 || !a) && this._types[i] || null;
271
293
  };
272
- _.prototype.getExtension = function(t) {
294
+ k.prototype.getExtension = function(t) {
273
295
  return t = /^\s*([^;\s]*)/.test(t) && RegExp.$1, t && this._extensions[t.toLowerCase()] || null;
274
296
  };
275
- var At = _, zt = { "application/andrew-inset": ["ez"], "application/applixware": ["aw"], "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/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/cu-seeme": ["cu"], "application/dash+xml": ["mpd"], "application/davmount+xml": ["davmount"], "application/docbook+xml": ["dbk"], "application/dssc+der": ["dssc"], "application/dssc+xml": ["xdssc"], "application/ecmascript": ["es", "ecma"], "application/emma+xml": ["emma"], "application/emotionml+xml": ["emotionml"], "application/epub+zip": ["epub"], "application/exi": ["exi"], "application/express": ["exp"], "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", "mjs"], "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/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": ["mp4s", "m4p"], "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-signature": ["asc", "sig"], "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/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/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/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/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/avif": ["avif"], "image/bmp": ["bmp"], "image/cgm": ["cgm"], "image/dicom-rle": ["drle"], "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"], "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/mesh": ["msh", "mesh", "silo"], "model/mtl": ["mtl"], "model/obj": ["obj"], "model/step+xml": ["stpx"], "model/step+zip": ["stpz"], "model/step-xml+zip": ["stpxz"], "model/stl": ["stl"], "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/jsx": ["jsx"], "text/less": ["less"], "text/markdown": ["markdown", "md"], "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/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"] };
276
- let Ft = At;
277
- var It = new Ft(zt);
278
- const Mt = /* @__PURE__ */ Tt(It);
279
- function Pt(t, e, i) {
280
- const a = bt(t, e);
281
- return E.mkdirSync(t, { recursive: !0 }), new Promise((n, s) => {
297
+ var It = k, Ft = { "application/andrew-inset": ["ez"], "application/applixware": ["aw"], "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/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/cu-seeme": ["cu"], "application/dash+xml": ["mpd"], "application/davmount+xml": ["davmount"], "application/docbook+xml": ["dbk"], "application/dssc+der": ["dssc"], "application/dssc+xml": ["xdssc"], "application/ecmascript": ["es", "ecma"], "application/emma+xml": ["emma"], "application/emotionml+xml": ["emotionml"], "application/epub+zip": ["epub"], "application/exi": ["exi"], "application/express": ["exp"], "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", "mjs"], "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/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": ["mp4s", "m4p"], "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-signature": ["asc", "sig"], "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/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/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/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/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/avif": ["avif"], "image/bmp": ["bmp"], "image/cgm": ["cgm"], "image/dicom-rle": ["drle"], "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"], "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/mesh": ["msh", "mesh", "silo"], "model/mtl": ["mtl"], "model/obj": ["obj"], "model/step+xml": ["stpx"], "model/step+zip": ["stpz"], "model/step-xml+zip": ["stpxz"], "model/stl": ["stl"], "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/jsx": ["jsx"], "text/less": ["less"], "text/markdown": ["markdown", "md"], "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/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"] };
298
+ let Rt = It;
299
+ var Pt = new Rt(Ft);
300
+ const Mt = /* @__PURE__ */ zt(Pt);
301
+ function qt(t, e, i) {
302
+ const a = wt(t, e);
303
+ return N.mkdirSync(t, { recursive: !0 }), new Promise((n, p) => {
282
304
  try {
283
- E.writeFile(a, i, {}, (p) => {
284
- p ? s(p) : n(a);
305
+ N.writeFile(a, i, {}, (o) => {
306
+ o ? p(o) : n(a);
285
307
  });
286
- } catch (p) {
287
- s(p);
308
+ } catch (o) {
309
+ p(o);
288
310
  }
289
311
  });
290
312
  }
291
- function tt(t) {
292
- return E.readFileSync(t);
313
+ function nt(t) {
314
+ return N.readFileSync(t);
293
315
  }
294
- function qt(t) {
316
+ function Lt(t) {
295
317
  return new Promise((e, i) => {
296
- vt.get(t, (a) => {
297
- const n = [], s = a.headers["content-type"];
298
- a.on("data", (p) => {
299
- n.push(p);
318
+ yt.get(t, (a) => {
319
+ const n = [], p = a.headers["content-type"];
320
+ a.on("data", (o) => {
321
+ n.push(o);
300
322
  }), a.on("end", () => {
301
- e({ buffer: Buffer.concat(n), mimeType: s });
323
+ e({ buffer: Buffer.concat(n), mimeType: p });
302
324
  });
303
325
  }).on("error", (a) => {
304
326
  i(a);
305
327
  });
306
328
  });
307
329
  }
308
- const Rt = async (t) => tt(t), k = (t, e = "sha1") => ht.createHash(e).update(t).digest("base64"), et = async (t) => {
309
- const e = new R(), { name: i, revision: a, documentType: n, created: s, lastModified: p } = t, l = {
330
+ const Ut = async (t) => nt(t), _ = (t, e = "sha1") => vt.createHash(e).update(t).digest("base64"), ot = async (t) => {
331
+ const e = new $(), { name: i, revision: a, documentType: n, created: p, lastModified: o } = t, c = {
310
332
  name: i,
311
333
  revision: a,
312
334
  documentType: n,
313
- created: s,
314
- lastModified: p
335
+ created: p,
336
+ lastModified: o
315
337
  };
316
- return e.file("header.json", JSON.stringify(l, null, 2)), e.file(
338
+ return e.file("header.json", JSON.stringify(c, null, 2)), e.file(
317
339
  "state.json",
318
340
  JSON.stringify(t.initialState || {}, null, 2)
319
- ), e.file("operations.json", JSON.stringify(t.operations, null, 2)), Object.keys(t.attachments).forEach((m) => {
320
- const { data: u, ...d } = t.attachments[m];
321
- e.file(m, u, {
341
+ ), e.file("operations.json", JSON.stringify(t.operations, null, 2)), Object.keys(t.attachments).forEach((l) => {
342
+ const { data: x, ...m } = t.attachments[l];
343
+ e.file(l, x, {
322
344
  base64: !0,
323
345
  createFolders: !0,
324
- comment: JSON.stringify(d)
346
+ comment: JSON.stringify(m)
325
347
  });
326
348
  }), e;
327
- }, Lt = async (t, e, i, a) => {
328
- const s = await (await et(t)).generateAsync({
349
+ }, Ct = async (t, e, i, a) => {
350
+ const p = await (await ot(t)).generateAsync({
329
351
  type: "uint8array",
330
352
  streamFiles: !0
331
- }), p = a ?? t.name, l = `.${i}.zip`;
332
- return Pt(
353
+ }), o = a ?? t.name, c = `.${i}.zip`;
354
+ return qt(
333
355
  e,
334
- p.endsWith(l) ? p : `${p}${l}`,
335
- s
356
+ o.endsWith(c) ? o : `${o}${c}`,
357
+ p
336
358
  );
337
- }, le = async (t, e) => {
338
- const a = await (await et(t)).generateAsync({ type: "blob" }), n = await e.createWritable();
359
+ }, me = async (t, e) => {
360
+ const a = await (await ot(t)).generateAsync({ type: "blob" }), n = await e.createWritable();
339
361
  await n.write(a), await n.close();
340
- }, P = async (t, e) => {
341
- const i = tt(t);
342
- return Ut(i, e);
343
- }, Ut = async (t, e) => {
344
- const i = new R();
362
+ }, L = async (t, e) => {
363
+ const i = nt(t);
364
+ return $t(i, e);
365
+ }, $t = async (t, e) => {
366
+ const i = new $();
345
367
  return await i.loadAsync(t), Jt(i, e);
346
368
  };
347
369
  async function Jt(t, e) {
348
370
  const i = t.file("state.json");
349
371
  if (!i)
350
372
  throw new Error("Initial state not found");
351
- const a = await i.async("string"), n = JSON.parse(a), s = t.file("header.json");
352
- let p;
353
- s && (p = JSON.parse(await s.async("string")));
354
- const l = t.file("operations.json");
355
- if (!l)
373
+ const a = await i.async("string"), n = JSON.parse(a), p = t.file("header.json");
374
+ let o;
375
+ p && (o = JSON.parse(await p.async("string")));
376
+ const c = t.file("operations.json");
377
+ if (!c)
356
378
  throw new Error("Operations history not found");
357
- const c = JSON.parse(
358
- await l.async("string")
379
+ const u = JSON.parse(
380
+ await c.async("string")
359
381
  );
360
- let m = ot(
382
+ let l = lt(
361
383
  n,
362
- c,
384
+ u,
363
385
  e,
364
386
  void 0,
365
- p
387
+ o
366
388
  );
367
- return p && (m = {
368
- ...m,
369
- ...p
370
- }), m;
389
+ return o && (l = {
390
+ ...l,
391
+ ...o
392
+ }), l;
371
393
  }
372
- function it(t) {
394
+ function st(t) {
373
395
  const e = t.replace(/^.*\./, "") || void 0, i = t.replace(/^.*[/\\]/, "") || void 0;
374
396
  return { extension: e, fileName: i };
375
397
  }
376
- async function ce(t) {
377
- const { buffer: e, mimeType: i = "application/octet-stream" } = await qt(t), a = it(t), n = e.toString("base64");
398
+ async function ue(t) {
399
+ const { buffer: e, mimeType: i = "application/octet-stream" } = await Lt(t), a = st(t), n = e.toString("base64");
378
400
  return {
379
401
  data: n,
380
- hash: k(n),
402
+ hash: _(n),
381
403
  mimeType: i,
382
404
  ...a
383
405
  };
384
406
  }
385
- async function re(t) {
386
- const e = await Rt(t), i = Mt.getType(t) || "application/octet-stream", a = it(t), n = e.toString("base64");
387
- return { data: n, hash: k(n), mimeType: i, ...a };
407
+ async function de(t) {
408
+ const e = await Ut(t), i = Mt.getType(t) || "application/octet-stream", a = st(t), n = e.toString("base64");
409
+ return { data: n, hash: _(n), mimeType: i, ...a };
388
410
  }
389
- function $t(t, e) {
411
+ function Bt(t, e) {
390
412
  const i = t.revision[e.scope];
391
- return [f, h, v].includes(e.type) ? i : i + 1;
413
+ return [g, h, w].includes(e.type) ? i : i + 1;
392
414
  }
393
- function Ct(t, e) {
415
+ function Zt(t, e) {
394
416
  return {
395
417
  ...t,
396
418
  revision: {
397
419
  ...t.revision,
398
- [e.scope]: $t(t, e)
420
+ [e.scope]: Bt(t, e)
399
421
  },
400
422
  lastModified: (/* @__PURE__ */ new Date()).toISOString()
401
423
  };
402
424
  }
403
- function Bt(t, e, i = 0) {
404
- if ([f, h, v].includes(e.type))
425
+ function Ht(t, e, i = 0) {
426
+ if ([g, h, w].includes(e.type))
405
427
  return t;
406
428
  const { scope: a } = e, n = t.operations[a].slice(
407
429
  0,
@@ -419,71 +441,100 @@ function Bt(t, e, i = 0) {
419
441
  operations: { ...t.operations, [a]: n }
420
442
  };
421
443
  }
422
- function Zt(t, e, i = 0) {
423
- let a = Bt(t, e, i);
424
- return a = Ct(a, e), a;
444
+ function Kt(t, e, i = 0) {
445
+ let a = Ht(t, e, i);
446
+ return a = Zt(a, e), a;
447
+ }
448
+ function Wt(t, e, i) {
449
+ switch (V().parse(e), e.type) {
450
+ case it:
451
+ return Et(t, e.input);
452
+ case w:
453
+ return At(t, e, i);
454
+ case at:
455
+ return Tt(t, e.input.state);
456
+ default:
457
+ return t;
458
+ }
425
459
  }
426
- function Ht(t, e, i) {
427
- switch (Z().parse(e), e.type) {
428
- case X:
429
- return _t(t, e.input);
430
- case f:
431
- return kt(t, e, i);
432
- case h:
460
+ function Vt(t, e, i) {
461
+ switch (e.type) {
462
+ case g:
433
463
  return Dt(t, e, i);
434
- case v:
435
- return Et(t, e, i);
436
- case Y:
437
- return Nt(t, e.input.state);
464
+ case h:
465
+ return Nt(t, e, i);
438
466
  default:
439
- return t;
467
+ return { document: t, action: e, skip: i };
440
468
  }
441
469
  }
442
- function at(t, e, i, a, n = {}) {
443
- const {
444
- skip: s = 0
445
- } = n;
446
- let p = t;
447
- return q(e) && (p = Ht(p, e, i)), p = Zt(p, e, s), p = M(p, (l) => {
448
- const c = i(l.state, e, a);
449
- if (c)
450
- return xt({
451
- ...p,
452
- state: c
470
+ function pt(t, e, i, a, n = {}) {
471
+ const { skip: p, ignoreSkipOperations: o = !1 } = n;
472
+ let c = { ...e }, u = p || 0, l = t, x = [...t.clipboard];
473
+ if (U(c)) {
474
+ const {
475
+ skip: m,
476
+ action: d,
477
+ document: r
478
+ } = Vt(t, c, u);
479
+ c = d, u = m, l = r, x = [...l.clipboard];
480
+ }
481
+ return C(c) && (l = Wt(l, c, i)), u > 0 && !o && (l = A(
482
+ l.initialState,
483
+ l.operations,
484
+ i,
485
+ void 0,
486
+ void 0,
487
+ void 0,
488
+ { [c.scope]: u }
489
+ )), l = Kt(l, c, u), l = S(l, (m) => {
490
+ const d = i(
491
+ m.state,
492
+ c,
493
+ a
494
+ ), r = U(e) ? [...x] : [];
495
+ if (d)
496
+ return D({
497
+ ...l,
498
+ clipboard: [...r],
499
+ state: d
453
500
  });
454
- }), M(p, (l) => {
455
- if ([f, h, v].includes(e.type))
456
- return l;
457
- const c = e.scope || "global";
458
- l.operations[c][l.operations[c].length - 1].hash = nt(l, c), !q(e) && e.attachments && e.attachments.forEach((m) => {
459
- const { hash: u, ...d } = m;
460
- l.attachments[u] = {
461
- ...d
501
+ m.clipboard = D([...r]);
502
+ }), S(l, (m) => {
503
+ if ([g, h, w].includes(c.type))
504
+ return m;
505
+ const d = c.scope || "global";
506
+ m.operations[d][m.operations[d].length - 1].hash = ct(m, d), !C(c) && c.attachments && c.attachments.forEach((r) => {
507
+ const { hash: v, ...f } = r;
508
+ m.attachments[v] = {
509
+ ...f
462
510
  };
463
511
  });
464
512
  });
465
513
  }
466
- function q(t) {
467
- return [X, f, h, v, Y].includes(t.type);
514
+ function U(t) {
515
+ return [g, h].includes(t.type);
516
+ }
517
+ function C(t) {
518
+ return [it, g, h, w, at].includes(t.type);
468
519
  }
469
- function x(t, e, i, a, n = "global") {
520
+ function b(t, e, i, a, n = "global") {
470
521
  if (!t)
471
522
  throw new Error("Empty action type");
472
523
  if (typeof t != "string")
473
524
  throw new Error(`Invalid action type: ${t}`);
474
- const s = { type: t, input: e, scope: n };
475
- i && (s.attachments = i);
525
+ const p = { type: t, input: e, scope: n };
526
+ i && (p.attachments = i);
476
527
  try {
477
- a == null || a().parse(s.input);
478
- } catch (p) {
479
- throw new Error(`Invalid action input: ${p}`);
528
+ a == null || a().parse(p.input);
529
+ } catch (o) {
530
+ throw new Error(`Invalid action input: ${o}`);
480
531
  }
481
- return s;
532
+ return p;
482
533
  }
483
- function Kt(t, e = at) {
484
- return (i, a, n, s) => e(i, a, t, n, s);
534
+ function Gt(t, e = pt) {
535
+ return (i, a, n, p) => e(i, a, t, n, p);
485
536
  }
486
- const Wt = (t, e) => ({
537
+ const Qt = (t, e) => ({
487
538
  name: "",
488
539
  documentType: "",
489
540
  revision: {
@@ -495,160 +546,171 @@ const Wt = (t, e) => ({
495
546
  attachments: {},
496
547
  ...t,
497
548
  state: (e == null ? void 0 : e(t == null ? void 0 : t.state)) ?? (t == null ? void 0 : t.state) ?? { global: {}, local: {} }
498
- }), Gt = (t, e) => {
499
- const i = Wt(
549
+ }), Xt = (t, e) => {
550
+ const i = Qt(
500
551
  t,
501
552
  e
502
553
  );
503
554
  return {
504
555
  ...i,
505
556
  initialState: i,
506
- operations: { global: [], local: [] }
557
+ operations: { global: [], local: [] },
558
+ clipboard: []
507
559
  };
508
- }, nt = (t, e = "global") => k(dt(t.state[e])), me = (t, e = 1e3) => {
560
+ }, ct = (t, e = "global") => _(bt(t.state[e])), xe = (t, e = 1e3) => {
509
561
  const i = Math.random() * e;
510
- return k(`${(t ?? /* @__PURE__ */ new Date()).toISOString()}${i}`);
562
+ return _(`${(t ?? /* @__PURE__ */ new Date()).toISOString()}${i}`);
511
563
  };
512
- function S(t) {
513
- return gt(ft(t, !0));
514
- }
515
- function Qt(t) {
516
- const e = [...t];
517
- let i = 0, a = e.length > 0 ? e[e.length - 1].index : 0;
518
- const n = [];
519
- for (const s of e.reverse()) {
520
- if (i > 0) {
521
- const l = a - s.index;
522
- i -= l;
564
+ function O(t) {
565
+ return gt(ht(t, !0));
566
+ }
567
+ function Yt(t, e) {
568
+ const i = [...t];
569
+ let a = e || 0, n = i.length > 0 ? i[i.length - 1].index : 0;
570
+ const p = [];
571
+ for (const o of i.reverse()) {
572
+ if (a > 0) {
573
+ const l = n - o.index;
574
+ a -= l;
523
575
  }
524
- if (i < 0)
576
+ if (a < 0)
525
577
  throw new Error("Invalid operation index, missing operations");
526
- const p = {
527
- ignore: i > 0,
528
- operation: s
529
- };
530
- s.skip > 0 && (i = i + (s.skip + 1)), a = s.index, n.push(p);
578
+ const c = {
579
+ ignore: a > 0,
580
+ operation: o
581
+ }, u = o.skip > 0 ? o.skip + 1 : 0;
582
+ if (u > 0 && u > a) {
583
+ const l = u - a;
584
+ a = a + l;
585
+ }
586
+ n = o.index, p.push(c);
531
587
  }
532
- return n.reverse();
588
+ return p.reverse();
533
589
  }
534
- function ue(t) {
590
+ function fe(t) {
535
591
  return Object.values(t).flatMap((e) => e).sort(
536
592
  (e, i) => new Date(e.timestamp).getTime() - new Date(i.timestamp).getTime()
537
593
  );
538
594
  }
539
- function Vt(t) {
595
+ function te(t) {
540
596
  return Object.values(t).flatMap((e) => e).sort(
541
597
  (e, i) => new Date(e.operation.timestamp).getTime() - new Date(i.operation.timestamp).getTime()
542
598
  );
543
599
  }
544
- function O(t, e, i, a, n, s = at) {
545
- const p = Kt(i, s);
546
- return ot(
600
+ function A(t, e, i, a, n, p = pt, o = {}) {
601
+ const c = Gt(i, p);
602
+ return lt(
547
603
  t,
548
604
  e,
549
- p,
605
+ c,
550
606
  a,
551
- n
607
+ n,
608
+ o
552
609
  );
553
610
  }
554
- function ot(t, e, i, a, n) {
555
- const s = Gt(t), p = Object.keys(e).reduce((u, d) => {
611
+ function lt(t, e, i, a, n, p = {}) {
612
+ const o = Xt(t), c = Object.keys(e).reduce((m, d) => {
556
613
  const r = d;
557
614
  return {
558
- ...u,
615
+ ...m,
559
616
  [r]: e[r].slice(0, n == null ? void 0 : n.revision[r])
560
617
  };
561
- }, {}), l = Object.keys(p).reduce((u, d) => {
618
+ }, {}), u = Object.keys(c).reduce((m, d) => {
562
619
  const r = d;
563
620
  return {
564
- ...u,
565
- [r]: Qt(p[r])
621
+ ...m,
622
+ [r]: Yt(c[r], p[r])
566
623
  };
567
- }, {}), c = Vt(l).reduce(
568
- (u, { ignore: d, operation: r }) => d ? i(
569
- u,
570
- rt(r.scope),
624
+ }, {}), l = te(u).reduce(
625
+ (m, { ignore: d, operation: r }) => d ? i(
626
+ m,
627
+ M(r.scope),
628
+ a,
629
+ { skip: r.skip, ignoreSkipOperations: !0 }
630
+ ) : i(
631
+ m,
632
+ r,
571
633
  a,
572
- { skip: r.skip }
573
- ) : i(u, r, a),
574
- s
575
- ), m = Object.keys(
576
- c.operations
634
+ { skip: r.skip, ignoreSkipOperations: !0 }
635
+ ),
636
+ o
637
+ ), x = Object.keys(
638
+ l.operations
577
639
  ).reduce(
578
- (u, d) => {
579
- const r = d, b = n && n.revision[r] < e[r].length ? e[r].slice(n.revision[r]) : [];
640
+ (m, d) => {
641
+ const r = d, v = n && n.revision[r] < e[r].length ? e[r].slice(n.revision[r]) : [];
580
642
  return {
581
- ...u,
643
+ ...m,
582
644
  [r]: [
583
- ...c.operations[r].map((y, D) => {
584
- var j;
645
+ ...l.operations[r].map((f, E) => {
646
+ var q;
585
647
  return {
586
- ...y,
587
- timestamp: ((j = e[r][D]) == null ? void 0 : j.timestamp) ?? y.timestamp
648
+ ...f,
649
+ timestamp: ((q = e[r][E]) == null ? void 0 : q.timestamp) ?? f.timestamp
588
650
  };
589
651
  }),
590
- ...b
652
+ ...v
591
653
  ]
592
654
  };
593
655
  },
594
656
  { global: [], local: [] }
595
657
  );
596
- return { ...c, operations: m };
658
+ return { ...l, operations: x };
597
659
  }
598
- const st = (t) => x(
660
+ const rt = (t) => b(
599
661
  "SET_NAME",
600
662
  t,
601
663
  void 0,
602
- z,
664
+ F,
603
665
  void 0
604
- ), pt = (t = 1, e = "global") => x(
666
+ ), mt = (t = 1, e = "global") => b(
605
667
  "UNDO",
606
668
  t,
607
669
  void 0,
608
- F,
670
+ R,
609
671
  e
610
- ), lt = (t = 1, e = "global") => x(
672
+ ), ut = (t = 1, e = "global") => b(
611
673
  "REDO",
612
674
  t,
613
675
  void 0,
614
- A,
676
+ I,
615
677
  e
616
- ), ct = (t, e, i = "global") => x(
678
+ ), dt = (t, e, i = "global") => b(
617
679
  "PRUNE",
618
680
  { start: t, end: e },
619
681
  void 0,
620
- T,
682
+ z,
621
683
  i
622
- ), I = (t, e) => x(
684
+ ), P = (t, e) => b(
623
685
  "LOAD_STATE",
624
686
  { state: t, operations: e },
625
687
  void 0,
626
- N
627
- ), rt = (t = "global") => x(
688
+ T
689
+ ), M = (t = "global") => b(
628
690
  "NOOP",
629
691
  {},
630
692
  void 0,
631
693
  void 0,
632
694
  t
633
- ), de = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
695
+ ), ge = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
634
696
  __proto__: null,
635
- loadState: I,
636
- noop: rt,
637
- prune: ct,
638
- redo: lt,
639
- setName: st,
640
- undo: pt
697
+ loadState: P,
698
+ noop: M,
699
+ prune: dt,
700
+ redo: ut,
701
+ setName: rt,
702
+ undo: mt
641
703
  }, Symbol.toStringTag, { value: "Module" }));
642
- class xe {
704
+ class he {
643
705
  /**
644
706
  * Constructs a BaseDocument instance with an initial state.
645
707
  * @param reducer - The reducer function that updates the state.
646
708
  * @param document - The initial state of the document.
647
709
  */
648
710
  constructor(e, i, a) {
649
- w(this, "_document");
650
- w(this, "_reducer");
651
- w(this, "_signalDispatch");
711
+ j(this, "_document");
712
+ j(this, "_reducer");
713
+ j(this, "_signalDispatch");
652
714
  this._reducer = e, this._document = i, this._signalDispatch = a;
653
715
  }
654
716
  /**
@@ -671,14 +733,14 @@ class xe {
671
733
  * @returns The file path where the state was saved.
672
734
  */
673
735
  saveToFile(e, i, a) {
674
- return Lt(this._document, e, i, a);
736
+ return Ct(this._document, e, i, a);
675
737
  }
676
738
  /**
677
739
  * Loads the state of the document from a file.
678
740
  * @param path - The file path where the state is stored.
679
741
  */
680
742
  async loadFromFile(e) {
681
- this._document = await P(e, this._reducer);
743
+ this._document = await L(e, this._reducer);
682
744
  }
683
745
  /**
684
746
  * Loads the state of the document from a file and returns it.
@@ -687,19 +749,19 @@ class xe {
687
749
  * @returns The state of the document.
688
750
  */
689
751
  static async stateFromFile(e, i) {
690
- return await P(e, i);
752
+ return await L(e, i);
691
753
  }
692
754
  /**
693
755
  * Gets the current state of the document.
694
756
  */
695
757
  get state() {
696
- return S(this._document.state);
758
+ return O(this._document.state);
697
759
  }
698
760
  /**
699
761
  * Gets the list of operations performed on the document.
700
762
  */
701
763
  get operations() {
702
- return S(this._document.operations);
764
+ return O(this._document.operations);
703
765
  }
704
766
  /**
705
767
  * Gets the name of the document.
@@ -738,13 +800,13 @@ class xe {
738
800
  * Gets the initial state of the document.
739
801
  */
740
802
  get initialState() {
741
- return S(this._document.initialState);
803
+ return O(this._document.initialState);
742
804
  }
743
805
  /**
744
806
  * Returns the current document as an object
745
807
  */
746
808
  toDocument() {
747
- return S(this._document);
809
+ return O(this._document);
748
810
  }
749
811
  /**
750
812
  * Gets the attachment associated with the given key.
@@ -758,21 +820,21 @@ class xe {
758
820
  * @param name - The new name of the document.
759
821
  */
760
822
  setName(e) {
761
- return this.dispatch(st(e)), this;
823
+ return this.dispatch(rt(e)), this;
762
824
  }
763
825
  /**
764
826
  * Reverts a number of actions from the document.
765
827
  * @param count - The number of actions to revert.
766
828
  */
767
829
  undo(e) {
768
- return this.dispatch(pt(e)), this;
830
+ return this.dispatch(mt(e)), this;
769
831
  }
770
832
  /**
771
833
  * Reapplies a number of actions to the document.
772
834
  * @param count - The number of actions to reapply.
773
835
  */
774
836
  redo(e) {
775
- return this.dispatch(lt(e)), this;
837
+ return this.dispatch(ut(e)), this;
776
838
  }
777
839
  /**
778
840
  * Removes a range of operations from the document.
@@ -780,7 +842,7 @@ class xe {
780
842
  * @param end - The ending index of the range to remove.
781
843
  */
782
844
  prune(e, i) {
783
- return this.dispatch(ct(e, i)), this;
845
+ return this.dispatch(dt(e, i)), this;
784
846
  }
785
847
  /**
786
848
  * Loads a document state and a set of operations.
@@ -788,10 +850,10 @@ class xe {
788
850
  * @param operations - The operations to apply to the document.
789
851
  */
790
852
  loadState(e, i) {
791
- return this.dispatch(I(e, i)), this;
853
+ return this.dispatch(P(e, i)), this;
792
854
  }
793
855
  }
794
- function ge(t, e) {
856
+ function be(t, e) {
795
857
  e.forEach((i) => {
796
858
  Object.getOwnPropertyNames(i.prototype).forEach((a) => {
797
859
  Object.defineProperty(
@@ -805,29 +867,31 @@ function ge(t, e) {
805
867
  });
806
868
  }
807
869
  export {
808
- xe as B,
809
- Wt as a,
810
- Gt as b,
811
- Kt as c,
812
- le as d,
813
- Ut as e,
814
- x as f,
815
- ge as g,
816
- de as h,
817
- q as i,
818
- et as j,
819
- re as k,
820
- P as l,
821
- ce as m,
822
- nt as n,
823
- me as o,
824
- Qt as p,
825
- ot as q,
826
- S as r,
827
- Lt as s,
828
- O as t,
829
- Vt as u,
830
- ue as v,
831
- at as w,
832
- pe as z
870
+ he as B,
871
+ Qt as a,
872
+ Xt as b,
873
+ Gt as c,
874
+ me as d,
875
+ $t as e,
876
+ b as f,
877
+ be as g,
878
+ ge as h,
879
+ C as i,
880
+ ot as j,
881
+ de as k,
882
+ L as l,
883
+ ue as m,
884
+ ct as n,
885
+ xe as o,
886
+ U as p,
887
+ Yt as q,
888
+ O as r,
889
+ Ct as s,
890
+ lt as t,
891
+ A as u,
892
+ te as v,
893
+ fe as w,
894
+ pt as x,
895
+ Vt as y,
896
+ re as z
833
897
  };