@valbuild/shared 0.123.0 → 0.123.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.
@@ -3,130 +3,21 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var core = require('@valbuild/core');
6
- var utils = require('../../dist/utils-d3d8b4b5.cjs.dev.js');
6
+ var getSitemapTree = require('../../dist/getSitemapTree-a0c9a0e3.cjs.dev.js');
7
7
  var zod = require('zod');
8
8
  var zodValidationError = require('zod-validation-error');
9
9
  var FlexSearch = require('flexsearch');
10
+ var utils = require('../../dist/utils-d3d8b4b5.cjs.dev.js');
10
11
 
11
12
  function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
12
13
 
13
14
  var FlexSearch__default = /*#__PURE__*/_interopDefault(FlexSearch);
14
15
 
15
- function _toPrimitive(t, r) {
16
- if ("object" != typeof t || !t) return t;
17
- var e = t[Symbol.toPrimitive];
18
- if (void 0 !== e) {
19
- var i = e.call(t, r || "default");
20
- if ("object" != typeof i) return i;
21
- throw new TypeError("@@toPrimitive must return a primitive value.");
22
- }
23
- return ("string" === r ? String : Number)(t);
24
- }
25
-
26
- function _toPropertyKey(t) {
27
- var i = _toPrimitive(t, "string");
28
- return "symbol" == typeof i ? i : i + "";
29
- }
30
-
31
- function _defineProperty(e, r, t) {
32
- return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
33
- value: t,
34
- enumerable: !0,
35
- configurable: !0,
36
- writable: !0
37
- }) : e[r] = t, e;
38
- }
39
-
40
- function ownKeys(e, r) {
41
- var t = Object.keys(e);
42
- if (Object.getOwnPropertySymbols) {
43
- var o = Object.getOwnPropertySymbols(e);
44
- r && (o = o.filter(function (r) {
45
- return Object.getOwnPropertyDescriptor(e, r).enumerable;
46
- })), t.push.apply(t, o);
47
- }
48
- return t;
49
- }
50
- function _objectSpread2(e) {
51
- for (var r = 1; r < arguments.length; r++) {
52
- var t = null != arguments[r] ? arguments[r] : {};
53
- r % 2 ? ownKeys(Object(t), !0).forEach(function (r) {
54
- _defineProperty(e, r, t[r]);
55
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {
56
- Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
57
- });
58
- }
59
- return e;
60
- }
61
-
62
- function _arrayLikeToArray(r, a) {
63
- (null == a || a > r.length) && (a = r.length);
64
- for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
65
- return n;
66
- }
67
-
68
- function _unsupportedIterableToArray(r, a) {
69
- if (r) {
70
- if ("string" == typeof r) return _arrayLikeToArray(r, a);
71
- var t = {}.toString.call(r).slice(8, -1);
72
- return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
73
- }
74
- }
75
-
76
- function _createForOfIteratorHelper(r, e) {
77
- var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
78
- if (!t) {
79
- if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) {
80
- t && (r = t);
81
- var n = 0,
82
- F = function () {};
83
- return {
84
- s: F,
85
- n: function () {
86
- return n >= r.length ? {
87
- done: !0
88
- } : {
89
- done: !1,
90
- value: r[n++]
91
- };
92
- },
93
- e: function (r) {
94
- throw r;
95
- },
96
- f: F
97
- };
98
- }
99
- throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
100
- }
101
- var o,
102
- a = !0,
103
- u = !1;
104
- return {
105
- s: function () {
106
- t = t.call(r);
107
- },
108
- n: function () {
109
- var r = t.next();
110
- return a = r.done, r;
111
- },
112
- e: function (r) {
113
- u = !0, o = r;
114
- },
115
- f: function () {
116
- try {
117
- a || null == t.return || t.return();
118
- } finally {
119
- if (u) throw o;
120
- }
121
- }
122
- };
123
- }
124
-
125
16
  function remirrorToRichTextSource(node, configDirectory, remoteOptions) {
126
17
  var files = {};
127
18
  var blocks = [];
128
19
  var i = 0;
129
- var _iterator = _createForOfIteratorHelper((node === null || node === void 0 ? void 0 : node.content) || []),
20
+ var _iterator = getSitemapTree._createForOfIteratorHelper((node === null || node === void 0 ? void 0 : node.content) || []),
130
21
  _step;
131
22
  try {
132
23
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
@@ -331,7 +222,7 @@ function convertImageNode(path, node, files, configDirectory, remoteOptions) {
331
222
  // file is added as src (see below):
332
223
  .concat("src");
333
224
  var remoteFileHash = core.Internal.remote.hashToRemoteFileHash(fullFileHash);
334
- var ref = remoteOptions ? core.Internal.remote.createRemoteRef(remoteOptions.remoteHost, _objectSpread2(_objectSpread2({}, remoteOptions), {}, {
225
+ var ref = remoteOptions ? core.Internal.remote.createRemoteRef(remoteOptions.remoteHost, getSitemapTree._objectSpread2(getSitemapTree._objectSpread2({}, remoteOptions), {}, {
335
226
  fileHash: remoteFileHash,
336
227
  validationHash: core.Internal.remote.getValidationHash(remoteOptions.coreVersion, remoteOptions.schema, mimeType, {
337
228
  width: typeof node.attrs.width === "number" ? node.attrs.width : 0,
@@ -389,7 +280,7 @@ function convertImageNode(path, node, files, configDirectory, remoteOptions) {
389
280
  }
390
281
  var tag = {
391
282
  tag: "img",
392
- src: _objectSpread2({
283
+ src: getSitemapTree._objectSpread2({
393
284
  path: noParamsUrl,
394
285
  width: typeof node.attrs.width === "number" ? node.attrs.width : 0,
395
286
  height: typeof node.attrs.height === "number" ? node.attrs.height : 0,
@@ -499,7 +390,7 @@ var RemirrorJSON = zod.z.object({
499
390
  });
500
391
 
501
392
  function _arrayWithoutHoles(r) {
502
- if (Array.isArray(r)) return _arrayLikeToArray(r);
393
+ if (Array.isArray(r)) return getSitemapTree._arrayLikeToArray(r);
503
394
  }
504
395
 
505
396
  function _iterableToArray(r) {
@@ -511,7 +402,7 @@ function _nonIterableSpread() {
511
402
  }
512
403
 
513
404
  function _toConsumableArray(r) {
514
- return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread();
405
+ return _arrayWithoutHoles(r) || _iterableToArray(r) || getSitemapTree._unsupportedIterableToArray(r) || _nonIterableSpread();
515
406
  }
516
407
 
517
408
  function richTextToRemirror(richtext) {
@@ -661,7 +552,7 @@ function convertLinkNodeToRemirror(linkNode) {
661
552
  if (remirrorNode.type !== "text") {
662
553
  return remirrorNode;
663
554
  }
664
- return _objectSpread2(_objectSpread2({}, remirrorNode), {}, {
555
+ return getSitemapTree._objectSpread2(getSitemapTree._objectSpread2({}, remirrorNode), {}, {
665
556
  marks: (remirrorNode.marks || []).concat({
666
557
  type: "link",
667
558
  attrs: {
@@ -708,7 +599,7 @@ function convertListItemToRemirror(liNode) {
708
599
  }
709
600
  function convertListItemToRemirrorParagraph(rtChildren) {
710
601
  var children = [];
711
- var _iterator = _createForOfIteratorHelper(rtChildren),
602
+ var _iterator = getSitemapTree._createForOfIteratorHelper(rtChildren),
712
603
  _step;
713
604
  try {
714
605
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
@@ -1543,7 +1434,7 @@ var Api = {
1543
1434
  query: {
1544
1435
  redirect_to: onlyOneStringQueryParam.optional()
1545
1436
  },
1546
- cookies: _defineProperty({}, VAL_SESSION_COOKIE, zod.z.string().optional())
1437
+ cookies: getSitemapTree._defineProperty({}, VAL_SESSION_COOKIE, zod.z.string().optional())
1547
1438
  },
1548
1439
  res: zod.z.union([zod.z.object({
1549
1440
  status: zod.z.literal(401),
@@ -1565,7 +1456,7 @@ var Api = {
1565
1456
  query: {
1566
1457
  redirect_to: onlyOneStringQueryParam.optional()
1567
1458
  },
1568
- cookies: _defineProperty({}, VAL_SESSION_COOKIE, zod.z.string().optional())
1459
+ cookies: getSitemapTree._defineProperty({}, VAL_SESSION_COOKIE, zod.z.string().optional())
1569
1460
  },
1570
1461
  res: zod.z.union([zod.z.object({
1571
1462
  status: zod.z.literal(401),
@@ -1584,7 +1475,7 @@ var Api = {
1584
1475
  "/draft/stat": {
1585
1476
  GET: {
1586
1477
  req: {
1587
- cookies: _defineProperty({}, VAL_SESSION_COOKIE, zod.z.string().optional())
1478
+ cookies: getSitemapTree._defineProperty({}, VAL_SESSION_COOKIE, zod.z.string().optional())
1588
1479
  },
1589
1480
  res: zod.z.union([zod.z.object({
1590
1481
  status: zod.z.literal(401),
@@ -1603,7 +1494,7 @@ var Api = {
1603
1494
  query: {
1604
1495
  redirect_to: onlyOneStringQueryParam.optional()
1605
1496
  },
1606
- cookies: _defineProperty({}, VAL_SESSION_COOKIE, zod.z.string().optional())
1497
+ cookies: getSitemapTree._defineProperty({}, VAL_SESSION_COOKIE, zod.z.string().optional())
1607
1498
  },
1608
1499
  res: zod.z.union([zod.z.object({
1609
1500
  status: zod.z.literal(401),
@@ -1611,7 +1502,7 @@ var Api = {
1611
1502
  }), zod.z.object({
1612
1503
  status: zod.z.literal(302),
1613
1504
  redirectTo: zod.z.string(),
1614
- cookies: zod.z.object(_defineProperty(_defineProperty({}, VAL_ENABLE_COOKIE_NAME, enableCookieValue), VAL_STATE_COOKIE, zod.z.object({
1505
+ cookies: zod.z.object(getSitemapTree._defineProperty(getSitemapTree._defineProperty({}, VAL_ENABLE_COOKIE_NAME, enableCookieValue), VAL_STATE_COOKIE, zod.z.object({
1615
1506
  value: zod.z.string(),
1616
1507
  options: zod.z.object({
1617
1508
  httpOnly: zod.z.literal(true),
@@ -1622,7 +1513,7 @@ var Api = {
1622
1513
  }), zod.z.object({
1623
1514
  status: zod.z.literal(302),
1624
1515
  redirectTo: zod.z.string(),
1625
- cookies: zod.z.object(_defineProperty({}, VAL_ENABLE_COOKIE_NAME, enableCookieValue))
1516
+ cookies: zod.z.object(getSitemapTree._defineProperty({}, VAL_ENABLE_COOKIE_NAME, enableCookieValue))
1626
1517
  }), zod.z.object({
1627
1518
  status: zod.z.literal(400),
1628
1519
  json: zod.z.object({
@@ -1637,7 +1528,7 @@ var Api = {
1637
1528
  query: {
1638
1529
  redirect_to: onlyOneStringQueryParam.optional()
1639
1530
  },
1640
- cookies: _defineProperty({}, VAL_SESSION_COOKIE, zod.z.string().optional())
1531
+ cookies: getSitemapTree._defineProperty({}, VAL_SESSION_COOKIE, zod.z.string().optional())
1641
1532
  },
1642
1533
  res: zod.z.union([zod.z.object({
1643
1534
  status: zod.z.literal(401),
@@ -1645,7 +1536,7 @@ var Api = {
1645
1536
  }), zod.z.object({
1646
1537
  status: zod.z.literal(302),
1647
1538
  redirectTo: zod.z.string(),
1648
- cookies: zod.z.object(_defineProperty({}, VAL_ENABLE_COOKIE_NAME, zod.z.object({
1539
+ cookies: zod.z.object(getSitemapTree._defineProperty({}, VAL_ENABLE_COOKIE_NAME, zod.z.object({
1649
1540
  value: zod.z.literal("false")
1650
1541
  })))
1651
1542
  }), zod.z.object({
@@ -1666,7 +1557,7 @@ var Api = {
1666
1557
  res: zod.z.union([zod.z.object({
1667
1558
  status: zod.z.literal(302),
1668
1559
  redirectTo: zod.z.string(),
1669
- cookies: zod.z.object(_defineProperty(_defineProperty({}, VAL_ENABLE_COOKIE_NAME, enableCookieValue), VAL_STATE_COOKIE, zod.z.object({
1560
+ cookies: zod.z.object(getSitemapTree._defineProperty(getSitemapTree._defineProperty({}, VAL_ENABLE_COOKIE_NAME, enableCookieValue), VAL_STATE_COOKIE, zod.z.object({
1670
1561
  value: zod.z.string(),
1671
1562
  options: zod.z.object({
1672
1563
  httpOnly: zod.z.literal(true),
@@ -1689,12 +1580,12 @@ var Api = {
1689
1580
  code: onlyOneStringQueryParam.optional(),
1690
1581
  state: onlyOneStringQueryParam.optional()
1691
1582
  },
1692
- cookies: _defineProperty({}, VAL_STATE_COOKIE, zod.z.string())
1583
+ cookies: getSitemapTree._defineProperty({}, VAL_STATE_COOKIE, zod.z.string())
1693
1584
  },
1694
1585
  res: zod.z.object({
1695
1586
  status: zod.z.literal(302),
1696
1587
  redirectTo: zod.z.string(),
1697
- cookies: zod.z.object(_defineProperty(_defineProperty(_defineProperty({}, VAL_STATE_COOKIE, zod.z.object({
1588
+ cookies: zod.z.object(getSitemapTree._defineProperty(getSitemapTree._defineProperty(getSitemapTree._defineProperty({}, VAL_STATE_COOKIE, zod.z.object({
1698
1589
  value: zod.z.literal(null)
1699
1590
  })), VAL_ENABLE_COOKIE_NAME, enableCookieValue.optional()), VAL_SESSION_COOKIE, zod.z.object({
1700
1591
  value: zod.z.string(),
@@ -1719,7 +1610,7 @@ var Api = {
1719
1610
  // TODO fix req types
1720
1611
  res: zod.z.union([zod.z.object({
1721
1612
  status: zod.z.literal(200),
1722
- cookies: zod.z.object(_defineProperty(_defineProperty({}, VAL_SESSION_COOKIE, zod.z.object({
1613
+ cookies: zod.z.object(getSitemapTree._defineProperty(getSitemapTree._defineProperty({}, VAL_SESSION_COOKIE, zod.z.object({
1723
1614
  value: zod.z.string(),
1724
1615
  options: zod.z.object({
1725
1616
  httpOnly: zod.z.literal(true),
@@ -1741,7 +1632,7 @@ var Api = {
1741
1632
  }), zod.z.object({
1742
1633
  status: zod.z.literal(302),
1743
1634
  redirectTo: zod.z.string(),
1744
- cookies: zod.z.object(_defineProperty(_defineProperty({}, VAL_SESSION_COOKIE, zod.z.object({
1635
+ cookies: zod.z.object(getSitemapTree._defineProperty(getSitemapTree._defineProperty({}, VAL_SESSION_COOKIE, zod.z.object({
1745
1636
  value: zod.z.string(),
1746
1637
  options: zod.z.object({
1747
1638
  httpOnly: zod.z.literal(true),
@@ -2702,7 +2593,7 @@ var Api = {
2702
2593
  */
2703
2594
  own_patch_groups_only: onlyOneBooleanQueryParam.optional()
2704
2595
  },
2705
- cookies: _defineProperty({}, VAL_SESSION_COOKIE, zod.z.string().optional())
2596
+ cookies: getSitemapTree._defineProperty({}, VAL_SESSION_COOKIE, zod.z.string().optional())
2706
2597
  },
2707
2598
  res: zod.z.union([unauthorizedResponse, notFoundResponse,
2708
2599
  // Shape (1): single `key`.
@@ -2749,7 +2640,7 @@ var Api = {
2749
2640
  "/ai/initialize": {
2750
2641
  POST: {
2751
2642
  req: {
2752
- cookies: _defineProperty({}, VAL_SESSION_COOKIE, zod.z.string().optional())
2643
+ cookies: getSitemapTree._defineProperty({}, VAL_SESSION_COOKIE, zod.z.string().optional())
2753
2644
  },
2754
2645
  res: zod.z.union([unauthorizedResponse, zod.z.object({
2755
2646
  status: zod.z.literal(200),
@@ -2806,7 +2697,7 @@ var Api = {
2806
2697
  cursor_updatedAt: onlyOneStringQueryParam.optional(),
2807
2698
  cursor_id: onlyOneStringQueryParam.optional()
2808
2699
  },
2809
- cookies: _defineProperty({}, VAL_SESSION_COOKIE, zod.z.string().optional())
2700
+ cookies: getSitemapTree._defineProperty({}, VAL_SESSION_COOKIE, zod.z.string().optional())
2810
2701
  },
2811
2702
  res: zod.z.union([unauthorizedResponse, zod.z.object({
2812
2703
  status: zod.z.literal(200),
@@ -2833,7 +2724,7 @@ var Api = {
2833
2724
  body: zod.z.object({
2834
2725
  name: zod.z.string()
2835
2726
  }),
2836
- cookies: _defineProperty({}, VAL_SESSION_COOKIE, zod.z.string().optional())
2727
+ cookies: getSitemapTree._defineProperty({}, VAL_SESSION_COOKIE, zod.z.string().optional())
2837
2728
  },
2838
2729
  res: zod.z.union([unauthorizedResponse, zod.z.object({
2839
2730
  status: zod.z.literal(200),
@@ -2853,7 +2744,7 @@ var Api = {
2853
2744
  cursor_updatedAt: onlyOneStringQueryParam.optional(),
2854
2745
  cursor_id: onlyOneStringQueryParam.optional()
2855
2746
  },
2856
- cookies: _defineProperty({}, VAL_SESSION_COOKIE, zod.z.string().optional())
2747
+ cookies: getSitemapTree._defineProperty({}, VAL_SESSION_COOKIE, zod.z.string().optional())
2857
2748
  },
2858
2749
  res: zod.z.union([unauthorizedResponse, zod.z.object({
2859
2750
  status: zod.z.literal(200),
@@ -2891,7 +2782,7 @@ var Api = {
2891
2782
  isRemote: zod.z["boolean"]().optional()
2892
2783
  })).min(1)
2893
2784
  }),
2894
- cookies: _defineProperty({}, VAL_SESSION_COOKIE, zod.z.string().optional())
2785
+ cookies: getSitemapTree._defineProperty({}, VAL_SESSION_COOKIE, zod.z.string().optional())
2895
2786
  },
2896
2787
  res: zod.z.union([unauthorizedResponse, zod.z.object({
2897
2788
  status: zod.z.literal(200),
@@ -2928,7 +2819,7 @@ var Api = {
2928
2819
  metadata: zod.z.any(),
2929
2820
  contentType: zod.z.string()
2930
2821
  }),
2931
- cookies: _defineProperty({}, VAL_SESSION_COOKIE, zod.z.string().optional())
2822
+ cookies: getSitemapTree._defineProperty({}, VAL_SESSION_COOKIE, zod.z.string().optional())
2932
2823
  },
2933
2824
  res: zod.z.union([unauthorizedResponse, zod.z.object({
2934
2825
  status: zod.z.literal(200),
@@ -2971,18 +2862,8 @@ var Api = {
2971
2862
  // `number` is allowed because the client stringifies every query value before it
2972
2863
  // goes on the URL (see createValClient), so a numeric param round-trips fine.
2973
2864
 
2974
- function _typeof(o) {
2975
- "@babel/helpers - typeof";
2976
-
2977
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
2978
- return typeof o;
2979
- } : function (o) {
2980
- return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
2981
- }, _typeof(o);
2982
- }
2983
-
2984
2865
  function getErrorMessageFromUnknownJson(json, fallback) {
2985
- if (_typeof(json) === "object" && json !== null && "message" in json && typeof json.message === "string") {
2866
+ if (getSitemapTree._typeof(json) === "object" && json !== null && "message" in json && typeof json.message === "string") {
2986
2867
  return json.message;
2987
2868
  }
2988
2869
  return fallback;
@@ -3011,7 +2892,7 @@ var createValClient = function createValClient(host, config // We want to use th
3011
2892
  for (_i = 0, _Object$keys = Object.keys(anyReq.query); _i < _Object$keys.length; _i++) {
3012
2893
  key = _Object$keys[_i];
3013
2894
  if (Array.isArray((_anyReq$query = anyReq.query) === null || _anyReq$query === void 0 ? void 0 : _anyReq$query[key])) {
3014
- _iterator = _createForOfIteratorHelper(((_anyReq$query2 = anyReq.query) === null || _anyReq$query2 === void 0 ? void 0 : _anyReq$query2[key]) || []);
2895
+ _iterator = getSitemapTree._createForOfIteratorHelper(((_anyReq$query2 = anyReq.query) === null || _anyReq$query2 === void 0 ? void 0 : _anyReq$query2[key]) || []);
3015
2896
  try {
3016
2897
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
3017
2898
  value = _step.value;
@@ -3252,7 +3133,7 @@ function _nonIterableRest() {
3252
3133
  }
3253
3134
 
3254
3135
  function _slicedToArray(r, e) {
3255
- return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
3136
+ return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || getSitemapTree._unsupportedIterableToArray(r, e) || _nonIterableRest();
3256
3137
  }
3257
3138
 
3258
3139
  var urlOf = function urlOf() {
@@ -3300,7 +3181,7 @@ var compatible = {
3300
3181
  * predicate is that check, said once.
3301
3182
  */
3302
3183
  function isJsonObject(value) {
3303
- return _typeof(value) === "object" && value !== null && !Array.isArray(value);
3184
+ return getSitemapTree._typeof(value) === "object" && value !== null && !Array.isArray(value);
3304
3185
  }
3305
3186
  function incompatible(reason) {
3306
3187
  return {
@@ -3407,7 +3288,7 @@ function checkCompatibility(from, to) {
3407
3288
  // wholesale would refuse a restore that is perfectly safe.
3408
3289
  if (to.schema.type === "union") {
3409
3290
  var key = typeof to.schema.key === "string" ? to.schema.key : "";
3410
- var _iterator = _createForOfIteratorHelper(to.schema.items),
3291
+ var _iterator = getSitemapTree._createForOfIteratorHelper(to.schema.items),
3411
3292
  _step;
3412
3293
  try {
3413
3294
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
@@ -3541,7 +3422,7 @@ function checkCompatibility(from, to) {
3541
3422
  });
3542
3423
  }
3543
3424
  var _unknown = null;
3544
- var _iterator2 = _createForOfIteratorHelper(from.value),
3425
+ var _iterator2 = getSitemapTree._createForOfIteratorHelper(from.value),
3545
3426
  _step2;
3546
3427
  try {
3547
3428
  for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
@@ -3643,7 +3524,7 @@ function checkCompatibility(from, to) {
3643
3524
  function newestCommitSha(commits) {
3644
3525
  var _newest$commitSha, _newest;
3645
3526
  var newest = null;
3646
- var _iterator = _createForOfIteratorHelper(commits !== null && commits !== void 0 ? commits : []),
3527
+ var _iterator = getSitemapTree._createForOfIteratorHelper(commits !== null && commits !== void 0 ? commits : []),
3647
3528
  _step;
3648
3529
  try {
3649
3530
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
@@ -3660,10 +3541,6 @@ function newestCommitSha(commits) {
3660
3541
  return (_newest$commitSha = (_newest = newest) === null || _newest === void 0 ? void 0 : _newest.commitSha) !== null && _newest$commitSha !== void 0 ? _newest$commitSha : null;
3661
3542
  }
3662
3543
 
3663
- var VAL_CONFIG_SESSION_STORAGE_KEY = "val-config";
3664
- var VAL_THEME_SESSION_STORAGE_KEY = "val-theme";
3665
- var VAL_AI_SESSION_STORAGE_KEY = "val-ai-session";
3666
-
3667
3544
  var SharedValConfig = zod.z.object({
3668
3545
  contentHostUrl: zod.z.string().optional(),
3669
3546
  appHostUrl: zod.z.string().optional(),
@@ -3691,170 +3568,6 @@ var ValDeployment = zod.z.object({
3691
3568
  createdAt: zod.z.string()
3692
3569
  });
3693
3570
 
3694
- // Strictly speaking this should be in the next package but it's shared, because we want to use it in the ui package. We want to resolve that somehow
3695
- function getNextAppRouterSitemapTree(srcFolder, paths) {
3696
- var root = {
3697
- type: "node",
3698
- name: "/",
3699
- children: []
3700
- };
3701
- var _iterator = _createForOfIteratorHelper(paths),
3702
- _step;
3703
- try {
3704
- var _loop = function _loop() {
3705
- var path = _step.value;
3706
- var urlPath = path.urlPath,
3707
- moduleFilePathS = path.moduleFilePath;
3708
- var moduleFilePath = moduleFilePathS;
3709
- if (!urlPath.startsWith("/")) {
3710
- console.error("urlPath must start with /: ".concat(urlPath));
3711
- return 0; // continue
3712
- }
3713
- var pattern = getPatternFromModuleFilePath(moduleFilePath, srcFolder);
3714
- if (urlPath === "/") {
3715
- var fullPath = "/";
3716
- root.pattern = getPatternFromModuleFilePath(moduleFilePath, srcFolder);
3717
- root.page = {
3718
- fullPath: fullPath
3719
- };
3720
- root.sourcePath = core.Internal.joinModuleFilePathAndModulePath(moduleFilePath, "\"".concat(fullPath, "\""));
3721
- root.moduleFilePath = moduleFilePath;
3722
- return 0; // continue
3723
- }
3724
- var pathParts = urlPath.split("/").slice(1).filter(Boolean);
3725
- var currentNode = root;
3726
- pathParts.forEach(function (part, index) {
3727
- var hasChildren = index < pathParts.length - 1;
3728
- var isLast = index === pathParts.length - 1;
3729
- var fullPath = "/" + pathParts.slice(0, index + 1).join("/");
3730
- var sourcePath = core.Internal.joinModuleFilePathAndModulePath(moduleFilePath, "\"".concat(fullPath, "\""));
3731
- var node = hasChildren ? _objectSpread2(_objectSpread2({
3732
- type: "node",
3733
- name: part,
3734
- pattern: pattern,
3735
- moduleFilePath: moduleFilePath
3736
- }, isLast ? {
3737
- page: {
3738
- fullPath: fullPath
3739
- },
3740
- sourcePath: sourcePath
3741
- } : {}), {}, {
3742
- children: []
3743
- }) : {
3744
- type: "leaf",
3745
- name: part,
3746
- pattern: pattern,
3747
- fullPath: fullPath,
3748
- moduleFilePath: moduleFilePath,
3749
- sourcePath: sourcePath,
3750
- children: []
3751
- };
3752
- var existingNodeIndex = currentNode.children.findIndex(function (node) {
3753
- return node.name === part;
3754
- });
3755
- if (existingNodeIndex === -1) {
3756
- currentNode.children.push(node);
3757
- if (currentNode.type === "node") {
3758
- currentNode.isLinear = true;
3759
- if (currentNode.children.length > 1) {
3760
- delete currentNode.isLinear;
3761
- }
3762
- }
3763
- currentNode = node;
3764
- } else {
3765
- var existingNode = currentNode.children[existingNodeIndex];
3766
- if (existingNode.type === "leaf" && hasChildren) {
3767
- var _sourcePath = existingNode.sourcePath;
3768
- // convert leaf to node
3769
- currentNode.children[existingNodeIndex] = {
3770
- type: "node",
3771
- name: part,
3772
- pattern: pattern,
3773
- page: {
3774
- fullPath: fullPath
3775
- },
3776
- sourcePath: _sourcePath,
3777
- children: existingNode.children,
3778
- moduleFilePath: moduleFilePath
3779
- };
3780
- currentNode = currentNode.children[existingNodeIndex];
3781
- } else if (existingNode.type === "node" && isLast) {
3782
- // add page, source path and module file path
3783
- existingNode.page = {
3784
- fullPath: fullPath
3785
- };
3786
- existingNode.sourcePath = sourcePath;
3787
- existingNode.moduleFilePath = moduleFilePath;
3788
- existingNode.pattern = pattern;
3789
- } else {
3790
- currentNode = currentNode.children[existingNodeIndex];
3791
- }
3792
- }
3793
- });
3794
- },
3795
- _ret;
3796
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
3797
- _ret = _loop();
3798
- if (_ret === 0) continue;
3799
- }
3800
- } catch (err) {
3801
- _iterator.e(err);
3802
- } finally {
3803
- _iterator.f();
3804
- }
3805
- return root;
3806
- }
3807
- function getPatternFromModuleFilePath(moduleFilePath, srcFolder) {
3808
- return moduleFilePath.replace(srcFolder, "")
3809
- // TODO: hacky!
3810
- // remove route groups
3811
- .replace(/\/\([^/]+\)/g, "") // not sure we want to do this?
3812
- .replace("/page.val.ts", "").replace("/page.val.js", "");
3813
- }
3814
-
3815
- function parseRoutePattern(pattern) {
3816
- if (pattern === "" || pattern === "/") {
3817
- return [];
3818
- }
3819
- var p = pattern.startsWith("/") ? pattern.slice(1) : pattern;
3820
- return p.split("/").map(function (part) {
3821
- var isOptionalParam = part.startsWith("[[") && part.endsWith("]]");
3822
- var isNonOptionalParam = part.startsWith("[") && part.endsWith("]");
3823
- var nameStart = isOptionalParam ? 2 : isNonOptionalParam ? 1 : 0;
3824
- var nameEnd = part.indexOf("]", nameStart);
3825
- var isArrayParam = part.slice(nameStart, nameStart + 3) === "...";
3826
- var paramName = part.slice(nameStart + (isArrayParam ? 3 : 0), nameEnd);
3827
- if (isOptionalParam || isNonOptionalParam) {
3828
- if (isArrayParam) {
3829
- return {
3830
- type: "array-param",
3831
- paramName: paramName,
3832
- optional: isOptionalParam
3833
- };
3834
- } else {
3835
- return {
3836
- type: "string-param",
3837
- paramName: paramName,
3838
- optional: isOptionalParam
3839
- };
3840
- }
3841
- }
3842
- return {
3843
- type: "literal",
3844
- name: part
3845
- };
3846
- });
3847
- }
3848
-
3849
- function getNextAppRouterSourceFolder(moduleFilePath) {
3850
- if (moduleFilePath.startsWith("/app")) {
3851
- return "/app";
3852
- } else if (moduleFilePath.startsWith("/src/app")) {
3853
- return "/src/app";
3854
- }
3855
- return null;
3856
- }
3857
-
3858
3571
  /**
3859
3572
  * Shared route validation utilities
3860
3573
  */
@@ -3968,7 +3681,7 @@ function getRoutesWithModulePaths(schemas, sources) {
3968
3681
  var moduleFilePath = moduleFilePathS;
3969
3682
  var schema = schemas[moduleFilePath];
3970
3683
  var source = sources[moduleFilePath];
3971
- if (schema && schema.type === "record" && schema.router && source && _typeof(source) === "object" && !Array.isArray(source)) {
3684
+ if (schema && schema.type === "record" && schema.router && source && getSitemapTree._typeof(source) === "object" && !Array.isArray(source)) {
3972
3685
  for (var key in source) {
3973
3686
  if (!routeMap.has(key)) {
3974
3687
  routeMap.set(key, moduleFilePath);
@@ -4052,12 +3765,12 @@ function getKeyOfRecordAt(sourcePath, snapshot) {
4052
3765
  // returns undefined source on any mismatch.
4053
3766
  var source = moduleSource;
4054
3767
  var schema = moduleSchema;
4055
- var _iterator = _createForOfIteratorHelper(core.Internal.splitModulePath(modulePath)),
3768
+ var _iterator = getSitemapTree._createForOfIteratorHelper(core.Internal.splitModulePath(modulePath)),
4056
3769
  _step;
4057
3770
  try {
4058
3771
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
4059
3772
  var part = _step.value;
4060
- if (source && _typeof(source) === "object" && !Array.isArray(source) && part in source) {
3773
+ if (source && getSitemapTree._typeof(source) === "object" && !Array.isArray(source) && part in source) {
4061
3774
  source = source[part];
4062
3775
  } else {
4063
3776
  source = undefined;
@@ -4090,12 +3803,12 @@ function checkKeyIsValid(key, sourcePath, snapshot) {
4090
3803
  message: "Expected key at ".concat(sourcePath, " to be of type 'record'")
4091
3804
  };
4092
3805
  }
4093
- if (keyOfModuleSource && _typeof(keyOfModuleSource) === "object" && !Array.isArray(keyOfModuleSource) && key in keyOfModuleSource) {
3806
+ if (keyOfModuleSource && getSitemapTree._typeof(keyOfModuleSource) === "object" && !Array.isArray(keyOfModuleSource) && key in keyOfModuleSource) {
4094
3807
  return {
4095
3808
  error: false
4096
3809
  };
4097
3810
  }
4098
- if (!keyOfModuleSource || _typeof(keyOfModuleSource) !== "object" || Array.isArray(keyOfModuleSource)) {
3811
+ if (!keyOfModuleSource || getSitemapTree._typeof(keyOfModuleSource) !== "object" || Array.isArray(keyOfModuleSource)) {
4099
3812
  return {
4100
3813
  error: true,
4101
3814
  message: "Expected ".concat(sourcePath, " to be a truthy object")
@@ -4122,7 +3835,7 @@ function checkRouteIsValid(route, includePattern, excludePattern, snapshot) {
4122
3835
  var schema = snapshot.schemas[moduleFilePath];
4123
3836
  if ((schema === null || schema === void 0 ? void 0 : schema.type) === "record" && schema.router) {
4124
3837
  var source = snapshot.sources[moduleFilePath];
4125
- if (source && _typeof(source) === "object" && !Array.isArray(source)) {
3838
+ if (source && getSitemapTree._typeof(source) === "object" && !Array.isArray(source)) {
4126
3839
  routerModules[moduleFilePath] = Object.keys(source);
4127
3840
  }
4128
3841
  }
@@ -4184,18 +3897,18 @@ function resolveSchemaSourceFixForError(error, snapshot) {
4184
3897
  if (!error.value) {
4185
3898
  return {
4186
3899
  status: "remaining",
4187
- error: _objectSpread2(_objectSpread2({}, error), {}, {
3900
+ error: getSitemapTree._objectSpread2(getSitemapTree._objectSpread2({}, error), {}, {
4188
3901
  message: "Could not find a value for keyOf. ".concat(TYPE_ERROR_MESSAGE),
4189
3902
  typeError: true,
4190
3903
  fixes: undefined
4191
3904
  })
4192
3905
  };
4193
3906
  }
4194
- if (_typeof(error.value) !== "object") {
3907
+ if (getSitemapTree._typeof(error.value) !== "object") {
4195
3908
  return {
4196
3909
  status: "remaining",
4197
- error: _objectSpread2(_objectSpread2({}, error), {}, {
4198
- message: "Expected keyOf validation error to have a 'value' property of type 'object'. Found: ".concat(_typeof(error.value), ". ").concat(TYPE_ERROR_MESSAGE),
3910
+ error: getSitemapTree._objectSpread2(getSitemapTree._objectSpread2({}, error), {}, {
3911
+ message: "Expected keyOf validation error to have a 'value' property of type 'object'. Found: ".concat(getSitemapTree._typeof(error.value), ". ").concat(TYPE_ERROR_MESSAGE),
4199
3912
  typeError: true,
4200
3913
  fixes: undefined
4201
3914
  })
@@ -4207,8 +3920,8 @@ function resolveSchemaSourceFixForError(error, snapshot) {
4207
3920
  if (typeof key !== "string") {
4208
3921
  return {
4209
3922
  status: "remaining",
4210
- error: _objectSpread2(_objectSpread2({}, error), {}, {
4211
- message: "Expected keyOf validation error 'value' to have property 'key' of type 'string'. Found: ".concat(_typeof(key), ". ").concat(TYPE_ERROR_MESSAGE),
3923
+ error: getSitemapTree._objectSpread2(getSitemapTree._objectSpread2({}, error), {}, {
3924
+ message: "Expected keyOf validation error 'value' to have property 'key' of type 'string'. Found: ".concat(getSitemapTree._typeof(key), ". ").concat(TYPE_ERROR_MESSAGE),
4212
3925
  typeError: true,
4213
3926
  fixes: undefined
4214
3927
  })
@@ -4217,8 +3930,8 @@ function resolveSchemaSourceFixForError(error, snapshot) {
4217
3930
  if (typeof valueSourcePath !== "string") {
4218
3931
  return {
4219
3932
  status: "remaining",
4220
- error: _objectSpread2(_objectSpread2({}, error), {}, {
4221
- message: "Expected keyOf validation error 'value' to have property 'sourcePath' of type 'string'. Found: ".concat(_typeof(valueSourcePath), ". ").concat(TYPE_ERROR_MESSAGE),
3933
+ error: getSitemapTree._objectSpread2(getSitemapTree._objectSpread2({}, error), {}, {
3934
+ message: "Expected keyOf validation error 'value' to have property 'sourcePath' of type 'string'. Found: ".concat(getSitemapTree._typeof(valueSourcePath), ". ").concat(TYPE_ERROR_MESSAGE),
4222
3935
  typeError: true,
4223
3936
  fixes: undefined
4224
3937
  })
@@ -4228,7 +3941,7 @@ function resolveSchemaSourceFixForError(error, snapshot) {
4228
3941
  if (res.error) {
4229
3942
  return {
4230
3943
  status: "remaining",
4231
- error: _objectSpread2(_objectSpread2({}, error), {}, {
3944
+ error: getSitemapTree._objectSpread2(getSitemapTree._objectSpread2({}, error), {}, {
4232
3945
  message: res.message,
4233
3946
  fixes: undefined
4234
3947
  })
@@ -4242,18 +3955,18 @@ function resolveSchemaSourceFixForError(error, snapshot) {
4242
3955
  if (!error.value) {
4243
3956
  return {
4244
3957
  status: "remaining",
4245
- error: _objectSpread2(_objectSpread2({}, error), {}, {
3958
+ error: getSitemapTree._objectSpread2(getSitemapTree._objectSpread2({}, error), {}, {
4246
3959
  message: "Could not find a value for route. ".concat(TYPE_ERROR_MESSAGE),
4247
3960
  typeError: true,
4248
3961
  fixes: undefined
4249
3962
  })
4250
3963
  };
4251
3964
  }
4252
- if (_typeof(error.value) !== "object") {
3965
+ if (getSitemapTree._typeof(error.value) !== "object") {
4253
3966
  return {
4254
3967
  status: "remaining",
4255
- error: _objectSpread2(_objectSpread2({}, error), {}, {
4256
- message: "Expected route validation error to have a 'value' property of type 'object'. Found: ".concat(_typeof(error.value), ". ").concat(TYPE_ERROR_MESSAGE),
3968
+ error: getSitemapTree._objectSpread2(getSitemapTree._objectSpread2({}, error), {}, {
3969
+ message: "Expected route validation error to have a 'value' property of type 'object'. Found: ".concat(getSitemapTree._typeof(error.value), ". ").concat(TYPE_ERROR_MESSAGE),
4257
3970
  typeError: true,
4258
3971
  fixes: undefined
4259
3972
  })
@@ -4264,8 +3977,8 @@ function resolveSchemaSourceFixForError(error, snapshot) {
4264
3977
  if (typeof route !== "string") {
4265
3978
  return {
4266
3979
  status: "remaining",
4267
- error: _objectSpread2(_objectSpread2({}, error), {}, {
4268
- message: "Expected route validation error 'value' to have property 'route' of type 'string'. Found: ".concat(_typeof(route), ". ").concat(TYPE_ERROR_MESSAGE),
3980
+ error: getSitemapTree._objectSpread2(getSitemapTree._objectSpread2({}, error), {}, {
3981
+ message: "Expected route validation error 'value' to have property 'route' of type 'string'. Found: ".concat(getSitemapTree._typeof(route), ". ").concat(TYPE_ERROR_MESSAGE),
4269
3982
  typeError: true,
4270
3983
  fixes: undefined
4271
3984
  })
@@ -4277,7 +3990,7 @@ function resolveSchemaSourceFixForError(error, snapshot) {
4277
3990
  if (_res.error) {
4278
3991
  return {
4279
3992
  status: "remaining",
4280
- error: _objectSpread2(_objectSpread2({}, error), {}, {
3993
+ error: getSitemapTree._objectSpread2(getSitemapTree._objectSpread2({}, error), {}, {
4281
3994
  message: _res.message,
4282
3995
  fixes: undefined
4283
3996
  })
@@ -4290,7 +4003,7 @@ function resolveSchemaSourceFixForError(error, snapshot) {
4290
4003
  return null;
4291
4004
  }
4292
4005
  function asRegExpPattern(value) {
4293
- if (value && _typeof(value) === "object" && "source" in value && "flags" in value && typeof value.source === "string" && typeof value.flags === "string") {
4006
+ if (value && getSitemapTree._typeof(value) === "object" && "source" in value && "flags" in value && typeof value.source === "string" && typeof value.flags === "string") {
4294
4007
  return value;
4295
4008
  }
4296
4009
  return undefined;
@@ -4312,7 +4025,7 @@ function resolveSchemaSourceFixes(validationErrors, snapshot) {
4312
4025
  for (var sourcePathS in validationErrors) {
4313
4026
  var sourcePath = sourcePathS;
4314
4027
  var remaining = [];
4315
- var _iterator2 = _createForOfIteratorHelper(validationErrors[sourcePath]),
4028
+ var _iterator2 = getSitemapTree._createForOfIteratorHelper(validationErrors[sourcePath]),
4316
4029
  _step2;
4317
4030
  try {
4318
4031
  for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
@@ -4336,84 +4049,6 @@ function resolveSchemaSourceFixes(validationErrors, snapshot) {
4336
4049
  return result;
4337
4050
  }
4338
4051
 
4339
- /**
4340
- * The protocol between the studio's canvas and the page inside it.
4341
- *
4342
- * The canvas shows the running site in a frame. That frame is a different
4343
- * document — the customer's app, rendered by their components — so the studio
4344
- * cannot reach into it, and it cannot reach out. Everything they say to each
4345
- * other goes through `postMessage`, and this is the vocabulary.
4346
- *
4347
- * It lives in `shared` because both halves have to agree on it: the page half
4348
- * ships in `@valbuild/next`, the studio half in `@valbuild/ui`, and a message
4349
- * shape defined twice is a message shape that will differ once.
4350
- *
4351
- * ## Why a query parameter turns it on
4352
- *
4353
- * The frame has to render the page as Val sees it — draft content, with
4354
- * `data-val-path` on every element Val tracks — while *not* showing Val's own
4355
- * overlay, because the studio is already the UI. Nothing about the cookies can
4356
- * express that: they are per-origin, and the studio and the page share an
4357
- * origin, so a cookie would change the customer's own tabs too. A parameter on
4358
- * the frame's URL is scoped to exactly the one document that needs it.
4359
- */
4360
-
4361
- /** Marks a page load as the studio's canvas frame. */
4362
- var VAL_CANVAS_PARAM = "val_canvas";
4363
-
4364
- /**
4365
- * Every message is tagged with this, and the tag is checked on receipt.
4366
- *
4367
- * A window receives messages from anything that has a handle on it —
4368
- * extensions, embeds, other frames — and `event.data` is whatever they chose to
4369
- * send. Checking a discriminator before reading anything else is what keeps a
4370
- * stray message from being read as a canvas instruction.
4371
- */
4372
- var VAL_CANVAS_MESSAGE = "val-canvas";
4373
-
4374
- /** One element on the page that Val has a path for. */
4375
-
4376
- /** What the page tells the studio. */
4377
-
4378
- /** What the studio tells the page. */
4379
-
4380
- /** Narrow an unknown `event.data` to a message from the page. */
4381
- function isValCanvasPageMessage(data) {
4382
- if (_typeof(data) !== "object" || data === null) return false;
4383
- var message = data;
4384
- if (message.val !== VAL_CANVAS_MESSAGE) return false;
4385
- return message.type === "ready" || message.type === "elements" || message.type === "clicked" || message.type === "pinch" || message.type === "zoom" || message.type === "refreshing";
4386
- }
4387
-
4388
- /** Narrow an unknown `event.data` to a message from the studio. */
4389
- function isValCanvasStudioMessage(data) {
4390
- if (_typeof(data) !== "object" || data === null) return false;
4391
- var message = data;
4392
- if (message.val !== VAL_CANVAS_MESSAGE) return false;
4393
- return message.type === "rescan" || message.type === "highlight" || message.type === "setPicking" || message.type === "sourceUpdate" || message.type === "sourcesSynced";
4394
- }
4395
-
4396
- /**
4397
- * Whether this document was loaded as the studio's canvas frame.
4398
- *
4399
- * Reads the location directly rather than taking it as an argument, because
4400
- * every caller wants the answer for the document it is running in, and passing
4401
- * it around is how one of them ends up asking about the wrong one.
4402
- */
4403
- function isValCanvasFrame(search) {
4404
- try {
4405
- return new URLSearchParams(search).get(VAL_CANVAS_PARAM) !== null;
4406
- } catch (_unused) {
4407
- return false;
4408
- }
4409
- }
4410
-
4411
- /** Add the canvas marker to a page URL. */
4412
- function withValCanvasParam(url) {
4413
- var separator = url.includes("?") ? "&" : "?";
4414
- return "".concat(url).concat(separator).concat(VAL_CANVAS_PARAM, "=1");
4415
- }
4416
-
4417
4052
  /**
4418
4053
  * Local `yyyy-MM-dd`, which is the one thing this module used `date-fns` for.
4419
4054
  *
@@ -4514,13 +4149,13 @@ function emptyOf(schema) {
4514
4149
  var toolNames = ["get_all_schema", "get_source", "search_content", "validate_content", "create_patch", "add_session_image_to_gallery", "remove_image_gallery_entry", "navigate_to", "get_current_context", "get_patches", "get_source_path_from_route", "set_session_name", "show_compare_view", "ask_user_question", "duplicate_source", "empty_at_path", "count_entries", "get_record_keys"];
4515
4150
 
4516
4151
  function buildFileRefValue(filePath, metadata) {
4517
- return _objectSpread2({
4152
+ return getSitemapTree._objectSpread2({
4518
4153
  path: filePath
4519
4154
  }, metadata);
4520
4155
  }
4521
4156
  function getSourceAt(source, path) {
4522
4157
  var current = source;
4523
- var _iterator = _createForOfIteratorHelper(path),
4158
+ var _iterator = getSitemapTree._createForOfIteratorHelper(path),
4524
4159
  _step;
4525
4160
  try {
4526
4161
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
@@ -4530,7 +4165,7 @@ function getSourceAt(source, path) {
4530
4165
  var idx = Number(part);
4531
4166
  if (!Number.isInteger(idx)) return undefined;
4532
4167
  current = current[idx];
4533
- } else if (_typeof(current) === "object") {
4168
+ } else if (getSitemapTree._typeof(current) === "object") {
4534
4169
  current = current[part];
4535
4170
  } else {
4536
4171
  return undefined;
@@ -4580,7 +4215,7 @@ function resolveSerializedSchemaAtPath(schema, path) {
4580
4215
  };
4581
4216
  } else if (current.type === "union") {
4582
4217
  if (typeof current.key === "string") {
4583
- var _iterator2 = _createForOfIteratorHelper(current.items),
4218
+ var _iterator2 = getSitemapTree._createForOfIteratorHelper(current.items),
4584
4219
  _step2;
4585
4220
  try {
4586
4221
  for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
@@ -4682,7 +4317,7 @@ function buildImageGalleryPatch(args, moduleSchema) {
4682
4317
  var patch = [{
4683
4318
  op: "add",
4684
4319
  path: [args.filePath],
4685
- value: _objectSpread2(_objectSpread2({}, args.metadata), {}, {
4320
+ value: getSitemapTree._objectSpread2(getSitemapTree._objectSpread2({}, args.metadata), {}, {
4686
4321
  // `alt` is a REQUIRED field of a gallery entry (`s.images()` gives it a
4687
4322
  // nullable string schema), so an entry written without one is invalid
4688
4323
  // the moment it lands — and the caller that had no alt to give is the
@@ -4703,7 +4338,7 @@ function buildImageGalleryPatch(args, moduleSchema) {
4703
4338
  function buildRemoveImageGalleryEntryPatch(args, moduleSchema, moduleSource) {
4704
4339
  var wrong = checkGallerySchema(moduleSchema);
4705
4340
  if (wrong) return wrong;
4706
- if (!moduleSource || _typeof(moduleSource) !== "object" || Array.isArray(moduleSource)) {
4341
+ if (!moduleSource || getSitemapTree._typeof(moduleSource) !== "object" || Array.isArray(moduleSource)) {
4707
4342
  return {
4708
4343
  kind: "error",
4709
4344
  message: "Cannot remove from gallery: module source is not an object."
@@ -5025,11 +4660,11 @@ function describeContainerAtPath(moduleSchema, moduleSource, path) {
5025
4660
  };
5026
4661
  }
5027
4662
  if (schema.type === "record" || schema.type === "object") {
5028
- if (value === null || _typeof(value) !== "object" || Array.isArray(value)) {
4663
+ if (value === null || getSitemapTree._typeof(value) !== "object" || Array.isArray(value)) {
5029
4664
  return {
5030
4665
  kind: "error",
5031
4666
  reason: "not-a-container",
5032
- message: "Path ".concat(JSON.stringify(path), " points to a ").concat(value === null ? "null" : Array.isArray(value) ? "array" : _typeof(value), " value, which has no entries to count or list.")
4667
+ message: "Path ".concat(JSON.stringify(path), " points to a ").concat(value === null ? "null" : Array.isArray(value) ? "array" : getSitemapTree._typeof(value), " value, which has no entries to count or list.")
5033
4668
  };
5034
4669
  }
5035
4670
  return {
@@ -5074,7 +4709,7 @@ function partitionValidationErrors(validationErrors) {
5074
4709
  var skipped = {};
5075
4710
  for (var sourcePathS in validationErrors) {
5076
4711
  var sourcePath = sourcePathS;
5077
- var _iterator = _createForOfIteratorHelper(validationErrors[sourcePath]),
4712
+ var _iterator = getSitemapTree._createForOfIteratorHelper(validationErrors[sourcePath]),
5078
4713
  _step;
5079
4714
  try {
5080
4715
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
@@ -5444,7 +5079,7 @@ function traverseSchemaSource(source, schema, path, callback) {
5444
5079
 
5445
5080
  // Handle file/image
5446
5081
  if (schema.type === "file" || schema.type === "image") {
5447
- if (source && _typeof(source) === "object" && "path" in source && typeof source.path === "string") {
5082
+ if (source && getSitemapTree._typeof(source) === "object" && "path" in source && typeof source.path === "string") {
5448
5083
  callback({
5449
5084
  source: source,
5450
5085
  schema: schema,
@@ -5556,7 +5191,7 @@ function traverseSchemaSource(source, schema, path, callback) {
5556
5191
  // Settings walks like an object, and starting from the SOURCE is what makes
5557
5192
  // its optional keys work: an absent section has nothing to traverse.
5558
5193
  schema.type === "settings") {
5559
- if (_typeof(source) !== "object" || source === null || Array.isArray(source)) {
5194
+ if (getSitemapTree._typeof(source) !== "object" || source === null || Array.isArray(source)) {
5560
5195
  return;
5561
5196
  }
5562
5197
  for (var key in source) {
@@ -5576,7 +5211,7 @@ function traverseSchemaSource(source, schema, path, callback) {
5576
5211
  var schemaKey = schema.key;
5577
5212
  if (typeof schemaKey === "string") {
5578
5213
  // Tagged union - find matching sub-schema
5579
- if (source && _typeof(source) === "object" && !Array.isArray(source) && schemaKey in source) {
5214
+ if (source && getSitemapTree._typeof(source) === "object" && !Array.isArray(source) && schemaKey in source) {
5580
5215
  var itemKey = source[schemaKey];
5581
5216
  if (typeof itemKey === "string") {
5582
5217
  var schemaOfItem = schema.items.filter(function (item) {
@@ -5621,8 +5256,8 @@ function flattenRichText(source) {
5621
5256
  if (typeof child === "string") {
5622
5257
  res += child;
5623
5258
  } else {
5624
- if (child && _typeof(child) === "object" && "children" in child && Array.isArray(child.children)) {
5625
- var _iterator = _createForOfIteratorHelper(child.children),
5259
+ if (child && getSitemapTree._typeof(child) === "object" && "children" in child && Array.isArray(child.children)) {
5260
+ var _iterator = getSitemapTree._createForOfIteratorHelper(child.children),
5626
5261
  _step;
5627
5262
  try {
5628
5263
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
@@ -5754,7 +5389,7 @@ function indexModule(searchIndex, moduleFilePath, source, schema) {
5754
5389
  }
5755
5390
  // Handle file/image
5756
5391
  else if (schema.type === "file" || schema.type === "image") {
5757
- if (source !== null && _typeof(source) === "object" && "path" in source && typeof source.path === "string") {
5392
+ if (source !== null && getSitemapTree._typeof(source) === "object" && "path" in source && typeof source.path === "string") {
5758
5393
  // The label is the bare filename - the folder is shown separately in
5759
5394
  // the UI - but both are searchable.
5760
5395
  var _getRefParts = getRefParts(source.path),
@@ -5791,7 +5426,7 @@ function removeModule(searchIndex, moduleFilePath) {
5791
5426
  docsByModule = searchIndex.docsByModule;
5792
5427
  var existing = docsByModule.get(moduleFilePath);
5793
5428
  if (existing === undefined) return;
5794
- var _iterator = _createForOfIteratorHelper(existing),
5429
+ var _iterator = getSitemapTree._createForOfIteratorHelper(existing),
5795
5430
  _step;
5796
5431
  try {
5797
5432
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
@@ -5879,6 +5514,19 @@ function performSearch(searchIndex, query) {
5879
5514
  };
5880
5515
  }
5881
5516
 
5517
+ exports.VAL_AI_SESSION_STORAGE_KEY = getSitemapTree.VAL_AI_SESSION_STORAGE_KEY;
5518
+ exports.VAL_CANVAS_MESSAGE = getSitemapTree.VAL_CANVAS_MESSAGE;
5519
+ exports.VAL_CANVAS_PARAM = getSitemapTree.VAL_CANVAS_PARAM;
5520
+ exports.VAL_CONFIG_SESSION_STORAGE_KEY = getSitemapTree.VAL_CONFIG_SESSION_STORAGE_KEY;
5521
+ exports.VAL_THEME_SESSION_STORAGE_KEY = getSitemapTree.VAL_THEME_SESSION_STORAGE_KEY;
5522
+ exports.getNextAppRouterSitemapTree = getSitemapTree.getNextAppRouterSitemapTree;
5523
+ exports.getNextAppRouterSourceFolder = getSitemapTree.getNextAppRouterSourceFolder;
5524
+ exports.getPatternFromModuleFilePath = getSitemapTree.getPatternFromModuleFilePath;
5525
+ exports.isValCanvasFrame = getSitemapTree.isValCanvasFrame;
5526
+ exports.isValCanvasPageMessage = getSitemapTree.isValCanvasPageMessage;
5527
+ exports.isValCanvasStudioMessage = getSitemapTree.isValCanvasStudioMessage;
5528
+ exports.parseRoutePattern = getSitemapTree.parseRoutePattern;
5529
+ exports.withValCanvasParam = getSitemapTree.withValCanvasParam;
5882
5530
  exports.Api = Api;
5883
5531
  exports.BinaryFileRef = BinaryFileRef;
5884
5532
  exports.CodeOptions = CodeOptions;
@@ -5937,14 +5585,9 @@ exports.SerializedSettingsSchema = SerializedSettingsSchema;
5937
5585
  exports.SerializedStringSchema = SerializedStringSchema;
5938
5586
  exports.SerializedUnionSchema = SerializedUnionSchema;
5939
5587
  exports.SharedValConfig = SharedValConfig;
5940
- exports.VAL_AI_SESSION_STORAGE_KEY = VAL_AI_SESSION_STORAGE_KEY;
5941
- exports.VAL_CANVAS_MESSAGE = VAL_CANVAS_MESSAGE;
5942
- exports.VAL_CANVAS_PARAM = VAL_CANVAS_PARAM;
5943
- exports.VAL_CONFIG_SESSION_STORAGE_KEY = VAL_CONFIG_SESSION_STORAGE_KEY;
5944
5588
  exports.VAL_ENABLE_COOKIE_NAME = VAL_ENABLE_COOKIE_NAME;
5945
5589
  exports.VAL_SESSION_COOKIE = VAL_SESSION_COOKIE;
5946
5590
  exports.VAL_STATE_COOKIE = VAL_STATE_COOKIE;
5947
- exports.VAL_THEME_SESSION_STORAGE_KEY = VAL_THEME_SESSION_STORAGE_KEY;
5948
5591
  exports.ValCommit = ValCommit;
5949
5592
  exports.ValDeployment = ValDeployment;
5950
5593
  exports.buildDuplicatePatch = buildDuplicatePatch;
@@ -5970,9 +5613,6 @@ exports.flattenRichText = flattenRichText;
5970
5613
  exports.getErrorMessageFromUnknownJson = getErrorMessageFromUnknownJson;
5971
5614
  exports.getFilenameFromRef = getFilenameFromRef;
5972
5615
  exports.getInlineImgInfo = getInlineImgInfo;
5973
- exports.getNextAppRouterSitemapTree = getNextAppRouterSitemapTree;
5974
- exports.getNextAppRouterSourceFolder = getNextAppRouterSourceFolder;
5975
- exports.getPatternFromModuleFilePath = getPatternFromModuleFilePath;
5976
5616
  exports.getRefParts = getRefParts;
5977
5617
  exports.getRoutesOf = getRoutesOf;
5978
5618
  exports.getRoutesWithModulePaths = getRoutesWithModulePaths;
@@ -5981,12 +5621,8 @@ exports.indexModule = indexModule;
5981
5621
  exports.isMimeTypeAccepted = isMimeTypeAccepted;
5982
5622
  exports.isRemoteSchema = isRemoteSchema;
5983
5623
  exports.isSkippedSource = isSkippedSource;
5984
- exports.isValCanvasFrame = isValCanvasFrame;
5985
- exports.isValCanvasPageMessage = isValCanvasPageMessage;
5986
- exports.isValCanvasStudioMessage = isValCanvasStudioMessage;
5987
5624
  exports.levenshtein = levenshtein;
5988
5625
  exports.newestCommitSha = newestCommitSha;
5989
- exports.parseRoutePattern = parseRoutePattern;
5990
5626
  exports.partitionValidationErrors = partitionValidationErrors;
5991
5627
  exports.performSearch = performSearch;
5992
5628
  exports.remirrorToRichTextSource = remirrorToRichTextSource;
@@ -6003,4 +5639,3 @@ exports.traverseSchemaSource = traverseSchemaSource;
6003
5639
  exports.urlOf = urlOf;
6004
5640
  exports.validateRoutePatterns = validateRoutePatterns;
6005
5641
  exports.withExtension = withExtension;
6006
- exports.withValCanvasParam = withValCanvasParam;