document-model 1.0.25 → 1.0.26

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 (137) 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 +6 -7
  5. package/dist/browser/index.cjs +1 -1
  6. package/dist/browser/index.js +4 -4
  7. package/dist/browser/internal/{index-TAPWNyA9.js → index-IVF7gvRz.js} +17 -7
  8. package/dist/browser/internal/index-JkTAMqR0.js +36 -0
  9. package/dist/browser/internal/index-ZuT5Pi3Z.js +1 -0
  10. package/dist/browser/internal/{index-3haD_DrE.js → index-gREVUw-G.js} +1 -1
  11. package/dist/browser/internal/object-1Edh7roc.js +1844 -0
  12. package/dist/browser/internal/object-v0zgcnse.js +6 -0
  13. package/dist/browser/src/document/actions/index.d.ts +3 -3
  14. package/dist/browser/src/document/object.d.ts +0 -63
  15. package/dist/browser/src/document/reducer.d.ts +0 -16
  16. package/dist/browser/src/document/schema/index.d.ts +2 -2
  17. package/dist/browser/src/document/schema/types.d.ts +0 -1
  18. package/dist/browser/src/document/types.d.ts +0 -9
  19. package/dist/browser/src/document/utils/base.d.ts +4 -7
  20. package/dist/browser/src/document-model/custom/reducers/versioning.d.ts +4 -4
  21. package/dist/browser/vitest.config.d.ts +2 -0
  22. package/dist/node/document-model.cjs +1 -1
  23. package/dist/node/document-model.js +3 -3
  24. package/dist/node/document.cjs +1 -1
  25. package/dist/node/document.js +7 -8
  26. package/dist/node/index.cjs +1 -1
  27. package/dist/node/index.js +4 -4
  28. package/dist/node/internal/index-8_P5_maf.js +1 -0
  29. package/dist/node/internal/{index-GpOpKG2W.js → index-AWkBpPdl.js} +17 -7
  30. package/dist/node/internal/{index-pZl431ni.js → index-VzErJ06c.js} +1 -1
  31. package/dist/node/internal/index-y-8qoZvC.js +36 -0
  32. package/dist/node/internal/object-6KU11KDZ.js +843 -0
  33. package/dist/node/internal/object-YfG4E2oW.js +1 -0
  34. package/dist/node/src/document/actions/index.d.ts +3 -3
  35. package/dist/node/src/document/object.d.ts +0 -63
  36. package/dist/node/src/document/reducer.d.ts +0 -16
  37. package/dist/node/src/document/schema/index.d.ts +2 -2
  38. package/dist/node/src/document/schema/types.d.ts +0 -1
  39. package/dist/node/src/document/types.d.ts +0 -9
  40. package/dist/node/src/document/utils/base.d.ts +4 -7
  41. package/dist/node/src/document-model/custom/reducers/versioning.d.ts +4 -4
  42. package/dist/node/test/document/redo.test.d.ts +1 -0
  43. package/dist/node/test/document/undo.test.d.ts +1 -0
  44. package/dist/node/vitest.config.d.ts +2 -0
  45. package/dist/src/document/actions/creators.d.ts +47 -0
  46. package/dist/src/document/actions/index.d.ts +10 -0
  47. package/dist/src/document/actions/types.d.ts +8 -0
  48. package/dist/src/document/index.d.ts +6 -0
  49. package/dist/src/document/object.d.ts +510 -0
  50. package/dist/src/document/reducer.d.ts +32 -0
  51. package/dist/src/document/schema/index.d.ts +2 -0
  52. package/dist/src/document/schema/types.d.ts +177 -0
  53. package/dist/src/document/schema/zod.d.ts +113 -0
  54. package/dist/src/document/signal.d.ts +28 -0
  55. package/dist/src/document/types.d.ts +210 -0
  56. package/dist/src/document/utils/base.d.ts +77 -0
  57. package/dist/src/document/utils/browser.d.ts +10 -0
  58. package/dist/src/document/utils/file.d.ts +47 -0
  59. package/dist/src/document/utils/index.d.ts +3 -0
  60. package/dist/src/document/utils/node.d.ts +9 -0
  61. package/dist/src/document-model/custom/reducers/header.d.ts +2 -0
  62. package/dist/src/document-model/custom/reducers/module.d.ts +2 -0
  63. package/dist/src/document-model/custom/reducers/operation-error.d.ts +2 -0
  64. package/dist/src/document-model/custom/reducers/operation-example.d.ts +2 -0
  65. package/dist/src/document-model/custom/reducers/operation.d.ts +2 -0
  66. package/dist/src/document-model/custom/reducers/state.d.ts +2 -0
  67. package/dist/src/document-model/custom/reducers/versioning.d.ts +7 -0
  68. package/dist/src/document-model/custom/utils.d.ts +1 -0
  69. package/dist/src/document-model/gen/actions.d.ts +15 -0
  70. package/dist/src/document-model/gen/creators.d.ts +7 -0
  71. package/dist/src/document-model/gen/document-model.d.ts +2 -0
  72. package/dist/src/document-model/gen/header/actions.d.ts +9 -0
  73. package/dist/src/document-model/gen/header/creators.d.ts +8 -0
  74. package/dist/src/document-model/gen/header/object.d.ts +12 -0
  75. package/dist/src/document-model/gen/header/operations.d.ts +10 -0
  76. package/dist/src/document-model/gen/index.d.ts +5 -0
  77. package/dist/src/document-model/gen/module/actions.d.ts +8 -0
  78. package/dist/src/document-model/gen/module/creators.d.ts +7 -0
  79. package/dist/src/document-model/gen/module/object.d.ts +11 -0
  80. package/dist/src/document-model/gen/module/operations.d.ts +9 -0
  81. package/dist/src/document-model/gen/object.d.ts +28 -0
  82. package/dist/src/document-model/gen/operation/actions.d.ts +13 -0
  83. package/dist/src/document-model/gen/operation/creators.d.ts +12 -0
  84. package/dist/src/document-model/gen/operation/object.d.ts +16 -0
  85. package/dist/src/document-model/gen/operation/operations.d.ts +14 -0
  86. package/dist/src/document-model/gen/operation-error/actions.d.ts +10 -0
  87. package/dist/src/document-model/gen/operation-error/creators.d.ts +9 -0
  88. package/dist/src/document-model/gen/operation-error/object.d.ts +13 -0
  89. package/dist/src/document-model/gen/operation-error/operations.d.ts +11 -0
  90. package/dist/src/document-model/gen/operation-example/actions.d.ts +7 -0
  91. package/dist/src/document-model/gen/operation-example/creators.d.ts +6 -0
  92. package/dist/src/document-model/gen/operation-example/object.d.ts +10 -0
  93. package/dist/src/document-model/gen/operation-example/operations.d.ts +8 -0
  94. package/dist/src/document-model/gen/reducer.d.ts +5 -0
  95. package/dist/src/document-model/gen/schema/index.d.ts +2 -0
  96. package/dist/src/document-model/gen/schema/types.d.ts +453 -0
  97. package/dist/src/document-model/gen/schema/zod.d.ts +453 -0
  98. package/dist/src/document-model/gen/state/actions.d.ts +9 -0
  99. package/dist/src/document-model/gen/state/creators.d.ts +8 -0
  100. package/dist/src/document-model/gen/state/object.d.ts +12 -0
  101. package/dist/src/document-model/gen/state/operations.d.ts +10 -0
  102. package/dist/src/document-model/gen/types.d.ts +8 -0
  103. package/dist/src/document-model/gen/utils.d.ts +6 -0
  104. package/dist/src/document-model/gen/versioning/actions.d.ts +8 -0
  105. package/dist/src/document-model/gen/versioning/creators.d.ts +7 -0
  106. package/dist/src/document-model/gen/versioning/object.d.ts +11 -0
  107. package/dist/src/document-model/gen/versioning/operations.d.ts +9 -0
  108. package/dist/src/document-model/index.d.ts +75 -0
  109. package/dist/src/index.d.ts +25 -0
  110. package/dist/test/document/local.test.d.ts +1 -0
  111. package/dist/test/document/object.test.d.ts +1 -0
  112. package/dist/test/document/prune.test.d.ts +1 -0
  113. package/dist/test/document/redo.test.d.ts +1 -0
  114. package/dist/test/document/reducer.test.d.ts +1 -0
  115. package/dist/test/document/skip-operations.test.d.ts +1 -0
  116. package/dist/test/document/undo-redo.test.d.ts +1 -0
  117. package/dist/test/document/undo.test.d.ts +1 -0
  118. package/dist/test/document/utils.test.d.ts +1 -0
  119. package/dist/test/document-model/object.test.d.ts +1 -0
  120. package/dist/test/document-model/skip-operations.test.d.ts +1 -0
  121. package/dist/test/document-model/zip.test.d.ts +1 -0
  122. package/dist/test/helpers.d.ts +32 -0
  123. package/dist/vite.config.d.ts +2 -0
  124. package/dist/vitest.config.d.ts +2 -0
  125. package/package.json +23 -17
  126. package/dist/browser/internal/index-7bSWIChK.js +0 -38
  127. package/dist/browser/internal/index-DQNkZhvL.js +0 -1
  128. package/dist/browser/internal/object-1BuggAcr.js +0 -6
  129. package/dist/browser/internal/object-jGU_rY7z.js +0 -1895
  130. package/dist/node/internal/index-FmPDtpIY.js +0 -38
  131. package/dist/node/internal/index-lh4jt_0f.js +0 -1
  132. package/dist/node/internal/object-evJm9vYN.js +0 -897
  133. package/dist/node/internal/object-pZF_UDWv.js +0 -1
  134. package/dist/node/jest.config.d.ts +0 -8
  135. /package/dist/browser/test/document/{undo-redo.test.d.ts → redo.test.d.ts} +0 -0
  136. /package/dist/{node/test/document/undo-redo.test.d.ts → browser/test/document/undo.test.d.ts} +0 -0
  137. /package/dist/{browser/jest.config.d.ts → jest.config.d.ts} +0 -0
@@ -1,897 +0,0 @@
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
- });
18
- }
19
- function y() {
20
- return s.literal("global").or(s.literal("local"));
21
- }
22
- function V() {
23
- return s.union([
24
- G(),
25
- X(),
26
- Y(),
27
- tt(),
28
- et()
29
- ]);
30
- }
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
- });
39
- }
40
- function G() {
41
- return s.object({
42
- input: s.lazy(() => T()),
43
- type: B,
44
- scope: y()
45
- });
46
- }
47
- function T() {
48
- return s.object({
49
- operations: s.number(),
50
- state: s.lazy(() => Q())
51
- });
52
- }
53
- function Q() {
54
- return s.object({
55
- data: s.unknown().nullish(),
56
- name: s.string()
57
- });
58
- }
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
- });
67
- }
68
- function X() {
69
- return s.object({
70
- input: s.lazy(() => z()),
71
- type: Z,
72
- scope: y()
73
- });
74
- }
75
- function z() {
76
- return s.object({
77
- end: s.number().nullish(),
78
- start: s.number().nullish()
79
- });
80
- }
81
- const I = s.number;
82
- function Y() {
83
- return s.object({
84
- input: I(),
85
- type: H,
86
- scope: y()
87
- });
88
- }
89
- const F = s.string;
90
- function tt() {
91
- return s.object({
92
- input: F(),
93
- type: K,
94
- scope: s.literal("global")
95
- });
96
- }
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
- });
106
- }
107
- const R = s.number;
108
- function et() {
109
- return s.object({
110
- input: R(),
111
- type: W,
112
- scope: y()
113
- });
114
- }
115
- const re = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
116
- __proto__: null,
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
- }, Symbol.toStringTag, { value: "Module" }));
142
- function Et(t, e) {
143
- return { ...t, name: e };
144
- }
145
- function Dt(t, e, i) {
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--);
174
- }
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
- });
211
- }
212
- function At(t, e, i) {
213
- const { scope: a } = e, n = t.operations[a];
214
- let {
215
- input: { start: p, end: o }
216
- } = e;
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(
219
- t.initialState,
220
- {
221
- ...t.operations,
222
- [a]: u.concat(c)
223
- },
224
- i
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(
227
- t.initialState,
228
- {
229
- ...t.operations,
230
- [a]: [
231
- ...u,
232
- {
233
- ...P(
234
- { name: m, state: d },
235
- c.length
236
- ),
237
- timestamp: v,
238
- index: r,
239
- hash: ct({ state: d }, "global")
240
- },
241
- ...l.map((f, E) => ({
242
- ...f,
243
- index: r + E + 1
244
- }))
245
- ]
246
- },
247
- i
248
- );
249
- }
250
- function Tt(t, e) {
251
- return {
252
- ...t,
253
- name: e.name,
254
- state: e.state ?? { global: {}, local: {} }
255
- };
256
- }
257
- const it = "SET_NAME", g = "UNDO", h = "REDO", w = "PRUNE", at = "LOAD_STATE";
258
- function zt(t) {
259
- return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
260
- }
261
- function k() {
262
- this._types = /* @__PURE__ */ Object.create(null), this._extensions = /* @__PURE__ */ Object.create(null);
263
- for (let t = 0; t < arguments.length; t++)
264
- this.define(arguments[t]);
265
- this.define = this.define.bind(this), this.getType = this.getType.bind(this), this.getExtension = this.getExtension.bind(this);
266
- }
267
- k.prototype.define = function(t, e) {
268
- for (let i in t) {
269
- let a = t[i].map(function(n) {
270
- return n.toLowerCase();
271
- });
272
- i = i.toLowerCase();
273
- for (let n = 0; n < a.length; n++) {
274
- const p = a[n];
275
- if (p[0] !== "*") {
276
- if (!e && p in this._types)
277
- throw new Error(
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 + '".'
279
- );
280
- this._types[p] = i;
281
- }
282
- }
283
- if (e || !this._extensions[i]) {
284
- const n = a[0];
285
- this._extensions[i] = n[0] !== "*" ? n : n.substr(1);
286
- }
287
- }
288
- };
289
- k.prototype.getType = function(t) {
290
- t = String(t);
291
- let e = t.replace(/^.*[/\\]/, "").toLowerCase(), i = e.replace(/^.*\./, "").toLowerCase(), a = e.length < t.length;
292
- return (i.length < e.length - 1 || !a) && this._types[i] || null;
293
- };
294
- k.prototype.getExtension = function(t) {
295
- return t = /^\s*([^;\s]*)/.test(t) && RegExp.$1, t && this._extensions[t.toLowerCase()] || null;
296
- };
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) => {
304
- try {
305
- N.writeFile(a, i, {}, (o) => {
306
- o ? p(o) : n(a);
307
- });
308
- } catch (o) {
309
- p(o);
310
- }
311
- });
312
- }
313
- function nt(t) {
314
- return N.readFileSync(t);
315
- }
316
- function Lt(t) {
317
- return new Promise((e, i) => {
318
- yt.get(t, (a) => {
319
- const n = [], p = a.headers["content-type"];
320
- a.on("data", (o) => {
321
- n.push(o);
322
- }), a.on("end", () => {
323
- e({ buffer: Buffer.concat(n), mimeType: p });
324
- });
325
- }).on("error", (a) => {
326
- i(a);
327
- });
328
- });
329
- }
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 = {
332
- name: i,
333
- revision: a,
334
- documentType: n,
335
- created: p,
336
- lastModified: o
337
- };
338
- return e.file("header.json", JSON.stringify(c, null, 2)), e.file(
339
- "state.json",
340
- JSON.stringify(t.initialState || {}, null, 2)
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, {
344
- base64: !0,
345
- createFolders: !0,
346
- comment: JSON.stringify(m)
347
- });
348
- }), e;
349
- }, Ct = async (t, e, i, a) => {
350
- const p = await (await ot(t)).generateAsync({
351
- type: "uint8array",
352
- streamFiles: !0
353
- }), o = a ?? t.name, c = `.${i}.zip`;
354
- return qt(
355
- e,
356
- o.endsWith(c) ? o : `${o}${c}`,
357
- p
358
- );
359
- }, me = async (t, e) => {
360
- const a = await (await ot(t)).generateAsync({ type: "blob" }), n = await e.createWritable();
361
- await n.write(a), await n.close();
362
- }, L = async (t, e) => {
363
- const i = nt(t);
364
- return $t(i, e);
365
- }, $t = async (t, e) => {
366
- const i = new $();
367
- return await i.loadAsync(t), Jt(i, e);
368
- };
369
- async function Jt(t, e) {
370
- const i = t.file("state.json");
371
- if (!i)
372
- throw new Error("Initial state not found");
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)
378
- throw new Error("Operations history not found");
379
- const u = JSON.parse(
380
- await c.async("string")
381
- );
382
- let l = lt(
383
- n,
384
- u,
385
- e,
386
- void 0,
387
- o
388
- );
389
- return o && (l = {
390
- ...l,
391
- ...o
392
- }), l;
393
- }
394
- function st(t) {
395
- const e = t.replace(/^.*\./, "") || void 0, i = t.replace(/^.*[/\\]/, "") || void 0;
396
- return { extension: e, fileName: i };
397
- }
398
- async function ue(t) {
399
- const { buffer: e, mimeType: i = "application/octet-stream" } = await Lt(t), a = st(t), n = e.toString("base64");
400
- return {
401
- data: n,
402
- hash: _(n),
403
- mimeType: i,
404
- ...a
405
- };
406
- }
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 };
410
- }
411
- function Bt(t, e) {
412
- const i = t.revision[e.scope];
413
- return [g, h, w].includes(e.type) ? i : i + 1;
414
- }
415
- function Zt(t, e) {
416
- return {
417
- ...t,
418
- revision: {
419
- ...t.revision,
420
- [e.scope]: Bt(t, e)
421
- },
422
- lastModified: (/* @__PURE__ */ new Date()).toISOString()
423
- };
424
- }
425
- function Ht(t, e, i = 0) {
426
- if ([g, h, w].includes(e.type))
427
- return t;
428
- const { scope: a } = e, n = t.operations[a].slice(
429
- 0,
430
- t.revision[a]
431
- );
432
- return n.push({
433
- ...e,
434
- index: n.length,
435
- timestamp: (/* @__PURE__ */ new Date()).toISOString(),
436
- hash: "",
437
- scope: a,
438
- skip: i
439
- }), {
440
- ...t,
441
- operations: { ...t.operations, [a]: n }
442
- };
443
- }
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
- }
459
- }
460
- function Vt(t, e, i) {
461
- switch (e.type) {
462
- case g:
463
- return Dt(t, e, i);
464
- case h:
465
- return Nt(t, e, i);
466
- default:
467
- return { document: t, action: e, skip: i };
468
- }
469
- }
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
500
- });
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
510
- };
511
- });
512
- });
513
- }
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);
519
- }
520
- function b(t, e, i, a, n = "global") {
521
- if (!t)
522
- throw new Error("Empty action type");
523
- if (typeof t != "string")
524
- throw new Error(`Invalid action type: ${t}`);
525
- const p = { type: t, input: e, scope: n };
526
- i && (p.attachments = i);
527
- try {
528
- a == null || a().parse(p.input);
529
- } catch (o) {
530
- throw new Error(`Invalid action input: ${o}`);
531
- }
532
- return p;
533
- }
534
- function Gt(t, e = pt) {
535
- return (i, a, n, p) => e(i, a, t, n, p);
536
- }
537
- const Qt = (t, e) => ({
538
- name: "",
539
- documentType: "",
540
- revision: {
541
- global: 0,
542
- local: 0
543
- },
544
- created: (/* @__PURE__ */ new Date()).toISOString(),
545
- lastModified: (/* @__PURE__ */ new Date()).toISOString(),
546
- attachments: {},
547
- ...t,
548
- state: (e == null ? void 0 : e(t == null ? void 0 : t.state)) ?? (t == null ? void 0 : t.state) ?? { global: {}, local: {} }
549
- }), Xt = (t, e) => {
550
- const i = Qt(
551
- t,
552
- e
553
- );
554
- return {
555
- ...i,
556
- initialState: i,
557
- operations: { global: [], local: [] },
558
- clipboard: []
559
- };
560
- }, ct = (t, e = "global") => _(bt(t.state[e])), xe = (t, e = 1e3) => {
561
- const i = Math.random() * e;
562
- return _(`${(t ?? /* @__PURE__ */ new Date()).toISOString()}${i}`);
563
- };
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;
575
- }
576
- if (a < 0)
577
- throw new Error("Invalid operation index, missing operations");
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);
587
- }
588
- return p.reverse();
589
- }
590
- function fe(t) {
591
- return Object.values(t).flatMap((e) => e).sort(
592
- (e, i) => new Date(e.timestamp).getTime() - new Date(i.timestamp).getTime()
593
- );
594
- }
595
- function te(t) {
596
- return Object.values(t).flatMap((e) => e).sort(
597
- (e, i) => new Date(e.operation.timestamp).getTime() - new Date(i.operation.timestamp).getTime()
598
- );
599
- }
600
- function A(t, e, i, a, n, p = pt, o = {}) {
601
- const c = Gt(i, p);
602
- return lt(
603
- t,
604
- e,
605
- c,
606
- a,
607
- n,
608
- o
609
- );
610
- }
611
- function lt(t, e, i, a, n, p = {}) {
612
- const o = Xt(t), c = Object.keys(e).reduce((m, d) => {
613
- const r = d;
614
- return {
615
- ...m,
616
- [r]: e[r].slice(0, n == null ? void 0 : n.revision[r])
617
- };
618
- }, {}), u = Object.keys(c).reduce((m, d) => {
619
- const r = d;
620
- return {
621
- ...m,
622
- [r]: Yt(c[r], p[r])
623
- };
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,
633
- a,
634
- { skip: r.skip, ignoreSkipOperations: !0 }
635
- ),
636
- o
637
- ), x = Object.keys(
638
- l.operations
639
- ).reduce(
640
- (m, d) => {
641
- const r = d, v = n && n.revision[r] < e[r].length ? e[r].slice(n.revision[r]) : [];
642
- return {
643
- ...m,
644
- [r]: [
645
- ...l.operations[r].map((f, E) => {
646
- var q;
647
- return {
648
- ...f,
649
- timestamp: ((q = e[r][E]) == null ? void 0 : q.timestamp) ?? f.timestamp
650
- };
651
- }),
652
- ...v
653
- ]
654
- };
655
- },
656
- { global: [], local: [] }
657
- );
658
- return { ...l, operations: x };
659
- }
660
- const rt = (t) => b(
661
- "SET_NAME",
662
- t,
663
- void 0,
664
- F,
665
- void 0
666
- ), mt = (t = 1, e = "global") => b(
667
- "UNDO",
668
- t,
669
- void 0,
670
- R,
671
- e
672
- ), ut = (t = 1, e = "global") => b(
673
- "REDO",
674
- t,
675
- void 0,
676
- I,
677
- e
678
- ), dt = (t, e, i = "global") => b(
679
- "PRUNE",
680
- { start: t, end: e },
681
- void 0,
682
- z,
683
- i
684
- ), P = (t, e) => b(
685
- "LOAD_STATE",
686
- { state: t, operations: e },
687
- void 0,
688
- T
689
- ), M = (t = "global") => b(
690
- "NOOP",
691
- {},
692
- void 0,
693
- void 0,
694
- t
695
- ), ge = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
696
- __proto__: null,
697
- loadState: P,
698
- noop: M,
699
- prune: dt,
700
- redo: ut,
701
- setName: rt,
702
- undo: mt
703
- }, Symbol.toStringTag, { value: "Module" }));
704
- class he {
705
- /**
706
- * Constructs a BaseDocument instance with an initial state.
707
- * @param reducer - The reducer function that updates the state.
708
- * @param document - The initial state of the document.
709
- */
710
- constructor(e, i, a) {
711
- j(this, "_document");
712
- j(this, "_reducer");
713
- j(this, "_signalDispatch");
714
- this._reducer = e, this._document = i, this._signalDispatch = a;
715
- }
716
- /**
717
- * Dispatches an action to update the state of the document.
718
- * @param action - The action to dispatch.
719
- * @returns The Document instance.
720
- */
721
- dispatch(e, i) {
722
- return this._document = this._reducer(
723
- this._document,
724
- e,
725
- this._signalDispatch,
726
- i
727
- ), this;
728
- }
729
- /**
730
- * Saves the state of the document to a file.
731
- * @param path - The file path where the state should be saved.
732
- * @param extension - The file extension to use when saving the state.
733
- * @returns The file path where the state was saved.
734
- */
735
- saveToFile(e, i, a) {
736
- return Ct(this._document, e, i, a);
737
- }
738
- /**
739
- * Loads the state of the document from a file.
740
- * @param path - The file path where the state is stored.
741
- */
742
- async loadFromFile(e) {
743
- this._document = await L(e, this._reducer);
744
- }
745
- /**
746
- * Loads the state of the document from a file and returns it.
747
- * @param path - The file path where the state is stored.
748
- * @param reducer - The reducer function that updates the state.
749
- * @returns The state of the document.
750
- */
751
- static async stateFromFile(e, i) {
752
- return await L(e, i);
753
- }
754
- /**
755
- * Gets the current state of the document.
756
- */
757
- get state() {
758
- return O(this._document.state);
759
- }
760
- /**
761
- * Gets the list of operations performed on the document.
762
- */
763
- get operations() {
764
- return O(this._document.operations);
765
- }
766
- /**
767
- * Gets the name of the document.
768
- */
769
- get name() {
770
- return this._document.name;
771
- }
772
- /**
773
- * Gets the type of document.
774
- */
775
- get documentType() {
776
- return this._document.documentType;
777
- }
778
- /**
779
- * Gets the timestamp of the date the document was created.
780
- */
781
- get created() {
782
- return this._document.created;
783
- }
784
- /**
785
- * Gets the timestamp of the date the document was last modified.
786
- */
787
- get lastModified() {
788
- return this._document.lastModified;
789
- }
790
- /**
791
- * Gets the global revision number of the document.
792
- */
793
- get revision() {
794
- return this._document.revision.global;
795
- }
796
- getRevision(e) {
797
- return this._document.revision[e];
798
- }
799
- /**
800
- * Gets the initial state of the document.
801
- */
802
- get initialState() {
803
- return O(this._document.initialState);
804
- }
805
- /**
806
- * Returns the current document as an object
807
- */
808
- toDocument() {
809
- return O(this._document);
810
- }
811
- /**
812
- * Gets the attachment associated with the given key.
813
- * @param attachment - The key of the attachment to retrieve.
814
- */
815
- getAttachment(e) {
816
- return this._document.attachments[e];
817
- }
818
- /**
819
- * Sets the name of the document.
820
- * @param name - The new name of the document.
821
- */
822
- setName(e) {
823
- return this.dispatch(rt(e)), this;
824
- }
825
- /**
826
- * Reverts a number of actions from the document.
827
- * @param count - The number of actions to revert.
828
- */
829
- undo(e) {
830
- return this.dispatch(mt(e)), this;
831
- }
832
- /**
833
- * Reapplies a number of actions to the document.
834
- * @param count - The number of actions to reapply.
835
- */
836
- redo(e) {
837
- return this.dispatch(ut(e)), this;
838
- }
839
- /**
840
- * Removes a range of operations from the document.
841
- * @param start - The starting index of the range to remove.
842
- * @param end - The ending index of the range to remove.
843
- */
844
- prune(e, i) {
845
- return this.dispatch(dt(e, i)), this;
846
- }
847
- /**
848
- * Loads a document state and a set of operations.
849
- * @param state - The state to load.
850
- * @param operations - The operations to apply to the document.
851
- */
852
- loadState(e, i) {
853
- return this.dispatch(P(e, i)), this;
854
- }
855
- }
856
- function be(t, e) {
857
- e.forEach((i) => {
858
- Object.getOwnPropertyNames(i.prototype).forEach((a) => {
859
- Object.defineProperty(
860
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
861
- t.prototype,
862
- a,
863
- // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access
864
- Object.getOwnPropertyDescriptor(i.prototype, a) || /* @__PURE__ */ Object.create(null)
865
- );
866
- });
867
- });
868
- }
869
- export {
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
897
- };