document-model 1.0.23 → 1.0.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/dist/browser/document-model.cjs +1 -1
  2. package/dist/browser/document-model.js +3 -3
  3. package/dist/browser/document.cjs +1 -1
  4. package/dist/browser/document.js +7 -6
  5. package/dist/browser/index.cjs +1 -1
  6. package/dist/browser/index.js +4 -4
  7. package/dist/browser/internal/{index-cd28e4ab.js → index-3haD_DrE.js} +1 -1
  8. package/dist/browser/internal/index-7bSWIChK.js +38 -0
  9. package/dist/browser/internal/index-DQNkZhvL.js +1 -0
  10. package/dist/browser/internal/{index-8aac3662.js → index-TAPWNyA9.js} +2 -2
  11. package/dist/browser/internal/object-1BuggAcr.js +6 -0
  12. package/dist/browser/internal/object-jGU_rY7z.js +1895 -0
  13. package/dist/browser/src/document/actions/index.d.ts +3 -3
  14. package/dist/browser/src/document/object.d.ts +63 -0
  15. package/dist/browser/src/document/reducer.d.ts +16 -0
  16. package/dist/browser/src/document/schema/types.d.ts +1 -0
  17. package/dist/browser/src/document/types.d.ts +9 -0
  18. package/dist/browser/src/document/utils/base.d.ts +7 -4
  19. package/dist/node/document-model.cjs +1 -1
  20. package/dist/node/document-model.js +3 -3
  21. package/dist/node/document.cjs +1 -1
  22. package/dist/node/document.js +8 -7
  23. package/dist/node/index.cjs +1 -1
  24. package/dist/node/index.js +4 -4
  25. package/dist/node/internal/index-FmPDtpIY.js +38 -0
  26. package/dist/node/internal/{index-e9f12d45.js → index-GpOpKG2W.js} +2 -2
  27. package/dist/node/internal/index-lh4jt_0f.js +1 -0
  28. package/dist/node/internal/{index-f04f94a6.js → index-pZl431ni.js} +1 -1
  29. package/dist/node/internal/{object-cb276649.js → object-evJm9vYN.js} +475 -411
  30. package/dist/node/internal/object-pZF_UDWv.js +1 -0
  31. package/dist/node/src/document/actions/index.d.ts +3 -3
  32. package/dist/node/src/document/object.d.ts +63 -0
  33. package/dist/node/src/document/reducer.d.ts +16 -0
  34. package/dist/node/src/document/schema/types.d.ts +1 -0
  35. package/dist/node/src/document/types.d.ts +9 -0
  36. package/dist/node/src/document/utils/base.d.ts +7 -4
  37. package/package.json +1 -1
  38. package/dist/browser/internal/index-8fceb2dc.js +0 -1
  39. package/dist/browser/internal/index-e127ba7e.js +0 -36
  40. package/dist/browser/internal/object-67d1240b.js +0 -1831
  41. package/dist/browser/internal/object-ba4e810d.js +0 -6
  42. package/dist/node/internal/index-ac24dd92.js +0 -36
  43. package/dist/node/internal/index-c75a9c7a.js +0 -1
  44. package/dist/node/internal/object-10b89c54.js +0 -1
  45. package/dist/node/test/document/redo.test.d.ts +0 -1
  46. package/dist/node/test/document/undo.test.d.ts +0 -1
  47. /package/dist/browser/test/document/{redo.test.d.ts → undo-redo.test.d.ts} +0 -0
  48. /package/dist/{browser/test/document/undo.test.d.ts → node/test/document/undo-redo.test.d.ts} +0 -0
@@ -0,0 +1,1895 @@
1
+ var Ae = Object.defineProperty;
2
+ var Se = (i, o, p) => o in i ? Ae(i, o, { enumerable: !0, configurable: !0, writable: !0, value: p }) : i[o] = p;
3
+ var H = (i, o, p) => (Se(i, typeof o != "symbol" ? o + "" : o, p), p);
4
+ import { produce as Y, castDraft as rt, castImmutable as Be, freeze as ke } from "immer";
5
+ import je from "json-stringify-deterministic";
6
+ import { z as g } from "zod";
7
+ import jt from "jszip";
8
+ const It = (i) => i != null, Ie = g.any().refine((i) => It(i)), Ut = g.enum(["LOAD_STATE"]), Ot = g.enum(["PRUNE"]), Tt = g.enum(["REDO"]), Dt = g.enum(["SET_NAME"]), Nt = g.enum(["UNDO"]);
9
+ function Ue() {
10
+ return g.object({
11
+ __typename: g.literal("Action").optional(),
12
+ type: g.string()
13
+ });
14
+ }
15
+ function q() {
16
+ return g.literal("global").or(g.literal("local"));
17
+ }
18
+ function Rt() {
19
+ return g.union([
20
+ Mt(),
21
+ Lt(),
22
+ zt(),
23
+ qt(),
24
+ $t()
25
+ ]);
26
+ }
27
+ function Oe() {
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
+ });
35
+ }
36
+ function Mt() {
37
+ return g.object({
38
+ input: g.lazy(() => at()),
39
+ type: Ut,
40
+ scope: q()
41
+ });
42
+ }
43
+ function at() {
44
+ return g.object({
45
+ operations: g.number(),
46
+ state: g.lazy(() => Ct())
47
+ });
48
+ }
49
+ function Ct() {
50
+ return g.object({
51
+ data: g.unknown().nullish(),
52
+ name: g.string()
53
+ });
54
+ }
55
+ function Te() {
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
+ });
63
+ }
64
+ function Lt() {
65
+ return g.object({
66
+ input: g.lazy(() => pt()),
67
+ type: Ot,
68
+ scope: q()
69
+ });
70
+ }
71
+ function pt() {
72
+ return g.object({
73
+ end: g.number().nullish(),
74
+ start: g.number().nullish()
75
+ });
76
+ }
77
+ const st = g.number;
78
+ function zt() {
79
+ return g.object({
80
+ input: st(),
81
+ type: Tt,
82
+ scope: q()
83
+ });
84
+ }
85
+ const ct = g.string;
86
+ function qt() {
87
+ return g.object({
88
+ input: ct(),
89
+ type: Dt,
90
+ scope: g.literal("global")
91
+ });
92
+ }
93
+ function De() {
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
+ });
102
+ }
103
+ const lt = g.number;
104
+ function $t() {
105
+ return g.object({
106
+ input: lt(),
107
+ type: Nt,
108
+ scope: q()
109
+ });
110
+ }
111
+ const Dr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
112
+ __proto__: null,
113
+ ActionSchema: Ue,
114
+ BaseActionSchema: Rt,
115
+ DocumentFileSchema: Oe,
116
+ LoadStateActionInputSchema: at,
117
+ LoadStateActionSchema: Mt,
118
+ LoadStateActionStateInputSchema: Ct,
119
+ Load_StateSchema: Ut,
120
+ OperationSchema: Te,
121
+ OperationScopeSchema: q,
122
+ PruneActionInputSchema: pt,
123
+ PruneActionSchema: Lt,
124
+ PruneSchema: Ot,
125
+ RedoActionInputSchema: st,
126
+ RedoActionSchema: zt,
127
+ RedoSchema: Tt,
128
+ SetNameActionInputSchema: ct,
129
+ SetNameActionSchema: qt,
130
+ SetNameOperationSchema: De,
131
+ Set_NameSchema: Dt,
132
+ UndoActionInputSchema: lt,
133
+ UndoActionSchema: $t,
134
+ UndoSchema: Nt,
135
+ definedNonNullAnySchema: Ie,
136
+ isDefinedNonNullAny: It
137
+ }, Symbol.toStringTag, { value: "Module" }));
138
+ function Ne(i, o) {
139
+ return { ...i, name: o };
140
+ }
141
+ function Re(i, o, p) {
142
+ const { scope: c, input: u } = o;
143
+ return Y({
144
+ document: i,
145
+ action: o,
146
+ skip: p
147
+ }, (l) => {
148
+ if (l.document.operations[c].length < 1)
149
+ throw new Error(
150
+ `Cannot undo: no operations in history for scope "${c}"`
151
+ );
152
+ if (u < 1)
153
+ throw new Error(
154
+ "Invalid UNDO action: input value must be greater than 0"
155
+ );
156
+ if (l.skip > 0)
157
+ throw new Error(
158
+ "Cannot undo: skip value from reducer cannot be used with UNDO action"
159
+ );
160
+ const [a] = l.document.operations[c].slice(-1), x = a.type === "NOOP" && a.skip > 0;
161
+ if (l.skip += u, x && (l.skip += a.skip, l.document.operations[c].pop()), l.document.operations[c].length < l.skip)
162
+ throw new Error(
163
+ "Cannot undo: you can't undo more operations than the ones in the scope history"
164
+ );
165
+ const d = l.document.operations[c].length - 1;
166
+ let E = u, w = x ? d - a.skip : d;
167
+ for (; E > 0 && w >= 0; ) {
168
+ const v = l.document.operations[c][w];
169
+ v.type === "NOOP" && v.skip > 0 ? (w = w - (v.skip + 1), l.skip += v.skip + 1) : (l.document.clipboard.push({ ...v }), E--, w--);
170
+ }
171
+ l.action = mt(c);
172
+ });
173
+ }
174
+ function Me(i, o, p) {
175
+ const { scope: c, input: u } = o;
176
+ return Y({
177
+ document: i,
178
+ action: o,
179
+ skip: p
180
+ }, (l) => {
181
+ if (l.skip > 0)
182
+ throw new Error(
183
+ "Cannot redo: skip value from reducer cannot be used with REDO action"
184
+ );
185
+ if (u > 1)
186
+ throw new Error(
187
+ "Cannot redo: you can only redo one operation at a time"
188
+ );
189
+ if (u < 1)
190
+ throw new Error("Invalid REDO action: invalid redo input value");
191
+ if (l.document.clipboard.length < 1)
192
+ throw new Error("Cannot redo: no operations in the clipboard");
193
+ const a = l.document.clipboard.findLastIndex(
194
+ (d) => d.scope === c
195
+ );
196
+ if (a < 0)
197
+ throw new Error(
198
+ `Cannot redo: no operations in clipboard for scope "${c}"`
199
+ );
200
+ const x = l.document.clipboard.splice(a, 1)[0];
201
+ l.action = rt({
202
+ type: x.type,
203
+ scope: x.scope,
204
+ input: x.input
205
+ });
206
+ });
207
+ }
208
+ function Ce(i, o, p) {
209
+ const { scope: c } = o, u = i.operations[c];
210
+ let {
211
+ input: { start: h, end: l }
212
+ } = o;
213
+ h = h || 0, l = l || u.length;
214
+ const a = u.slice(h, l), x = u.slice(0, h), d = u.slice(l), E = ot(
215
+ i.initialState,
216
+ {
217
+ ...i.operations,
218
+ [c]: x.concat(a)
219
+ },
220
+ p
221
+ ), { name: w, state: v } = E, y = x.length, U = x.length ? x[x.length - 1].timestamp : d.length ? d[0].timestamp : (/* @__PURE__ */ new Date()).toISOString();
222
+ return ot(
223
+ i.initialState,
224
+ {
225
+ ...i.operations,
226
+ [c]: [
227
+ ...x,
228
+ {
229
+ ...ht(
230
+ { name: w, state: v },
231
+ a.length
232
+ ),
233
+ timestamp: U,
234
+ index: y,
235
+ hash: ee({ state: v }, "global")
236
+ },
237
+ ...d.map((j, z) => ({
238
+ ...j,
239
+ index: y + z + 1
240
+ }))
241
+ ]
242
+ },
243
+ p
244
+ );
245
+ }
246
+ function Le(i, o) {
247
+ return {
248
+ ...i,
249
+ name: o.name,
250
+ state: o.state ?? { global: {}, local: {} }
251
+ };
252
+ }
253
+ const Pt = "SET_NAME", M = "UNDO", C = "REDO", $ = "PRUNE", Jt = "LOAD_STATE";
254
+ function Wt(i) {
255
+ return i && i.__esModule && Object.prototype.hasOwnProperty.call(i, "default") ? i.default : i;
256
+ }
257
+ function K() {
258
+ this._types = /* @__PURE__ */ Object.create(null), this._extensions = /* @__PURE__ */ Object.create(null);
259
+ for (let i = 0; i < arguments.length; i++)
260
+ this.define(arguments[i]);
261
+ this.define = this.define.bind(this), this.getType = this.getType.bind(this), this.getExtension = this.getExtension.bind(this);
262
+ }
263
+ K.prototype.define = function(i, o) {
264
+ for (let p in i) {
265
+ let c = i[p].map(function(u) {
266
+ return u.toLowerCase();
267
+ });
268
+ p = p.toLowerCase();
269
+ for (let u = 0; u < c.length; u++) {
270
+ const h = c[u];
271
+ if (h[0] !== "*") {
272
+ if (!o && h in this._types)
273
+ throw new Error(
274
+ 'Attempt to change mapping for "' + h + '" extension from "' + this._types[h] + '" to "' + p + '". Pass `force=true` to allow this, otherwise remove "' + h + '" from the list of extensions for "' + p + '".'
275
+ );
276
+ this._types[h] = p;
277
+ }
278
+ }
279
+ if (o || !this._extensions[p]) {
280
+ const u = c[0];
281
+ this._extensions[p] = u[0] !== "*" ? u : u.substr(1);
282
+ }
283
+ }
284
+ };
285
+ K.prototype.getType = function(i) {
286
+ i = String(i);
287
+ let o = i.replace(/^.*[/\\]/, "").toLowerCase(), p = o.replace(/^.*\./, "").toLowerCase(), c = o.length < i.length;
288
+ return (p.length < o.length - 1 || !c) && this._types[p] || null;
289
+ };
290
+ K.prototype.getExtension = function(i) {
291
+ return i = /^\s*([^;\s]*)/.test(i) && RegExp.$1, i && this._extensions[i.toLowerCase()] || null;
292
+ };
293
+ var ze = K, qe = { "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"] };
294
+ let $e = ze;
295
+ var Pe = new $e(qe);
296
+ const Je = /* @__PURE__ */ Wt(Pe);
297
+ var it = { exports: {} };
298
+ typeof Object.create == "function" ? it.exports = function(o, p) {
299
+ p && (o.super_ = p, o.prototype = Object.create(p.prototype, {
300
+ constructor: {
301
+ value: o,
302
+ enumerable: !1,
303
+ writable: !0,
304
+ configurable: !0
305
+ }
306
+ }));
307
+ } : it.exports = function(o, p) {
308
+ if (p) {
309
+ o.super_ = p;
310
+ var c = function() {
311
+ };
312
+ c.prototype = p.prototype, o.prototype = new c(), o.prototype.constructor = o;
313
+ }
314
+ };
315
+ var We = it.exports, nt = { exports: {} }, Ht = {}, V = {};
316
+ V.byteLength = Ye;
317
+ V.toByteArray = Ve;
318
+ V.fromByteArray = Qe;
319
+ var T = [], I = [], He = typeof Uint8Array < "u" ? Uint8Array : Array, et = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
320
+ for (var R = 0, Ze = et.length; R < Ze; ++R)
321
+ T[R] = et[R], I[et.charCodeAt(R)] = R;
322
+ I[45] = 62;
323
+ I[95] = 63;
324
+ function Zt(i) {
325
+ var o = i.length;
326
+ if (o % 4 > 0)
327
+ throw new Error("Invalid string. Length must be a multiple of 4");
328
+ var p = i.indexOf("=");
329
+ p === -1 && (p = o);
330
+ var c = p === o ? 0 : 4 - p % 4;
331
+ return [p, c];
332
+ }
333
+ function Ye(i) {
334
+ var o = Zt(i), p = o[0], c = o[1];
335
+ return (p + c) * 3 / 4 - c;
336
+ }
337
+ function Ke(i, o, p) {
338
+ return (o + p) * 3 / 4 - p;
339
+ }
340
+ function Ve(i) {
341
+ var o, p = Zt(i), c = p[0], u = p[1], h = new He(Ke(i, c, u)), l = 0, a = u > 0 ? c - 4 : c, x;
342
+ for (x = 0; x < a; x += 4)
343
+ o = I[i.charCodeAt(x)] << 18 | I[i.charCodeAt(x + 1)] << 12 | I[i.charCodeAt(x + 2)] << 6 | I[i.charCodeAt(x + 3)], h[l++] = o >> 16 & 255, h[l++] = o >> 8 & 255, h[l++] = o & 255;
344
+ return u === 2 && (o = I[i.charCodeAt(x)] << 2 | I[i.charCodeAt(x + 1)] >> 4, h[l++] = o & 255), u === 1 && (o = I[i.charCodeAt(x)] << 10 | I[i.charCodeAt(x + 1)] << 4 | I[i.charCodeAt(x + 2)] >> 2, h[l++] = o >> 8 & 255, h[l++] = o & 255), h;
345
+ }
346
+ function Xe(i) {
347
+ return T[i >> 18 & 63] + T[i >> 12 & 63] + T[i >> 6 & 63] + T[i & 63];
348
+ }
349
+ function Ge(i, o, p) {
350
+ for (var c, u = [], h = o; h < p; h += 3)
351
+ c = (i[h] << 16 & 16711680) + (i[h + 1] << 8 & 65280) + (i[h + 2] & 255), u.push(Xe(c));
352
+ return u.join("");
353
+ }
354
+ function Qe(i) {
355
+ for (var o, p = i.length, c = p % 3, u = [], h = 16383, l = 0, a = p - c; l < a; l += h)
356
+ u.push(Ge(i, l, l + h > a ? a : l + h));
357
+ return c === 1 ? (o = i[p - 1], u.push(
358
+ T[o >> 2] + T[o << 4 & 63] + "=="
359
+ )) : c === 2 && (o = (i[p - 2] << 8) + i[p - 1], u.push(
360
+ T[o >> 10] + T[o >> 4 & 63] + T[o << 2 & 63] + "="
361
+ )), u.join("");
362
+ }
363
+ var ut = {};
364
+ /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
365
+ ut.read = function(i, o, p, c, u) {
366
+ var h, l, a = u * 8 - c - 1, x = (1 << a) - 1, d = x >> 1, E = -7, w = p ? u - 1 : 0, v = p ? -1 : 1, y = i[o + w];
367
+ for (w += v, h = y & (1 << -E) - 1, y >>= -E, E += a; E > 0; h = h * 256 + i[o + w], w += v, E -= 8)
368
+ ;
369
+ for (l = h & (1 << -E) - 1, h >>= -E, E += c; E > 0; l = l * 256 + i[o + w], w += v, E -= 8)
370
+ ;
371
+ if (h === 0)
372
+ h = 1 - d;
373
+ else {
374
+ if (h === x)
375
+ return l ? NaN : (y ? -1 : 1) * (1 / 0);
376
+ l = l + Math.pow(2, c), h = h - d;
377
+ }
378
+ return (y ? -1 : 1) * l * Math.pow(2, h - c);
379
+ };
380
+ ut.write = function(i, o, p, c, u, h) {
381
+ var l, a, x, d = h * 8 - u - 1, E = (1 << d) - 1, w = E >> 1, v = u === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0, y = c ? 0 : h - 1, U = c ? 1 : -1, j = o < 0 || o === 0 && 1 / o < 0 ? 1 : 0;
382
+ for (o = Math.abs(o), isNaN(o) || o === 1 / 0 ? (a = isNaN(o) ? 1 : 0, l = E) : (l = Math.floor(Math.log(o) / Math.LN2), o * (x = Math.pow(2, -l)) < 1 && (l--, x *= 2), l + w >= 1 ? o += v / x : o += v * Math.pow(2, 1 - w), o * x >= 2 && (l++, x /= 2), l + w >= E ? (a = 0, l = E) : l + w >= 1 ? (a = (o * x - 1) * Math.pow(2, u), l = l + w) : (a = o * Math.pow(2, w - 1) * Math.pow(2, u), l = 0)); u >= 8; i[p + y] = a & 255, y += U, a /= 256, u -= 8)
383
+ ;
384
+ for (l = l << u | a, d += u; d > 0; i[p + y] = l & 255, y += U, l /= 256, d -= 8)
385
+ ;
386
+ i[p + y - U] |= j * 128;
387
+ };
388
+ /*!
389
+ * The buffer module from node.js, for the browser.
390
+ *
391
+ * @author Feross Aboukhadijeh <https://feross.org>
392
+ * @license MIT
393
+ */
394
+ (function(i) {
395
+ var o = V, p = ut, c = typeof Symbol == "function" && typeof Symbol.for == "function" ? Symbol.for("nodejs.util.inspect.custom") : null;
396
+ i.Buffer = a, i.SlowBuffer = pe, i.INSPECT_MAX_BYTES = 50;
397
+ var u = 2147483647;
398
+ i.kMaxLength = u, a.TYPED_ARRAY_SUPPORT = h(), !a.TYPED_ARRAY_SUPPORT && typeof console < "u" && typeof console.error == "function" && console.error(
399
+ "This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."
400
+ );
401
+ function h() {
402
+ try {
403
+ var r = new Uint8Array(1), t = { foo: function() {
404
+ return 42;
405
+ } };
406
+ return Object.setPrototypeOf(t, Uint8Array.prototype), Object.setPrototypeOf(r, t), r.foo() === 42;
407
+ } catch {
408
+ return !1;
409
+ }
410
+ }
411
+ Object.defineProperty(a.prototype, "parent", {
412
+ enumerable: !0,
413
+ get: function() {
414
+ if (a.isBuffer(this))
415
+ return this.buffer;
416
+ }
417
+ }), Object.defineProperty(a.prototype, "offset", {
418
+ enumerable: !0,
419
+ get: function() {
420
+ if (a.isBuffer(this))
421
+ return this.byteOffset;
422
+ }
423
+ });
424
+ function l(r) {
425
+ if (r > u)
426
+ throw new RangeError('The value "' + r + '" is invalid for option "size"');
427
+ var t = new Uint8Array(r);
428
+ return Object.setPrototypeOf(t, a.prototype), t;
429
+ }
430
+ function a(r, t, e) {
431
+ if (typeof r == "number") {
432
+ if (typeof t == "string")
433
+ throw new TypeError(
434
+ 'The "string" argument must be of type string. Received type number'
435
+ );
436
+ return w(r);
437
+ }
438
+ return x(r, t, e);
439
+ }
440
+ a.poolSize = 8192;
441
+ function x(r, t, e) {
442
+ if (typeof r == "string")
443
+ return v(r, t);
444
+ if (ArrayBuffer.isView(r))
445
+ return U(r);
446
+ if (r == null)
447
+ throw new TypeError(
448
+ "The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof r
449
+ );
450
+ if (O(r, ArrayBuffer) || r && O(r.buffer, ArrayBuffer) || typeof SharedArrayBuffer < "u" && (O(r, SharedArrayBuffer) || r && O(r.buffer, SharedArrayBuffer)))
451
+ return j(r, t, e);
452
+ if (typeof r == "number")
453
+ throw new TypeError(
454
+ 'The "value" argument must not be of type number. Received type number'
455
+ );
456
+ var n = r.valueOf && r.valueOf();
457
+ if (n != null && n !== r)
458
+ return a.from(n, t, e);
459
+ var s = z(r);
460
+ if (s)
461
+ return s;
462
+ if (typeof Symbol < "u" && Symbol.toPrimitive != null && typeof r[Symbol.toPrimitive] == "function")
463
+ return a.from(
464
+ r[Symbol.toPrimitive]("string"),
465
+ t,
466
+ e
467
+ );
468
+ throw new TypeError(
469
+ "The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof r
470
+ );
471
+ }
472
+ a.from = function(r, t, e) {
473
+ return x(r, t, e);
474
+ }, Object.setPrototypeOf(a.prototype, Uint8Array.prototype), Object.setPrototypeOf(a, Uint8Array);
475
+ function d(r) {
476
+ if (typeof r != "number")
477
+ throw new TypeError('"size" argument must be of type number');
478
+ if (r < 0)
479
+ throw new RangeError('The value "' + r + '" is invalid for option "size"');
480
+ }
481
+ function E(r, t, e) {
482
+ return d(r), r <= 0 ? l(r) : t !== void 0 ? typeof e == "string" ? l(r).fill(t, e) : l(r).fill(t) : l(r);
483
+ }
484
+ a.alloc = function(r, t, e) {
485
+ return E(r, t, e);
486
+ };
487
+ function w(r) {
488
+ return d(r), l(r < 0 ? 0 : N(r) | 0);
489
+ }
490
+ a.allocUnsafe = function(r) {
491
+ return w(r);
492
+ }, a.allocUnsafeSlow = function(r) {
493
+ return w(r);
494
+ };
495
+ function v(r, t) {
496
+ if ((typeof t != "string" || t === "") && (t = "utf8"), !a.isEncoding(t))
497
+ throw new TypeError("Unknown encoding: " + t);
498
+ var e = xt(r, t) | 0, n = l(e), s = n.write(r, t);
499
+ return s !== e && (n = n.slice(0, s)), n;
500
+ }
501
+ function y(r) {
502
+ for (var t = r.length < 0 ? 0 : N(r.length) | 0, e = l(t), n = 0; n < t; n += 1)
503
+ e[n] = r[n] & 255;
504
+ return e;
505
+ }
506
+ function U(r) {
507
+ if (O(r, Uint8Array)) {
508
+ var t = new Uint8Array(r);
509
+ return j(t.buffer, t.byteOffset, t.byteLength);
510
+ }
511
+ return y(r);
512
+ }
513
+ function j(r, t, e) {
514
+ if (t < 0 || r.byteLength < t)
515
+ throw new RangeError('"offset" is outside of buffer bounds');
516
+ if (r.byteLength < t + (e || 0))
517
+ throw new RangeError('"length" is outside of buffer bounds');
518
+ var n;
519
+ return t === void 0 && e === void 0 ? n = new Uint8Array(r) : e === void 0 ? n = new Uint8Array(r, t) : n = new Uint8Array(r, t, e), Object.setPrototypeOf(n, a.prototype), n;
520
+ }
521
+ function z(r) {
522
+ if (a.isBuffer(r)) {
523
+ var t = N(r.length) | 0, e = l(t);
524
+ return e.length === 0 || r.copy(e, 0, 0, t), e;
525
+ }
526
+ if (r.length !== void 0)
527
+ return typeof r.length != "number" || tt(r.length) ? l(0) : y(r);
528
+ if (r.type === "Buffer" && Array.isArray(r.data))
529
+ return y(r.data);
530
+ }
531
+ function N(r) {
532
+ if (r >= u)
533
+ throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x" + u.toString(16) + " bytes");
534
+ return r | 0;
535
+ }
536
+ function pe(r) {
537
+ return +r != r && (r = 0), a.alloc(+r);
538
+ }
539
+ a.isBuffer = function(t) {
540
+ return t != null && t._isBuffer === !0 && t !== a.prototype;
541
+ }, a.compare = function(t, e) {
542
+ if (O(t, Uint8Array) && (t = a.from(t, t.offset, t.byteLength)), O(e, Uint8Array) && (e = a.from(e, e.offset, e.byteLength)), !a.isBuffer(t) || !a.isBuffer(e))
543
+ throw new TypeError(
544
+ 'The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array'
545
+ );
546
+ if (t === e)
547
+ return 0;
548
+ for (var n = t.length, s = e.length, f = 0, m = Math.min(n, s); f < m; ++f)
549
+ if (t[f] !== e[f]) {
550
+ n = t[f], s = e[f];
551
+ break;
552
+ }
553
+ return n < s ? -1 : s < n ? 1 : 0;
554
+ }, a.isEncoding = function(t) {
555
+ switch (String(t).toLowerCase()) {
556
+ case "hex":
557
+ case "utf8":
558
+ case "utf-8":
559
+ case "ascii":
560
+ case "latin1":
561
+ case "binary":
562
+ case "base64":
563
+ case "ucs2":
564
+ case "ucs-2":
565
+ case "utf16le":
566
+ case "utf-16le":
567
+ return !0;
568
+ default:
569
+ return !1;
570
+ }
571
+ }, a.concat = function(t, e) {
572
+ if (!Array.isArray(t))
573
+ throw new TypeError('"list" argument must be an Array of Buffers');
574
+ if (t.length === 0)
575
+ return a.alloc(0);
576
+ var n;
577
+ if (e === void 0)
578
+ for (e = 0, n = 0; n < t.length; ++n)
579
+ e += t[n].length;
580
+ var s = a.allocUnsafe(e), f = 0;
581
+ for (n = 0; n < t.length; ++n) {
582
+ var m = t[n];
583
+ if (O(m, Uint8Array))
584
+ f + m.length > s.length ? a.from(m).copy(s, f) : Uint8Array.prototype.set.call(
585
+ s,
586
+ m,
587
+ f
588
+ );
589
+ else if (a.isBuffer(m))
590
+ m.copy(s, f);
591
+ else
592
+ throw new TypeError('"list" argument must be an Array of Buffers');
593
+ f += m.length;
594
+ }
595
+ return s;
596
+ };
597
+ function xt(r, t) {
598
+ if (a.isBuffer(r))
599
+ return r.length;
600
+ if (ArrayBuffer.isView(r) || O(r, ArrayBuffer))
601
+ return r.byteLength;
602
+ if (typeof r != "string")
603
+ throw new TypeError(
604
+ 'The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type ' + typeof r
605
+ );
606
+ var e = r.length, n = arguments.length > 2 && arguments[2] === !0;
607
+ if (!n && e === 0)
608
+ return 0;
609
+ for (var s = !1; ; )
610
+ switch (t) {
611
+ case "ascii":
612
+ case "latin1":
613
+ case "binary":
614
+ return e;
615
+ case "utf8":
616
+ case "utf-8":
617
+ return Q(r).length;
618
+ case "ucs2":
619
+ case "ucs-2":
620
+ case "utf16le":
621
+ case "utf-16le":
622
+ return e * 2;
623
+ case "hex":
624
+ return e >>> 1;
625
+ case "base64":
626
+ return _t(r).length;
627
+ default:
628
+ if (s)
629
+ return n ? -1 : Q(r).length;
630
+ t = ("" + t).toLowerCase(), s = !0;
631
+ }
632
+ }
633
+ a.byteLength = xt;
634
+ function se(r, t, e) {
635
+ var n = !1;
636
+ if ((t === void 0 || t < 0) && (t = 0), t > this.length || ((e === void 0 || e > this.length) && (e = this.length), e <= 0) || (e >>>= 0, t >>>= 0, e <= t))
637
+ return "";
638
+ for (r || (r = "utf8"); ; )
639
+ switch (r) {
640
+ case "hex":
641
+ return we(this, t, e);
642
+ case "utf8":
643
+ case "utf-8":
644
+ return wt(this, t, e);
645
+ case "ascii":
646
+ return de(this, t, e);
647
+ case "latin1":
648
+ case "binary":
649
+ return ge(this, t, e);
650
+ case "base64":
651
+ return me(this, t, e);
652
+ case "ucs2":
653
+ case "ucs-2":
654
+ case "utf16le":
655
+ case "utf-16le":
656
+ return ye(this, t, e);
657
+ default:
658
+ if (n)
659
+ throw new TypeError("Unknown encoding: " + r);
660
+ r = (r + "").toLowerCase(), n = !0;
661
+ }
662
+ }
663
+ a.prototype._isBuffer = !0;
664
+ function D(r, t, e) {
665
+ var n = r[t];
666
+ r[t] = r[e], r[e] = n;
667
+ }
668
+ a.prototype.swap16 = function() {
669
+ var t = this.length;
670
+ if (t % 2 !== 0)
671
+ throw new RangeError("Buffer size must be a multiple of 16-bits");
672
+ for (var e = 0; e < t; e += 2)
673
+ D(this, e, e + 1);
674
+ return this;
675
+ }, a.prototype.swap32 = function() {
676
+ var t = this.length;
677
+ if (t % 4 !== 0)
678
+ throw new RangeError("Buffer size must be a multiple of 32-bits");
679
+ for (var e = 0; e < t; e += 4)
680
+ D(this, e, e + 3), D(this, e + 1, e + 2);
681
+ return this;
682
+ }, a.prototype.swap64 = function() {
683
+ var t = this.length;
684
+ if (t % 8 !== 0)
685
+ throw new RangeError("Buffer size must be a multiple of 64-bits");
686
+ for (var e = 0; e < t; e += 8)
687
+ D(this, e, e + 7), D(this, e + 1, e + 6), D(this, e + 2, e + 5), D(this, e + 3, e + 4);
688
+ return this;
689
+ }, a.prototype.toString = function() {
690
+ var t = this.length;
691
+ return t === 0 ? "" : arguments.length === 0 ? wt(this, 0, t) : se.apply(this, arguments);
692
+ }, a.prototype.toLocaleString = a.prototype.toString, a.prototype.equals = function(t) {
693
+ if (!a.isBuffer(t))
694
+ throw new TypeError("Argument must be a Buffer");
695
+ return this === t ? !0 : a.compare(this, t) === 0;
696
+ }, a.prototype.inspect = function() {
697
+ var t = "", e = i.INSPECT_MAX_BYTES;
698
+ return t = this.toString("hex", 0, e).replace(/(.{2})/g, "$1 ").trim(), this.length > e && (t += " ... "), "<Buffer " + t + ">";
699
+ }, c && (a.prototype[c] = a.prototype.inspect), a.prototype.compare = function(t, e, n, s, f) {
700
+ if (O(t, Uint8Array) && (t = a.from(t, t.offset, t.byteLength)), !a.isBuffer(t))
701
+ throw new TypeError(
702
+ 'The "target" argument must be one of type Buffer or Uint8Array. Received type ' + typeof t
703
+ );
704
+ if (e === void 0 && (e = 0), n === void 0 && (n = t ? t.length : 0), s === void 0 && (s = 0), f === void 0 && (f = this.length), e < 0 || n > t.length || s < 0 || f > this.length)
705
+ throw new RangeError("out of range index");
706
+ if (s >= f && e >= n)
707
+ return 0;
708
+ if (s >= f)
709
+ return -1;
710
+ if (e >= n)
711
+ return 1;
712
+ if (e >>>= 0, n >>>= 0, s >>>= 0, f >>>= 0, this === t)
713
+ return 0;
714
+ for (var m = f - s, b = n - e, _ = Math.min(m, b), F = this.slice(s, f), B = t.slice(e, n), A = 0; A < _; ++A)
715
+ if (F[A] !== B[A]) {
716
+ m = F[A], b = B[A];
717
+ break;
718
+ }
719
+ return m < b ? -1 : b < m ? 1 : 0;
720
+ };
721
+ function dt(r, t, e, n, s) {
722
+ if (r.length === 0)
723
+ return -1;
724
+ if (typeof e == "string" ? (n = e, e = 0) : e > 2147483647 ? e = 2147483647 : e < -2147483648 && (e = -2147483648), e = +e, tt(e) && (e = s ? 0 : r.length - 1), e < 0 && (e = r.length + e), e >= r.length) {
725
+ if (s)
726
+ return -1;
727
+ e = r.length - 1;
728
+ } else if (e < 0)
729
+ if (s)
730
+ e = 0;
731
+ else
732
+ return -1;
733
+ if (typeof t == "string" && (t = a.from(t, n)), a.isBuffer(t))
734
+ return t.length === 0 ? -1 : gt(r, t, e, n, s);
735
+ if (typeof t == "number")
736
+ return t = t & 255, typeof Uint8Array.prototype.indexOf == "function" ? s ? Uint8Array.prototype.indexOf.call(r, t, e) : Uint8Array.prototype.lastIndexOf.call(r, t, e) : gt(r, [t], e, n, s);
737
+ throw new TypeError("val must be string, number or Buffer");
738
+ }
739
+ function gt(r, t, e, n, s) {
740
+ var f = 1, m = r.length, b = t.length;
741
+ if (n !== void 0 && (n = String(n).toLowerCase(), n === "ucs2" || n === "ucs-2" || n === "utf16le" || n === "utf-16le")) {
742
+ if (r.length < 2 || t.length < 2)
743
+ return -1;
744
+ f = 2, m /= 2, b /= 2, e /= 2;
745
+ }
746
+ function _(Ft, At) {
747
+ return f === 1 ? Ft[At] : Ft.readUInt16BE(At * f);
748
+ }
749
+ var F;
750
+ if (s) {
751
+ var B = -1;
752
+ for (F = e; F < m; F++)
753
+ if (_(r, F) === _(t, B === -1 ? 0 : F - B)) {
754
+ if (B === -1 && (B = F), F - B + 1 === b)
755
+ return B * f;
756
+ } else
757
+ B !== -1 && (F -= F - B), B = -1;
758
+ } else
759
+ for (e + b > m && (e = m - b), F = e; F >= 0; F--) {
760
+ for (var A = !0, W = 0; W < b; W++)
761
+ if (_(r, F + W) !== _(t, W)) {
762
+ A = !1;
763
+ break;
764
+ }
765
+ if (A)
766
+ return F;
767
+ }
768
+ return -1;
769
+ }
770
+ a.prototype.includes = function(t, e, n) {
771
+ return this.indexOf(t, e, n) !== -1;
772
+ }, a.prototype.indexOf = function(t, e, n) {
773
+ return dt(this, t, e, n, !0);
774
+ }, a.prototype.lastIndexOf = function(t, e, n) {
775
+ return dt(this, t, e, n, !1);
776
+ };
777
+ function ce(r, t, e, n) {
778
+ e = Number(e) || 0;
779
+ var s = r.length - e;
780
+ n ? (n = Number(n), n > s && (n = s)) : n = s;
781
+ var f = t.length;
782
+ n > f / 2 && (n = f / 2);
783
+ for (var m = 0; m < n; ++m) {
784
+ var b = parseInt(t.substr(m * 2, 2), 16);
785
+ if (tt(b))
786
+ return m;
787
+ r[e + m] = b;
788
+ }
789
+ return m;
790
+ }
791
+ function le(r, t, e, n) {
792
+ return J(Q(t, r.length - e), r, e, n);
793
+ }
794
+ function ue(r, t, e, n) {
795
+ return J(Ee(t), r, e, n);
796
+ }
797
+ function fe(r, t, e, n) {
798
+ return J(_t(t), r, e, n);
799
+ }
800
+ function he(r, t, e, n) {
801
+ return J(_e(t, r.length - e), r, e, n);
802
+ }
803
+ a.prototype.write = function(t, e, n, s) {
804
+ if (e === void 0)
805
+ s = "utf8", n = this.length, e = 0;
806
+ else if (n === void 0 && typeof e == "string")
807
+ s = e, n = this.length, e = 0;
808
+ else if (isFinite(e))
809
+ e = e >>> 0, isFinite(n) ? (n = n >>> 0, s === void 0 && (s = "utf8")) : (s = n, n = void 0);
810
+ else
811
+ throw new Error(
812
+ "Buffer.write(string, encoding, offset[, length]) is no longer supported"
813
+ );
814
+ var f = this.length - e;
815
+ if ((n === void 0 || n > f) && (n = f), t.length > 0 && (n < 0 || e < 0) || e > this.length)
816
+ throw new RangeError("Attempt to write outside buffer bounds");
817
+ s || (s = "utf8");
818
+ for (var m = !1; ; )
819
+ switch (s) {
820
+ case "hex":
821
+ return ce(this, t, e, n);
822
+ case "utf8":
823
+ case "utf-8":
824
+ return le(this, t, e, n);
825
+ case "ascii":
826
+ case "latin1":
827
+ case "binary":
828
+ return ue(this, t, e, n);
829
+ case "base64":
830
+ return fe(this, t, e, n);
831
+ case "ucs2":
832
+ case "ucs-2":
833
+ case "utf16le":
834
+ case "utf-16le":
835
+ return he(this, t, e, n);
836
+ default:
837
+ if (m)
838
+ throw new TypeError("Unknown encoding: " + s);
839
+ s = ("" + s).toLowerCase(), m = !0;
840
+ }
841
+ }, a.prototype.toJSON = function() {
842
+ return {
843
+ type: "Buffer",
844
+ data: Array.prototype.slice.call(this._arr || this, 0)
845
+ };
846
+ };
847
+ function me(r, t, e) {
848
+ return t === 0 && e === r.length ? o.fromByteArray(r) : o.fromByteArray(r.slice(t, e));
849
+ }
850
+ function wt(r, t, e) {
851
+ e = Math.min(r.length, e);
852
+ for (var n = [], s = t; s < e; ) {
853
+ var f = r[s], m = null, b = f > 239 ? 4 : f > 223 ? 3 : f > 191 ? 2 : 1;
854
+ if (s + b <= e) {
855
+ var _, F, B, A;
856
+ switch (b) {
857
+ case 1:
858
+ f < 128 && (m = f);
859
+ break;
860
+ case 2:
861
+ _ = r[s + 1], (_ & 192) === 128 && (A = (f & 31) << 6 | _ & 63, A > 127 && (m = A));
862
+ break;
863
+ case 3:
864
+ _ = r[s + 1], F = r[s + 2], (_ & 192) === 128 && (F & 192) === 128 && (A = (f & 15) << 12 | (_ & 63) << 6 | F & 63, A > 2047 && (A < 55296 || A > 57343) && (m = A));
865
+ break;
866
+ case 4:
867
+ _ = r[s + 1], F = r[s + 2], B = r[s + 3], (_ & 192) === 128 && (F & 192) === 128 && (B & 192) === 128 && (A = (f & 15) << 18 | (_ & 63) << 12 | (F & 63) << 6 | B & 63, A > 65535 && A < 1114112 && (m = A));
868
+ }
869
+ }
870
+ m === null ? (m = 65533, b = 1) : m > 65535 && (m -= 65536, n.push(m >>> 10 & 1023 | 55296), m = 56320 | m & 1023), n.push(m), s += b;
871
+ }
872
+ return xe(n);
873
+ }
874
+ var yt = 4096;
875
+ function xe(r) {
876
+ var t = r.length;
877
+ if (t <= yt)
878
+ return String.fromCharCode.apply(String, r);
879
+ for (var e = "", n = 0; n < t; )
880
+ e += String.fromCharCode.apply(
881
+ String,
882
+ r.slice(n, n += yt)
883
+ );
884
+ return e;
885
+ }
886
+ function de(r, t, e) {
887
+ var n = "";
888
+ e = Math.min(r.length, e);
889
+ for (var s = t; s < e; ++s)
890
+ n += String.fromCharCode(r[s] & 127);
891
+ return n;
892
+ }
893
+ function ge(r, t, e) {
894
+ var n = "";
895
+ e = Math.min(r.length, e);
896
+ for (var s = t; s < e; ++s)
897
+ n += String.fromCharCode(r[s]);
898
+ return n;
899
+ }
900
+ function we(r, t, e) {
901
+ var n = r.length;
902
+ (!t || t < 0) && (t = 0), (!e || e < 0 || e > n) && (e = n);
903
+ for (var s = "", f = t; f < e; ++f)
904
+ s += Fe[r[f]];
905
+ return s;
906
+ }
907
+ function ye(r, t, e) {
908
+ for (var n = r.slice(t, e), s = "", f = 0; f < n.length - 1; f += 2)
909
+ s += String.fromCharCode(n[f] + n[f + 1] * 256);
910
+ return s;
911
+ }
912
+ a.prototype.slice = function(t, e) {
913
+ var n = this.length;
914
+ t = ~~t, e = e === void 0 ? n : ~~e, t < 0 ? (t += n, t < 0 && (t = 0)) : t > n && (t = n), e < 0 ? (e += n, e < 0 && (e = 0)) : e > n && (e = n), e < t && (e = t);
915
+ var s = this.subarray(t, e);
916
+ return Object.setPrototypeOf(s, a.prototype), s;
917
+ };
918
+ function S(r, t, e) {
919
+ if (r % 1 !== 0 || r < 0)
920
+ throw new RangeError("offset is not uint");
921
+ if (r + t > e)
922
+ throw new RangeError("Trying to access beyond buffer length");
923
+ }
924
+ a.prototype.readUintLE = a.prototype.readUIntLE = function(t, e, n) {
925
+ t = t >>> 0, e = e >>> 0, n || S(t, e, this.length);
926
+ for (var s = this[t], f = 1, m = 0; ++m < e && (f *= 256); )
927
+ s += this[t + m] * f;
928
+ return s;
929
+ }, a.prototype.readUintBE = a.prototype.readUIntBE = function(t, e, n) {
930
+ t = t >>> 0, e = e >>> 0, n || S(t, e, this.length);
931
+ for (var s = this[t + --e], f = 1; e > 0 && (f *= 256); )
932
+ s += this[t + --e] * f;
933
+ return s;
934
+ }, a.prototype.readUint8 = a.prototype.readUInt8 = function(t, e) {
935
+ return t = t >>> 0, e || S(t, 1, this.length), this[t];
936
+ }, a.prototype.readUint16LE = a.prototype.readUInt16LE = function(t, e) {
937
+ return t = t >>> 0, e || S(t, 2, this.length), this[t] | this[t + 1] << 8;
938
+ }, a.prototype.readUint16BE = a.prototype.readUInt16BE = function(t, e) {
939
+ return t = t >>> 0, e || S(t, 2, this.length), this[t] << 8 | this[t + 1];
940
+ }, a.prototype.readUint32LE = a.prototype.readUInt32LE = function(t, e) {
941
+ return t = t >>> 0, e || S(t, 4, this.length), (this[t] | this[t + 1] << 8 | this[t + 2] << 16) + this[t + 3] * 16777216;
942
+ }, a.prototype.readUint32BE = a.prototype.readUInt32BE = function(t, e) {
943
+ return t = t >>> 0, e || S(t, 4, this.length), this[t] * 16777216 + (this[t + 1] << 16 | this[t + 2] << 8 | this[t + 3]);
944
+ }, a.prototype.readIntLE = function(t, e, n) {
945
+ t = t >>> 0, e = e >>> 0, n || S(t, e, this.length);
946
+ for (var s = this[t], f = 1, m = 0; ++m < e && (f *= 256); )
947
+ s += this[t + m] * f;
948
+ return f *= 128, s >= f && (s -= Math.pow(2, 8 * e)), s;
949
+ }, a.prototype.readIntBE = function(t, e, n) {
950
+ t = t >>> 0, e = e >>> 0, n || S(t, e, this.length);
951
+ for (var s = e, f = 1, m = this[t + --s]; s > 0 && (f *= 256); )
952
+ m += this[t + --s] * f;
953
+ return f *= 128, m >= f && (m -= Math.pow(2, 8 * e)), m;
954
+ }, a.prototype.readInt8 = function(t, e) {
955
+ return t = t >>> 0, e || S(t, 1, this.length), this[t] & 128 ? (255 - this[t] + 1) * -1 : this[t];
956
+ }, a.prototype.readInt16LE = function(t, e) {
957
+ t = t >>> 0, e || S(t, 2, this.length);
958
+ var n = this[t] | this[t + 1] << 8;
959
+ return n & 32768 ? n | 4294901760 : n;
960
+ }, a.prototype.readInt16BE = function(t, e) {
961
+ t = t >>> 0, e || S(t, 2, this.length);
962
+ var n = this[t + 1] | this[t] << 8;
963
+ return n & 32768 ? n | 4294901760 : n;
964
+ }, a.prototype.readInt32LE = function(t, e) {
965
+ return t = t >>> 0, e || S(t, 4, this.length), this[t] | this[t + 1] << 8 | this[t + 2] << 16 | this[t + 3] << 24;
966
+ }, a.prototype.readInt32BE = function(t, e) {
967
+ return t = t >>> 0, e || S(t, 4, this.length), this[t] << 24 | this[t + 1] << 16 | this[t + 2] << 8 | this[t + 3];
968
+ }, a.prototype.readFloatLE = function(t, e) {
969
+ return t = t >>> 0, e || S(t, 4, this.length), p.read(this, t, !0, 23, 4);
970
+ }, a.prototype.readFloatBE = function(t, e) {
971
+ return t = t >>> 0, e || S(t, 4, this.length), p.read(this, t, !1, 23, 4);
972
+ }, a.prototype.readDoubleLE = function(t, e) {
973
+ return t = t >>> 0, e || S(t, 8, this.length), p.read(this, t, !0, 52, 8);
974
+ }, a.prototype.readDoubleBE = function(t, e) {
975
+ return t = t >>> 0, e || S(t, 8, this.length), p.read(this, t, !1, 52, 8);
976
+ };
977
+ function k(r, t, e, n, s, f) {
978
+ if (!a.isBuffer(r))
979
+ throw new TypeError('"buffer" argument must be a Buffer instance');
980
+ if (t > s || t < f)
981
+ throw new RangeError('"value" argument is out of bounds');
982
+ if (e + n > r.length)
983
+ throw new RangeError("Index out of range");
984
+ }
985
+ a.prototype.writeUintLE = a.prototype.writeUIntLE = function(t, e, n, s) {
986
+ if (t = +t, e = e >>> 0, n = n >>> 0, !s) {
987
+ var f = Math.pow(2, 8 * n) - 1;
988
+ k(this, t, e, n, f, 0);
989
+ }
990
+ var m = 1, b = 0;
991
+ for (this[e] = t & 255; ++b < n && (m *= 256); )
992
+ this[e + b] = t / m & 255;
993
+ return e + n;
994
+ }, a.prototype.writeUintBE = a.prototype.writeUIntBE = function(t, e, n, s) {
995
+ if (t = +t, e = e >>> 0, n = n >>> 0, !s) {
996
+ var f = Math.pow(2, 8 * n) - 1;
997
+ k(this, t, e, n, f, 0);
998
+ }
999
+ var m = n - 1, b = 1;
1000
+ for (this[e + m] = t & 255; --m >= 0 && (b *= 256); )
1001
+ this[e + m] = t / b & 255;
1002
+ return e + n;
1003
+ }, a.prototype.writeUint8 = a.prototype.writeUInt8 = function(t, e, n) {
1004
+ return t = +t, e = e >>> 0, n || k(this, t, e, 1, 255, 0), this[e] = t & 255, e + 1;
1005
+ }, a.prototype.writeUint16LE = a.prototype.writeUInt16LE = function(t, e, n) {
1006
+ return t = +t, e = e >>> 0, n || k(this, t, e, 2, 65535, 0), this[e] = t & 255, this[e + 1] = t >>> 8, e + 2;
1007
+ }, a.prototype.writeUint16BE = a.prototype.writeUInt16BE = function(t, e, n) {
1008
+ return t = +t, e = e >>> 0, n || k(this, t, e, 2, 65535, 0), this[e] = t >>> 8, this[e + 1] = t & 255, e + 2;
1009
+ }, a.prototype.writeUint32LE = a.prototype.writeUInt32LE = function(t, e, n) {
1010
+ return t = +t, e = e >>> 0, n || k(this, t, e, 4, 4294967295, 0), this[e + 3] = t >>> 24, this[e + 2] = t >>> 16, this[e + 1] = t >>> 8, this[e] = t & 255, e + 4;
1011
+ }, a.prototype.writeUint32BE = a.prototype.writeUInt32BE = function(t, e, n) {
1012
+ return t = +t, e = e >>> 0, n || k(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;
1013
+ }, a.prototype.writeIntLE = function(t, e, n, s) {
1014
+ if (t = +t, e = e >>> 0, !s) {
1015
+ var f = Math.pow(2, 8 * n - 1);
1016
+ k(this, t, e, n, f - 1, -f);
1017
+ }
1018
+ var m = 0, b = 1, _ = 0;
1019
+ for (this[e] = t & 255; ++m < n && (b *= 256); )
1020
+ t < 0 && _ === 0 && this[e + m - 1] !== 0 && (_ = 1), this[e + m] = (t / b >> 0) - _ & 255;
1021
+ return e + n;
1022
+ }, a.prototype.writeIntBE = function(t, e, n, s) {
1023
+ if (t = +t, e = e >>> 0, !s) {
1024
+ var f = Math.pow(2, 8 * n - 1);
1025
+ k(this, t, e, n, f - 1, -f);
1026
+ }
1027
+ var m = n - 1, b = 1, _ = 0;
1028
+ for (this[e + m] = t & 255; --m >= 0 && (b *= 256); )
1029
+ t < 0 && _ === 0 && this[e + m + 1] !== 0 && (_ = 1), this[e + m] = (t / b >> 0) - _ & 255;
1030
+ return e + n;
1031
+ }, a.prototype.writeInt8 = function(t, e, n) {
1032
+ return t = +t, e = e >>> 0, n || k(this, t, e, 1, 127, -128), t < 0 && (t = 255 + t + 1), this[e] = t & 255, e + 1;
1033
+ }, a.prototype.writeInt16LE = function(t, e, n) {
1034
+ return t = +t, e = e >>> 0, n || k(this, t, e, 2, 32767, -32768), this[e] = t & 255, this[e + 1] = t >>> 8, e + 2;
1035
+ }, a.prototype.writeInt16BE = function(t, e, n) {
1036
+ return t = +t, e = e >>> 0, n || k(this, t, e, 2, 32767, -32768), this[e] = t >>> 8, this[e + 1] = t & 255, e + 2;
1037
+ }, a.prototype.writeInt32LE = function(t, e, n) {
1038
+ return t = +t, e = e >>> 0, n || k(this, t, e, 4, 2147483647, -2147483648), this[e] = t & 255, this[e + 1] = t >>> 8, this[e + 2] = t >>> 16, this[e + 3] = t >>> 24, e + 4;
1039
+ }, a.prototype.writeInt32BE = function(t, e, n) {
1040
+ return t = +t, e = e >>> 0, n || k(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;
1041
+ };
1042
+ function vt(r, t, e, n, s, f) {
1043
+ if (e + n > r.length)
1044
+ throw new RangeError("Index out of range");
1045
+ if (e < 0)
1046
+ throw new RangeError("Index out of range");
1047
+ }
1048
+ function bt(r, t, e, n, s) {
1049
+ return t = +t, e = e >>> 0, s || vt(r, t, e, 4), p.write(r, t, e, n, 23, 4), e + 4;
1050
+ }
1051
+ a.prototype.writeFloatLE = function(t, e, n) {
1052
+ return bt(this, t, e, !0, n);
1053
+ }, a.prototype.writeFloatBE = function(t, e, n) {
1054
+ return bt(this, t, e, !1, n);
1055
+ };
1056
+ function Et(r, t, e, n, s) {
1057
+ return t = +t, e = e >>> 0, s || vt(r, t, e, 8), p.write(r, t, e, n, 52, 8), e + 8;
1058
+ }
1059
+ a.prototype.writeDoubleLE = function(t, e, n) {
1060
+ return Et(this, t, e, !0, n);
1061
+ }, a.prototype.writeDoubleBE = function(t, e, n) {
1062
+ return Et(this, t, e, !1, n);
1063
+ }, a.prototype.copy = function(t, e, n, s) {
1064
+ if (!a.isBuffer(t))
1065
+ throw new TypeError("argument should be a Buffer");
1066
+ if (n || (n = 0), !s && s !== 0 && (s = this.length), e >= t.length && (e = t.length), e || (e = 0), s > 0 && s < n && (s = n), s === n || t.length === 0 || this.length === 0)
1067
+ return 0;
1068
+ if (e < 0)
1069
+ throw new RangeError("targetStart out of bounds");
1070
+ if (n < 0 || n >= this.length)
1071
+ throw new RangeError("Index out of range");
1072
+ if (s < 0)
1073
+ throw new RangeError("sourceEnd out of bounds");
1074
+ s > this.length && (s = this.length), t.length - e < s - n && (s = t.length - e + n);
1075
+ var f = s - n;
1076
+ return this === t && typeof Uint8Array.prototype.copyWithin == "function" ? this.copyWithin(e, n, s) : Uint8Array.prototype.set.call(
1077
+ t,
1078
+ this.subarray(n, s),
1079
+ e
1080
+ ), f;
1081
+ }, a.prototype.fill = function(t, e, n, s) {
1082
+ if (typeof t == "string") {
1083
+ 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")
1084
+ throw new TypeError("encoding must be a string");
1085
+ if (typeof s == "string" && !a.isEncoding(s))
1086
+ throw new TypeError("Unknown encoding: " + s);
1087
+ if (t.length === 1) {
1088
+ var f = t.charCodeAt(0);
1089
+ (s === "utf8" && f < 128 || s === "latin1") && (t = f);
1090
+ }
1091
+ } else
1092
+ typeof t == "number" ? t = t & 255 : typeof t == "boolean" && (t = Number(t));
1093
+ if (e < 0 || this.length < e || this.length < n)
1094
+ throw new RangeError("Out of range index");
1095
+ if (n <= e)
1096
+ return this;
1097
+ e = e >>> 0, n = n === void 0 ? this.length : n >>> 0, t || (t = 0);
1098
+ var m;
1099
+ if (typeof t == "number")
1100
+ for (m = e; m < n; ++m)
1101
+ this[m] = t;
1102
+ else {
1103
+ var b = a.isBuffer(t) ? t : a.from(t, s), _ = b.length;
1104
+ if (_ === 0)
1105
+ throw new TypeError('The value "' + t + '" is invalid for argument "value"');
1106
+ for (m = 0; m < n - e; ++m)
1107
+ this[m + e] = b[m % _];
1108
+ }
1109
+ return this;
1110
+ };
1111
+ var ve = /[^+/0-9A-Za-z-_]/g;
1112
+ function be(r) {
1113
+ if (r = r.split("=")[0], r = r.trim().replace(ve, ""), r.length < 2)
1114
+ return "";
1115
+ for (; r.length % 4 !== 0; )
1116
+ r = r + "=";
1117
+ return r;
1118
+ }
1119
+ function Q(r, t) {
1120
+ t = t || 1 / 0;
1121
+ for (var e, n = r.length, s = null, f = [], m = 0; m < n; ++m) {
1122
+ if (e = r.charCodeAt(m), e > 55295 && e < 57344) {
1123
+ if (!s) {
1124
+ if (e > 56319) {
1125
+ (t -= 3) > -1 && f.push(239, 191, 189);
1126
+ continue;
1127
+ } else if (m + 1 === n) {
1128
+ (t -= 3) > -1 && f.push(239, 191, 189);
1129
+ continue;
1130
+ }
1131
+ s = e;
1132
+ continue;
1133
+ }
1134
+ if (e < 56320) {
1135
+ (t -= 3) > -1 && f.push(239, 191, 189), s = e;
1136
+ continue;
1137
+ }
1138
+ e = (s - 55296 << 10 | e - 56320) + 65536;
1139
+ } else
1140
+ s && (t -= 3) > -1 && f.push(239, 191, 189);
1141
+ if (s = null, e < 128) {
1142
+ if ((t -= 1) < 0)
1143
+ break;
1144
+ f.push(e);
1145
+ } else if (e < 2048) {
1146
+ if ((t -= 2) < 0)
1147
+ break;
1148
+ f.push(
1149
+ e >> 6 | 192,
1150
+ e & 63 | 128
1151
+ );
1152
+ } else if (e < 65536) {
1153
+ if ((t -= 3) < 0)
1154
+ break;
1155
+ f.push(
1156
+ e >> 12 | 224,
1157
+ e >> 6 & 63 | 128,
1158
+ e & 63 | 128
1159
+ );
1160
+ } else if (e < 1114112) {
1161
+ if ((t -= 4) < 0)
1162
+ break;
1163
+ f.push(
1164
+ e >> 18 | 240,
1165
+ e >> 12 & 63 | 128,
1166
+ e >> 6 & 63 | 128,
1167
+ e & 63 | 128
1168
+ );
1169
+ } else
1170
+ throw new Error("Invalid code point");
1171
+ }
1172
+ return f;
1173
+ }
1174
+ function Ee(r) {
1175
+ for (var t = [], e = 0; e < r.length; ++e)
1176
+ t.push(r.charCodeAt(e) & 255);
1177
+ return t;
1178
+ }
1179
+ function _e(r, t) {
1180
+ for (var e, n, s, f = [], m = 0; m < r.length && !((t -= 2) < 0); ++m)
1181
+ e = r.charCodeAt(m), n = e >> 8, s = e % 256, f.push(s), f.push(n);
1182
+ return f;
1183
+ }
1184
+ function _t(r) {
1185
+ return o.toByteArray(be(r));
1186
+ }
1187
+ function J(r, t, e, n) {
1188
+ for (var s = 0; s < n && !(s + e >= t.length || s >= r.length); ++s)
1189
+ t[s + e] = r[s];
1190
+ return s;
1191
+ }
1192
+ function O(r, t) {
1193
+ return r instanceof t || r != null && r.constructor != null && r.constructor.name != null && r.constructor.name === t.name;
1194
+ }
1195
+ function tt(r) {
1196
+ return r !== r;
1197
+ }
1198
+ var Fe = function() {
1199
+ for (var r = "0123456789abcdef", t = new Array(256), e = 0; e < 16; ++e)
1200
+ for (var n = e * 16, s = 0; s < 16; ++s)
1201
+ t[n + s] = r[e] + r[s];
1202
+ return t;
1203
+ }();
1204
+ })(Ht);
1205
+ /*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
1206
+ (function(i, o) {
1207
+ var p = Ht, c = p.Buffer;
1208
+ function u(l, a) {
1209
+ for (var x in l)
1210
+ a[x] = l[x];
1211
+ }
1212
+ c.from && c.alloc && c.allocUnsafe && c.allocUnsafeSlow ? i.exports = p : (u(p, o), o.Buffer = h);
1213
+ function h(l, a, x) {
1214
+ return c(l, a, x);
1215
+ }
1216
+ h.prototype = Object.create(c.prototype), u(c, h), h.from = function(l, a, x) {
1217
+ if (typeof l == "number")
1218
+ throw new TypeError("Argument must not be a number");
1219
+ return c(l, a, x);
1220
+ }, h.alloc = function(l, a, x) {
1221
+ if (typeof l != "number")
1222
+ throw new TypeError("Argument must be a number");
1223
+ var d = c(l);
1224
+ return a !== void 0 ? typeof x == "string" ? d.fill(a, x) : d.fill(a) : d.fill(0), d;
1225
+ }, h.allocUnsafe = function(l) {
1226
+ if (typeof l != "number")
1227
+ throw new TypeError("Argument must be a number");
1228
+ return c(l);
1229
+ }, h.allocUnsafeSlow = function(l) {
1230
+ if (typeof l != "number")
1231
+ throw new TypeError("Argument must be a number");
1232
+ return p.SlowBuffer(l);
1233
+ };
1234
+ })(nt, nt.exports);
1235
+ var Yt = nt.exports, Kt = Yt.Buffer;
1236
+ function X(i, o) {
1237
+ this._block = Kt.alloc(i), this._finalSize = o, this._blockSize = i, this._len = 0;
1238
+ }
1239
+ X.prototype.update = function(i, o) {
1240
+ typeof i == "string" && (o = o || "utf8", i = Kt.from(i, o));
1241
+ for (var p = this._block, c = this._blockSize, u = i.length, h = this._len, l = 0; l < u; ) {
1242
+ for (var a = h % c, x = Math.min(u - l, c - a), d = 0; d < x; d++)
1243
+ p[a + d] = i[l + d];
1244
+ h += x, l += x, h % c === 0 && this._update(p);
1245
+ }
1246
+ return this._len += u, this;
1247
+ };
1248
+ X.prototype.digest = function(i) {
1249
+ var o = this._len % this._blockSize;
1250
+ this._block[o] = 128, this._block.fill(0, o + 1), o >= this._finalSize && (this._update(this._block), this._block.fill(0));
1251
+ var p = this._len * 8;
1252
+ if (p <= 4294967295)
1253
+ this._block.writeUInt32BE(p, this._blockSize - 4);
1254
+ else {
1255
+ var c = (p & 4294967295) >>> 0, u = (p - c) / 4294967296;
1256
+ this._block.writeUInt32BE(u, this._blockSize - 8), this._block.writeUInt32BE(c, this._blockSize - 4);
1257
+ }
1258
+ this._update(this._block);
1259
+ var h = this._hash();
1260
+ return i ? h.toString(i) : h;
1261
+ };
1262
+ X.prototype._update = function() {
1263
+ throw new Error("_update must be implemented by subclass");
1264
+ };
1265
+ var tr = X, er = We, Vt = tr, rr = Yt.Buffer, ir = [
1266
+ 1518500249,
1267
+ 1859775393,
1268
+ -1894007588,
1269
+ -899497514
1270
+ ], nr = new Array(80);
1271
+ function P() {
1272
+ this.init(), this._w = nr, Vt.call(this, 64, 56);
1273
+ }
1274
+ er(P, Vt);
1275
+ P.prototype.init = function() {
1276
+ return this._a = 1732584193, this._b = 4023233417, this._c = 2562383102, this._d = 271733878, this._e = 3285377520, this;
1277
+ };
1278
+ function or(i) {
1279
+ return i << 1 | i >>> 31;
1280
+ }
1281
+ function ar(i) {
1282
+ return i << 5 | i >>> 27;
1283
+ }
1284
+ function pr(i) {
1285
+ return i << 30 | i >>> 2;
1286
+ }
1287
+ function sr(i, o, p, c) {
1288
+ return i === 0 ? o & p | ~o & c : i === 2 ? o & p | o & c | p & c : o ^ p ^ c;
1289
+ }
1290
+ P.prototype._update = function(i) {
1291
+ for (var o = this._w, p = this._a | 0, c = this._b | 0, u = this._c | 0, h = this._d | 0, l = this._e | 0, a = 0; a < 16; ++a)
1292
+ o[a] = i.readInt32BE(a * 4);
1293
+ for (; a < 80; ++a)
1294
+ o[a] = or(o[a - 3] ^ o[a - 8] ^ o[a - 14] ^ o[a - 16]);
1295
+ for (var x = 0; x < 80; ++x) {
1296
+ var d = ~~(x / 20), E = ar(p) + sr(d, c, u, h) + l + o[x] + ir[d] | 0;
1297
+ l = h, h = u, u = pr(c), c = p, p = E;
1298
+ }
1299
+ this._a = p + this._a | 0, this._b = c + this._b | 0, this._c = u + this._c | 0, this._d = h + this._d | 0, this._e = l + this._e | 0;
1300
+ };
1301
+ P.prototype._hash = function() {
1302
+ var i = rr.allocUnsafe(20);
1303
+ return i.writeInt32BE(this._a | 0, 0), i.writeInt32BE(this._b | 0, 4), i.writeInt32BE(this._c | 0, 8), i.writeInt32BE(this._d | 0, 12), i.writeInt32BE(this._e | 0, 16), i;
1304
+ };
1305
+ var cr = P;
1306
+ const lr = /* @__PURE__ */ Wt(cr), ft = new Error("File system not available.");
1307
+ function ur(i, o, p) {
1308
+ throw ft;
1309
+ }
1310
+ function Xt(i) {
1311
+ throw ft;
1312
+ }
1313
+ function fr(i) {
1314
+ throw ft;
1315
+ }
1316
+ const hr = async (i) => Xt();
1317
+ function mr(i) {
1318
+ let o = "";
1319
+ for (let p = 0; p < i.length; p += 2)
1320
+ o += String.fromCharCode(parseInt(i.substr(p, 2), 16));
1321
+ return btoa(o);
1322
+ }
1323
+ const G = (i, o = "sha1") => {
1324
+ if (o !== "sha1")
1325
+ throw new Error("Only sha1 algorithm is available.");
1326
+ const p = new lr();
1327
+ return mr(p.update(i).digest("hex"));
1328
+ }, Gt = async (i) => {
1329
+ const o = new jt(), { name: p, revision: c, documentType: u, created: h, lastModified: l } = i, a = {
1330
+ name: p,
1331
+ revision: c,
1332
+ documentType: u,
1333
+ created: h,
1334
+ lastModified: l
1335
+ };
1336
+ return o.file("header.json", JSON.stringify(a, null, 2)), o.file(
1337
+ "state.json",
1338
+ JSON.stringify(i.initialState || {}, null, 2)
1339
+ ), o.file("operations.json", JSON.stringify(i.operations, null, 2)), Object.keys(i.attachments).forEach((d) => {
1340
+ const { data: E, ...w } = i.attachments[d];
1341
+ o.file(d, E, {
1342
+ base64: !0,
1343
+ createFolders: !0,
1344
+ comment: JSON.stringify(w)
1345
+ });
1346
+ }), o;
1347
+ }, xr = async (i, o, p, c) => {
1348
+ await (await Gt(i)).generateAsync({
1349
+ type: "uint8array",
1350
+ streamFiles: !0
1351
+ });
1352
+ const h = c ?? i.name, l = `.${p}.zip`;
1353
+ return ur(
1354
+ o,
1355
+ h.endsWith(l) ? h : `${h}${l}`
1356
+ );
1357
+ }, Nr = async (i, o) => {
1358
+ const c = await (await Gt(i)).generateAsync({ type: "blob" }), u = await o.createWritable();
1359
+ await u.write(c), await u.close();
1360
+ }, St = async (i, o) => {
1361
+ const p = Xt();
1362
+ return dr(p, o);
1363
+ }, dr = async (i, o) => {
1364
+ const p = new jt();
1365
+ return await p.loadAsync(i), gr(p, o);
1366
+ };
1367
+ async function gr(i, o) {
1368
+ const p = i.file("state.json");
1369
+ if (!p)
1370
+ throw new Error("Initial state not found");
1371
+ const c = await p.async("string"), u = JSON.parse(c), h = i.file("header.json");
1372
+ let l;
1373
+ h && (l = JSON.parse(await h.async("string")));
1374
+ const a = i.file("operations.json");
1375
+ if (!a)
1376
+ throw new Error("Operations history not found");
1377
+ const x = JSON.parse(
1378
+ await a.async("string")
1379
+ );
1380
+ let d = re(
1381
+ u,
1382
+ x,
1383
+ o,
1384
+ void 0,
1385
+ l
1386
+ );
1387
+ return l && (d = {
1388
+ ...d,
1389
+ ...l
1390
+ }), d;
1391
+ }
1392
+ function Qt(i) {
1393
+ const o = i.replace(/^.*\./, "") || void 0, p = i.replace(/^.*[/\\]/, "") || void 0;
1394
+ return { extension: o, fileName: p };
1395
+ }
1396
+ async function Rr(i) {
1397
+ const { buffer: o, mimeType: p = "application/octet-stream" } = await fr(), c = Qt(i), u = o.toString("base64");
1398
+ return {
1399
+ data: u,
1400
+ hash: G(u),
1401
+ mimeType: p,
1402
+ ...c
1403
+ };
1404
+ }
1405
+ async function Mr(i) {
1406
+ const o = await hr(), p = Je.getType(i) || "application/octet-stream", c = Qt(i), u = o.toString("base64");
1407
+ return { data: u, hash: G(u), mimeType: p, ...c };
1408
+ }
1409
+ function wr(i, o) {
1410
+ const p = i.revision[o.scope];
1411
+ return [M, C, $].includes(o.type) ? p : p + 1;
1412
+ }
1413
+ function yr(i, o) {
1414
+ return {
1415
+ ...i,
1416
+ revision: {
1417
+ ...i.revision,
1418
+ [o.scope]: wr(i, o)
1419
+ },
1420
+ lastModified: (/* @__PURE__ */ new Date()).toISOString()
1421
+ };
1422
+ }
1423
+ function vr(i, o, p = 0) {
1424
+ if ([M, C, $].includes(o.type))
1425
+ return i;
1426
+ const { scope: c } = o, u = i.operations[c].slice(
1427
+ 0,
1428
+ i.revision[c]
1429
+ );
1430
+ return u.push({
1431
+ ...o,
1432
+ index: u.length,
1433
+ timestamp: (/* @__PURE__ */ new Date()).toISOString(),
1434
+ hash: "",
1435
+ scope: c,
1436
+ skip: p
1437
+ }), {
1438
+ ...i,
1439
+ operations: { ...i.operations, [c]: u }
1440
+ };
1441
+ }
1442
+ function br(i, o, p = 0) {
1443
+ let c = vr(i, o, p);
1444
+ return c = yr(c, o), c;
1445
+ }
1446
+ function Er(i, o, p) {
1447
+ switch (Rt().parse(o), o.type) {
1448
+ case Pt:
1449
+ return Ne(i, o.input);
1450
+ case $:
1451
+ return Ce(i, o, p);
1452
+ case Jt:
1453
+ return Le(i, o.input.state);
1454
+ default:
1455
+ return i;
1456
+ }
1457
+ }
1458
+ function _r(i, o, p) {
1459
+ switch (o.type) {
1460
+ case M:
1461
+ return Re(i, o, p);
1462
+ case C:
1463
+ return Me(i, o, p);
1464
+ default:
1465
+ return { document: i, action: o, skip: p };
1466
+ }
1467
+ }
1468
+ function te(i, o, p, c, u = {}) {
1469
+ const { skip: h, ignoreSkipOperations: l = !1 } = u;
1470
+ let a = { ...o }, x = h || 0, d = i, E = [...i.clipboard];
1471
+ if (Bt(a)) {
1472
+ const {
1473
+ skip: w,
1474
+ action: v,
1475
+ document: y
1476
+ } = _r(i, a, x);
1477
+ a = v, x = w, d = y, E = [...d.clipboard];
1478
+ }
1479
+ return kt(a) && (d = Er(d, a, p)), x > 0 && !l && (d = ot(
1480
+ d.initialState,
1481
+ d.operations,
1482
+ p,
1483
+ void 0,
1484
+ void 0,
1485
+ void 0,
1486
+ { [a.scope]: x }
1487
+ )), d = br(d, a, x), d = Y(d, (w) => {
1488
+ const v = p(
1489
+ w.state,
1490
+ a,
1491
+ c
1492
+ ), y = Bt(o) ? [...E] : [];
1493
+ if (v)
1494
+ return rt({
1495
+ ...d,
1496
+ clipboard: [...y],
1497
+ state: v
1498
+ });
1499
+ w.clipboard = rt([...y]);
1500
+ }), Y(d, (w) => {
1501
+ if ([M, C, $].includes(a.type))
1502
+ return w;
1503
+ const v = a.scope || "global";
1504
+ w.operations[v][w.operations[v].length - 1].hash = ee(w, v), !kt(a) && a.attachments && a.attachments.forEach((y) => {
1505
+ const { hash: U, ...j } = y;
1506
+ w.attachments[U] = {
1507
+ ...j
1508
+ };
1509
+ });
1510
+ });
1511
+ }
1512
+ function Bt(i) {
1513
+ return [M, C].includes(i.type);
1514
+ }
1515
+ function kt(i) {
1516
+ return [Pt, M, C, $, Jt].includes(i.type);
1517
+ }
1518
+ function L(i, o, p, c, u = "global") {
1519
+ if (!i)
1520
+ throw new Error("Empty action type");
1521
+ if (typeof i != "string")
1522
+ throw new Error(`Invalid action type: ${i}`);
1523
+ const h = { type: i, input: o, scope: u };
1524
+ p && (h.attachments = p);
1525
+ try {
1526
+ c == null || c().parse(h.input);
1527
+ } catch (l) {
1528
+ throw new Error(`Invalid action input: ${l}`);
1529
+ }
1530
+ return h;
1531
+ }
1532
+ function Fr(i, o = te) {
1533
+ return (p, c, u, h) => o(p, c, i, u, h);
1534
+ }
1535
+ const Ar = (i, o) => ({
1536
+ name: "",
1537
+ documentType: "",
1538
+ revision: {
1539
+ global: 0,
1540
+ local: 0
1541
+ },
1542
+ created: (/* @__PURE__ */ new Date()).toISOString(),
1543
+ lastModified: (/* @__PURE__ */ new Date()).toISOString(),
1544
+ attachments: {},
1545
+ ...i,
1546
+ state: (o == null ? void 0 : o(i == null ? void 0 : i.state)) ?? (i == null ? void 0 : i.state) ?? { global: {}, local: {} }
1547
+ }), Sr = (i, o) => {
1548
+ const p = Ar(
1549
+ i,
1550
+ o
1551
+ );
1552
+ return {
1553
+ ...p,
1554
+ initialState: p,
1555
+ operations: { global: [], local: [] },
1556
+ clipboard: []
1557
+ };
1558
+ }, ee = (i, o = "global") => G(je(i.state[o])), Cr = (i, o = 1e3) => {
1559
+ const p = Math.random() * o;
1560
+ return G(`${(i ?? /* @__PURE__ */ new Date()).toISOString()}${p}`);
1561
+ };
1562
+ function Z(i) {
1563
+ return Be(ke(i, !0));
1564
+ }
1565
+ function Br(i, o) {
1566
+ const p = [...i];
1567
+ let c = o || 0, u = p.length > 0 ? p[p.length - 1].index : 0;
1568
+ const h = [];
1569
+ for (const l of p.reverse()) {
1570
+ if (c > 0) {
1571
+ const d = u - l.index;
1572
+ c -= d;
1573
+ }
1574
+ if (c < 0)
1575
+ throw new Error("Invalid operation index, missing operations");
1576
+ const a = {
1577
+ ignore: c > 0,
1578
+ operation: l
1579
+ }, x = l.skip > 0 ? l.skip + 1 : 0;
1580
+ if (x > 0 && x > c) {
1581
+ const d = x - c;
1582
+ c = c + d;
1583
+ }
1584
+ u = l.index, h.push(a);
1585
+ }
1586
+ return h.reverse();
1587
+ }
1588
+ function Lr(i) {
1589
+ return Object.values(i).flatMap((o) => o).sort(
1590
+ (o, p) => new Date(o.timestamp).getTime() - new Date(p.timestamp).getTime()
1591
+ );
1592
+ }
1593
+ function kr(i) {
1594
+ return Object.values(i).flatMap((o) => o).sort(
1595
+ (o, p) => new Date(o.operation.timestamp).getTime() - new Date(p.operation.timestamp).getTime()
1596
+ );
1597
+ }
1598
+ function ot(i, o, p, c, u, h = te, l = {}) {
1599
+ const a = Fr(p, h);
1600
+ return re(
1601
+ i,
1602
+ o,
1603
+ a,
1604
+ c,
1605
+ u,
1606
+ l
1607
+ );
1608
+ }
1609
+ function re(i, o, p, c, u, h = {}) {
1610
+ const l = Sr(i), a = Object.keys(o).reduce((w, v) => {
1611
+ const y = v;
1612
+ return {
1613
+ ...w,
1614
+ [y]: o[y].slice(0, u == null ? void 0 : u.revision[y])
1615
+ };
1616
+ }, {}), x = Object.keys(a).reduce((w, v) => {
1617
+ const y = v;
1618
+ return {
1619
+ ...w,
1620
+ [y]: Br(a[y], h[y])
1621
+ };
1622
+ }, {}), d = kr(x).reduce(
1623
+ (w, { ignore: v, operation: y }) => v ? p(
1624
+ w,
1625
+ mt(y.scope),
1626
+ c,
1627
+ { skip: y.skip, ignoreSkipOperations: !0 }
1628
+ ) : p(
1629
+ w,
1630
+ y,
1631
+ c,
1632
+ { skip: y.skip, ignoreSkipOperations: !0 }
1633
+ ),
1634
+ l
1635
+ ), E = Object.keys(
1636
+ d.operations
1637
+ ).reduce(
1638
+ (w, v) => {
1639
+ const y = v, U = u && u.revision[y] < o[y].length ? o[y].slice(u.revision[y]) : [];
1640
+ return {
1641
+ ...w,
1642
+ [y]: [
1643
+ ...d.operations[y].map((j, z) => {
1644
+ var N;
1645
+ return {
1646
+ ...j,
1647
+ timestamp: ((N = o[y][z]) == null ? void 0 : N.timestamp) ?? j.timestamp
1648
+ };
1649
+ }),
1650
+ ...U
1651
+ ]
1652
+ };
1653
+ },
1654
+ { global: [], local: [] }
1655
+ );
1656
+ return { ...d, operations: E };
1657
+ }
1658
+ const ie = (i) => L(
1659
+ "SET_NAME",
1660
+ i,
1661
+ void 0,
1662
+ ct,
1663
+ void 0
1664
+ ), ne = (i = 1, o = "global") => L(
1665
+ "UNDO",
1666
+ i,
1667
+ void 0,
1668
+ lt,
1669
+ o
1670
+ ), oe = (i = 1, o = "global") => L(
1671
+ "REDO",
1672
+ i,
1673
+ void 0,
1674
+ st,
1675
+ o
1676
+ ), ae = (i, o, p = "global") => L(
1677
+ "PRUNE",
1678
+ { start: i, end: o },
1679
+ void 0,
1680
+ pt,
1681
+ p
1682
+ ), ht = (i, o) => L(
1683
+ "LOAD_STATE",
1684
+ { state: i, operations: o },
1685
+ void 0,
1686
+ at
1687
+ ), mt = (i = "global") => L(
1688
+ "NOOP",
1689
+ {},
1690
+ void 0,
1691
+ void 0,
1692
+ i
1693
+ ), zr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1694
+ __proto__: null,
1695
+ loadState: ht,
1696
+ noop: mt,
1697
+ prune: ae,
1698
+ redo: oe,
1699
+ setName: ie,
1700
+ undo: ne
1701
+ }, Symbol.toStringTag, { value: "Module" }));
1702
+ class qr {
1703
+ /**
1704
+ * Constructs a BaseDocument instance with an initial state.
1705
+ * @param reducer - The reducer function that updates the state.
1706
+ * @param document - The initial state of the document.
1707
+ */
1708
+ constructor(o, p, c) {
1709
+ H(this, "_document");
1710
+ H(this, "_reducer");
1711
+ H(this, "_signalDispatch");
1712
+ this._reducer = o, this._document = p, this._signalDispatch = c;
1713
+ }
1714
+ /**
1715
+ * Dispatches an action to update the state of the document.
1716
+ * @param action - The action to dispatch.
1717
+ * @returns The Document instance.
1718
+ */
1719
+ dispatch(o, p) {
1720
+ return this._document = this._reducer(
1721
+ this._document,
1722
+ o,
1723
+ this._signalDispatch,
1724
+ p
1725
+ ), this;
1726
+ }
1727
+ /**
1728
+ * Saves the state of the document to a file.
1729
+ * @param path - The file path where the state should be saved.
1730
+ * @param extension - The file extension to use when saving the state.
1731
+ * @returns The file path where the state was saved.
1732
+ */
1733
+ saveToFile(o, p, c) {
1734
+ return xr(this._document, o, p, c);
1735
+ }
1736
+ /**
1737
+ * Loads the state of the document from a file.
1738
+ * @param path - The file path where the state is stored.
1739
+ */
1740
+ async loadFromFile(o) {
1741
+ this._document = await St(o, this._reducer);
1742
+ }
1743
+ /**
1744
+ * Loads the state of the document from a file and returns it.
1745
+ * @param path - The file path where the state is stored.
1746
+ * @param reducer - The reducer function that updates the state.
1747
+ * @returns The state of the document.
1748
+ */
1749
+ static async stateFromFile(o, p) {
1750
+ return await St(o, p);
1751
+ }
1752
+ /**
1753
+ * Gets the current state of the document.
1754
+ */
1755
+ get state() {
1756
+ return Z(this._document.state);
1757
+ }
1758
+ /**
1759
+ * Gets the list of operations performed on the document.
1760
+ */
1761
+ get operations() {
1762
+ return Z(this._document.operations);
1763
+ }
1764
+ /**
1765
+ * Gets the name of the document.
1766
+ */
1767
+ get name() {
1768
+ return this._document.name;
1769
+ }
1770
+ /**
1771
+ * Gets the type of document.
1772
+ */
1773
+ get documentType() {
1774
+ return this._document.documentType;
1775
+ }
1776
+ /**
1777
+ * Gets the timestamp of the date the document was created.
1778
+ */
1779
+ get created() {
1780
+ return this._document.created;
1781
+ }
1782
+ /**
1783
+ * Gets the timestamp of the date the document was last modified.
1784
+ */
1785
+ get lastModified() {
1786
+ return this._document.lastModified;
1787
+ }
1788
+ /**
1789
+ * Gets the global revision number of the document.
1790
+ */
1791
+ get revision() {
1792
+ return this._document.revision.global;
1793
+ }
1794
+ getRevision(o) {
1795
+ return this._document.revision[o];
1796
+ }
1797
+ /**
1798
+ * Gets the initial state of the document.
1799
+ */
1800
+ get initialState() {
1801
+ return Z(this._document.initialState);
1802
+ }
1803
+ /**
1804
+ * Returns the current document as an object
1805
+ */
1806
+ toDocument() {
1807
+ return Z(this._document);
1808
+ }
1809
+ /**
1810
+ * Gets the attachment associated with the given key.
1811
+ * @param attachment - The key of the attachment to retrieve.
1812
+ */
1813
+ getAttachment(o) {
1814
+ return this._document.attachments[o];
1815
+ }
1816
+ /**
1817
+ * Sets the name of the document.
1818
+ * @param name - The new name of the document.
1819
+ */
1820
+ setName(o) {
1821
+ return this.dispatch(ie(o)), this;
1822
+ }
1823
+ /**
1824
+ * Reverts a number of actions from the document.
1825
+ * @param count - The number of actions to revert.
1826
+ */
1827
+ undo(o) {
1828
+ return this.dispatch(ne(o)), this;
1829
+ }
1830
+ /**
1831
+ * Reapplies a number of actions to the document.
1832
+ * @param count - The number of actions to reapply.
1833
+ */
1834
+ redo(o) {
1835
+ return this.dispatch(oe(o)), this;
1836
+ }
1837
+ /**
1838
+ * Removes a range of operations from the document.
1839
+ * @param start - The starting index of the range to remove.
1840
+ * @param end - The ending index of the range to remove.
1841
+ */
1842
+ prune(o, p) {
1843
+ return this.dispatch(ae(o, p)), this;
1844
+ }
1845
+ /**
1846
+ * Loads a document state and a set of operations.
1847
+ * @param state - The state to load.
1848
+ * @param operations - The operations to apply to the document.
1849
+ */
1850
+ loadState(o, p) {
1851
+ return this.dispatch(ht(o, p)), this;
1852
+ }
1853
+ }
1854
+ function $r(i, o) {
1855
+ o.forEach((p) => {
1856
+ Object.getOwnPropertyNames(p.prototype).forEach((c) => {
1857
+ Object.defineProperty(
1858
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
1859
+ i.prototype,
1860
+ c,
1861
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access
1862
+ Object.getOwnPropertyDescriptor(p.prototype, c) || /* @__PURE__ */ Object.create(null)
1863
+ );
1864
+ });
1865
+ });
1866
+ }
1867
+ export {
1868
+ qr as B,
1869
+ Ar as a,
1870
+ Sr as b,
1871
+ Fr as c,
1872
+ Nr as d,
1873
+ dr as e,
1874
+ L as f,
1875
+ $r as g,
1876
+ zr as h,
1877
+ kt as i,
1878
+ Gt as j,
1879
+ Mr as k,
1880
+ St as l,
1881
+ Rr as m,
1882
+ ee as n,
1883
+ Cr as o,
1884
+ Bt as p,
1885
+ Br as q,
1886
+ Z as r,
1887
+ xr as s,
1888
+ re as t,
1889
+ ot as u,
1890
+ kr as v,
1891
+ Lr as w,
1892
+ te as x,
1893
+ _r as y,
1894
+ Dr as z
1895
+ };