@valbuild/core 0.14.0 → 0.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/dist/SelectorProxy-2af1b2b8.cjs.prod.js +756 -0
  2. package/dist/SelectorProxy-63c2d0e2.esm.js +722 -0
  3. package/dist/SelectorProxy-873782a5.cjs.dev.js +756 -0
  4. package/dist/declarations/src/index.d.ts +2 -0
  5. package/dist/declarations/src/initVal.d.ts +1 -1
  6. package/dist/declarations/src/patch/index.d.ts +1 -1
  7. package/dist/declarations/src/patch/util.d.ts +2 -0
  8. package/dist/declarations/src/schema/array.d.ts +3 -2
  9. package/dist/declarations/src/schema/boolean.d.ts +3 -2
  10. package/dist/declarations/src/schema/i18n.d.ts +3 -2
  11. package/dist/declarations/src/schema/image.d.ts +3 -2
  12. package/dist/declarations/src/schema/index.d.ts +5 -2
  13. package/dist/declarations/src/schema/literal.d.ts +3 -2
  14. package/dist/declarations/src/schema/number.d.ts +3 -2
  15. package/dist/declarations/src/schema/object.d.ts +3 -2
  16. package/dist/declarations/src/schema/oneOf.d.ts +3 -2
  17. package/dist/declarations/src/schema/richtext.d.ts +3 -2
  18. package/dist/declarations/src/schema/string.d.ts +3 -2
  19. package/dist/declarations/src/schema/union.d.ts +3 -2
  20. package/dist/declarations/src/schema/validation/ValidationError.d.ts +14 -0
  21. package/dist/declarations/src/schema/validation/ValidationFix.d.ts +2 -0
  22. package/dist/index-2fff5ca8.cjs.dev.js +456 -0
  23. package/dist/{index-06df0a5b.esm.js → index-af761363.esm.js} +2 -555
  24. package/dist/index-cac9ecbd.cjs.prod.js +456 -0
  25. package/dist/ops-1b6e0e35.cjs.prod.js +552 -0
  26. package/dist/ops-74661336.esm.js +541 -0
  27. package/dist/ops-ea4827fc.cjs.dev.js +552 -0
  28. package/dist/valbuild-core.cjs.dev.js +151 -531
  29. package/dist/valbuild-core.cjs.prod.js +151 -531
  30. package/dist/valbuild-core.esm.js +65 -445
  31. package/expr/dist/valbuild-core-expr.cjs.dev.js +8 -8
  32. package/expr/dist/valbuild-core-expr.cjs.prod.js +8 -8
  33. package/expr/dist/valbuild-core-expr.esm.js +2 -2
  34. package/package.json +2 -1
  35. package/patch/dist/valbuild-core-patch.cjs.dev.js +30 -21
  36. package/patch/dist/valbuild-core-patch.cjs.prod.js +30 -21
  37. package/patch/dist/valbuild-core-patch.esm.js +12 -4
  38. package/src/expr/repl.ts +2 -2
  39. package/src/index.ts +5 -0
  40. package/src/initVal.ts +1 -1
  41. package/src/patch/index.ts +1 -0
  42. package/src/patch/util.ts +7 -0
  43. package/src/schema/array.ts +45 -4
  44. package/src/schema/boolean.ts +14 -3
  45. package/src/schema/i18n.ts +4 -2
  46. package/src/schema/image.ts +65 -5
  47. package/src/schema/index.ts +23 -2
  48. package/src/schema/literal.ts +24 -3
  49. package/src/schema/number.ts +14 -3
  50. package/src/schema/object.ts +50 -7
  51. package/src/schema/oneOf.ts +3 -2
  52. package/src/schema/richtext.ts +63 -3
  53. package/src/schema/string.ts +14 -3
  54. package/src/schema/union.ts +3 -2
  55. package/src/schema/validation/ValidationError.ts +16 -0
  56. package/src/schema/validation/ValidationFix.ts +6 -0
  57. package/src/schema/validation.test.ts +226 -0
  58. package/src/selector/SelectorProxy.ts +1 -1
  59. package/dist/createClass-012eebbf.esm.js +0 -109
  60. package/dist/createClass-a436dbfe.cjs.dev.js +0 -116
  61. package/dist/createClass-de7426aa.cjs.prod.js +0 -116
  62. package/dist/index-9663f28a.cjs.dev.js +0 -1037
  63. package/dist/index-b2270f8f.cjs.prod.js +0 -1037
  64. package/dist/ops-6fae92a1.esm.js +0 -12
  65. package/dist/ops-87cdbafc.cjs.dev.js +0 -14
  66. package/dist/ops-ae4d1bc2.cjs.prod.js +0 -14
@@ -0,0 +1,541 @@
1
+ import { _ as _inherits, a as _createSuper, b as _classCallCheck, c as _createClass, f as _typeof, e as _defineProperty, j as _slicedToArray, l as createValPathOfItem, d as _objectSpread2, S as Schema, V as VAL_EXTENSION, n as newSelectorProxy, m as SourceOrExpr, E as Expr, w as _toConsumableArray, I as ImageSchema } from './SelectorProxy-63c2d0e2.esm.js';
2
+ import { _ as _createForOfIteratorHelper } from './result-b96df128.esm.js';
3
+
4
+ var ObjectSchema = /*#__PURE__*/function (_Schema) {
5
+ _inherits(ObjectSchema, _Schema);
6
+ var _super = _createSuper(ObjectSchema);
7
+ function ObjectSchema(items) {
8
+ var _this;
9
+ var opt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
10
+ _classCallCheck(this, ObjectSchema);
11
+ _this = _super.call(this);
12
+ _this.items = items;
13
+ _this.opt = opt;
14
+ return _this;
15
+ }
16
+ _createClass(ObjectSchema, [{
17
+ key: "validate",
18
+ value: function validate(path, src) {
19
+ var _this2 = this;
20
+ var error = false;
21
+ if (this.opt && (src === null || src === undefined)) {
22
+ return false;
23
+ }
24
+ if (_typeof(src) !== "object") {
25
+ return _defineProperty({}, path, [{
26
+ message: "Expected 'object', got '".concat(_typeof(src), "'")
27
+ }]);
28
+ } else if (Array.isArray(src)) {
29
+ return _defineProperty({}, path, [{
30
+ message: "Expected 'object', got 'array'"
31
+ }]);
32
+ }
33
+ Object.entries(this.items).forEach(function (_ref3) {
34
+ var _ref4 = _slicedToArray(_ref3, 2),
35
+ key = _ref4[0],
36
+ schema = _ref4[1];
37
+ var subPath = createValPathOfItem(path, key);
38
+ if (!subPath) {
39
+ error = _this2.appendValidationError(error, path, "Internal error: could not create path at ".concat(!path && typeof path === "string" ? "<empty string>" : path, " at key ").concat(key),
40
+ // Should! never happen
41
+ src);
42
+ } else {
43
+ var subError = schema.validate(subPath, src[key]);
44
+ if (subError && error) {
45
+ error = _objectSpread2(_objectSpread2({}, subError), error);
46
+ } else if (subError) {
47
+ error = subError;
48
+ }
49
+ }
50
+ });
51
+ return error;
52
+ }
53
+ }, {
54
+ key: "assert",
55
+ value: function assert(src) {
56
+ if (this.opt && (src === null || src === undefined)) {
57
+ return true;
58
+ }
59
+ if (!src) {
60
+ return false;
61
+ }
62
+ for (var _i = 0, _Object$entries = Object.entries(this.items); _i < _Object$entries.length; _i++) {
63
+ var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2),
64
+ _key = _Object$entries$_i[0],
65
+ schema = _Object$entries$_i[1];
66
+ if (!schema.assert(src[_key])) {
67
+ return false;
68
+ }
69
+ }
70
+ return _typeof(src) === "object" && !Array.isArray(src);
71
+ }
72
+ }, {
73
+ key: "optional",
74
+ value: function optional() {
75
+ return new ObjectSchema(this.items, true);
76
+ }
77
+ }, {
78
+ key: "serialize",
79
+ value: function serialize() {
80
+ return {
81
+ type: "object",
82
+ items: Object.fromEntries(Object.entries(this.items).map(function (_ref5) {
83
+ var _ref6 = _slicedToArray(_ref5, 2),
84
+ key = _ref6[0],
85
+ schema = _ref6[1];
86
+ return [key, schema.serialize()];
87
+ })),
88
+ opt: this.opt
89
+ };
90
+ }
91
+ }]);
92
+ return ObjectSchema;
93
+ }(Schema);
94
+ var object = function object(schema) {
95
+ return new ObjectSchema(schema);
96
+ };
97
+
98
+ var ArraySchema = /*#__PURE__*/function (_Schema) {
99
+ _inherits(ArraySchema, _Schema);
100
+ var _super = _createSuper(ArraySchema);
101
+ function ArraySchema(item) {
102
+ var _this;
103
+ var opt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
104
+ _classCallCheck(this, ArraySchema);
105
+ _this = _super.call(this);
106
+ _this.item = item;
107
+ _this.opt = opt;
108
+ return _this;
109
+ }
110
+ _createClass(ArraySchema, [{
111
+ key: "validate",
112
+ value: function validate(path, src) {
113
+ var _this2 = this;
114
+ var error = false;
115
+ if (this.opt && (src === null || src === undefined)) {
116
+ return false;
117
+ }
118
+ if (_typeof(src) !== "object" || !Array.isArray(src)) {
119
+ return _defineProperty({}, path, [{
120
+ message: "Expected 'array', got '".concat(_typeof(src), "'")
121
+ }]);
122
+ }
123
+ src.forEach(function (i, idx) {
124
+ var subPath = createValPathOfItem(path, idx);
125
+ if (!subPath) {
126
+ error = _this2.appendValidationError(error, path, "Internal error: could not create path at ".concat(!path && typeof path === "string" ? "<empty string>" : path, " at index ").concat(idx),
127
+ // Should! never happen
128
+ src);
129
+ } else {
130
+ var subError = _this2.item.validate(subPath, i);
131
+ if (subError && error) {
132
+ error = _objectSpread2(_objectSpread2({}, subError), error);
133
+ } else if (subError) {
134
+ error = subError;
135
+ }
136
+ }
137
+ });
138
+ return error;
139
+ }
140
+ }, {
141
+ key: "assert",
142
+ value: function assert(src) {
143
+ if (this.opt && (src === null || src === undefined)) {
144
+ return true;
145
+ }
146
+ if (!src) {
147
+ return false;
148
+ }
149
+ var _iterator = _createForOfIteratorHelper(src),
150
+ _step;
151
+ try {
152
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
153
+ var _item = _step.value;
154
+ if (!this.item.assert(_item)) {
155
+ return false;
156
+ }
157
+ }
158
+ } catch (err) {
159
+ _iterator.e(err);
160
+ } finally {
161
+ _iterator.f();
162
+ }
163
+ return _typeof(src) === "object" && Array.isArray(src);
164
+ }
165
+ }, {
166
+ key: "optional",
167
+ value: function optional() {
168
+ return new ArraySchema(this.item, true);
169
+ }
170
+ }, {
171
+ key: "serialize",
172
+ value: function serialize() {
173
+ return {
174
+ type: "array",
175
+ item: this.item.serialize(),
176
+ opt: this.opt
177
+ };
178
+ }
179
+ }]);
180
+ return ArraySchema;
181
+ }(Schema);
182
+ var array = function array(schema) {
183
+ return new ArraySchema(schema);
184
+ };
185
+
186
+ var I18nSchema = /*#__PURE__*/function (_Schema) {
187
+ _inherits(I18nSchema, _Schema);
188
+ var _super = _createSuper(I18nSchema);
189
+ function I18nSchema(locales, item) {
190
+ var _this;
191
+ var opt = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
192
+ _classCallCheck(this, I18nSchema);
193
+ _this = _super.call(this);
194
+ _this.locales = locales;
195
+ _this.item = item;
196
+ _this.opt = opt;
197
+ return _this;
198
+ }
199
+ _createClass(I18nSchema, [{
200
+ key: "validate",
201
+ value: function validate(path, src) {
202
+ throw new Error("Method not implemented.");
203
+ }
204
+ }, {
205
+ key: "assert",
206
+ value: function assert(src) {
207
+ throw new Error("Method not implemented.");
208
+ }
209
+ }, {
210
+ key: "optional",
211
+ value: function optional() {
212
+ return new I18nSchema(this.locales, this.item, true);
213
+ }
214
+ }, {
215
+ key: "serialize",
216
+ value: function serialize() {
217
+ return {
218
+ type: "i18n",
219
+ item: this.item.serialize(),
220
+ locales: this.locales,
221
+ opt: this.opt
222
+ };
223
+ }
224
+ }]);
225
+ return I18nSchema;
226
+ }(Schema);
227
+ var i18n = function i18n(locales) {
228
+ return function (schema) {
229
+ return new I18nSchema(locales, schema);
230
+ };
231
+ };
232
+
233
+ var UnionSchema = /*#__PURE__*/function (_Schema) {
234
+ _inherits(UnionSchema, _Schema);
235
+ var _super = _createSuper(UnionSchema);
236
+ function UnionSchema(key, items) {
237
+ var _this;
238
+ var opt = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
239
+ _classCallCheck(this, UnionSchema);
240
+ _this = _super.call(this);
241
+ _this.key = key;
242
+ _this.items = items;
243
+ _this.opt = opt;
244
+ return _this;
245
+ }
246
+ _createClass(UnionSchema, [{
247
+ key: "validate",
248
+ value: function validate(path, src) {
249
+ throw new Error("Method not implemented.");
250
+ }
251
+ }, {
252
+ key: "assert",
253
+ value: function assert(src) {
254
+ throw new Error("Method not implemented.");
255
+ }
256
+ }, {
257
+ key: "optional",
258
+ value: function optional() {
259
+ throw new Error("Method not implemented.");
260
+ }
261
+ }, {
262
+ key: "serialize",
263
+ value: function serialize() {
264
+ return {
265
+ type: "union",
266
+ key: this.key,
267
+ items: this.items.map(function (o) {
268
+ return o.serialize();
269
+ }),
270
+ opt: this.opt
271
+ };
272
+ }
273
+ }]);
274
+ return UnionSchema;
275
+ }(Schema);
276
+ var union = function union(key) {
277
+ for (var _len = arguments.length, objects = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
278
+ objects[_key - 1] = arguments[_key];
279
+ }
280
+ return new UnionSchema(key, objects);
281
+ };
282
+
283
+ var RichTextSchema = /*#__PURE__*/function (_Schema) {
284
+ _inherits(RichTextSchema, _Schema);
285
+ var _super = _createSuper(RichTextSchema);
286
+ function RichTextSchema() {
287
+ var _this;
288
+ var opt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
289
+ _classCallCheck(this, RichTextSchema);
290
+ _this = _super.call(this);
291
+ _this.opt = opt;
292
+ return _this;
293
+ }
294
+ _createClass(RichTextSchema, [{
295
+ key: "validate",
296
+ value: function validate(path, src) {
297
+ if (this.opt && (src === null || src === undefined)) {
298
+ return false;
299
+ }
300
+ if (src === null || src === undefined) {
301
+ return _defineProperty({}, path, [{
302
+ message: "Expected non-nullable got '".concat(src, "'")
303
+ }]);
304
+ }
305
+ if (_typeof(src) !== "object" && !Array.isArray(src)) {
306
+ return _defineProperty({}, path, [{
307
+ message: "Expected 'object' (that is not of an array) or 'string', got '".concat(_typeof(src), "'"),
308
+ value: src
309
+ }]);
310
+ }
311
+ if (src[VAL_EXTENSION] !== "richtext") {
312
+ return _defineProperty({}, path, [{
313
+ message: "Expected _type key with value 'richtext' got '".concat(src[VAL_EXTENSION], "'"),
314
+ value: src
315
+ }]);
316
+ }
317
+ if (src.type !== "root") {
318
+ return _defineProperty({}, path, [{
319
+ message: "Expected type key with value 'root' got '".concat(src.type, "'"),
320
+ value: src
321
+ }]);
322
+ }
323
+ if (_typeof(src.children) !== "object" && !Array.isArray(src.children)) {
324
+ return _defineProperty({}, path, [{
325
+ message: "Expected children to be an array, but got '".concat(src.type, "'"),
326
+ value: src
327
+ }]);
328
+ }
329
+ return false;
330
+ }
331
+ }, {
332
+ key: "assert",
333
+ value: function assert(src) {
334
+ // TODO:
335
+ return true;
336
+ }
337
+ }, {
338
+ key: "optional",
339
+ value: function optional() {
340
+ return new RichTextSchema(true);
341
+ }
342
+ }, {
343
+ key: "serialize",
344
+ value: function serialize() {
345
+ return {
346
+ type: "richtext",
347
+ opt: this.opt
348
+ };
349
+ }
350
+ }]);
351
+ return RichTextSchema;
352
+ }(Schema);
353
+ var richtext = function richtext() {
354
+ return new RichTextSchema();
355
+ };
356
+
357
+ function content(
358
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
359
+ id,
360
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
361
+ schema,
362
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
363
+ source) {
364
+ return newSelectorProxy(source, id, schema);
365
+ }
366
+ function getRawSource(valModule) {
367
+ var sourceOrExpr = valModule[SourceOrExpr];
368
+ if (sourceOrExpr instanceof Expr) {
369
+ throw Error("Cannot get raw source of an Expr");
370
+ }
371
+ var source = sourceOrExpr;
372
+ return source;
373
+ }
374
+ function splitModuleIdAndModulePath(path) {
375
+ return [path.slice(0, path.indexOf(".")), path.slice(path.indexOf(".") + 1)];
376
+ }
377
+ function isObjectSchema(schema) {
378
+ return schema instanceof ObjectSchema || _typeof(schema) === "object" && "type" in schema && schema.type === "object";
379
+ }
380
+ function isArraySchema(schema) {
381
+ return schema instanceof ArraySchema || _typeof(schema) === "object" && "type" in schema && schema.type === "array";
382
+ }
383
+ function isI18nSchema(schema) {
384
+ return schema instanceof I18nSchema || _typeof(schema) === "object" && "type" in schema && schema.type === "i18n";
385
+ }
386
+ function isUnionSchema(schema) {
387
+ return schema instanceof UnionSchema || _typeof(schema) === "object" && "type" in schema && schema.type === "union";
388
+ }
389
+
390
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
391
+ function isRichTextSchema(schema) {
392
+ return schema instanceof RichTextSchema || _typeof(schema) === "object" && "type" in schema && schema.type === "richtext";
393
+ }
394
+ function isImageSchema(schema) {
395
+ return schema instanceof ImageSchema || _typeof(schema) === "object" && "type" in schema && schema.type === "image";
396
+ }
397
+ function resolvePath(path, valModule, schema) {
398
+ var parts = parsePath(path);
399
+ var origParts = _toConsumableArray(parts);
400
+ var resolvedSchema = schema;
401
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
402
+ var resolvedSource = valModule;
403
+ var _loop = function _loop() {
404
+ var part = parts.shift();
405
+ if (part === undefined) {
406
+ throw Error("Unexpected undefined part");
407
+ }
408
+ if (isArraySchema(resolvedSchema)) {
409
+ if (Number.isNaN(Number(part))) {
410
+ throw Error("Invalid path: array schema ".concat(resolvedSchema, " must have ").concat(part, " a number as path"));
411
+ }
412
+ if (_typeof(resolvedSource) !== "object" && !Array.isArray(resolvedSource)) {
413
+ throw Error("Schema type error: expected source to be type of array, but got ".concat(_typeof(resolvedSource)));
414
+ }
415
+ if (!resolvedSource[part]) {
416
+ var _resolvedSource;
417
+ throw Error("Invalid path: array source (length: ".concat((_resolvedSource = resolvedSource) === null || _resolvedSource === void 0 ? void 0 : _resolvedSource.length, ") did not have index ").concat(part, " from path: ").concat(path));
418
+ }
419
+ resolvedSource = resolvedSource[part];
420
+ resolvedSchema = resolvedSchema.item;
421
+ } else if (isObjectSchema(resolvedSchema)) {
422
+ if (_typeof(resolvedSource) !== "object") {
423
+ throw Error("Schema type error: expected source to be type of object, but got ".concat(_typeof(resolvedSource)));
424
+ }
425
+ if (!resolvedSource[part]) {
426
+ throw Error("Invalid path: object source did not have key ".concat(part, " from path: ").concat(path));
427
+ }
428
+ resolvedSource = resolvedSource[part];
429
+ resolvedSchema = resolvedSchema.items[part];
430
+ } else if (isI18nSchema(resolvedSchema)) {
431
+ if (!resolvedSchema.locales.includes(part)) {
432
+ throw Error("Invalid path: i18n schema ".concat(resolvedSchema, " supports locales ").concat(resolvedSchema.locales.join(", "), ", but found: ").concat(part));
433
+ }
434
+ if (!Object.keys(resolvedSource).includes(part)) {
435
+ throw Error("Schema type error: expected source to be type of i18n with locale ".concat(part, ", but got ").concat(JSON.stringify(Object.keys(resolvedSource))));
436
+ }
437
+ resolvedSource = resolvedSource[part];
438
+ resolvedSchema = resolvedSchema.item;
439
+ } else if (isImageSchema(resolvedSchema)) {
440
+ return {
441
+ v: {
442
+ path: origParts.slice(0, origParts.length - parts.length - 1).map(function (p) {
443
+ return JSON.stringify(p);
444
+ }).join("."),
445
+ // TODO: create a function generate path from parts (not sure if this always works)
446
+ schema: resolvedSchema,
447
+ source: resolvedSource
448
+ }
449
+ };
450
+ } else if (isUnionSchema(resolvedSchema)) {
451
+ var _key = resolvedSchema.key;
452
+ var keyValue = resolvedSource[_key];
453
+ if (!keyValue) {
454
+ throw Error("Invalid path: union source ".concat(resolvedSchema, " did not have required key ").concat(_key, " in path: ").concat(path));
455
+ }
456
+ var schemaOfUnionKey = resolvedSchema.items.find(
457
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
458
+ function (child) {
459
+ var _child$items, _child$items$_key;
460
+ return (child === null || child === void 0 ? void 0 : (_child$items = child.items) === null || _child$items === void 0 ? void 0 : (_child$items$_key = _child$items[_key]) === null || _child$items$_key === void 0 ? void 0 : _child$items$_key.value) === keyValue;
461
+ });
462
+ if (!schemaOfUnionKey) {
463
+ throw Error("Invalid path: union schema ".concat(resolvedSchema, " did not have a child object with ").concat(_key, " of value ").concat(keyValue, " in path: ").concat(path));
464
+ }
465
+ resolvedSchema = schemaOfUnionKey.items[part];
466
+ resolvedSource = resolvedSource[part];
467
+ } else if (isRichTextSchema(resolvedSchema)) {
468
+ return {
469
+ v: {
470
+ path: origParts.slice(0, origParts.length - parts.length - 1).map(function (p) {
471
+ return JSON.stringify(p);
472
+ }).join("."),
473
+ // TODO: create a function generate path from parts (not sure if this always works)
474
+ schema: resolvedSchema,
475
+ source: resolvedSource
476
+ }
477
+ };
478
+ } else {
479
+ throw Error("Invalid path: ".concat(part, " resolved to an unexpected schema ").concat(JSON.stringify(resolvedSchema)));
480
+ }
481
+ };
482
+ while (parts.length > 0) {
483
+ var _ret = _loop();
484
+ if (_typeof(_ret) === "object") return _ret.v;
485
+ }
486
+ if (parts.length > 0) {
487
+ throw Error("Invalid path: ".concat(parts.join("."), " is not a valid path"));
488
+ }
489
+ return {
490
+ path: path,
491
+ schema: resolvedSchema,
492
+ source: resolvedSource
493
+ };
494
+ }
495
+ function parsePath(input) {
496
+ var result = [];
497
+ var i = 0;
498
+ while (i < input.length) {
499
+ var part = "";
500
+ if (input[i] === '"') {
501
+ // Parse a quoted string
502
+ i++;
503
+ while (i < input.length && input[i] !== '"') {
504
+ if (input[i] === "\\" && input[i + 1] === '"') {
505
+ // Handle escaped double quotes
506
+ part += '"';
507
+ i++;
508
+ } else {
509
+ part += input[i];
510
+ }
511
+ i++;
512
+ }
513
+ if (input[i] !== '"') {
514
+ var _input$i;
515
+ throw new Error("Invalid input (".concat(JSON.stringify(input), "): Missing closing double quote: ").concat((_input$i = input[i]) !== null && _input$i !== void 0 ? _input$i : "at end of string", " (char: ").concat(i, "; length: ").concat(input.length, ")"));
516
+ }
517
+ } else {
518
+ // Parse a regular string
519
+ while (i < input.length && input[i] !== ".") {
520
+ part += input[i];
521
+ i++;
522
+ }
523
+ }
524
+ if (part !== "") {
525
+ result.push(part);
526
+ }
527
+ i++;
528
+ }
529
+ return result;
530
+ }
531
+
532
+ var PatchError = /*#__PURE__*/_createClass(function PatchError(message) {
533
+ _classCallCheck(this, PatchError);
534
+ this.message = message;
535
+ });
536
+
537
+ /**
538
+ * NOTE: MAY mutate the input document.
539
+ */
540
+
541
+ export { PatchError as P, array as a, resolvePath as b, content as c, getRawSource as g, i18n as i, object as o, richtext as r, splitModuleIdAndModulePath as s, union as u };