document-model 1.1.0-debug.2 → 1.1.0-experimental.2

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 (140) hide show
  1. package/dist/browser/cjs/document-model.js +1 -21
  2. package/dist/browser/cjs/document.js +1 -15
  3. package/dist/browser/cjs/index.js +1 -18
  4. package/dist/browser/cjs/internal/index-DLodkpOq.js +22 -0
  5. package/dist/browser/cjs/internal/index-azT4DEce.js +1 -0
  6. package/dist/browser/cjs/internal/object-CMr-_AP8.js +25 -0
  7. package/dist/browser/es/document-model.js +15 -16
  8. package/dist/browser/es/document.js +9 -10
  9. package/dist/browser/es/index.js +11 -13
  10. package/dist/browser/es/internal/index-BzNpRs2a.js +44 -0
  11. package/dist/browser/es/internal/index-CL_1ivGq.js +2104 -0
  12. package/dist/browser/es/internal/object-FFc9n_3I.js +2789 -0
  13. package/dist/browser/src/document/object.d.ts +35 -0
  14. package/dist/browser/src/document/types.d.ts +6 -0
  15. package/dist/browser/src/document/utils/base.d.ts +5 -4
  16. package/dist/browser/src/document/utils/document-helpers.d.ts +1 -1
  17. package/dist/browser/src/document/utils/index.d.ts +1 -1
  18. package/dist/node/cjs/document-model.js +1 -25
  19. package/dist/node/cjs/document.js +1 -19
  20. package/dist/node/cjs/index.js +1 -22
  21. package/dist/node/cjs/internal/index-CPeTtUsk.js +22 -0
  22. package/dist/node/cjs/internal/index-CTavCc1t.js +1 -0
  23. package/dist/node/cjs/internal/object-DhI24-1e.js +20 -0
  24. package/dist/node/es/document-model.js +14 -15
  25. package/dist/node/es/document.js +9 -10
  26. package/dist/node/es/index.js +11 -13
  27. package/dist/node/es/internal/index-8lUz8qED.js +44 -0
  28. package/dist/node/es/internal/index-A880In4b.js +2108 -0
  29. package/dist/node/es/internal/object-C9n9Ijnt.js +1687 -0
  30. package/dist/node/src/document/object.d.ts +35 -0
  31. package/dist/node/src/document/types.d.ts +6 -0
  32. package/dist/node/src/document/utils/base.d.ts +5 -4
  33. package/dist/node/src/document/utils/document-helpers.d.ts +1 -1
  34. package/dist/node/src/document/utils/index.d.ts +1 -1
  35. package/package.json +1 -1
  36. package/CHANGELOG.md +0 -19
  37. package/dist/browser/cjs/document-model.js.map +0 -1
  38. package/dist/browser/cjs/document.js.map +0 -1
  39. package/dist/browser/cjs/index.js.map +0 -1
  40. package/dist/browser/cjs/internal/index-CaJbS06G.js +0 -2339
  41. package/dist/browser/cjs/internal/index-CaJbS06G.js.map +0 -1
  42. package/dist/browser/cjs/internal/index-kKIg6qNB.js +0 -44
  43. package/dist/browser/cjs/internal/index-kKIg6qNB.js.map +0 -1
  44. package/dist/browser/cjs/internal/object-B6dSDhtS.js +0 -4109
  45. package/dist/browser/cjs/internal/object-B6dSDhtS.js.map +0 -1
  46. package/dist/browser/es/document-model.js.map +0 -1
  47. package/dist/browser/es/document.js.map +0 -1
  48. package/dist/browser/es/index.js.map +0 -1
  49. package/dist/browser/es/internal/index-B1lQN59e.js +0 -2340
  50. package/dist/browser/es/internal/index-B1lQN59e.js.map +0 -1
  51. package/dist/browser/es/internal/index-Bu0CkmrW.js +0 -45
  52. package/dist/browser/es/internal/index-Bu0CkmrW.js.map +0 -1
  53. package/dist/browser/es/internal/object-9mR1JlXD.js +0 -4110
  54. package/dist/browser/es/internal/object-9mR1JlXD.js.map +0 -1
  55. package/dist/node/cjs/document-model.js.map +0 -1
  56. package/dist/node/cjs/document.js.map +0 -1
  57. package/dist/node/cjs/index.js.map +0 -1
  58. package/dist/node/cjs/internal/index-AqiVmL0w.js +0 -44
  59. package/dist/node/cjs/internal/index-AqiVmL0w.js.map +0 -1
  60. package/dist/node/cjs/internal/index-ajqhOWQ1.js +0 -2343
  61. package/dist/node/cjs/internal/index-ajqhOWQ1.js.map +0 -1
  62. package/dist/node/cjs/internal/object-D_9h7jBN.js +0 -2111
  63. package/dist/node/cjs/internal/object-D_9h7jBN.js.map +0 -1
  64. package/dist/node/es/document-model.js.map +0 -1
  65. package/dist/node/es/document.js.map +0 -1
  66. package/dist/node/es/index.js.map +0 -1
  67. package/dist/node/es/internal/index-Bh_09edy.js +0 -2344
  68. package/dist/node/es/internal/index-Bh_09edy.js.map +0 -1
  69. package/dist/node/es/internal/index-s6NFw7Kq.js +0 -45
  70. package/dist/node/es/internal/index-s6NFw7Kq.js.map +0 -1
  71. package/dist/node/es/internal/object-CbITi4iq.js +0 -2112
  72. package/dist/node/es/internal/object-CbITi4iq.js.map +0 -1
  73. package/dist/src/document/actions/creators.d.ts +0 -47
  74. package/dist/src/document/actions/index.d.ts +0 -14
  75. package/dist/src/document/actions/types.d.ts +0 -15
  76. package/dist/src/document/index.d.ts +0 -6
  77. package/dist/src/document/object.d.ts +0 -1175
  78. package/dist/src/document/reducer.d.ts +0 -43
  79. package/dist/src/document/schema/index.d.ts +0 -2
  80. package/dist/src/document/schema/types.d.ts +0 -176
  81. package/dist/src/document/schema/zod.d.ts +0 -113
  82. package/dist/src/document/signal.d.ts +0 -29
  83. package/dist/src/document/types.d.ts +0 -249
  84. package/dist/src/document/utils/base.d.ts +0 -85
  85. package/dist/src/document/utils/document-helpers.d.ts +0 -53
  86. package/dist/src/document/utils/file.d.ts +0 -48
  87. package/dist/src/document/utils/index.d.ts +0 -5
  88. package/dist/src/document/utils/node.d.ts +0 -9
  89. package/dist/src/document/utils/validation.d.ts +0 -2
  90. package/dist/src/document-model/custom/reducers/header.d.ts +0 -2
  91. package/dist/src/document-model/custom/reducers/module.d.ts +0 -2
  92. package/dist/src/document-model/custom/reducers/operation-error.d.ts +0 -2
  93. package/dist/src/document-model/custom/reducers/operation-example.d.ts +0 -2
  94. package/dist/src/document-model/custom/reducers/operation.d.ts +0 -2
  95. package/dist/src/document-model/custom/reducers/state.d.ts +0 -2
  96. package/dist/src/document-model/custom/reducers/versioning.d.ts +0 -7
  97. package/dist/src/document-model/custom/utils.d.ts +0 -7
  98. package/dist/src/document-model/gen/actions.d.ts +0 -15
  99. package/dist/src/document-model/gen/creators.d.ts +0 -7
  100. package/dist/src/document-model/gen/document-model.d.ts +0 -2
  101. package/dist/src/document-model/gen/header/actions.d.ts +0 -9
  102. package/dist/src/document-model/gen/header/creators.d.ts +0 -8
  103. package/dist/src/document-model/gen/header/object.d.ts +0 -12
  104. package/dist/src/document-model/gen/header/operations.d.ts +0 -10
  105. package/dist/src/document-model/gen/index.d.ts +0 -5
  106. package/dist/src/document-model/gen/module/actions.d.ts +0 -8
  107. package/dist/src/document-model/gen/module/creators.d.ts +0 -7
  108. package/dist/src/document-model/gen/module/object.d.ts +0 -11
  109. package/dist/src/document-model/gen/module/operations.d.ts +0 -9
  110. package/dist/src/document-model/gen/object.d.ts +0 -28
  111. package/dist/src/document-model/gen/operation/actions.d.ts +0 -13
  112. package/dist/src/document-model/gen/operation/creators.d.ts +0 -12
  113. package/dist/src/document-model/gen/operation/object.d.ts +0 -16
  114. package/dist/src/document-model/gen/operation/operations.d.ts +0 -14
  115. package/dist/src/document-model/gen/operation-error/actions.d.ts +0 -10
  116. package/dist/src/document-model/gen/operation-error/creators.d.ts +0 -9
  117. package/dist/src/document-model/gen/operation-error/object.d.ts +0 -13
  118. package/dist/src/document-model/gen/operation-error/operations.d.ts +0 -11
  119. package/dist/src/document-model/gen/operation-example/actions.d.ts +0 -7
  120. package/dist/src/document-model/gen/operation-example/creators.d.ts +0 -6
  121. package/dist/src/document-model/gen/operation-example/object.d.ts +0 -10
  122. package/dist/src/document-model/gen/operation-example/operations.d.ts +0 -8
  123. package/dist/src/document-model/gen/reducer.d.ts +0 -5
  124. package/dist/src/document-model/gen/schema/index.d.ts +0 -2
  125. package/dist/src/document-model/gen/schema/types.d.ts +0 -453
  126. package/dist/src/document-model/gen/schema/zod.d.ts +0 -453
  127. package/dist/src/document-model/gen/state/actions.d.ts +0 -9
  128. package/dist/src/document-model/gen/state/creators.d.ts +0 -8
  129. package/dist/src/document-model/gen/state/object.d.ts +0 -12
  130. package/dist/src/document-model/gen/state/operations.d.ts +0 -10
  131. package/dist/src/document-model/gen/types.d.ts +0 -8
  132. package/dist/src/document-model/gen/utils.d.ts +0 -6
  133. package/dist/src/document-model/gen/versioning/actions.d.ts +0 -8
  134. package/dist/src/document-model/gen/versioning/creators.d.ts +0 -7
  135. package/dist/src/document-model/gen/versioning/object.d.ts +0 -11
  136. package/dist/src/document-model/gen/versioning/operations.d.ts +0 -9
  137. package/dist/src/document-model/index.d.ts +0 -80
  138. package/dist/src/index.d.ts +0 -25
  139. package/dist/vite.config.d.ts +0 -2
  140. package/dist/vitest.config.d.ts +0 -2
@@ -0,0 +1,2104 @@
1
+ var Rt = Object.defineProperty;
2
+ var xt = (t, e, r) => e in t ? Rt(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r;
3
+ var Ee = (t, e, r) => (xt(t, typeof e != "symbol" ? e + "" : e, r), r);
4
+ import { c as At, i as Mt, a as Dt, b as Nt, s as Lt, d as Pt, l as Ct, e as jt, f as a, B as c, g as yt, h as wt } from "./object-FFc9n_3I.js";
5
+ import "immer";
6
+ import "jszip";
7
+ import { z as o } from "zod";
8
+ const kt = new RegExp("([\\p{Ll}\\d])(\\p{Lu})", "gu"), Ut = new RegExp("(\\p{Lu})([\\p{Lu}][\\p{Ll}])", "gu"), vt = new RegExp("(\\d)\\p{Ll}|(\\p{L})\\d", "u"), Ft = /[^\p{L}\d]+/giu, he = "$1\0$2", Oe = "";
9
+ function Se(t) {
10
+ let e = t.trim();
11
+ e = e.replace(kt, he).replace(Ut, he), e = e.replace(Ft, "\0");
12
+ let r = 0, n = e.length;
13
+ for (; e.charAt(r) === "\0"; )
14
+ r++;
15
+ if (r === n)
16
+ return [];
17
+ for (; e.charAt(n - 1) === "\0"; )
18
+ n--;
19
+ return e.slice(r, n).split(/\0/g);
20
+ }
21
+ function $t(t) {
22
+ const e = Se(t);
23
+ for (let r = 0; r < e.length; r++) {
24
+ const n = e[r], i = vt.exec(n);
25
+ if (i) {
26
+ const s = i.index + (i[1] ?? i[2]).length;
27
+ e.splice(r, 1, n.slice(0, s), n.slice(s));
28
+ }
29
+ }
30
+ return e;
31
+ }
32
+ function ge(t, e) {
33
+ const [r, n, i] = Wt(t, e), s = Vt(e == null ? void 0 : e.locale), l = Xt(e == null ? void 0 : e.locale), u = e != null && e.mergeAmbiguousCharacters ? Ht(s, l) : Gt(s, l);
34
+ return r + n.map(u).join((e == null ? void 0 : e.delimiter) ?? "") + i;
35
+ }
36
+ function Vt(t) {
37
+ return t === !1 ? (e) => e.toLowerCase() : (e) => e.toLocaleLowerCase(t);
38
+ }
39
+ function Xt(t) {
40
+ return t === !1 ? (e) => e.toUpperCase() : (e) => e.toLocaleUpperCase(t);
41
+ }
42
+ function Ht(t, e) {
43
+ return (r) => `${e(r[0])}${t(r.slice(1))}`;
44
+ }
45
+ function Gt(t, e) {
46
+ return (r, n) => {
47
+ const i = r[0];
48
+ return (n > 0 && i >= "0" && i <= "9" ? "_" + i : e(i)) + t(r.slice(1));
49
+ };
50
+ }
51
+ function Wt(t, e = {}) {
52
+ const r = e.split ?? (e.separateNumbers ? $t : Se), n = e.prefixCharacters ?? Oe, i = e.suffixCharacters ?? Oe;
53
+ let s = 0, l = t.length;
54
+ for (; s < t.length; ) {
55
+ const u = t.charAt(s);
56
+ if (!n.includes(u))
57
+ break;
58
+ s++;
59
+ }
60
+ for (; l > s; ) {
61
+ const u = l - 1, Tt = t.charAt(u);
62
+ if (!i.includes(Tt))
63
+ break;
64
+ l = u;
65
+ }
66
+ return [
67
+ t.slice(0, s),
68
+ r(t.slice(s, l)),
69
+ t.slice(l)
70
+ ];
71
+ }
72
+ function fe(t, e = !1) {
73
+ const r = [];
74
+ if (e && t === "")
75
+ return r;
76
+ try {
77
+ const n = JSON.parse(t);
78
+ !e && !Object.keys(n).length && r.push({
79
+ message: "Initial state cannot be empty",
80
+ details: {
81
+ initialState: t
82
+ }
83
+ });
84
+ } catch {
85
+ r.push({
86
+ message: "Invalid initial state",
87
+ details: {
88
+ initialState: t
89
+ }
90
+ });
91
+ }
92
+ return r;
93
+ }
94
+ function be(t, e, r = "", n = !0) {
95
+ const i = [];
96
+ if (!n && !t)
97
+ return i.push({
98
+ message: "State schema is required",
99
+ details: {
100
+ schema: t
101
+ }
102
+ }), i;
103
+ if (n && !t)
104
+ return i;
105
+ const s = `type ${ge(e)}${ge(r)}State`;
106
+ return t.includes(s) || i.push({
107
+ message: `Invalid state schema name. Expected ${s}`,
108
+ details: {
109
+ schema: t
110
+ }
111
+ }), i;
112
+ }
113
+ function _e(t) {
114
+ const e = [];
115
+ t.length || e.push({
116
+ message: "Modules are required",
117
+ details: {
118
+ modules: t
119
+ }
120
+ });
121
+ const r = t.reduce(
122
+ (n, i) => [...n, ...T(i)],
123
+ []
124
+ );
125
+ return [...e, ...r];
126
+ }
127
+ function T(t) {
128
+ const e = [];
129
+ t.name || e.push({
130
+ message: "Module name is required",
131
+ details: {
132
+ module: t
133
+ }
134
+ }), t.operations.length || e.push({
135
+ message: "Module operations are required",
136
+ details: {
137
+ module: t
138
+ }
139
+ });
140
+ const r = t.operations.reduce(
141
+ (n, i) => [...n, ...R(i)],
142
+ []
143
+ );
144
+ return [...e, ...r];
145
+ }
146
+ function R(t) {
147
+ const e = [];
148
+ return t.name || e.push({
149
+ message: "Operation name is required",
150
+ details: {
151
+ operation: t
152
+ }
153
+ }), t.schema || e.push({
154
+ message: "Operation schema is required",
155
+ details: {
156
+ operation: t
157
+ }
158
+ }), e;
159
+ }
160
+ const Bt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
161
+ __proto__: null,
162
+ validateInitialState: fe,
163
+ validateModule: T,
164
+ validateModuleOperation: R,
165
+ validateModules: _e,
166
+ validateStateSchemaName: be
167
+ }, Symbol.toStringTag, { value: "Module" })), Ie = {
168
+ id: "powerhouse/document-model",
169
+ name: "DocumentModel",
170
+ extension: "phdm",
171
+ description: "The Powerhouse Document Model describes the state and operations of a document type.",
172
+ author: {
173
+ name: "Powerhouse",
174
+ website: "https://www.powerhouse.inc/"
175
+ },
176
+ specifications: [
177
+ {
178
+ version: 1,
179
+ changeLog: [],
180
+ modules: [
181
+ {
182
+ name: "header",
183
+ operations: [
184
+ {
185
+ name: "SetModelName",
186
+ id: "",
187
+ description: "",
188
+ schema: "",
189
+ template: "",
190
+ reducer: "",
191
+ examples: [],
192
+ errors: [],
193
+ scope: "global"
194
+ },
195
+ {
196
+ name: "SetModelId",
197
+ id: "",
198
+ description: "",
199
+ schema: "",
200
+ template: "",
201
+ reducer: "",
202
+ examples: [],
203
+ errors: [],
204
+ scope: "global"
205
+ },
206
+ {
207
+ name: "SetModelExtension",
208
+ id: "",
209
+ description: "",
210
+ schema: "",
211
+ template: "",
212
+ reducer: "",
213
+ examples: [],
214
+ errors: [],
215
+ scope: "global"
216
+ },
217
+ {
218
+ name: "SetModelDescription",
219
+ id: "",
220
+ description: "",
221
+ schema: "",
222
+ template: "",
223
+ reducer: "",
224
+ examples: [],
225
+ errors: [],
226
+ scope: "global"
227
+ },
228
+ {
229
+ name: "SetAuthorName",
230
+ id: "",
231
+ description: "",
232
+ schema: "",
233
+ template: "",
234
+ reducer: "",
235
+ examples: [],
236
+ errors: [],
237
+ scope: "global"
238
+ },
239
+ {
240
+ name: "SetAuthorWebsite",
241
+ id: "",
242
+ description: "",
243
+ schema: "",
244
+ template: "",
245
+ reducer: "",
246
+ examples: [],
247
+ errors: [],
248
+ scope: "global"
249
+ }
250
+ ],
251
+ id: "",
252
+ description: ""
253
+ },
254
+ {
255
+ name: "versioning",
256
+ operations: [
257
+ {
258
+ name: "AddChangeLogItem",
259
+ id: "",
260
+ description: "",
261
+ schema: "",
262
+ template: "",
263
+ reducer: "",
264
+ examples: [],
265
+ errors: [],
266
+ scope: "global"
267
+ },
268
+ {
269
+ name: "UpdateChangeLogItem",
270
+ id: "",
271
+ description: "",
272
+ schema: "",
273
+ template: "",
274
+ reducer: "",
275
+ examples: [],
276
+ errors: [],
277
+ scope: "global"
278
+ },
279
+ {
280
+ name: "DeleteChangeLogItem",
281
+ id: "",
282
+ description: "",
283
+ schema: "",
284
+ template: "",
285
+ reducer: "",
286
+ examples: [],
287
+ errors: [],
288
+ scope: "global"
289
+ },
290
+ {
291
+ name: "ReorderChangeLogItems",
292
+ id: "",
293
+ description: "",
294
+ schema: "",
295
+ template: "",
296
+ reducer: "",
297
+ examples: [],
298
+ errors: [],
299
+ scope: "global"
300
+ },
301
+ {
302
+ name: "ReleaseNewVersion",
303
+ schema: null,
304
+ id: "",
305
+ description: "",
306
+ template: "",
307
+ reducer: "",
308
+ examples: [],
309
+ errors: [],
310
+ scope: "global"
311
+ }
312
+ ],
313
+ id: "",
314
+ description: ""
315
+ },
316
+ {
317
+ name: "module",
318
+ operations: [
319
+ {
320
+ name: "AddModule",
321
+ id: "",
322
+ description: "",
323
+ schema: "",
324
+ template: "",
325
+ reducer: "",
326
+ examples: [],
327
+ errors: [],
328
+ scope: "global"
329
+ },
330
+ {
331
+ name: "SetModuleName",
332
+ id: "",
333
+ description: "",
334
+ schema: "",
335
+ template: "",
336
+ reducer: "",
337
+ examples: [],
338
+ errors: [],
339
+ scope: "global"
340
+ },
341
+ {
342
+ name: "SetModuleDescription",
343
+ id: "",
344
+ description: "",
345
+ schema: "",
346
+ template: "",
347
+ reducer: "",
348
+ examples: [],
349
+ errors: [],
350
+ scope: "global"
351
+ },
352
+ {
353
+ name: "DeleteModule",
354
+ id: "",
355
+ description: "",
356
+ schema: "",
357
+ template: "",
358
+ reducer: "",
359
+ examples: [],
360
+ errors: [],
361
+ scope: "global"
362
+ },
363
+ {
364
+ name: "ReorderModules",
365
+ id: "",
366
+ description: "",
367
+ schema: "",
368
+ template: "",
369
+ reducer: "",
370
+ examples: [],
371
+ errors: [],
372
+ scope: "global"
373
+ }
374
+ ],
375
+ id: "",
376
+ description: ""
377
+ },
378
+ {
379
+ name: "operation-error",
380
+ operations: [
381
+ {
382
+ name: "AddOperationError",
383
+ id: "",
384
+ description: "",
385
+ schema: "",
386
+ template: "",
387
+ reducer: "",
388
+ examples: [],
389
+ errors: [],
390
+ scope: "global"
391
+ },
392
+ {
393
+ name: "SetOperationErrorCode",
394
+ id: "",
395
+ description: "",
396
+ schema: "",
397
+ template: "",
398
+ reducer: "",
399
+ examples: [],
400
+ errors: [],
401
+ scope: "global"
402
+ },
403
+ {
404
+ name: "SetOperationErrorName",
405
+ id: "",
406
+ description: "",
407
+ schema: "",
408
+ template: "",
409
+ reducer: "",
410
+ examples: [],
411
+ errors: [],
412
+ scope: "global"
413
+ },
414
+ {
415
+ name: "SetOperationErrorDescription",
416
+ id: "",
417
+ description: "",
418
+ schema: "",
419
+ template: "",
420
+ reducer: "",
421
+ examples: [],
422
+ errors: [],
423
+ scope: "global"
424
+ },
425
+ {
426
+ name: "SetOperationErrorTemplate",
427
+ id: "",
428
+ description: "",
429
+ schema: "",
430
+ template: "",
431
+ reducer: "",
432
+ examples: [],
433
+ errors: [],
434
+ scope: "global"
435
+ },
436
+ {
437
+ name: "DeleteOperationError",
438
+ id: "",
439
+ description: "",
440
+ schema: "",
441
+ template: "",
442
+ reducer: "",
443
+ examples: [],
444
+ errors: [],
445
+ scope: "global"
446
+ },
447
+ {
448
+ name: "ReorderOperationErrors",
449
+ id: "",
450
+ description: "",
451
+ schema: "",
452
+ template: "",
453
+ reducer: "",
454
+ examples: [],
455
+ errors: [],
456
+ scope: "global"
457
+ }
458
+ ],
459
+ id: "",
460
+ description: ""
461
+ },
462
+ {
463
+ name: "operation-example",
464
+ operations: [
465
+ {
466
+ name: "AddOperationExample",
467
+ id: "",
468
+ description: "",
469
+ schema: "",
470
+ template: "",
471
+ reducer: "",
472
+ examples: [],
473
+ errors: [],
474
+ scope: "global"
475
+ },
476
+ {
477
+ name: "UpdateOperationExample",
478
+ id: "",
479
+ description: "",
480
+ schema: "",
481
+ template: "",
482
+ reducer: "",
483
+ examples: [],
484
+ errors: [],
485
+ scope: "global"
486
+ },
487
+ {
488
+ name: "DeleteOperationExample",
489
+ id: "",
490
+ description: "",
491
+ schema: "",
492
+ template: "",
493
+ reducer: "",
494
+ examples: [],
495
+ errors: [],
496
+ scope: "global"
497
+ },
498
+ {
499
+ name: "ReorderOperationExamples",
500
+ id: "",
501
+ description: "",
502
+ schema: "",
503
+ template: "",
504
+ reducer: "",
505
+ examples: [],
506
+ errors: [],
507
+ scope: "global"
508
+ }
509
+ ],
510
+ id: "",
511
+ description: ""
512
+ },
513
+ {
514
+ name: "operation",
515
+ operations: [
516
+ {
517
+ name: "AddOperation",
518
+ id: "",
519
+ description: "",
520
+ schema: "",
521
+ template: "",
522
+ reducer: "",
523
+ examples: [],
524
+ errors: [],
525
+ scope: "global"
526
+ },
527
+ {
528
+ name: "SetOperationName",
529
+ id: "",
530
+ description: "",
531
+ schema: "",
532
+ template: "",
533
+ reducer: "",
534
+ examples: [],
535
+ errors: [],
536
+ scope: "global"
537
+ },
538
+ {
539
+ name: "SetOperationSchema",
540
+ id: "",
541
+ description: "",
542
+ schema: "",
543
+ template: "",
544
+ reducer: "",
545
+ examples: [],
546
+ errors: [],
547
+ scope: "global"
548
+ },
549
+ {
550
+ name: "SetOperationDescription",
551
+ id: "",
552
+ description: "",
553
+ schema: "",
554
+ template: "",
555
+ reducer: "",
556
+ examples: [],
557
+ errors: [],
558
+ scope: "global"
559
+ },
560
+ {
561
+ name: "SetOperationTemplate",
562
+ id: "",
563
+ description: "",
564
+ schema: "",
565
+ template: "",
566
+ reducer: "",
567
+ examples: [],
568
+ errors: [],
569
+ scope: "global"
570
+ },
571
+ {
572
+ name: "SetOperationReducer",
573
+ id: "",
574
+ description: "",
575
+ schema: "",
576
+ template: "",
577
+ reducer: "",
578
+ examples: [],
579
+ errors: [],
580
+ scope: "global"
581
+ },
582
+ {
583
+ name: "MoveOperation",
584
+ id: "",
585
+ description: "",
586
+ schema: "",
587
+ template: "",
588
+ reducer: "",
589
+ examples: [],
590
+ errors: [],
591
+ scope: "global"
592
+ },
593
+ {
594
+ name: "DeleteOperation",
595
+ id: "",
596
+ description: "",
597
+ schema: "",
598
+ template: "",
599
+ reducer: "",
600
+ examples: [],
601
+ errors: [],
602
+ scope: "global"
603
+ },
604
+ {
605
+ name: "ReorderModuleOperations",
606
+ id: "",
607
+ description: "",
608
+ schema: "",
609
+ template: "",
610
+ reducer: "",
611
+ examples: [],
612
+ errors: [],
613
+ scope: "global"
614
+ }
615
+ ],
616
+ id: "",
617
+ description: ""
618
+ },
619
+ {
620
+ name: "state",
621
+ operations: [
622
+ {
623
+ name: "SetStateSchema",
624
+ id: "",
625
+ description: "",
626
+ schema: "",
627
+ template: "",
628
+ reducer: "",
629
+ examples: [],
630
+ errors: [],
631
+ scope: "global"
632
+ },
633
+ {
634
+ name: "SetInitialState",
635
+ id: "",
636
+ description: "",
637
+ schema: "",
638
+ template: "",
639
+ reducer: "",
640
+ examples: [],
641
+ errors: [],
642
+ scope: "global"
643
+ },
644
+ {
645
+ name: "AddStateExample",
646
+ id: "",
647
+ description: "",
648
+ schema: "",
649
+ template: "",
650
+ reducer: "",
651
+ examples: [],
652
+ errors: [],
653
+ scope: "global"
654
+ },
655
+ {
656
+ name: "UpdateStateExample",
657
+ id: "",
658
+ description: "",
659
+ schema: "",
660
+ template: "",
661
+ reducer: "",
662
+ examples: [],
663
+ errors: [],
664
+ scope: "global"
665
+ },
666
+ {
667
+ name: "DeleteStateExample",
668
+ id: "",
669
+ description: "",
670
+ schema: "",
671
+ template: "",
672
+ reducer: "",
673
+ examples: [],
674
+ errors: [],
675
+ scope: "global"
676
+ },
677
+ {
678
+ name: "ReorderStateExamples",
679
+ id: "",
680
+ description: "",
681
+ schema: "",
682
+ template: "",
683
+ reducer: "",
684
+ examples: [],
685
+ errors: [],
686
+ scope: "global"
687
+ }
688
+ ],
689
+ id: "",
690
+ description: ""
691
+ }
692
+ ],
693
+ state: {
694
+ global: {
695
+ schema: "",
696
+ initialValue: `{
697
+ "id": "",
698
+ "name": "",
699
+ "extension": "",
700
+ "description": "",
701
+ "author": {
702
+ "name": "",
703
+ "website": ""
704
+ },
705
+ "specifications": [
706
+ {
707
+ "version": 1,
708
+ "changeLog": [],
709
+ "state": {
710
+ "schema": "",
711
+ "initialValue": "",
712
+ "examples": []
713
+ },
714
+ "modules": []
715
+ }
716
+ ]
717
+ }`,
718
+ examples: []
719
+ },
720
+ local: {
721
+ schema: "",
722
+ initialValue: "{}",
723
+ examples: []
724
+ }
725
+ }
726
+ }
727
+ ]
728
+ }, Te = (t) => t != null, zt = o.any().refine((t) => Te(t));
729
+ function x() {
730
+ return o.object({
731
+ __typename: o.literal("AddChangeLogItemInput").optional(),
732
+ content: o.string(),
733
+ id: o.string(),
734
+ insertBefore: o.string().nullable()
735
+ });
736
+ }
737
+ function A() {
738
+ return o.object({
739
+ description: o.string().nullish(),
740
+ id: o.string(),
741
+ name: o.string()
742
+ });
743
+ }
744
+ function M() {
745
+ return o.object({
746
+ errorCode: o.string().nullish(),
747
+ errorDescription: o.string().nullish(),
748
+ errorName: o.string().nullish(),
749
+ errorTemplate: o.string().nullish(),
750
+ id: o.string(),
751
+ operationId: o.string()
752
+ });
753
+ }
754
+ function D() {
755
+ return o.object({
756
+ example: o.string(),
757
+ id: o.string(),
758
+ operationId: o.string()
759
+ });
760
+ }
761
+ function N() {
762
+ return o.object({
763
+ description: o.string().nullish(),
764
+ id: o.string(),
765
+ moduleId: o.string(),
766
+ name: o.string(),
767
+ reducer: o.string().nullish(),
768
+ schema: o.string().nullish(),
769
+ template: o.string().nullish(),
770
+ scope: _().nullish()
771
+ });
772
+ }
773
+ function L() {
774
+ return o.object({
775
+ scope: o.string(),
776
+ example: o.string(),
777
+ id: o.string(),
778
+ insertBefore: o.string().nullish()
779
+ });
780
+ }
781
+ function Re() {
782
+ return o.object({
783
+ __typename: o.literal("Author").optional(),
784
+ name: o.string(),
785
+ website: o.string().nullable()
786
+ });
787
+ }
788
+ function P() {
789
+ return o.object({
790
+ __typename: o.literal("CodeExample").optional(),
791
+ id: o.string(),
792
+ value: o.string()
793
+ });
794
+ }
795
+ function C() {
796
+ return o.object({
797
+ __typename: o.literal("DeleteChangeLogItemInput").optional(),
798
+ id: o.string()
799
+ });
800
+ }
801
+ function j() {
802
+ return o.object({
803
+ id: o.string()
804
+ });
805
+ }
806
+ function y() {
807
+ return o.object({
808
+ id: o.string()
809
+ });
810
+ }
811
+ function w() {
812
+ return o.object({
813
+ id: o.string()
814
+ });
815
+ }
816
+ function k() {
817
+ return o.object({
818
+ id: o.string()
819
+ });
820
+ }
821
+ function U() {
822
+ return o.object({
823
+ scope: o.string(),
824
+ id: o.string()
825
+ });
826
+ }
827
+ function _() {
828
+ return o.literal("global").or(o.literal("local"));
829
+ }
830
+ function qt() {
831
+ return o.union([
832
+ x(),
833
+ A(),
834
+ M(),
835
+ D(),
836
+ N(),
837
+ L(),
838
+ C(),
839
+ j(),
840
+ y(),
841
+ w(),
842
+ k(),
843
+ U(),
844
+ v(),
845
+ F(),
846
+ $(),
847
+ V(),
848
+ X(),
849
+ H(),
850
+ G(),
851
+ W(),
852
+ B(),
853
+ z(),
854
+ q(),
855
+ J(),
856
+ K(),
857
+ Q(),
858
+ Y(),
859
+ Z(),
860
+ ee(),
861
+ te(),
862
+ re(),
863
+ oe(),
864
+ ne(),
865
+ ie(),
866
+ se(),
867
+ ae(),
868
+ pe(),
869
+ le(),
870
+ ce(),
871
+ de(),
872
+ ue()
873
+ ]);
874
+ }
875
+ function Jt() {
876
+ return o.object({
877
+ __typename: o.literal("DocumentModelState").optional(),
878
+ author: Re(),
879
+ description: o.string(),
880
+ extension: o.string(),
881
+ id: o.string(),
882
+ name: o.string(),
883
+ specifications: o.array(xe())
884
+ });
885
+ }
886
+ function xe() {
887
+ return o.object({
888
+ __typename: o.literal("DocumentSpecification").optional(),
889
+ changeLog: o.array(o.string()),
890
+ modules: o.array(Ae()),
891
+ state: Le(),
892
+ version: o.number()
893
+ });
894
+ }
895
+ function Ae() {
896
+ return o.object({
897
+ __typename: o.literal("Module").optional(),
898
+ description: o.string().nullable(),
899
+ id: o.string(),
900
+ name: o.string(),
901
+ operations: o.array(Me())
902
+ });
903
+ }
904
+ function v() {
905
+ return o.object({
906
+ newModuleId: o.string(),
907
+ operationId: o.string()
908
+ });
909
+ }
910
+ function Me() {
911
+ return o.object({
912
+ __typename: o.literal("Operation").optional(),
913
+ description: o.string().nullable(),
914
+ errors: o.array(De()),
915
+ examples: o.array(P()),
916
+ id: o.string(),
917
+ name: o.string().nullable(),
918
+ reducer: o.string().nullable(),
919
+ schema: o.string().nullable(),
920
+ template: o.string().nullable(),
921
+ scope: _()
922
+ });
923
+ }
924
+ function De() {
925
+ return o.object({
926
+ __typename: o.literal("OperationError").optional(),
927
+ code: o.string().nullable(),
928
+ description: o.string().nullable(),
929
+ id: o.string(),
930
+ name: o.string().nullable(),
931
+ template: o.string().nullable()
932
+ });
933
+ }
934
+ function F() {
935
+ return o.object({
936
+ __typename: o.literal("ReorderChangeLogItemsInput").optional(),
937
+ order: o.array(o.string())
938
+ });
939
+ }
940
+ function $() {
941
+ return o.object({
942
+ moduleId: o.string(),
943
+ order: o.array(o.string())
944
+ });
945
+ }
946
+ function V() {
947
+ return o.object({
948
+ order: o.array(o.string())
949
+ });
950
+ }
951
+ function X() {
952
+ return o.object({
953
+ operationId: o.string(),
954
+ order: o.array(o.string())
955
+ });
956
+ }
957
+ function H() {
958
+ return o.object({
959
+ operationId: o.string(),
960
+ order: o.array(o.string())
961
+ });
962
+ }
963
+ function G() {
964
+ return o.object({
965
+ scope: o.string(),
966
+ order: o.array(o.string())
967
+ });
968
+ }
969
+ function W() {
970
+ return o.object({
971
+ authorName: o.string()
972
+ });
973
+ }
974
+ function B() {
975
+ return o.object({
976
+ authorWebsite: o.string()
977
+ });
978
+ }
979
+ function z() {
980
+ return o.object({
981
+ scope: o.string(),
982
+ initialValue: o.string()
983
+ });
984
+ }
985
+ function q() {
986
+ return o.object({
987
+ description: o.string()
988
+ });
989
+ }
990
+ function J() {
991
+ return o.object({
992
+ extension: o.string()
993
+ });
994
+ }
995
+ function K() {
996
+ return o.object({
997
+ id: o.string()
998
+ });
999
+ }
1000
+ function Q() {
1001
+ return o.object({
1002
+ name: o.string()
1003
+ });
1004
+ }
1005
+ function Y() {
1006
+ return o.object({
1007
+ description: o.string().nullish(),
1008
+ id: o.string()
1009
+ });
1010
+ }
1011
+ function Z() {
1012
+ return o.object({
1013
+ id: o.string(),
1014
+ name: o.string().nullish()
1015
+ });
1016
+ }
1017
+ function ee() {
1018
+ return o.object({
1019
+ description: o.string().nullish(),
1020
+ id: o.string()
1021
+ });
1022
+ }
1023
+ function te() {
1024
+ return o.object({
1025
+ errorCode: o.string().nullish(),
1026
+ id: o.string()
1027
+ });
1028
+ }
1029
+ function re() {
1030
+ return o.object({
1031
+ errorDescription: o.string().nullish(),
1032
+ id: o.string()
1033
+ });
1034
+ }
1035
+ function oe() {
1036
+ return o.object({
1037
+ errorName: o.string().nullish(),
1038
+ id: o.string()
1039
+ });
1040
+ }
1041
+ function ne() {
1042
+ return o.object({
1043
+ errorTemplate: o.string().nullish(),
1044
+ id: o.string()
1045
+ });
1046
+ }
1047
+ function ie() {
1048
+ return o.object({
1049
+ id: o.string(),
1050
+ name: o.string().nullish()
1051
+ });
1052
+ }
1053
+ function Ne() {
1054
+ return o.object({
1055
+ id: o.string(),
1056
+ scope: _()
1057
+ });
1058
+ }
1059
+ function se() {
1060
+ return o.object({
1061
+ id: o.string(),
1062
+ reducer: o.string().nullish()
1063
+ });
1064
+ }
1065
+ function ae() {
1066
+ return o.object({
1067
+ id: o.string(),
1068
+ schema: o.string().nullish()
1069
+ });
1070
+ }
1071
+ function pe() {
1072
+ return o.object({
1073
+ id: o.string(),
1074
+ template: o.string().nullish()
1075
+ });
1076
+ }
1077
+ function le() {
1078
+ return o.object({
1079
+ scope: o.string(),
1080
+ schema: o.string()
1081
+ });
1082
+ }
1083
+ function I() {
1084
+ return o.object({
1085
+ __typename: o.literal("State").optional(),
1086
+ examples: o.array(P()),
1087
+ initialValue: o.string(),
1088
+ schema: o.string()
1089
+ });
1090
+ }
1091
+ function Le() {
1092
+ return o.object({
1093
+ global: I(),
1094
+ local: I()
1095
+ });
1096
+ }
1097
+ function ce() {
1098
+ return o.object({
1099
+ __typename: o.literal("UpdateChangeLogItemInput").optional(),
1100
+ id: o.string(),
1101
+ newContent: o.string()
1102
+ });
1103
+ }
1104
+ function de() {
1105
+ return o.object({
1106
+ example: o.string(),
1107
+ id: o.string()
1108
+ });
1109
+ }
1110
+ function ue() {
1111
+ return o.object({
1112
+ scope: o.string(),
1113
+ id: o.string(),
1114
+ newExample: o.string()
1115
+ });
1116
+ }
1117
+ const Kt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1118
+ __proto__: null,
1119
+ AddChangeLogItemInputSchema: x,
1120
+ AddModuleInputSchema: A,
1121
+ AddOperationErrorInputSchema: M,
1122
+ AddOperationExampleInputSchema: D,
1123
+ AddOperationInputSchema: N,
1124
+ AddStateExampleInputSchema: L,
1125
+ AuthorSchema: Re,
1126
+ CodeExampleSchema: P,
1127
+ DeleteChangeLogItemInputSchema: C,
1128
+ DeleteModuleInputSchema: j,
1129
+ DeleteOperationErrorInputSchema: y,
1130
+ DeleteOperationExampleInputSchema: w,
1131
+ DeleteOperationInputSchema: k,
1132
+ DeleteStateExampleInputSchema: U,
1133
+ DocumentModelInputSchema: qt,
1134
+ DocumentModelStateSchema: Jt,
1135
+ DocumentSpecificationSchema: xe,
1136
+ ModuleSchema: Ae,
1137
+ MoveOperationInputSchema: v,
1138
+ OperationErrorSchema: De,
1139
+ OperationSchema: Me,
1140
+ OperationScopeSchema: _,
1141
+ ReorderChangeLogItemsInputSchema: F,
1142
+ ReorderModuleOperationsInputSchema: $,
1143
+ ReorderModulesInputSchema: V,
1144
+ ReorderOperationErrorsInputSchema: X,
1145
+ ReorderOperationExamplesInputSchema: H,
1146
+ ReorderStateExamplesInputSchema: G,
1147
+ ScopeStateSchema: Le,
1148
+ SetAuthorNameInputSchema: W,
1149
+ SetAuthorWebsiteInputSchema: B,
1150
+ SetInitialStateInputSchema: z,
1151
+ SetModelDescriptionInputSchema: q,
1152
+ SetModelExtensionInputSchema: J,
1153
+ SetModelIdInputSchema: K,
1154
+ SetModelNameInputSchema: Q,
1155
+ SetModuleDescriptionInputSchema: Y,
1156
+ SetModuleNameInputSchema: Z,
1157
+ SetOperationDescriptionInputSchema: ee,
1158
+ SetOperationErrorCodeInputSchema: te,
1159
+ SetOperationErrorDescriptionInputSchema: re,
1160
+ SetOperationErrorNameInputSchema: oe,
1161
+ SetOperationErrorTemplateInputSchema: ne,
1162
+ SetOperationNameInputSchema: ie,
1163
+ SetOperationReducerInputSchema: se,
1164
+ SetOperationSchemaInputSchema: ae,
1165
+ SetOperationScopeInputSchema: Ne,
1166
+ SetOperationTemplateInputSchema: pe,
1167
+ SetStateSchemaInputSchema: le,
1168
+ StateSchema: I,
1169
+ UpdateChangeLogItemInputSchema: ce,
1170
+ UpdateOperationExampleInputSchema: de,
1171
+ UpdateStateExampleInputSchema: ue,
1172
+ definedNonNullAnySchema: zt,
1173
+ isDefinedNonNullAny: Te
1174
+ }, Symbol.toStringTag, { value: "Module" })), m = {
1175
+ setModelNameOperation(t, e) {
1176
+ t.name = e.input.name;
1177
+ },
1178
+ setModelIdOperation(t, e) {
1179
+ t.id = e.input.id;
1180
+ },
1181
+ setModelExtensionOperation(t, e) {
1182
+ t.extension = e.input.extension;
1183
+ },
1184
+ setModelDescriptionOperation(t, e) {
1185
+ t.description = e.input.description;
1186
+ },
1187
+ setAuthorNameOperation(t, e) {
1188
+ t.author = t.author || { name: "", website: null }, t.author.name = e.input.authorName;
1189
+ },
1190
+ setAuthorWebsiteOperation(t, e) {
1191
+ t.author = t.author || { name: "", website: null }, t.author.website = e.input.authorWebsite;
1192
+ }
1193
+ }, O = {
1194
+ addChangeLogItemOperation(t, e) {
1195
+ throw new Error(
1196
+ 'Reducer "addChangeLogItemOperation" not yet implemented'
1197
+ );
1198
+ },
1199
+ updateChangeLogItemOperation(t, e) {
1200
+ throw new Error(
1201
+ 'Reducer "updateChangeLogItemOperation" not yet implemented'
1202
+ );
1203
+ },
1204
+ deleteChangeLogItemOperation(t, e) {
1205
+ throw new Error(
1206
+ 'Reducer "deleteChangeLogItemOperation" not yet implemented'
1207
+ );
1208
+ },
1209
+ reorderChangeLogItemsOperation(t, e) {
1210
+ throw new Error(
1211
+ 'Reducer "reorderChangeLogItemsOperation" not yet implemented'
1212
+ );
1213
+ },
1214
+ releaseNewVersionOperation(t, e) {
1215
+ throw new Error(
1216
+ 'Reducer "releaseNewVersionOperation" not yet implemented'
1217
+ );
1218
+ }
1219
+ }, Qt = (t) => {
1220
+ const e = {};
1221
+ return t.forEach((r, n) => e[r] = n), (r, n) => (e[n.id] || 999999) - (e[r.id] || 999999);
1222
+ }, g = {
1223
+ addModuleOperation(t, e) {
1224
+ t.specifications[t.specifications.length - 1].modules.push({
1225
+ id: e.input.id,
1226
+ name: e.input.name,
1227
+ description: e.input.description || "",
1228
+ operations: []
1229
+ });
1230
+ },
1231
+ setModuleNameOperation(t, e) {
1232
+ const r = t.specifications[t.specifications.length - 1];
1233
+ for (let n = 0; n < r.modules.length; n++)
1234
+ r.modules[n].id === e.input.id && (r.modules[n].name = e.input.name || "");
1235
+ },
1236
+ setModuleDescriptionOperation(t, e) {
1237
+ const r = t.specifications[t.specifications.length - 1];
1238
+ for (let n = 0; n < r.modules.length; n++)
1239
+ r.modules[n].id === e.input.id && (r.modules[n].description = e.input.description || "");
1240
+ },
1241
+ deleteModuleOperation(t, e) {
1242
+ const r = t.specifications[t.specifications.length - 1];
1243
+ r.modules = r.modules.filter(
1244
+ (n) => n.id != e.input.id
1245
+ );
1246
+ },
1247
+ reorderModulesOperation(t, e) {
1248
+ t.specifications[t.specifications.length - 1].modules.sort(Qt(e.input.order));
1249
+ }
1250
+ }, Yt = (t) => {
1251
+ const e = {};
1252
+ return t.forEach((r, n) => e[r] = n), (r, n) => (e[n.id] || 999999) - (e[r.id] || 999999);
1253
+ }, d = {
1254
+ addOperationErrorOperation(t, e) {
1255
+ const r = t.specifications[t.specifications.length - 1];
1256
+ for (let n = 0; n < r.modules.length; n++)
1257
+ for (let i = 0; i < r.modules[n].operations.length; i++)
1258
+ r.modules[n].operations[i].id == e.input.operationId && r.modules[n].operations[i].errors.push({
1259
+ id: e.input.id,
1260
+ name: e.input.errorName || "",
1261
+ code: e.input.errorCode || "",
1262
+ description: e.input.errorDescription || "",
1263
+ template: e.input.errorTemplate || ""
1264
+ });
1265
+ },
1266
+ setOperationErrorCodeOperation(t, e) {
1267
+ const r = t.specifications[t.specifications.length - 1];
1268
+ for (let n = 0; n < r.modules.length; n++)
1269
+ for (let i = 0; i < r.modules[n].operations.length; i++)
1270
+ for (let s = 0; s < r.modules[n].operations[i].errors.length; s++)
1271
+ r.modules[n].operations[i].errors[s].id == e.input.id && (r.modules[n].operations[i].errors[s].code = e.input.errorCode || "");
1272
+ },
1273
+ setOperationErrorNameOperation(t, e) {
1274
+ const r = t.specifications[t.specifications.length - 1];
1275
+ for (let n = 0; n < r.modules.length; n++)
1276
+ for (let i = 0; i < r.modules[n].operations.length; i++)
1277
+ for (let s = 0; s < r.modules[n].operations[i].errors.length; s++)
1278
+ r.modules[n].operations[i].errors[s].id == e.input.id && (r.modules[n].operations[i].errors[s].name = e.input.errorName || "");
1279
+ },
1280
+ setOperationErrorDescriptionOperation(t, e) {
1281
+ const r = t.specifications[t.specifications.length - 1];
1282
+ for (let n = 0; n < r.modules.length; n++)
1283
+ for (let i = 0; i < r.modules[n].operations.length; i++)
1284
+ for (let s = 0; s < r.modules[n].operations[i].errors.length; s++)
1285
+ r.modules[n].operations[i].errors[s].id == e.input.id && (r.modules[n].operations[i].errors[s].description = e.input.errorDescription || "");
1286
+ },
1287
+ setOperationErrorTemplateOperation(t, e) {
1288
+ const r = t.specifications[t.specifications.length - 1];
1289
+ for (let n = 0; n < r.modules.length; n++)
1290
+ for (let i = 0; i < r.modules[n].operations.length; i++)
1291
+ for (let s = 0; s < r.modules[n].operations[i].errors.length; s++)
1292
+ r.modules[n].operations[i].errors[s].id == e.input.id && (r.modules[n].operations[i].errors[s].template = e.input.errorTemplate || "");
1293
+ },
1294
+ deleteOperationErrorOperation(t, e) {
1295
+ const r = t.specifications[t.specifications.length - 1];
1296
+ for (let n = 0; n < r.modules.length; n++)
1297
+ for (let i = 0; i < r.modules[n].operations.length; i++)
1298
+ r.modules[n].operations[i].errors = r.modules[n].operations[i].errors.filter((s) => s.id != e.input.id);
1299
+ },
1300
+ reorderOperationErrorsOperation(t, e) {
1301
+ const r = t.specifications[t.specifications.length - 1];
1302
+ for (let n = 0; n < r.modules.length; n++)
1303
+ for (let i = 0; i < r.modules[n].operations.length; i++)
1304
+ r.modules[n].operations[i].id == e.input.operationId && r.modules[n].operations[i].errors.sort(
1305
+ Yt(e.input.order)
1306
+ );
1307
+ }
1308
+ }, Zt = (t) => {
1309
+ const e = {};
1310
+ return t.forEach((r, n) => e[r] = n), (r, n) => (e[n.id] || 999999) - (e[r.id] || 999999);
1311
+ }, b = {
1312
+ addOperationExampleOperation(t, e) {
1313
+ const r = t.specifications[t.specifications.length - 1];
1314
+ for (let n = 0; n < r.modules.length; n++)
1315
+ for (let i = 0; i < r.modules[n].operations.length; i++)
1316
+ r.modules[n].operations[i].id == e.input.operationId && r.modules[n].operations[i].examples.push({
1317
+ id: e.input.id,
1318
+ value: e.input.example
1319
+ });
1320
+ },
1321
+ updateOperationExampleOperation(t, e) {
1322
+ const r = t.specifications[t.specifications.length - 1];
1323
+ for (let n = 0; n < r.modules.length; n++)
1324
+ for (let i = 0; i < r.modules[n].operations.length; i++)
1325
+ for (let s = 0; s < r.modules[n].operations[i].examples.length; s++)
1326
+ r.modules[n].operations[i].examples[s].id == e.input.id && (r.modules[n].operations[i].examples[s].value = e.input.example);
1327
+ },
1328
+ deleteOperationExampleOperation(t, e) {
1329
+ const r = t.specifications[t.specifications.length - 1];
1330
+ for (let n = 0; n < r.modules.length; n++)
1331
+ for (let i = 0; i < r.modules[n].operations.length; i++)
1332
+ r.modules[n].operations[i].examples = r.modules[n].operations[i].examples.filter(
1333
+ (s) => s.id != e.input.id
1334
+ );
1335
+ },
1336
+ reorderOperationExamplesOperation(t, e) {
1337
+ const r = t.specifications[t.specifications.length - 1];
1338
+ for (let n = 0; n < r.modules.length; n++)
1339
+ for (let i = 0; i < r.modules[n].operations.length; i++)
1340
+ r.modules[n].operations[i].id == e.input.operationId && r.modules[n].operations[i].examples.sort(
1341
+ Zt(e.input.order)
1342
+ );
1343
+ }
1344
+ }, er = (t) => {
1345
+ const e = {};
1346
+ return t.forEach((r, n) => e[r] = n), (r, n) => (e[n.id] || 999999) - (e[r.id] || 999999);
1347
+ }, p = {
1348
+ addOperationOperation(t, e) {
1349
+ const r = t.specifications[t.specifications.length - 1];
1350
+ for (let n = 0; n < r.modules.length; n++)
1351
+ r.modules[n].id == e.input.moduleId && r.modules[n].operations.push({
1352
+ id: e.input.id,
1353
+ name: e.input.name,
1354
+ description: e.input.description || "",
1355
+ schema: e.input.schema || "",
1356
+ template: e.input.template || e.input.description || "",
1357
+ reducer: e.input.reducer || "",
1358
+ errors: [],
1359
+ examples: [],
1360
+ scope: e.input.scope || "global"
1361
+ });
1362
+ },
1363
+ setOperationNameOperation(t, e) {
1364
+ const r = t.specifications[t.specifications.length - 1];
1365
+ for (let n = 0; n < r.modules.length; n++)
1366
+ for (let i = 0; i < r.modules[n].operations.length; i++)
1367
+ r.modules[n].operations[i].id == e.input.id && (r.modules[n].operations[i].name = e.input.name || "");
1368
+ },
1369
+ setOperationScopeOperation(t, e) {
1370
+ const r = t.specifications[t.specifications.length - 1];
1371
+ for (let n = 0; n < r.modules.length; n++)
1372
+ for (let i = 0; i < r.modules[n].operations.length; i++)
1373
+ r.modules[n].operations[i].id == e.input.id && (r.modules[n].operations[i].scope = e.input.scope || "global");
1374
+ },
1375
+ setOperationSchemaOperation(t, e) {
1376
+ const r = t.specifications[t.specifications.length - 1];
1377
+ for (let n = 0; n < r.modules.length; n++)
1378
+ for (let i = 0; i < r.modules[n].operations.length; i++)
1379
+ r.modules[n].operations[i].id == e.input.id && (r.modules[n].operations[i].schema = e.input.schema || "");
1380
+ },
1381
+ setOperationDescriptionOperation(t, e) {
1382
+ const r = t.specifications[t.specifications.length - 1];
1383
+ for (let n = 0; n < r.modules.length; n++)
1384
+ for (let i = 0; i < r.modules[n].operations.length; i++)
1385
+ r.modules[n].operations[i].id == e.input.id && (r.modules[n].operations[i].description = e.input.description || "");
1386
+ },
1387
+ setOperationTemplateOperation(t, e) {
1388
+ const r = t.specifications[t.specifications.length - 1];
1389
+ for (let n = 0; n < r.modules.length; n++)
1390
+ for (let i = 0; i < r.modules[n].operations.length; i++)
1391
+ r.modules[n].operations[i].id == e.input.id && (r.modules[n].operations[i].template = e.input.template || "");
1392
+ },
1393
+ setOperationReducerOperation(t, e) {
1394
+ const r = t.specifications[t.specifications.length - 1];
1395
+ for (let n = 0; n < r.modules.length; n++)
1396
+ for (let i = 0; i < r.modules[n].operations.length; i++)
1397
+ r.modules[n].operations[i].id == e.input.id && (r.modules[n].operations[i].reducer = e.input.reducer || "");
1398
+ },
1399
+ moveOperationOperation(t, e) {
1400
+ const r = [], n = t.specifications[t.specifications.length - 1];
1401
+ for (let i = 0; i < n.modules.length; i++)
1402
+ n.modules[i].operations = n.modules[i].operations.filter((s) => s.id == e.input.operationId ? (r.push(s), !1) : !0);
1403
+ for (let i = 0; i < n.modules.length; i++)
1404
+ n.modules[i].id == e.input.newModuleId && n.modules[i].operations.push(...r);
1405
+ },
1406
+ deleteOperationOperation(t, e) {
1407
+ const r = t.specifications[t.specifications.length - 1];
1408
+ for (let n = 0; n < r.modules.length; n++)
1409
+ r.modules[n].operations = r.modules[n].operations.filter((i) => i.id != e.input.id);
1410
+ },
1411
+ reorderModuleOperationsOperation(t, e) {
1412
+ const r = t.specifications[t.specifications.length - 1];
1413
+ for (let n = 0; n < r.modules.length; n++)
1414
+ r.modules[n].id == e.input.moduleId && r.modules[n].operations.sort(
1415
+ er(e.input.order)
1416
+ );
1417
+ }
1418
+ }, tr = (t) => {
1419
+ const e = {};
1420
+ return t.forEach((r, n) => e[r] = n), (r, n) => (e[n.id] || 999999) - (e[r.id] || 999999);
1421
+ }, E = {
1422
+ setStateSchemaOperation(t, e) {
1423
+ const r = t.specifications[t.specifications.length - 1];
1424
+ if (Object.keys(r.state).includes(e.input.scope))
1425
+ r.state[e.input.scope].schema = e.input.schema;
1426
+ else
1427
+ throw new Error(`Invalid scope: ${e.input.scope}`);
1428
+ },
1429
+ setInitialStateOperation(t, e) {
1430
+ const r = t.specifications[t.specifications.length - 1];
1431
+ if (Object.keys(r.state).includes(e.input.scope))
1432
+ r.state[e.input.scope].initialValue = e.input.initialValue;
1433
+ else
1434
+ throw new Error(`Invalid scope: ${e.input.scope}`);
1435
+ },
1436
+ addStateExampleOperation(t, e) {
1437
+ const r = t.specifications[t.specifications.length - 1];
1438
+ if (Object.keys(r.state).includes(e.input.scope))
1439
+ r.state[e.input.scope].examples.push({
1440
+ id: e.input.id,
1441
+ value: e.input.example
1442
+ });
1443
+ else
1444
+ throw new Error(`Invalid scope: ${e.input.scope}`);
1445
+ },
1446
+ updateStateExampleOperation(t, e) {
1447
+ const r = t.specifications[t.specifications.length - 1];
1448
+ if (!Object.keys(r.state).includes(e.input.scope))
1449
+ throw new Error(`Invalid scope: ${e.input.scope}`);
1450
+ const n = r.state[e.input.scope].examples;
1451
+ for (let i = 0; i < n.length; i++)
1452
+ n[i].id == e.input.id && (n[i].value = e.input.newExample);
1453
+ },
1454
+ deleteStateExampleOperation(t, e) {
1455
+ const r = t.specifications[t.specifications.length - 1];
1456
+ if (Object.keys(r.state).includes(e.input.scope))
1457
+ r.state[e.input.scope].examples = r.state[e.input.scope].examples.filter((n) => n.id != e.input.id);
1458
+ else
1459
+ throw new Error(`Invalid scope: ${e.input.scope}`);
1460
+ },
1461
+ reorderStateExamplesOperation(t, e) {
1462
+ const r = t.specifications[t.specifications.length - 1];
1463
+ if (Object.keys(r.state).includes(e.input.scope))
1464
+ r.state[e.input.scope].examples.sort(tr(e.input.order));
1465
+ else
1466
+ throw new Error(`Invalid scope: ${e.input.scope}`);
1467
+ }
1468
+ }, rr = (t, e) => {
1469
+ if (Mt(e))
1470
+ return t;
1471
+ switch (e.type) {
1472
+ case "SET_MODEL_NAME":
1473
+ Q().parse(e.input), m.setModelNameOperation(t.global, e);
1474
+ break;
1475
+ case "SET_MODEL_ID":
1476
+ K().parse(e.input), m.setModelIdOperation(t.global, e);
1477
+ break;
1478
+ case "SET_MODEL_EXTENSION":
1479
+ J().parse(e.input), m.setModelExtensionOperation(t.global, e);
1480
+ break;
1481
+ case "SET_MODEL_DESCRIPTION":
1482
+ q().parse(e.input), m.setModelDescriptionOperation(t.global, e);
1483
+ break;
1484
+ case "SET_AUTHOR_NAME":
1485
+ W().parse(e.input), m.setAuthorNameOperation(t.global, e);
1486
+ break;
1487
+ case "SET_AUTHOR_WEBSITE":
1488
+ B().parse(e.input), m.setAuthorWebsiteOperation(t.global, e);
1489
+ break;
1490
+ case "ADD_CHANGE_LOG_ITEM":
1491
+ x().parse(e.input), O.addChangeLogItemOperation(t.global, e);
1492
+ break;
1493
+ case "UPDATE_CHANGE_LOG_ITEM":
1494
+ ce().parse(e.input), O.updateChangeLogItemOperation(
1495
+ t.global,
1496
+ e
1497
+ );
1498
+ break;
1499
+ case "DELETE_CHANGE_LOG_ITEM":
1500
+ C().parse(e.input), O.deleteChangeLogItemOperation(
1501
+ t.global,
1502
+ e
1503
+ );
1504
+ break;
1505
+ case "REORDER_CHANGE_LOG_ITEMS":
1506
+ F().parse(e.input), O.reorderChangeLogItemsOperation(
1507
+ t.global,
1508
+ e
1509
+ );
1510
+ break;
1511
+ case "RELEASE_NEW_VERSION":
1512
+ if (Object.keys(e.input).length > 0)
1513
+ throw new Error(
1514
+ "Expected empty input for action RELEASE_NEW_VERSION"
1515
+ );
1516
+ O.releaseNewVersionOperation(t.global, e);
1517
+ break;
1518
+ case "ADD_MODULE":
1519
+ A().parse(e.input), g.addModuleOperation(t.global, e);
1520
+ break;
1521
+ case "SET_MODULE_NAME":
1522
+ Z().parse(e.input), g.setModuleNameOperation(t.global, e);
1523
+ break;
1524
+ case "SET_MODULE_DESCRIPTION":
1525
+ Y().parse(e.input), g.setModuleDescriptionOperation(t.global, e);
1526
+ break;
1527
+ case "DELETE_MODULE":
1528
+ j().parse(e.input), g.deleteModuleOperation(t.global, e);
1529
+ break;
1530
+ case "REORDER_MODULES":
1531
+ V().parse(e.input), g.reorderModulesOperation(t.global, e);
1532
+ break;
1533
+ case "ADD_OPERATION_ERROR":
1534
+ M().parse(e.input), d.addOperationErrorOperation(
1535
+ t.global,
1536
+ e
1537
+ );
1538
+ break;
1539
+ case "SET_OPERATION_ERROR_CODE":
1540
+ te().parse(e.input), d.setOperationErrorCodeOperation(
1541
+ t.global,
1542
+ e
1543
+ );
1544
+ break;
1545
+ case "SET_OPERATION_ERROR_NAME":
1546
+ oe().parse(e.input), d.setOperationErrorNameOperation(
1547
+ t.global,
1548
+ e
1549
+ );
1550
+ break;
1551
+ case "SET_OPERATION_ERROR_DESCRIPTION":
1552
+ re().parse(e.input), d.setOperationErrorDescriptionOperation(
1553
+ t.global,
1554
+ e
1555
+ );
1556
+ break;
1557
+ case "SET_OPERATION_ERROR_TEMPLATE":
1558
+ ne().parse(e.input), d.setOperationErrorTemplateOperation(
1559
+ t.global,
1560
+ e
1561
+ );
1562
+ break;
1563
+ case "DELETE_OPERATION_ERROR":
1564
+ y().parse(e.input), d.deleteOperationErrorOperation(
1565
+ t.global,
1566
+ e
1567
+ );
1568
+ break;
1569
+ case "REORDER_OPERATION_ERRORS":
1570
+ X().parse(e.input), d.reorderOperationErrorsOperation(
1571
+ t.global,
1572
+ e
1573
+ );
1574
+ break;
1575
+ case "ADD_OPERATION_EXAMPLE":
1576
+ D().parse(e.input), b.addOperationExampleOperation(
1577
+ t.global,
1578
+ e
1579
+ );
1580
+ break;
1581
+ case "UPDATE_OPERATION_EXAMPLE":
1582
+ de().parse(e.input), b.updateOperationExampleOperation(
1583
+ t.global,
1584
+ e
1585
+ );
1586
+ break;
1587
+ case "DELETE_OPERATION_EXAMPLE":
1588
+ w().parse(e.input), b.deleteOperationExampleOperation(
1589
+ t.global,
1590
+ e
1591
+ );
1592
+ break;
1593
+ case "REORDER_OPERATION_EXAMPLES":
1594
+ H().parse(e.input), b.reorderOperationExamplesOperation(
1595
+ t.global,
1596
+ e
1597
+ );
1598
+ break;
1599
+ case "ADD_OPERATION":
1600
+ N().parse(e.input), p.addOperationOperation(t.global, e);
1601
+ break;
1602
+ case "SET_OPERATION_NAME":
1603
+ ie().parse(e.input), p.setOperationNameOperation(t.global, e);
1604
+ break;
1605
+ case "SET_OPERATION_SCOPE":
1606
+ Ne().parse(e.input), p.setOperationScopeOperation(t.global, e);
1607
+ break;
1608
+ case "SET_OPERATION_SCHEMA":
1609
+ ae().parse(e.input), p.setOperationSchemaOperation(t.global, e);
1610
+ break;
1611
+ case "SET_OPERATION_DESCRIPTION":
1612
+ ee().parse(e.input), p.setOperationDescriptionOperation(
1613
+ t.global,
1614
+ e
1615
+ );
1616
+ break;
1617
+ case "SET_OPERATION_TEMPLATE":
1618
+ pe().parse(e.input), p.setOperationTemplateOperation(
1619
+ t.global,
1620
+ e
1621
+ );
1622
+ break;
1623
+ case "SET_OPERATION_REDUCER":
1624
+ se().parse(e.input), p.setOperationReducerOperation(t.global, e);
1625
+ break;
1626
+ case "MOVE_OPERATION":
1627
+ v().parse(e.input), p.moveOperationOperation(t.global, e);
1628
+ break;
1629
+ case "DELETE_OPERATION":
1630
+ k().parse(e.input), p.deleteOperationOperation(t.global, e);
1631
+ break;
1632
+ case "REORDER_MODULE_OPERATIONS":
1633
+ $().parse(e.input), p.reorderModuleOperationsOperation(
1634
+ t.global,
1635
+ e
1636
+ );
1637
+ break;
1638
+ case "SET_STATE_SCHEMA":
1639
+ le().parse(e.input), E.setStateSchemaOperation(t.global, e);
1640
+ break;
1641
+ case "SET_INITIAL_STATE":
1642
+ z().parse(e.input), E.setInitialStateOperation(t.global, e);
1643
+ break;
1644
+ case "ADD_STATE_EXAMPLE":
1645
+ L().parse(e.input), E.addStateExampleOperation(t.global, e);
1646
+ break;
1647
+ case "UPDATE_STATE_EXAMPLE":
1648
+ ue().parse(e.input), E.updateStateExampleOperation(t.global, e);
1649
+ break;
1650
+ case "DELETE_STATE_EXAMPLE":
1651
+ U().parse(e.input), E.deleteStateExampleOperation(t.global, e);
1652
+ break;
1653
+ case "REORDER_STATE_EXAMPLES":
1654
+ G().parse(e.input), E.reorderStateExamplesOperation(t.global, e);
1655
+ break;
1656
+ default:
1657
+ return t;
1658
+ }
1659
+ }, f = At(rr), or = {
1660
+ id: "",
1661
+ name: "",
1662
+ extension: "",
1663
+ description: "",
1664
+ author: {
1665
+ name: "",
1666
+ website: ""
1667
+ },
1668
+ specifications: [
1669
+ {
1670
+ version: 1,
1671
+ changeLog: [],
1672
+ state: {
1673
+ global: {
1674
+ schema: "",
1675
+ initialValue: "",
1676
+ examples: []
1677
+ },
1678
+ local: {
1679
+ schema: "",
1680
+ initialValue: "",
1681
+ examples: []
1682
+ }
1683
+ },
1684
+ modules: []
1685
+ }
1686
+ ]
1687
+ }, nr = {}, S = {
1688
+ fileExtension: "phdm",
1689
+ createState(t) {
1690
+ return {
1691
+ global: { ...or, ...t == null ? void 0 : t.global },
1692
+ local: { ...nr, ...t == null ? void 0 : t.local }
1693
+ };
1694
+ },
1695
+ createExtendedState(t) {
1696
+ return Dt(
1697
+ { ...t, documentType: "powerhouse/document-model" },
1698
+ S.createState
1699
+ );
1700
+ },
1701
+ createDocument(t) {
1702
+ return Nt(
1703
+ S.createExtendedState(t),
1704
+ S.createState
1705
+ );
1706
+ },
1707
+ saveToFile(t, e, r) {
1708
+ return Lt(t, e, "phdm", r);
1709
+ },
1710
+ saveToFileHandle(t, e) {
1711
+ return Pt(t, e);
1712
+ },
1713
+ loadFromFile(t) {
1714
+ return Ct(t, f);
1715
+ },
1716
+ loadFromInput(t) {
1717
+ return jt(t, f);
1718
+ }
1719
+ }, Pe = (t) => a(
1720
+ "SET_MODEL_NAME",
1721
+ { ...t }
1722
+ ), Ce = (t) => a(
1723
+ "SET_MODEL_ID",
1724
+ { ...t }
1725
+ ), je = (t) => a(
1726
+ "SET_MODEL_EXTENSION",
1727
+ { ...t }
1728
+ ), ye = (t) => a(
1729
+ "SET_MODEL_DESCRIPTION",
1730
+ { ...t }
1731
+ ), we = (t) => a(
1732
+ "SET_AUTHOR_NAME",
1733
+ { ...t }
1734
+ ), ke = (t) => a(
1735
+ "SET_AUTHOR_WEBSITE",
1736
+ { ...t }
1737
+ );
1738
+ class ir extends c {
1739
+ setModelName(e, r) {
1740
+ return this.dispatch(Pe(e), r);
1741
+ }
1742
+ setModelId(e, r) {
1743
+ return this.dispatch(Ce(e), r);
1744
+ }
1745
+ setModelExtension(e, r) {
1746
+ return this.dispatch(je(e), r);
1747
+ }
1748
+ setModelDescription(e, r) {
1749
+ return this.dispatch(ye(e), r);
1750
+ }
1751
+ setAuthorName(e, r) {
1752
+ return this.dispatch(we(e), r);
1753
+ }
1754
+ setAuthorWebsite(e, r) {
1755
+ return this.dispatch(ke(e), r);
1756
+ }
1757
+ }
1758
+ const Ue = (t) => a(
1759
+ "ADD_CHANGE_LOG_ITEM",
1760
+ { ...t }
1761
+ ), ve = (t) => a(
1762
+ "UPDATE_CHANGE_LOG_ITEM",
1763
+ { ...t }
1764
+ ), Fe = (t) => a(
1765
+ "DELETE_CHANGE_LOG_ITEM",
1766
+ { ...t }
1767
+ ), $e = (t) => a(
1768
+ "REORDER_CHANGE_LOG_ITEMS",
1769
+ { ...t }
1770
+ ), Ve = () => a(
1771
+ "RELEASE_NEW_VERSION"
1772
+ );
1773
+ class sr extends c {
1774
+ addChangeLogItem(e, r) {
1775
+ return this.dispatch(Ue(e), r);
1776
+ }
1777
+ updateChangeLogItem(e, r) {
1778
+ return this.dispatch(ve(e), r);
1779
+ }
1780
+ deleteChangeLogItem(e, r) {
1781
+ return this.dispatch(Fe(e), r);
1782
+ }
1783
+ reorderChangeLogItems(e, r) {
1784
+ return this.dispatch($e(e), r);
1785
+ }
1786
+ releaseNewVersion(e) {
1787
+ return this.dispatch(Ve(), e);
1788
+ }
1789
+ }
1790
+ const Xe = (t) => a(
1791
+ "ADD_MODULE",
1792
+ { ...t }
1793
+ ), He = (t) => a(
1794
+ "SET_MODULE_NAME",
1795
+ { ...t }
1796
+ ), Ge = (t) => a(
1797
+ "SET_MODULE_DESCRIPTION",
1798
+ { ...t }
1799
+ ), We = (t) => a(
1800
+ "DELETE_MODULE",
1801
+ { ...t }
1802
+ ), Be = (t) => a(
1803
+ "REORDER_MODULES",
1804
+ { ...t }
1805
+ );
1806
+ class ar extends c {
1807
+ addModule(e, r) {
1808
+ return this.dispatch(Xe(e), r);
1809
+ }
1810
+ setModuleName(e, r) {
1811
+ return this.dispatch(He(e), r);
1812
+ }
1813
+ setModuleDescription(e, r) {
1814
+ return this.dispatch(Ge(e), r);
1815
+ }
1816
+ deleteModule(e, r) {
1817
+ return this.dispatch(We(e), r);
1818
+ }
1819
+ reorderModules(e, r) {
1820
+ return this.dispatch(Be(e), r);
1821
+ }
1822
+ }
1823
+ const ze = (t) => a(
1824
+ "ADD_OPERATION_ERROR",
1825
+ { ...t }
1826
+ ), qe = (t) => a(
1827
+ "SET_OPERATION_ERROR_CODE",
1828
+ { ...t }
1829
+ ), Je = (t) => a(
1830
+ "SET_OPERATION_ERROR_NAME",
1831
+ { ...t }
1832
+ ), Ke = (t) => a(
1833
+ "SET_OPERATION_ERROR_DESCRIPTION",
1834
+ { ...t }
1835
+ ), Qe = (t) => a(
1836
+ "SET_OPERATION_ERROR_TEMPLATE",
1837
+ { ...t }
1838
+ ), Ye = (t) => a(
1839
+ "DELETE_OPERATION_ERROR",
1840
+ { ...t }
1841
+ ), Ze = (t) => a(
1842
+ "REORDER_OPERATION_ERRORS",
1843
+ { ...t }
1844
+ );
1845
+ class pr extends c {
1846
+ addOperationError(e, r) {
1847
+ return this.dispatch(ze(e), r);
1848
+ }
1849
+ setOperationErrorCode(e, r) {
1850
+ return this.dispatch(qe(e), r);
1851
+ }
1852
+ setOperationErrorName(e, r) {
1853
+ return this.dispatch(Je(e), r);
1854
+ }
1855
+ setOperationErrorDescription(e, r) {
1856
+ return this.dispatch(Ke(e), r);
1857
+ }
1858
+ setOperationErrorTemplate(e, r) {
1859
+ return this.dispatch(Qe(e), r);
1860
+ }
1861
+ deleteOperationError(e, r) {
1862
+ return this.dispatch(Ye(e), r);
1863
+ }
1864
+ reorderOperationErrors(e, r) {
1865
+ return this.dispatch(Ze(e), r);
1866
+ }
1867
+ }
1868
+ const et = (t) => a(
1869
+ "ADD_OPERATION_EXAMPLE",
1870
+ { ...t }
1871
+ ), tt = (t) => a(
1872
+ "UPDATE_OPERATION_EXAMPLE",
1873
+ { ...t }
1874
+ ), rt = (t) => a(
1875
+ "DELETE_OPERATION_EXAMPLE",
1876
+ { ...t }
1877
+ ), ot = (t) => a(
1878
+ "REORDER_OPERATION_EXAMPLES",
1879
+ { ...t }
1880
+ );
1881
+ class lr extends c {
1882
+ addOperationExample(e, r) {
1883
+ return this.dispatch(et(e), r);
1884
+ }
1885
+ updateOperationExample(e, r) {
1886
+ return this.dispatch(tt(e), r);
1887
+ }
1888
+ deleteOperationExample(e, r) {
1889
+ return this.dispatch(rt(e), r);
1890
+ }
1891
+ reorderOperationExamples(e, r) {
1892
+ return this.dispatch(ot(e), r);
1893
+ }
1894
+ }
1895
+ const nt = (t) => a(
1896
+ "ADD_OPERATION",
1897
+ { ...t }
1898
+ ), it = (t) => a(
1899
+ "SET_OPERATION_NAME",
1900
+ { ...t }
1901
+ ), st = (t) => a(
1902
+ "SET_OPERATION_SCOPE",
1903
+ { ...t }
1904
+ ), at = (t) => a(
1905
+ "SET_OPERATION_SCHEMA",
1906
+ { ...t }
1907
+ ), pt = (t) => a(
1908
+ "SET_OPERATION_DESCRIPTION",
1909
+ { ...t }
1910
+ ), lt = (t) => a(
1911
+ "SET_OPERATION_TEMPLATE",
1912
+ { ...t }
1913
+ ), ct = (t) => a(
1914
+ "SET_OPERATION_REDUCER",
1915
+ { ...t }
1916
+ ), dt = (t) => a(
1917
+ "MOVE_OPERATION",
1918
+ { ...t }
1919
+ ), ut = (t) => a(
1920
+ "DELETE_OPERATION",
1921
+ { ...t }
1922
+ ), mt = (t) => a(
1923
+ "REORDER_MODULE_OPERATIONS",
1924
+ { ...t }
1925
+ );
1926
+ class cr extends c {
1927
+ addOperation(e, r) {
1928
+ return this.dispatch(nt(e), r);
1929
+ }
1930
+ setOperationName(e, r) {
1931
+ return this.dispatch(it(e), r);
1932
+ }
1933
+ setOperationScope(e, r) {
1934
+ return this.dispatch(st(e), r);
1935
+ }
1936
+ setOperationSchema(e, r) {
1937
+ return this.dispatch(at(e), r);
1938
+ }
1939
+ setOperationDescription(e, r) {
1940
+ return this.dispatch(pt(e), r);
1941
+ }
1942
+ setOperationTemplate(e, r) {
1943
+ return this.dispatch(lt(e), r);
1944
+ }
1945
+ setOperationReducer(e, r) {
1946
+ return this.dispatch(ct(e), r);
1947
+ }
1948
+ moveOperation(e, r) {
1949
+ return this.dispatch(dt(e), r);
1950
+ }
1951
+ deleteOperation(e, r) {
1952
+ return this.dispatch(ut(e), r);
1953
+ }
1954
+ reorderModuleOperations(e, r) {
1955
+ return this.dispatch(mt(e), r);
1956
+ }
1957
+ }
1958
+ const Et = (t) => a(
1959
+ "SET_STATE_SCHEMA",
1960
+ { ...t }
1961
+ ), ht = (t) => a(
1962
+ "SET_INITIAL_STATE",
1963
+ { ...t }
1964
+ ), Ot = (t) => a(
1965
+ "ADD_STATE_EXAMPLE",
1966
+ { ...t }
1967
+ ), gt = (t) => a(
1968
+ "UPDATE_STATE_EXAMPLE",
1969
+ { ...t }
1970
+ ), St = (t) => a(
1971
+ "DELETE_STATE_EXAMPLE",
1972
+ { ...t }
1973
+ ), ft = (t) => a(
1974
+ "REORDER_STATE_EXAMPLES",
1975
+ { ...t }
1976
+ );
1977
+ class dr extends c {
1978
+ setStateSchema(e, r) {
1979
+ return this.dispatch(Et(e), r);
1980
+ }
1981
+ setInitialState(e, r) {
1982
+ return this.dispatch(ht(e), r);
1983
+ }
1984
+ addStateExample(e, r) {
1985
+ return this.dispatch(Ot(e), r);
1986
+ }
1987
+ updateStateExample(e, r) {
1988
+ return this.dispatch(gt(e), r);
1989
+ }
1990
+ deleteStateExample(e, r) {
1991
+ return this.dispatch(St(e), r);
1992
+ }
1993
+ reorderStateExamples(e, r) {
1994
+ return this.dispatch(ft(e), r);
1995
+ }
1996
+ }
1997
+ var h;
1998
+ let me = (h = class extends c {
1999
+ constructor(e, r) {
2000
+ super(f, S.createDocument(e), r);
2001
+ }
2002
+ saveToFile(e, r) {
2003
+ return super.saveToFile(e, h.fileExtension, r);
2004
+ }
2005
+ loadFromFile(e) {
2006
+ return super.loadFromFile(e);
2007
+ }
2008
+ static async fromFile(e) {
2009
+ const r = new this();
2010
+ return await r.loadFromFile(e), r;
2011
+ }
2012
+ }, Ee(h, "fileExtension", "phdm"), h);
2013
+ yt(me, [
2014
+ ir,
2015
+ sr,
2016
+ ar,
2017
+ pr,
2018
+ lr,
2019
+ cr,
2020
+ dr
2021
+ ]);
2022
+ const ur = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2023
+ __proto__: null,
2024
+ addChangeLogItem: Ue,
2025
+ addModule: Xe,
2026
+ addOperation: nt,
2027
+ addOperationError: ze,
2028
+ addOperationExample: et,
2029
+ addStateExample: Ot,
2030
+ deleteChangeLogItem: Fe,
2031
+ deleteModule: We,
2032
+ deleteOperation: ut,
2033
+ deleteOperationError: Ye,
2034
+ deleteOperationExample: rt,
2035
+ deleteStateExample: St,
2036
+ moveOperation: dt,
2037
+ releaseNewVersion: Ve,
2038
+ reorderChangeLogItems: $e,
2039
+ reorderModuleOperations: mt,
2040
+ reorderModules: Be,
2041
+ reorderOperationErrors: Ze,
2042
+ reorderOperationExamples: ot,
2043
+ reorderStateExamples: ft,
2044
+ setAuthorName: we,
2045
+ setAuthorWebsite: ke,
2046
+ setInitialState: ht,
2047
+ setModelDescription: ye,
2048
+ setModelExtension: je,
2049
+ setModelId: Ce,
2050
+ setModelName: Pe,
2051
+ setModuleDescription: Ge,
2052
+ setModuleName: He,
2053
+ setOperationDescription: pt,
2054
+ setOperationErrorCode: qe,
2055
+ setOperationErrorDescription: Ke,
2056
+ setOperationErrorName: Je,
2057
+ setOperationErrorTemplate: Qe,
2058
+ setOperationName: it,
2059
+ setOperationReducer: ct,
2060
+ setOperationSchema: at,
2061
+ setOperationScope: st,
2062
+ setOperationTemplate: lt,
2063
+ setStateSchema: Et,
2064
+ updateChangeLogItem: ve,
2065
+ updateOperationExample: tt,
2066
+ updateStateExample: gt
2067
+ }, Symbol.toStringTag, { value: "Module" })), bt = me, _t = { ...S, ...Bt }, It = { ...wt, ...ur }, mr = {
2068
+ Document: bt,
2069
+ reducer: f,
2070
+ actions: It,
2071
+ utils: _t,
2072
+ documentModel: Ie
2073
+ }, fr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2074
+ __proto__: null,
2075
+ Document: bt,
2076
+ DocumentModel: me,
2077
+ actions: It,
2078
+ documentModel: Ie,
2079
+ module: mr,
2080
+ reducer: f,
2081
+ utils: _t,
2082
+ validateInitialState: fe,
2083
+ validateModule: T,
2084
+ validateModuleOperation: R,
2085
+ validateModules: _e,
2086
+ validateStateSchemaName: be,
2087
+ z: Kt
2088
+ }, Symbol.toStringTag, { value: "Module" }));
2089
+ export {
2090
+ fr as D,
2091
+ me as a,
2092
+ bt as b,
2093
+ It as c,
2094
+ Ie as d,
2095
+ be as e,
2096
+ _e as f,
2097
+ T as g,
2098
+ R as h,
2099
+ mr as m,
2100
+ f as r,
2101
+ _t as u,
2102
+ fe as v,
2103
+ Kt as z
2104
+ };