document-model 1.5.0 → 1.7.0

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 (67) hide show
  1. package/dist/browser/cjs/document-model.js +2 -2
  2. package/dist/browser/cjs/document.js +2 -2
  3. package/dist/browser/cjs/index.js +2 -2
  4. package/dist/{node/cjs/internal/index-RX6RcsNg.js → browser/cjs/internal/index-BllCzBc9.js} +11 -3
  5. package/dist/browser/cjs/internal/index-BllCzBc9.js.map +1 -0
  6. package/dist/browser/cjs/internal/{index-BoiSedJ2.js → index-DTRXQ2Nf.js} +5 -10
  7. package/dist/browser/{es/internal/index-B7idSyw8.js.map → cjs/internal/index-DTRXQ2Nf.js.map} +1 -1
  8. package/dist/browser/cjs/internal/{object-DldjPOTT.js → object-Bf9_woMQ.js} +327 -321
  9. package/dist/browser/cjs/internal/object-Bf9_woMQ.js.map +1 -0
  10. package/dist/browser/es/document-model.js +2 -2
  11. package/dist/browser/es/document.js +8 -8
  12. package/dist/browser/es/index.js +2 -2
  13. package/dist/browser/es/internal/{index-B7idSyw8.js → index-BAvDobTr.js} +5 -10
  14. package/dist/{node/es/internal/index-BFRJ-0Rp.js.map → browser/es/internal/index-BAvDobTr.js.map} +1 -1
  15. package/dist/browser/es/internal/index-Db40bdYP.js +58 -0
  16. package/dist/browser/es/internal/index-Db40bdYP.js.map +1 -0
  17. package/dist/browser/es/internal/{object-I6vKsK3r.js → object-CY74acQg.js} +352 -346
  18. package/dist/browser/es/internal/object-CY74acQg.js.map +1 -0
  19. package/dist/browser/src/document/actions/creators.d.ts +1 -1
  20. package/dist/browser/src/document/schema/zod.d.ts +18 -18
  21. package/dist/browser/src/document/types.d.ts +12 -1
  22. package/dist/browser/src/document/utils/base.d.ts +1 -1
  23. package/dist/browser/src/document/utils/crypto.d.ts +10 -0
  24. package/dist/browser/src/document/utils/document-helpers.d.ts +1 -0
  25. package/dist/browser/src/document/utils/index.d.ts +1 -0
  26. package/dist/browser/src/document/utils/node.d.ts +3 -2
  27. package/dist/browser/src/document-model/gen/schema/zod.d.ts +177 -177
  28. package/dist/browser/src/document-model/index.d.ts +3 -3
  29. package/dist/node/cjs/document-model.js +2 -2
  30. package/dist/node/cjs/document.js +2 -2
  31. package/dist/node/cjs/index.js +2 -2
  32. package/dist/node/cjs/internal/{index-WVYoLyly.js → index-aABa-Hb0.js} +5 -10
  33. package/dist/node/cjs/internal/{index-WVYoLyly.js.map → index-aABa-Hb0.js.map} +1 -1
  34. package/dist/{browser/cjs/internal/index-frw-qprx.js → node/cjs/internal/index-kI4cPPpE.js} +11 -3
  35. package/dist/node/cjs/internal/index-kI4cPPpE.js.map +1 -0
  36. package/dist/node/cjs/internal/{object-7GplcYr4.js → object-BMm0OLWL.js} +173 -60
  37. package/dist/node/cjs/internal/object-BMm0OLWL.js.map +1 -0
  38. package/dist/node/es/document-model.js +2 -2
  39. package/dist/node/es/document.js +8 -8
  40. package/dist/node/es/index.js +2 -2
  41. package/dist/node/es/internal/{index-BFRJ-0Rp.js → index-B0WPutmO.js} +5 -10
  42. package/dist/{browser/cjs/internal/index-BoiSedJ2.js.map → node/es/internal/index-B0WPutmO.js.map} +1 -1
  43. package/dist/node/es/internal/index-MkEgGMJR.js +58 -0
  44. package/dist/node/es/internal/index-MkEgGMJR.js.map +1 -0
  45. package/dist/node/es/internal/{object-Cu2Dz-iF.js → object-VZ_AS47_.js} +198 -85
  46. package/dist/node/es/internal/object-VZ_AS47_.js.map +1 -0
  47. package/dist/node/src/document/actions/creators.d.ts +1 -1
  48. package/dist/node/src/document/schema/zod.d.ts +18 -18
  49. package/dist/node/src/document/types.d.ts +12 -1
  50. package/dist/node/src/document/utils/base.d.ts +1 -1
  51. package/dist/node/src/document/utils/crypto.d.ts +10 -0
  52. package/dist/node/src/document/utils/document-helpers.d.ts +1 -0
  53. package/dist/node/src/document/utils/index.d.ts +1 -0
  54. package/dist/node/src/document/utils/node.d.ts +3 -2
  55. package/dist/node/src/document-model/gen/schema/zod.d.ts +177 -177
  56. package/dist/node/src/document-model/index.d.ts +3 -3
  57. package/package.json +2 -1
  58. package/dist/browser/cjs/internal/index-frw-qprx.js.map +0 -1
  59. package/dist/browser/cjs/internal/object-DldjPOTT.js.map +0 -1
  60. package/dist/browser/es/internal/index-D2kKzCXD.js +0 -50
  61. package/dist/browser/es/internal/index-D2kKzCXD.js.map +0 -1
  62. package/dist/browser/es/internal/object-I6vKsK3r.js.map +0 -1
  63. package/dist/node/cjs/internal/index-RX6RcsNg.js.map +0 -1
  64. package/dist/node/cjs/internal/object-7GplcYr4.js.map +0 -1
  65. package/dist/node/es/internal/index-NWZKlhKu.js +0 -50
  66. package/dist/node/es/internal/index-NWZKlhKu.js.map +0 -1
  67. package/dist/node/es/internal/object-Cu2Dz-iF.js.map +0 -1
@@ -1,10 +1,7 @@
1
1
  "use strict";
2
2
  var __defProp = Object.defineProperty;
3
3
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4
- var __publicField = (obj, key, value) => {
5
- __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
6
- return value;
7
- };
4
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
8
5
  const mutative = require("mutative");
9
6
  const zod$1 = require("zod");
10
7
  const JSZip = require("jszip");
@@ -271,8 +268,7 @@ var safeStableStringify = { exports: {} };
271
268
  if (value) {
272
269
  return (value2) => {
273
270
  let message = `Object can not safely be stringified. Received type ${typeof value2}`;
274
- if (typeof value2 !== "function")
275
- message += ` (${value2.toString()})`;
271
+ if (typeof value2 !== "function") message += ` (${value2.toString()})`;
276
272
  throw new Error(message);
277
273
  };
278
274
  }
@@ -921,95 +917,6 @@ const REDO = "REDO";
921
917
  const PRUNE = "PRUNE";
922
918
  const LOAD_STATE = "LOAD_STATE";
923
919
  const NOOP = "NOOP";
924
- const types = { "application/andrew-inset": ["ez"], "application/appinstaller": ["appinstaller"], "application/applixware": ["aw"], "application/appx": ["appx"], "application/appxbundle": ["appxbundle"], "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/automationml-aml+xml": ["aml"], "application/automationml-amlx+zip": ["amlx"], "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/cpl+xml": ["cpl"], "application/cu-seeme": ["cu"], "application/cwl": ["cwl"], "application/dash+xml": ["mpd"], "application/dash-patch+xml": ["mpp"], "application/davmount+xml": ["davmount"], "application/docbook+xml": ["dbk"], "application/dssc+der": ["dssc"], "application/dssc+xml": ["xdssc"], "application/ecmascript": ["ecma"], "application/emma+xml": ["emma"], "application/emotionml+xml": ["emotionml"], "application/epub+zip": ["epub"], "application/exi": ["exi"], "application/express": ["exp"], "application/fdf": ["fdf"], "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"], "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/media-policy-dataset+xml": ["mpf"], "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": ["*mp4", "*mpg4", "mp4s", "m4p"], "application/msix": ["msix"], "application/msixbundle": ["msixbundle"], "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-keys": ["asc"], "application/pgp-signature": ["sig", "*asc"], "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/sql": ["sql"], "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/watcherinfo+xml": ["wif"], "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/xfdf": ["xfdf"], "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/aac": ["adts", "aac"], "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/avci": ["avci"], "image/avcs": ["avcs"], "image/avif": ["avif"], "image/bmp": ["bmp", "dib"], "image/cgm": ["cgm"], "image/dicom-rle": ["drle"], "image/dpx": ["dpx"], "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", "jpgm"], "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/jt": ["jt"], "model/mesh": ["msh", "mesh", "silo"], "model/mtl": ["mtl"], "model/obj": ["obj"], "model/prc": ["prc"], "model/step+xml": ["stpx"], "model/step+zip": ["stpz"], "model/step-xml+zip": ["stpxz"], "model/stl": ["stl"], "model/u3d": ["u3d"], "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/javascript": ["js", "mjs"], "text/jsx": ["jsx"], "text/less": ["less"], "text/markdown": ["md", "markdown"], "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/wgsl": ["wgsl"], "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"] };
925
- Object.freeze(types);
926
- var __classPrivateFieldGet = function(receiver, state, kind, f) {
927
- if (kind === "a" && !f)
928
- throw new TypeError("Private accessor was defined without a getter");
929
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
930
- throw new TypeError("Cannot read private member from an object whose class did not declare it");
931
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
932
- };
933
- var _Mime_extensionToType, _Mime_typeToExtension, _Mime_typeToExtensions;
934
- class Mime {
935
- constructor(...args) {
936
- _Mime_extensionToType.set(this, /* @__PURE__ */ new Map());
937
- _Mime_typeToExtension.set(this, /* @__PURE__ */ new Map());
938
- _Mime_typeToExtensions.set(this, /* @__PURE__ */ new Map());
939
- for (const arg of args) {
940
- this.define(arg);
941
- }
942
- }
943
- define(typeMap, force = false) {
944
- for (let [type, extensions] of Object.entries(typeMap)) {
945
- type = type.toLowerCase();
946
- extensions = extensions.map((ext) => ext.toLowerCase());
947
- if (!__classPrivateFieldGet(this, _Mime_typeToExtensions, "f").has(type)) {
948
- __classPrivateFieldGet(this, _Mime_typeToExtensions, "f").set(type, /* @__PURE__ */ new Set());
949
- }
950
- const allExtensions = __classPrivateFieldGet(this, _Mime_typeToExtensions, "f").get(type);
951
- let first = true;
952
- for (let extension of extensions) {
953
- const starred = extension.startsWith("*");
954
- extension = starred ? extension.slice(1) : extension;
955
- allExtensions == null ? void 0 : allExtensions.add(extension);
956
- if (first) {
957
- __classPrivateFieldGet(this, _Mime_typeToExtension, "f").set(type, extension);
958
- }
959
- first = false;
960
- if (starred)
961
- continue;
962
- const currentType = __classPrivateFieldGet(this, _Mime_extensionToType, "f").get(extension);
963
- if (currentType && currentType != type && !force) {
964
- throw new Error(`"${type} -> ${extension}" conflicts with "${currentType} -> ${extension}". Pass \`force=true\` to override this definition.`);
965
- }
966
- __classPrivateFieldGet(this, _Mime_extensionToType, "f").set(extension, type);
967
- }
968
- }
969
- return this;
970
- }
971
- getType(path) {
972
- if (typeof path !== "string")
973
- return null;
974
- const last = path.replace(/^.*[/\\]/, "").toLowerCase();
975
- const ext = last.replace(/^.*\./, "").toLowerCase();
976
- const hasPath = last.length < path.length;
977
- const hasDot = ext.length < last.length - 1;
978
- if (!hasDot && hasPath)
979
- return null;
980
- return __classPrivateFieldGet(this, _Mime_extensionToType, "f").get(ext) ?? null;
981
- }
982
- getExtension(type) {
983
- var _a;
984
- if (typeof type !== "string")
985
- return null;
986
- type = (_a = type == null ? void 0 : type.split) == null ? void 0 : _a.call(type, ";")[0];
987
- return (type && __classPrivateFieldGet(this, _Mime_typeToExtension, "f").get(type.trim().toLowerCase())) ?? null;
988
- }
989
- getAllExtensions(type) {
990
- if (typeof type !== "string")
991
- return null;
992
- return __classPrivateFieldGet(this, _Mime_typeToExtensions, "f").get(type.toLowerCase()) ?? null;
993
- }
994
- _freeze() {
995
- this.define = () => {
996
- throw new Error("define() not allowed for built-in Mime objects. See https://github.com/broofa/mime/blob/main/README.md#custom-mime-instances");
997
- };
998
- Object.freeze(this);
999
- for (const extensions of __classPrivateFieldGet(this, _Mime_typeToExtensions, "f").values()) {
1000
- Object.freeze(extensions);
1001
- }
1002
- return this;
1003
- }
1004
- _getTestState() {
1005
- return {
1006
- types: __classPrivateFieldGet(this, _Mime_extensionToType, "f"),
1007
- extensions: __classPrivateFieldGet(this, _Mime_typeToExtension, "f")
1008
- };
1009
- }
1010
- }
1011
- _Mime_extensionToType = /* @__PURE__ */ new WeakMap(), _Mime_typeToExtension = /* @__PURE__ */ new WeakMap(), _Mime_typeToExtensions = /* @__PURE__ */ new WeakMap();
1012
- const mime = new Mime(types)._freeze();
1013
920
  var inherits_browser = { exports: {} };
1014
921
  if (typeof Object.create === "function") {
1015
922
  inherits_browser.exports = function inherits2(ctor, superCtor) {
@@ -1060,8 +967,7 @@ function getLens(b64) {
1060
967
  throw new Error("Invalid string. Length must be a multiple of 4");
1061
968
  }
1062
969
  var validLen = b64.indexOf("=");
1063
- if (validLen === -1)
1064
- validLen = len;
970
+ if (validLen === -1) validLen = len;
1065
971
  var placeHoldersLen = validLen === len ? 0 : 4 - validLen % 4;
1066
972
  return [validLen, placeHoldersLen];
1067
973
  }
@@ -1250,16 +1156,14 @@ ieee754.write = function(buffer2, value, offset, isLE, mLen, nBytes) {
1250
1156
  Object.defineProperty(Buffer3.prototype, "parent", {
1251
1157
  enumerable: true,
1252
1158
  get: function() {
1253
- if (!Buffer3.isBuffer(this))
1254
- return void 0;
1159
+ if (!Buffer3.isBuffer(this)) return void 0;
1255
1160
  return this.buffer;
1256
1161
  }
1257
1162
  });
1258
1163
  Object.defineProperty(Buffer3.prototype, "offset", {
1259
1164
  enumerable: true,
1260
1165
  get: function() {
1261
- if (!Buffer3.isBuffer(this))
1262
- return void 0;
1166
+ if (!Buffer3.isBuffer(this)) return void 0;
1263
1167
  return this.byteOffset;
1264
1168
  }
1265
1169
  });
@@ -1311,8 +1215,7 @@ ieee754.write = function(buffer2, value, offset, isLE, mLen, nBytes) {
1311
1215
  return Buffer3.from(valueOf, encodingOrOffset, length);
1312
1216
  }
1313
1217
  var b = fromObject(value);
1314
- if (b)
1315
- return b;
1218
+ if (b) return b;
1316
1219
  if (typeof Symbol !== "undefined" && Symbol.toPrimitive != null && typeof value[Symbol.toPrimitive] === "function") {
1317
1220
  return Buffer3.from(
1318
1221
  value[Symbol.toPrimitive]("string"),
@@ -1443,17 +1346,14 @@ ieee754.write = function(buffer2, value, offset, isLE, mLen, nBytes) {
1443
1346
  return b != null && b._isBuffer === true && b !== Buffer3.prototype;
1444
1347
  };
1445
1348
  Buffer3.compare = function compare(a, b) {
1446
- if (isInstance(a, Uint8Array))
1447
- a = Buffer3.from(a, a.offset, a.byteLength);
1448
- if (isInstance(b, Uint8Array))
1449
- b = Buffer3.from(b, b.offset, b.byteLength);
1349
+ if (isInstance(a, Uint8Array)) a = Buffer3.from(a, a.offset, a.byteLength);
1350
+ if (isInstance(b, Uint8Array)) b = Buffer3.from(b, b.offset, b.byteLength);
1450
1351
  if (!Buffer3.isBuffer(a) || !Buffer3.isBuffer(b)) {
1451
1352
  throw new TypeError(
1452
1353
  'The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array'
1453
1354
  );
1454
1355
  }
1455
- if (a === b)
1456
- return 0;
1356
+ if (a === b) return 0;
1457
1357
  var x = a.length;
1458
1358
  var y = b.length;
1459
1359
  for (var i = 0, len = Math.min(x, y); i < len; ++i) {
@@ -1463,10 +1363,8 @@ ieee754.write = function(buffer2, value, offset, isLE, mLen, nBytes) {
1463
1363
  break;
1464
1364
  }
1465
1365
  }
1466
- if (x < y)
1467
- return -1;
1468
- if (y < x)
1469
- return 1;
1366
+ if (x < y) return -1;
1367
+ if (y < x) return 1;
1470
1368
  return 0;
1471
1369
  };
1472
1370
  Buffer3.isEncoding = function isEncoding(encoding) {
@@ -1538,8 +1436,7 @@ ieee754.write = function(buffer2, value, offset, isLE, mLen, nBytes) {
1538
1436
  }
1539
1437
  var len = string.length;
1540
1438
  var mustMatch = arguments.length > 2 && arguments[2] === true;
1541
- if (!mustMatch && len === 0)
1542
- return 0;
1439
+ if (!mustMatch && len === 0) return 0;
1543
1440
  var loweredCase = false;
1544
1441
  for (; ; ) {
1545
1442
  switch (encoding) {
@@ -1588,8 +1485,7 @@ ieee754.write = function(buffer2, value, offset, isLE, mLen, nBytes) {
1588
1485
  if (end <= start) {
1589
1486
  return "";
1590
1487
  }
1591
- if (!encoding)
1592
- encoding = "utf8";
1488
+ if (!encoding) encoding = "utf8";
1593
1489
  while (true) {
1594
1490
  switch (encoding) {
1595
1491
  case "hex":
@@ -1610,8 +1506,7 @@ ieee754.write = function(buffer2, value, offset, isLE, mLen, nBytes) {
1610
1506
  case "utf-16le":
1611
1507
  return utf16leSlice(this, start, end);
1612
1508
  default:
1613
- if (loweredCase)
1614
- throw new TypeError("Unknown encoding: " + encoding);
1509
+ if (loweredCase) throw new TypeError("Unknown encoding: " + encoding);
1615
1510
  encoding = (encoding + "").toLowerCase();
1616
1511
  loweredCase = true;
1617
1512
  }
@@ -1659,26 +1554,21 @@ ieee754.write = function(buffer2, value, offset, isLE, mLen, nBytes) {
1659
1554
  };
1660
1555
  Buffer3.prototype.toString = function toString() {
1661
1556
  var length = this.length;
1662
- if (length === 0)
1663
- return "";
1664
- if (arguments.length === 0)
1665
- return utf8Slice(this, 0, length);
1557
+ if (length === 0) return "";
1558
+ if (arguments.length === 0) return utf8Slice(this, 0, length);
1666
1559
  return slowToString.apply(this, arguments);
1667
1560
  };
1668
1561
  Buffer3.prototype.toLocaleString = Buffer3.prototype.toString;
1669
1562
  Buffer3.prototype.equals = function equals(b) {
1670
- if (!Buffer3.isBuffer(b))
1671
- throw new TypeError("Argument must be a Buffer");
1672
- if (this === b)
1673
- return true;
1563
+ if (!Buffer3.isBuffer(b)) throw new TypeError("Argument must be a Buffer");
1564
+ if (this === b) return true;
1674
1565
  return Buffer3.compare(this, b) === 0;
1675
1566
  };
1676
1567
  Buffer3.prototype.inspect = function inspect() {
1677
1568
  var str = "";
1678
1569
  var max = exports2.INSPECT_MAX_BYTES;
1679
1570
  str = this.toString("hex", 0, max).replace(/(.{2})/g, "$1 ").trim();
1680
- if (this.length > max)
1681
- str += " ... ";
1571
+ if (this.length > max) str += " ... ";
1682
1572
  return "<Buffer " + str + ">";
1683
1573
  };
1684
1574
  if (customInspectSymbol) {
@@ -1721,8 +1611,7 @@ ieee754.write = function(buffer2, value, offset, isLE, mLen, nBytes) {
1721
1611
  end >>>= 0;
1722
1612
  thisStart >>>= 0;
1723
1613
  thisEnd >>>= 0;
1724
- if (this === target)
1725
- return 0;
1614
+ if (this === target) return 0;
1726
1615
  var x = thisEnd - thisStart;
1727
1616
  var y = end - start;
1728
1617
  var len = Math.min(x, y);
@@ -1735,15 +1624,12 @@ ieee754.write = function(buffer2, value, offset, isLE, mLen, nBytes) {
1735
1624
  break;
1736
1625
  }
1737
1626
  }
1738
- if (x < y)
1739
- return -1;
1740
- if (y < x)
1741
- return 1;
1627
+ if (x < y) return -1;
1628
+ if (y < x) return 1;
1742
1629
  return 0;
1743
1630
  };
1744
1631
  function bidirectionalIndexOf(buffer2, val, byteOffset, encoding, dir) {
1745
- if (buffer2.length === 0)
1746
- return -1;
1632
+ if (buffer2.length === 0) return -1;
1747
1633
  if (typeof byteOffset === "string") {
1748
1634
  encoding = byteOffset;
1749
1635
  byteOffset = 0;
@@ -1756,18 +1642,13 @@ ieee754.write = function(buffer2, value, offset, isLE, mLen, nBytes) {
1756
1642
  if (numberIsNaN(byteOffset)) {
1757
1643
  byteOffset = dir ? 0 : buffer2.length - 1;
1758
1644
  }
1759
- if (byteOffset < 0)
1760
- byteOffset = buffer2.length + byteOffset;
1645
+ if (byteOffset < 0) byteOffset = buffer2.length + byteOffset;
1761
1646
  if (byteOffset >= buffer2.length) {
1762
- if (dir)
1763
- return -1;
1764
- else
1765
- byteOffset = buffer2.length - 1;
1647
+ if (dir) return -1;
1648
+ else byteOffset = buffer2.length - 1;
1766
1649
  } else if (byteOffset < 0) {
1767
- if (dir)
1768
- byteOffset = 0;
1769
- else
1770
- return -1;
1650
+ if (dir) byteOffset = 0;
1651
+ else return -1;
1771
1652
  }
1772
1653
  if (typeof val === "string") {
1773
1654
  val = Buffer3.from(val, encoding);
@@ -1818,19 +1699,15 @@ ieee754.write = function(buffer2, value, offset, isLE, mLen, nBytes) {
1818
1699
  var foundIndex = -1;
1819
1700
  for (i = byteOffset; i < arrLength; i++) {
1820
1701
  if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
1821
- if (foundIndex === -1)
1822
- foundIndex = i;
1823
- if (i - foundIndex + 1 === valLength)
1824
- return foundIndex * indexSize;
1702
+ if (foundIndex === -1) foundIndex = i;
1703
+ if (i - foundIndex + 1 === valLength) return foundIndex * indexSize;
1825
1704
  } else {
1826
- if (foundIndex !== -1)
1827
- i -= i - foundIndex;
1705
+ if (foundIndex !== -1) i -= i - foundIndex;
1828
1706
  foundIndex = -1;
1829
1707
  }
1830
1708
  }
1831
1709
  } else {
1832
- if (byteOffset + valLength > arrLength)
1833
- byteOffset = arrLength - valLength;
1710
+ if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength;
1834
1711
  for (i = byteOffset; i >= 0; i--) {
1835
1712
  var found = true;
1836
1713
  for (var j = 0; j < valLength; j++) {
@@ -1839,8 +1716,7 @@ ieee754.write = function(buffer2, value, offset, isLE, mLen, nBytes) {
1839
1716
  break;
1840
1717
  }
1841
1718
  }
1842
- if (found)
1843
- return i;
1719
+ if (found) return i;
1844
1720
  }
1845
1721
  }
1846
1722
  return -1;
@@ -1871,8 +1747,7 @@ ieee754.write = function(buffer2, value, offset, isLE, mLen, nBytes) {
1871
1747
  }
1872
1748
  for (var i = 0; i < length; ++i) {
1873
1749
  var parsed = parseInt(string.substr(i * 2, 2), 16);
1874
- if (numberIsNaN(parsed))
1875
- return i;
1750
+ if (numberIsNaN(parsed)) return i;
1876
1751
  buf[offset + i] = parsed;
1877
1752
  }
1878
1753
  return i;
@@ -1902,8 +1777,7 @@ ieee754.write = function(buffer2, value, offset, isLE, mLen, nBytes) {
1902
1777
  offset = offset >>> 0;
1903
1778
  if (isFinite(length)) {
1904
1779
  length = length >>> 0;
1905
- if (encoding === void 0)
1906
- encoding = "utf8";
1780
+ if (encoding === void 0) encoding = "utf8";
1907
1781
  } else {
1908
1782
  encoding = length;
1909
1783
  length = void 0;
@@ -1914,13 +1788,11 @@ ieee754.write = function(buffer2, value, offset, isLE, mLen, nBytes) {
1914
1788
  );
1915
1789
  }
1916
1790
  var remaining = this.length - offset;
1917
- if (length === void 0 || length > remaining)
1918
- length = remaining;
1791
+ if (length === void 0 || length > remaining) length = remaining;
1919
1792
  if (string.length > 0 && (length < 0 || offset < 0) || offset > this.length) {
1920
1793
  throw new RangeError("Attempt to write outside buffer bounds");
1921
1794
  }
1922
- if (!encoding)
1923
- encoding = "utf8";
1795
+ if (!encoding) encoding = "utf8";
1924
1796
  var loweredCase = false;
1925
1797
  for (; ; ) {
1926
1798
  switch (encoding) {
@@ -1941,8 +1813,7 @@ ieee754.write = function(buffer2, value, offset, isLE, mLen, nBytes) {
1941
1813
  case "utf-16le":
1942
1814
  return ucs2Write(this, string, offset, length);
1943
1815
  default:
1944
- if (loweredCase)
1945
- throw new TypeError("Unknown encoding: " + encoding);
1816
+ if (loweredCase) throw new TypeError("Unknown encoding: " + encoding);
1946
1817
  encoding = ("" + encoding).toLowerCase();
1947
1818
  loweredCase = true;
1948
1819
  }
@@ -2055,10 +1926,8 @@ ieee754.write = function(buffer2, value, offset, isLE, mLen, nBytes) {
2055
1926
  }
2056
1927
  function hexSlice(buf, start, end) {
2057
1928
  var len = buf.length;
2058
- if (!start || start < 0)
2059
- start = 0;
2060
- if (!end || end < 0 || end > len)
2061
- end = len;
1929
+ if (!start || start < 0) start = 0;
1930
+ if (!end || end < 0 || end > len) end = len;
2062
1931
  var out = "";
2063
1932
  for (var i = start; i < end; ++i) {
2064
1933
  out += hexSliceLookupTable[buf[i]];
@@ -2079,35 +1948,29 @@ ieee754.write = function(buffer2, value, offset, isLE, mLen, nBytes) {
2079
1948
  end = end === void 0 ? len : ~~end;
2080
1949
  if (start < 0) {
2081
1950
  start += len;
2082
- if (start < 0)
2083
- start = 0;
1951
+ if (start < 0) start = 0;
2084
1952
  } else if (start > len) {
2085
1953
  start = len;
2086
1954
  }
2087
1955
  if (end < 0) {
2088
1956
  end += len;
2089
- if (end < 0)
2090
- end = 0;
1957
+ if (end < 0) end = 0;
2091
1958
  } else if (end > len) {
2092
1959
  end = len;
2093
1960
  }
2094
- if (end < start)
2095
- end = start;
1961
+ if (end < start) end = start;
2096
1962
  var newBuf = this.subarray(start, end);
2097
1963
  Object.setPrototypeOf(newBuf, Buffer3.prototype);
2098
1964
  return newBuf;
2099
1965
  };
2100
1966
  function checkOffset(offset, ext, length) {
2101
- if (offset % 1 !== 0 || offset < 0)
2102
- throw new RangeError("offset is not uint");
2103
- if (offset + ext > length)
2104
- throw new RangeError("Trying to access beyond buffer length");
1967
+ if (offset % 1 !== 0 || offset < 0) throw new RangeError("offset is not uint");
1968
+ if (offset + ext > length) throw new RangeError("Trying to access beyond buffer length");
2105
1969
  }
2106
1970
  Buffer3.prototype.readUintLE = Buffer3.prototype.readUIntLE = function readUIntLE(offset, byteLength3, noAssert) {
2107
1971
  offset = offset >>> 0;
2108
1972
  byteLength3 = byteLength3 >>> 0;
2109
- if (!noAssert)
2110
- checkOffset(offset, byteLength3, this.length);
1973
+ if (!noAssert) checkOffset(offset, byteLength3, this.length);
2111
1974
  var val = this[offset];
2112
1975
  var mul = 1;
2113
1976
  var i = 0;
@@ -2131,39 +1994,33 @@ ieee754.write = function(buffer2, value, offset, isLE, mLen, nBytes) {
2131
1994
  };
2132
1995
  Buffer3.prototype.readUint8 = Buffer3.prototype.readUInt8 = function readUInt8(offset, noAssert) {
2133
1996
  offset = offset >>> 0;
2134
- if (!noAssert)
2135
- checkOffset(offset, 1, this.length);
1997
+ if (!noAssert) checkOffset(offset, 1, this.length);
2136
1998
  return this[offset];
2137
1999
  };
2138
2000
  Buffer3.prototype.readUint16LE = Buffer3.prototype.readUInt16LE = function readUInt16LE(offset, noAssert) {
2139
2001
  offset = offset >>> 0;
2140
- if (!noAssert)
2141
- checkOffset(offset, 2, this.length);
2002
+ if (!noAssert) checkOffset(offset, 2, this.length);
2142
2003
  return this[offset] | this[offset + 1] << 8;
2143
2004
  };
2144
2005
  Buffer3.prototype.readUint16BE = Buffer3.prototype.readUInt16BE = function readUInt16BE(offset, noAssert) {
2145
2006
  offset = offset >>> 0;
2146
- if (!noAssert)
2147
- checkOffset(offset, 2, this.length);
2007
+ if (!noAssert) checkOffset(offset, 2, this.length);
2148
2008
  return this[offset] << 8 | this[offset + 1];
2149
2009
  };
2150
2010
  Buffer3.prototype.readUint32LE = Buffer3.prototype.readUInt32LE = function readUInt32LE(offset, noAssert) {
2151
2011
  offset = offset >>> 0;
2152
- if (!noAssert)
2153
- checkOffset(offset, 4, this.length);
2012
+ if (!noAssert) checkOffset(offset, 4, this.length);
2154
2013
  return (this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16) + this[offset + 3] * 16777216;
2155
2014
  };
2156
2015
  Buffer3.prototype.readUint32BE = Buffer3.prototype.readUInt32BE = function readUInt32BE(offset, noAssert) {
2157
2016
  offset = offset >>> 0;
2158
- if (!noAssert)
2159
- checkOffset(offset, 4, this.length);
2017
+ if (!noAssert) checkOffset(offset, 4, this.length);
2160
2018
  return this[offset] * 16777216 + (this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3]);
2161
2019
  };
2162
2020
  Buffer3.prototype.readIntLE = function readIntLE(offset, byteLength3, noAssert) {
2163
2021
  offset = offset >>> 0;
2164
2022
  byteLength3 = byteLength3 >>> 0;
2165
- if (!noAssert)
2166
- checkOffset(offset, byteLength3, this.length);
2023
+ if (!noAssert) checkOffset(offset, byteLength3, this.length);
2167
2024
  var val = this[offset];
2168
2025
  var mul = 1;
2169
2026
  var i = 0;
@@ -2171,15 +2028,13 @@ ieee754.write = function(buffer2, value, offset, isLE, mLen, nBytes) {
2171
2028
  val += this[offset + i] * mul;
2172
2029
  }
2173
2030
  mul *= 128;
2174
- if (val >= mul)
2175
- val -= Math.pow(2, 8 * byteLength3);
2031
+ if (val >= mul) val -= Math.pow(2, 8 * byteLength3);
2176
2032
  return val;
2177
2033
  };
2178
2034
  Buffer3.prototype.readIntBE = function readIntBE(offset, byteLength3, noAssert) {
2179
2035
  offset = offset >>> 0;
2180
2036
  byteLength3 = byteLength3 >>> 0;
2181
- if (!noAssert)
2182
- checkOffset(offset, byteLength3, this.length);
2037
+ if (!noAssert) checkOffset(offset, byteLength3, this.length);
2183
2038
  var i = byteLength3;
2184
2039
  var mul = 1;
2185
2040
  var val = this[offset + --i];
@@ -2187,75 +2042,61 @@ ieee754.write = function(buffer2, value, offset, isLE, mLen, nBytes) {
2187
2042
  val += this[offset + --i] * mul;
2188
2043
  }
2189
2044
  mul *= 128;
2190
- if (val >= mul)
2191
- val -= Math.pow(2, 8 * byteLength3);
2045
+ if (val >= mul) val -= Math.pow(2, 8 * byteLength3);
2192
2046
  return val;
2193
2047
  };
2194
2048
  Buffer3.prototype.readInt8 = function readInt8(offset, noAssert) {
2195
2049
  offset = offset >>> 0;
2196
- if (!noAssert)
2197
- checkOffset(offset, 1, this.length);
2198
- if (!(this[offset] & 128))
2199
- return this[offset];
2050
+ if (!noAssert) checkOffset(offset, 1, this.length);
2051
+ if (!(this[offset] & 128)) return this[offset];
2200
2052
  return (255 - this[offset] + 1) * -1;
2201
2053
  };
2202
2054
  Buffer3.prototype.readInt16LE = function readInt16LE(offset, noAssert) {
2203
2055
  offset = offset >>> 0;
2204
- if (!noAssert)
2205
- checkOffset(offset, 2, this.length);
2056
+ if (!noAssert) checkOffset(offset, 2, this.length);
2206
2057
  var val = this[offset] | this[offset + 1] << 8;
2207
2058
  return val & 32768 ? val | 4294901760 : val;
2208
2059
  };
2209
2060
  Buffer3.prototype.readInt16BE = function readInt16BE(offset, noAssert) {
2210
2061
  offset = offset >>> 0;
2211
- if (!noAssert)
2212
- checkOffset(offset, 2, this.length);
2062
+ if (!noAssert) checkOffset(offset, 2, this.length);
2213
2063
  var val = this[offset + 1] | this[offset] << 8;
2214
2064
  return val & 32768 ? val | 4294901760 : val;
2215
2065
  };
2216
2066
  Buffer3.prototype.readInt32LE = function readInt32LE(offset, noAssert) {
2217
2067
  offset = offset >>> 0;
2218
- if (!noAssert)
2219
- checkOffset(offset, 4, this.length);
2068
+ if (!noAssert) checkOffset(offset, 4, this.length);
2220
2069
  return this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16 | this[offset + 3] << 24;
2221
2070
  };
2222
2071
  Buffer3.prototype.readInt32BE = function readInt32BE(offset, noAssert) {
2223
2072
  offset = offset >>> 0;
2224
- if (!noAssert)
2225
- checkOffset(offset, 4, this.length);
2073
+ if (!noAssert) checkOffset(offset, 4, this.length);
2226
2074
  return this[offset] << 24 | this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3];
2227
2075
  };
2228
2076
  Buffer3.prototype.readFloatLE = function readFloatLE(offset, noAssert) {
2229
2077
  offset = offset >>> 0;
2230
- if (!noAssert)
2231
- checkOffset(offset, 4, this.length);
2078
+ if (!noAssert) checkOffset(offset, 4, this.length);
2232
2079
  return ieee754$1.read(this, offset, true, 23, 4);
2233
2080
  };
2234
2081
  Buffer3.prototype.readFloatBE = function readFloatBE(offset, noAssert) {
2235
2082
  offset = offset >>> 0;
2236
- if (!noAssert)
2237
- checkOffset(offset, 4, this.length);
2083
+ if (!noAssert) checkOffset(offset, 4, this.length);
2238
2084
  return ieee754$1.read(this, offset, false, 23, 4);
2239
2085
  };
2240
2086
  Buffer3.prototype.readDoubleLE = function readDoubleLE(offset, noAssert) {
2241
2087
  offset = offset >>> 0;
2242
- if (!noAssert)
2243
- checkOffset(offset, 8, this.length);
2088
+ if (!noAssert) checkOffset(offset, 8, this.length);
2244
2089
  return ieee754$1.read(this, offset, true, 52, 8);
2245
2090
  };
2246
2091
  Buffer3.prototype.readDoubleBE = function readDoubleBE(offset, noAssert) {
2247
2092
  offset = offset >>> 0;
2248
- if (!noAssert)
2249
- checkOffset(offset, 8, this.length);
2093
+ if (!noAssert) checkOffset(offset, 8, this.length);
2250
2094
  return ieee754$1.read(this, offset, false, 52, 8);
2251
2095
  };
2252
2096
  function checkInt(buf, value, offset, ext, max, min) {
2253
- if (!Buffer3.isBuffer(buf))
2254
- throw new TypeError('"buffer" argument must be a Buffer instance');
2255
- if (value > max || value < min)
2256
- throw new RangeError('"value" argument is out of bounds');
2257
- if (offset + ext > buf.length)
2258
- throw new RangeError("Index out of range");
2097
+ if (!Buffer3.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance');
2098
+ if (value > max || value < min) throw new RangeError('"value" argument is out of bounds');
2099
+ if (offset + ext > buf.length) throw new RangeError("Index out of range");
2259
2100
  }
2260
2101
  Buffer3.prototype.writeUintLE = Buffer3.prototype.writeUIntLE = function writeUIntLE(value, offset, byteLength3, noAssert) {
2261
2102
  value = +value;
@@ -2292,16 +2133,14 @@ ieee754.write = function(buffer2, value, offset, isLE, mLen, nBytes) {
2292
2133
  Buffer3.prototype.writeUint8 = Buffer3.prototype.writeUInt8 = function writeUInt8(value, offset, noAssert) {
2293
2134
  value = +value;
2294
2135
  offset = offset >>> 0;
2295
- if (!noAssert)
2296
- checkInt(this, value, offset, 1, 255, 0);
2136
+ if (!noAssert) checkInt(this, value, offset, 1, 255, 0);
2297
2137
  this[offset] = value & 255;
2298
2138
  return offset + 1;
2299
2139
  };
2300
2140
  Buffer3.prototype.writeUint16LE = Buffer3.prototype.writeUInt16LE = function writeUInt16LE(value, offset, noAssert) {
2301
2141
  value = +value;
2302
2142
  offset = offset >>> 0;
2303
- if (!noAssert)
2304
- checkInt(this, value, offset, 2, 65535, 0);
2143
+ if (!noAssert) checkInt(this, value, offset, 2, 65535, 0);
2305
2144
  this[offset] = value & 255;
2306
2145
  this[offset + 1] = value >>> 8;
2307
2146
  return offset + 2;
@@ -2309,8 +2148,7 @@ ieee754.write = function(buffer2, value, offset, isLE, mLen, nBytes) {
2309
2148
  Buffer3.prototype.writeUint16BE = Buffer3.prototype.writeUInt16BE = function writeUInt16BE(value, offset, noAssert) {
2310
2149
  value = +value;
2311
2150
  offset = offset >>> 0;
2312
- if (!noAssert)
2313
- checkInt(this, value, offset, 2, 65535, 0);
2151
+ if (!noAssert) checkInt(this, value, offset, 2, 65535, 0);
2314
2152
  this[offset] = value >>> 8;
2315
2153
  this[offset + 1] = value & 255;
2316
2154
  return offset + 2;
@@ -2318,8 +2156,7 @@ ieee754.write = function(buffer2, value, offset, isLE, mLen, nBytes) {
2318
2156
  Buffer3.prototype.writeUint32LE = Buffer3.prototype.writeUInt32LE = function writeUInt32LE(value, offset, noAssert) {
2319
2157
  value = +value;
2320
2158
  offset = offset >>> 0;
2321
- if (!noAssert)
2322
- checkInt(this, value, offset, 4, 4294967295, 0);
2159
+ if (!noAssert) checkInt(this, value, offset, 4, 4294967295, 0);
2323
2160
  this[offset + 3] = value >>> 24;
2324
2161
  this[offset + 2] = value >>> 16;
2325
2162
  this[offset + 1] = value >>> 8;
@@ -2329,8 +2166,7 @@ ieee754.write = function(buffer2, value, offset, isLE, mLen, nBytes) {
2329
2166
  Buffer3.prototype.writeUint32BE = Buffer3.prototype.writeUInt32BE = function writeUInt32BE(value, offset, noAssert) {
2330
2167
  value = +value;
2331
2168
  offset = offset >>> 0;
2332
- if (!noAssert)
2333
- checkInt(this, value, offset, 4, 4294967295, 0);
2169
+ if (!noAssert) checkInt(this, value, offset, 4, 4294967295, 0);
2334
2170
  this[offset] = value >>> 24;
2335
2171
  this[offset + 1] = value >>> 16;
2336
2172
  this[offset + 2] = value >>> 8;
@@ -2378,18 +2214,15 @@ ieee754.write = function(buffer2, value, offset, isLE, mLen, nBytes) {
2378
2214
  Buffer3.prototype.writeInt8 = function writeInt8(value, offset, noAssert) {
2379
2215
  value = +value;
2380
2216
  offset = offset >>> 0;
2381
- if (!noAssert)
2382
- checkInt(this, value, offset, 1, 127, -128);
2383
- if (value < 0)
2384
- value = 255 + value + 1;
2217
+ if (!noAssert) checkInt(this, value, offset, 1, 127, -128);
2218
+ if (value < 0) value = 255 + value + 1;
2385
2219
  this[offset] = value & 255;
2386
2220
  return offset + 1;
2387
2221
  };
2388
2222
  Buffer3.prototype.writeInt16LE = function writeInt16LE(value, offset, noAssert) {
2389
2223
  value = +value;
2390
2224
  offset = offset >>> 0;
2391
- if (!noAssert)
2392
- checkInt(this, value, offset, 2, 32767, -32768);
2225
+ if (!noAssert) checkInt(this, value, offset, 2, 32767, -32768);
2393
2226
  this[offset] = value & 255;
2394
2227
  this[offset + 1] = value >>> 8;
2395
2228
  return offset + 2;
@@ -2397,8 +2230,7 @@ ieee754.write = function(buffer2, value, offset, isLE, mLen, nBytes) {
2397
2230
  Buffer3.prototype.writeInt16BE = function writeInt16BE(value, offset, noAssert) {
2398
2231
  value = +value;
2399
2232
  offset = offset >>> 0;
2400
- if (!noAssert)
2401
- checkInt(this, value, offset, 2, 32767, -32768);
2233
+ if (!noAssert) checkInt(this, value, offset, 2, 32767, -32768);
2402
2234
  this[offset] = value >>> 8;
2403
2235
  this[offset + 1] = value & 255;
2404
2236
  return offset + 2;
@@ -2406,8 +2238,7 @@ ieee754.write = function(buffer2, value, offset, isLE, mLen, nBytes) {
2406
2238
  Buffer3.prototype.writeInt32LE = function writeInt32LE(value, offset, noAssert) {
2407
2239
  value = +value;
2408
2240
  offset = offset >>> 0;
2409
- if (!noAssert)
2410
- checkInt(this, value, offset, 4, 2147483647, -2147483648);
2241
+ if (!noAssert) checkInt(this, value, offset, 4, 2147483647, -2147483648);
2411
2242
  this[offset] = value & 255;
2412
2243
  this[offset + 1] = value >>> 8;
2413
2244
  this[offset + 2] = value >>> 16;
@@ -2417,10 +2248,8 @@ ieee754.write = function(buffer2, value, offset, isLE, mLen, nBytes) {
2417
2248
  Buffer3.prototype.writeInt32BE = function writeInt32BE(value, offset, noAssert) {
2418
2249
  value = +value;
2419
2250
  offset = offset >>> 0;
2420
- if (!noAssert)
2421
- checkInt(this, value, offset, 4, 2147483647, -2147483648);
2422
- if (value < 0)
2423
- value = 4294967295 + value + 1;
2251
+ if (!noAssert) checkInt(this, value, offset, 4, 2147483647, -2147483648);
2252
+ if (value < 0) value = 4294967295 + value + 1;
2424
2253
  this[offset] = value >>> 24;
2425
2254
  this[offset + 1] = value >>> 16;
2426
2255
  this[offset + 2] = value >>> 8;
@@ -2428,10 +2257,8 @@ ieee754.write = function(buffer2, value, offset, isLE, mLen, nBytes) {
2428
2257
  return offset + 4;
2429
2258
  };
2430
2259
  function checkIEEE754(buf, value, offset, ext, max, min) {
2431
- if (offset + ext > buf.length)
2432
- throw new RangeError("Index out of range");
2433
- if (offset < 0)
2434
- throw new RangeError("Index out of range");
2260
+ if (offset + ext > buf.length) throw new RangeError("Index out of range");
2261
+ if (offset < 0) throw new RangeError("Index out of range");
2435
2262
  }
2436
2263
  function writeFloat(buf, value, offset, littleEndian, noAssert) {
2437
2264
  value = +value;
@@ -2464,31 +2291,20 @@ ieee754.write = function(buffer2, value, offset, isLE, mLen, nBytes) {
2464
2291
  return writeDouble(this, value, offset, false, noAssert);
2465
2292
  };
2466
2293
  Buffer3.prototype.copy = function copy(target, targetStart, start, end) {
2467
- if (!Buffer3.isBuffer(target))
2468
- throw new TypeError("argument should be a Buffer");
2469
- if (!start)
2470
- start = 0;
2471
- if (!end && end !== 0)
2472
- end = this.length;
2473
- if (targetStart >= target.length)
2474
- targetStart = target.length;
2475
- if (!targetStart)
2476
- targetStart = 0;
2477
- if (end > 0 && end < start)
2478
- end = start;
2479
- if (end === start)
2480
- return 0;
2481
- if (target.length === 0 || this.length === 0)
2482
- return 0;
2294
+ if (!Buffer3.isBuffer(target)) throw new TypeError("argument should be a Buffer");
2295
+ if (!start) start = 0;
2296
+ if (!end && end !== 0) end = this.length;
2297
+ if (targetStart >= target.length) targetStart = target.length;
2298
+ if (!targetStart) targetStart = 0;
2299
+ if (end > 0 && end < start) end = start;
2300
+ if (end === start) return 0;
2301
+ if (target.length === 0 || this.length === 0) return 0;
2483
2302
  if (targetStart < 0) {
2484
2303
  throw new RangeError("targetStart out of bounds");
2485
2304
  }
2486
- if (start < 0 || start >= this.length)
2487
- throw new RangeError("Index out of range");
2488
- if (end < 0)
2489
- throw new RangeError("sourceEnd out of bounds");
2490
- if (end > this.length)
2491
- end = this.length;
2305
+ if (start < 0 || start >= this.length) throw new RangeError("Index out of range");
2306
+ if (end < 0) throw new RangeError("sourceEnd out of bounds");
2307
+ if (end > this.length) end = this.length;
2492
2308
  if (target.length - targetStart < end - start) {
2493
2309
  end = target.length - targetStart + start;
2494
2310
  }
@@ -2539,8 +2355,7 @@ ieee754.write = function(buffer2, value, offset, isLE, mLen, nBytes) {
2539
2355
  }
2540
2356
  start = start >>> 0;
2541
2357
  end = end === void 0 ? this.length : end >>> 0;
2542
- if (!val)
2543
- val = 0;
2358
+ if (!val) val = 0;
2544
2359
  var i;
2545
2360
  if (typeof val === "number") {
2546
2361
  for (i = start; i < end; ++i) {
@@ -2562,8 +2377,7 @@ ieee754.write = function(buffer2, value, offset, isLE, mLen, nBytes) {
2562
2377
  function base64clean(str) {
2563
2378
  str = str.split("=")[0];
2564
2379
  str = str.trim().replace(INVALID_BASE64_RE, "");
2565
- if (str.length < 2)
2566
- return "";
2380
+ if (str.length < 2) return "";
2567
2381
  while (str.length % 4 !== 0) {
2568
2382
  str = str + "=";
2569
2383
  }
@@ -2580,51 +2394,43 @@ ieee754.write = function(buffer2, value, offset, isLE, mLen, nBytes) {
2580
2394
  if (codePoint > 55295 && codePoint < 57344) {
2581
2395
  if (!leadSurrogate) {
2582
2396
  if (codePoint > 56319) {
2583
- if ((units -= 3) > -1)
2584
- bytes.push(239, 191, 189);
2397
+ if ((units -= 3) > -1) bytes.push(239, 191, 189);
2585
2398
  continue;
2586
2399
  } else if (i + 1 === length) {
2587
- if ((units -= 3) > -1)
2588
- bytes.push(239, 191, 189);
2400
+ if ((units -= 3) > -1) bytes.push(239, 191, 189);
2589
2401
  continue;
2590
2402
  }
2591
2403
  leadSurrogate = codePoint;
2592
2404
  continue;
2593
2405
  }
2594
2406
  if (codePoint < 56320) {
2595
- if ((units -= 3) > -1)
2596
- bytes.push(239, 191, 189);
2407
+ if ((units -= 3) > -1) bytes.push(239, 191, 189);
2597
2408
  leadSurrogate = codePoint;
2598
2409
  continue;
2599
2410
  }
2600
2411
  codePoint = (leadSurrogate - 55296 << 10 | codePoint - 56320) + 65536;
2601
2412
  } else if (leadSurrogate) {
2602
- if ((units -= 3) > -1)
2603
- bytes.push(239, 191, 189);
2413
+ if ((units -= 3) > -1) bytes.push(239, 191, 189);
2604
2414
  }
2605
2415
  leadSurrogate = null;
2606
2416
  if (codePoint < 128) {
2607
- if ((units -= 1) < 0)
2608
- break;
2417
+ if ((units -= 1) < 0) break;
2609
2418
  bytes.push(codePoint);
2610
2419
  } else if (codePoint < 2048) {
2611
- if ((units -= 2) < 0)
2612
- break;
2420
+ if ((units -= 2) < 0) break;
2613
2421
  bytes.push(
2614
2422
  codePoint >> 6 | 192,
2615
2423
  codePoint & 63 | 128
2616
2424
  );
2617
2425
  } else if (codePoint < 65536) {
2618
- if ((units -= 3) < 0)
2619
- break;
2426
+ if ((units -= 3) < 0) break;
2620
2427
  bytes.push(
2621
2428
  codePoint >> 12 | 224,
2622
2429
  codePoint >> 6 & 63 | 128,
2623
2430
  codePoint & 63 | 128
2624
2431
  );
2625
2432
  } else if (codePoint < 1114112) {
2626
- if ((units -= 4) < 0)
2627
- break;
2433
+ if ((units -= 4) < 0) break;
2628
2434
  bytes.push(
2629
2435
  codePoint >> 18 | 240,
2630
2436
  codePoint >> 12 & 63 | 128,
@@ -2648,8 +2454,7 @@ ieee754.write = function(buffer2, value, offset, isLE, mLen, nBytes) {
2648
2454
  var c, hi, lo;
2649
2455
  var byteArray = [];
2650
2456
  for (var i = 0; i < str.length; ++i) {
2651
- if ((units -= 2) < 0)
2652
- break;
2457
+ if ((units -= 2) < 0) break;
2653
2458
  c = str.charCodeAt(i);
2654
2459
  hi = c >> 8;
2655
2460
  lo = c % 256;
@@ -2663,8 +2468,7 @@ ieee754.write = function(buffer2, value, offset, isLE, mLen, nBytes) {
2663
2468
  }
2664
2469
  function blitBuffer(src, dst, offset, length) {
2665
2470
  for (var i = 0; i < length; ++i) {
2666
- if (i + offset >= dst.length || i >= src.length)
2667
- break;
2471
+ if (i + offset >= dst.length || i >= src.length) break;
2668
2472
  dst[i + offset] = src[i];
2669
2473
  }
2670
2474
  return i;
@@ -2833,10 +2637,8 @@ function rotl30(num) {
2833
2637
  return num << 30 | num >>> 2;
2834
2638
  }
2835
2639
  function ft(s, b, c, d) {
2836
- if (s === 0)
2837
- return b & c | ~b & d;
2838
- if (s === 2)
2839
- return b & c | b & d | c & d;
2640
+ if (s === 0) return b & c | ~b & d;
2641
+ if (s === 2) return b & c | b & d | c & d;
2840
2642
  return b ^ c ^ d;
2841
2643
  }
2842
2644
  Sha1.prototype._update = function(M) {
@@ -2846,10 +2648,8 @@ Sha1.prototype._update = function(M) {
2846
2648
  var c = this._c | 0;
2847
2649
  var d = this._d | 0;
2848
2650
  var e = this._e | 0;
2849
- for (var i = 0; i < 16; ++i)
2850
- W2[i] = M.readInt32BE(i * 4);
2851
- for (; i < 80; ++i)
2852
- W2[i] = rotl1(W2[i - 3] ^ W2[i - 8] ^ W2[i - 14] ^ W2[i - 16]);
2651
+ for (var i = 0; i < 16; ++i) W2[i] = M.readInt32BE(i * 4);
2652
+ for (; i < 80; ++i) W2[i] = rotl1(W2[i - 3] ^ W2[i - 8] ^ W2[i - 14] ^ W2[i - 16]);
2853
2653
  for (var j = 0; j < 80; ++j) {
2854
2654
  var s = ~~(j / 20);
2855
2655
  var t = rotl5(a) + ft(s, b, c, d) + e + W2[j] + K$1[s] | 0;
@@ -2991,10 +2791,8 @@ Sha256.prototype._update = function(M) {
2991
2791
  var f = this._f | 0;
2992
2792
  var g = this._g | 0;
2993
2793
  var h = this._h | 0;
2994
- for (var i = 0; i < 16; ++i)
2995
- W2[i] = M.readInt32BE(i * 4);
2996
- for (; i < 64; ++i)
2997
- W2[i] = gamma1(W2[i - 2]) + W2[i - 7] + gamma0(W2[i - 15]) + W2[i - 16] | 0;
2794
+ for (var i = 0; i < 16; ++i) W2[i] = M.readInt32BE(i * 4);
2795
+ for (; i < 64; ++i) W2[i] = gamma1(W2[i - 2]) + W2[i - 7] + gamma0(W2[i - 15]) + W2[i - 16] | 0;
2998
2796
  for (var j = 0; j < 64; ++j) {
2999
2797
  var T1 = h + sigma1(e) + ch(e, f, g) + K[j] + W2[j] | 0;
3000
2798
  var T2 = sigma0(a) + maj(a, b, c) | 0;
@@ -3049,12 +2847,190 @@ const hashAlgorithms = {
3049
2847
  };
3050
2848
  const hash = (data, algorithm = "sha1") => {
3051
2849
  if (!["sha1", "sha256"].includes(algorithm)) {
3052
- throw new Error("Hashing algorithm not supported: Available: sha1, sha256");
2850
+ throw new Error(
2851
+ "Hashing algorithm not supported: Available: sha1, sha256"
2852
+ );
3053
2853
  }
3054
2854
  const Algorithm = hashAlgorithms[algorithm];
3055
2855
  const sha = new Algorithm();
3056
2856
  return sha.update(data).digest("base64");
3057
2857
  };
2858
+ function getUnixTimestamp(date) {
2859
+ return (new Date(date).getTime() / 1e3).toFixed(0);
2860
+ }
2861
+ function buildOperationSignatureParams({
2862
+ documentId,
2863
+ signer,
2864
+ operation,
2865
+ previousStateHash
2866
+ }) {
2867
+ const { timestamp, scope, id, type } = operation;
2868
+ return [
2869
+ getUnixTimestamp(timestamp),
2870
+ // timestamp,
2871
+ signer.app.key,
2872
+ // signer public key
2873
+ hash(
2874
+ // hash (docID, scope, operationID, operationName, operationInput)
2875
+ [documentId, scope, id, type, cjsModule(operation.input)].join(
2876
+ ""
2877
+ )
2878
+ ),
2879
+ previousStateHash
2880
+ // state hash that the operation was applied to
2881
+ ];
2882
+ }
2883
+ const textEncode = new TextEncoder();
2884
+ function buildOperationSignatureMessage(params) {
2885
+ const message = params.join("");
2886
+ const prefix = "Signed Operation:\n" + message.length.toString();
2887
+ return textEncode.encode(prefix + message);
2888
+ }
2889
+ function ab2hex(ab) {
2890
+ return Array.prototype.map.call(
2891
+ new Uint8Array(ab),
2892
+ (x) => ("00" + x.toString(16)).slice(-2)
2893
+ ).join("");
2894
+ }
2895
+ function hex2ab(hex) {
2896
+ var _a;
2897
+ return new Uint8Array(
2898
+ ((_a = hex.match(/[\da-f]{2}/gi)) == null ? void 0 : _a.map(function(h) {
2899
+ return parseInt(h, 16);
2900
+ })) ?? []
2901
+ );
2902
+ }
2903
+ async function buildOperationSignature(context, signMethod) {
2904
+ const params = buildOperationSignatureParams(context);
2905
+ const message = buildOperationSignatureMessage(params);
2906
+ const signature = await signMethod(message);
2907
+ return [...params, `0x${ab2hex(signature)}`];
2908
+ }
2909
+ async function buildSignedOperation(action, reducer, document, context, signHandler) {
2910
+ var _a, _b;
2911
+ const result = reducer(document, action, void 0, {
2912
+ reuseHash: true,
2913
+ reuseOperationResultingState: true
2914
+ });
2915
+ const operation = result.operations[action.scope].at(-1);
2916
+ if (!operation) {
2917
+ throw new Error("Action was not applied");
2918
+ }
2919
+ const previousStateHash = ((_a = result.operations[action.scope].at(-2)) == null ? void 0 : _a.hash) ?? "";
2920
+ const signature = await buildOperationSignature(
2921
+ {
2922
+ ...context,
2923
+ operation,
2924
+ previousStateHash
2925
+ },
2926
+ signHandler
2927
+ );
2928
+ return {
2929
+ ...operation,
2930
+ context: {
2931
+ ...operation.context,
2932
+ signer: {
2933
+ ...(_b = operation.context) == null ? void 0 : _b.signer,
2934
+ ...context.signer,
2935
+ signatures: [...context.signer.signatures ?? [], signature]
2936
+ }
2937
+ }
2938
+ };
2939
+ }
2940
+ async function verifyOperationSignature(signature, signer, verifyHandler) {
2941
+ const publicKey = signer.app.key;
2942
+ const params = signature.slice(0, 4);
2943
+ const signatureBytes = hex2ab(signature[4]);
2944
+ const expectedMessage = buildOperationSignatureMessage(params);
2945
+ return verifyHandler(publicKey, signatureBytes, expectedMessage);
2946
+ }
2947
+ const types = { "application/andrew-inset": ["ez"], "application/appinstaller": ["appinstaller"], "application/applixware": ["aw"], "application/appx": ["appx"], "application/appxbundle": ["appxbundle"], "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/automationml-aml+xml": ["aml"], "application/automationml-amlx+zip": ["amlx"], "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/cpl+xml": ["cpl"], "application/cu-seeme": ["cu"], "application/cwl": ["cwl"], "application/dash+xml": ["mpd"], "application/dash-patch+xml": ["mpp"], "application/davmount+xml": ["davmount"], "application/docbook+xml": ["dbk"], "application/dssc+der": ["dssc"], "application/dssc+xml": ["xdssc"], "application/ecmascript": ["ecma"], "application/emma+xml": ["emma"], "application/emotionml+xml": ["emotionml"], "application/epub+zip": ["epub"], "application/exi": ["exi"], "application/express": ["exp"], "application/fdf": ["fdf"], "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"], "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/media-policy-dataset+xml": ["mpf"], "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": ["*mp4", "*mpg4", "mp4s", "m4p"], "application/msix": ["msix"], "application/msixbundle": ["msixbundle"], "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-keys": ["asc"], "application/pgp-signature": ["sig", "*asc"], "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/sql": ["sql"], "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/watcherinfo+xml": ["wif"], "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/xfdf": ["xfdf"], "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/aac": ["adts", "aac"], "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/avci": ["avci"], "image/avcs": ["avcs"], "image/avif": ["avif"], "image/bmp": ["bmp", "dib"], "image/cgm": ["cgm"], "image/dicom-rle": ["drle"], "image/dpx": ["dpx"], "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", "jpgm"], "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/jt": ["jt"], "model/mesh": ["msh", "mesh", "silo"], "model/mtl": ["mtl"], "model/obj": ["obj"], "model/prc": ["prc"], "model/step+xml": ["stpx"], "model/step+zip": ["stpz"], "model/step-xml+zip": ["stpxz"], "model/stl": ["stl"], "model/u3d": ["u3d"], "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/javascript": ["js", "mjs"], "text/jsx": ["jsx"], "text/less": ["less"], "text/markdown": ["md", "markdown"], "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/wgsl": ["wgsl"], "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"] };
2948
+ Object.freeze(types);
2949
+ var __classPrivateFieldGet = function(receiver, state, kind, f) {
2950
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
2951
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
2952
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
2953
+ };
2954
+ var _Mime_extensionToType, _Mime_typeToExtension, _Mime_typeToExtensions;
2955
+ class Mime {
2956
+ constructor(...args) {
2957
+ _Mime_extensionToType.set(this, /* @__PURE__ */ new Map());
2958
+ _Mime_typeToExtension.set(this, /* @__PURE__ */ new Map());
2959
+ _Mime_typeToExtensions.set(this, /* @__PURE__ */ new Map());
2960
+ for (const arg of args) {
2961
+ this.define(arg);
2962
+ }
2963
+ }
2964
+ define(typeMap, force = false) {
2965
+ for (let [type, extensions] of Object.entries(typeMap)) {
2966
+ type = type.toLowerCase();
2967
+ extensions = extensions.map((ext) => ext.toLowerCase());
2968
+ if (!__classPrivateFieldGet(this, _Mime_typeToExtensions, "f").has(type)) {
2969
+ __classPrivateFieldGet(this, _Mime_typeToExtensions, "f").set(type, /* @__PURE__ */ new Set());
2970
+ }
2971
+ const allExtensions = __classPrivateFieldGet(this, _Mime_typeToExtensions, "f").get(type);
2972
+ let first = true;
2973
+ for (let extension of extensions) {
2974
+ const starred = extension.startsWith("*");
2975
+ extension = starred ? extension.slice(1) : extension;
2976
+ allExtensions == null ? void 0 : allExtensions.add(extension);
2977
+ if (first) {
2978
+ __classPrivateFieldGet(this, _Mime_typeToExtension, "f").set(type, extension);
2979
+ }
2980
+ first = false;
2981
+ if (starred)
2982
+ continue;
2983
+ const currentType = __classPrivateFieldGet(this, _Mime_extensionToType, "f").get(extension);
2984
+ if (currentType && currentType != type && !force) {
2985
+ throw new Error(`"${type} -> ${extension}" conflicts with "${currentType} -> ${extension}". Pass \`force=true\` to override this definition.`);
2986
+ }
2987
+ __classPrivateFieldGet(this, _Mime_extensionToType, "f").set(extension, type);
2988
+ }
2989
+ }
2990
+ return this;
2991
+ }
2992
+ getType(path) {
2993
+ if (typeof path !== "string")
2994
+ return null;
2995
+ const last = path.replace(/^.*[/\\]/, "").toLowerCase();
2996
+ const ext = last.replace(/^.*\./, "").toLowerCase();
2997
+ const hasPath = last.length < path.length;
2998
+ const hasDot = ext.length < last.length - 1;
2999
+ if (!hasDot && hasPath)
3000
+ return null;
3001
+ return __classPrivateFieldGet(this, _Mime_extensionToType, "f").get(ext) ?? null;
3002
+ }
3003
+ getExtension(type) {
3004
+ var _a;
3005
+ if (typeof type !== "string")
3006
+ return null;
3007
+ type = (_a = type == null ? void 0 : type.split) == null ? void 0 : _a.call(type, ";")[0];
3008
+ return (type && __classPrivateFieldGet(this, _Mime_typeToExtension, "f").get(type.trim().toLowerCase())) ?? null;
3009
+ }
3010
+ getAllExtensions(type) {
3011
+ if (typeof type !== "string")
3012
+ return null;
3013
+ return __classPrivateFieldGet(this, _Mime_typeToExtensions, "f").get(type.toLowerCase()) ?? null;
3014
+ }
3015
+ _freeze() {
3016
+ this.define = () => {
3017
+ throw new Error("define() not allowed for built-in Mime objects. See https://github.com/broofa/mime/blob/main/README.md#custom-mime-instances");
3018
+ };
3019
+ Object.freeze(this);
3020
+ for (const extensions of __classPrivateFieldGet(this, _Mime_typeToExtensions, "f").values()) {
3021
+ Object.freeze(extensions);
3022
+ }
3023
+ return this;
3024
+ }
3025
+ _getTestState() {
3026
+ return {
3027
+ types: __classPrivateFieldGet(this, _Mime_extensionToType, "f"),
3028
+ extensions: __classPrivateFieldGet(this, _Mime_typeToExtension, "f")
3029
+ };
3030
+ }
3031
+ }
3032
+ _Mime_extensionToType = /* @__PURE__ */ new WeakMap(), _Mime_typeToExtension = /* @__PURE__ */ new WeakMap(), _Mime_typeToExtensions = /* @__PURE__ */ new WeakMap();
3033
+ const mime = new Mime(types)._freeze();
3058
3034
  function validateOperations(operations) {
3059
3035
  const errors = [];
3060
3036
  const scopes = Object.keys(operations);
@@ -3124,8 +3100,7 @@ function garbageCollect(sortedOperations) {
3124
3100
  function addUndo(sortedOperations) {
3125
3101
  const operationsCopy = [...sortedOperations];
3126
3102
  const latestOperation = operationsCopy[operationsCopy.length - 1];
3127
- if (!latestOperation)
3128
- return operationsCopy;
3103
+ if (!latestOperation) return operationsCopy;
3129
3104
  if (latestOperation.type === "NOOP") {
3130
3105
  operationsCopy.push({
3131
3106
  ...latestOperation,
@@ -3388,6 +3363,22 @@ function filterDuplicatedOperations(targetOperations, sourceOperations) {
3388
3363
  return true;
3389
3364
  });
3390
3365
  }
3366
+ function filterDocumentOperationsResultingState(documentOperations) {
3367
+ if (!documentOperations) {
3368
+ return {};
3369
+ }
3370
+ const entries = Object.entries(documentOperations);
3371
+ return entries.reduce(
3372
+ (acc, [scope, operations]) => ({
3373
+ ...acc,
3374
+ [scope]: operations.map((op) => {
3375
+ const { resultingState, ...restProps } = op;
3376
+ return restProps;
3377
+ })
3378
+ }),
3379
+ {}
3380
+ );
3381
+ }
3391
3382
  const documentHelpers = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3392
3383
  __proto__: null,
3393
3384
  IntegrityIssueSubType,
@@ -3396,6 +3387,7 @@ const documentHelpers = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.def
3396
3387
  attachBranch,
3397
3388
  checkCleanedOperationsIntegrity,
3398
3389
  checkOperationsIntegrity,
3390
+ filterDocumentOperationsResultingState,
3399
3391
  filterDuplicatedOperations,
3400
3392
  garbageCollect,
3401
3393
  garbageCollectDocumentOperations,
@@ -3427,7 +3419,14 @@ const createZip = async (document) => {
3427
3419
  "state.json",
3428
3420
  JSON.stringify(document.initialState || {}, null, 2)
3429
3421
  );
3430
- zip.file("operations.json", JSON.stringify(document.operations, null, 2));
3422
+ zip.file(
3423
+ "operations.json",
3424
+ JSON.stringify(
3425
+ filterDocumentOperationsResultingState(document.operations),
3426
+ null,
3427
+ 2
3428
+ )
3429
+ );
3431
3430
  if (document.attachments) {
3432
3431
  const attachments = Object.keys(document.attachments);
3433
3432
  attachments.forEach((key) => {
@@ -3572,7 +3571,7 @@ function updateOperations(document, action, skip = 0) {
3572
3571
  nextIndex = action.index;
3573
3572
  operationId = action.id;
3574
3573
  } else {
3575
- operationId = v4();
3574
+ operationId = "id" in action ? action.id : v4();
3576
3575
  }
3577
3576
  operations.push({
3578
3577
  ...action,
@@ -3620,8 +3619,7 @@ function processUndoRedo(document, action, skip) {
3620
3619
  function processSkipOperation(document, action, customReducer, skipValue, reuseOperationResultingState = false, resultingStateParser = parseResultingState) {
3621
3620
  const scope = action.scope;
3622
3621
  const latestOperation = document.operations[scope].at(-1);
3623
- if (!latestOperation)
3624
- return document;
3622
+ if (!latestOperation) return document;
3625
3623
  const documentOperations = garbageCollectDocumentOperations(
3626
3624
  {
3627
3625
  ...document.operations,
@@ -4298,8 +4296,13 @@ function applyMixins(derivedCtor, constructors) {
4298
4296
  }
4299
4297
  exports.BaseActions = BaseActions;
4300
4298
  exports.BaseDocument = BaseDocument;
4299
+ exports.ab2hex = ab2hex;
4301
4300
  exports.applyMixins = applyMixins;
4302
4301
  exports.baseReducer = baseReducer;
4302
+ exports.buildOperationSignature = buildOperationSignature;
4303
+ exports.buildOperationSignatureMessage = buildOperationSignatureMessage;
4304
+ exports.buildOperationSignatureParams = buildOperationSignatureParams;
4305
+ exports.buildSignedOperation = buildSignedOperation;
4303
4306
  exports.calculateSkipsLeft = calculateSkipsLeft;
4304
4307
  exports.createAction = createAction;
4305
4308
  exports.createDocument = createDocument;
@@ -4310,8 +4313,10 @@ exports.createZip = createZip;
4310
4313
  exports.documentHelpers = documentHelpers;
4311
4314
  exports.getLocalFile = getLocalFile;
4312
4315
  exports.getRemoteFile = getRemoteFile;
4316
+ exports.getUnixTimestamp = getUnixTimestamp;
4313
4317
  exports.hashDocument = hashDocument;
4314
4318
  exports.hashKey = hashKey;
4319
+ exports.hex2ab = hex2ab;
4315
4320
  exports.isBaseAction = isBaseAction;
4316
4321
  exports.isNoopOperation = isNoopOperation;
4317
4322
  exports.isSameDocument = isSameDocument;
@@ -4332,5 +4337,6 @@ exports.sortOperations = sortOperations;
4332
4337
  exports.updateDocument = updateDocument;
4333
4338
  exports.updateHeader = updateHeader;
4334
4339
  exports.validateOperations = validateOperations;
4340
+ exports.verifyOperationSignature = verifyOperationSignature;
4335
4341
  exports.zod = zod;
4336
- //# sourceMappingURL=object-DldjPOTT.js.map
4342
+ //# sourceMappingURL=object-Bf9_woMQ.js.map