document-model 1.0.22 → 1.0.24
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-model.cjs +1 -1
- package/dist/browser/document-model.js +2 -2
- package/dist/browser/document.cjs +1 -1
- package/dist/browser/document.js +4 -4
- package/dist/browser/index.cjs +1 -1
- package/dist/browser/index.js +3 -3
- package/dist/browser/internal/index-Xpydy6AU.js +22 -0
- package/dist/browser/internal/index-e4O5HJBs.js +1 -0
- package/dist/browser/internal/{index-k0_xGFJa.js → index-sfNIE5tQ.js} +400 -398
- package/dist/browser/internal/index-v3lMuqpK.js +36 -0
- package/dist/browser/internal/object-U8CbkcSV.js +6 -0
- package/dist/browser/internal/{object-wtPuW7QY.js → object-YlWt1S0J.js} +407 -357
- package/dist/browser/src/document/actions/creators.d.ts +3 -2
- package/dist/browser/src/document/actions/types.d.ts +1 -1
- package/dist/browser/src/document/object.d.ts +58 -2
- package/dist/browser/src/document/reducer.d.ts +2 -2
- package/dist/browser/src/document/schema/types.d.ts +9 -3
- package/dist/browser/src/document/signal.d.ts +7 -1
- package/dist/browser/src/document/types.d.ts +12 -1
- package/dist/browser/src/document/utils/base.d.ts +15 -2
- package/dist/browser/src/document-model/gen/header/object.d.ts +7 -6
- package/dist/browser/src/document-model/gen/module/object.d.ts +6 -5
- package/dist/browser/src/document-model/gen/operation/object.d.ts +11 -10
- package/dist/browser/src/document-model/gen/operation-error/object.d.ts +8 -7
- package/dist/browser/src/document-model/gen/operation-example/object.d.ts +5 -4
- package/dist/browser/src/document-model/gen/reducer.d.ts +2 -0
- package/dist/browser/src/document-model/gen/state/object.d.ts +7 -6
- package/dist/browser/src/document-model/gen/versioning/object.d.ts +6 -5
- package/dist/browser/src/document-model/index.d.ts +2 -1
- package/dist/browser/test/document/skip-operations.test.d.ts +1 -0
- package/dist/browser/test/document-model/skip-operations.test.d.ts +1 -0
- package/dist/browser/test/helpers.d.ts +5 -2
- package/dist/jest.config.d.ts +8 -0
- package/dist/node/document-model.cjs +1 -1
- package/dist/node/document-model.js +2 -2
- package/dist/node/document.cjs +1 -1
- package/dist/node/document.js +4 -4
- package/dist/node/index.cjs +1 -1
- package/dist/node/index.js +3 -3
- package/dist/node/internal/index-HgkfWSZk.js +36 -0
- package/dist/node/internal/index-PkGY1BML.js +22 -0
- package/dist/node/internal/index-aihhQ-ya.js +1 -0
- package/dist/node/internal/{index-vqhz-N10.js → index-sNi-u40H.js} +400 -398
- package/dist/node/internal/object-Nz1iEXFy.js +1 -0
- package/dist/node/internal/{object-yzJ3jRpE.js → object-T2hpMYZ4.js} +317 -267
- package/dist/node/src/document/actions/creators.d.ts +3 -2
- package/dist/node/src/document/actions/types.d.ts +1 -1
- package/dist/node/src/document/object.d.ts +58 -2
- package/dist/node/src/document/reducer.d.ts +2 -2
- package/dist/node/src/document/schema/types.d.ts +9 -3
- package/dist/node/src/document/signal.d.ts +7 -1
- package/dist/node/src/document/types.d.ts +12 -1
- package/dist/node/src/document/utils/base.d.ts +15 -2
- package/dist/node/src/document-model/gen/header/object.d.ts +7 -6
- package/dist/node/src/document-model/gen/module/object.d.ts +6 -5
- package/dist/node/src/document-model/gen/operation/object.d.ts +11 -10
- package/dist/node/src/document-model/gen/operation-error/object.d.ts +8 -7
- package/dist/node/src/document-model/gen/operation-example/object.d.ts +5 -4
- package/dist/node/src/document-model/gen/reducer.d.ts +2 -0
- package/dist/node/src/document-model/gen/state/object.d.ts +7 -6
- package/dist/node/src/document-model/gen/versioning/object.d.ts +6 -5
- package/dist/node/src/document-model/index.d.ts +2 -1
- package/dist/node/test/document/skip-operations.test.d.ts +1 -0
- package/dist/node/test/document-model/skip-operations.test.d.ts +1 -0
- package/dist/node/test/helpers.d.ts +5 -2
- package/dist/src/document/actions/creators.d.ts +47 -0
- package/dist/src/document/actions/index.d.ts +10 -0
- package/dist/src/document/actions/types.d.ts +8 -0
- package/dist/src/document/index.d.ts +6 -0
- package/dist/src/document/object.d.ts +447 -0
- package/dist/src/document/reducer.d.ts +16 -0
- package/dist/src/document/schema/index.d.ts +2 -0
- package/dist/src/document/schema/types.d.ts +180 -0
- package/dist/src/document/schema/zod.d.ts +113 -0
- package/dist/src/document/signal.d.ts +28 -0
- package/dist/src/document/types.d.ts +201 -0
- package/dist/src/document/utils/base.d.ts +74 -0
- package/dist/src/document/utils/browser.d.ts +10 -0
- package/dist/src/document/utils/file.d.ts +47 -0
- package/dist/src/document/utils/index.d.ts +2 -0
- package/dist/src/document/utils/node.d.ts +9 -0
- package/dist/src/document-model/custom/reducers/header.d.ts +2 -0
- package/dist/src/document-model/custom/reducers/module.d.ts +2 -0
- package/dist/src/document-model/custom/reducers/operation-error.d.ts +2 -0
- package/dist/src/document-model/custom/reducers/operation-example.d.ts +2 -0
- package/dist/src/document-model/custom/reducers/operation.d.ts +2 -0
- package/dist/src/document-model/custom/reducers/state.d.ts +2 -0
- package/dist/src/document-model/custom/reducers/versioning.d.ts +7 -0
- package/dist/src/document-model/custom/utils.d.ts +1 -0
- package/dist/src/document-model/gen/actions.d.ts +15 -0
- package/dist/src/document-model/gen/creators.d.ts +7 -0
- package/dist/src/document-model/gen/document-model.d.ts +2 -0
- package/dist/src/document-model/gen/header/actions.d.ts +9 -0
- package/dist/src/document-model/gen/header/creators.d.ts +8 -0
- package/dist/src/document-model/gen/header/object.d.ts +12 -0
- package/dist/src/document-model/gen/header/operations.d.ts +10 -0
- package/dist/src/document-model/gen/index.d.ts +5 -0
- package/dist/src/document-model/gen/module/actions.d.ts +8 -0
- package/dist/src/document-model/gen/module/creators.d.ts +7 -0
- package/dist/src/document-model/gen/module/object.d.ts +11 -0
- package/dist/src/document-model/gen/module/operations.d.ts +9 -0
- package/dist/src/document-model/gen/object.d.ts +28 -0
- package/dist/src/document-model/gen/operation/actions.d.ts +13 -0
- package/dist/src/document-model/gen/operation/creators.d.ts +12 -0
- package/dist/src/document-model/gen/operation/object.d.ts +16 -0
- package/dist/src/document-model/gen/operation/operations.d.ts +14 -0
- package/dist/src/document-model/gen/operation-error/actions.d.ts +10 -0
- package/dist/src/document-model/gen/operation-error/creators.d.ts +9 -0
- package/dist/src/document-model/gen/operation-error/object.d.ts +13 -0
- package/dist/src/document-model/gen/operation-error/operations.d.ts +11 -0
- package/dist/src/document-model/gen/operation-example/actions.d.ts +7 -0
- package/dist/src/document-model/gen/operation-example/creators.d.ts +6 -0
- package/dist/src/document-model/gen/operation-example/object.d.ts +10 -0
- package/dist/src/document-model/gen/operation-example/operations.d.ts +8 -0
- package/dist/src/document-model/gen/reducer.d.ts +5 -0
- package/dist/src/document-model/gen/schema/index.d.ts +2 -0
- package/dist/src/document-model/gen/schema/types.d.ts +453 -0
- package/dist/src/document-model/gen/schema/zod.d.ts +453 -0
- package/dist/src/document-model/gen/state/actions.d.ts +9 -0
- package/dist/src/document-model/gen/state/creators.d.ts +8 -0
- package/dist/src/document-model/gen/state/object.d.ts +12 -0
- package/dist/src/document-model/gen/state/operations.d.ts +10 -0
- package/dist/src/document-model/gen/types.d.ts +8 -0
- package/dist/src/document-model/gen/utils.d.ts +6 -0
- package/dist/src/document-model/gen/versioning/actions.d.ts +8 -0
- package/dist/src/document-model/gen/versioning/creators.d.ts +7 -0
- package/dist/src/document-model/gen/versioning/object.d.ts +11 -0
- package/dist/src/document-model/gen/versioning/operations.d.ts +9 -0
- package/dist/src/document-model/index.d.ts +75 -0
- package/dist/src/index.d.ts +25 -0
- package/dist/test/document/local.test.d.ts +1 -0
- package/dist/test/document/object.test.d.ts +1 -0
- package/dist/test/document/prune.test.d.ts +1 -0
- package/dist/test/document/redo.test.d.ts +1 -0
- package/dist/test/document/reducer.test.d.ts +1 -0
- package/dist/test/document/skip-operations.test.d.ts +1 -0
- package/dist/test/document/undo.test.d.ts +1 -0
- package/dist/test/document/utils.test.d.ts +1 -0
- package/dist/test/document-model/object.test.d.ts +1 -0
- package/dist/test/document-model/skip-operations.test.d.ts +1 -0
- package/dist/test/document-model/zip.test.d.ts +1 -0
- package/dist/test/helpers.d.ts +32 -0
- package/dist/vite.config.d.ts +2 -0
- package/dist/vitest.config.d.ts +2 -0
- package/package.json +1 -1
- package/dist/browser/internal/index-BGvdUwMj.js +0 -1
- package/dist/browser/internal/index-ZaSXpgfR.js +0 -22
- package/dist/browser/internal/index-vHDbgY8i.js +0 -34
- package/dist/browser/internal/object-fIfH8K9b.js +0 -6
- package/dist/node/internal/index-3_D7m254.js +0 -34
- package/dist/node/internal/index-ffEJwj4v.js +0 -22
- package/dist/node/internal/index-frYzO4l6.js +0 -1
- package/dist/node/internal/object-Vf10stKL.js +0 -1
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import
|
|
5
|
-
import { produce as
|
|
1
|
+
var mt = Object.defineProperty;
|
|
2
|
+
var ut = (t, e, i) => e in t ? mt(t, e, { enumerable: !0, configurable: !0, writable: !0, value: i }) : t[e] = i;
|
|
3
|
+
var w = (t, e, i) => (ut(t, typeof e != "symbol" ? e + "" : e, i), i);
|
|
4
|
+
import dt from "json-stringify-deterministic";
|
|
5
|
+
import { produce as M, castDraft as xt, castImmutable as gt, freeze as ft } from "immer";
|
|
6
6
|
import { z as o } from "zod";
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
7
|
+
import R from "jszip";
|
|
8
|
+
import ht from "crypto";
|
|
9
|
+
import E from "fs";
|
|
10
|
+
import vt from "https";
|
|
11
11
|
import { join as bt } from "path";
|
|
12
|
-
const
|
|
13
|
-
function
|
|
12
|
+
const L = (t) => t != null, yt = o.any().refine((t) => L(t)), U = o.enum(["LOAD_STATE"]), J = o.enum(["PRUNE"]), $ = o.enum(["REDO"]), C = o.enum(["SET_NAME"]), B = o.enum(["UNDO"]);
|
|
13
|
+
function jt() {
|
|
14
14
|
return o.object({
|
|
15
15
|
__typename: o.literal("Action").optional(),
|
|
16
16
|
type: o.string()
|
|
17
17
|
});
|
|
18
18
|
}
|
|
19
|
-
function
|
|
19
|
+
function g() {
|
|
20
20
|
return o.literal("global").or(o.literal("local"));
|
|
21
21
|
}
|
|
22
|
-
function
|
|
22
|
+
function Z() {
|
|
23
23
|
return o.union([
|
|
24
|
-
|
|
25
|
-
K(),
|
|
24
|
+
H(),
|
|
26
25
|
W(),
|
|
27
26
|
G(),
|
|
28
|
-
Q()
|
|
27
|
+
Q(),
|
|
28
|
+
V()
|
|
29
29
|
]);
|
|
30
30
|
}
|
|
31
|
-
function
|
|
31
|
+
function wt() {
|
|
32
32
|
return o.object({
|
|
33
33
|
__typename: o.literal("DocumentFile").optional(),
|
|
34
34
|
data: o.string(),
|
|
@@ -37,26 +37,26 @@ function jt() {
|
|
|
37
37
|
mimeType: o.string()
|
|
38
38
|
});
|
|
39
39
|
}
|
|
40
|
-
function
|
|
40
|
+
function H() {
|
|
41
41
|
return o.object({
|
|
42
|
-
input: o.lazy(() =>
|
|
43
|
-
type:
|
|
44
|
-
scope:
|
|
42
|
+
input: o.lazy(() => N()),
|
|
43
|
+
type: U,
|
|
44
|
+
scope: g()
|
|
45
45
|
});
|
|
46
46
|
}
|
|
47
|
-
function
|
|
47
|
+
function N() {
|
|
48
48
|
return o.object({
|
|
49
49
|
operations: o.number(),
|
|
50
|
-
state: o.lazy(() =>
|
|
50
|
+
state: o.lazy(() => K())
|
|
51
51
|
});
|
|
52
52
|
}
|
|
53
|
-
function
|
|
53
|
+
function K() {
|
|
54
54
|
return o.object({
|
|
55
55
|
data: o.unknown().nullish(),
|
|
56
56
|
name: o.string()
|
|
57
57
|
});
|
|
58
58
|
}
|
|
59
|
-
function
|
|
59
|
+
function St() {
|
|
60
60
|
return o.object({
|
|
61
61
|
__typename: o.literal("Operation").optional(),
|
|
62
62
|
hash: o.string(),
|
|
@@ -65,36 +65,36 @@ function wt() {
|
|
|
65
65
|
type: o.string()
|
|
66
66
|
});
|
|
67
67
|
}
|
|
68
|
-
function
|
|
68
|
+
function W() {
|
|
69
69
|
return o.object({
|
|
70
|
-
input: o.lazy(() =>
|
|
71
|
-
type:
|
|
72
|
-
scope:
|
|
70
|
+
input: o.lazy(() => T()),
|
|
71
|
+
type: J,
|
|
72
|
+
scope: g()
|
|
73
73
|
});
|
|
74
74
|
}
|
|
75
|
-
function
|
|
75
|
+
function T() {
|
|
76
76
|
return o.object({
|
|
77
77
|
end: o.number().nullish(),
|
|
78
78
|
start: o.number().nullish()
|
|
79
79
|
});
|
|
80
80
|
}
|
|
81
81
|
const A = o.number;
|
|
82
|
-
function
|
|
82
|
+
function G() {
|
|
83
83
|
return o.object({
|
|
84
84
|
input: A(),
|
|
85
|
-
type:
|
|
86
|
-
scope:
|
|
85
|
+
type: $,
|
|
86
|
+
scope: g()
|
|
87
87
|
});
|
|
88
88
|
}
|
|
89
|
-
const
|
|
90
|
-
function
|
|
89
|
+
const z = o.string;
|
|
90
|
+
function Q() {
|
|
91
91
|
return o.object({
|
|
92
|
-
input:
|
|
93
|
-
type:
|
|
92
|
+
input: z(),
|
|
93
|
+
type: C,
|
|
94
94
|
scope: o.literal("global")
|
|
95
95
|
});
|
|
96
96
|
}
|
|
97
|
-
function
|
|
97
|
+
function Ot() {
|
|
98
98
|
return o.object({
|
|
99
99
|
__typename: o.literal("SetNameOperation").optional(),
|
|
100
100
|
hash: o.string(),
|
|
@@ -104,51 +104,51 @@ function St() {
|
|
|
104
104
|
type: o.string()
|
|
105
105
|
});
|
|
106
106
|
}
|
|
107
|
-
const
|
|
108
|
-
function
|
|
107
|
+
const F = o.number;
|
|
108
|
+
function V() {
|
|
109
109
|
return o.object({
|
|
110
|
-
input:
|
|
111
|
-
type:
|
|
112
|
-
scope:
|
|
110
|
+
input: F(),
|
|
111
|
+
type: B,
|
|
112
|
+
scope: g()
|
|
113
113
|
});
|
|
114
114
|
}
|
|
115
|
-
const
|
|
115
|
+
const pe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
116
116
|
__proto__: null,
|
|
117
|
-
ActionSchema:
|
|
118
|
-
BaseActionSchema:
|
|
119
|
-
DocumentFileSchema:
|
|
120
|
-
LoadStateActionInputSchema:
|
|
121
|
-
LoadStateActionSchema:
|
|
122
|
-
LoadStateActionStateInputSchema:
|
|
123
|
-
Load_StateSchema:
|
|
124
|
-
OperationSchema:
|
|
125
|
-
OperationScopeSchema:
|
|
126
|
-
PruneActionInputSchema:
|
|
127
|
-
PruneActionSchema:
|
|
128
|
-
PruneSchema:
|
|
117
|
+
ActionSchema: jt,
|
|
118
|
+
BaseActionSchema: Z,
|
|
119
|
+
DocumentFileSchema: wt,
|
|
120
|
+
LoadStateActionInputSchema: N,
|
|
121
|
+
LoadStateActionSchema: H,
|
|
122
|
+
LoadStateActionStateInputSchema: K,
|
|
123
|
+
Load_StateSchema: U,
|
|
124
|
+
OperationSchema: St,
|
|
125
|
+
OperationScopeSchema: g,
|
|
126
|
+
PruneActionInputSchema: T,
|
|
127
|
+
PruneActionSchema: W,
|
|
128
|
+
PruneSchema: J,
|
|
129
129
|
RedoActionInputSchema: A,
|
|
130
|
-
RedoActionSchema:
|
|
131
|
-
RedoSchema:
|
|
132
|
-
SetNameActionInputSchema:
|
|
133
|
-
SetNameActionSchema:
|
|
134
|
-
SetNameOperationSchema:
|
|
135
|
-
Set_NameSchema:
|
|
136
|
-
UndoActionInputSchema:
|
|
137
|
-
UndoActionSchema:
|
|
138
|
-
UndoSchema:
|
|
139
|
-
definedNonNullAnySchema:
|
|
140
|
-
isDefinedNonNullAny:
|
|
130
|
+
RedoActionSchema: G,
|
|
131
|
+
RedoSchema: $,
|
|
132
|
+
SetNameActionInputSchema: z,
|
|
133
|
+
SetNameActionSchema: Q,
|
|
134
|
+
SetNameOperationSchema: Ot,
|
|
135
|
+
Set_NameSchema: C,
|
|
136
|
+
UndoActionInputSchema: F,
|
|
137
|
+
UndoActionSchema: V,
|
|
138
|
+
UndoSchema: B,
|
|
139
|
+
definedNonNullAnySchema: yt,
|
|
140
|
+
isDefinedNonNullAny: L
|
|
141
141
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
142
|
-
function
|
|
142
|
+
function _t(t, e) {
|
|
143
143
|
return { ...t, name: e };
|
|
144
144
|
}
|
|
145
|
-
function
|
|
145
|
+
function kt(t, e, i) {
|
|
146
146
|
const { scope: a, input: n } = e, s = t.revision[e.scope], p = Math.min(n, s), l = t.operations[a].slice(
|
|
147
147
|
0,
|
|
148
148
|
s - p
|
|
149
149
|
);
|
|
150
150
|
return {
|
|
151
|
-
...
|
|
151
|
+
...O(
|
|
152
152
|
t.initialState,
|
|
153
153
|
{
|
|
154
154
|
...t.operations,
|
|
@@ -172,7 +172,7 @@ function Dt(t, e, i) {
|
|
|
172
172
|
t.revision[a] + p
|
|
173
173
|
);
|
|
174
174
|
return {
|
|
175
|
-
...
|
|
175
|
+
...O(
|
|
176
176
|
t.initialState,
|
|
177
177
|
{
|
|
178
178
|
...t.operations,
|
|
@@ -187,62 +187,62 @@ function Dt(t, e, i) {
|
|
|
187
187
|
}
|
|
188
188
|
};
|
|
189
189
|
}
|
|
190
|
-
function
|
|
190
|
+
function Et(t, e, i) {
|
|
191
191
|
const { scope: a } = e, n = t.operations[a];
|
|
192
192
|
let {
|
|
193
193
|
input: { start: s, end: p }
|
|
194
194
|
} = e;
|
|
195
195
|
s = s || 0, p = p || n.length;
|
|
196
|
-
const l = n.slice(s, p),
|
|
196
|
+
const l = n.slice(s, p), c = n.slice(0, s), m = n.slice(p), u = O(
|
|
197
197
|
t.initialState,
|
|
198
198
|
{
|
|
199
199
|
...t.operations,
|
|
200
|
-
[a]:
|
|
200
|
+
[a]: c.concat(l)
|
|
201
201
|
},
|
|
202
202
|
i
|
|
203
|
-
), { name:
|
|
204
|
-
return
|
|
203
|
+
), { name: d, state: r } = u, b = c.length, y = c.length ? c[c.length - 1].timestamp : m.length ? m[0].timestamp : (/* @__PURE__ */ new Date()).toISOString();
|
|
204
|
+
return O(
|
|
205
205
|
t.initialState,
|
|
206
206
|
{
|
|
207
207
|
...t.operations,
|
|
208
208
|
[a]: [
|
|
209
|
-
...
|
|
209
|
+
...c,
|
|
210
210
|
{
|
|
211
|
-
...
|
|
212
|
-
{ name:
|
|
211
|
+
...I(
|
|
212
|
+
{ name: d, state: r },
|
|
213
213
|
l.length
|
|
214
214
|
),
|
|
215
|
-
timestamp:
|
|
216
|
-
index:
|
|
217
|
-
hash:
|
|
215
|
+
timestamp: y,
|
|
216
|
+
index: b,
|
|
217
|
+
hash: nt({ state: r }, "global")
|
|
218
218
|
},
|
|
219
|
-
...
|
|
220
|
-
...
|
|
221
|
-
index:
|
|
219
|
+
...m.map((D, j) => ({
|
|
220
|
+
...D,
|
|
221
|
+
index: b + j + 1
|
|
222
222
|
}))
|
|
223
223
|
]
|
|
224
224
|
},
|
|
225
225
|
i
|
|
226
226
|
);
|
|
227
227
|
}
|
|
228
|
-
function
|
|
228
|
+
function Nt(t, e) {
|
|
229
229
|
return {
|
|
230
230
|
...t,
|
|
231
231
|
name: e.name,
|
|
232
232
|
state: e.state ?? { global: {}, local: {} }
|
|
233
233
|
};
|
|
234
234
|
}
|
|
235
|
-
const
|
|
236
|
-
function
|
|
235
|
+
const X = "SET_NAME", f = "UNDO", h = "REDO", v = "PRUNE", Y = "LOAD_STATE";
|
|
236
|
+
function Tt(t) {
|
|
237
237
|
return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
|
|
238
238
|
}
|
|
239
|
-
function
|
|
239
|
+
function _() {
|
|
240
240
|
this._types = /* @__PURE__ */ Object.create(null), this._extensions = /* @__PURE__ */ Object.create(null);
|
|
241
241
|
for (let t = 0; t < arguments.length; t++)
|
|
242
242
|
this.define(arguments[t]);
|
|
243
243
|
this.define = this.define.bind(this), this.getType = this.getType.bind(this), this.getExtension = this.getExtension.bind(this);
|
|
244
244
|
}
|
|
245
|
-
|
|
245
|
+
_.prototype.define = function(t, e) {
|
|
246
246
|
for (let i in t) {
|
|
247
247
|
let a = t[i].map(function(n) {
|
|
248
248
|
return n.toLowerCase();
|
|
@@ -264,23 +264,23 @@ O.prototype.define = function(t, e) {
|
|
|
264
264
|
}
|
|
265
265
|
}
|
|
266
266
|
};
|
|
267
|
-
|
|
267
|
+
_.prototype.getType = function(t) {
|
|
268
268
|
t = String(t);
|
|
269
269
|
let e = t.replace(/^.*[/\\]/, "").toLowerCase(), i = e.replace(/^.*\./, "").toLowerCase(), a = e.length < t.length;
|
|
270
270
|
return (i.length < e.length - 1 || !a) && this._types[i] || null;
|
|
271
271
|
};
|
|
272
|
-
|
|
272
|
+
_.prototype.getExtension = function(t) {
|
|
273
273
|
return t = /^\s*([^;\s]*)/.test(t) && RegExp.$1, t && this._extensions[t.toLowerCase()] || null;
|
|
274
274
|
};
|
|
275
|
-
var At = O, Tt = { "application/andrew-inset": ["ez"], "application/applixware": ["aw"], "application/atom+xml": ["atom"], "application/atomcat+xml": ["atomcat"], "application/atomdeleted+xml": ["atomdeleted"], "application/atomsvc+xml": ["atomsvc"], "application/atsc-dwd+xml": ["dwd"], "application/atsc-held+xml": ["held"], "application/atsc-rsat+xml": ["rsat"], "application/bdoc": ["bdoc"], "application/calendar+xml": ["xcs"], "application/ccxml+xml": ["ccxml"], "application/cdfx+xml": ["cdfx"], "application/cdmi-capability": ["cdmia"], "application/cdmi-container": ["cdmic"], "application/cdmi-domain": ["cdmid"], "application/cdmi-object": ["cdmio"], "application/cdmi-queue": ["cdmiq"], "application/cu-seeme": ["cu"], "application/dash+xml": ["mpd"], "application/davmount+xml": ["davmount"], "application/docbook+xml": ["dbk"], "application/dssc+der": ["dssc"], "application/dssc+xml": ["xdssc"], "application/ecmascript": ["es", "ecma"], "application/emma+xml": ["emma"], "application/emotionml+xml": ["emotionml"], "application/epub+zip": ["epub"], "application/exi": ["exi"], "application/express": ["exp"], "application/fdt+xml": ["fdt"], "application/font-tdpfr": ["pfr"], "application/geo+json": ["geojson"], "application/gml+xml": ["gml"], "application/gpx+xml": ["gpx"], "application/gxf": ["gxf"], "application/gzip": ["gz"], "application/hjson": ["hjson"], "application/hyperstudio": ["stk"], "application/inkml+xml": ["ink", "inkml"], "application/ipfix": ["ipfix"], "application/its+xml": ["its"], "application/java-archive": ["jar", "war", "ear"], "application/java-serialized-object": ["ser"], "application/java-vm": ["class"], "application/javascript": ["js", "mjs"], "application/json": ["json", "map"], "application/json5": ["json5"], "application/jsonml+json": ["jsonml"], "application/ld+json": ["jsonld"], "application/lgr+xml": ["lgr"], "application/lost+xml": ["lostxml"], "application/mac-binhex40": ["hqx"], "application/mac-compactpro": ["cpt"], "application/mads+xml": ["mads"], "application/manifest+json": ["webmanifest"], "application/marc": ["mrc"], "application/marcxml+xml": ["mrcx"], "application/mathematica": ["ma", "nb", "mb"], "application/mathml+xml": ["mathml"], "application/mbox": ["mbox"], "application/mediaservercontrol+xml": ["mscml"], "application/metalink+xml": ["metalink"], "application/metalink4+xml": ["meta4"], "application/mets+xml": ["mets"], "application/mmt-aei+xml": ["maei"], "application/mmt-usd+xml": ["musd"], "application/mods+xml": ["mods"], "application/mp21": ["m21", "mp21"], "application/mp4": ["mp4s", "m4p"], "application/msword": ["doc", "dot"], "application/mxf": ["mxf"], "application/n-quads": ["nq"], "application/n-triples": ["nt"], "application/node": ["cjs"], "application/octet-stream": ["bin", "dms", "lrf", "mar", "so", "dist", "distz", "pkg", "bpk", "dump", "elc", "deploy", "exe", "dll", "deb", "dmg", "iso", "img", "msi", "msp", "msm", "buffer"], "application/oda": ["oda"], "application/oebps-package+xml": ["opf"], "application/ogg": ["ogx"], "application/omdoc+xml": ["omdoc"], "application/onenote": ["onetoc", "onetoc2", "onetmp", "onepkg"], "application/oxps": ["oxps"], "application/p2p-overlay+xml": ["relo"], "application/patch-ops-error+xml": ["xer"], "application/pdf": ["pdf"], "application/pgp-encrypted": ["pgp"], "application/pgp-signature": ["asc", "sig"], "application/pics-rules": ["prf"], "application/pkcs10": ["p10"], "application/pkcs7-mime": ["p7m", "p7c"], "application/pkcs7-signature": ["p7s"], "application/pkcs8": ["p8"], "application/pkix-attr-cert": ["ac"], "application/pkix-cert": ["cer"], "application/pkix-crl": ["crl"], "application/pkix-pkipath": ["pkipath"], "application/pkixcmp": ["pki"], "application/pls+xml": ["pls"], "application/postscript": ["ai", "eps", "ps"], "application/provenance+xml": ["provx"], "application/pskc+xml": ["pskcxml"], "application/raml+yaml": ["raml"], "application/rdf+xml": ["rdf", "owl"], "application/reginfo+xml": ["rif"], "application/relax-ng-compact-syntax": ["rnc"], "application/resource-lists+xml": ["rl"], "application/resource-lists-diff+xml": ["rld"], "application/rls-services+xml": ["rs"], "application/route-apd+xml": ["rapd"], "application/route-s-tsid+xml": ["sls"], "application/route-usd+xml": ["rusd"], "application/rpki-ghostbusters": ["gbr"], "application/rpki-manifest": ["mft"], "application/rpki-roa": ["roa"], "application/rsd+xml": ["rsd"], "application/rss+xml": ["rss"], "application/rtf": ["rtf"], "application/sbml+xml": ["sbml"], "application/scvp-cv-request": ["scq"], "application/scvp-cv-response": ["scs"], "application/scvp-vp-request": ["spq"], "application/scvp-vp-response": ["spp"], "application/sdp": ["sdp"], "application/senml+xml": ["senmlx"], "application/sensml+xml": ["sensmlx"], "application/set-payment-initiation": ["setpay"], "application/set-registration-initiation": ["setreg"], "application/shf+xml": ["shf"], "application/sieve": ["siv", "sieve"], "application/smil+xml": ["smi", "smil"], "application/sparql-query": ["rq"], "application/sparql-results+xml": ["srx"], "application/srgs": ["gram"], "application/srgs+xml": ["grxml"], "application/sru+xml": ["sru"], "application/ssdl+xml": ["ssdl"], "application/ssml+xml": ["ssml"], "application/swid+xml": ["swidtag"], "application/tei+xml": ["tei", "teicorpus"], "application/thraud+xml": ["tfi"], "application/timestamped-data": ["tsd"], "application/toml": ["toml"], "application/trig": ["trig"], "application/ttml+xml": ["ttml"], "application/ubjson": ["ubj"], "application/urc-ressheet+xml": ["rsheet"], "application/urc-targetdesc+xml": ["td"], "application/voicexml+xml": ["vxml"], "application/wasm": ["wasm"], "application/widget": ["wgt"], "application/winhlp": ["hlp"], "application/wsdl+xml": ["wsdl"], "application/wspolicy+xml": ["wspolicy"], "application/xaml+xml": ["xaml"], "application/xcap-att+xml": ["xav"], "application/xcap-caps+xml": ["xca"], "application/xcap-diff+xml": ["xdf"], "application/xcap-el+xml": ["xel"], "application/xcap-ns+xml": ["xns"], "application/xenc+xml": ["xenc"], "application/xhtml+xml": ["xhtml", "xht"], "application/xliff+xml": ["xlf"], "application/xml": ["xml", "xsl", "xsd", "rng"], "application/xml-dtd": ["dtd"], "application/xop+xml": ["xop"], "application/xproc+xml": ["xpl"], "application/xslt+xml": ["*xsl", "xslt"], "application/xspf+xml": ["xspf"], "application/xv+xml": ["mxml", "xhvml", "xvml", "xvm"], "application/yang": ["yang"], "application/yin+xml": ["yin"], "application/zip": ["zip"], "audio/3gpp": ["*3gpp"], "audio/adpcm": ["adp"], "audio/amr": ["amr"], "audio/basic": ["au", "snd"], "audio/midi": ["mid", "midi", "kar", "rmi"], "audio/mobile-xmf": ["mxmf"], "audio/mp3": ["*mp3"], "audio/mp4": ["m4a", "mp4a"], "audio/mpeg": ["mpga", "mp2", "mp2a", "mp3", "m2a", "m3a"], "audio/ogg": ["oga", "ogg", "spx", "opus"], "audio/s3m": ["s3m"], "audio/silk": ["sil"], "audio/wav": ["wav"], "audio/wave": ["*wav"], "audio/webm": ["weba"], "audio/xm": ["xm"], "font/collection": ["ttc"], "font/otf": ["otf"], "font/ttf": ["ttf"], "font/woff": ["woff"], "font/woff2": ["woff2"], "image/aces": ["exr"], "image/apng": ["apng"], "image/avif": ["avif"], "image/bmp": ["bmp"], "image/cgm": ["cgm"], "image/dicom-rle": ["drle"], "image/emf": ["emf"], "image/fits": ["fits"], "image/g3fax": ["g3"], "image/gif": ["gif"], "image/heic": ["heic"], "image/heic-sequence": ["heics"], "image/heif": ["heif"], "image/heif-sequence": ["heifs"], "image/hej2k": ["hej2"], "image/hsj2": ["hsj2"], "image/ief": ["ief"], "image/jls": ["jls"], "image/jp2": ["jp2", "jpg2"], "image/jpeg": ["jpeg", "jpg", "jpe"], "image/jph": ["jph"], "image/jphc": ["jhc"], "image/jpm": ["jpm"], "image/jpx": ["jpx", "jpf"], "image/jxr": ["jxr"], "image/jxra": ["jxra"], "image/jxrs": ["jxrs"], "image/jxs": ["jxs"], "image/jxsc": ["jxsc"], "image/jxsi": ["jxsi"], "image/jxss": ["jxss"], "image/ktx": ["ktx"], "image/ktx2": ["ktx2"], "image/png": ["png"], "image/sgi": ["sgi"], "image/svg+xml": ["svg", "svgz"], "image/t38": ["t38"], "image/tiff": ["tif", "tiff"], "image/tiff-fx": ["tfx"], "image/webp": ["webp"], "image/wmf": ["wmf"], "message/disposition-notification": ["disposition-notification"], "message/global": ["u8msg"], "message/global-delivery-status": ["u8dsn"], "message/global-disposition-notification": ["u8mdn"], "message/global-headers": ["u8hdr"], "message/rfc822": ["eml", "mime"], "model/3mf": ["3mf"], "model/gltf+json": ["gltf"], "model/gltf-binary": ["glb"], "model/iges": ["igs", "iges"], "model/mesh": ["msh", "mesh", "silo"], "model/mtl": ["mtl"], "model/obj": ["obj"], "model/step+xml": ["stpx"], "model/step+zip": ["stpz"], "model/step-xml+zip": ["stpxz"], "model/stl": ["stl"], "model/vrml": ["wrl", "vrml"], "model/x3d+binary": ["*x3db", "x3dbz"], "model/x3d+fastinfoset": ["x3db"], "model/x3d+vrml": ["*x3dv", "x3dvz"], "model/x3d+xml": ["x3d", "x3dz"], "model/x3d-vrml": ["x3dv"], "text/cache-manifest": ["appcache", "manifest"], "text/calendar": ["ics", "ifb"], "text/coffeescript": ["coffee", "litcoffee"], "text/css": ["css"], "text/csv": ["csv"], "text/html": ["html", "htm", "shtml"], "text/jade": ["jade"], "text/jsx": ["jsx"], "text/less": ["less"], "text/markdown": ["markdown", "md"], "text/mathml": ["mml"], "text/mdx": ["mdx"], "text/n3": ["n3"], "text/plain": ["txt", "text", "conf", "def", "list", "log", "in", "ini"], "text/richtext": ["rtx"], "text/rtf": ["*rtf"], "text/sgml": ["sgml", "sgm"], "text/shex": ["shex"], "text/slim": ["slim", "slm"], "text/spdx": ["spdx"], "text/stylus": ["stylus", "styl"], "text/tab-separated-values": ["tsv"], "text/troff": ["t", "tr", "roff", "man", "me", "ms"], "text/turtle": ["ttl"], "text/uri-list": ["uri", "uris", "urls"], "text/vcard": ["vcard"], "text/vtt": ["vtt"], "text/xml": ["*xml"], "text/yaml": ["yaml", "yml"], "video/3gpp": ["3gp", "3gpp"], "video/3gpp2": ["3g2"], "video/h261": ["h261"], "video/h263": ["h263"], "video/h264": ["h264"], "video/iso.segment": ["m4s"], "video/jpeg": ["jpgv"], "video/jpm": ["*jpm", "jpgm"], "video/mj2": ["mj2", "mjp2"], "video/mp2t": ["ts"], "video/mp4": ["mp4", "mp4v", "mpg4"], "video/mpeg": ["mpeg", "mpg", "mpe", "m1v", "m2v"], "video/ogg": ["ogv"], "video/quicktime": ["qt", "mov"], "video/webm": ["webm"] };
|
|
276
|
-
let
|
|
277
|
-
var
|
|
278
|
-
const
|
|
279
|
-
function
|
|
275
|
+
var At = _, zt = { "application/andrew-inset": ["ez"], "application/applixware": ["aw"], "application/atom+xml": ["atom"], "application/atomcat+xml": ["atomcat"], "application/atomdeleted+xml": ["atomdeleted"], "application/atomsvc+xml": ["atomsvc"], "application/atsc-dwd+xml": ["dwd"], "application/atsc-held+xml": ["held"], "application/atsc-rsat+xml": ["rsat"], "application/bdoc": ["bdoc"], "application/calendar+xml": ["xcs"], "application/ccxml+xml": ["ccxml"], "application/cdfx+xml": ["cdfx"], "application/cdmi-capability": ["cdmia"], "application/cdmi-container": ["cdmic"], "application/cdmi-domain": ["cdmid"], "application/cdmi-object": ["cdmio"], "application/cdmi-queue": ["cdmiq"], "application/cu-seeme": ["cu"], "application/dash+xml": ["mpd"], "application/davmount+xml": ["davmount"], "application/docbook+xml": ["dbk"], "application/dssc+der": ["dssc"], "application/dssc+xml": ["xdssc"], "application/ecmascript": ["es", "ecma"], "application/emma+xml": ["emma"], "application/emotionml+xml": ["emotionml"], "application/epub+zip": ["epub"], "application/exi": ["exi"], "application/express": ["exp"], "application/fdt+xml": ["fdt"], "application/font-tdpfr": ["pfr"], "application/geo+json": ["geojson"], "application/gml+xml": ["gml"], "application/gpx+xml": ["gpx"], "application/gxf": ["gxf"], "application/gzip": ["gz"], "application/hjson": ["hjson"], "application/hyperstudio": ["stk"], "application/inkml+xml": ["ink", "inkml"], "application/ipfix": ["ipfix"], "application/its+xml": ["its"], "application/java-archive": ["jar", "war", "ear"], "application/java-serialized-object": ["ser"], "application/java-vm": ["class"], "application/javascript": ["js", "mjs"], "application/json": ["json", "map"], "application/json5": ["json5"], "application/jsonml+json": ["jsonml"], "application/ld+json": ["jsonld"], "application/lgr+xml": ["lgr"], "application/lost+xml": ["lostxml"], "application/mac-binhex40": ["hqx"], "application/mac-compactpro": ["cpt"], "application/mads+xml": ["mads"], "application/manifest+json": ["webmanifest"], "application/marc": ["mrc"], "application/marcxml+xml": ["mrcx"], "application/mathematica": ["ma", "nb", "mb"], "application/mathml+xml": ["mathml"], "application/mbox": ["mbox"], "application/mediaservercontrol+xml": ["mscml"], "application/metalink+xml": ["metalink"], "application/metalink4+xml": ["meta4"], "application/mets+xml": ["mets"], "application/mmt-aei+xml": ["maei"], "application/mmt-usd+xml": ["musd"], "application/mods+xml": ["mods"], "application/mp21": ["m21", "mp21"], "application/mp4": ["mp4s", "m4p"], "application/msword": ["doc", "dot"], "application/mxf": ["mxf"], "application/n-quads": ["nq"], "application/n-triples": ["nt"], "application/node": ["cjs"], "application/octet-stream": ["bin", "dms", "lrf", "mar", "so", "dist", "distz", "pkg", "bpk", "dump", "elc", "deploy", "exe", "dll", "deb", "dmg", "iso", "img", "msi", "msp", "msm", "buffer"], "application/oda": ["oda"], "application/oebps-package+xml": ["opf"], "application/ogg": ["ogx"], "application/omdoc+xml": ["omdoc"], "application/onenote": ["onetoc", "onetoc2", "onetmp", "onepkg"], "application/oxps": ["oxps"], "application/p2p-overlay+xml": ["relo"], "application/patch-ops-error+xml": ["xer"], "application/pdf": ["pdf"], "application/pgp-encrypted": ["pgp"], "application/pgp-signature": ["asc", "sig"], "application/pics-rules": ["prf"], "application/pkcs10": ["p10"], "application/pkcs7-mime": ["p7m", "p7c"], "application/pkcs7-signature": ["p7s"], "application/pkcs8": ["p8"], "application/pkix-attr-cert": ["ac"], "application/pkix-cert": ["cer"], "application/pkix-crl": ["crl"], "application/pkix-pkipath": ["pkipath"], "application/pkixcmp": ["pki"], "application/pls+xml": ["pls"], "application/postscript": ["ai", "eps", "ps"], "application/provenance+xml": ["provx"], "application/pskc+xml": ["pskcxml"], "application/raml+yaml": ["raml"], "application/rdf+xml": ["rdf", "owl"], "application/reginfo+xml": ["rif"], "application/relax-ng-compact-syntax": ["rnc"], "application/resource-lists+xml": ["rl"], "application/resource-lists-diff+xml": ["rld"], "application/rls-services+xml": ["rs"], "application/route-apd+xml": ["rapd"], "application/route-s-tsid+xml": ["sls"], "application/route-usd+xml": ["rusd"], "application/rpki-ghostbusters": ["gbr"], "application/rpki-manifest": ["mft"], "application/rpki-roa": ["roa"], "application/rsd+xml": ["rsd"], "application/rss+xml": ["rss"], "application/rtf": ["rtf"], "application/sbml+xml": ["sbml"], "application/scvp-cv-request": ["scq"], "application/scvp-cv-response": ["scs"], "application/scvp-vp-request": ["spq"], "application/scvp-vp-response": ["spp"], "application/sdp": ["sdp"], "application/senml+xml": ["senmlx"], "application/sensml+xml": ["sensmlx"], "application/set-payment-initiation": ["setpay"], "application/set-registration-initiation": ["setreg"], "application/shf+xml": ["shf"], "application/sieve": ["siv", "sieve"], "application/smil+xml": ["smi", "smil"], "application/sparql-query": ["rq"], "application/sparql-results+xml": ["srx"], "application/srgs": ["gram"], "application/srgs+xml": ["grxml"], "application/sru+xml": ["sru"], "application/ssdl+xml": ["ssdl"], "application/ssml+xml": ["ssml"], "application/swid+xml": ["swidtag"], "application/tei+xml": ["tei", "teicorpus"], "application/thraud+xml": ["tfi"], "application/timestamped-data": ["tsd"], "application/toml": ["toml"], "application/trig": ["trig"], "application/ttml+xml": ["ttml"], "application/ubjson": ["ubj"], "application/urc-ressheet+xml": ["rsheet"], "application/urc-targetdesc+xml": ["td"], "application/voicexml+xml": ["vxml"], "application/wasm": ["wasm"], "application/widget": ["wgt"], "application/winhlp": ["hlp"], "application/wsdl+xml": ["wsdl"], "application/wspolicy+xml": ["wspolicy"], "application/xaml+xml": ["xaml"], "application/xcap-att+xml": ["xav"], "application/xcap-caps+xml": ["xca"], "application/xcap-diff+xml": ["xdf"], "application/xcap-el+xml": ["xel"], "application/xcap-ns+xml": ["xns"], "application/xenc+xml": ["xenc"], "application/xhtml+xml": ["xhtml", "xht"], "application/xliff+xml": ["xlf"], "application/xml": ["xml", "xsl", "xsd", "rng"], "application/xml-dtd": ["dtd"], "application/xop+xml": ["xop"], "application/xproc+xml": ["xpl"], "application/xslt+xml": ["*xsl", "xslt"], "application/xspf+xml": ["xspf"], "application/xv+xml": ["mxml", "xhvml", "xvml", "xvm"], "application/yang": ["yang"], "application/yin+xml": ["yin"], "application/zip": ["zip"], "audio/3gpp": ["*3gpp"], "audio/adpcm": ["adp"], "audio/amr": ["amr"], "audio/basic": ["au", "snd"], "audio/midi": ["mid", "midi", "kar", "rmi"], "audio/mobile-xmf": ["mxmf"], "audio/mp3": ["*mp3"], "audio/mp4": ["m4a", "mp4a"], "audio/mpeg": ["mpga", "mp2", "mp2a", "mp3", "m2a", "m3a"], "audio/ogg": ["oga", "ogg", "spx", "opus"], "audio/s3m": ["s3m"], "audio/silk": ["sil"], "audio/wav": ["wav"], "audio/wave": ["*wav"], "audio/webm": ["weba"], "audio/xm": ["xm"], "font/collection": ["ttc"], "font/otf": ["otf"], "font/ttf": ["ttf"], "font/woff": ["woff"], "font/woff2": ["woff2"], "image/aces": ["exr"], "image/apng": ["apng"], "image/avif": ["avif"], "image/bmp": ["bmp"], "image/cgm": ["cgm"], "image/dicom-rle": ["drle"], "image/emf": ["emf"], "image/fits": ["fits"], "image/g3fax": ["g3"], "image/gif": ["gif"], "image/heic": ["heic"], "image/heic-sequence": ["heics"], "image/heif": ["heif"], "image/heif-sequence": ["heifs"], "image/hej2k": ["hej2"], "image/hsj2": ["hsj2"], "image/ief": ["ief"], "image/jls": ["jls"], "image/jp2": ["jp2", "jpg2"], "image/jpeg": ["jpeg", "jpg", "jpe"], "image/jph": ["jph"], "image/jphc": ["jhc"], "image/jpm": ["jpm"], "image/jpx": ["jpx", "jpf"], "image/jxr": ["jxr"], "image/jxra": ["jxra"], "image/jxrs": ["jxrs"], "image/jxs": ["jxs"], "image/jxsc": ["jxsc"], "image/jxsi": ["jxsi"], "image/jxss": ["jxss"], "image/ktx": ["ktx"], "image/ktx2": ["ktx2"], "image/png": ["png"], "image/sgi": ["sgi"], "image/svg+xml": ["svg", "svgz"], "image/t38": ["t38"], "image/tiff": ["tif", "tiff"], "image/tiff-fx": ["tfx"], "image/webp": ["webp"], "image/wmf": ["wmf"], "message/disposition-notification": ["disposition-notification"], "message/global": ["u8msg"], "message/global-delivery-status": ["u8dsn"], "message/global-disposition-notification": ["u8mdn"], "message/global-headers": ["u8hdr"], "message/rfc822": ["eml", "mime"], "model/3mf": ["3mf"], "model/gltf+json": ["gltf"], "model/gltf-binary": ["glb"], "model/iges": ["igs", "iges"], "model/mesh": ["msh", "mesh", "silo"], "model/mtl": ["mtl"], "model/obj": ["obj"], "model/step+xml": ["stpx"], "model/step+zip": ["stpz"], "model/step-xml+zip": ["stpxz"], "model/stl": ["stl"], "model/vrml": ["wrl", "vrml"], "model/x3d+binary": ["*x3db", "x3dbz"], "model/x3d+fastinfoset": ["x3db"], "model/x3d+vrml": ["*x3dv", "x3dvz"], "model/x3d+xml": ["x3d", "x3dz"], "model/x3d-vrml": ["x3dv"], "text/cache-manifest": ["appcache", "manifest"], "text/calendar": ["ics", "ifb"], "text/coffeescript": ["coffee", "litcoffee"], "text/css": ["css"], "text/csv": ["csv"], "text/html": ["html", "htm", "shtml"], "text/jade": ["jade"], "text/jsx": ["jsx"], "text/less": ["less"], "text/markdown": ["markdown", "md"], "text/mathml": ["mml"], "text/mdx": ["mdx"], "text/n3": ["n3"], "text/plain": ["txt", "text", "conf", "def", "list", "log", "in", "ini"], "text/richtext": ["rtx"], "text/rtf": ["*rtf"], "text/sgml": ["sgml", "sgm"], "text/shex": ["shex"], "text/slim": ["slim", "slm"], "text/spdx": ["spdx"], "text/stylus": ["stylus", "styl"], "text/tab-separated-values": ["tsv"], "text/troff": ["t", "tr", "roff", "man", "me", "ms"], "text/turtle": ["ttl"], "text/uri-list": ["uri", "uris", "urls"], "text/vcard": ["vcard"], "text/vtt": ["vtt"], "text/xml": ["*xml"], "text/yaml": ["yaml", "yml"], "video/3gpp": ["3gp", "3gpp"], "video/3gpp2": ["3g2"], "video/h261": ["h261"], "video/h263": ["h263"], "video/h264": ["h264"], "video/iso.segment": ["m4s"], "video/jpeg": ["jpgv"], "video/jpm": ["*jpm", "jpgm"], "video/mj2": ["mj2", "mjp2"], "video/mp2t": ["ts"], "video/mp4": ["mp4", "mp4v", "mpg4"], "video/mpeg": ["mpeg", "mpg", "mpe", "m1v", "m2v"], "video/ogg": ["ogv"], "video/quicktime": ["qt", "mov"], "video/webm": ["webm"] };
|
|
276
|
+
let Ft = At;
|
|
277
|
+
var It = new Ft(zt);
|
|
278
|
+
const Mt = /* @__PURE__ */ Tt(It);
|
|
279
|
+
function Pt(t, e, i) {
|
|
280
280
|
const a = bt(t, e);
|
|
281
|
-
return
|
|
281
|
+
return E.mkdirSync(t, { recursive: !0 }), new Promise((n, s) => {
|
|
282
282
|
try {
|
|
283
|
-
|
|
283
|
+
E.writeFile(a, i, {}, (p) => {
|
|
284
284
|
p ? s(p) : n(a);
|
|
285
285
|
});
|
|
286
286
|
} catch (p) {
|
|
@@ -288,12 +288,12 @@ function qt(t, e, i) {
|
|
|
288
288
|
}
|
|
289
289
|
});
|
|
290
290
|
}
|
|
291
|
-
function
|
|
292
|
-
return
|
|
291
|
+
function tt(t) {
|
|
292
|
+
return E.readFileSync(t);
|
|
293
293
|
}
|
|
294
|
-
function
|
|
294
|
+
function qt(t) {
|
|
295
295
|
return new Promise((e, i) => {
|
|
296
|
-
|
|
296
|
+
vt.get(t, (a) => {
|
|
297
297
|
const n = [], s = a.headers["content-type"];
|
|
298
298
|
a.on("data", (p) => {
|
|
299
299
|
n.push(p);
|
|
@@ -305,8 +305,8 @@ function It(t) {
|
|
|
305
305
|
});
|
|
306
306
|
});
|
|
307
307
|
}
|
|
308
|
-
const
|
|
309
|
-
const e = new
|
|
308
|
+
const Rt = async (t) => tt(t), k = (t, e = "sha1") => ht.createHash(e).update(t).digest("base64"), et = async (t) => {
|
|
309
|
+
const e = new R(), { name: i, revision: a, documentType: n, created: s, lastModified: p } = t, l = {
|
|
310
310
|
name: i,
|
|
311
311
|
revision: a,
|
|
312
312
|
documentType: n,
|
|
@@ -316,35 +316,35 @@ const Mt = async (t) => Y(t), _ = (t, e = "sha1") => ft.createHash(e).update(t).
|
|
|
316
316
|
return e.file("header.json", JSON.stringify(l, null, 2)), e.file(
|
|
317
317
|
"state.json",
|
|
318
318
|
JSON.stringify(t.initialState || {}, null, 2)
|
|
319
|
-
), e.file("operations.json", JSON.stringify(t.operations, null, 2)), Object.keys(t.attachments).forEach((
|
|
320
|
-
const { data: u, ...
|
|
321
|
-
e.file(
|
|
319
|
+
), e.file("operations.json", JSON.stringify(t.operations, null, 2)), Object.keys(t.attachments).forEach((m) => {
|
|
320
|
+
const { data: u, ...d } = t.attachments[m];
|
|
321
|
+
e.file(m, u, {
|
|
322
322
|
base64: !0,
|
|
323
323
|
createFolders: !0,
|
|
324
|
-
comment: JSON.stringify(
|
|
324
|
+
comment: JSON.stringify(d)
|
|
325
325
|
});
|
|
326
326
|
}), e;
|
|
327
|
-
},
|
|
328
|
-
const s = await (await
|
|
327
|
+
}, Lt = async (t, e, i, a) => {
|
|
328
|
+
const s = await (await et(t)).generateAsync({
|
|
329
329
|
type: "uint8array",
|
|
330
330
|
streamFiles: !0
|
|
331
331
|
}), p = a ?? t.name, l = `.${i}.zip`;
|
|
332
|
-
return
|
|
332
|
+
return Pt(
|
|
333
333
|
e,
|
|
334
334
|
p.endsWith(l) ? p : `${p}${l}`,
|
|
335
335
|
s
|
|
336
336
|
);
|
|
337
|
-
},
|
|
338
|
-
const a = await (await
|
|
337
|
+
}, le = async (t, e) => {
|
|
338
|
+
const a = await (await et(t)).generateAsync({ type: "blob" }), n = await e.createWritable();
|
|
339
339
|
await n.write(a), await n.close();
|
|
340
|
-
},
|
|
341
|
-
const i =
|
|
342
|
-
return
|
|
343
|
-
},
|
|
344
|
-
const i = new
|
|
345
|
-
return await i.loadAsync(t),
|
|
340
|
+
}, P = async (t, e) => {
|
|
341
|
+
const i = tt(t);
|
|
342
|
+
return Ut(i, e);
|
|
343
|
+
}, Ut = async (t, e) => {
|
|
344
|
+
const i = new R();
|
|
345
|
+
return await i.loadAsync(t), Jt(i, e);
|
|
346
346
|
};
|
|
347
|
-
async function
|
|
347
|
+
async function Jt(t, e) {
|
|
348
348
|
const i = t.file("state.json");
|
|
349
349
|
if (!i)
|
|
350
350
|
throw new Error("Initial state not found");
|
|
@@ -354,115 +354,119 @@ async function Ut(t, e) {
|
|
|
354
354
|
const l = t.file("operations.json");
|
|
355
355
|
if (!l)
|
|
356
356
|
throw new Error("Operations history not found");
|
|
357
|
-
const
|
|
357
|
+
const c = JSON.parse(
|
|
358
358
|
await l.async("string")
|
|
359
359
|
);
|
|
360
|
-
let
|
|
360
|
+
let m = ot(
|
|
361
361
|
n,
|
|
362
|
-
|
|
362
|
+
c,
|
|
363
363
|
e,
|
|
364
364
|
void 0,
|
|
365
365
|
p
|
|
366
366
|
);
|
|
367
|
-
return p && (
|
|
368
|
-
...
|
|
367
|
+
return p && (m = {
|
|
368
|
+
...m,
|
|
369
369
|
...p
|
|
370
|
-
}),
|
|
370
|
+
}), m;
|
|
371
371
|
}
|
|
372
|
-
function
|
|
372
|
+
function it(t) {
|
|
373
373
|
const e = t.replace(/^.*\./, "") || void 0, i = t.replace(/^.*[/\\]/, "") || void 0;
|
|
374
374
|
return { extension: e, fileName: i };
|
|
375
375
|
}
|
|
376
|
-
async function
|
|
377
|
-
const { buffer: e, mimeType: i = "application/octet-stream" } = await
|
|
376
|
+
async function ce(t) {
|
|
377
|
+
const { buffer: e, mimeType: i = "application/octet-stream" } = await qt(t), a = it(t), n = e.toString("base64");
|
|
378
378
|
return {
|
|
379
379
|
data: n,
|
|
380
|
-
hash:
|
|
380
|
+
hash: k(n),
|
|
381
381
|
mimeType: i,
|
|
382
382
|
...a
|
|
383
383
|
};
|
|
384
384
|
}
|
|
385
|
-
async function
|
|
386
|
-
const e = await
|
|
387
|
-
return { data: n, hash:
|
|
385
|
+
async function re(t) {
|
|
386
|
+
const e = await Rt(t), i = Mt.getType(t) || "application/octet-stream", a = it(t), n = e.toString("base64");
|
|
387
|
+
return { data: n, hash: k(n), mimeType: i, ...a };
|
|
388
388
|
}
|
|
389
|
-
function
|
|
389
|
+
function $t(t, e) {
|
|
390
390
|
const i = t.revision[e.scope];
|
|
391
|
-
return [
|
|
391
|
+
return [f, h, v].includes(e.type) ? i : i + 1;
|
|
392
392
|
}
|
|
393
|
-
function
|
|
393
|
+
function Ct(t, e) {
|
|
394
394
|
return {
|
|
395
395
|
...t,
|
|
396
396
|
revision: {
|
|
397
397
|
...t.revision,
|
|
398
|
-
[e.scope]:
|
|
398
|
+
[e.scope]: $t(t, e)
|
|
399
399
|
},
|
|
400
400
|
lastModified: (/* @__PURE__ */ new Date()).toISOString()
|
|
401
401
|
};
|
|
402
402
|
}
|
|
403
|
-
function
|
|
404
|
-
if ([
|
|
403
|
+
function Bt(t, e, i = 0) {
|
|
404
|
+
if ([f, h, v].includes(e.type))
|
|
405
405
|
return t;
|
|
406
|
-
const { scope:
|
|
406
|
+
const { scope: a } = e, n = t.operations[a].slice(
|
|
407
407
|
0,
|
|
408
|
-
t.revision[
|
|
408
|
+
t.revision[a]
|
|
409
409
|
);
|
|
410
|
-
return
|
|
410
|
+
return n.push({
|
|
411
411
|
...e,
|
|
412
|
-
index:
|
|
412
|
+
index: n.length,
|
|
413
413
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
414
414
|
hash: "",
|
|
415
|
-
scope:
|
|
415
|
+
scope: a,
|
|
416
|
+
skip: i
|
|
416
417
|
}), {
|
|
417
418
|
...t,
|
|
418
|
-
operations: { ...t.operations, [
|
|
419
|
+
operations: { ...t.operations, [a]: n }
|
|
419
420
|
};
|
|
420
421
|
}
|
|
421
|
-
function
|
|
422
|
-
let
|
|
423
|
-
return
|
|
422
|
+
function Zt(t, e, i = 0) {
|
|
423
|
+
let a = Bt(t, e, i);
|
|
424
|
+
return a = Ct(a, e), a;
|
|
424
425
|
}
|
|
425
|
-
function
|
|
426
|
-
switch (
|
|
427
|
-
case
|
|
428
|
-
return
|
|
429
|
-
case g:
|
|
430
|
-
return _t(t, e, i);
|
|
426
|
+
function Ht(t, e, i) {
|
|
427
|
+
switch (Z().parse(e), e.type) {
|
|
428
|
+
case X:
|
|
429
|
+
return _t(t, e.input);
|
|
431
430
|
case f:
|
|
432
|
-
return Dt(t, e, i);
|
|
433
|
-
case h:
|
|
434
431
|
return kt(t, e, i);
|
|
435
|
-
case
|
|
436
|
-
return
|
|
432
|
+
case h:
|
|
433
|
+
return Dt(t, e, i);
|
|
434
|
+
case v:
|
|
435
|
+
return Et(t, e, i);
|
|
436
|
+
case Y:
|
|
437
|
+
return Nt(t, e.input.state);
|
|
437
438
|
default:
|
|
438
439
|
return t;
|
|
439
440
|
}
|
|
440
441
|
}
|
|
441
|
-
function
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
442
|
+
function at(t, e, i, a, n = {}) {
|
|
443
|
+
const {
|
|
444
|
+
skip: s = 0
|
|
445
|
+
} = n;
|
|
446
|
+
let p = t;
|
|
447
|
+
return q(e) && (p = Ht(p, e, i)), p = Zt(p, e, s), p = M(p, (l) => {
|
|
448
|
+
const c = i(l.state, e, a);
|
|
449
|
+
if (c)
|
|
450
|
+
return xt({
|
|
451
|
+
...p,
|
|
452
|
+
state: c
|
|
449
453
|
});
|
|
450
|
-
}),
|
|
451
|
-
if ([
|
|
452
|
-
return
|
|
453
|
-
const
|
|
454
|
-
|
|
455
|
-
const { hash:
|
|
456
|
-
|
|
457
|
-
...
|
|
454
|
+
}), M(p, (l) => {
|
|
455
|
+
if ([f, h, v].includes(e.type))
|
|
456
|
+
return l;
|
|
457
|
+
const c = e.scope || "global";
|
|
458
|
+
l.operations[c][l.operations[c].length - 1].hash = nt(l, c), !q(e) && e.attachments && e.attachments.forEach((m) => {
|
|
459
|
+
const { hash: u, ...d } = m;
|
|
460
|
+
l.attachments[u] = {
|
|
461
|
+
...d
|
|
458
462
|
};
|
|
459
463
|
});
|
|
460
464
|
});
|
|
461
465
|
}
|
|
462
|
-
function
|
|
463
|
-
return [
|
|
466
|
+
function q(t) {
|
|
467
|
+
return [X, f, h, v, Y].includes(t.type);
|
|
464
468
|
}
|
|
465
|
-
function
|
|
469
|
+
function x(t, e, i, a, n = "global") {
|
|
466
470
|
if (!t)
|
|
467
471
|
throw new Error("Empty action type");
|
|
468
472
|
if (typeof t != "string")
|
|
@@ -476,10 +480,10 @@ function b(t, e, i, a, n = "global") {
|
|
|
476
480
|
}
|
|
477
481
|
return s;
|
|
478
482
|
}
|
|
479
|
-
function
|
|
480
|
-
return (i, a, n) => e(i, a, t, n);
|
|
483
|
+
function Kt(t, e = at) {
|
|
484
|
+
return (i, a, n, s) => e(i, a, t, n, s);
|
|
481
485
|
}
|
|
482
|
-
const
|
|
486
|
+
const Wt = (t, e) => ({
|
|
483
487
|
name: "",
|
|
484
488
|
documentType: "",
|
|
485
489
|
revision: {
|
|
@@ -491,8 +495,8 @@ const Kt = (t, e) => ({
|
|
|
491
495
|
attachments: {},
|
|
492
496
|
...t,
|
|
493
497
|
state: (e == null ? void 0 : e(t == null ? void 0 : t.state)) ?? (t == null ? void 0 : t.state) ?? { global: {}, local: {} }
|
|
494
|
-
}),
|
|
495
|
-
const i =
|
|
498
|
+
}), Gt = (t, e) => {
|
|
499
|
+
const i = Wt(
|
|
496
500
|
t,
|
|
497
501
|
e
|
|
498
502
|
);
|
|
@@ -501,21 +505,45 @@ const Kt = (t, e) => ({
|
|
|
501
505
|
initialState: i,
|
|
502
506
|
operations: { global: [], local: [] }
|
|
503
507
|
};
|
|
504
|
-
},
|
|
508
|
+
}, nt = (t, e = "global") => k(dt(t.state[e])), me = (t, e = 1e3) => {
|
|
505
509
|
const i = Math.random() * e;
|
|
506
|
-
return
|
|
510
|
+
return k(`${(t ?? /* @__PURE__ */ new Date()).toISOString()}${i}`);
|
|
507
511
|
};
|
|
508
|
-
function
|
|
509
|
-
return
|
|
512
|
+
function S(t) {
|
|
513
|
+
return gt(ft(t, !0));
|
|
514
|
+
}
|
|
515
|
+
function Qt(t) {
|
|
516
|
+
const e = [...t];
|
|
517
|
+
let i = 0, a = e.length > 0 ? e[e.length - 1].index : 0;
|
|
518
|
+
const n = [];
|
|
519
|
+
for (const s of e.reverse()) {
|
|
520
|
+
if (i > 0) {
|
|
521
|
+
const l = a - s.index;
|
|
522
|
+
i -= l;
|
|
523
|
+
}
|
|
524
|
+
if (i < 0)
|
|
525
|
+
throw new Error("Invalid operation index, missing operations");
|
|
526
|
+
const p = {
|
|
527
|
+
ignore: i > 0,
|
|
528
|
+
operation: s
|
|
529
|
+
};
|
|
530
|
+
s.skip > 0 && (i = i + (s.skip + 1)), a = s.index, n.push(p);
|
|
531
|
+
}
|
|
532
|
+
return n.reverse();
|
|
510
533
|
}
|
|
511
|
-
function
|
|
534
|
+
function ue(t) {
|
|
512
535
|
return Object.values(t).flatMap((e) => e).sort(
|
|
513
536
|
(e, i) => new Date(e.timestamp).getTime() - new Date(i.timestamp).getTime()
|
|
514
537
|
);
|
|
515
538
|
}
|
|
516
|
-
function
|
|
517
|
-
|
|
518
|
-
|
|
539
|
+
function Vt(t) {
|
|
540
|
+
return Object.values(t).flatMap((e) => e).sort(
|
|
541
|
+
(e, i) => new Date(e.operation.timestamp).getTime() - new Date(i.operation.timestamp).getTime()
|
|
542
|
+
);
|
|
543
|
+
}
|
|
544
|
+
function O(t, e, i, a, n, s = at) {
|
|
545
|
+
const p = Kt(i, s);
|
|
546
|
+
return ot(
|
|
519
547
|
t,
|
|
520
548
|
e,
|
|
521
549
|
p,
|
|
@@ -523,85 +551,104 @@ function S(t, e, i, a, n, s = it) {
|
|
|
523
551
|
n
|
|
524
552
|
);
|
|
525
553
|
}
|
|
526
|
-
function
|
|
527
|
-
const s =
|
|
528
|
-
const
|
|
554
|
+
function ot(t, e, i, a, n) {
|
|
555
|
+
const s = Gt(t), p = Object.keys(e).reduce((u, d) => {
|
|
556
|
+
const r = d;
|
|
557
|
+
return {
|
|
558
|
+
...u,
|
|
559
|
+
[r]: e[r].slice(0, n == null ? void 0 : n.revision[r])
|
|
560
|
+
};
|
|
561
|
+
}, {}), l = Object.keys(p).reduce((u, d) => {
|
|
562
|
+
const r = d;
|
|
529
563
|
return {
|
|
530
|
-
...
|
|
531
|
-
[
|
|
564
|
+
...u,
|
|
565
|
+
[r]: Qt(p[r])
|
|
532
566
|
};
|
|
533
|
-
}, {}),
|
|
534
|
-
(
|
|
567
|
+
}, {}), c = Vt(l).reduce(
|
|
568
|
+
(u, { ignore: d, operation: r }) => d ? i(
|
|
569
|
+
u,
|
|
570
|
+
rt(r.scope),
|
|
571
|
+
a,
|
|
572
|
+
{ skip: r.skip }
|
|
573
|
+
) : i(u, r, a),
|
|
535
574
|
s
|
|
536
|
-
),
|
|
537
|
-
|
|
575
|
+
), m = Object.keys(
|
|
576
|
+
c.operations
|
|
538
577
|
).reduce(
|
|
539
|
-
(
|
|
540
|
-
const
|
|
578
|
+
(u, d) => {
|
|
579
|
+
const r = d, b = n && n.revision[r] < e[r].length ? e[r].slice(n.revision[r]) : [];
|
|
541
580
|
return {
|
|
542
|
-
...
|
|
543
|
-
[
|
|
544
|
-
...
|
|
545
|
-
var
|
|
581
|
+
...u,
|
|
582
|
+
[r]: [
|
|
583
|
+
...c.operations[r].map((y, D) => {
|
|
584
|
+
var j;
|
|
546
585
|
return {
|
|
547
|
-
...
|
|
548
|
-
timestamp: ((
|
|
586
|
+
...y,
|
|
587
|
+
timestamp: ((j = e[r][D]) == null ? void 0 : j.timestamp) ?? y.timestamp
|
|
549
588
|
};
|
|
550
589
|
}),
|
|
551
|
-
...
|
|
590
|
+
...b
|
|
552
591
|
]
|
|
553
592
|
};
|
|
554
593
|
},
|
|
555
594
|
{ global: [], local: [] }
|
|
556
595
|
);
|
|
557
|
-
return { ...
|
|
596
|
+
return { ...c, operations: m };
|
|
558
597
|
}
|
|
559
|
-
const
|
|
598
|
+
const st = (t) => x(
|
|
560
599
|
"SET_NAME",
|
|
561
600
|
t,
|
|
562
601
|
void 0,
|
|
563
|
-
|
|
564
|
-
|
|
602
|
+
z,
|
|
603
|
+
void 0
|
|
604
|
+
), pt = (t = 1, e = "global") => x(
|
|
565
605
|
"UNDO",
|
|
566
606
|
t,
|
|
567
607
|
void 0,
|
|
568
|
-
|
|
608
|
+
F,
|
|
569
609
|
e
|
|
570
|
-
),
|
|
610
|
+
), lt = (t = 1, e = "global") => x(
|
|
571
611
|
"REDO",
|
|
572
612
|
t,
|
|
573
613
|
void 0,
|
|
574
614
|
A,
|
|
575
615
|
e
|
|
576
|
-
),
|
|
616
|
+
), ct = (t, e, i = "global") => x(
|
|
577
617
|
"PRUNE",
|
|
578
618
|
{ start: t, end: e },
|
|
579
619
|
void 0,
|
|
580
|
-
|
|
620
|
+
T,
|
|
581
621
|
i
|
|
582
|
-
),
|
|
622
|
+
), I = (t, e) => x(
|
|
583
623
|
"LOAD_STATE",
|
|
584
624
|
{ state: t, operations: e },
|
|
585
625
|
void 0,
|
|
586
|
-
|
|
587
|
-
),
|
|
626
|
+
N
|
|
627
|
+
), rt = (t = "global") => x(
|
|
628
|
+
"NOOP",
|
|
629
|
+
{},
|
|
630
|
+
void 0,
|
|
631
|
+
void 0,
|
|
632
|
+
t
|
|
633
|
+
), de = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
588
634
|
__proto__: null,
|
|
589
|
-
loadState:
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
635
|
+
loadState: I,
|
|
636
|
+
noop: rt,
|
|
637
|
+
prune: ct,
|
|
638
|
+
redo: lt,
|
|
639
|
+
setName: st,
|
|
640
|
+
undo: pt
|
|
594
641
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
595
|
-
class
|
|
642
|
+
class xe {
|
|
596
643
|
/**
|
|
597
644
|
* Constructs a BaseDocument instance with an initial state.
|
|
598
645
|
* @param reducer - The reducer function that updates the state.
|
|
599
646
|
* @param document - The initial state of the document.
|
|
600
647
|
*/
|
|
601
648
|
constructor(e, i, a) {
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
649
|
+
w(this, "_document");
|
|
650
|
+
w(this, "_reducer");
|
|
651
|
+
w(this, "_signalDispatch");
|
|
605
652
|
this._reducer = e, this._document = i, this._signalDispatch = a;
|
|
606
653
|
}
|
|
607
654
|
/**
|
|
@@ -609,11 +656,12 @@ class me {
|
|
|
609
656
|
* @param action - The action to dispatch.
|
|
610
657
|
* @returns The Document instance.
|
|
611
658
|
*/
|
|
612
|
-
dispatch(e) {
|
|
659
|
+
dispatch(e, i) {
|
|
613
660
|
return this._document = this._reducer(
|
|
614
661
|
this._document,
|
|
615
662
|
e,
|
|
616
|
-
this._signalDispatch
|
|
663
|
+
this._signalDispatch,
|
|
664
|
+
i
|
|
617
665
|
), this;
|
|
618
666
|
}
|
|
619
667
|
/**
|
|
@@ -623,14 +671,14 @@ class me {
|
|
|
623
671
|
* @returns The file path where the state was saved.
|
|
624
672
|
*/
|
|
625
673
|
saveToFile(e, i, a) {
|
|
626
|
-
return
|
|
674
|
+
return Lt(this._document, e, i, a);
|
|
627
675
|
}
|
|
628
676
|
/**
|
|
629
677
|
* Loads the state of the document from a file.
|
|
630
678
|
* @param path - The file path where the state is stored.
|
|
631
679
|
*/
|
|
632
680
|
async loadFromFile(e) {
|
|
633
|
-
this._document = await
|
|
681
|
+
this._document = await P(e, this._reducer);
|
|
634
682
|
}
|
|
635
683
|
/**
|
|
636
684
|
* Loads the state of the document from a file and returns it.
|
|
@@ -639,19 +687,19 @@ class me {
|
|
|
639
687
|
* @returns The state of the document.
|
|
640
688
|
*/
|
|
641
689
|
static async stateFromFile(e, i) {
|
|
642
|
-
return await
|
|
690
|
+
return await P(e, i);
|
|
643
691
|
}
|
|
644
692
|
/**
|
|
645
693
|
* Gets the current state of the document.
|
|
646
694
|
*/
|
|
647
695
|
get state() {
|
|
648
|
-
return
|
|
696
|
+
return S(this._document.state);
|
|
649
697
|
}
|
|
650
698
|
/**
|
|
651
699
|
* Gets the list of operations performed on the document.
|
|
652
700
|
*/
|
|
653
701
|
get operations() {
|
|
654
|
-
return
|
|
702
|
+
return S(this._document.operations);
|
|
655
703
|
}
|
|
656
704
|
/**
|
|
657
705
|
* Gets the name of the document.
|
|
@@ -690,13 +738,13 @@ class me {
|
|
|
690
738
|
* Gets the initial state of the document.
|
|
691
739
|
*/
|
|
692
740
|
get initialState() {
|
|
693
|
-
return
|
|
741
|
+
return S(this._document.initialState);
|
|
694
742
|
}
|
|
695
743
|
/**
|
|
696
744
|
* Returns the current document as an object
|
|
697
745
|
*/
|
|
698
746
|
toDocument() {
|
|
699
|
-
return
|
|
747
|
+
return S(this._document);
|
|
700
748
|
}
|
|
701
749
|
/**
|
|
702
750
|
* Gets the attachment associated with the given key.
|
|
@@ -710,21 +758,21 @@ class me {
|
|
|
710
758
|
* @param name - The new name of the document.
|
|
711
759
|
*/
|
|
712
760
|
setName(e) {
|
|
713
|
-
return this.dispatch(
|
|
761
|
+
return this.dispatch(st(e)), this;
|
|
714
762
|
}
|
|
715
763
|
/**
|
|
716
764
|
* Reverts a number of actions from the document.
|
|
717
765
|
* @param count - The number of actions to revert.
|
|
718
766
|
*/
|
|
719
767
|
undo(e) {
|
|
720
|
-
return this.dispatch(
|
|
768
|
+
return this.dispatch(pt(e)), this;
|
|
721
769
|
}
|
|
722
770
|
/**
|
|
723
771
|
* Reapplies a number of actions to the document.
|
|
724
772
|
* @param count - The number of actions to reapply.
|
|
725
773
|
*/
|
|
726
774
|
redo(e) {
|
|
727
|
-
return this.dispatch(
|
|
775
|
+
return this.dispatch(lt(e)), this;
|
|
728
776
|
}
|
|
729
777
|
/**
|
|
730
778
|
* Removes a range of operations from the document.
|
|
@@ -732,7 +780,7 @@ class me {
|
|
|
732
780
|
* @param end - The ending index of the range to remove.
|
|
733
781
|
*/
|
|
734
782
|
prune(e, i) {
|
|
735
|
-
return this.dispatch(
|
|
783
|
+
return this.dispatch(ct(e, i)), this;
|
|
736
784
|
}
|
|
737
785
|
/**
|
|
738
786
|
* Loads a document state and a set of operations.
|
|
@@ -740,10 +788,10 @@ class me {
|
|
|
740
788
|
* @param operations - The operations to apply to the document.
|
|
741
789
|
*/
|
|
742
790
|
loadState(e, i) {
|
|
743
|
-
return this.dispatch(
|
|
791
|
+
return this.dispatch(I(e, i)), this;
|
|
744
792
|
}
|
|
745
793
|
}
|
|
746
|
-
function
|
|
794
|
+
function ge(t, e) {
|
|
747
795
|
e.forEach((i) => {
|
|
748
796
|
Object.getOwnPropertyNames(i.prototype).forEach((a) => {
|
|
749
797
|
Object.defineProperty(
|
|
@@ -757,27 +805,29 @@ function ue(t, e) {
|
|
|
757
805
|
});
|
|
758
806
|
}
|
|
759
807
|
export {
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
808
|
+
xe as B,
|
|
809
|
+
Wt as a,
|
|
810
|
+
Gt as b,
|
|
811
|
+
Kt as c,
|
|
812
|
+
le as d,
|
|
813
|
+
Ut as e,
|
|
814
|
+
x as f,
|
|
815
|
+
ge as g,
|
|
816
|
+
de as h,
|
|
817
|
+
q as i,
|
|
818
|
+
et as j,
|
|
819
|
+
re as k,
|
|
820
|
+
P as l,
|
|
821
|
+
ce as m,
|
|
822
|
+
nt as n,
|
|
823
|
+
me as o,
|
|
824
|
+
Qt as p,
|
|
825
|
+
ot as q,
|
|
826
|
+
S as r,
|
|
827
|
+
Lt as s,
|
|
828
|
+
O as t,
|
|
829
|
+
Vt as u,
|
|
830
|
+
ue as v,
|
|
831
|
+
at as w,
|
|
832
|
+
pe as z
|
|
783
833
|
};
|