document-model 1.0.17 → 1.0.19
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.
- package/dist/browser/document/utils/base.d.ts +6 -2
- package/dist/browser/document-model/gen/header/object.d.ts +2 -2
- package/dist/browser/document-model/gen/module/object.d.ts +2 -2
- package/dist/browser/document-model/gen/object.d.ts +4 -4
- package/dist/browser/document-model/gen/operation/object.d.ts +2 -2
- package/dist/browser/document-model/gen/operation-error/object.d.ts +2 -2
- package/dist/browser/document-model/gen/operation-example/object.d.ts +2 -2
- package/dist/browser/document-model/gen/reducer.d.ts +2 -2
- package/dist/browser/document-model/gen/schema/types.d.ts +1 -1
- package/dist/browser/document-model/gen/state/object.d.ts +2 -2
- package/dist/browser/document-model/gen/types.d.ts +3 -3
- package/dist/browser/document-model/gen/utils.d.ts +4 -2
- package/dist/browser/document-model/gen/versioning/object.d.ts +2 -2
- package/dist/browser/document-model/index.d.ts +9 -9
- package/dist/browser/document-model.cjs +1 -1
- package/dist/browser/document-model.js +2 -2
- package/dist/browser/document.cjs +1 -1
- package/dist/browser/document.js +6 -6
- package/dist/browser/index.cjs +1 -1
- package/dist/browser/index.js +4 -4
- package/dist/browser/internal/{index-01030c3f.js → index-1ad32a2e.js} +2 -2
- package/dist/browser/internal/index-2551382e.js +34 -0
- package/dist/{node/internal/index-0db636da.js → browser/internal/index-46b68530.js} +22 -25
- package/dist/browser/internal/index-869c5d0d.js +1 -0
- package/dist/browser/internal/object-1fdba77d.js +6 -0
- package/dist/browser/internal/{object-7e8eaff4.js → object-d50f7d2f.js} +744 -715
- package/dist/node/document/utils/base.d.ts +6 -2
- package/dist/node/document-model/gen/header/object.d.ts +2 -2
- package/dist/node/document-model/gen/module/object.d.ts +2 -2
- package/dist/node/document-model/gen/object.d.ts +4 -4
- package/dist/node/document-model/gen/operation/object.d.ts +2 -2
- package/dist/node/document-model/gen/operation-error/object.d.ts +2 -2
- package/dist/node/document-model/gen/operation-example/object.d.ts +2 -2
- package/dist/node/document-model/gen/reducer.d.ts +2 -2
- package/dist/node/document-model/gen/schema/types.d.ts +1 -1
- package/dist/node/document-model/gen/state/object.d.ts +2 -2
- package/dist/node/document-model/gen/types.d.ts +3 -3
- package/dist/node/document-model/gen/utils.d.ts +4 -2
- package/dist/node/document-model/gen/versioning/object.d.ts +2 -2
- package/dist/node/document-model/index.d.ts +9 -9
- package/dist/node/document-model.cjs +1 -1
- package/dist/node/document-model.js +3 -3
- package/dist/node/document.cjs +1 -1
- package/dist/node/document.js +5 -5
- package/dist/node/index.cjs +1 -1
- package/dist/node/index.js +4 -4
- package/dist/node/internal/{index-cddc9dfd.js → index-631ba7bf.js} +2 -2
- package/dist/node/internal/index-6477ee0a.js +1 -0
- package/dist/{browser/internal/index-5f1909ad.js → node/internal/index-8d582c48.js} +26 -21
- package/dist/node/internal/index-f235f9be.js +34 -0
- package/dist/node/internal/object-08bd169a.js +1 -0
- package/dist/node/internal/{object-c32ea0a0.js → object-773231ca.js} +473 -444
- package/package.json +1 -1
- package/dist/browser/internal/index-2aee8ea9.js +0 -1
- package/dist/browser/internal/index-a1282d5c.js +0 -31
- package/dist/browser/internal/object-24df9d92.js +0 -6
- package/dist/node/internal/index-2d4783d9.js +0 -1
- package/dist/node/internal/index-5ef0c6b0.js +0 -31
- package/dist/node/internal/object-21f3d2ee.js +0 -1
|
@@ -1,484 +1,472 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import
|
|
5
|
-
import { produce as
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import {
|
|
12
|
-
const
|
|
13
|
-
function
|
|
14
|
-
return
|
|
15
|
-
__typename:
|
|
16
|
-
type:
|
|
1
|
+
var pt = Object.defineProperty;
|
|
2
|
+
var lt = (t, i, e) => i in t ? pt(t, i, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[i] = e;
|
|
3
|
+
var h = (t, i, e) => (lt(t, typeof i != "symbol" ? i + "" : i, e), e);
|
|
4
|
+
import ct from "json-stringify-deterministic";
|
|
5
|
+
import { produce as T, castDraft as rt, castImmutable as mt, freeze as ut } from "immer";
|
|
6
|
+
import { z as o } from "zod";
|
|
7
|
+
import P from "jszip";
|
|
8
|
+
import dt from "crypto";
|
|
9
|
+
import O from "fs";
|
|
10
|
+
import xt from "https";
|
|
11
|
+
import { join as gt } from "path";
|
|
12
|
+
const q = (t) => t != null, ft = o.any().refine((t) => q(t)), I = o.enum(["LOAD_STATE"]), M = o.enum(["PRUNE"]), R = o.enum(["REDO"]), L = o.enum(["SET_NAME"]), U = o.enum(["UNDO"]);
|
|
13
|
+
function ht() {
|
|
14
|
+
return o.object({
|
|
15
|
+
__typename: o.literal("Action").optional(),
|
|
16
|
+
type: o.string()
|
|
17
17
|
});
|
|
18
18
|
}
|
|
19
|
-
function
|
|
20
|
-
return
|
|
21
|
-
|
|
22
|
-
C(),
|
|
19
|
+
function J() {
|
|
20
|
+
return o.union([
|
|
21
|
+
$(),
|
|
23
22
|
B(),
|
|
24
23
|
Z(),
|
|
25
|
-
H()
|
|
24
|
+
H(),
|
|
25
|
+
K()
|
|
26
26
|
]);
|
|
27
27
|
}
|
|
28
|
-
function
|
|
29
|
-
return
|
|
30
|
-
__typename:
|
|
31
|
-
data:
|
|
32
|
-
extension:
|
|
33
|
-
fileName:
|
|
34
|
-
mimeType:
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
function J() {
|
|
38
|
-
return n.object({
|
|
39
|
-
input: n.lazy(() => S()),
|
|
40
|
-
type: q,
|
|
41
|
-
scope: n.literal("global")
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
function S() {
|
|
45
|
-
return n.object({
|
|
46
|
-
operations: n.number(),
|
|
47
|
-
state: n.lazy(() => $())
|
|
28
|
+
function bt() {
|
|
29
|
+
return o.object({
|
|
30
|
+
__typename: o.literal("DocumentFile").optional(),
|
|
31
|
+
data: o.string(),
|
|
32
|
+
extension: o.string().nullable(),
|
|
33
|
+
fileName: o.string().nullable(),
|
|
34
|
+
mimeType: o.string()
|
|
48
35
|
});
|
|
49
36
|
}
|
|
50
37
|
function $() {
|
|
51
|
-
return
|
|
52
|
-
|
|
53
|
-
|
|
38
|
+
return o.object({
|
|
39
|
+
input: o.lazy(() => _()),
|
|
40
|
+
type: I,
|
|
41
|
+
scope: o.literal("global")
|
|
54
42
|
});
|
|
55
43
|
}
|
|
56
|
-
function
|
|
57
|
-
return
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
index: n.number(),
|
|
61
|
-
timestamp: n.string().datetime(),
|
|
62
|
-
type: n.string()
|
|
44
|
+
function _() {
|
|
45
|
+
return o.object({
|
|
46
|
+
operations: o.number(),
|
|
47
|
+
state: o.lazy(() => C())
|
|
63
48
|
});
|
|
64
49
|
}
|
|
65
50
|
function C() {
|
|
66
|
-
return
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
scope: n.literal("global")
|
|
51
|
+
return o.object({
|
|
52
|
+
data: o.unknown().nullish(),
|
|
53
|
+
name: o.string()
|
|
70
54
|
});
|
|
71
55
|
}
|
|
72
|
-
function
|
|
73
|
-
return
|
|
74
|
-
|
|
75
|
-
|
|
56
|
+
function vt() {
|
|
57
|
+
return o.object({
|
|
58
|
+
__typename: o.literal("Operation").optional(),
|
|
59
|
+
hash: o.string(),
|
|
60
|
+
index: o.number(),
|
|
61
|
+
timestamp: o.string().datetime(),
|
|
62
|
+
type: o.string()
|
|
76
63
|
});
|
|
77
64
|
}
|
|
78
|
-
const O = n.number;
|
|
79
65
|
function B() {
|
|
80
|
-
return
|
|
81
|
-
input:
|
|
66
|
+
return o.object({
|
|
67
|
+
input: o.lazy(() => D()),
|
|
82
68
|
type: M,
|
|
83
|
-
scope:
|
|
69
|
+
scope: o.literal("global")
|
|
84
70
|
});
|
|
85
71
|
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
type: R,
|
|
91
|
-
scope: n.literal("global")
|
|
72
|
+
function D() {
|
|
73
|
+
return o.object({
|
|
74
|
+
end: o.number().nullish(),
|
|
75
|
+
start: o.number().nullish()
|
|
92
76
|
});
|
|
93
77
|
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
timestamp: n.string().datetime(),
|
|
101
|
-
type: n.string()
|
|
78
|
+
const k = o.number;
|
|
79
|
+
function Z() {
|
|
80
|
+
return o.object({
|
|
81
|
+
input: k(),
|
|
82
|
+
type: R,
|
|
83
|
+
scope: o.literal("global")
|
|
102
84
|
});
|
|
103
85
|
}
|
|
104
|
-
const
|
|
86
|
+
const E = o.string;
|
|
105
87
|
function H() {
|
|
106
|
-
return
|
|
107
|
-
input:
|
|
88
|
+
return o.object({
|
|
89
|
+
input: E(),
|
|
108
90
|
type: L,
|
|
109
|
-
scope:
|
|
91
|
+
scope: o.literal("global")
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
function yt() {
|
|
95
|
+
return o.object({
|
|
96
|
+
__typename: o.literal("SetNameOperation").optional(),
|
|
97
|
+
hash: o.string(),
|
|
98
|
+
index: o.number(),
|
|
99
|
+
input: o.string(),
|
|
100
|
+
timestamp: o.string().datetime(),
|
|
101
|
+
type: o.string()
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
const N = o.number;
|
|
105
|
+
function K() {
|
|
106
|
+
return o.object({
|
|
107
|
+
input: N(),
|
|
108
|
+
type: U,
|
|
109
|
+
scope: o.literal("global")
|
|
110
110
|
});
|
|
111
111
|
}
|
|
112
|
-
const
|
|
112
|
+
const ei = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
113
113
|
__proto__: null,
|
|
114
|
-
ActionSchema:
|
|
115
|
-
BaseActionSchema:
|
|
116
|
-
DocumentFileSchema:
|
|
117
|
-
LoadStateActionInputSchema:
|
|
118
|
-
LoadStateActionSchema:
|
|
119
|
-
LoadStateActionStateInputSchema:
|
|
120
|
-
Load_StateSchema:
|
|
121
|
-
OperationSchema:
|
|
122
|
-
PruneActionInputSchema:
|
|
123
|
-
PruneActionSchema:
|
|
124
|
-
PruneSchema:
|
|
125
|
-
RedoActionInputSchema:
|
|
126
|
-
RedoActionSchema:
|
|
127
|
-
RedoSchema:
|
|
128
|
-
SetNameActionInputSchema:
|
|
129
|
-
SetNameActionSchema:
|
|
130
|
-
SetNameOperationSchema:
|
|
131
|
-
Set_NameSchema:
|
|
132
|
-
UndoActionInputSchema:
|
|
133
|
-
UndoActionSchema:
|
|
134
|
-
UndoSchema:
|
|
135
|
-
definedNonNullAnySchema:
|
|
136
|
-
isDefinedNonNullAny:
|
|
114
|
+
ActionSchema: ht,
|
|
115
|
+
BaseActionSchema: J,
|
|
116
|
+
DocumentFileSchema: bt,
|
|
117
|
+
LoadStateActionInputSchema: _,
|
|
118
|
+
LoadStateActionSchema: $,
|
|
119
|
+
LoadStateActionStateInputSchema: C,
|
|
120
|
+
Load_StateSchema: I,
|
|
121
|
+
OperationSchema: vt,
|
|
122
|
+
PruneActionInputSchema: D,
|
|
123
|
+
PruneActionSchema: B,
|
|
124
|
+
PruneSchema: M,
|
|
125
|
+
RedoActionInputSchema: k,
|
|
126
|
+
RedoActionSchema: Z,
|
|
127
|
+
RedoSchema: R,
|
|
128
|
+
SetNameActionInputSchema: E,
|
|
129
|
+
SetNameActionSchema: H,
|
|
130
|
+
SetNameOperationSchema: yt,
|
|
131
|
+
Set_NameSchema: L,
|
|
132
|
+
UndoActionInputSchema: N,
|
|
133
|
+
UndoActionSchema: K,
|
|
134
|
+
UndoSchema: U,
|
|
135
|
+
definedNonNullAnySchema: ft,
|
|
136
|
+
isDefinedNonNullAny: q
|
|
137
137
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
138
|
-
function
|
|
138
|
+
function jt(t, i) {
|
|
139
|
+
return { ...t, name: i };
|
|
140
|
+
}
|
|
141
|
+
function wt(t, i, e) {
|
|
142
|
+
const n = Math.min(i, t.revision), a = t.operations.global.slice(
|
|
143
|
+
0,
|
|
144
|
+
t.revision - n
|
|
145
|
+
);
|
|
146
|
+
return {
|
|
147
|
+
...v(
|
|
148
|
+
t.initialState,
|
|
149
|
+
{
|
|
150
|
+
global: a,
|
|
151
|
+
local: t.operations.local
|
|
152
|
+
},
|
|
153
|
+
e
|
|
154
|
+
),
|
|
155
|
+
operations: t.operations,
|
|
156
|
+
revision: t.revision - n
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
function St(t, i, e) {
|
|
160
|
+
const n = t.operations.global.length - t.revision;
|
|
161
|
+
if (!n)
|
|
162
|
+
throw new Error("There is no UNDO operation to REDO");
|
|
163
|
+
const a = i < n ? i : n, s = t.operations.global.slice(
|
|
164
|
+
0,
|
|
165
|
+
t.revision + a
|
|
166
|
+
);
|
|
167
|
+
return {
|
|
168
|
+
...v(
|
|
169
|
+
t.initialState,
|
|
170
|
+
{
|
|
171
|
+
global: s,
|
|
172
|
+
local: t.operations.local
|
|
173
|
+
},
|
|
174
|
+
e
|
|
175
|
+
),
|
|
176
|
+
operations: t.operations,
|
|
177
|
+
revision: t.revision + a
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
function Ot(t, i, e, n) {
|
|
181
|
+
i = i || 0, e = e || t.operations.global.length;
|
|
182
|
+
const a = t.operations.global.slice(i, e), s = t.operations.global.slice(0, i), p = t.operations.global.slice(e), l = v(
|
|
183
|
+
t.initialState,
|
|
184
|
+
{
|
|
185
|
+
global: s.concat(a),
|
|
186
|
+
local: t.operations.local
|
|
187
|
+
},
|
|
188
|
+
n
|
|
189
|
+
), { name: r, state: c } = l, m = s.length, u = s.length ? s[s.length - 1].timestamp : p.length ? p[0].timestamp : (/* @__PURE__ */ new Date()).toISOString();
|
|
190
|
+
return v(
|
|
191
|
+
t.initialState,
|
|
192
|
+
{
|
|
193
|
+
global: [
|
|
194
|
+
...s,
|
|
195
|
+
{
|
|
196
|
+
...A(
|
|
197
|
+
{ name: r, state: c },
|
|
198
|
+
a.length
|
|
199
|
+
),
|
|
200
|
+
timestamp: u,
|
|
201
|
+
index: m,
|
|
202
|
+
hash: tt({ state: c }, "global")
|
|
203
|
+
},
|
|
204
|
+
...p.map((w, S) => ({
|
|
205
|
+
...w,
|
|
206
|
+
index: m + S + 1
|
|
207
|
+
}))
|
|
208
|
+
],
|
|
209
|
+
local: t.operations.local
|
|
210
|
+
},
|
|
211
|
+
n
|
|
212
|
+
);
|
|
213
|
+
}
|
|
214
|
+
function _t(t, i) {
|
|
215
|
+
return {
|
|
216
|
+
...t,
|
|
217
|
+
name: i.name,
|
|
218
|
+
state: i.state ?? { global: {}, local: {} }
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
const W = "SET_NAME", d = "UNDO", x = "REDO", g = "PRUNE", G = "LOAD_STATE";
|
|
222
|
+
function Dt(t) {
|
|
139
223
|
return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
|
|
140
224
|
}
|
|
141
|
-
function
|
|
225
|
+
function y() {
|
|
142
226
|
this._types = /* @__PURE__ */ Object.create(null), this._extensions = /* @__PURE__ */ Object.create(null);
|
|
143
227
|
for (let t = 0; t < arguments.length; t++)
|
|
144
228
|
this.define(arguments[t]);
|
|
145
229
|
this.define = this.define.bind(this), this.getType = this.getType.bind(this), this.getExtension = this.getExtension.bind(this);
|
|
146
230
|
}
|
|
147
|
-
|
|
148
|
-
for (let
|
|
149
|
-
let
|
|
150
|
-
return
|
|
231
|
+
y.prototype.define = function(t, i) {
|
|
232
|
+
for (let e in t) {
|
|
233
|
+
let n = t[e].map(function(a) {
|
|
234
|
+
return a.toLowerCase();
|
|
151
235
|
});
|
|
152
|
-
|
|
153
|
-
for (let
|
|
154
|
-
const s = a
|
|
236
|
+
e = e.toLowerCase();
|
|
237
|
+
for (let a = 0; a < n.length; a++) {
|
|
238
|
+
const s = n[a];
|
|
155
239
|
if (s[0] !== "*") {
|
|
156
|
-
if (!
|
|
240
|
+
if (!i && s in this._types)
|
|
157
241
|
throw new Error(
|
|
158
|
-
'Attempt to change mapping for "' + s + '" extension from "' + this._types[s] + '" to "' +
|
|
242
|
+
'Attempt to change mapping for "' + s + '" extension from "' + this._types[s] + '" to "' + e + '". Pass `force=true` to allow this, otherwise remove "' + s + '" from the list of extensions for "' + e + '".'
|
|
159
243
|
);
|
|
160
|
-
this._types[s] =
|
|
244
|
+
this._types[s] = e;
|
|
161
245
|
}
|
|
162
246
|
}
|
|
163
|
-
if (
|
|
164
|
-
const
|
|
165
|
-
this._extensions[
|
|
247
|
+
if (i || !this._extensions[e]) {
|
|
248
|
+
const a = n[0];
|
|
249
|
+
this._extensions[e] = a[0] !== "*" ? a : a.substr(1);
|
|
166
250
|
}
|
|
167
251
|
}
|
|
168
252
|
};
|
|
169
|
-
|
|
253
|
+
y.prototype.getType = function(t) {
|
|
170
254
|
t = String(t);
|
|
171
|
-
let
|
|
172
|
-
return (
|
|
255
|
+
let i = t.replace(/^.*[/\\]/, "").toLowerCase(), e = i.replace(/^.*\./, "").toLowerCase(), n = i.length < t.length;
|
|
256
|
+
return (e.length < i.length - 1 || !n) && this._types[e] || null;
|
|
173
257
|
};
|
|
174
|
-
|
|
258
|
+
y.prototype.getExtension = function(t) {
|
|
175
259
|
return t = /^\s*([^;\s]*)/.test(t) && RegExp.$1, t && this._extensions[t.toLowerCase()] || null;
|
|
176
260
|
};
|
|
177
|
-
var bt = h, vt = { "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"] };
|
|
178
|
-
let
|
|
179
|
-
var
|
|
180
|
-
const
|
|
181
|
-
function
|
|
182
|
-
const
|
|
183
|
-
return
|
|
261
|
+
var kt = y, Et = { "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"] };
|
|
262
|
+
let Nt = kt;
|
|
263
|
+
var At = new Nt(Et);
|
|
264
|
+
const Tt = /* @__PURE__ */ Dt(At);
|
|
265
|
+
function zt(t, i, e) {
|
|
266
|
+
const n = gt(t, i);
|
|
267
|
+
return O.mkdirSync(t, { recursive: !0 }), new Promise((a, s) => {
|
|
184
268
|
try {
|
|
185
|
-
|
|
186
|
-
|
|
269
|
+
O.writeFile(n, e, {}, (p) => {
|
|
270
|
+
p ? s(p) : a(n);
|
|
187
271
|
});
|
|
188
|
-
} catch (
|
|
189
|
-
s(
|
|
272
|
+
} catch (p) {
|
|
273
|
+
s(p);
|
|
190
274
|
}
|
|
191
275
|
});
|
|
192
276
|
}
|
|
193
|
-
function
|
|
194
|
-
return
|
|
195
|
-
}
|
|
196
|
-
function
|
|
197
|
-
return new Promise((
|
|
198
|
-
|
|
199
|
-
const
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
}),
|
|
203
|
-
|
|
277
|
+
function Q(t) {
|
|
278
|
+
return O.readFileSync(t);
|
|
279
|
+
}
|
|
280
|
+
function Ft(t) {
|
|
281
|
+
return new Promise((i, e) => {
|
|
282
|
+
xt.get(t, (n) => {
|
|
283
|
+
const a = [], s = n.headers["content-type"];
|
|
284
|
+
n.on("data", (p) => {
|
|
285
|
+
a.push(p);
|
|
286
|
+
}), n.on("end", () => {
|
|
287
|
+
i({ buffer: Buffer.concat(a), mimeType: s });
|
|
204
288
|
});
|
|
205
|
-
}).on("error", (
|
|
206
|
-
|
|
289
|
+
}).on("error", (n) => {
|
|
290
|
+
e(n);
|
|
207
291
|
});
|
|
208
292
|
});
|
|
209
293
|
}
|
|
210
|
-
const
|
|
211
|
-
const
|
|
212
|
-
name:
|
|
213
|
-
revision:
|
|
214
|
-
documentType:
|
|
294
|
+
const Pt = async (t) => Q(t), j = (t, i = "sha1") => dt.createHash(i).update(t).digest("base64"), V = async (t) => {
|
|
295
|
+
const i = new P(), { name: e, revision: n, documentType: a, created: s, lastModified: p } = t, l = {
|
|
296
|
+
name: e,
|
|
297
|
+
revision: n,
|
|
298
|
+
documentType: a,
|
|
215
299
|
created: s,
|
|
216
|
-
lastModified:
|
|
300
|
+
lastModified: p
|
|
217
301
|
};
|
|
218
|
-
return
|
|
302
|
+
return i.file("header.json", JSON.stringify(l, null, 2)), i.file(
|
|
219
303
|
"state.json",
|
|
220
304
|
JSON.stringify(t.initialState || {}, null, 2)
|
|
221
|
-
),
|
|
222
|
-
const { data:
|
|
223
|
-
|
|
305
|
+
), i.file("operations.json", JSON.stringify(t.operations, null, 2)), Object.keys(t.attachments).forEach((c) => {
|
|
306
|
+
const { data: m, ...u } = t.attachments[c];
|
|
307
|
+
i.file(c, m, {
|
|
224
308
|
base64: !0,
|
|
225
309
|
createFolders: !0,
|
|
226
|
-
comment: JSON.stringify(
|
|
310
|
+
comment: JSON.stringify(u)
|
|
227
311
|
});
|
|
228
|
-
}),
|
|
229
|
-
},
|
|
230
|
-
const s = await (await
|
|
312
|
+
}), i;
|
|
313
|
+
}, qt = async (t, i, e, n) => {
|
|
314
|
+
const s = await (await V(t)).generateAsync({
|
|
231
315
|
type: "uint8array",
|
|
232
316
|
streamFiles: !0
|
|
233
|
-
}),
|
|
234
|
-
return
|
|
235
|
-
|
|
236
|
-
|
|
317
|
+
}), p = n ?? t.name, l = `.${e}.zip`;
|
|
318
|
+
return zt(
|
|
319
|
+
i,
|
|
320
|
+
p.endsWith(l) ? p : `${p}${l}`,
|
|
237
321
|
s
|
|
238
322
|
);
|
|
239
|
-
},
|
|
240
|
-
const
|
|
241
|
-
await
|
|
242
|
-
},
|
|
243
|
-
const
|
|
244
|
-
return
|
|
245
|
-
},
|
|
246
|
-
const
|
|
247
|
-
return await
|
|
323
|
+
}, ai = async (t, i) => {
|
|
324
|
+
const n = await (await V(t)).generateAsync({ type: "blob" }), a = await i.createWritable();
|
|
325
|
+
await a.write(n), await a.close();
|
|
326
|
+
}, z = async (t, i) => {
|
|
327
|
+
const e = Q(t);
|
|
328
|
+
return It(e, i);
|
|
329
|
+
}, It = async (t, i) => {
|
|
330
|
+
const e = new P();
|
|
331
|
+
return await e.loadAsync(t), Mt(e, i);
|
|
248
332
|
};
|
|
249
|
-
async function
|
|
250
|
-
const
|
|
251
|
-
if (!
|
|
333
|
+
async function Mt(t, i) {
|
|
334
|
+
const e = t.file("state.json");
|
|
335
|
+
if (!e)
|
|
252
336
|
throw new Error("Initial state not found");
|
|
253
|
-
const
|
|
254
|
-
let
|
|
255
|
-
s && (
|
|
256
|
-
const
|
|
257
|
-
if (!
|
|
337
|
+
const n = await e.async("string"), a = JSON.parse(n), s = t.file("header.json");
|
|
338
|
+
let p;
|
|
339
|
+
s && (p = JSON.parse(await s.async("string")));
|
|
340
|
+
const l = t.file("operations.json");
|
|
341
|
+
if (!l)
|
|
258
342
|
throw new Error("Operations history not found");
|
|
259
|
-
const
|
|
260
|
-
await
|
|
261
|
-
), m = {
|
|
262
|
-
...o,
|
|
263
|
-
...l,
|
|
264
|
-
initialState: o,
|
|
265
|
-
operations: { global: [], local: [] },
|
|
266
|
-
attachments: { ...o.attachments }
|
|
267
|
-
};
|
|
268
|
-
let r = c.global.concat(c.local).slice(0, l == null ? void 0 : l.revision).reduce(
|
|
269
|
-
(j, it) => e(j, it),
|
|
270
|
-
m
|
|
343
|
+
const r = JSON.parse(
|
|
344
|
+
await l.async("string")
|
|
271
345
|
);
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
...c.global.slice(l.revision)
|
|
279
|
-
],
|
|
280
|
-
local: r.operations.local
|
|
281
|
-
}
|
|
282
|
-
}), r;
|
|
283
|
-
}
|
|
284
|
-
function G(t) {
|
|
285
|
-
const e = t.replace(/^.*\./, "") || void 0, i = t.replace(/^.*[/\\]/, "") || void 0;
|
|
286
|
-
return { extension: e, fileName: i };
|
|
287
|
-
}
|
|
288
|
-
async function te(t) {
|
|
289
|
-
const { buffer: e, mimeType: i = "application/octet-stream" } = await _t(t), a = G(t), o = e.toString("base64");
|
|
290
|
-
return {
|
|
291
|
-
data: o,
|
|
292
|
-
hash: b(o),
|
|
293
|
-
mimeType: i,
|
|
294
|
-
...a
|
|
295
|
-
};
|
|
296
|
-
}
|
|
297
|
-
async function ee(t) {
|
|
298
|
-
const e = await Ot(t), i = wt.getType(t) || "application/octet-stream", a = G(t), o = e.toString("base64");
|
|
299
|
-
return { data: o, hash: b(o), mimeType: i, ...a };
|
|
300
|
-
}
|
|
301
|
-
function f(t, e, i, a) {
|
|
302
|
-
const o = $t(t), s = Ut(i);
|
|
303
|
-
return e.global.concat(e.local).reduce(
|
|
304
|
-
(l, p) => s(l, p, a),
|
|
305
|
-
o
|
|
346
|
+
let c = it(
|
|
347
|
+
a,
|
|
348
|
+
r,
|
|
349
|
+
i,
|
|
350
|
+
void 0,
|
|
351
|
+
p
|
|
306
352
|
);
|
|
353
|
+
return p && (c = {
|
|
354
|
+
...c,
|
|
355
|
+
...p
|
|
356
|
+
}), c;
|
|
307
357
|
}
|
|
308
|
-
function
|
|
309
|
-
|
|
358
|
+
function X(t) {
|
|
359
|
+
const i = t.replace(/^.*\./, "") || void 0, e = t.replace(/^.*[/\\]/, "") || void 0;
|
|
360
|
+
return { extension: i, fileName: e };
|
|
310
361
|
}
|
|
311
|
-
function
|
|
312
|
-
const
|
|
313
|
-
0,
|
|
314
|
-
t.revision - a
|
|
315
|
-
);
|
|
362
|
+
async function ni(t) {
|
|
363
|
+
const { buffer: i, mimeType: e = "application/octet-stream" } = await Ft(t), n = X(t), a = i.toString("base64");
|
|
316
364
|
return {
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
local: t.operations.local
|
|
322
|
-
},
|
|
323
|
-
i
|
|
324
|
-
),
|
|
325
|
-
operations: t.operations,
|
|
326
|
-
revision: t.revision - a
|
|
365
|
+
data: a,
|
|
366
|
+
hash: j(a),
|
|
367
|
+
mimeType: e,
|
|
368
|
+
...n
|
|
327
369
|
};
|
|
328
370
|
}
|
|
329
|
-
function
|
|
330
|
-
const
|
|
331
|
-
|
|
332
|
-
throw new Error("There is no UNDO operation to REDO");
|
|
333
|
-
const o = e < a ? e : a, s = t.operations.global.slice(
|
|
334
|
-
0,
|
|
335
|
-
t.revision + o
|
|
336
|
-
);
|
|
337
|
-
return {
|
|
338
|
-
...f(
|
|
339
|
-
t.initialState,
|
|
340
|
-
{
|
|
341
|
-
global: s,
|
|
342
|
-
local: t.operations.local
|
|
343
|
-
},
|
|
344
|
-
i
|
|
345
|
-
),
|
|
346
|
-
operations: t.operations,
|
|
347
|
-
revision: t.revision + o
|
|
348
|
-
};
|
|
371
|
+
async function oi(t) {
|
|
372
|
+
const i = await Pt(t), e = Tt.getType(t) || "application/octet-stream", n = X(t), a = i.toString("base64");
|
|
373
|
+
return { data: a, hash: j(a), mimeType: e, ...n };
|
|
349
374
|
}
|
|
350
|
-
function
|
|
351
|
-
|
|
352
|
-
const o = t.operations.global.slice(e, i), s = t.operations.global.slice(0, e), l = t.operations.global.slice(i), p = f(
|
|
353
|
-
t.initialState,
|
|
354
|
-
{
|
|
355
|
-
global: s.concat(o),
|
|
356
|
-
local: t.operations.local
|
|
357
|
-
},
|
|
358
|
-
a
|
|
359
|
-
), { name: c, state: m } = p;
|
|
360
|
-
return f(
|
|
361
|
-
t.initialState,
|
|
362
|
-
{
|
|
363
|
-
global: [
|
|
364
|
-
...s,
|
|
365
|
-
E({ name: c, state: m }, o.length),
|
|
366
|
-
...l
|
|
367
|
-
],
|
|
368
|
-
local: t.operations.local
|
|
369
|
-
},
|
|
370
|
-
a
|
|
371
|
-
);
|
|
372
|
-
}
|
|
373
|
-
function Ft(t, e) {
|
|
374
|
-
return {
|
|
375
|
-
...t,
|
|
376
|
-
name: e.name,
|
|
377
|
-
state: e.state ?? { global: {}, local: {} }
|
|
378
|
-
};
|
|
379
|
-
}
|
|
380
|
-
const Q = "SET_NAME", v = "UNDO", y = "REDO", u = "PRUNE", V = "LOAD_STATE";
|
|
381
|
-
function Pt(t, e) {
|
|
382
|
-
return [v, y, u].includes(e.type) ? t.revision : t.revision + 1;
|
|
375
|
+
function Rt(t, i) {
|
|
376
|
+
return [d, x, g].includes(i.type) ? t.revision : t.revision + 1;
|
|
383
377
|
}
|
|
384
|
-
function
|
|
378
|
+
function Lt(t, i) {
|
|
385
379
|
return {
|
|
386
380
|
...t,
|
|
387
|
-
revision:
|
|
381
|
+
revision: Rt(t, i),
|
|
388
382
|
lastModified: (/* @__PURE__ */ new Date()).toISOString()
|
|
389
383
|
};
|
|
390
384
|
}
|
|
391
|
-
function
|
|
392
|
-
if ([
|
|
385
|
+
function Ut(t, i) {
|
|
386
|
+
if ([d, x, g].includes(i.type))
|
|
393
387
|
return t;
|
|
394
|
-
const
|
|
388
|
+
const e = t.operations.global.slice(
|
|
395
389
|
0,
|
|
396
390
|
t.revision
|
|
397
|
-
), a = t.operations
|
|
398
|
-
return
|
|
399
|
-
...
|
|
400
|
-
index: i.length,
|
|
401
|
-
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
402
|
-
hash: "",
|
|
403
|
-
scope: "global"
|
|
404
|
-
}) : e.scope === "local" && a.push({
|
|
405
|
-
...e,
|
|
391
|
+
), n = i.scope || "global", a = n === "global" ? e : t.operations[n];
|
|
392
|
+
return a.push({
|
|
393
|
+
...i,
|
|
406
394
|
index: a.length,
|
|
407
395
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
408
396
|
hash: "",
|
|
409
|
-
scope:
|
|
397
|
+
scope: n
|
|
410
398
|
}), {
|
|
411
399
|
...t,
|
|
412
|
-
operations: {
|
|
413
|
-
global: i,
|
|
414
|
-
local: a
|
|
415
|
-
}
|
|
400
|
+
operations: { ...t.operations, [n]: a }
|
|
416
401
|
};
|
|
417
402
|
}
|
|
418
|
-
function
|
|
419
|
-
let
|
|
420
|
-
return (!
|
|
421
|
-
}
|
|
422
|
-
function
|
|
423
|
-
switch (
|
|
424
|
-
case
|
|
425
|
-
return
|
|
426
|
-
case
|
|
427
|
-
return
|
|
428
|
-
case
|
|
429
|
-
return
|
|
430
|
-
case
|
|
431
|
-
return
|
|
403
|
+
function Jt(t, i) {
|
|
404
|
+
let e = Ut(t, i);
|
|
405
|
+
return (!i.scope || i.scope === "global") && (e = Lt(e, i)), e;
|
|
406
|
+
}
|
|
407
|
+
function $t(t, i, e) {
|
|
408
|
+
switch (J().parse(i), i.type) {
|
|
409
|
+
case W:
|
|
410
|
+
return jt(t, i.input);
|
|
411
|
+
case d:
|
|
412
|
+
return wt(t, i.input, e);
|
|
413
|
+
case x:
|
|
414
|
+
return St(t, i.input, e);
|
|
415
|
+
case g:
|
|
416
|
+
return Ot(
|
|
432
417
|
t,
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
418
|
+
i.input.start,
|
|
419
|
+
i.input.end,
|
|
420
|
+
e
|
|
436
421
|
);
|
|
437
|
-
case
|
|
438
|
-
return
|
|
422
|
+
case G:
|
|
423
|
+
return _t(t, i.input.state);
|
|
439
424
|
default:
|
|
440
425
|
return t;
|
|
441
426
|
}
|
|
442
427
|
}
|
|
443
|
-
function
|
|
444
|
-
let
|
|
445
|
-
return
|
|
446
|
-
const
|
|
447
|
-
if (
|
|
448
|
-
return
|
|
449
|
-
...
|
|
450
|
-
state:
|
|
428
|
+
function Y(t, i, e, n) {
|
|
429
|
+
let a = t;
|
|
430
|
+
return F(i) && (a = $t(a, i, e)), a = Jt(a, i), a = T(a, (s) => {
|
|
431
|
+
const p = e(s.state, i, n);
|
|
432
|
+
if (p)
|
|
433
|
+
return rt({
|
|
434
|
+
...a,
|
|
435
|
+
state: p
|
|
451
436
|
});
|
|
452
|
-
}),
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
437
|
+
}), T(a, (s) => {
|
|
438
|
+
if ([d, x, g].includes(i.type))
|
|
439
|
+
return s;
|
|
440
|
+
const p = i.scope || "global";
|
|
441
|
+
s.operations[p][s.operations[p].length - 1].hash = tt(s, p), !F(i) && i.attachments && i.attachments.forEach((l) => {
|
|
442
|
+
const { hash: r, ...c } = l;
|
|
443
|
+
s.attachments[r] = {
|
|
456
444
|
...c
|
|
457
445
|
};
|
|
458
446
|
});
|
|
459
447
|
});
|
|
460
448
|
}
|
|
461
|
-
function
|
|
462
|
-
return [
|
|
449
|
+
function F(t) {
|
|
450
|
+
return [W, d, x, g, G].includes(t.type);
|
|
463
451
|
}
|
|
464
|
-
function
|
|
452
|
+
function f(t, i, e, n, a = "global") {
|
|
465
453
|
if (!t)
|
|
466
454
|
throw new Error("Empty action type");
|
|
467
455
|
if (typeof t != "string")
|
|
468
456
|
throw new Error(`Invalid action type: ${t}`);
|
|
469
|
-
const s = { type: t, input:
|
|
470
|
-
|
|
457
|
+
const s = { type: t, input: i, scope: a };
|
|
458
|
+
e && (s.attachments = e);
|
|
471
459
|
try {
|
|
472
|
-
|
|
473
|
-
} catch (
|
|
474
|
-
throw new Error(`Invalid action input: ${
|
|
460
|
+
n == null || n().parse(s.input);
|
|
461
|
+
} catch (p) {
|
|
462
|
+
throw new Error(`Invalid action input: ${p}`);
|
|
475
463
|
}
|
|
476
464
|
return s;
|
|
477
465
|
}
|
|
478
|
-
function
|
|
479
|
-
return (
|
|
466
|
+
function Ct(t, i = Y) {
|
|
467
|
+
return (e, n, a) => i(e, n, t, a);
|
|
480
468
|
}
|
|
481
|
-
const
|
|
469
|
+
const Bt = (t, i) => ({
|
|
482
470
|
name: "",
|
|
483
471
|
documentType: "",
|
|
484
472
|
revision: 0,
|
|
@@ -486,72 +474,110 @@ const Jt = (t, e) => ({
|
|
|
486
474
|
lastModified: (/* @__PURE__ */ new Date()).toISOString(),
|
|
487
475
|
attachments: {},
|
|
488
476
|
...t,
|
|
489
|
-
state: (
|
|
490
|
-
}),
|
|
491
|
-
const
|
|
477
|
+
state: (i == null ? void 0 : i(t == null ? void 0 : t.state)) ?? (t == null ? void 0 : t.state) ?? { global: {}, local: {} }
|
|
478
|
+
}), Zt = (t, i) => {
|
|
479
|
+
const e = Bt(
|
|
492
480
|
t,
|
|
493
|
-
|
|
481
|
+
i
|
|
494
482
|
);
|
|
495
483
|
return {
|
|
496
|
-
...
|
|
497
|
-
initialState:
|
|
484
|
+
...e,
|
|
485
|
+
initialState: e,
|
|
498
486
|
operations: { global: [], local: [] }
|
|
499
487
|
};
|
|
500
|
-
},
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
)
|
|
504
|
-
), ie = (t, e = 1e3) => {
|
|
505
|
-
const i = Math.random() * e;
|
|
506
|
-
return b(`${(t ?? /* @__PURE__ */ new Date()).toISOString()}${i}`);
|
|
488
|
+
}, tt = (t, i = "global") => j(ct(t.state[i])), si = (t, i = 1e3) => {
|
|
489
|
+
const e = Math.random() * i;
|
|
490
|
+
return j(`${(t ?? /* @__PURE__ */ new Date()).toISOString()}${e}`);
|
|
507
491
|
};
|
|
508
|
-
function
|
|
509
|
-
return
|
|
492
|
+
function b(t) {
|
|
493
|
+
return mt(ut(t, !0));
|
|
510
494
|
}
|
|
511
|
-
|
|
495
|
+
function Ht(t) {
|
|
496
|
+
return Object.values(t).flatMap((i) => i).sort(
|
|
497
|
+
(i, e) => new Date(i.timestamp).getTime() - new Date(e.timestamp).getTime()
|
|
498
|
+
);
|
|
499
|
+
}
|
|
500
|
+
function v(t, i, e, n, a, s = Y) {
|
|
501
|
+
const p = Ct(e, s);
|
|
502
|
+
return it(
|
|
503
|
+
t,
|
|
504
|
+
i,
|
|
505
|
+
p,
|
|
506
|
+
n,
|
|
507
|
+
a
|
|
508
|
+
);
|
|
509
|
+
}
|
|
510
|
+
function it(t, i, e, n, a) {
|
|
511
|
+
const s = Zt(t), p = {
|
|
512
|
+
...i,
|
|
513
|
+
global: i.global.slice(0, a == null ? void 0 : a.revision)
|
|
514
|
+
}, l = Ht(p).reduce(
|
|
515
|
+
(c, m) => e(c, m, n),
|
|
516
|
+
s
|
|
517
|
+
), r = Object.keys(
|
|
518
|
+
l.operations
|
|
519
|
+
).reduce(
|
|
520
|
+
(c, m) => {
|
|
521
|
+
const u = m, w = u === "global" && a && a.revision < i.global.length ? i.global.slice(a == null ? void 0 : a.revision) : [];
|
|
522
|
+
return {
|
|
523
|
+
...c,
|
|
524
|
+
[u]: [
|
|
525
|
+
...l.operations[u].map((S, st) => ({
|
|
526
|
+
...S,
|
|
527
|
+
timestamp: i[u][st].timestamp
|
|
528
|
+
})),
|
|
529
|
+
...w
|
|
530
|
+
]
|
|
531
|
+
};
|
|
532
|
+
},
|
|
533
|
+
{ global: [], local: [] }
|
|
534
|
+
);
|
|
535
|
+
return { ...l, operations: r };
|
|
536
|
+
}
|
|
537
|
+
const et = (t) => f(
|
|
512
538
|
"SET_NAME",
|
|
513
539
|
t,
|
|
514
540
|
void 0,
|
|
515
|
-
|
|
516
|
-
),
|
|
541
|
+
E
|
|
542
|
+
), at = (t = 1) => f("UNDO", t, void 0, N), nt = (t = 1) => f("REDO", t, void 0, k), ot = (t, i) => f(
|
|
517
543
|
"PRUNE",
|
|
518
|
-
{ start: t, end:
|
|
544
|
+
{ start: t, end: i },
|
|
519
545
|
void 0,
|
|
520
|
-
|
|
521
|
-
),
|
|
546
|
+
D
|
|
547
|
+
), A = (t, i) => f(
|
|
522
548
|
"LOAD_STATE",
|
|
523
|
-
{ state: t, operations:
|
|
549
|
+
{ state: t, operations: i },
|
|
524
550
|
void 0,
|
|
525
|
-
|
|
526
|
-
),
|
|
551
|
+
_
|
|
552
|
+
), pi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
527
553
|
__proto__: null,
|
|
528
|
-
loadState:
|
|
529
|
-
prune:
|
|
530
|
-
redo:
|
|
531
|
-
setName:
|
|
532
|
-
undo:
|
|
554
|
+
loadState: A,
|
|
555
|
+
prune: ot,
|
|
556
|
+
redo: nt,
|
|
557
|
+
setName: et,
|
|
558
|
+
undo: at
|
|
533
559
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
534
|
-
class
|
|
560
|
+
class li {
|
|
535
561
|
/**
|
|
536
562
|
* Constructs a BaseDocument instance with an initial state.
|
|
537
563
|
* @param reducer - The reducer function that updates the state.
|
|
538
564
|
* @param document - The initial state of the document.
|
|
539
565
|
*/
|
|
540
|
-
constructor(
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
this._reducer =
|
|
566
|
+
constructor(i, e, n) {
|
|
567
|
+
h(this, "_document");
|
|
568
|
+
h(this, "_reducer");
|
|
569
|
+
h(this, "_signalDispatch");
|
|
570
|
+
this._reducer = i, this._document = e, this._signalDispatch = n;
|
|
545
571
|
}
|
|
546
572
|
/**
|
|
547
573
|
* Dispatches an action to update the state of the document.
|
|
548
574
|
* @param action - The action to dispatch.
|
|
549
575
|
* @returns The Document instance.
|
|
550
576
|
*/
|
|
551
|
-
dispatch(
|
|
577
|
+
dispatch(i) {
|
|
552
578
|
return this._document = this._reducer(
|
|
553
579
|
this._document,
|
|
554
|
-
|
|
580
|
+
i,
|
|
555
581
|
this._signalDispatch
|
|
556
582
|
), this;
|
|
557
583
|
}
|
|
@@ -561,15 +587,15 @@ class oe {
|
|
|
561
587
|
* @param extension - The file extension to use when saving the state.
|
|
562
588
|
* @returns The file path where the state was saved.
|
|
563
589
|
*/
|
|
564
|
-
saveToFile(
|
|
565
|
-
return
|
|
590
|
+
saveToFile(i, e, n) {
|
|
591
|
+
return qt(this._document, i, e, n);
|
|
566
592
|
}
|
|
567
593
|
/**
|
|
568
594
|
* Loads the state of the document from a file.
|
|
569
595
|
* @param path - The file path where the state is stored.
|
|
570
596
|
*/
|
|
571
|
-
async loadFromFile(
|
|
572
|
-
this._document = await
|
|
597
|
+
async loadFromFile(i) {
|
|
598
|
+
this._document = await z(i, this._reducer);
|
|
573
599
|
}
|
|
574
600
|
/**
|
|
575
601
|
* Loads the state of the document from a file and returns it.
|
|
@@ -577,20 +603,20 @@ class oe {
|
|
|
577
603
|
* @param reducer - The reducer function that updates the state.
|
|
578
604
|
* @returns The state of the document.
|
|
579
605
|
*/
|
|
580
|
-
static async stateFromFile(
|
|
581
|
-
return await
|
|
606
|
+
static async stateFromFile(i, e) {
|
|
607
|
+
return await z(i, e);
|
|
582
608
|
}
|
|
583
609
|
/**
|
|
584
610
|
* Gets the current state of the document.
|
|
585
611
|
*/
|
|
586
612
|
get state() {
|
|
587
|
-
return
|
|
613
|
+
return b(this._document.state);
|
|
588
614
|
}
|
|
589
615
|
/**
|
|
590
616
|
* Gets the list of operations performed on the document.
|
|
591
617
|
*/
|
|
592
618
|
get operations() {
|
|
593
|
-
return
|
|
619
|
+
return b(this._document.operations);
|
|
594
620
|
}
|
|
595
621
|
/**
|
|
596
622
|
* Gets the name of the document.
|
|
@@ -626,89 +652,92 @@ class oe {
|
|
|
626
652
|
* Gets the initial state of the document.
|
|
627
653
|
*/
|
|
628
654
|
get initialState() {
|
|
629
|
-
return
|
|
655
|
+
return b(this._document.initialState);
|
|
630
656
|
}
|
|
631
657
|
/**
|
|
632
658
|
* Returns the current document as an object
|
|
633
659
|
*/
|
|
634
660
|
toDocument() {
|
|
635
|
-
return
|
|
661
|
+
return b(this._document);
|
|
636
662
|
}
|
|
637
663
|
/**
|
|
638
664
|
* Gets the attachment associated with the given key.
|
|
639
665
|
* @param attachment - The key of the attachment to retrieve.
|
|
640
666
|
*/
|
|
641
|
-
getAttachment(
|
|
642
|
-
return this._document.attachments[
|
|
667
|
+
getAttachment(i) {
|
|
668
|
+
return this._document.attachments[i];
|
|
643
669
|
}
|
|
644
670
|
/**
|
|
645
671
|
* Sets the name of the document.
|
|
646
672
|
* @param name - The new name of the document.
|
|
647
673
|
*/
|
|
648
|
-
setName(
|
|
649
|
-
return this.dispatch(
|
|
674
|
+
setName(i) {
|
|
675
|
+
return this.dispatch(et(i)), this;
|
|
650
676
|
}
|
|
651
677
|
/**
|
|
652
678
|
* Reverts a number of actions from the document.
|
|
653
679
|
* @param count - The number of actions to revert.
|
|
654
680
|
*/
|
|
655
|
-
undo(
|
|
656
|
-
return this.dispatch(
|
|
681
|
+
undo(i) {
|
|
682
|
+
return this.dispatch(at(i)), this;
|
|
657
683
|
}
|
|
658
684
|
/**
|
|
659
685
|
* Reapplies a number of actions to the document.
|
|
660
686
|
* @param count - The number of actions to reapply.
|
|
661
687
|
*/
|
|
662
|
-
redo(
|
|
663
|
-
return this.dispatch(
|
|
688
|
+
redo(i) {
|
|
689
|
+
return this.dispatch(nt(i)), this;
|
|
664
690
|
}
|
|
665
691
|
/**
|
|
666
692
|
* Removes a range of operations from the document.
|
|
667
693
|
* @param start - The starting index of the range to remove.
|
|
668
694
|
* @param end - The ending index of the range to remove.
|
|
669
695
|
*/
|
|
670
|
-
prune(
|
|
671
|
-
return this.dispatch(
|
|
696
|
+
prune(i, e) {
|
|
697
|
+
return this.dispatch(ot(i, e)), this;
|
|
672
698
|
}
|
|
673
699
|
/**
|
|
674
700
|
* Loads a document state and a set of operations.
|
|
675
701
|
* @param state - The state to load.
|
|
676
702
|
* @param operations - The operations to apply to the document.
|
|
677
703
|
*/
|
|
678
|
-
loadState(
|
|
679
|
-
return this.dispatch(
|
|
704
|
+
loadState(i, e) {
|
|
705
|
+
return this.dispatch(A(i, e)), this;
|
|
680
706
|
}
|
|
681
707
|
}
|
|
682
|
-
function
|
|
683
|
-
|
|
684
|
-
Object.getOwnPropertyNames(
|
|
708
|
+
function ci(t, i) {
|
|
709
|
+
i.forEach((e) => {
|
|
710
|
+
Object.getOwnPropertyNames(e.prototype).forEach((n) => {
|
|
685
711
|
Object.defineProperty(
|
|
686
712
|
t.prototype,
|
|
687
|
-
|
|
688
|
-
Object.getOwnPropertyDescriptor(
|
|
713
|
+
n,
|
|
714
|
+
Object.getOwnPropertyDescriptor(e.prototype, n) || /* @__PURE__ */ Object.create(null)
|
|
689
715
|
);
|
|
690
716
|
});
|
|
691
717
|
});
|
|
692
718
|
}
|
|
693
719
|
export {
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
720
|
+
li as B,
|
|
721
|
+
Bt as a,
|
|
722
|
+
Zt as b,
|
|
723
|
+
Ct as c,
|
|
724
|
+
ai as d,
|
|
725
|
+
It as e,
|
|
726
|
+
f,
|
|
727
|
+
ci as g,
|
|
728
|
+
pi as h,
|
|
729
|
+
F as i,
|
|
730
|
+
V as j,
|
|
731
|
+
oi as k,
|
|
732
|
+
z as l,
|
|
733
|
+
ni as m,
|
|
734
|
+
tt as n,
|
|
735
|
+
si as o,
|
|
736
|
+
it as p,
|
|
737
|
+
v as q,
|
|
738
|
+
b as r,
|
|
739
|
+
qt as s,
|
|
740
|
+
Ht as t,
|
|
741
|
+
Y as u,
|
|
742
|
+
ei as z
|
|
714
743
|
};
|