document-model 1.0.9 → 1.0.11

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 (55) hide show
  1. package/dist/browser/document/index.d.ts +1 -0
  2. package/dist/browser/document/object.d.ts +10 -4
  3. package/dist/browser/document/reducer.d.ts +2 -1
  4. package/dist/browser/document/signal.d.ts +15 -0
  5. package/dist/browser/document/types.d.ts +12 -3
  6. package/dist/browser/document/utils/base.d.ts +2 -2
  7. package/dist/browser/document-model/gen/object.d.ts +2 -2
  8. package/dist/browser/document-model/gen/operation/actions.d.ts +3 -2
  9. package/dist/browser/document-model/gen/operation/creators.d.ts +3 -2
  10. package/dist/browser/document-model/gen/operation/object.d.ts +2 -1
  11. package/dist/browser/document-model/gen/operation/operations.d.ts +2 -1
  12. package/dist/browser/document-model/gen/schema/types.d.ts +8 -0
  13. package/dist/browser/document-model/gen/schema/zod.d.ts +5 -1
  14. package/dist/browser/document-model/index.d.ts +1 -0
  15. package/dist/browser/document-model.cjs +1 -1
  16. package/dist/browser/document-model.js +2 -2
  17. package/dist/browser/document.cjs +1 -1
  18. package/dist/browser/document.js +2 -2
  19. package/dist/browser/index.cjs +1 -1
  20. package/dist/browser/index.js +3 -3
  21. package/dist/browser/internal/index-ac329925.js +22 -0
  22. package/dist/{node/internal/index-5b0ca13a.js → browser/internal/index-c9e4dc9e.js} +1 -1
  23. package/dist/{node/internal/index-6a7277fe.js → browser/internal/index-cf51e575.js} +1 -1
  24. package/dist/browser/internal/{index-48f140bc.js → index-df1f6a1b.js} +442 -374
  25. package/dist/browser/internal/{object-ceb8f869.js → object-113c73e2.js} +2 -2
  26. package/dist/browser/internal/{object-98a2cff6.js → object-13eaec2b.js} +219 -218
  27. package/dist/node/document/index.d.ts +1 -0
  28. package/dist/node/document/object.d.ts +10 -4
  29. package/dist/node/document/reducer.d.ts +2 -1
  30. package/dist/node/document/signal.d.ts +15 -0
  31. package/dist/node/document/types.d.ts +12 -3
  32. package/dist/node/document/utils/base.d.ts +2 -2
  33. package/dist/node/document-model/gen/object.d.ts +2 -2
  34. package/dist/node/document-model/gen/operation/actions.d.ts +3 -2
  35. package/dist/node/document-model/gen/operation/creators.d.ts +3 -2
  36. package/dist/node/document-model/gen/operation/object.d.ts +2 -1
  37. package/dist/node/document-model/gen/operation/operations.d.ts +2 -1
  38. package/dist/node/document-model/gen/schema/types.d.ts +8 -0
  39. package/dist/node/document-model/gen/schema/zod.d.ts +5 -1
  40. package/dist/node/document-model/index.d.ts +1 -0
  41. package/dist/node/document-model.cjs +1 -1
  42. package/dist/node/document-model.js +2 -2
  43. package/dist/node/document.cjs +1 -1
  44. package/dist/node/document.js +2 -2
  45. package/dist/node/index.cjs +1 -1
  46. package/dist/node/index.js +3 -3
  47. package/dist/node/internal/{index-dfaca09a.js → index-0abc9251.js} +442 -374
  48. package/dist/{browser/internal/index-9922a4fc.js → node/internal/index-150bbba4.js} +1 -1
  49. package/dist/node/internal/index-2cd26a65.js +22 -0
  50. package/dist/{browser/internal/index-ff22a5bb.js → node/internal/index-a74d15aa.js} +1 -1
  51. package/dist/node/internal/{object-10abe15d.js → object-073dccc4.js} +1 -1
  52. package/dist/node/internal/{object-6f942fcb.js → object-baf4e3d5.js} +79 -78
  53. package/package.json +1 -1
  54. package/dist/browser/internal/index-7d7d05c8.js +0 -22
  55. package/dist/node/internal/index-2e487f63.js +0 -22
@@ -1,6 +1,6 @@
1
1
  var Y = Object.defineProperty;
2
2
  var tt = (t, i, e) => i in t ? Y(t, i, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[i] = e;
3
- var j = (t, i, e) => (tt(t, typeof i != "symbol" ? i + "" : i, e), e);
3
+ var x = (t, i, e) => (tt(t, typeof i != "symbol" ? i + "" : i, e), e);
4
4
  import it from "json-stringify-deterministic";
5
5
  import { produce as N, castDraft as et, castImmutable as at, freeze as nt } from "immer";
6
6
  import z from "jszip";
@@ -9,8 +9,8 @@ import w from "fs";
9
9
  import st from "https";
10
10
  import { join as pt } from "path";
11
11
  import { z as o } from "zod";
12
- const F = (t) => t != null, lt = o.any().refine((t) => F(t)), P = o.enum(["LOAD_STATE"]), q = o.enum(["PRUNE"]), M = o.enum(["REDO"]), L = o.enum(["SET_NAME"]), R = o.enum(["UNDO"]);
13
- function ct() {
12
+ const F = (t) => t != null, ct = o.any().refine((t) => F(t)), P = o.enum(["LOAD_STATE"]), q = o.enum(["PRUNE"]), M = o.enum(["REDO"]), L = o.enum(["SET_NAME"]), R = o.enum(["UNDO"]);
13
+ function lt() {
14
14
  return o.object({
15
15
  __typename: o.literal("Action").optional(),
16
16
  type: o.string()
@@ -103,7 +103,7 @@ function D() {
103
103
  }
104
104
  const Gt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
105
105
  __proto__: null,
106
- ActionSchema: ct,
106
+ ActionSchema: lt,
107
107
  BaseActionSchema: I,
108
108
  DocumentFileSchema: rt,
109
109
  LoadStateActionInputSchema: U,
@@ -121,19 +121,19 @@ const Gt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
121
121
  Set_NameSchema: L,
122
122
  UndoActionSchema: D,
123
123
  UndoSchema: R,
124
- definedNonNullAnySchema: lt,
124
+ definedNonNullAnySchema: ct,
125
125
  isDefinedNonNullAny: F
126
126
  }, Symbol.toStringTag, { value: "Module" }));
127
127
  function ut(t) {
128
128
  return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
129
129
  }
130
- function g() {
130
+ function h() {
131
131
  this._types = /* @__PURE__ */ Object.create(null), this._extensions = /* @__PURE__ */ Object.create(null);
132
132
  for (let t = 0; t < arguments.length; t++)
133
133
  this.define(arguments[t]);
134
134
  this.define = this.define.bind(this), this.getType = this.getType.bind(this), this.getExtension = this.getExtension.bind(this);
135
135
  }
136
- g.prototype.define = function(t, i) {
136
+ h.prototype.define = function(t, i) {
137
137
  for (let e in t) {
138
138
  let a = t[e].map(function(n) {
139
139
  return n.toLowerCase();
@@ -155,15 +155,15 @@ g.prototype.define = function(t, i) {
155
155
  }
156
156
  }
157
157
  };
158
- g.prototype.getType = function(t) {
158
+ h.prototype.getType = function(t) {
159
159
  t = String(t);
160
160
  let i = t.replace(/^.*[/\\]/, "").toLowerCase(), e = i.replace(/^.*\./, "").toLowerCase(), a = i.length < t.length;
161
161
  return (e.length < i.length - 1 || !a) && this._types[e] || null;
162
162
  };
163
- g.prototype.getExtension = function(t) {
163
+ h.prototype.getExtension = function(t) {
164
164
  return t = /^\s*([^;\s]*)/.test(t) && RegExp.$1, t && this._extensions[t.toLowerCase()] || null;
165
165
  };
166
- var xt = g, ft = { "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"] };
166
+ var xt = h, ft = { "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"] };
167
167
  let gt = xt;
168
168
  var ht = new gt(ft);
169
169
  const vt = /* @__PURE__ */ ut(ht);
@@ -196,33 +196,33 @@ function bt(t) {
196
196
  });
197
197
  });
198
198
  }
199
- const jt = async (t) => $(t), h = (t, i = "sha1") => ot.createHash(i).update(t).digest("base64"), B = async (t) => {
200
- const i = new z(), { name: e, revision: a, documentType: n, created: s, lastModified: p } = t, l = {
199
+ const jt = async (t) => $(t), v = (t, i = "sha1") => ot.createHash(i).update(t).digest("base64"), B = async (t) => {
200
+ const i = new z(), { name: e, revision: a, documentType: n, created: s, lastModified: p } = t, c = {
201
201
  name: e,
202
202
  revision: a,
203
203
  documentType: n,
204
204
  created: s,
205
205
  lastModified: p
206
206
  };
207
- return i.file("header.json", JSON.stringify(l, null, 2)), i.file(
207
+ return i.file("header.json", JSON.stringify(c, null, 2)), i.file(
208
208
  "state.json",
209
209
  JSON.stringify(t.initialState || {}, null, 2)
210
- ), i.file("operations.json", JSON.stringify(t.operations, null, 2)), Object.keys(t.attachments).forEach((c) => {
211
- const { data: r, ...b } = t.attachments[c];
212
- i.file(c, r, {
210
+ ), i.file("operations.json", JSON.stringify(t.operations, null, 2)), Object.keys(t.attachments).forEach((r) => {
211
+ const { data: m, ...j } = t.attachments[r];
212
+ i.file(r, m, {
213
213
  base64: !0,
214
214
  createFolders: !0,
215
- comment: JSON.stringify(b)
215
+ comment: JSON.stringify(j)
216
216
  });
217
217
  }), i;
218
218
  }, wt = async (t, i, e, a) => {
219
219
  const s = await (await B(t)).generateAsync({
220
220
  type: "uint8array",
221
221
  streamFiles: !0
222
- }), p = a ?? t.name, l = `.${e}.zip`;
222
+ }), p = a ?? t.name, c = `.${e}.zip`;
223
223
  return yt(
224
224
  i,
225
- p.endsWith(l) ? p : `${p}${l}`,
225
+ p.endsWith(c) ? p : `${p}${c}`,
226
226
  s
227
227
  );
228
228
  }, Qt = async (t, i) => {
@@ -242,30 +242,30 @@ async function _t(t, i) {
242
242
  const a = await e.async("string"), n = JSON.parse(a), s = t.file("header.json");
243
243
  let p = null;
244
244
  s && (p = JSON.parse(await s.async("string")));
245
- const l = t.file("operations.json");
246
- if (!l)
245
+ const c = t.file("operations.json");
246
+ if (!c)
247
247
  throw new Error("Operations history not found");
248
- const m = JSON.parse(
249
- await l.async("string")
250
- ), c = {
248
+ const l = JSON.parse(
249
+ await c.async("string")
250
+ ), r = {
251
251
  ...n,
252
252
  ...p,
253
253
  initialState: n,
254
254
  operations: [],
255
255
  attachments: { ...n.attachments }
256
256
  };
257
- let r = m.slice(0, p == null ? void 0 : p.revision).reduce(
258
- (b, X) => i(b, X),
259
- c
257
+ let m = l.slice(0, p == null ? void 0 : p.revision).reduce(
258
+ (j, X) => i(j, X),
259
+ r
260
260
  );
261
- return p && (r = {
262
- ...r,
261
+ return p && (m = {
262
+ ...m,
263
263
  ...p,
264
264
  operations: [
265
- ...r.operations,
266
- ...m.slice(p.revision)
265
+ ...m.operations,
266
+ ...l.slice(p.revision)
267
267
  ]
268
- }), r;
268
+ }), m;
269
269
  }
270
270
  function Z(t) {
271
271
  const i = t.replace(/^.*\./, "") || void 0, e = t.replace(/^.*[/\\]/, "") || void 0;
@@ -277,20 +277,20 @@ async function Vt(t) {
277
277
  ), a = Z(t), n = i.toString("base64");
278
278
  return {
279
279
  data: n,
280
- hash: h(n),
280
+ hash: v(n),
281
281
  mimeType: e,
282
282
  ...a
283
283
  };
284
284
  }
285
285
  async function Xt(t) {
286
286
  const i = await jt(t), e = vt.getType(t) || "application/octet-stream", a = Z(t), n = i.toString("base64");
287
- return { data: n, hash: h(n), mimeType: e, ...a };
287
+ return { data: n, hash: v(n), mimeType: e, ...a };
288
288
  }
289
- function f(t, i, e) {
290
- const a = Rt(t), n = Mt(e);
289
+ function g(t, i, e, a) {
290
+ const n = Rt(t), s = Mt(e);
291
291
  return i.reduce(
292
- (s, p) => n(s, p),
293
- a
292
+ (p, c) => s(p, c, a),
293
+ n
294
294
  );
295
295
  }
296
296
  function Ot(t, i) {
@@ -302,7 +302,7 @@ function kt(t, i, e) {
302
302
  t.revision - a
303
303
  );
304
304
  return {
305
- ...f(
305
+ ...g(
306
306
  t.initialState,
307
307
  n,
308
308
  e
@@ -320,7 +320,7 @@ function Dt(t, i, e) {
320
320
  t.revision + n
321
321
  );
322
322
  return {
323
- ...f(
323
+ ...g(
324
324
  t.initialState,
325
325
  s,
326
326
  e
@@ -331,16 +331,16 @@ function Dt(t, i, e) {
331
331
  }
332
332
  function Et(t, i, e, a) {
333
333
  i = i || 0, e = e || t.operations.length;
334
- const n = t.operations.slice(i, e), s = t.operations.slice(0, i), p = t.operations.slice(e), l = f(
334
+ const n = t.operations.slice(i, e), s = t.operations.slice(0, i), p = t.operations.slice(e), c = g(
335
335
  t.initialState,
336
336
  s.concat(n),
337
337
  a
338
- ), { name: m, state: c } = l;
339
- return f(
338
+ ), { name: l, state: r } = c;
339
+ return g(
340
340
  t.initialState,
341
341
  [
342
342
  ...s,
343
- E({ name: m, state: c }, n.length),
343
+ E({ name: l, state: r }, n.length),
344
344
  ...p
345
345
  ],
346
346
  a
@@ -353,9 +353,9 @@ function Nt(t, i) {
353
353
  state: i.state ?? {}
354
354
  };
355
355
  }
356
- const H = "SET_NAME", v = "UNDO", y = "REDO", d = "PRUNE", K = "LOAD_STATE";
356
+ const H = "SET_NAME", y = "UNDO", b = "REDO", d = "PRUNE", K = "LOAD_STATE";
357
357
  function At(t, i) {
358
- return [v, y, d].includes(i.type) ? t.revision : t.revision + 1;
358
+ return [y, b, d].includes(i.type) ? t.revision : t.revision + 1;
359
359
  }
360
360
  function Tt(t, i) {
361
361
  return {
@@ -365,7 +365,7 @@ function Tt(t, i) {
365
365
  };
366
366
  }
367
367
  function zt(t, i) {
368
- if ([v, y, d, d].includes(i.type))
368
+ if ([y, b, d, d].includes(i.type))
369
369
  return t;
370
370
  const e = t.operations.slice(0, t.revision);
371
371
  return {
@@ -389,9 +389,9 @@ function Pt(t, i, e) {
389
389
  switch (I().parse(i), i.type) {
390
390
  case H:
391
391
  return Ot(t, i.input);
392
- case v:
393
- return kt(t, i.input, e);
394
392
  case y:
393
+ return kt(t, i.input, e);
394
+ case b:
395
395
  return Dt(t, i.input, e);
396
396
  case d:
397
397
  return Et(
@@ -406,37 +406,37 @@ function Pt(t, i, e) {
406
406
  return t;
407
407
  }
408
408
  }
409
- function qt(t, i, e) {
410
- let a = t;
411
- return T(i) && (a = Pt(a, i, e)), a = Ft(a, i), a = N(a, (n) => {
412
- const s = e(n.state, i);
413
- if (s)
409
+ function qt(t, i, e, a) {
410
+ let n = t;
411
+ return T(i) && (n = Pt(n, i, e)), n = Ft(n, i), n = N(n, (s) => {
412
+ const p = e(s.state, i, a);
413
+ if (p)
414
414
  return et({
415
- ...a,
416
- state: s
415
+ ...n,
416
+ state: p
417
417
  });
418
- }), N(a, (n) => {
419
- n.operations[n.operations.length - 1].hash = It(n), !T(i) && i.attachments && i.attachments.forEach((s) => {
420
- const { hash: p, ...l } = s;
421
- n.attachments[p] = {
418
+ }), N(n, (s) => {
419
+ s.operations[s.operations.length - 1].hash = It(s), !T(i) && i.attachments && i.attachments.forEach((p) => {
420
+ const { hash: c, ...l } = p;
421
+ s.attachments[c] = {
422
422
  ...l
423
423
  };
424
424
  });
425
425
  });
426
426
  }
427
427
  function T(t) {
428
- return [H, v, y, d, K].includes(t.type);
428
+ return [H, y, b, d, K].includes(t.type);
429
429
  }
430
- function u(t, i, e, a) {
430
+ function u(t, i, e, a, n = "global") {
431
431
  if (!t)
432
432
  throw new Error("Empty action type");
433
433
  if (typeof t != "string")
434
434
  throw new Error(`Invalid action type: ${t}`);
435
- const n = e ? { type: t, input: i, attachments: e } : { type: t, input: i };
436
- return a == null || a().parse(n), n;
435
+ const s = { type: t, input: i, scope: n };
436
+ return e && (s.attachments = e), a == null || a().parse(s), s;
437
437
  }
438
438
  function Mt(t, i = qt) {
439
- return (e, a) => i(e, a, t);
439
+ return (e, a, n) => i(e, a, t, n);
440
440
  }
441
441
  const Lt = (t, i) => ({
442
442
  name: "",
@@ -457,11 +457,11 @@ const Lt = (t, i) => ({
457
457
  initialState: e,
458
458
  operations: []
459
459
  };
460
- }, It = (t) => h(it(t.state)), Yt = (t, i = 1e3) => {
460
+ }, It = (t) => v(it(t.state)), Yt = (t, i = 1e3) => {
461
461
  const e = Math.random() * i;
462
- return h(`${(t ?? /* @__PURE__ */ new Date()).toISOString()}${e}`);
462
+ return v(`${(t ?? /* @__PURE__ */ new Date()).toISOString()}${e}`);
463
463
  };
464
- function x(t) {
464
+ function f(t) {
465
465
  return at(nt(t, !0));
466
466
  }
467
467
  const W = (t) => u(
@@ -493,10 +493,11 @@ class ii {
493
493
  * @param reducer - The reducer function that updates the state.
494
494
  * @param document - The initial state of the document.
495
495
  */
496
- constructor(i, e) {
497
- j(this, "_document");
498
- j(this, "_reducer");
499
- this._reducer = i, this._document = e;
496
+ constructor(i, e, a) {
497
+ x(this, "_document");
498
+ x(this, "_reducer");
499
+ x(this, "_dispatch");
500
+ this._reducer = i, this._document = e, this._dispatch = a;
500
501
  }
501
502
  /**
502
503
  * Dispatches an action to update the state of the document.
@@ -504,7 +505,7 @@ class ii {
504
505
  * @returns The Document instance.
505
506
  */
506
507
  dispatch(i) {
507
- return this._document = this._reducer(this._document, i), this;
508
+ return this._document = this._reducer(this._document, i, this._dispatch), this;
508
509
  }
509
510
  /**
510
511
  * Saves the state of the document to a file.
@@ -535,13 +536,13 @@ class ii {
535
536
  * Gets the current state of the document.
536
537
  */
537
538
  get state() {
538
- return x(this._document.state);
539
+ return f(this._document.state);
539
540
  }
540
541
  /**
541
542
  * Gets the list of operations performed on the document.
542
543
  */
543
544
  get operations() {
544
- return x(this._document.operations);
545
+ return f(this._document.operations);
545
546
  }
546
547
  /**
547
548
  * Gets the name of the document.
@@ -577,13 +578,13 @@ class ii {
577
578
  * Gets the initial state of the document.
578
579
  */
579
580
  get initialState() {
580
- return x(this._document.initialState);
581
+ return f(this._document.initialState);
581
582
  }
582
583
  /**
583
584
  * Returns the current document as an object
584
585
  */
585
586
  toDocument() {
586
- return x(this._document);
587
+ return f(this._document);
587
588
  }
588
589
  /**
589
590
  * Gets the attachment associated with the given key.
@@ -659,7 +660,7 @@ export {
659
660
  It as n,
660
661
  Yt as o,
661
662
  qt as p,
662
- x as r,
663
+ f as r,
663
664
  wt as s,
664
665
  Gt as z
665
666
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "document-model",
3
- "version": "1.0.9",
3
+ "version": "1.0.11",
4
4
  "license": "AGPL-3.0-only",
5
5
  "private": false,
6
6
  "files": [
@@ -1,22 +0,0 @@
1
- "use strict";var ct=Object.defineProperty;var lt=(t,e,o)=>e in t?ct(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o;var de=(t,e,o)=>(lt(t,typeof e!="symbol"?e+"":e,o),o);const s=require("./object-ceb8f869.js");require("json-stringify-deterministic");require("immer");require("jszip");const r=require("zod"),dt=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"})),_={id:"powerhouse/document-model",name:"DocumentModel",extension:"phdm",description:"The Powerhouse Document Model describes the state and operations of a document type.",author:{name:"Powerhouse",website:"https://www.powerhouse.inc/"},specifications:[{version:1,changeLog:[],modules:[{name:"header",operations:[{name:"SetModelName",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[]},{name:"SetModelId",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[]},{name:"SetModelExtension",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[]},{name:"SetModelDescription",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[]},{name:"SetAuthorName",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[]},{name:"SetAuthorWebsite",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[]}],id:"",description:""},{name:"versioning",operations:[{name:"AddChangeLogItem",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[]},{name:"UpdateChangeLogItem",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[]},{name:"DeleteChangeLogItem",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[]},{name:"ReorderChangeLogItems",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[]},{name:"ReleaseNewVersion",schema:null,id:"",description:"",template:"",reducer:"",examples:[],errors:[]}],id:"",description:""},{name:"module",operations:[{name:"AddModule",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[]},{name:"SetModuleName",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[]},{name:"SetModuleDescription",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[]},{name:"DeleteModule",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[]},{name:"ReorderModules",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[]}],id:"",description:""},{name:"operation-error",operations:[{name:"AddOperationError",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[]},{name:"SetOperationErrorCode",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[]},{name:"SetOperationErrorName",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[]},{name:"SetOperationErrorDescription",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[]},{name:"SetOperationErrorTemplate",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[]},{name:"DeleteOperationError",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[]},{name:"ReorderOperationErrors",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[]}],id:"",description:""},{name:"operation-example",operations:[{name:"AddOperationExample",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[]},{name:"UpdateOperationExample",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[]},{name:"DeleteOperationExample",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[]},{name:"ReorderOperationExamples",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[]}],id:"",description:""},{name:"operation",operations:[{name:"AddOperation",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[]},{name:"SetOperationName",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[]},{name:"SetOperationSchema",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[]},{name:"SetOperationDescription",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[]},{name:"SetOperationTemplate",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[]},{name:"SetOperationReducer",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[]},{name:"MoveOperation",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[]},{name:"DeleteOperation",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[]},{name:"ReorderModuleOperations",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[]}],id:"",description:""},{name:"state",operations:[{name:"SetStateSchema",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[]},{name:"SetInitialState",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[]},{name:"AddStateExample",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[]},{name:"UpdateStateExample",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[]},{name:"DeleteStateExample",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[]},{name:"ReorderStateExamples",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[]}],id:"",description:""}],state:{schema:"",initialValue:`{
2
- "id": "",
3
- "name": "",
4
- "extension": "",
5
- "description": "",
6
- "author": {
7
- "name": "",
8
- "website": ""
9
- },
10
- "specifications": [
11
- {
12
- "version": 1,
13
- "changeLog": [],
14
- "state": {
15
- "schema": "",
16
- "initialValue": "",
17
- "examples": []
18
- },
19
- "modules": []
20
- }
21
- ]
22
- }`,examples:[]}}]},ue=t=>t!=null,ut=r.z.any().refine(t=>ue(t));function f(){return r.z.object({__typename:r.z.literal("AddChangeLogItemInput").optional(),content:r.z.string(),id:r.z.string(),insertBefore:r.z.string().nullable()})}function A(){return r.z.object({description:r.z.string().nullish(),id:r.z.string(),name:r.z.string()})}function z(){return r.z.object({errorCode:r.z.string().nullish(),errorDescription:r.z.string().nullish(),errorName:r.z.string().nullish(),errorTemplate:r.z.string().nullish(),id:r.z.string(),operationId:r.z.string()})}function I(){return r.z.object({example:r.z.string(),id:r.z.string(),operationId:r.z.string()})}function T(){return r.z.object({description:r.z.string().nullish(),id:r.z.string(),moduleId:r.z.string(),name:r.z.string(),reducer:r.z.string().nullish(),schema:r.z.string().nullish(),template:r.z.string().nullish()})}function R(){return r.z.object({example:r.z.string(),id:r.z.string(),insertBefore:r.z.string().nullish()})}function me(){return r.z.object({__typename:r.z.literal("Author").optional(),name:r.z.string(),website:r.z.string().nullable()})}function D(){return r.z.object({__typename:r.z.literal("CodeExample").optional(),id:r.z.string(),value:r.z.string()})}function M(){return r.z.object({__typename:r.z.literal("DeleteChangeLogItemInput").optional(),id:r.z.string()})}function x(){return r.z.object({id:r.z.string()})}function b(){return r.z.object({id:r.z.string()})}function N(){return r.z.object({id:r.z.string()})}function L(){return r.z.object({id:r.z.string()})}function P(){return r.z.object({id:r.z.string()})}function mt(){return r.z.union([f(),A(),z(),I(),T(),R(),M(),x(),b(),N(),L(),P(),j(),C(),k(),y(),w(),U(),v(),F(),H(),V(),X(),G(),B(),W(),$(),q(),J(),K(),Q(),Y(),Z(),ee(),te(),re(),ne(),oe(),ie(),se(),ae()])}function Et(){return r.z.object({__typename:r.z.literal("DocumentModelState").optional(),author:me(),description:r.z.string(),extension:r.z.string(),id:r.z.string(),name:r.z.string(),specifications:r.z.array(Ee())})}function Ee(){return r.z.object({__typename:r.z.literal("DocumentSpecification").optional(),changeLog:r.z.array(r.z.string()),modules:r.z.array(he()),state:ge(),version:r.z.number()})}function he(){return r.z.object({__typename:r.z.literal("Module").optional(),description:r.z.string().nullable(),id:r.z.string(),name:r.z.string(),operations:r.z.array(Oe())})}function j(){return r.z.object({newModuleId:r.z.string(),operationId:r.z.string()})}function Oe(){return r.z.object({__typename:r.z.literal("Operation").optional(),description:r.z.string().nullable(),errors:r.z.array(Se()),examples:r.z.array(D()),id:r.z.string(),name:r.z.string().nullable(),reducer:r.z.string().nullable(),schema:r.z.string().nullable(),template:r.z.string().nullable()})}function Se(){return r.z.object({__typename:r.z.literal("OperationError").optional(),code:r.z.string().nullable(),description:r.z.string().nullable(),id:r.z.string(),name:r.z.string().nullable(),template:r.z.string().nullable()})}function C(){return r.z.object({__typename:r.z.literal("ReorderChangeLogItemsInput").optional(),order:r.z.array(r.z.string())})}function k(){return r.z.object({moduleId:r.z.string(),order:r.z.array(r.z.string())})}function y(){return r.z.object({order:r.z.array(r.z.string())})}function w(){return r.z.object({operationId:r.z.string(),order:r.z.array(r.z.string())})}function U(){return r.z.object({operationId:r.z.string(),order:r.z.array(r.z.string())})}function v(){return r.z.object({order:r.z.array(r.z.string())})}function F(){return r.z.object({authorName:r.z.string()})}function H(){return r.z.object({authorWebsite:r.z.string()})}function V(){return r.z.object({initialValue:r.z.string()})}function X(){return r.z.object({description:r.z.string()})}function G(){return r.z.object({extension:r.z.string()})}function B(){return r.z.object({id:r.z.string()})}function W(){return r.z.object({name:r.z.string()})}function $(){return r.z.object({description:r.z.string().nullish(),id:r.z.string()})}function q(){return r.z.object({id:r.z.string(),name:r.z.string().nullish()})}function J(){return r.z.object({description:r.z.string().nullish(),id:r.z.string()})}function K(){return r.z.object({errorCode:r.z.string().nullish(),id:r.z.string()})}function Q(){return r.z.object({errorDescription:r.z.string().nullish(),id:r.z.string()})}function Y(){return r.z.object({errorName:r.z.string().nullish(),id:r.z.string()})}function Z(){return r.z.object({errorTemplate:r.z.string().nullish(),id:r.z.string()})}function ee(){return r.z.object({id:r.z.string(),name:r.z.string().nullish()})}function te(){return r.z.object({id:r.z.string(),reducer:r.z.string().nullish()})}function re(){return r.z.object({id:r.z.string(),schema:r.z.string().nullish()})}function ne(){return r.z.object({id:r.z.string(),template:r.z.string().nullish()})}function oe(){return r.z.object({schema:r.z.string()})}function ge(){return r.z.object({__typename:r.z.literal("State").optional(),examples:r.z.array(D()),initialValue:r.z.string(),schema:r.z.string()})}function ie(){return r.z.object({__typename:r.z.literal("UpdateChangeLogItemInput").optional(),id:r.z.string(),newContent:r.z.string()})}function se(){return r.z.object({example:r.z.string(),id:r.z.string()})}function ae(){return r.z.object({id:r.z.string(),newExample:r.z.string()})}const _e=Object.freeze(Object.defineProperty({__proto__:null,AddChangeLogItemInputSchema:f,AddModuleInputSchema:A,AddOperationErrorInputSchema:z,AddOperationExampleInputSchema:I,AddOperationInputSchema:T,AddStateExampleInputSchema:R,AuthorSchema:me,CodeExampleSchema:D,DeleteChangeLogItemInputSchema:M,DeleteModuleInputSchema:x,DeleteOperationErrorInputSchema:b,DeleteOperationExampleInputSchema:N,DeleteOperationInputSchema:L,DeleteStateExampleInputSchema:P,DocumentModelInputSchema:mt,DocumentModelStateSchema:Et,DocumentSpecificationSchema:Ee,ModuleSchema:he,MoveOperationInputSchema:j,OperationErrorSchema:Se,OperationSchema:Oe,ReorderChangeLogItemsInputSchema:C,ReorderModuleOperationsInputSchema:k,ReorderModulesInputSchema:y,ReorderOperationErrorsInputSchema:w,ReorderOperationExamplesInputSchema:U,ReorderStateExamplesInputSchema:v,SetAuthorNameInputSchema:F,SetAuthorWebsiteInputSchema:H,SetInitialStateInputSchema:V,SetModelDescriptionInputSchema:X,SetModelExtensionInputSchema:G,SetModelIdInputSchema:B,SetModelNameInputSchema:W,SetModuleDescriptionInputSchema:$,SetModuleNameInputSchema:q,SetOperationDescriptionInputSchema:J,SetOperationErrorCodeInputSchema:K,SetOperationErrorDescriptionInputSchema:Q,SetOperationErrorNameInputSchema:Y,SetOperationErrorTemplateInputSchema:Z,SetOperationNameInputSchema:ee,SetOperationReducerInputSchema:te,SetOperationSchemaInputSchema:re,SetOperationTemplateInputSchema:ne,SetStateSchemaInputSchema:oe,StateSchema:ge,UpdateChangeLogItemInputSchema:ie,UpdateOperationExampleInputSchema:se,UpdateStateExampleInputSchema:ae,definedNonNullAnySchema:ut,isDefinedNonNullAny:ue},Symbol.toStringTag,{value:"Module"})),l={setModelNameOperation(t,e){t.name=e.input.name},setModelIdOperation(t,e){t.id=e.input.id},setModelExtensionOperation(t,e){t.extension=e.input.extension},setModelDescriptionOperation(t,e){t.description=e.input.description},setAuthorNameOperation(t,e){t.author=t.author||{name:"",website:null},t.author.name=e.input.authorName},setAuthorWebsiteOperation(t,e){t.author=t.author||{name:"",website:null},t.author.website=e.input.authorWebsite}},E={addChangeLogItemOperation(t,e){throw new Error('Reducer "addChangeLogItemOperation" not yet implemented')},updateChangeLogItemOperation(t,e){throw new Error('Reducer "updateChangeLogItemOperation" not yet implemented')},deleteChangeLogItemOperation(t,e){throw new Error('Reducer "deleteChangeLogItemOperation" not yet implemented')},reorderChangeLogItemsOperation(t,e){throw new Error('Reducer "reorderChangeLogItemsOperation" not yet implemented')},releaseNewVersionOperation(t,e){throw new Error('Reducer "releaseNewVersionOperation" not yet implemented')}},ht=t=>{const e={};return t.forEach((o,n)=>e[o]=n),(o,n)=>(e[n.id]||999999)-(e[o.id]||999999)},h={addModuleOperation(t,e){t.specifications[t.specifications.length-1].modules.push({id:e.input.id,name:e.input.name,description:e.input.description||"",operations:[]})},setModuleNameOperation(t,e){const o=t.specifications[t.specifications.length-1];for(let n=0;n<o.modules.length;n++)o.modules[n].id===e.input.id&&(o.modules[n].name=e.input.name||"")},setModuleDescriptionOperation(t,e){const o=t.specifications[t.specifications.length-1];for(let n=0;n<o.modules.length;n++)o.modules[n].id===e.input.id&&(o.modules[n].description=e.input.description||"")},deleteModuleOperation(t,e){const o=t.specifications[t.specifications.length-1];o.modules=o.modules.filter(n=>n.id!=e.input.id)},reorderModulesOperation(t,e){t.specifications[t.specifications.length-1].modules.sort(ht(e.input.order))}},Ot=t=>{const e={};return t.forEach((o,n)=>e[o]=n),(o,n)=>(e[n.id]||999999)-(e[o.id]||999999)},c={addOperationErrorOperation(t,e){const o=t.specifications[t.specifications.length-1];for(let n=0;n<o.modules.length;n++)for(let i=0;i<o.modules[n].operations.length;i++)o.modules[n].operations[i].id==e.input.operationId&&o.modules[n].operations[i].errors.push({id:e.input.id,name:e.input.errorName||"",code:e.input.errorCode||"",description:e.input.errorDescription||"",template:e.input.errorTemplate||""})},setOperationErrorCodeOperation(t,e){const o=t.specifications[t.specifications.length-1];for(let n=0;n<o.modules.length;n++)for(let i=0;i<o.modules[n].operations.length;i++)for(let a=0;a<o.modules[n].operations[i].errors.length;a++)o.modules[n].operations[i].errors[a].id==e.input.id&&(o.modules[n].operations[i].errors[a].code=e.input.errorCode||"")},setOperationErrorNameOperation(t,e){const o=t.specifications[t.specifications.length-1];for(let n=0;n<o.modules.length;n++)for(let i=0;i<o.modules[n].operations.length;i++)for(let a=0;a<o.modules[n].operations[i].errors.length;a++)o.modules[n].operations[i].errors[a].id==e.input.id&&(o.modules[n].operations[i].errors[a].name=e.input.errorName||"")},setOperationErrorDescriptionOperation(t,e){const o=t.specifications[t.specifications.length-1];for(let n=0;n<o.modules.length;n++)for(let i=0;i<o.modules[n].operations.length;i++)for(let a=0;a<o.modules[n].operations[i].errors.length;a++)o.modules[n].operations[i].errors[a].id==e.input.id&&(o.modules[n].operations[i].errors[a].description=e.input.errorDescription||"")},setOperationErrorTemplateOperation(t,e){const o=t.specifications[t.specifications.length-1];for(let n=0;n<o.modules.length;n++)for(let i=0;i<o.modules[n].operations.length;i++)for(let a=0;a<o.modules[n].operations[i].errors.length;a++)o.modules[n].operations[i].errors[a].id==e.input.id&&(o.modules[n].operations[i].errors[a].template=e.input.errorTemplate||"")},deleteOperationErrorOperation(t,e){const o=t.specifications[t.specifications.length-1];for(let n=0;n<o.modules.length;n++)for(let i=0;i<o.modules[n].operations.length;i++)o.modules[n].operations[i].errors=o.modules[n].operations[i].errors.filter(a=>a.id!=e.input.id)},reorderOperationErrorsOperation(t,e){const o=t.specifications[t.specifications.length-1];for(let n=0;n<o.modules.length;n++)for(let i=0;i<o.modules[n].operations.length;i++)o.modules[n].operations[i].id==e.input.operationId&&o.modules[n].operations[i].errors.sort(Ot(e.input.order))}},St=t=>{const e={};return t.forEach((o,n)=>e[o]=n),(o,n)=>(e[n.id]||999999)-(e[o.id]||999999)},S={addOperationExampleOperation(t,e){const o=t.specifications[t.specifications.length-1];for(let n=0;n<o.modules.length;n++)for(let i=0;i<o.modules[n].operations.length;i++)o.modules[n].operations[i].id==e.input.operationId&&o.modules[n].operations[i].examples.push({id:e.input.id,value:e.input.example})},updateOperationExampleOperation(t,e){const o=t.specifications[t.specifications.length-1];for(let n=0;n<o.modules.length;n++)for(let i=0;i<o.modules[n].operations.length;i++)for(let a=0;a<o.modules[n].operations[i].examples.length;a++)o.modules[n].operations[i].examples[a].id==e.input.id&&(o.modules[n].operations[i].examples[a].value=e.input.example)},deleteOperationExampleOperation(t,e){const o=t.specifications[t.specifications.length-1];for(let n=0;n<o.modules.length;n++)for(let i=0;i<o.modules[n].operations.length;i++)o.modules[n].operations[i].examples=o.modules[n].operations[i].examples.filter(a=>a.id!=e.input.id)},reorderOperationExamplesOperation(t,e){const o=t.specifications[t.specifications.length-1];for(let n=0;n<o.modules.length;n++)for(let i=0;i<o.modules[n].operations.length;i++)o.modules[n].operations[i].id==e.input.operationId&&o.modules[n].operations[i].examples.sort(St(e.input.order))}},gt=t=>{const e={};return t.forEach((o,n)=>e[o]=n),(o,n)=>(e[n.id]||999999)-(e[o.id]||999999)},p={addOperationOperation(t,e){const o=t.specifications[t.specifications.length-1];for(let n=0;n<o.modules.length;n++)o.modules[n].id==e.input.moduleId&&o.modules[n].operations.push({id:e.input.id,name:e.input.name,description:e.input.description||"",schema:e.input.schema||"",template:e.input.template||e.input.description||"",reducer:e.input.reducer||"",errors:[],examples:[]})},setOperationNameOperation(t,e){const o=t.specifications[t.specifications.length-1];for(let n=0;n<o.modules.length;n++)for(let i=0;i<o.modules[n].operations.length;i++)o.modules[n].operations[i].id==e.input.id&&(o.modules[n].operations[i].name=e.input.name||"")},setOperationSchemaOperation(t,e){const o=t.specifications[t.specifications.length-1];for(let n=0;n<o.modules.length;n++)for(let i=0;i<o.modules[n].operations.length;i++)o.modules[n].operations[i].id==e.input.id&&(o.modules[n].operations[i].schema=e.input.schema||"")},setOperationDescriptionOperation(t,e){const o=t.specifications[t.specifications.length-1];for(let n=0;n<o.modules.length;n++)for(let i=0;i<o.modules[n].operations.length;i++)o.modules[n].operations[i].id==e.input.id&&(o.modules[n].operations[i].description=e.input.description||"")},setOperationTemplateOperation(t,e){const o=t.specifications[t.specifications.length-1];for(let n=0;n<o.modules.length;n++)for(let i=0;i<o.modules[n].operations.length;i++)o.modules[n].operations[i].id==e.input.id&&(o.modules[n].operations[i].template=e.input.template||"")},setOperationReducerOperation(t,e){const o=t.specifications[t.specifications.length-1];for(let n=0;n<o.modules.length;n++)for(let i=0;i<o.modules[n].operations.length;i++)o.modules[n].operations[i].id==e.input.id&&(o.modules[n].operations[i].reducer=e.input.reducer||"")},moveOperationOperation(t,e){const o=[],n=t.specifications[t.specifications.length-1];for(let i=0;i<n.modules.length;i++)n.modules[i].operations=n.modules[i].operations.filter(a=>a.id==e.input.operationId?(o.push(a),!1):!0);for(let i=0;i<n.modules.length;i++)n.modules[i].id==e.input.newModuleId&&n.modules[i].operations.push(...o)},deleteOperationOperation(t,e){const o=t.specifications[t.specifications.length-1];for(let n=0;n<o.modules.length;n++)o.modules[n].operations=o.modules[n].operations.filter(i=>i.id!=e.input.id)},reorderModuleOperationsOperation(t,e){const o=t.specifications[t.specifications.length-1];for(let n=0;n<o.modules.length;n++)o.modules[n].id==e.input.moduleId&&o.modules[n].operations.sort(gt(e.input.order))}},_t=t=>{const e={};return t.forEach((o,n)=>e[o]=n),(o,n)=>(e[n.id]||999999)-(e[o.id]||999999)},d={setStateSchemaOperation(t,e){const o=t.specifications[t.specifications.length-1];o.state.schema=e.input.schema},setInitialStateOperation(t,e){const o=t.specifications[t.specifications.length-1];o.state.initialValue=e.input.initialValue},addStateExampleOperation(t,e){t.specifications[t.specifications.length-1].state.examples.push({id:e.input.id,value:e.input.example})},updateStateExampleOperation(t,e){const o=t.specifications[t.specifications.length-1];for(let n=0;n<o.state.examples.length;n++)o.state.examples[n].id==e.input.id&&(o.state.examples[n].value=e.input.newExample)},deleteStateExampleOperation(t,e){const o=t.specifications[t.specifications.length-1];o.state.examples=o.state.examples.filter(n=>n.id!=e.input.id)},reorderStateExamplesOperation(t,e){t.specifications[t.specifications.length-1].state.examples.sort(_t(e.input.order))}},ft=(t,e)=>{if(s.isBaseAction(e))return t;switch(e.type){case"SET_MODEL_NAME":W().parse(e.input),l.setModelNameOperation(t,e);break;case"SET_MODEL_ID":B().parse(e.input),l.setModelIdOperation(t,e);break;case"SET_MODEL_EXTENSION":G().parse(e.input),l.setModelExtensionOperation(t,e);break;case"SET_MODEL_DESCRIPTION":X().parse(e.input),l.setModelDescriptionOperation(t,e);break;case"SET_AUTHOR_NAME":F().parse(e.input),l.setAuthorNameOperation(t,e);break;case"SET_AUTHOR_WEBSITE":H().parse(e.input),l.setAuthorWebsiteOperation(t,e);break;case"ADD_CHANGE_LOG_ITEM":f().parse(e.input),E.addChangeLogItemOperation(t,e);break;case"UPDATE_CHANGE_LOG_ITEM":ie().parse(e.input),E.updateChangeLogItemOperation(t,e);break;case"DELETE_CHANGE_LOG_ITEM":M().parse(e.input),E.deleteChangeLogItemOperation(t,e);break;case"REORDER_CHANGE_LOG_ITEMS":C().parse(e.input),E.reorderChangeLogItemsOperation(t,e);break;case"RELEASE_NEW_VERSION":if(Object.keys(e.input).length>0)throw new Error("Expected empty input for action RELEASE_NEW_VERSION");E.releaseNewVersionOperation(t,e);break;case"ADD_MODULE":A().parse(e.input),h.addModuleOperation(t,e);break;case"SET_MODULE_NAME":q().parse(e.input),h.setModuleNameOperation(t,e);break;case"SET_MODULE_DESCRIPTION":$().parse(e.input),h.setModuleDescriptionOperation(t,e);break;case"DELETE_MODULE":x().parse(e.input),h.deleteModuleOperation(t,e);break;case"REORDER_MODULES":y().parse(e.input),h.reorderModulesOperation(t,e);break;case"ADD_OPERATION_ERROR":z().parse(e.input),c.addOperationErrorOperation(t,e);break;case"SET_OPERATION_ERROR_CODE":K().parse(e.input),c.setOperationErrorCodeOperation(t,e);break;case"SET_OPERATION_ERROR_NAME":Y().parse(e.input),c.setOperationErrorNameOperation(t,e);break;case"SET_OPERATION_ERROR_DESCRIPTION":Q().parse(e.input),c.setOperationErrorDescriptionOperation(t,e);break;case"SET_OPERATION_ERROR_TEMPLATE":Z().parse(e.input),c.setOperationErrorTemplateOperation(t,e);break;case"DELETE_OPERATION_ERROR":b().parse(e.input),c.deleteOperationErrorOperation(t,e);break;case"REORDER_OPERATION_ERRORS":w().parse(e.input),c.reorderOperationErrorsOperation(t,e);break;case"ADD_OPERATION_EXAMPLE":I().parse(e.input),S.addOperationExampleOperation(t,e);break;case"UPDATE_OPERATION_EXAMPLE":se().parse(e.input),S.updateOperationExampleOperation(t,e);break;case"DELETE_OPERATION_EXAMPLE":N().parse(e.input),S.deleteOperationExampleOperation(t,e);break;case"REORDER_OPERATION_EXAMPLES":U().parse(e.input),S.reorderOperationExamplesOperation(t,e);break;case"ADD_OPERATION":T().parse(e.input),p.addOperationOperation(t,e);break;case"SET_OPERATION_NAME":ee().parse(e.input),p.setOperationNameOperation(t,e);break;case"SET_OPERATION_SCHEMA":re().parse(e.input),p.setOperationSchemaOperation(t,e);break;case"SET_OPERATION_DESCRIPTION":J().parse(e.input),p.setOperationDescriptionOperation(t,e);break;case"SET_OPERATION_TEMPLATE":ne().parse(e.input),p.setOperationTemplateOperation(t,e);break;case"SET_OPERATION_REDUCER":te().parse(e.input),p.setOperationReducerOperation(t,e);break;case"MOVE_OPERATION":j().parse(e.input),p.moveOperationOperation(t,e);break;case"DELETE_OPERATION":L().parse(e.input),p.deleteOperationOperation(t,e);break;case"REORDER_MODULE_OPERATIONS":k().parse(e.input),p.reorderModuleOperationsOperation(t,e);break;case"SET_STATE_SCHEMA":oe().parse(e.input),d.setStateSchemaOperation(t,e);break;case"SET_INITIAL_STATE":V().parse(e.input),d.setInitialStateOperation(t,e);break;case"ADD_STATE_EXAMPLE":R().parse(e.input),d.addStateExampleOperation(t,e);break;case"UPDATE_STATE_EXAMPLE":ae().parse(e.input),d.updateStateExampleOperation(t,e);break;case"DELETE_STATE_EXAMPLE":P().parse(e.input),d.deleteStateExampleOperation(t,e);break;case"REORDER_STATE_EXAMPLES":v().parse(e.input),d.reorderStateExamplesOperation(t,e);break;default:return t}},m=s.createReducer(ft),At={id:"",name:"",extension:"",description:"",author:{name:"",website:""},specifications:[{version:1,changeLog:[],state:{schema:"",initialValue:"",examples:[]},modules:[]}]},O={fileExtension:"phdm",createState(t){return{...At,...t}},createExtendedState(t){return s.createExtendedState({...t,documentType:"powerhouse/document-model"},O.createState)},createDocument(t){return s.createDocument(O.createExtendedState(t),O.createState)},saveToFile(t,e,o){return s.saveToFile(t,e,"phdm",o)},saveToFileHandle(t,e){return s.saveToFileHandle(t,e)},loadFromFile(t){return s.loadFromFile(t,m)},loadFromInput(t){return s.loadFromInput(t,m)}},fe=t=>s.createAction("SET_MODEL_NAME",{...t}),Ae=t=>s.createAction("SET_MODEL_ID",{...t}),ze=t=>s.createAction("SET_MODEL_EXTENSION",{...t}),Ie=t=>s.createAction("SET_MODEL_DESCRIPTION",{...t}),Te=t=>s.createAction("SET_AUTHOR_NAME",{...t}),Re=t=>s.createAction("SET_AUTHOR_WEBSITE",{...t});class zt extends s.BaseDocument{setModelName(e){return this.dispatch(fe(e))}setModelId(e){return this.dispatch(Ae(e))}setModelExtension(e){return this.dispatch(ze(e))}setModelDescription(e){return this.dispatch(Ie(e))}setAuthorName(e){return this.dispatch(Te(e))}setAuthorWebsite(e){return this.dispatch(Re(e))}}const De=t=>s.createAction("ADD_CHANGE_LOG_ITEM",{...t}),Me=t=>s.createAction("UPDATE_CHANGE_LOG_ITEM",{...t}),xe=t=>s.createAction("DELETE_CHANGE_LOG_ITEM",{...t}),be=t=>s.createAction("REORDER_CHANGE_LOG_ITEMS",{...t}),Ne=()=>s.createAction("RELEASE_NEW_VERSION");class It extends s.BaseDocument{addChangeLogItem(e){return this.dispatch(De(e))}updateChangeLogItem(e){return this.dispatch(Me(e))}deleteChangeLogItem(e){return this.dispatch(xe(e))}reorderChangeLogItems(e){return this.dispatch(be(e))}releaseNewVersion(){return this.dispatch(Ne())}}const Le=t=>s.createAction("ADD_MODULE",{...t}),Pe=t=>s.createAction("SET_MODULE_NAME",{...t}),je=t=>s.createAction("SET_MODULE_DESCRIPTION",{...t}),Ce=t=>s.createAction("DELETE_MODULE",{...t}),ke=t=>s.createAction("REORDER_MODULES",{...t});class Tt extends s.BaseDocument{addModule(e){return this.dispatch(Le(e))}setModuleName(e){return this.dispatch(Pe(e))}setModuleDescription(e){return this.dispatch(je(e))}deleteModule(e){return this.dispatch(Ce(e))}reorderModules(e){return this.dispatch(ke(e))}}const ye=t=>s.createAction("ADD_OPERATION_ERROR",{...t}),we=t=>s.createAction("SET_OPERATION_ERROR_CODE",{...t}),Ue=t=>s.createAction("SET_OPERATION_ERROR_NAME",{...t}),ve=t=>s.createAction("SET_OPERATION_ERROR_DESCRIPTION",{...t}),Fe=t=>s.createAction("SET_OPERATION_ERROR_TEMPLATE",{...t}),He=t=>s.createAction("DELETE_OPERATION_ERROR",{...t}),Ve=t=>s.createAction("REORDER_OPERATION_ERRORS",{...t});class Rt extends s.BaseDocument{addOperationError(e){return this.dispatch(ye(e))}setOperationErrorCode(e){return this.dispatch(we(e))}setOperationErrorName(e){return this.dispatch(Ue(e))}setOperationErrorDescription(e){return this.dispatch(ve(e))}setOperationErrorTemplate(e){return this.dispatch(Fe(e))}deleteOperationError(e){return this.dispatch(He(e))}reorderOperationErrors(e){return this.dispatch(Ve(e))}}const Xe=t=>s.createAction("ADD_OPERATION_EXAMPLE",{...t}),Ge=t=>s.createAction("UPDATE_OPERATION_EXAMPLE",{...t}),Be=t=>s.createAction("DELETE_OPERATION_EXAMPLE",{...t}),We=t=>s.createAction("REORDER_OPERATION_EXAMPLES",{...t});class Dt extends s.BaseDocument{addOperationExample(e){return this.dispatch(Xe(e))}updateOperationExample(e){return this.dispatch(Ge(e))}deleteOperationExample(e){return this.dispatch(Be(e))}reorderOperationExamples(e){return this.dispatch(We(e))}}const $e=t=>s.createAction("ADD_OPERATION",{...t}),qe=t=>s.createAction("SET_OPERATION_NAME",{...t}),Je=t=>s.createAction("SET_OPERATION_SCHEMA",{...t}),Ke=t=>s.createAction("SET_OPERATION_DESCRIPTION",{...t}),Qe=t=>s.createAction("SET_OPERATION_TEMPLATE",{...t}),Ye=t=>s.createAction("SET_OPERATION_REDUCER",{...t}),Ze=t=>s.createAction("MOVE_OPERATION",{...t}),et=t=>s.createAction("DELETE_OPERATION",{...t}),tt=t=>s.createAction("REORDER_MODULE_OPERATIONS",{...t});class Mt extends s.BaseDocument{addOperation(e){return this.dispatch($e(e))}setOperationName(e){return this.dispatch(qe(e))}setOperationSchema(e){return this.dispatch(Je(e))}setOperationDescription(e){return this.dispatch(Ke(e))}setOperationTemplate(e){return this.dispatch(Qe(e))}setOperationReducer(e){return this.dispatch(Ye(e))}moveOperation(e){return this.dispatch(Ze(e))}deleteOperation(e){return this.dispatch(et(e))}reorderModuleOperations(e){return this.dispatch(tt(e))}}const rt=t=>s.createAction("SET_STATE_SCHEMA",{...t}),nt=t=>s.createAction("SET_INITIAL_STATE",{...t}),ot=t=>s.createAction("ADD_STATE_EXAMPLE",{...t}),it=t=>s.createAction("UPDATE_STATE_EXAMPLE",{...t}),st=t=>s.createAction("DELETE_STATE_EXAMPLE",{...t}),at=t=>s.createAction("REORDER_STATE_EXAMPLES",{...t});class xt extends s.BaseDocument{setStateSchema(e){return this.dispatch(rt(e))}setInitialState(e){return this.dispatch(nt(e))}addStateExample(e){return this.dispatch(ot(e))}updateStateExample(e){return this.dispatch(it(e))}deleteStateExample(e){return this.dispatch(st(e))}reorderStateExamples(e){return this.dispatch(at(e))}}var u;let g=(u=class extends s.BaseDocument{constructor(e){super(m,O.createDocument(e))}saveToFile(e,o){return super.saveToFile(e,u.fileExtension,o)}loadFromFile(e){return super.loadFromFile(e)}static async fromFile(e){const o=new this;return await o.loadFromFile(e),o}},de(u,"fileExtension","phdm"),u);s.applyMixins(g,[zt,It,Tt,Rt,Dt,Mt,xt]);const bt=Object.freeze(Object.defineProperty({__proto__:null,addChangeLogItem:De,addModule:Le,addOperation:$e,addOperationError:ye,addOperationExample:Xe,addStateExample:ot,deleteChangeLogItem:xe,deleteModule:Ce,deleteOperation:et,deleteOperationError:He,deleteOperationExample:Be,deleteStateExample:st,moveOperation:Ze,releaseNewVersion:Ne,reorderChangeLogItems:be,reorderModuleOperations:tt,reorderModules:ke,reorderOperationErrors:Ve,reorderOperationExamples:We,reorderStateExamples:at,setAuthorName:Te,setAuthorWebsite:Re,setInitialState:nt,setModelDescription:Ie,setModelExtension:ze,setModelId:Ae,setModelName:fe,setModuleDescription:je,setModuleName:Pe,setOperationDescription:Ke,setOperationErrorCode:we,setOperationErrorDescription:ve,setOperationErrorName:Ue,setOperationErrorTemplate:Fe,setOperationName:qe,setOperationReducer:Ye,setOperationSchema:Je,setOperationTemplate:Qe,setStateSchema:rt,updateChangeLogItem:Me,updateOperationExample:Ge,updateStateExample:it},Symbol.toStringTag,{value:"Module"})),pe=g,ce={...O,...dt},le={...s.BaseActions,...bt},pt={Document:pe,reducer:m,actions:le,utils:ce,documentModel:_},Nt=Object.freeze(Object.defineProperty({__proto__:null,Document:pe,DocumentModel:g,actions:le,documentModel:_,module:pt,reducer:m,utils:ce,z:_e},Symbol.toStringTag,{value:"Module"}));exports.Document=pe;exports.DocumentModel=Nt;exports.DocumentModel$1=g;exports.actions=le;exports.documentModel=_;exports.module=pt;exports.reducer=m;exports.utils=ce;exports.zod=_e;