document-model 1.0.30 → 1.0.32
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 +2 -2
- package/dist/browser/index.cjs +1 -1
- package/dist/browser/index.js +3 -3
- package/dist/browser/internal/{index-B-7drCvN.js → index-B7qIPXoz.js} +1 -1
- package/dist/browser/internal/{index-BFLtpklA.js → index-BFOiHt6I.js} +1 -1
- package/dist/{node/internal/index-BevT9mtU.js → browser/internal/index-BVR8cGlp.js} +1 -1
- package/dist/browser/internal/index-DtMGoFXU.js +40 -0
- package/dist/browser/internal/{object-DCxjKS4C.js → object-Diya-yJS.js} +297 -274
- package/dist/browser/internal/{object-g08kById.js → object-O_qdzVL-.js} +3 -2
- package/dist/browser/src/document/types.d.ts +7 -1
- package/dist/browser/src/document/utils/index.d.ts +1 -0
- package/dist/browser/src/document/utils/validation.d.ts +2 -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 +3 -3
- package/dist/node/index.cjs +1 -1
- package/dist/node/index.js +3 -3
- package/dist/{browser/internal/index-_gFM9c3z.js → node/internal/index-Bxw-tgFs.js} +1 -1
- package/dist/node/internal/{index-CbWnG-mj.js → index-C-NbJIDm.js} +1 -1
- package/dist/node/internal/{index-BNOB79wS.js → index-CsNA2GBY.js} +1 -1
- package/dist/node/internal/index-Ly6V0vGQ.js +40 -0
- package/dist/node/internal/object-DyU92wWO.js +2 -0
- package/dist/node/internal/{object-l76vs_od.js → object-usT57J9v.js} +289 -266
- package/dist/node/src/document/types.d.ts +7 -1
- package/dist/node/src/document/utils/index.d.ts +1 -0
- package/dist/node/src/document/utils/validation.d.ts +2 -0
- package/package.json +1 -1
- package/dist/browser/internal/index-FwxURTAn.js +0 -39
- package/dist/node/internal/index-JCxY4diP.js +0 -39
- package/dist/node/internal/object-DULiHJNK.js +0 -1
|
@@ -3,20 +3,20 @@ var je = (o, r, p) => r in o ? Be(o, r, { enumerable: !0, configurable: !0, writ
|
|
|
3
3
|
var V = (o, r, p) => (je(o, typeof r != "symbol" ? r + "" : r, p), p);
|
|
4
4
|
import { produce as J, castDraft as ot, castImmutable as Ie, freeze as Oe } from "immer";
|
|
5
5
|
import Ue from "json-stringify-deterministic";
|
|
6
|
-
import { z as
|
|
6
|
+
import { z as g } from "zod";
|
|
7
7
|
import Ut from "jszip";
|
|
8
|
-
const Tt = (o) => o != null, Te =
|
|
8
|
+
const Tt = (o) => o != null, Te = g.any().refine((o) => Tt(o)), Dt = g.enum(["LOAD_STATE"]), Nt = g.enum(["PRUNE"]), Mt = g.enum(["REDO"]), Rt = g.enum(["SET_NAME"]), Ct = g.enum(["UNDO"]);
|
|
9
9
|
function De() {
|
|
10
|
-
return
|
|
11
|
-
__typename:
|
|
12
|
-
type:
|
|
10
|
+
return g.object({
|
|
11
|
+
__typename: g.literal("Action").optional(),
|
|
12
|
+
type: g.string()
|
|
13
13
|
});
|
|
14
14
|
}
|
|
15
15
|
function H() {
|
|
16
|
-
return
|
|
16
|
+
return g.literal("global").or(g.literal("local"));
|
|
17
17
|
}
|
|
18
18
|
function Lt() {
|
|
19
|
-
return
|
|
19
|
+
return g.union([
|
|
20
20
|
zt(),
|
|
21
21
|
qt(),
|
|
22
22
|
$t(),
|
|
@@ -25,90 +25,90 @@ function Lt() {
|
|
|
25
25
|
]);
|
|
26
26
|
}
|
|
27
27
|
function Ne() {
|
|
28
|
-
return
|
|
29
|
-
__typename:
|
|
30
|
-
data:
|
|
31
|
-
extension:
|
|
32
|
-
fileName:
|
|
33
|
-
mimeType:
|
|
28
|
+
return g.object({
|
|
29
|
+
__typename: g.literal("DocumentFile").optional(),
|
|
30
|
+
data: g.string(),
|
|
31
|
+
extension: g.string().nullable(),
|
|
32
|
+
fileName: g.string().nullable(),
|
|
33
|
+
mimeType: g.string()
|
|
34
34
|
});
|
|
35
35
|
}
|
|
36
36
|
function zt() {
|
|
37
|
-
return
|
|
38
|
-
input:
|
|
37
|
+
return g.object({
|
|
38
|
+
input: g.lazy(() => ct()),
|
|
39
39
|
type: Dt,
|
|
40
40
|
scope: H()
|
|
41
41
|
});
|
|
42
42
|
}
|
|
43
43
|
function ct() {
|
|
44
|
-
return
|
|
45
|
-
operations:
|
|
46
|
-
state:
|
|
44
|
+
return g.object({
|
|
45
|
+
operations: g.number(),
|
|
46
|
+
state: g.lazy(() => Pt())
|
|
47
47
|
});
|
|
48
48
|
}
|
|
49
49
|
function Pt() {
|
|
50
|
-
return
|
|
51
|
-
data:
|
|
52
|
-
name:
|
|
50
|
+
return g.object({
|
|
51
|
+
data: g.unknown().nullish(),
|
|
52
|
+
name: g.string()
|
|
53
53
|
});
|
|
54
54
|
}
|
|
55
55
|
function Me() {
|
|
56
|
-
return
|
|
57
|
-
__typename:
|
|
58
|
-
hash:
|
|
59
|
-
index:
|
|
60
|
-
timestamp:
|
|
61
|
-
type:
|
|
56
|
+
return g.object({
|
|
57
|
+
__typename: g.literal("Operation").optional(),
|
|
58
|
+
hash: g.string(),
|
|
59
|
+
index: g.number(),
|
|
60
|
+
timestamp: g.string().datetime(),
|
|
61
|
+
type: g.string()
|
|
62
62
|
});
|
|
63
63
|
}
|
|
64
64
|
function qt() {
|
|
65
|
-
return
|
|
66
|
-
input:
|
|
65
|
+
return g.object({
|
|
66
|
+
input: g.lazy(() => lt()),
|
|
67
67
|
type: Nt,
|
|
68
68
|
scope: H()
|
|
69
69
|
});
|
|
70
70
|
}
|
|
71
71
|
function lt() {
|
|
72
|
-
return
|
|
73
|
-
end:
|
|
74
|
-
start:
|
|
72
|
+
return g.object({
|
|
73
|
+
end: g.number().nullish(),
|
|
74
|
+
start: g.number().nullish()
|
|
75
75
|
});
|
|
76
76
|
}
|
|
77
|
-
const ut =
|
|
77
|
+
const ut = g.number;
|
|
78
78
|
function $t() {
|
|
79
|
-
return
|
|
79
|
+
return g.object({
|
|
80
80
|
input: ut(),
|
|
81
81
|
type: Mt,
|
|
82
82
|
scope: H()
|
|
83
83
|
});
|
|
84
84
|
}
|
|
85
|
-
const ft =
|
|
85
|
+
const ft = g.string;
|
|
86
86
|
function Wt() {
|
|
87
|
-
return
|
|
87
|
+
return g.object({
|
|
88
88
|
input: ft(),
|
|
89
89
|
type: Rt,
|
|
90
|
-
scope:
|
|
90
|
+
scope: g.literal("global")
|
|
91
91
|
});
|
|
92
92
|
}
|
|
93
93
|
function Re() {
|
|
94
|
-
return
|
|
95
|
-
__typename:
|
|
96
|
-
hash:
|
|
97
|
-
index:
|
|
98
|
-
input:
|
|
99
|
-
timestamp:
|
|
100
|
-
type:
|
|
94
|
+
return g.object({
|
|
95
|
+
__typename: g.literal("SetNameOperation").optional(),
|
|
96
|
+
hash: g.string(),
|
|
97
|
+
index: g.number(),
|
|
98
|
+
input: g.string(),
|
|
99
|
+
timestamp: g.string().datetime(),
|
|
100
|
+
type: g.string()
|
|
101
101
|
});
|
|
102
102
|
}
|
|
103
|
-
const mt =
|
|
103
|
+
const mt = g.number;
|
|
104
104
|
function Jt() {
|
|
105
|
-
return
|
|
105
|
+
return g.object({
|
|
106
106
|
input: mt(),
|
|
107
107
|
type: Ct,
|
|
108
108
|
scope: H()
|
|
109
109
|
});
|
|
110
110
|
}
|
|
111
|
-
const
|
|
111
|
+
const Li = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
112
112
|
__proto__: null,
|
|
113
113
|
ActionSchema: De,
|
|
114
114
|
BaseActionSchema: Lt,
|
|
@@ -143,9 +143,9 @@ function Le(o, r, p) {
|
|
|
143
143
|
skip: p,
|
|
144
144
|
document: o
|
|
145
145
|
}, { scope: u } = r;
|
|
146
|
-
return !u || r.skip === void 0 ? c : J(c, (
|
|
147
|
-
const [l] =
|
|
148
|
-
r.skip && r.skip > 0 && (
|
|
146
|
+
return !u || r.skip === void 0 ? c : J(c, (f) => {
|
|
147
|
+
const [l] = f.document.operations[u].slice(-1);
|
|
148
|
+
r.skip && r.skip > 0 && (f.skip = r.skip), l.type === "NOOP" && r.index === l.index && f.skip > l.skip && f.document.operations[u].pop();
|
|
149
149
|
});
|
|
150
150
|
}
|
|
151
151
|
function ze(o, r, p) {
|
|
@@ -173,10 +173,10 @@ function ze(o, r, p) {
|
|
|
173
173
|
"Cannot undo: you can't undo more operations than the ones in the scope history"
|
|
174
174
|
);
|
|
175
175
|
const d = l.document.operations[c].length - 1;
|
|
176
|
-
let
|
|
177
|
-
for (;
|
|
178
|
-
const v = l.document.operations[c][
|
|
179
|
-
v.type === "NOOP" && v.skip > 0 ? (
|
|
176
|
+
let b = u, w = x ? d - a.skip : d;
|
|
177
|
+
for (; b > 0 && w >= 0; ) {
|
|
178
|
+
const v = l.document.operations[c][w];
|
|
179
|
+
v.type === "NOOP" && v.skip > 0 ? (w = w - (v.skip + 1), l.skip += v.skip + 1) : (l.document.clipboard.push({ ...v }), b--, w--);
|
|
180
180
|
}
|
|
181
181
|
l.action = wt(c);
|
|
182
182
|
});
|
|
@@ -218,17 +218,17 @@ function Pe(o, r, p) {
|
|
|
218
218
|
function qe(o, r, p) {
|
|
219
219
|
const { scope: c } = r, u = o.operations[c];
|
|
220
220
|
let {
|
|
221
|
-
input: { start:
|
|
221
|
+
input: { start: f, end: l }
|
|
222
222
|
} = r;
|
|
223
|
-
|
|
224
|
-
const a = u.slice(
|
|
223
|
+
f = f || 0, l = l || u.length;
|
|
224
|
+
const a = u.slice(f, l), x = u.slice(0, f), d = u.slice(l), b = st(
|
|
225
225
|
o.initialState,
|
|
226
226
|
{
|
|
227
227
|
...o.operations,
|
|
228
228
|
[c]: x.concat(a)
|
|
229
229
|
},
|
|
230
230
|
p
|
|
231
|
-
), { name:
|
|
231
|
+
), { name: w, state: v } = b, y = x.length, U = x.length ? x[x.length - 1].timestamp : d.length ? d[0].timestamp : (/* @__PURE__ */ new Date()).toISOString();
|
|
232
232
|
return st(
|
|
233
233
|
o.initialState,
|
|
234
234
|
{
|
|
@@ -237,7 +237,7 @@ function qe(o, r, p) {
|
|
|
237
237
|
...x,
|
|
238
238
|
{
|
|
239
239
|
...dt(
|
|
240
|
-
{ name:
|
|
240
|
+
{ name: w, state: v },
|
|
241
241
|
a.length
|
|
242
242
|
),
|
|
243
243
|
timestamp: U,
|
|
@@ -321,19 +321,19 @@ function Ke(o, r, p) {
|
|
|
321
321
|
}
|
|
322
322
|
}
|
|
323
323
|
function Yt(o, r, p, c, u = {}) {
|
|
324
|
-
const { skip:
|
|
325
|
-
let a = { ...r }, x =
|
|
324
|
+
const { skip: f, ignoreSkipOperations: l = !1 } = u;
|
|
325
|
+
let a = { ...r }, x = f || 0, d = o, b = [...o.clipboard];
|
|
326
326
|
if (Ei(a)) {
|
|
327
|
-
const { document:
|
|
328
|
-
x = v, d =
|
|
327
|
+
const { document: w, skip: v } = Le(d, a, x);
|
|
328
|
+
x = v, d = w;
|
|
329
329
|
}
|
|
330
330
|
if (jt(a)) {
|
|
331
331
|
const {
|
|
332
|
-
skip:
|
|
332
|
+
skip: w,
|
|
333
333
|
action: v,
|
|
334
334
|
document: y
|
|
335
335
|
} = Ke(o, a, x);
|
|
336
|
-
a = v, x =
|
|
336
|
+
a = v, x = w, d = y, b = [...d.clipboard];
|
|
337
337
|
}
|
|
338
338
|
return It(a) && (d = Ge(d, a, p)), x > 0 && !l && (d = st(
|
|
339
339
|
d.initialState,
|
|
@@ -343,26 +343,26 @@ function Yt(o, r, p, c, u = {}) {
|
|
|
343
343
|
void 0,
|
|
344
344
|
void 0,
|
|
345
345
|
{ [a.scope]: x }
|
|
346
|
-
)), d = Ye(d, a, x), d = J(d, (
|
|
346
|
+
)), d = Ye(d, a, x), d = J(d, (w) => {
|
|
347
347
|
const v = p(
|
|
348
|
-
|
|
348
|
+
w.state,
|
|
349
349
|
a,
|
|
350
350
|
c
|
|
351
|
-
), y = jt(r) ? [...
|
|
351
|
+
), y = jt(r) ? [...b] : [];
|
|
352
352
|
if (v)
|
|
353
353
|
return ot({
|
|
354
354
|
...d,
|
|
355
355
|
clipboard: [...y],
|
|
356
356
|
state: v
|
|
357
357
|
});
|
|
358
|
-
|
|
359
|
-
}), J(d, (
|
|
358
|
+
w.clipboard = ot([...y]);
|
|
359
|
+
}), J(d, (w) => {
|
|
360
360
|
if ([z, P, Z].includes(a.type))
|
|
361
|
-
return
|
|
361
|
+
return w;
|
|
362
362
|
const v = a.scope || "global";
|
|
363
|
-
|
|
363
|
+
w.operations[v][w.operations[v].length - 1].hash = ee(w, v), !It(a) && a.attachments && a.attachments.forEach((y) => {
|
|
364
364
|
const { hash: U, ...j } = y;
|
|
365
|
-
|
|
365
|
+
w.attachments[U] = {
|
|
366
366
|
...j
|
|
367
367
|
};
|
|
368
368
|
});
|
|
@@ -415,22 +415,22 @@ function ii(o, r, p) {
|
|
|
415
415
|
return (r + p) * 3 / 4 - p;
|
|
416
416
|
}
|
|
417
417
|
function ri(o) {
|
|
418
|
-
var r, p = Kt(o), c = p[0], u = p[1],
|
|
418
|
+
var r, p = Kt(o), c = p[0], u = p[1], f = new Qe(ii(o, c, u)), l = 0, a = u > 0 ? c - 4 : c, x;
|
|
419
419
|
for (x = 0; x < a; x += 4)
|
|
420
|
-
r = O[o.charCodeAt(x)] << 18 | O[o.charCodeAt(x + 1)] << 12 | O[o.charCodeAt(x + 2)] << 6 | O[o.charCodeAt(x + 3)],
|
|
421
|
-
return u === 2 && (r = O[o.charCodeAt(x)] << 2 | O[o.charCodeAt(x + 1)] >> 4,
|
|
420
|
+
r = O[o.charCodeAt(x)] << 18 | O[o.charCodeAt(x + 1)] << 12 | O[o.charCodeAt(x + 2)] << 6 | O[o.charCodeAt(x + 3)], f[l++] = r >> 16 & 255, f[l++] = r >> 8 & 255, f[l++] = r & 255;
|
|
421
|
+
return u === 2 && (r = O[o.charCodeAt(x)] << 2 | O[o.charCodeAt(x + 1)] >> 4, f[l++] = r & 255), u === 1 && (r = O[o.charCodeAt(x)] << 10 | O[o.charCodeAt(x + 1)] << 4 | O[o.charCodeAt(x + 2)] >> 2, f[l++] = r >> 8 & 255, f[l++] = r & 255), f;
|
|
422
422
|
}
|
|
423
423
|
function ni(o) {
|
|
424
424
|
return D[o >> 18 & 63] + D[o >> 12 & 63] + D[o >> 6 & 63] + D[o & 63];
|
|
425
425
|
}
|
|
426
426
|
function oi(o, r, p) {
|
|
427
|
-
for (var c, u = [],
|
|
428
|
-
c = (o[
|
|
427
|
+
for (var c, u = [], f = r; f < p; f += 3)
|
|
428
|
+
c = (o[f] << 16 & 16711680) + (o[f + 1] << 8 & 65280) + (o[f + 2] & 255), u.push(ni(c));
|
|
429
429
|
return u.join("");
|
|
430
430
|
}
|
|
431
431
|
function ai(o) {
|
|
432
|
-
for (var r, p = o.length, c = p % 3, u = [],
|
|
433
|
-
u.push(oi(o, l, l +
|
|
432
|
+
for (var r, p = o.length, c = p % 3, u = [], f = 16383, l = 0, a = p - c; l < a; l += f)
|
|
433
|
+
u.push(oi(o, l, l + f > a ? a : l + f));
|
|
434
434
|
return c === 1 ? (r = o[p - 1], u.push(
|
|
435
435
|
D[r >> 2] + D[r << 4 & 63] + "=="
|
|
436
436
|
)) : c === 2 && (r = (o[p - 2] << 8) + o[p - 1], u.push(
|
|
@@ -440,23 +440,23 @@ function ai(o) {
|
|
|
440
440
|
var ht = {};
|
|
441
441
|
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
442
442
|
ht.read = function(o, r, p, c, u) {
|
|
443
|
-
var
|
|
444
|
-
for (
|
|
443
|
+
var f, l, a = u * 8 - c - 1, x = (1 << a) - 1, d = x >> 1, b = -7, w = p ? u - 1 : 0, v = p ? -1 : 1, y = o[r + w];
|
|
444
|
+
for (w += v, f = y & (1 << -b) - 1, y >>= -b, b += a; b > 0; f = f * 256 + o[r + w], w += v, b -= 8)
|
|
445
445
|
;
|
|
446
|
-
for (l =
|
|
446
|
+
for (l = f & (1 << -b) - 1, f >>= -b, b += c; b > 0; l = l * 256 + o[r + w], w += v, b -= 8)
|
|
447
447
|
;
|
|
448
|
-
if (
|
|
449
|
-
|
|
448
|
+
if (f === 0)
|
|
449
|
+
f = 1 - d;
|
|
450
450
|
else {
|
|
451
|
-
if (
|
|
451
|
+
if (f === x)
|
|
452
452
|
return l ? NaN : (y ? -1 : 1) * (1 / 0);
|
|
453
|
-
l = l + Math.pow(2, c),
|
|
453
|
+
l = l + Math.pow(2, c), f = f - d;
|
|
454
454
|
}
|
|
455
|
-
return (y ? -1 : 1) * l * Math.pow(2,
|
|
455
|
+
return (y ? -1 : 1) * l * Math.pow(2, f - c);
|
|
456
456
|
};
|
|
457
|
-
ht.write = function(o, r, p, c, u,
|
|
458
|
-
var l, a, x, d =
|
|
459
|
-
for (r = Math.abs(r), isNaN(r) || r === 1 / 0 ? (a = isNaN(r) ? 1 : 0, l =
|
|
457
|
+
ht.write = function(o, r, p, c, u, f) {
|
|
458
|
+
var l, a, x, d = f * 8 - u - 1, b = (1 << d) - 1, w = b >> 1, v = u === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0, y = c ? 0 : f - 1, U = c ? 1 : -1, j = r < 0 || r === 0 && 1 / r < 0 ? 1 : 0;
|
|
459
|
+
for (r = Math.abs(r), isNaN(r) || r === 1 / 0 ? (a = isNaN(r) ? 1 : 0, l = b) : (l = Math.floor(Math.log(r) / Math.LN2), r * (x = Math.pow(2, -l)) < 1 && (l--, x *= 2), l + w >= 1 ? r += v / x : r += v * Math.pow(2, 1 - w), r * x >= 2 && (l++, x /= 2), l + w >= b ? (a = 0, l = b) : l + w >= 1 ? (a = (r * x - 1) * Math.pow(2, u), l = l + w) : (a = r * Math.pow(2, w - 1) * Math.pow(2, u), l = 0)); u >= 8; o[p + y] = a & 255, y += U, a /= 256, u -= 8)
|
|
460
460
|
;
|
|
461
461
|
for (l = l << u | a, d += u; d > 0; o[p + y] = l & 255, y += U, l /= 256, d -= 8)
|
|
462
462
|
;
|
|
@@ -472,10 +472,10 @@ ht.write = function(o, r, p, c, u, m) {
|
|
|
472
472
|
var r = Q, p = ht, c = typeof Symbol == "function" && typeof Symbol.for == "function" ? Symbol.for("nodejs.util.inspect.custom") : null;
|
|
473
473
|
o.Buffer = a, o.SlowBuffer = le, o.INSPECT_MAX_BYTES = 50;
|
|
474
474
|
var u = 2147483647;
|
|
475
|
-
o.kMaxLength = u, a.TYPED_ARRAY_SUPPORT =
|
|
475
|
+
o.kMaxLength = u, a.TYPED_ARRAY_SUPPORT = f(), !a.TYPED_ARRAY_SUPPORT && typeof console < "u" && typeof console.error == "function" && console.error(
|
|
476
476
|
"This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."
|
|
477
477
|
);
|
|
478
|
-
function
|
|
478
|
+
function f() {
|
|
479
479
|
try {
|
|
480
480
|
var i = new Uint8Array(1), t = { foo: function() {
|
|
481
481
|
return 42;
|
|
@@ -510,7 +510,7 @@ ht.write = function(o, r, p, c, u, m) {
|
|
|
510
510
|
throw new TypeError(
|
|
511
511
|
'The "string" argument must be of type string. Received type number'
|
|
512
512
|
);
|
|
513
|
-
return
|
|
513
|
+
return w(i);
|
|
514
514
|
}
|
|
515
515
|
return x(i, t, e);
|
|
516
516
|
}
|
|
@@ -555,19 +555,19 @@ ht.write = function(o, r, p, c, u, m) {
|
|
|
555
555
|
if (i < 0)
|
|
556
556
|
throw new RangeError('The value "' + i + '" is invalid for option "size"');
|
|
557
557
|
}
|
|
558
|
-
function
|
|
558
|
+
function b(i, t, e) {
|
|
559
559
|
return d(i), i <= 0 ? l(i) : t !== void 0 ? typeof e == "string" ? l(i).fill(t, e) : l(i).fill(t) : l(i);
|
|
560
560
|
}
|
|
561
561
|
a.alloc = function(i, t, e) {
|
|
562
|
-
return
|
|
562
|
+
return b(i, t, e);
|
|
563
563
|
};
|
|
564
|
-
function
|
|
564
|
+
function w(i) {
|
|
565
565
|
return d(i), l(i < 0 ? 0 : R(i) | 0);
|
|
566
566
|
}
|
|
567
567
|
a.allocUnsafe = function(i) {
|
|
568
|
-
return
|
|
568
|
+
return w(i);
|
|
569
569
|
}, a.allocUnsafeSlow = function(i) {
|
|
570
|
-
return
|
|
570
|
+
return w(i);
|
|
571
571
|
};
|
|
572
572
|
function v(i, t) {
|
|
573
573
|
if ((typeof t != "string" || t === "") && (t = "utf8"), !a.isEncoding(t))
|
|
@@ -622,9 +622,9 @@ ht.write = function(o, r, p, c, u, m) {
|
|
|
622
622
|
);
|
|
623
623
|
if (t === e)
|
|
624
624
|
return 0;
|
|
625
|
-
for (var n = t.length, s = e.length,
|
|
626
|
-
if (t[
|
|
627
|
-
n = t[
|
|
625
|
+
for (var n = t.length, s = e.length, m = 0, h = Math.min(n, s); m < h; ++m)
|
|
626
|
+
if (t[m] !== e[m]) {
|
|
627
|
+
n = t[m], s = e[m];
|
|
628
628
|
break;
|
|
629
629
|
}
|
|
630
630
|
return n < s ? -1 : s < n ? 1 : 0;
|
|
@@ -654,20 +654,20 @@ ht.write = function(o, r, p, c, u, m) {
|
|
|
654
654
|
if (e === void 0)
|
|
655
655
|
for (e = 0, n = 0; n < t.length; ++n)
|
|
656
656
|
e += t[n].length;
|
|
657
|
-
var s = a.allocUnsafe(e),
|
|
657
|
+
var s = a.allocUnsafe(e), m = 0;
|
|
658
658
|
for (n = 0; n < t.length; ++n) {
|
|
659
659
|
var h = t[n];
|
|
660
660
|
if (T(h, Uint8Array))
|
|
661
|
-
|
|
661
|
+
m + h.length > s.length ? a.from(h).copy(s, m) : Uint8Array.prototype.set.call(
|
|
662
662
|
s,
|
|
663
663
|
h,
|
|
664
|
-
|
|
664
|
+
m
|
|
665
665
|
);
|
|
666
666
|
else if (a.isBuffer(h))
|
|
667
|
-
h.copy(s,
|
|
667
|
+
h.copy(s, m);
|
|
668
668
|
else
|
|
669
669
|
throw new TypeError('"list" argument must be an Array of Buffers');
|
|
670
|
-
|
|
670
|
+
m += h.length;
|
|
671
671
|
}
|
|
672
672
|
return s;
|
|
673
673
|
};
|
|
@@ -773,27 +773,27 @@ ht.write = function(o, r, p, c, u, m) {
|
|
|
773
773
|
}, a.prototype.inspect = function() {
|
|
774
774
|
var t = "", e = o.INSPECT_MAX_BYTES;
|
|
775
775
|
return t = this.toString("hex", 0, e).replace(/(.{2})/g, "$1 ").trim(), this.length > e && (t += " ... "), "<Buffer " + t + ">";
|
|
776
|
-
}, c && (a.prototype[c] = a.prototype.inspect), a.prototype.compare = function(t, e, n, s,
|
|
776
|
+
}, c && (a.prototype[c] = a.prototype.inspect), a.prototype.compare = function(t, e, n, s, m) {
|
|
777
777
|
if (T(t, Uint8Array) && (t = a.from(t, t.offset, t.byteLength)), !a.isBuffer(t))
|
|
778
778
|
throw new TypeError(
|
|
779
779
|
'The "target" argument must be one of type Buffer or Uint8Array. Received type ' + typeof t
|
|
780
780
|
);
|
|
781
|
-
if (e === void 0 && (e = 0), n === void 0 && (n = t ? t.length : 0), s === void 0 && (s = 0),
|
|
781
|
+
if (e === void 0 && (e = 0), n === void 0 && (n = t ? t.length : 0), s === void 0 && (s = 0), m === void 0 && (m = this.length), e < 0 || n > t.length || s < 0 || m > this.length)
|
|
782
782
|
throw new RangeError("out of range index");
|
|
783
|
-
if (s >=
|
|
783
|
+
if (s >= m && e >= n)
|
|
784
784
|
return 0;
|
|
785
|
-
if (s >=
|
|
785
|
+
if (s >= m)
|
|
786
786
|
return -1;
|
|
787
787
|
if (e >= n)
|
|
788
788
|
return 1;
|
|
789
|
-
if (e >>>= 0, n >>>= 0, s >>>= 0,
|
|
789
|
+
if (e >>>= 0, n >>>= 0, s >>>= 0, m >>>= 0, this === t)
|
|
790
790
|
return 0;
|
|
791
|
-
for (var h =
|
|
791
|
+
for (var h = m - s, E = n - e, _ = Math.min(h, E), F = this.slice(s, m), k = t.slice(e, n), A = 0; A < _; ++A)
|
|
792
792
|
if (F[A] !== k[A]) {
|
|
793
|
-
h = F[A],
|
|
793
|
+
h = F[A], E = k[A];
|
|
794
794
|
break;
|
|
795
795
|
}
|
|
796
|
-
return h <
|
|
796
|
+
return h < E ? -1 : E < h ? 1 : 0;
|
|
797
797
|
};
|
|
798
798
|
function yt(i, t, e, n, s) {
|
|
799
799
|
if (i.length === 0)
|
|
@@ -814,27 +814,27 @@ ht.write = function(o, r, p, c, u, m) {
|
|
|
814
814
|
throw new TypeError("val must be string, number or Buffer");
|
|
815
815
|
}
|
|
816
816
|
function vt(i, t, e, n, s) {
|
|
817
|
-
var
|
|
817
|
+
var m = 1, h = i.length, E = t.length;
|
|
818
818
|
if (n !== void 0 && (n = String(n).toLowerCase(), n === "ucs2" || n === "ucs-2" || n === "utf16le" || n === "utf-16le")) {
|
|
819
819
|
if (i.length < 2 || t.length < 2)
|
|
820
820
|
return -1;
|
|
821
|
-
|
|
821
|
+
m = 2, h /= 2, E /= 2, e /= 2;
|
|
822
822
|
}
|
|
823
823
|
function _(kt, Bt) {
|
|
824
|
-
return
|
|
824
|
+
return m === 1 ? kt[Bt] : kt.readUInt16BE(Bt * m);
|
|
825
825
|
}
|
|
826
826
|
var F;
|
|
827
827
|
if (s) {
|
|
828
828
|
var k = -1;
|
|
829
829
|
for (F = e; F < h; F++)
|
|
830
830
|
if (_(i, F) === _(t, k === -1 ? 0 : F - k)) {
|
|
831
|
-
if (k === -1 && (k = F), F - k + 1 ===
|
|
832
|
-
return k *
|
|
831
|
+
if (k === -1 && (k = F), F - k + 1 === E)
|
|
832
|
+
return k * m;
|
|
833
833
|
} else
|
|
834
834
|
k !== -1 && (F -= F - k), k = -1;
|
|
835
835
|
} else
|
|
836
|
-
for (e +
|
|
837
|
-
for (var A = !0, K = 0; K <
|
|
836
|
+
for (e + E > h && (e = h - E), F = e; F >= 0; F--) {
|
|
837
|
+
for (var A = !0, K = 0; K < E; K++)
|
|
838
838
|
if (_(i, F + K) !== _(t, K)) {
|
|
839
839
|
A = !1;
|
|
840
840
|
break;
|
|
@@ -855,13 +855,13 @@ ht.write = function(o, r, p, c, u, m) {
|
|
|
855
855
|
e = Number(e) || 0;
|
|
856
856
|
var s = i.length - e;
|
|
857
857
|
n ? (n = Number(n), n > s && (n = s)) : n = s;
|
|
858
|
-
var
|
|
859
|
-
n >
|
|
858
|
+
var m = t.length;
|
|
859
|
+
n > m / 2 && (n = m / 2);
|
|
860
860
|
for (var h = 0; h < n; ++h) {
|
|
861
|
-
var
|
|
862
|
-
if (rt(
|
|
861
|
+
var E = parseInt(t.substr(h * 2, 2), 16);
|
|
862
|
+
if (rt(E))
|
|
863
863
|
return h;
|
|
864
|
-
i[e + h] =
|
|
864
|
+
i[e + h] = E;
|
|
865
865
|
}
|
|
866
866
|
return h;
|
|
867
867
|
}
|
|
@@ -888,8 +888,8 @@ ht.write = function(o, r, p, c, u, m) {
|
|
|
888
888
|
throw new Error(
|
|
889
889
|
"Buffer.write(string, encoding, offset[, length]) is no longer supported"
|
|
890
890
|
);
|
|
891
|
-
var
|
|
892
|
-
if ((n === void 0 || n >
|
|
891
|
+
var m = this.length - e;
|
|
892
|
+
if ((n === void 0 || n > m) && (n = m), t.length > 0 && (n < 0 || e < 0) || e > this.length)
|
|
893
893
|
throw new RangeError("Attempt to write outside buffer bounds");
|
|
894
894
|
s || (s = "utf8");
|
|
895
895
|
for (var h = !1; ; )
|
|
@@ -927,24 +927,24 @@ ht.write = function(o, r, p, c, u, m) {
|
|
|
927
927
|
function bt(i, t, e) {
|
|
928
928
|
e = Math.min(i.length, e);
|
|
929
929
|
for (var n = [], s = t; s < e; ) {
|
|
930
|
-
var
|
|
931
|
-
if (s +
|
|
930
|
+
var m = i[s], h = null, E = m > 239 ? 4 : m > 223 ? 3 : m > 191 ? 2 : 1;
|
|
931
|
+
if (s + E <= e) {
|
|
932
932
|
var _, F, k, A;
|
|
933
|
-
switch (
|
|
933
|
+
switch (E) {
|
|
934
934
|
case 1:
|
|
935
|
-
|
|
935
|
+
m < 128 && (h = m);
|
|
936
936
|
break;
|
|
937
937
|
case 2:
|
|
938
|
-
_ = i[s + 1], (_ & 192) === 128 && (A = (
|
|
938
|
+
_ = i[s + 1], (_ & 192) === 128 && (A = (m & 31) << 6 | _ & 63, A > 127 && (h = A));
|
|
939
939
|
break;
|
|
940
940
|
case 3:
|
|
941
|
-
_ = i[s + 1], F = i[s + 2], (_ & 192) === 128 && (F & 192) === 128 && (A = (
|
|
941
|
+
_ = i[s + 1], F = i[s + 2], (_ & 192) === 128 && (F & 192) === 128 && (A = (m & 15) << 12 | (_ & 63) << 6 | F & 63, A > 2047 && (A < 55296 || A > 57343) && (h = A));
|
|
942
942
|
break;
|
|
943
943
|
case 4:
|
|
944
|
-
_ = i[s + 1], F = i[s + 2], k = i[s + 3], (_ & 192) === 128 && (F & 192) === 128 && (k & 192) === 128 && (A = (
|
|
944
|
+
_ = i[s + 1], F = i[s + 2], k = i[s + 3], (_ & 192) === 128 && (F & 192) === 128 && (k & 192) === 128 && (A = (m & 15) << 18 | (_ & 63) << 12 | (F & 63) << 6 | k & 63, A > 65535 && A < 1114112 && (h = A));
|
|
945
945
|
}
|
|
946
946
|
}
|
|
947
|
-
h === null ? (h = 65533,
|
|
947
|
+
h === null ? (h = 65533, E = 1) : h > 65535 && (h -= 65536, n.push(h >>> 10 & 1023 | 55296), h = 56320 | h & 1023), n.push(h), s += E;
|
|
948
948
|
}
|
|
949
949
|
return ge(n);
|
|
950
950
|
}
|
|
@@ -977,13 +977,13 @@ ht.write = function(o, r, p, c, u, m) {
|
|
|
977
977
|
function be(i, t, e) {
|
|
978
978
|
var n = i.length;
|
|
979
979
|
(!t || t < 0) && (t = 0), (!e || e < 0 || e > n) && (e = n);
|
|
980
|
-
for (var s = "",
|
|
981
|
-
s += ke[i[
|
|
980
|
+
for (var s = "", m = t; m < e; ++m)
|
|
981
|
+
s += ke[i[m]];
|
|
982
982
|
return s;
|
|
983
983
|
}
|
|
984
984
|
function Ee(i, t, e) {
|
|
985
|
-
for (var n = i.slice(t, e), s = "",
|
|
986
|
-
s += String.fromCharCode(n[
|
|
985
|
+
for (var n = i.slice(t, e), s = "", m = 0; m < n.length - 1; m += 2)
|
|
986
|
+
s += String.fromCharCode(n[m] + n[m + 1] * 256);
|
|
987
987
|
return s;
|
|
988
988
|
}
|
|
989
989
|
a.prototype.slice = function(t, e) {
|
|
@@ -1000,13 +1000,13 @@ ht.write = function(o, r, p, c, u, m) {
|
|
|
1000
1000
|
}
|
|
1001
1001
|
a.prototype.readUintLE = a.prototype.readUIntLE = function(t, e, n) {
|
|
1002
1002
|
t = t >>> 0, e = e >>> 0, n || S(t, e, this.length);
|
|
1003
|
-
for (var s = this[t],
|
|
1004
|
-
s += this[t + h] *
|
|
1003
|
+
for (var s = this[t], m = 1, h = 0; ++h < e && (m *= 256); )
|
|
1004
|
+
s += this[t + h] * m;
|
|
1005
1005
|
return s;
|
|
1006
1006
|
}, a.prototype.readUintBE = a.prototype.readUIntBE = function(t, e, n) {
|
|
1007
1007
|
t = t >>> 0, e = e >>> 0, n || S(t, e, this.length);
|
|
1008
|
-
for (var s = this[t + --e],
|
|
1009
|
-
s += this[t + --e] *
|
|
1008
|
+
for (var s = this[t + --e], m = 1; e > 0 && (m *= 256); )
|
|
1009
|
+
s += this[t + --e] * m;
|
|
1010
1010
|
return s;
|
|
1011
1011
|
}, a.prototype.readUint8 = a.prototype.readUInt8 = function(t, e) {
|
|
1012
1012
|
return t = t >>> 0, e || S(t, 1, this.length), this[t];
|
|
@@ -1020,14 +1020,14 @@ ht.write = function(o, r, p, c, u, m) {
|
|
|
1020
1020
|
return t = t >>> 0, e || S(t, 4, this.length), this[t] * 16777216 + (this[t + 1] << 16 | this[t + 2] << 8 | this[t + 3]);
|
|
1021
1021
|
}, a.prototype.readIntLE = function(t, e, n) {
|
|
1022
1022
|
t = t >>> 0, e = e >>> 0, n || S(t, e, this.length);
|
|
1023
|
-
for (var s = this[t],
|
|
1024
|
-
s += this[t + h] *
|
|
1025
|
-
return
|
|
1023
|
+
for (var s = this[t], m = 1, h = 0; ++h < e && (m *= 256); )
|
|
1024
|
+
s += this[t + h] * m;
|
|
1025
|
+
return m *= 128, s >= m && (s -= Math.pow(2, 8 * e)), s;
|
|
1026
1026
|
}, a.prototype.readIntBE = function(t, e, n) {
|
|
1027
1027
|
t = t >>> 0, e = e >>> 0, n || S(t, e, this.length);
|
|
1028
|
-
for (var s = e,
|
|
1029
|
-
h += this[t + --s] *
|
|
1030
|
-
return
|
|
1028
|
+
for (var s = e, m = 1, h = this[t + --s]; s > 0 && (m *= 256); )
|
|
1029
|
+
h += this[t + --s] * m;
|
|
1030
|
+
return m *= 128, h >= m && (h -= Math.pow(2, 8 * e)), h;
|
|
1031
1031
|
}, a.prototype.readInt8 = function(t, e) {
|
|
1032
1032
|
return t = t >>> 0, e || S(t, 1, this.length), this[t] & 128 ? (255 - this[t] + 1) * -1 : this[t];
|
|
1033
1033
|
}, a.prototype.readInt16LE = function(t, e) {
|
|
@@ -1051,31 +1051,31 @@ ht.write = function(o, r, p, c, u, m) {
|
|
|
1051
1051
|
}, a.prototype.readDoubleBE = function(t, e) {
|
|
1052
1052
|
return t = t >>> 0, e || S(t, 8, this.length), p.read(this, t, !1, 52, 8);
|
|
1053
1053
|
};
|
|
1054
|
-
function B(i, t, e, n, s,
|
|
1054
|
+
function B(i, t, e, n, s, m) {
|
|
1055
1055
|
if (!a.isBuffer(i))
|
|
1056
1056
|
throw new TypeError('"buffer" argument must be a Buffer instance');
|
|
1057
|
-
if (t > s || t <
|
|
1057
|
+
if (t > s || t < m)
|
|
1058
1058
|
throw new RangeError('"value" argument is out of bounds');
|
|
1059
1059
|
if (e + n > i.length)
|
|
1060
1060
|
throw new RangeError("Index out of range");
|
|
1061
1061
|
}
|
|
1062
1062
|
a.prototype.writeUintLE = a.prototype.writeUIntLE = function(t, e, n, s) {
|
|
1063
1063
|
if (t = +t, e = e >>> 0, n = n >>> 0, !s) {
|
|
1064
|
-
var
|
|
1065
|
-
B(this, t, e, n,
|
|
1064
|
+
var m = Math.pow(2, 8 * n) - 1;
|
|
1065
|
+
B(this, t, e, n, m, 0);
|
|
1066
1066
|
}
|
|
1067
|
-
var h = 1,
|
|
1068
|
-
for (this[e] = t & 255; ++
|
|
1069
|
-
this[e +
|
|
1067
|
+
var h = 1, E = 0;
|
|
1068
|
+
for (this[e] = t & 255; ++E < n && (h *= 256); )
|
|
1069
|
+
this[e + E] = t / h & 255;
|
|
1070
1070
|
return e + n;
|
|
1071
1071
|
}, a.prototype.writeUintBE = a.prototype.writeUIntBE = function(t, e, n, s) {
|
|
1072
1072
|
if (t = +t, e = e >>> 0, n = n >>> 0, !s) {
|
|
1073
|
-
var
|
|
1074
|
-
B(this, t, e, n,
|
|
1073
|
+
var m = Math.pow(2, 8 * n) - 1;
|
|
1074
|
+
B(this, t, e, n, m, 0);
|
|
1075
1075
|
}
|
|
1076
|
-
var h = n - 1,
|
|
1077
|
-
for (this[e + h] = t & 255; --h >= 0 && (
|
|
1078
|
-
this[e + h] = t /
|
|
1076
|
+
var h = n - 1, E = 1;
|
|
1077
|
+
for (this[e + h] = t & 255; --h >= 0 && (E *= 256); )
|
|
1078
|
+
this[e + h] = t / E & 255;
|
|
1079
1079
|
return e + n;
|
|
1080
1080
|
}, a.prototype.writeUint8 = a.prototype.writeUInt8 = function(t, e, n) {
|
|
1081
1081
|
return t = +t, e = e >>> 0, n || B(this, t, e, 1, 255, 0), this[e] = t & 255, e + 1;
|
|
@@ -1089,21 +1089,21 @@ ht.write = function(o, r, p, c, u, m) {
|
|
|
1089
1089
|
return t = +t, e = e >>> 0, n || B(this, t, e, 4, 4294967295, 0), this[e] = t >>> 24, this[e + 1] = t >>> 16, this[e + 2] = t >>> 8, this[e + 3] = t & 255, e + 4;
|
|
1090
1090
|
}, a.prototype.writeIntLE = function(t, e, n, s) {
|
|
1091
1091
|
if (t = +t, e = e >>> 0, !s) {
|
|
1092
|
-
var
|
|
1093
|
-
B(this, t, e, n,
|
|
1092
|
+
var m = Math.pow(2, 8 * n - 1);
|
|
1093
|
+
B(this, t, e, n, m - 1, -m);
|
|
1094
1094
|
}
|
|
1095
|
-
var h = 0,
|
|
1096
|
-
for (this[e] = t & 255; ++h < n && (
|
|
1097
|
-
t < 0 && _ === 0 && this[e + h - 1] !== 0 && (_ = 1), this[e + h] = (t /
|
|
1095
|
+
var h = 0, E = 1, _ = 0;
|
|
1096
|
+
for (this[e] = t & 255; ++h < n && (E *= 256); )
|
|
1097
|
+
t < 0 && _ === 0 && this[e + h - 1] !== 0 && (_ = 1), this[e + h] = (t / E >> 0) - _ & 255;
|
|
1098
1098
|
return e + n;
|
|
1099
1099
|
}, a.prototype.writeIntBE = function(t, e, n, s) {
|
|
1100
1100
|
if (t = +t, e = e >>> 0, !s) {
|
|
1101
|
-
var
|
|
1102
|
-
B(this, t, e, n,
|
|
1101
|
+
var m = Math.pow(2, 8 * n - 1);
|
|
1102
|
+
B(this, t, e, n, m - 1, -m);
|
|
1103
1103
|
}
|
|
1104
|
-
var h = n - 1,
|
|
1105
|
-
for (this[e + h] = t & 255; --h >= 0 && (
|
|
1106
|
-
t < 0 && _ === 0 && this[e + h + 1] !== 0 && (_ = 1), this[e + h] = (t /
|
|
1104
|
+
var h = n - 1, E = 1, _ = 0;
|
|
1105
|
+
for (this[e + h] = t & 255; --h >= 0 && (E *= 256); )
|
|
1106
|
+
t < 0 && _ === 0 && this[e + h + 1] !== 0 && (_ = 1), this[e + h] = (t / E >> 0) - _ & 255;
|
|
1107
1107
|
return e + n;
|
|
1108
1108
|
}, a.prototype.writeInt8 = function(t, e, n) {
|
|
1109
1109
|
return t = +t, e = e >>> 0, n || B(this, t, e, 1, 127, -128), t < 0 && (t = 255 + t + 1), this[e] = t & 255, e + 1;
|
|
@@ -1116,7 +1116,7 @@ ht.write = function(o, r, p, c, u, m) {
|
|
|
1116
1116
|
}, a.prototype.writeInt32BE = function(t, e, n) {
|
|
1117
1117
|
return t = +t, e = e >>> 0, n || B(this, t, e, 4, 2147483647, -2147483648), t < 0 && (t = 4294967295 + t + 1), this[e] = t >>> 24, this[e + 1] = t >>> 16, this[e + 2] = t >>> 8, this[e + 3] = t & 255, e + 4;
|
|
1118
1118
|
};
|
|
1119
|
-
function _t(i, t, e, n, s,
|
|
1119
|
+
function _t(i, t, e, n, s, m) {
|
|
1120
1120
|
if (e + n > i.length)
|
|
1121
1121
|
throw new RangeError("Index out of range");
|
|
1122
1122
|
if (e < 0)
|
|
@@ -1149,12 +1149,12 @@ ht.write = function(o, r, p, c, u, m) {
|
|
|
1149
1149
|
if (s < 0)
|
|
1150
1150
|
throw new RangeError("sourceEnd out of bounds");
|
|
1151
1151
|
s > this.length && (s = this.length), t.length - e < s - n && (s = t.length - e + n);
|
|
1152
|
-
var
|
|
1152
|
+
var m = s - n;
|
|
1153
1153
|
return this === t && typeof Uint8Array.prototype.copyWithin == "function" ? this.copyWithin(e, n, s) : Uint8Array.prototype.set.call(
|
|
1154
1154
|
t,
|
|
1155
1155
|
this.subarray(n, s),
|
|
1156
1156
|
e
|
|
1157
|
-
),
|
|
1157
|
+
), m;
|
|
1158
1158
|
}, a.prototype.fill = function(t, e, n, s) {
|
|
1159
1159
|
if (typeof t == "string") {
|
|
1160
1160
|
if (typeof e == "string" ? (s = e, e = 0, n = this.length) : typeof n == "string" && (s = n, n = this.length), s !== void 0 && typeof s != "string")
|
|
@@ -1162,8 +1162,8 @@ ht.write = function(o, r, p, c, u, m) {
|
|
|
1162
1162
|
if (typeof s == "string" && !a.isEncoding(s))
|
|
1163
1163
|
throw new TypeError("Unknown encoding: " + s);
|
|
1164
1164
|
if (t.length === 1) {
|
|
1165
|
-
var
|
|
1166
|
-
(s === "utf8" &&
|
|
1165
|
+
var m = t.charCodeAt(0);
|
|
1166
|
+
(s === "utf8" && m < 128 || s === "latin1") && (t = m);
|
|
1167
1167
|
}
|
|
1168
1168
|
} else
|
|
1169
1169
|
typeof t == "number" ? t = t & 255 : typeof t == "boolean" && (t = Number(t));
|
|
@@ -1177,11 +1177,11 @@ ht.write = function(o, r, p, c, u, m) {
|
|
|
1177
1177
|
for (h = e; h < n; ++h)
|
|
1178
1178
|
this[h] = t;
|
|
1179
1179
|
else {
|
|
1180
|
-
var
|
|
1180
|
+
var E = a.isBuffer(t) ? t : a.from(t, s), _ = E.length;
|
|
1181
1181
|
if (_ === 0)
|
|
1182
1182
|
throw new TypeError('The value "' + t + '" is invalid for argument "value"');
|
|
1183
1183
|
for (h = 0; h < n - e; ++h)
|
|
1184
|
-
this[h + e] =
|
|
1184
|
+
this[h + e] = E[h % _];
|
|
1185
1185
|
}
|
|
1186
1186
|
return this;
|
|
1187
1187
|
};
|
|
@@ -1195,41 +1195,41 @@ ht.write = function(o, r, p, c, u, m) {
|
|
|
1195
1195
|
}
|
|
1196
1196
|
function it(i, t) {
|
|
1197
1197
|
t = t || 1 / 0;
|
|
1198
|
-
for (var e, n = i.length, s = null,
|
|
1198
|
+
for (var e, n = i.length, s = null, m = [], h = 0; h < n; ++h) {
|
|
1199
1199
|
if (e = i.charCodeAt(h), e > 55295 && e < 57344) {
|
|
1200
1200
|
if (!s) {
|
|
1201
1201
|
if (e > 56319) {
|
|
1202
|
-
(t -= 3) > -1 &&
|
|
1202
|
+
(t -= 3) > -1 && m.push(239, 191, 189);
|
|
1203
1203
|
continue;
|
|
1204
1204
|
} else if (h + 1 === n) {
|
|
1205
|
-
(t -= 3) > -1 &&
|
|
1205
|
+
(t -= 3) > -1 && m.push(239, 191, 189);
|
|
1206
1206
|
continue;
|
|
1207
1207
|
}
|
|
1208
1208
|
s = e;
|
|
1209
1209
|
continue;
|
|
1210
1210
|
}
|
|
1211
1211
|
if (e < 56320) {
|
|
1212
|
-
(t -= 3) > -1 &&
|
|
1212
|
+
(t -= 3) > -1 && m.push(239, 191, 189), s = e;
|
|
1213
1213
|
continue;
|
|
1214
1214
|
}
|
|
1215
1215
|
e = (s - 55296 << 10 | e - 56320) + 65536;
|
|
1216
1216
|
} else
|
|
1217
|
-
s && (t -= 3) > -1 &&
|
|
1217
|
+
s && (t -= 3) > -1 && m.push(239, 191, 189);
|
|
1218
1218
|
if (s = null, e < 128) {
|
|
1219
1219
|
if ((t -= 1) < 0)
|
|
1220
1220
|
break;
|
|
1221
|
-
|
|
1221
|
+
m.push(e);
|
|
1222
1222
|
} else if (e < 2048) {
|
|
1223
1223
|
if ((t -= 2) < 0)
|
|
1224
1224
|
break;
|
|
1225
|
-
|
|
1225
|
+
m.push(
|
|
1226
1226
|
e >> 6 | 192,
|
|
1227
1227
|
e & 63 | 128
|
|
1228
1228
|
);
|
|
1229
1229
|
} else if (e < 65536) {
|
|
1230
1230
|
if ((t -= 3) < 0)
|
|
1231
1231
|
break;
|
|
1232
|
-
|
|
1232
|
+
m.push(
|
|
1233
1233
|
e >> 12 | 224,
|
|
1234
1234
|
e >> 6 & 63 | 128,
|
|
1235
1235
|
e & 63 | 128
|
|
@@ -1237,7 +1237,7 @@ ht.write = function(o, r, p, c, u, m) {
|
|
|
1237
1237
|
} else if (e < 1114112) {
|
|
1238
1238
|
if ((t -= 4) < 0)
|
|
1239
1239
|
break;
|
|
1240
|
-
|
|
1240
|
+
m.push(
|
|
1241
1241
|
e >> 18 | 240,
|
|
1242
1242
|
e >> 12 & 63 | 128,
|
|
1243
1243
|
e >> 6 & 63 | 128,
|
|
@@ -1246,7 +1246,7 @@ ht.write = function(o, r, p, c, u, m) {
|
|
|
1246
1246
|
} else
|
|
1247
1247
|
throw new Error("Invalid code point");
|
|
1248
1248
|
}
|
|
1249
|
-
return
|
|
1249
|
+
return m;
|
|
1250
1250
|
}
|
|
1251
1251
|
function Ae(i) {
|
|
1252
1252
|
for (var t = [], e = 0; e < i.length; ++e)
|
|
@@ -1254,9 +1254,9 @@ ht.write = function(o, r, p, c, u, m) {
|
|
|
1254
1254
|
return t;
|
|
1255
1255
|
}
|
|
1256
1256
|
function Se(i, t) {
|
|
1257
|
-
for (var e, n, s,
|
|
1258
|
-
e = i.charCodeAt(h), n = e >> 8, s = e % 256,
|
|
1259
|
-
return
|
|
1257
|
+
for (var e, n, s, m = [], h = 0; h < i.length && !((t -= 2) < 0); ++h)
|
|
1258
|
+
e = i.charCodeAt(h), n = e >> 8, s = e % 256, m.push(s), m.push(n);
|
|
1259
|
+
return m;
|
|
1260
1260
|
}
|
|
1261
1261
|
function St(i) {
|
|
1262
1262
|
return r.toByteArray(Fe(i));
|
|
@@ -1286,24 +1286,24 @@ ht.write = function(o, r, p, c, u, m) {
|
|
|
1286
1286
|
for (var x in l)
|
|
1287
1287
|
a[x] = l[x];
|
|
1288
1288
|
}
|
|
1289
|
-
c.from && c.alloc && c.allocUnsafe && c.allocUnsafeSlow ? o.exports = p : (u(p, r), r.Buffer =
|
|
1290
|
-
function
|
|
1289
|
+
c.from && c.alloc && c.allocUnsafe && c.allocUnsafeSlow ? o.exports = p : (u(p, r), r.Buffer = f);
|
|
1290
|
+
function f(l, a, x) {
|
|
1291
1291
|
return c(l, a, x);
|
|
1292
1292
|
}
|
|
1293
|
-
|
|
1293
|
+
f.prototype = Object.create(c.prototype), u(c, f), f.from = function(l, a, x) {
|
|
1294
1294
|
if (typeof l == "number")
|
|
1295
1295
|
throw new TypeError("Argument must not be a number");
|
|
1296
1296
|
return c(l, a, x);
|
|
1297
|
-
},
|
|
1297
|
+
}, f.alloc = function(l, a, x) {
|
|
1298
1298
|
if (typeof l != "number")
|
|
1299
1299
|
throw new TypeError("Argument must be a number");
|
|
1300
1300
|
var d = c(l);
|
|
1301
1301
|
return a !== void 0 ? typeof x == "string" ? d.fill(a, x) : d.fill(a) : d.fill(0), d;
|
|
1302
|
-
},
|
|
1302
|
+
}, f.allocUnsafe = function(l) {
|
|
1303
1303
|
if (typeof l != "number")
|
|
1304
1304
|
throw new TypeError("Argument must be a number");
|
|
1305
1305
|
return c(l);
|
|
1306
|
-
},
|
|
1306
|
+
}, f.allocUnsafeSlow = function(l) {
|
|
1307
1307
|
if (typeof l != "number")
|
|
1308
1308
|
throw new TypeError("Argument must be a number");
|
|
1309
1309
|
return p.SlowBuffer(l);
|
|
@@ -1315,10 +1315,10 @@ function tt(o, r) {
|
|
|
1315
1315
|
}
|
|
1316
1316
|
tt.prototype.update = function(o, r) {
|
|
1317
1317
|
typeof o == "string" && (r = r || "utf8", o = Xt.from(o, r));
|
|
1318
|
-
for (var p = this._block, c = this._blockSize, u = o.length,
|
|
1319
|
-
for (var a =
|
|
1318
|
+
for (var p = this._block, c = this._blockSize, u = o.length, f = this._len, l = 0; l < u; ) {
|
|
1319
|
+
for (var a = f % c, x = Math.min(u - l, c - a), d = 0; d < x; d++)
|
|
1320
1320
|
p[a + d] = o[l + d];
|
|
1321
|
-
|
|
1321
|
+
f += x, l += x, f % c === 0 && this._update(p);
|
|
1322
1322
|
}
|
|
1323
1323
|
return this._len += u, this;
|
|
1324
1324
|
};
|
|
@@ -1333,8 +1333,8 @@ tt.prototype.digest = function(o) {
|
|
|
1333
1333
|
this._block.writeUInt32BE(u, this._blockSize - 8), this._block.writeUInt32BE(c, this._blockSize - 4);
|
|
1334
1334
|
}
|
|
1335
1335
|
this._update(this._block);
|
|
1336
|
-
var
|
|
1337
|
-
return o ?
|
|
1336
|
+
var f = this._hash();
|
|
1337
|
+
return o ? f.toString(o) : f;
|
|
1338
1338
|
};
|
|
1339
1339
|
tt.prototype._update = function() {
|
|
1340
1340
|
throw new Error("_update must be implemented by subclass");
|
|
@@ -1365,15 +1365,15 @@ function xi(o, r, p, c) {
|
|
|
1365
1365
|
return o === 0 ? r & p | ~r & c : o === 2 ? r & p | r & c | p & c : r ^ p ^ c;
|
|
1366
1366
|
}
|
|
1367
1367
|
Y.prototype._update = function(o) {
|
|
1368
|
-
for (var r = this._w, p = this._a | 0, c = this._b | 0, u = this._c | 0,
|
|
1368
|
+
for (var r = this._w, p = this._a | 0, c = this._b | 0, u = this._c | 0, f = this._d | 0, l = this._e | 0, a = 0; a < 16; ++a)
|
|
1369
1369
|
r[a] = o.readInt32BE(a * 4);
|
|
1370
1370
|
for (; a < 80; ++a)
|
|
1371
1371
|
r[a] = fi(r[a - 3] ^ r[a - 8] ^ r[a - 14] ^ r[a - 16]);
|
|
1372
1372
|
for (var x = 0; x < 80; ++x) {
|
|
1373
|
-
var d = ~~(x / 20),
|
|
1374
|
-
l =
|
|
1373
|
+
var d = ~~(x / 20), b = mi(p) + xi(d, c, u, f) + l + r[x] + li[d] | 0;
|
|
1374
|
+
l = f, f = u, u = hi(c), c = p, p = b;
|
|
1375
1375
|
}
|
|
1376
|
-
this._a = p + this._a | 0, this._b = c + this._b | 0, this._c = u + this._c | 0, this._d =
|
|
1376
|
+
this._a = p + this._a | 0, this._b = c + this._b | 0, this._c = u + this._c | 0, this._d = f + this._d | 0, this._e = l + this._e | 0;
|
|
1377
1377
|
};
|
|
1378
1378
|
Y.prototype._hash = function() {
|
|
1379
1379
|
var o = ci.allocUnsafe(20);
|
|
@@ -1417,17 +1417,17 @@ function q(o, r, p, c, u = "global") {
|
|
|
1417
1417
|
throw new Error("Empty action type");
|
|
1418
1418
|
if (typeof o != "string")
|
|
1419
1419
|
throw new Error(`Invalid action type: ${o}`);
|
|
1420
|
-
const
|
|
1421
|
-
p && (
|
|
1420
|
+
const f = { type: o, input: r, scope: u };
|
|
1421
|
+
p && (f.attachments = p);
|
|
1422
1422
|
try {
|
|
1423
|
-
c == null || c().parse(
|
|
1423
|
+
c == null || c().parse(f.input);
|
|
1424
1424
|
} catch (l) {
|
|
1425
1425
|
throw new Error(`Invalid action input: ${l}`);
|
|
1426
1426
|
}
|
|
1427
|
-
return
|
|
1427
|
+
return f;
|
|
1428
1428
|
}
|
|
1429
1429
|
function _i(o, r = Yt) {
|
|
1430
|
-
return (p, c, u,
|
|
1430
|
+
return (p, c, u, f) => r(p, c, o, u, f);
|
|
1431
1431
|
}
|
|
1432
1432
|
const Fi = (o, r) => ({
|
|
1433
1433
|
name: "",
|
|
@@ -1452,7 +1452,7 @@ const Fi = (o, r) => ({
|
|
|
1452
1452
|
operations: { global: [], local: [] },
|
|
1453
1453
|
clipboard: []
|
|
1454
1454
|
};
|
|
1455
|
-
}, ee = (o, r = "global") => et(Ue(o.state[r])),
|
|
1455
|
+
}, ee = (o, r = "global") => et(Ue(o.state[r])), zi = (o, r = 1e3) => {
|
|
1456
1456
|
const p = Math.random() * r;
|
|
1457
1457
|
return et(`${(o ?? /* @__PURE__ */ new Date()).toISOString()}${p}`);
|
|
1458
1458
|
};
|
|
@@ -1462,7 +1462,7 @@ function X(o) {
|
|
|
1462
1462
|
function Si(o, r) {
|
|
1463
1463
|
const p = [...o];
|
|
1464
1464
|
let c = r || 0, u = p.length > 0 ? p[p.length - 1].index : 0;
|
|
1465
|
-
const
|
|
1465
|
+
const f = [];
|
|
1466
1466
|
for (const l of p.reverse()) {
|
|
1467
1467
|
if (c > 0) {
|
|
1468
1468
|
const d = u - l.index;
|
|
@@ -1478,11 +1478,11 @@ function Si(o, r) {
|
|
|
1478
1478
|
const d = x - c;
|
|
1479
1479
|
c = c + d;
|
|
1480
1480
|
}
|
|
1481
|
-
u = l.index,
|
|
1481
|
+
u = l.index, f.push(a);
|
|
1482
1482
|
}
|
|
1483
|
-
return
|
|
1483
|
+
return f.reverse();
|
|
1484
1484
|
}
|
|
1485
|
-
function
|
|
1485
|
+
function Pi(o) {
|
|
1486
1486
|
return Object.values(o).flatMap((r) => r).sort(
|
|
1487
1487
|
(r, p) => new Date(r.timestamp).getTime() - new Date(p.timestamp).getTime()
|
|
1488
1488
|
);
|
|
@@ -1492,8 +1492,8 @@ function ki(o) {
|
|
|
1492
1492
|
(r, p) => new Date(r.operation.timestamp).getTime() - new Date(p.operation.timestamp).getTime()
|
|
1493
1493
|
);
|
|
1494
1494
|
}
|
|
1495
|
-
function st(o, r, p, c, u,
|
|
1496
|
-
const a = _i(p,
|
|
1495
|
+
function st(o, r, p, c, u, f = Yt, l = {}) {
|
|
1496
|
+
const a = _i(p, f);
|
|
1497
1497
|
return ie(
|
|
1498
1498
|
o,
|
|
1499
1499
|
r,
|
|
@@ -1503,41 +1503,41 @@ function st(o, r, p, c, u, m = Yt, l = {}) {
|
|
|
1503
1503
|
l
|
|
1504
1504
|
);
|
|
1505
1505
|
}
|
|
1506
|
-
function ie(o, r, p, c, u,
|
|
1507
|
-
const l = Ai(o), a = Object.keys(r).reduce((
|
|
1506
|
+
function ie(o, r, p, c, u, f = {}) {
|
|
1507
|
+
const l = Ai(o), a = Object.keys(r).reduce((w, v) => {
|
|
1508
1508
|
const y = v;
|
|
1509
1509
|
return {
|
|
1510
|
-
...
|
|
1510
|
+
...w,
|
|
1511
1511
|
[y]: r[y].slice(0, u == null ? void 0 : u.revision[y])
|
|
1512
1512
|
};
|
|
1513
1513
|
}, {}), x = Object.keys(a).reduce(
|
|
1514
|
-
(
|
|
1514
|
+
(w, v) => {
|
|
1515
1515
|
const y = v;
|
|
1516
1516
|
return {
|
|
1517
|
-
...
|
|
1517
|
+
...w,
|
|
1518
1518
|
[y]: Si(
|
|
1519
1519
|
a[y],
|
|
1520
|
-
|
|
1520
|
+
f[y]
|
|
1521
1521
|
)
|
|
1522
1522
|
};
|
|
1523
1523
|
},
|
|
1524
1524
|
{}
|
|
1525
1525
|
), d = ki(x).reduce(
|
|
1526
|
-
(
|
|
1526
|
+
(w, { ignore: v, operation: y }) => v ? p(w, wt(y.scope), c, {
|
|
1527
1527
|
skip: y.skip,
|
|
1528
1528
|
ignoreSkipOperations: !0
|
|
1529
|
-
}) : p(
|
|
1529
|
+
}) : p(w, y, c, {
|
|
1530
1530
|
skip: y.skip,
|
|
1531
1531
|
ignoreSkipOperations: !0
|
|
1532
1532
|
}),
|
|
1533
1533
|
l
|
|
1534
|
-
),
|
|
1534
|
+
), b = Object.keys(
|
|
1535
1535
|
d.operations
|
|
1536
1536
|
).reduce(
|
|
1537
|
-
(
|
|
1537
|
+
(w, v) => {
|
|
1538
1538
|
const y = v, U = u && u.revision[y] < r[y].length ? r[y].slice(u.revision[y]) : [];
|
|
1539
1539
|
return {
|
|
1540
|
-
...
|
|
1540
|
+
...w,
|
|
1541
1541
|
[y]: [
|
|
1542
1542
|
...d.operations[y].map((j, $) => {
|
|
1543
1543
|
var R;
|
|
@@ -1552,7 +1552,7 @@ function ie(o, r, p, c, u, m = {}) {
|
|
|
1552
1552
|
},
|
|
1553
1553
|
{ global: [], local: [] }
|
|
1554
1554
|
);
|
|
1555
|
-
return { ...d, operations:
|
|
1555
|
+
return { ...d, operations: b };
|
|
1556
1556
|
}
|
|
1557
1557
|
const re = (o) => q(
|
|
1558
1558
|
"SET_NAME",
|
|
@@ -1583,7 +1583,7 @@ const re = (o) => q(
|
|
|
1583
1583
|
{ state: o, operations: r },
|
|
1584
1584
|
void 0,
|
|
1585
1585
|
ct
|
|
1586
|
-
), wt = (o = "global") => q("NOOP", {}, void 0, void 0, o),
|
|
1586
|
+
), wt = (o = "global") => q("NOOP", {}, void 0, void 0, o), qi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1587
1587
|
__proto__: null,
|
|
1588
1588
|
loadState: dt,
|
|
1589
1589
|
noop: wt,
|
|
@@ -1609,11 +1609,11 @@ class Bi {
|
|
|
1609
1609
|
define(r, p = !1) {
|
|
1610
1610
|
for (let [c, u] of Object.entries(r)) {
|
|
1611
1611
|
c = c.toLowerCase(), u = u.map((a) => a.toLowerCase()), I(this, M, "f").has(c) || I(this, M, "f").set(c, /* @__PURE__ */ new Set());
|
|
1612
|
-
const
|
|
1612
|
+
const f = I(this, M, "f").get(c);
|
|
1613
1613
|
let l = !0;
|
|
1614
1614
|
for (let a of u) {
|
|
1615
1615
|
const x = a.startsWith("*");
|
|
1616
|
-
if (a = x ? a.slice(1) : a,
|
|
1616
|
+
if (a = x ? a.slice(1) : a, f == null || f.add(a), l && I(this, W, "f").set(c, a), l = !1, x)
|
|
1617
1617
|
continue;
|
|
1618
1618
|
const d = I(this, L, "f").get(a);
|
|
1619
1619
|
if (d && d != c && !p)
|
|
@@ -1652,75 +1652,97 @@ class Bi {
|
|
|
1652
1652
|
}
|
|
1653
1653
|
}
|
|
1654
1654
|
L = /* @__PURE__ */ new WeakMap(), W = /* @__PURE__ */ new WeakMap(), M = /* @__PURE__ */ new WeakMap();
|
|
1655
|
-
const ji = new Bi(pe)._freeze()
|
|
1656
|
-
|
|
1655
|
+
const ji = new Bi(pe)._freeze();
|
|
1656
|
+
function Ii(o) {
|
|
1657
|
+
const r = [], p = Object.keys(o);
|
|
1658
|
+
for (const c of p) {
|
|
1659
|
+
const u = o[c].sort((f, l) => f.index - l.index);
|
|
1660
|
+
for (let f = 0; f < u.length; f++)
|
|
1661
|
+
u[f].index !== f && r.push({
|
|
1662
|
+
message: `Invalid operation index ${u[f].index} at position ${f}`,
|
|
1663
|
+
details: {
|
|
1664
|
+
position: f,
|
|
1665
|
+
operation: u[f],
|
|
1666
|
+
scope: u[f].scope
|
|
1667
|
+
}
|
|
1668
|
+
});
|
|
1669
|
+
}
|
|
1670
|
+
return r;
|
|
1671
|
+
}
|
|
1672
|
+
const se = async (o) => {
|
|
1673
|
+
const r = new Ut(), { name: p, revision: c, documentType: u, created: f, lastModified: l } = o, a = {
|
|
1657
1674
|
name: p,
|
|
1658
1675
|
revision: c,
|
|
1659
1676
|
documentType: u,
|
|
1660
|
-
created:
|
|
1677
|
+
created: f,
|
|
1661
1678
|
lastModified: l
|
|
1662
1679
|
};
|
|
1663
1680
|
return r.file("header.json", JSON.stringify(a, null, 2)), r.file(
|
|
1664
1681
|
"state.json",
|
|
1665
1682
|
JSON.stringify(o.initialState || {}, null, 2)
|
|
1666
1683
|
), r.file("operations.json", JSON.stringify(o.operations, null, 2)), Object.keys(o.attachments).forEach((d) => {
|
|
1667
|
-
const { data:
|
|
1668
|
-
r.file(d,
|
|
1684
|
+
const { data: b, ...w } = o.attachments[d];
|
|
1685
|
+
r.file(d, b, {
|
|
1669
1686
|
base64: !0,
|
|
1670
1687
|
createFolders: !0,
|
|
1671
|
-
comment: JSON.stringify(
|
|
1688
|
+
comment: JSON.stringify(w)
|
|
1672
1689
|
});
|
|
1673
1690
|
}), r;
|
|
1674
|
-
},
|
|
1691
|
+
}, Oi = async (o, r, p, c) => {
|
|
1675
1692
|
await (await se(o)).generateAsync({
|
|
1676
1693
|
type: "uint8array",
|
|
1677
1694
|
streamFiles: !0
|
|
1678
1695
|
});
|
|
1679
|
-
const
|
|
1696
|
+
const f = c ?? o.name, l = `.${p}.zip`;
|
|
1680
1697
|
return gi(
|
|
1681
1698
|
r,
|
|
1682
|
-
|
|
1699
|
+
f.endsWith(l) ? f : `${f}${l}`
|
|
1683
1700
|
);
|
|
1684
|
-
},
|
|
1701
|
+
}, $i = async (o, r) => {
|
|
1685
1702
|
const c = await (await se(o)).generateAsync({ type: "blob" }), u = await r.createWritable();
|
|
1686
1703
|
await u.write(c), await u.close();
|
|
1687
1704
|
}, Ot = async (o, r) => {
|
|
1688
1705
|
const p = te();
|
|
1689
|
-
return
|
|
1690
|
-
},
|
|
1706
|
+
return Ui(p, r);
|
|
1707
|
+
}, Ui = async (o, r) => {
|
|
1691
1708
|
const p = new Ut();
|
|
1692
|
-
return await p.loadAsync(o),
|
|
1709
|
+
return await p.loadAsync(o), Ti(p, r);
|
|
1693
1710
|
};
|
|
1694
|
-
async function
|
|
1711
|
+
async function Ti(o, r) {
|
|
1695
1712
|
const p = o.file("state.json");
|
|
1696
1713
|
if (!p)
|
|
1697
1714
|
throw new Error("Initial state not found");
|
|
1698
|
-
const c = await p.async("string"), u = JSON.parse(c),
|
|
1715
|
+
const c = await p.async("string"), u = JSON.parse(c), f = o.file("header.json");
|
|
1699
1716
|
let l;
|
|
1700
|
-
|
|
1717
|
+
f && (l = JSON.parse(await f.async("string")));
|
|
1701
1718
|
const a = o.file("operations.json");
|
|
1702
1719
|
if (!a)
|
|
1703
1720
|
throw new Error("Operations history not found");
|
|
1704
1721
|
const x = JSON.parse(
|
|
1705
1722
|
await a.async("string")
|
|
1706
|
-
);
|
|
1707
|
-
|
|
1723
|
+
), d = Ii(x);
|
|
1724
|
+
if (d.length) {
|
|
1725
|
+
const w = d.map((v) => v.message);
|
|
1726
|
+
throw new Error(w.join(`
|
|
1727
|
+
`));
|
|
1728
|
+
}
|
|
1729
|
+
let b = ie(
|
|
1708
1730
|
u,
|
|
1709
1731
|
x,
|
|
1710
1732
|
r,
|
|
1711
1733
|
void 0,
|
|
1712
1734
|
l
|
|
1713
1735
|
);
|
|
1714
|
-
return l && (
|
|
1715
|
-
...
|
|
1736
|
+
return l && (b = {
|
|
1737
|
+
...b,
|
|
1716
1738
|
...l
|
|
1717
|
-
}),
|
|
1739
|
+
}), b;
|
|
1718
1740
|
}
|
|
1719
1741
|
function ce(o) {
|
|
1720
1742
|
const r = o.replace(/^.*\./, "") || void 0, p = o.replace(/^.*[/\\]/, "") || void 0;
|
|
1721
1743
|
return { extension: r, fileName: p };
|
|
1722
1744
|
}
|
|
1723
|
-
async function
|
|
1745
|
+
async function Wi(o) {
|
|
1724
1746
|
const { buffer: r, mimeType: p = "application/octet-stream" } = await yi(), c = ce(o), u = r.toString("base64");
|
|
1725
1747
|
return {
|
|
1726
1748
|
data: u,
|
|
@@ -1729,11 +1751,11 @@ async function $i(o) {
|
|
|
1729
1751
|
...c
|
|
1730
1752
|
};
|
|
1731
1753
|
}
|
|
1732
|
-
async function
|
|
1754
|
+
async function Ji(o) {
|
|
1733
1755
|
const r = await vi(), p = ji.getType(o) || "application/octet-stream", c = ce(o), u = r.toString("base64");
|
|
1734
1756
|
return { data: u, hash: et(u), mimeType: p, ...c };
|
|
1735
1757
|
}
|
|
1736
|
-
class
|
|
1758
|
+
class Hi {
|
|
1737
1759
|
/**
|
|
1738
1760
|
* Constructs a BaseDocument instance with an initial state.
|
|
1739
1761
|
* @param reducer - The reducer function that updates the state.
|
|
@@ -1765,7 +1787,7 @@ class Ji {
|
|
|
1765
1787
|
* @returns The file path where the state was saved.
|
|
1766
1788
|
*/
|
|
1767
1789
|
saveToFile(r, p, c) {
|
|
1768
|
-
return
|
|
1790
|
+
return Oi(this._document, r, p, c);
|
|
1769
1791
|
}
|
|
1770
1792
|
/**
|
|
1771
1793
|
* Loads the state of the document from a file.
|
|
@@ -1885,7 +1907,7 @@ class Ji {
|
|
|
1885
1907
|
return this.dispatch(dt(r, p)), this;
|
|
1886
1908
|
}
|
|
1887
1909
|
}
|
|
1888
|
-
function
|
|
1910
|
+
function Zi(o, r) {
|
|
1889
1911
|
r.forEach((p) => {
|
|
1890
1912
|
Object.getOwnPropertyNames(p.prototype).forEach((c) => {
|
|
1891
1913
|
Object.defineProperty(
|
|
@@ -1899,32 +1921,33 @@ function Hi(o, r) {
|
|
|
1899
1921
|
});
|
|
1900
1922
|
}
|
|
1901
1923
|
export {
|
|
1902
|
-
|
|
1903
|
-
|
|
1924
|
+
Ke as A,
|
|
1925
|
+
Hi as B,
|
|
1926
|
+
Li as C,
|
|
1904
1927
|
Fi as a,
|
|
1905
1928
|
Ai as b,
|
|
1906
1929
|
_i as c,
|
|
1907
|
-
|
|
1908
|
-
|
|
1930
|
+
$i as d,
|
|
1931
|
+
Ui as e,
|
|
1909
1932
|
q as f,
|
|
1910
|
-
|
|
1911
|
-
|
|
1933
|
+
Zi as g,
|
|
1934
|
+
qi as h,
|
|
1912
1935
|
It as i,
|
|
1913
1936
|
se as j,
|
|
1914
|
-
|
|
1937
|
+
Ji as k,
|
|
1915
1938
|
Ot as l,
|
|
1916
|
-
|
|
1939
|
+
Wi as m,
|
|
1917
1940
|
ee as n,
|
|
1918
|
-
|
|
1941
|
+
zi as o,
|
|
1919
1942
|
Ei as p,
|
|
1920
1943
|
jt as q,
|
|
1921
1944
|
Si as r,
|
|
1922
|
-
|
|
1945
|
+
Oi as s,
|
|
1923
1946
|
X as t,
|
|
1924
1947
|
ie as u,
|
|
1925
1948
|
st as v,
|
|
1926
1949
|
ki as w,
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1950
|
+
Pi as x,
|
|
1951
|
+
Ii as y,
|
|
1952
|
+
Yt as z
|
|
1930
1953
|
};
|