@valbuild/shared 0.150.13 → 0.150.17

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.
@@ -1,5 +1,5 @@
1
1
  import { f as _createForOfIteratorHelper, d as _objectSpread2, e as _toConsumableArray, _ as _typeof, g as _defineProperty, b as _asyncToGenerator, c as _regenerator, a as _slicedToArray } from '../../dist/createForOfIteratorHelper-9b80f1a2.esm.js';
2
- import { Internal, CODE_LANGUAGES, resolveSettingsModule, missingDeclaredKeys, localeOfValue, discriminatedUnionBranchOf, routePatternOf, matchRoutePattern, DEFAULT_COLOR_FORMAT, declaredKeySetOf } from '@valbuild/core';
2
+ import { Internal, CODE_LANGUAGES, resolveSettingsModule, missingDeclaredKeys, localeOfValue, routePatternOf, matchRoutePattern, discriminatedUnionBranchOf, DEFAULT_COLOR_FORMAT, declaredKeySetOf } from '@valbuild/core';
3
3
  import { z } from 'zod';
4
4
  import { _ as _objectWithoutProperties } from '../../dist/protocol-55cfa3cf.esm.js';
5
5
  export { P as PublishProtocolError, b as parseArtifacts, p as parseBuildTarget, l as parseCancel, a as parseDeclare, m as parseDiscard, j as parseJob, n as parseNewestCiRun, h as parsePress, g as parseProblems, f as parseProjectSource, d as parsePromote, o as parsePublishToken, k as parseRenew, i as parseRequestStatus, e as parseStatus, q as parseUpdateTarget, c as parseVerify } from '../../dist/protocol-55cfa3cf.esm.js';
@@ -1663,6 +1663,40 @@ var AnalyticsBeacon = z.object({
1663
1663
  }, {
1664
1664
  message: "At most ".concat(MAX_ANALYTICS_PATHS_PER_BEACON, " paths a beacon")
1665
1665
  });
1666
+ /**
1667
+ * A Sketchpad, as the server keeps it: a rough page written in the strict
1668
+ * format of `sketchpad/sketchFormat.ts`, owned by the project and nothing
1669
+ * else. Not by an AI session -- the assistant that made it remembers its id,
1670
+ * and any chat can read it again -- and not by a page: `page` is a label for
1671
+ * which page it is about, and can be changed or cleared.
1672
+ *
1673
+ * `version` goes up by one on every change, and a change names the version
1674
+ * it was made against, so two writers cannot overwrite each other unseen.
1675
+ */
1676
+ var Sketchpad = z.object({
1677
+ id: z.string(),
1678
+ page: z.string().nullable(),
1679
+ /** Its first heading, for a list to name it by. */
1680
+ title: z.string().nullable(),
1681
+ text: z.string(),
1682
+ version: z.number()["int"](),
1683
+ archived: z["boolean"](),
1684
+ createdAt: z.string(),
1685
+ updatedAt: z.string(),
1686
+ /** Profile ids; null where nobody was signed in (local dev, the demo). */
1687
+ createdBy: z.string().nullable(),
1688
+ updatedBy: z.string().nullable()
1689
+ });
1690
+ var SketchpadSummary = Sketchpad.omit({
1691
+ text: true
1692
+ });
1693
+ /** A line of a sketch the server would not take, and why. */
1694
+ var SketchErrorZ = z.object({
1695
+ line: z.number(),
1696
+ message: z.string()
1697
+ });
1698
+ /** The most text a sketchpad holds, in UTF-8 bytes: a page, not a site. */
1699
+ var SKETCHPAD_MAX_TEXT_LENGTH = 256 * 1024;
1666
1700
  var Api = {
1667
1701
  "/draft/enable": {
1668
1702
  GET: {
@@ -1713,11 +1747,22 @@ var Api = {
1713
1747
  // Parsed by the handler rather than here, so a beacon of a version this
1714
1748
  // server does not know is ignored instead of refused.
1715
1749
  req: {
1716
- body: z.unknown()
1750
+ body: z.unknown(),
1751
+ // What a server that forwards beacons to Val's ingest has to check
1752
+ // and pass on itself: a forward loses the browser's own headers. The
1753
+ // visitor's IP is deliberately not one of them.
1754
+ headers: {
1755
+ "sec-fetch-site": z.string().optional(),
1756
+ "user-agent": z.string().optional(),
1757
+ "x-vercel-ip-country": z.string().optional(),
1758
+ "cf-ipcountry": z.string().optional(),
1759
+ "cloudfront-viewer-country": z.string().optional()
1760
+ }
1717
1761
  },
1718
1762
  res: z.union([
1719
- // `counted` is false wherever nothing stores the counts -- every
1720
- // server but the hosted platform's, for now.
1763
+ // `counted` is true only where the beacon was handed to Val's ingest
1764
+ // and it counted it: the hosted platform, or a self-hosted server in
1765
+ // http mode. False everywhere else, local dev included.
1721
1766
  z.object({
1722
1767
  status: z.literal(200),
1723
1768
  json: z.object({
@@ -1726,6 +1771,12 @@ var Api = {
1726
1771
  }), z.object({
1727
1772
  status: z.literal(400),
1728
1773
  json: GenericError
1774
+ }),
1775
+ // Analytics is switched off for this project in Val's admin. The
1776
+ // browser script stops sending when it sees this.
1777
+ z.object({
1778
+ status: z.literal(410),
1779
+ json: GenericError
1729
1780
  })])
1730
1781
  }
1731
1782
  },
@@ -2394,6 +2445,124 @@ var Api = {
2394
2445
  })
2395
2446
  }
2396
2447
  },
2448
+ /**
2449
+ * The project's sketchpads: list them, or make one. See `Sketchpad`.
2450
+ * Making one answers with its id, which is what an assistant keeps to
2451
+ * read and change it later.
2452
+ */
2453
+ "/sketchpads": {
2454
+ GET: {
2455
+ req: {
2456
+ query: {
2457
+ /** `exclude` (the default), `include`, or `only`. */
2458
+ archived: onlyOneStringQueryParam.optional(),
2459
+ /** Only those about this page. */
2460
+ page: onlyOneStringQueryParam.optional()
2461
+ },
2462
+ cookies: {
2463
+ val_session: z.string().optional()
2464
+ }
2465
+ },
2466
+ res: z.union([unauthorizedResponse, z.object({
2467
+ status: z.literal(400),
2468
+ json: GenericError
2469
+ }), z.object({
2470
+ status: z.literal(500),
2471
+ json: GenericError
2472
+ }), z.object({
2473
+ status: z.literal(200),
2474
+ json: z.object({
2475
+ sketchpads: z.array(SketchpadSummary)
2476
+ })
2477
+ })])
2478
+ },
2479
+ POST: {
2480
+ req: {
2481
+ body: z.object({
2482
+ text: z.string(),
2483
+ page: z.string().nullable()
2484
+ }),
2485
+ cookies: {
2486
+ val_session: z.string().optional()
2487
+ }
2488
+ },
2489
+ res: z.union([unauthorizedResponse, z.object({
2490
+ status: z.literal(400),
2491
+ json: z.object({
2492
+ message: z.string(),
2493
+ /** Lines of the text that are not in the sketch format. */
2494
+ errors: z.array(SketchErrorZ).optional()
2495
+ })
2496
+ }), z.object({
2497
+ status: z.literal(500),
2498
+ json: GenericError
2499
+ }), z.object({
2500
+ status: z.literal(201),
2501
+ json: z.object({
2502
+ sketchpad: Sketchpad
2503
+ })
2504
+ })])
2505
+ }
2506
+ },
2507
+ /** One sketchpad: read it, or change its text, its page or whether it is archived. */
2508
+ "/sketchpad": {
2509
+ GET: {
2510
+ req: {
2511
+ query: {
2512
+ id: onlyOneStringQueryParam
2513
+ },
2514
+ cookies: {
2515
+ val_session: z.string().optional()
2516
+ }
2517
+ },
2518
+ res: z.union([unauthorizedResponse, notFoundResponse, z.object({
2519
+ status: z.literal(500),
2520
+ json: GenericError
2521
+ }), z.object({
2522
+ status: z.literal(200),
2523
+ json: z.object({
2524
+ sketchpad: Sketchpad
2525
+ })
2526
+ })])
2527
+ },
2528
+ PATCH: {
2529
+ req: {
2530
+ body: z.object({
2531
+ id: z.string(),
2532
+ /** The version this change was made against. */
2533
+ baseVersion: z.number()["int"](),
2534
+ text: z.string().optional(),
2535
+ page: z.string().nullable().optional(),
2536
+ archived: z["boolean"]().optional()
2537
+ }),
2538
+ cookies: {
2539
+ val_session: z.string().optional()
2540
+ }
2541
+ },
2542
+ res: z.union([unauthorizedResponse, notFoundResponse, z.object({
2543
+ status: z.literal(400),
2544
+ json: z.object({
2545
+ message: z.string(),
2546
+ errors: z.array(SketchErrorZ).optional()
2547
+ })
2548
+ }), /** Changed since `baseVersion`: here is how it is now. */
2549
+ z.object({
2550
+ status: z.literal(409),
2551
+ json: z.object({
2552
+ message: z.string(),
2553
+ sketchpad: Sketchpad
2554
+ })
2555
+ }), z.object({
2556
+ status: z.literal(500),
2557
+ json: GenericError
2558
+ }), z.object({
2559
+ status: z.literal(200),
2560
+ json: z.object({
2561
+ sketchpad: Sketchpad
2562
+ })
2563
+ })])
2564
+ }
2565
+ },
2397
2566
  "/upload/patches": {
2398
2567
  POST: {
2399
2568
  req: {
@@ -5363,6 +5532,7 @@ function resolveSchemaSourceFixes(validationErrors, snapshot) {
5363
5532
  * in most projects, and for every project that has not declared any languages.
5364
5533
  */
5365
5534
  function localeAt(path, snapshot) {
5535
+ var _localeScopeAt$locale, _localeScopeAt;
5366
5536
  var available = declaredLocales(snapshot);
5367
5537
  if (available.length === 0) {
5368
5538
  // Nothing can be one of no languages. Answering `null` rather than reading
@@ -5371,18 +5541,66 @@ function localeAt(path, snapshot) {
5371
5541
  return null;
5372
5542
  }
5373
5543
  var _Internal$splitModule = Internal.splitModuleFilePathAndModulePath(path),
5374
- _Internal$splitModule2 = _slicedToArray(_Internal$splitModule, 2),
5375
- moduleFilePath = _Internal$splitModule2[0],
5376
- modulePath = _Internal$splitModule2[1];
5544
+ _Internal$splitModule2 = _slicedToArray(_Internal$splitModule, 1),
5545
+ moduleFilePath = _Internal$splitModule2[0];
5377
5546
  var schema = snapshot.schemas[moduleFilePath];
5378
5547
  var source = snapshot.sources[moduleFilePath];
5379
5548
  if (schema === undefined || source === undefined) {
5380
5549
  return null;
5381
5550
  }
5551
+ return (_localeScopeAt$locale = (_localeScopeAt = localeScopeAt(path, schema, source, available)) === null || _localeScopeAt === void 0 ? void 0 : _localeScopeAt.locale) !== null && _localeScopeAt$locale !== void 0 ? _localeScopeAt$locale : null;
5552
+ }
5553
+
5554
+ /**
5555
+ * Where the scope governing a path opens, and how.
5556
+ *
5557
+ * - `field`: the node `depth` segments down has a locale field. `depth` 0 is the
5558
+ * module root.
5559
+ * - `record-key`: segment `depth` is a key of a locale-keyed record, which sits
5560
+ * `depth` segments down.
5561
+ * - `route-key`: segment `depth` is a route whose parameters name the language,
5562
+ * in the router `depth` segments down (in practice the module root).
5563
+ *
5564
+ * The opener is what decides where an editor goes when the Studio's language
5565
+ * changes under them — the same entry in another language for a key, the
5566
+ * parent for a field. See `relocateForLocale`.
5567
+ */
5568
+
5569
+ /**
5570
+ * The scope that governs a path, read from that module's schema and source
5571
+ * alone, or `null` where none does.
5572
+ *
5573
+ * {@link localeAt} for a caller that already has the module in hand — the
5574
+ * Studio, which has the project's languages from its own provider and would
5575
+ * otherwise have to assemble a snapshot of every module to ask about one.
5576
+ */
5577
+ function localeScopeAt(path, schema, source, available) {
5578
+ if (available.length === 0) {
5579
+ return null;
5580
+ }
5581
+ var _Internal$splitModule3 = Internal.splitModuleFilePathAndModulePath(path),
5582
+ _Internal$splitModule4 = _slicedToArray(_Internal$splitModule3, 2),
5583
+ moduleFilePath = _Internal$splitModule4[0],
5584
+ modulePath = _Internal$splitModule4[1];
5382
5585
  var segments = modulePath ? Internal.splitModulePath(modulePath) : [];
5383
5586
  return walk(schema, source, segments, available, moduleFilePath);
5384
5587
  }
5385
5588
 
5589
+ /**
5590
+ * The language a whole module is in: the one its root's locale field names, or
5591
+ * `null` where its root has none.
5592
+ *
5593
+ * The only way a module is in one language as a whole — a locale-keyed record
5594
+ * or a router at the root is every one of its languages at once. Needs no path,
5595
+ * so a list of modules can ask it of each.
5596
+ */
5597
+ function localeOfModuleRoot(schema, source, available) {
5598
+ if (available.length === 0) {
5599
+ return null;
5600
+ }
5601
+ return enter(schema, source, available).locale;
5602
+ }
5603
+
5386
5604
  /**
5387
5605
  * The language a locale schema's value MEANS, or `null` if it means none of
5388
5606
  * the project's.
@@ -5428,11 +5646,32 @@ function isLocaleSchema(schema) {
5428
5646
  return schema.type === "locale" || schema.type === "enum" && schema.locales !== undefined;
5429
5647
  }
5430
5648
 
5649
+ /**
5650
+ * Whether a router's URLs name the language each page is in — one of its route
5651
+ * parameters is a locale (`s.router(router, { locale: … }, item)`).
5652
+ */
5653
+ function hasLocaleRouteParam(schema) {
5654
+ return schema.type === "record" && schema.params !== undefined && Object.values(schema.params).some(isLocaleSchema);
5655
+ }
5656
+
5431
5657
  /**
5432
5658
  * The language a router's key is in, where one of its route parameters is a
5433
5659
  * locale — `/nb/blog/hei` is `nb-NO` when `locale` maps `nb` to it.
5660
+ *
5661
+ * Answered from the key alone, with no content read: which is what lets the
5662
+ * Studio's page tree filter every page of a site without loading one of them.
5434
5663
  */
5435
5664
  function localeOfRouteKey(schema, moduleFilePath, key, available) {
5665
+ var param = localeParamOfRouteKey(schema, moduleFilePath, key);
5666
+ return param === null ? null : localeMeantBy(param.schema, param.value, available);
5667
+ }
5668
+
5669
+ /**
5670
+ * The route parameters a key gives its router, and which of them is the
5671
+ * language — or `null` where the router has no locale parameter or the key is
5672
+ * not one of its URLs.
5673
+ */
5674
+ function localeParamOfRouteKey(schema, moduleFilePath, key) {
5436
5675
  if (schema.params === undefined || schema.router === undefined) {
5437
5676
  return null;
5438
5677
  }
@@ -5449,7 +5688,12 @@ function localeOfRouteKey(schema, moduleFilePath, key, available) {
5449
5688
  name = _Object$entries$_i[0],
5450
5689
  param = _Object$entries$_i[1];
5451
5690
  if (isLocaleSchema(param) && Object.prototype.hasOwnProperty.call(values, name)) {
5452
- return localeMeantBy(param, values[name], available);
5691
+ return {
5692
+ name: name,
5693
+ schema: param,
5694
+ value: values[name],
5695
+ values: values
5696
+ };
5453
5697
  }
5454
5698
  }
5455
5699
  return null;
@@ -5469,16 +5713,22 @@ function localeOfRouteKey(schema, moduleFilePath, key, available) {
5469
5713
  */
5470
5714
  function walk(schema, source, segments, available, moduleFilePath) {
5471
5715
  var entered = enter(schema, source, available);
5472
- var locale = entered.locale;
5716
+ var scope = entered.locale === null ? null : {
5717
+ kind: "field",
5718
+ locale: entered.locale,
5719
+ depth: 0
5720
+ };
5473
5721
  var currentSchema = entered.schema;
5474
5722
  var currentSource = source;
5475
- var _iterator = _createForOfIteratorHelper(segments),
5723
+ var _iterator = _createForOfIteratorHelper(segments.entries()),
5476
5724
  _step;
5477
5725
  try {
5478
5726
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
5479
- var segment = _step.value;
5727
+ var _step$value = _slicedToArray(_step.value, 2),
5728
+ index = _step$value[0],
5729
+ segment = _step$value[1];
5480
5730
  if (currentSchema === undefined) {
5481
- return locale;
5731
+ return scope;
5482
5732
  }
5483
5733
  if (currentSchema.type === "record") {
5484
5734
  if (currentSchema.key !== undefined && isLocaleSchema(currentSchema.key)) {
@@ -5487,14 +5737,24 @@ function walk(schema, source, segments, available, moduleFilePath) {
5487
5737
  // the tag it stands for when the key is an enum with `.locales()`.
5488
5738
  var resolved = localeMeantBy(currentSchema.key, segment, available);
5489
5739
  if (resolved !== null) {
5490
- locale = resolved;
5740
+ scope = {
5741
+ kind: "record-key",
5742
+ locale: resolved,
5743
+ depth: index,
5744
+ keySchema: currentSchema.key
5745
+ };
5491
5746
  }
5492
5747
  } else if (currentSchema.params !== undefined) {
5493
5748
  // A router whose URL names the language: the key is a URL, and one of
5494
5749
  // its parameters is the answer.
5495
5750
  var _resolved = localeOfRouteKey(currentSchema, moduleFilePath, segment, available);
5496
5751
  if (_resolved !== null) {
5497
- locale = _resolved;
5752
+ scope = {
5753
+ kind: "route-key",
5754
+ locale: _resolved,
5755
+ depth: index,
5756
+ router: currentSchema
5757
+ };
5498
5758
  }
5499
5759
  }
5500
5760
  currentSchema = currentSchema.item;
@@ -5504,13 +5764,17 @@ function walk(schema, source, segments, available, moduleFilePath) {
5504
5764
  currentSchema = currentSchema.items[segment];
5505
5765
  } else {
5506
5766
  // A leaf, or richtext's internal structure. Nothing below opens a scope.
5507
- return locale;
5767
+ return scope;
5508
5768
  }
5509
5769
  currentSource = childSource(currentSource, segment);
5510
5770
  entered = enter(currentSchema, currentSource, available);
5511
5771
  currentSchema = entered.schema;
5512
5772
  if (entered.locale !== null) {
5513
- locale = entered.locale;
5773
+ scope = {
5774
+ kind: "field",
5775
+ locale: entered.locale,
5776
+ depth: index + 1
5777
+ };
5514
5778
  }
5515
5779
  }
5516
5780
  } catch (err) {
@@ -5518,7 +5782,7 @@ function walk(schema, source, segments, available, moduleFilePath) {
5518
5782
  } finally {
5519
5783
  _iterator.f();
5520
5784
  }
5521
- return locale;
5785
+ return scope;
5522
5786
  }
5523
5787
 
5524
5788
  /**
@@ -5608,6 +5872,187 @@ function isJsonObject(source) {
5608
5872
  return _typeof(source) === "object" && source !== null && !Array.isArray(source);
5609
5873
  }
5610
5874
 
5875
+ /**
5876
+ * Where an editor goes when the Studio's language changes under them.
5877
+ *
5878
+ * - `stay`: the path is in that language, or in none.
5879
+ * - `path`: the same entry in that language (`counterpart`), or the nearest
5880
+ * parent that is not in another language (`parent`).
5881
+ * - `home`: neither exists, so the editor goes to the Studio's start, with
5882
+ * nothing selected.
5883
+ */
5884
+
5885
+ /**
5886
+ * Where to move a path to when the Studio is switched to `locale`.
5887
+ *
5888
+ * The rule, in the order it is tried:
5889
+ *
5890
+ * 1. **The same entry in `locale`, where Val KNOWS it.** That is two cases:
5891
+ * a locale-keyed record, where the counterpart of `"en-US"` is the
5892
+ * `"nb-NO"` key of the same record; and a router whose URLs name their
5893
+ * language, where `/about` and `/nb/about` differ only in it. Only a key
5894
+ * that exists is taken, and the rest of the path is kept as far as it
5895
+ * still exists, so an editor on a field lands on that field.
5896
+ * 2. **Otherwise the nearest parent that is not in another language.** An
5897
+ * English post in a list of posts gives the list, now showing Norwegian.
5898
+ * 3. **Otherwise the Studio's start**, which is `home`: nothing selected. That
5899
+ * is where an object at the module root opened the scope (the whole module
5900
+ * is in another language), and where the parent would be a router: a list
5901
+ * of pages is not a page, and the Pages tree is how an editor sees one.
5902
+ *
5903
+ * Not the site's root page, and not any other page: which language a page is
5904
+ * in is the page's own business, and `/` can be in the language the editor
5905
+ * just left. The start screen is in no language.
5906
+ *
5907
+ * Never a guess. Two pages whose URLs differ in more than the language — a
5908
+ * Norwegian slug for a Norwegian page — are not known to be translations of
5909
+ * each other, so that is `home` rather than whichever page looks closest.
5910
+ */
5911
+ function relocateForLocale(path, locale, schema, source, available) {
5912
+ var scope = localeScopeAt(path, schema, source, available);
5913
+ if (scope === null || scope.locale === locale) {
5914
+ return {
5915
+ type: "stay"
5916
+ };
5917
+ }
5918
+ var _Internal$splitModule = Internal.splitModuleFilePathAndModulePath(path),
5919
+ _Internal$splitModule2 = _slicedToArray(_Internal$splitModule, 2),
5920
+ moduleFilePath = _Internal$splitModule2[0],
5921
+ modulePath = _Internal$splitModule2[1];
5922
+ var segments = modulePath ? Internal.splitModulePath(modulePath) : [];
5923
+ var at = function at(parts) {
5924
+ return Internal.joinModuleFilePathAndModulePath(moduleFilePath, Internal.patchPathToModulePath(parts));
5925
+ };
5926
+ var prefix = segments.slice(0, scope.depth);
5927
+ var rest = segments.slice(scope.depth + 1);
5928
+ if (scope.kind === "record-key") {
5929
+ var record = sourceAt(source, prefix);
5930
+ var key = isJsonObject(record) ? Object.keys(record).find(function (candidate) {
5931
+ return localeMeantBy(scope.keySchema, candidate, available) === locale;
5932
+ }) : undefined;
5933
+ if (key !== undefined) {
5934
+ return {
5935
+ type: "path",
5936
+ path: at(existingPart(source, [].concat(_toConsumableArray(prefix), [key]), rest)),
5937
+ reason: "counterpart"
5938
+ };
5939
+ }
5940
+ return {
5941
+ type: "path",
5942
+ path: at(prefix),
5943
+ reason: "parent"
5944
+ };
5945
+ }
5946
+ if (scope.kind === "route-key") {
5947
+ var router = sourceAt(source, prefix);
5948
+ var current = localeParamOfRouteKey(scope.router, moduleFilePath, segments[scope.depth]);
5949
+ if (isJsonObject(router) && current !== null) {
5950
+ var _key = Object.keys(router).find(function (candidate) {
5951
+ var other = localeParamOfRouteKey(scope.router, moduleFilePath, candidate);
5952
+ return other !== null && localeMeantBy(other.schema, other.value, available) === locale && sameRouteExcept(current.values, other.values, current.name);
5953
+ });
5954
+ if (_key !== undefined) {
5955
+ return {
5956
+ type: "path",
5957
+ path: at(existingPart(source, [].concat(_toConsumableArray(prefix), [_key]), rest)),
5958
+ reason: "counterpart"
5959
+ };
5960
+ }
5961
+ }
5962
+ return {
5963
+ type: "home"
5964
+ };
5965
+ }
5966
+
5967
+ // A locale FIELD opened the scope, on the node `depth` segments down.
5968
+ if (scope.depth === 0) {
5969
+ return {
5970
+ type: "home"
5971
+ };
5972
+ }
5973
+ var parent = segments.slice(0, scope.depth - 1);
5974
+ if (parent.length === 0 && schema.type === "record" && schema.router !== undefined) {
5975
+ return {
5976
+ type: "home"
5977
+ };
5978
+ }
5979
+ return {
5980
+ type: "path",
5981
+ path: at(parent),
5982
+ reason: "parent"
5983
+ };
5984
+ }
5985
+
5986
+ /** The source at `parts` below `source`, or `null` where it runs out. */
5987
+ function sourceAt(source, parts) {
5988
+ var current = source;
5989
+ var _iterator = _createForOfIteratorHelper(parts),
5990
+ _step;
5991
+ try {
5992
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
5993
+ var part = _step.value;
5994
+ current = childSource(current, part);
5995
+ }
5996
+ } catch (err) {
5997
+ _iterator.e(err);
5998
+ } finally {
5999
+ _iterator.f();
6000
+ }
6001
+ return current;
6002
+ }
6003
+
6004
+ /**
6005
+ * `base`, followed by as much of `rest` as the source still has.
6006
+ *
6007
+ * The counterpart of a field is the same field in the other language's entry,
6008
+ * but that entry can be `null` — declared and not yet written — or shorter (a
6009
+ * list with fewer items). Landing on the entry then is the right answer: it is
6010
+ * the translation the editor is about to write.
6011
+ */
6012
+ function existingPart(source, base, rest) {
6013
+ var parts = _toConsumableArray(base);
6014
+ var current = sourceAt(source, base);
6015
+ var _iterator2 = _createForOfIteratorHelper(rest),
6016
+ _step2;
6017
+ try {
6018
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
6019
+ var part = _step2.value;
6020
+ var next = childSource(current, part);
6021
+ if (next === null) {
6022
+ break;
6023
+ }
6024
+ parts.push(part);
6025
+ current = next;
6026
+ }
6027
+ } catch (err) {
6028
+ _iterator2.e(err);
6029
+ } finally {
6030
+ _iterator2.f();
6031
+ }
6032
+ return parts;
6033
+ }
6034
+
6035
+ /** Whether two routes' parameters agree on everything but `ignore`. */
6036
+ function sameRouteExcept(a, b, ignore) {
6037
+ var names = new Set([].concat(_toConsumableArray(Object.keys(a)), _toConsumableArray(Object.keys(b))));
6038
+ var _iterator3 = _createForOfIteratorHelper(names),
6039
+ _step3;
6040
+ try {
6041
+ for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
6042
+ var _a$name, _b$name;
6043
+ var name = _step3.value;
6044
+ if (name !== ignore && ((_a$name = a[name]) !== null && _a$name !== void 0 ? _a$name : null) !== ((_b$name = b[name]) !== null && _b$name !== void 0 ? _b$name : null)) {
6045
+ return false;
6046
+ }
6047
+ }
6048
+ } catch (err) {
6049
+ _iterator3.e(err);
6050
+ } finally {
6051
+ _iterator3.f();
6052
+ }
6053
+ return true;
6054
+ }
6055
+
5611
6056
  /**
5612
6057
  * Local `yyyy-MM-dd`, which is the one thing this module used `date-fns` for.
5613
6058
  *
@@ -5785,7 +6230,383 @@ function emptyRecord(schema, context) {
5785
6230
  }));
5786
6231
  }
5787
6232
 
5788
- 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"];
6233
+ 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", "list_sketchpads", "create_sketchpad", "read_sketchpad", "write_sketchpad"];
6234
+
6235
+ /**
6236
+ * A page sketch: a page written as indented text, with four primitives.
6237
+ *
6238
+ * ```
6239
+ * # Our people text (a heading: #, ## or ###)
6240
+ * We are 40 people in Oslo. text (a paragraph)
6241
+ * [image: Team photo] placeholder: [kind] or [kind: label]
6242
+ * [hero: Roof](image: /a.jpg) a placeholder with an image (or video) in it
6243
+ * icon hero M3 5h18v14H3z how every [hero] box is drawn: SVG path data
6244
+ * row its children side by side
6245
+ * col 2 its children stacked; 2 shares of the row
6246
+ * ## Design
6247
+ * col
6248
+ * [button: Join us]
6249
+ * ```
6250
+ *
6251
+ * It is a scratch pad, not a layout language: it says WHAT is on a page and
6252
+ * roughly WHERE, so an assistant and a person can agree on a page's content
6253
+ * before anyone worries about how it looks. The person never sees this text,
6254
+ * only the page it describes; the assistant never sees the page, only this.
6255
+ * So the two have to be the same thing, and the format is STRICT: there is
6256
+ * exactly one way to write what is on the screen. `checkSketch` is that
6257
+ * rule, and the server refuses a write that breaks it, with the line to fix.
6258
+ *
6259
+ * Parsing is still forgiving, so a sketch that breaks the rule shows what it
6260
+ * can rather than nothing; that is for reading, never for accepting.
6261
+ *
6262
+ * A placeholder's kind is any word, and nothing here knows what one means. The
6263
+ * assistant that writes the sketch also draws each kind's icon, as path data
6264
+ * in a 24 by 24 box, so a kind nobody thought of looks as deliberate as an
6265
+ * image. Media put in a box is written into the text too, so the assistant
6266
+ * that builds the page reads it exactly as the person left it.
6267
+ */
6268
+
6269
+ var CONTAINER = /^(row|col)(?:\s+(\d+))?$/;
6270
+ var PLACEHOLDER = /^\[([^\]:]*)(?::([^\]]*))?\](?:\((image|video):\s*([^\s)]+)\s*\))?$/;
6271
+ var HAS_MEDIA = /^\[[^\]]*\]\(/;
6272
+ var ICON = /^icon\s+(\S+)\s+([Mm][\d\s.-].*)$/;
6273
+ var PATH_DATA = /^[Mm][MmLlHhVvCcSsQqTtAaZz\d\s.,-]*$/;
6274
+ var HEADING = /^(#{1,3})\s+(.*)$/;
6275
+ function parseSketch(source) {
6276
+ var blocks = [];
6277
+ var errors = [];
6278
+ var icons = {};
6279
+ // The containers that are open at the current line, innermost last.
6280
+ var stack = [{
6281
+ type: "page",
6282
+ indent: -1,
6283
+ children: blocks,
6284
+ lastIndent: null
6285
+ }];
6286
+ source.split(/\r?\n/).forEach(function (raw, index) {
6287
+ var line = index + 1;
6288
+ var expanded = raw.replace(/\t/g, " ");
6289
+ var content = expanded.trim();
6290
+ if (content === "") {
6291
+ return;
6292
+ }
6293
+ var indent = expanded.length - expanded.trimStart().length;
6294
+
6295
+ // An icon is not a block, so it can go anywhere and closes nothing.
6296
+ var icon = ICON.exec(content);
6297
+ if (icon) {
6298
+ var path = icon[2].trim();
6299
+ if (PATH_DATA.test(path)) {
6300
+ icons[icon[1].toLowerCase()] = path;
6301
+ } else {
6302
+ errors.push({
6303
+ line: line,
6304
+ message: 'An icon is SVG path data for a 24 by 24 box, like "icon stat M3 17l6-6 4 4 8-8". Only path commands and numbers are allowed.'
6305
+ });
6306
+ }
6307
+ return;
6308
+ }
6309
+ while (stack.length > 1 && indent <= stack[stack.length - 1].indent) {
6310
+ stack.pop();
6311
+ }
6312
+ var parent = stack[stack.length - 1];
6313
+ var node = parseContent(content, line, errors);
6314
+
6315
+ // Indented further than the block above it, and that block is not a
6316
+ // container. Keep it as that block's sibling rather than dropping it.
6317
+ if (parent.lastIndent !== null && indent > parent.lastIndent) {
6318
+ errors.push({
6319
+ line: line,
6320
+ message: "Only row and col can hold other blocks. Indent this as much as the line above it."
6321
+ });
6322
+ } else {
6323
+ parent.lastIndent = indent;
6324
+ }
6325
+ if (node.type === "col" && parent.type !== "row") {
6326
+ errors.push({
6327
+ line: line,
6328
+ message: "A col only goes directly inside a row."
6329
+ });
6330
+ }
6331
+ if (node.type === "row" && parent.type === "row") {
6332
+ errors.push({
6333
+ line: line,
6334
+ message: "A row goes in a col, not directly in another row."
6335
+ });
6336
+ }
6337
+ parent.children.push(node);
6338
+ if (node.type === "row" || node.type === "col") {
6339
+ stack.push({
6340
+ type: node.type,
6341
+ indent: indent,
6342
+ children: node.children,
6343
+ lastIndent: null
6344
+ });
6345
+ }
6346
+ });
6347
+ return {
6348
+ blocks: blocks,
6349
+ icons: icons,
6350
+ errors: errors
6351
+ };
6352
+ }
6353
+ function parseContent(content, line, errors) {
6354
+ // A leading backslash keeps a line that looks like a keyword as text.
6355
+ if (content.startsWith("\\")) {
6356
+ return {
6357
+ type: "text",
6358
+ line: line,
6359
+ level: 0,
6360
+ text: content.slice(1)
6361
+ };
6362
+ }
6363
+ var container = CONTAINER.exec(content);
6364
+ if (container) {
6365
+ if (container[1] === "row") {
6366
+ if (container[2] !== undefined) {
6367
+ errors.push({
6368
+ line: line,
6369
+ message: "A row takes no number. Put it on a col: \"col ".concat(container[2], "\".")
6370
+ });
6371
+ }
6372
+ return {
6373
+ type: "row",
6374
+ line: line,
6375
+ children: []
6376
+ };
6377
+ }
6378
+ var weight = container[2] === undefined ? 1 : Number(container[2]);
6379
+ if (weight === 0) {
6380
+ errors.push({
6381
+ line: line,
6382
+ message: "A col needs a weight of 1 or more."
6383
+ });
6384
+ }
6385
+ return {
6386
+ type: "col",
6387
+ line: line,
6388
+ weight: Math.max(weight, 1),
6389
+ children: []
6390
+ };
6391
+ }
6392
+ if (content.startsWith("[")) {
6393
+ var placeholder = PLACEHOLDER.exec(content);
6394
+ if (placeholder) {
6395
+ var _placeholder$;
6396
+ var kind = placeholder[1].trim();
6397
+ var label = (_placeholder$ = placeholder[2]) === null || _placeholder$ === void 0 ? void 0 : _placeholder$.trim();
6398
+ if (/\s/.test(kind)) {
6399
+ // An icon line names a kind by one word, so a kind has to be one.
6400
+ errors.push({
6401
+ line: line,
6402
+ message: "A box's kind is one word: \"[".concat(kind.replace(/\s+/g, "-")).concat(label ? ": ".concat(label) : "", "]\".")
6403
+ });
6404
+ }
6405
+ var mediaType = placeholder[3];
6406
+ return {
6407
+ type: "placeholder",
6408
+ line: line,
6409
+ kind: kind === "" ? "block" : kind,
6410
+ label: label ? label : null,
6411
+ media: mediaType === "image" || mediaType === "video" ? {
6412
+ type: mediaType,
6413
+ src: placeholder[4]
6414
+ } : null
6415
+ };
6416
+ }
6417
+ if (HAS_MEDIA.test(content)) {
6418
+ errors.push({
6419
+ line: line,
6420
+ message: 'Media in a box is written after it as (image: url) or (video: url), like "[hero: Team photo](image: /public/val/team.jpg)".'
6421
+ });
6422
+ return {
6423
+ type: "text",
6424
+ line: line,
6425
+ level: 0,
6426
+ text: content
6427
+ };
6428
+ }
6429
+ errors.push({
6430
+ line: line,
6431
+ message: 'A placeholder is written [kind] or [kind: label], on a line of its own, like "[image: Team photo]".'
6432
+ });
6433
+ return {
6434
+ type: "text",
6435
+ line: line,
6436
+ level: 0,
6437
+ text: content
6438
+ };
6439
+ }
6440
+ var heading = HEADING.exec(content);
6441
+ if (heading) {
6442
+ var level = heading[1].length === 1 ? 1 : heading[1].length === 2 ? 2 : 3;
6443
+ return {
6444
+ type: "text",
6445
+ line: line,
6446
+ level: level,
6447
+ text: heading[2]
6448
+ };
6449
+ }
6450
+ return {
6451
+ type: "text",
6452
+ line: line,
6453
+ level: 0,
6454
+ text: content
6455
+ };
6456
+ }
6457
+
6458
+ /**
6459
+ * The line a text block is written as. Line breaks become spaces, and a
6460
+ * paragraph that would read as something else is kept as text with `\`.
6461
+ */
6462
+ function formatSketchText(level, text) {
6463
+ var flat = text.replace(/\s+/g, " ").trim();
6464
+ if (level > 0) {
6465
+ return "#".repeat(level) + " " + flat;
6466
+ }
6467
+ var ambiguous = flat.startsWith("\\") || flat.startsWith("[") || CONTAINER.test(flat) || HEADING.test(flat) || ICON.test(flat);
6468
+ return ambiguous ? "\\" + flat : flat;
6469
+ }
6470
+
6471
+ /** The line a placeholder is written as. */
6472
+ function formatSketchBox(placeholder) {
6473
+ var clean = function clean(text) {
6474
+ return text.replace(/[[\]]/g, "").replace(/\s+/g, " ").trim();
6475
+ };
6476
+ var kind = clean(placeholder.kind).replace(/:/g, "") || "block";
6477
+ var label = placeholder.label === null ? "" : clean(placeholder.label);
6478
+ var media = placeholder.media ? "(".concat(placeholder.media.type, ": ").concat(placeholder.media.src.replace(/[\s)]/g, encodeURIComponent), ")") : "";
6479
+ return "[".concat(kind).concat(label ? ": ".concat(label) : "", "]").concat(media);
6480
+ }
6481
+
6482
+ /**
6483
+ * The ONE way of writing `blocks` and `icons`: what `checkSketch` holds every
6484
+ * other text to, and what the Studio's editor writes (its own serializer is
6485
+ * tested against this one). Two spaces per level; an empty row gets an empty
6486
+ * col, so it has somewhere to type; a col outside a row is written as its
6487
+ * contents, which is all it shows; the icons last, after one blank line, and
6488
+ * no blank line anywhere else; a final newline. Empty text is not written --
6489
+ * it is not on the page.
6490
+ */
6491
+ function formatSketch(blocks, icons) {
6492
+ var lines = [];
6493
+ var _walk = function walk(node, depth, inRow) {
6494
+ var indent = " ".repeat(depth);
6495
+ switch (node.type) {
6496
+ case "text":
6497
+ if (node.text) {
6498
+ lines.push(indent + formatSketchText(node.level, node.text));
6499
+ }
6500
+ return;
6501
+ case "placeholder":
6502
+ lines.push(indent + formatSketchBox(node));
6503
+ return;
6504
+ case "row":
6505
+ lines.push(indent + "row");
6506
+ if (node.children.length === 0) {
6507
+ lines.push(indent + " col");
6508
+ }
6509
+ node.children.forEach(function (child) {
6510
+ return _walk(child, depth + 1, true);
6511
+ });
6512
+ return;
6513
+ case "col":
6514
+ if (!inRow) {
6515
+ node.children.forEach(function (child) {
6516
+ return _walk(child, depth, false);
6517
+ });
6518
+ return;
6519
+ }
6520
+ lines.push(indent + (node.weight === 1 ? "col" : "col ".concat(node.weight)));
6521
+ node.children.forEach(function (child) {
6522
+ return _walk(child, depth + 1, false);
6523
+ });
6524
+ return;
6525
+ }
6526
+ };
6527
+ blocks.forEach(function (block) {
6528
+ return _walk(block, 0, false);
6529
+ });
6530
+ var iconLines = Object.entries(icons).map(function (_ref) {
6531
+ var _ref2 = _slicedToArray(_ref, 2),
6532
+ kind = _ref2[0],
6533
+ path = _ref2[1];
6534
+ return "icon ".concat(kind, " ").concat(path);
6535
+ });
6536
+ var all = [].concat(lines, _toConsumableArray(iconLines.length > 0 ? [""].concat(_toConsumableArray(iconLines)) : []));
6537
+ return all.length > 0 ? all.join("\n") + "\n" : "";
6538
+ }
6539
+
6540
+ /**
6541
+ * What a list names a sketch by: its first top-level heading, the biggest
6542
+ * one first. Null for a sketch with no heading, which a list then names by
6543
+ * its page.
6544
+ */
6545
+ function sketchTitle(blocks) {
6546
+ var _loop = function _loop() {
6547
+ var level = _arr[_i];
6548
+ var heading = blocks.find(function (block) {
6549
+ return block.type === "text" && block.level === level && block.text !== "";
6550
+ });
6551
+ if (heading) {
6552
+ return {
6553
+ v: heading.text
6554
+ };
6555
+ }
6556
+ },
6557
+ _ret;
6558
+ for (var _i = 0, _arr = [1, 2, 3]; _i < _arr.length; _i++) {
6559
+ _ret = _loop();
6560
+ if (_ret) return _ret.v;
6561
+ }
6562
+ return null;
6563
+ }
6564
+
6565
+ /**
6566
+ * Everything wrong with `source`, or nothing when it is a sketch exactly as
6567
+ * `formatSketch` writes it.
6568
+ *
6569
+ * Strict on purpose. The person sees the page and the assistant sees the
6570
+ * text, so a text with two spellings of one page -- a tab or two spaces, an
6571
+ * icon line here or there, a blank line or none -- is a text the assistant
6572
+ * cannot trust to be what is on the screen, and that would show it a change
6573
+ * nobody made the next time the Studio writes it back. Holding every write
6574
+ * to the one spelling rules all of that out at once.
6575
+ *
6576
+ * The parse errors come first; past those, the first line that is spelled
6577
+ * differently, with how it should be spelled.
6578
+ */
6579
+ function checkSketch(source) {
6580
+ var _parseSketch = parseSketch(source),
6581
+ blocks = _parseSketch.blocks,
6582
+ icons = _parseSketch.icons,
6583
+ errors = _parseSketch.errors;
6584
+ if (errors.length > 0) {
6585
+ return errors;
6586
+ }
6587
+ var canonical = formatSketch(blocks, icons);
6588
+ if (canonical === source) {
6589
+ return [];
6590
+ }
6591
+ if (canonical !== "" && !source.endsWith("\n")) {
6592
+ return [{
6593
+ line: source.split("\n").length,
6594
+ message: "A sketch ends with a newline."
6595
+ }];
6596
+ }
6597
+ // Compared without the final newline, so an extra one is an extra line.
6598
+ var given = source.slice(0, -1).split("\n");
6599
+ var wanted = canonical.slice(0, -1).split("\n");
6600
+ for (var i = 0; i < Math.max(given.length, wanted.length); i++) {
6601
+ if (given[i] !== wanted[i]) {
6602
+ return [{
6603
+ line: i + 1,
6604
+ message: wanted[i] === undefined ? "Nothing goes here: the sketch ends on the line before." : given[i] === "" ? "No blank lines: the one blank line in a sketch is before its icons." : given[i] === undefined ? "The sketch goes on: \"".concat(wanted[i], "\".") : "This line is written ".concat(JSON.stringify(wanted[i]), " in a sketch: two spaces per level, the icons last after one blank line, and no other blank lines.")
6605
+ }];
6606
+ }
6607
+ }
6608
+ return [];
6609
+ }
5789
6610
 
5790
6611
  function buildFileRefValue(filePath, metadata) {
5791
6612
  return _objectSpread2({
@@ -8726,4 +9547,4 @@ var messageOf = function messageOf(error) {
8726
9547
  return error instanceof Error ? error.message : String(error);
8727
9548
  };
8728
9549
 
8729
- export { AA_LARGE, AA_TEXT, AIToolCallSummaries, AnalyticsBeacon, Api, BRAND_CONTRAST_PAIRS, BinaryFileRef, CodeOptions, ColorOptions, DEFAULT_ERROR_MESSAGE, DateOptions, ENCODE_DEFAULTS, ENCODE_MIME_TYPE_OF, FileOptions, HistoricalCommit, HistoricalModule, HistoricalPatchSet, HistoryError, ImageEncodeOption, ImageOptions, JSONValue, JSON_ENTRIES_BATCH_MAX, LOCAL_FILE_IN_REMOTE_PROJECT_HINT, LOCAL_FILE_IN_REMOTE_PROJECT_WARNING, ModuleComparison, NEVER_ENCODED, ParentRef$1 as ParentRef, Patch, PatchBlock, PatchId, PatchJSON, PatchSets, PlanRefusalError, RAMP_STEPS, RemirrorBr, RemirrorBulletList, RemirrorHeading, RemirrorImage, RemirrorJSON, RemirrorLinkMark, RemirrorListItem, RemirrorOrderedList, RemirrorParagraph, RemirrorText, RemirrorTextMark, RestoreVerdict, RichTextOptions, SCHEMA_SOURCE_FIXES, SELF_CHECK_VERSION, STUDIO_FIXES, SerializedArraySchema, SerializedBooleanSchema, SerializedCodeSchema, SerializedColorSchema, SerializedDateSchema, SerializedDateTimeSchema, SerializedDiscriminatedUnionSchema, SerializedEnumSchema, SerializedFileSchema, SerializedImageSchema, SerializedKeyOfSchema, SerializedLiteralSchema, SerializedLocaleSchema, SerializedNumberSchema, SerializedObjectSchema, SerializedRecordSchema, SerializedRichTextSchema, SerializedRouteSchema, SerializedSchema, SerializedSettingsSchema, SerializedStringSchema, SerializedValViewSchema, SerializedVideoSchema, SharedValConfig, VAL_ENABLE_COOKIE_NAME, VAL_GREEN_RAMP, VAL_SESSION_COOKIE, VAL_STATE_COOKIE, VAL_STUDIO_HEADER, ValCommit, ValDeployment, VideoOptions, VideoStreamOption, WARNING_FIXES, WASM_ENCODED_MIME_TYPES, accentRamp, buildDuplicatePatch, buildEmptyAtPathPatch, buildFileRefValue, buildImageGalleryPatch, buildRemoveImageGalleryEntryPatch, buildSearchIndex, chainHeadOf, checkCompatibility, chooseEncoded, concatModulePath, contrastRatio, createRegExpFromPattern, createSearchIndex, createValClient, declaredLocales, describeContainerAtPath, emptyOf, enumLocaleTag, explainIncompatible, fallbackMimeType, filterBlockingValidationErrors, filterRoutesByPatterns, findSimilar, fitWithin, flattenRichText, forEachRichTextImage, getErrorMessageFromUnknownJson, getFilenameFromRef, getInlineImgInfo, getKeyOfRecordAt, getRefParts, getRoutesOf, getRoutesWithModulePaths, getSourceAt, getValDemo, indexModule, isInsidePatchSetPath, isLocaleSchema, isMimeTypeAccepted, isRemoteSchema, isRepairedOnSave, isSchemaSourceFixError, isSkippedSource, isStudioFix, isValidationWarning, isWarningFix, joinSharedChanges, keyOfRecordPath, levenshtein, localeAt, localeMeantBy, memoizePerRequest, newestCommitSha, partitionValidationErrors, performSearch, proposalCustomProperties, relativeLuminance, remirrorToRichTextSource, removeModule, resolveEncodeSettings, resolvePairGround, resolveSchemaSourceFixForError, resolveSchemaSourceFixes, resolveSerializedSchemaAtPath, richTextImageSchema, richTextToRemirror, safeParsePatch, schemaErrorsOf, schemaTypesOfPath, selectionClosure, selfCheck, shouldEncodeWithWasm, sideFiles, sideSource, sourcePathOfChild, themeCustomProperties, toolNames, traverseSchemaSource, urlOf, validateRoutePatterns, withExtension };
9550
+ export { AA_LARGE, AA_TEXT, AIToolCallSummaries, AnalyticsBeacon, Api, BRAND_CONTRAST_PAIRS, BinaryFileRef, CodeOptions, ColorOptions, DEFAULT_ERROR_MESSAGE, DateOptions, ENCODE_DEFAULTS, ENCODE_MIME_TYPE_OF, FileOptions, HistoricalCommit, HistoricalModule, HistoricalPatchSet, HistoryError, ImageEncodeOption, ImageOptions, JSONValue, JSON_ENTRIES_BATCH_MAX, LOCAL_FILE_IN_REMOTE_PROJECT_HINT, LOCAL_FILE_IN_REMOTE_PROJECT_WARNING, ModuleComparison, NEVER_ENCODED, ParentRef$1 as ParentRef, Patch, PatchBlock, PatchId, PatchJSON, PatchSets, PlanRefusalError, RAMP_STEPS, RemirrorBr, RemirrorBulletList, RemirrorHeading, RemirrorImage, RemirrorJSON, RemirrorLinkMark, RemirrorListItem, RemirrorOrderedList, RemirrorParagraph, RemirrorText, RemirrorTextMark, RestoreVerdict, RichTextOptions, SCHEMA_SOURCE_FIXES, SELF_CHECK_VERSION, SKETCHPAD_MAX_TEXT_LENGTH, STUDIO_FIXES, SerializedArraySchema, SerializedBooleanSchema, SerializedCodeSchema, SerializedColorSchema, SerializedDateSchema, SerializedDateTimeSchema, SerializedDiscriminatedUnionSchema, SerializedEnumSchema, SerializedFileSchema, SerializedImageSchema, SerializedKeyOfSchema, SerializedLiteralSchema, SerializedLocaleSchema, SerializedNumberSchema, SerializedObjectSchema, SerializedRecordSchema, SerializedRichTextSchema, SerializedRouteSchema, SerializedSchema, SerializedSettingsSchema, SerializedStringSchema, SerializedValViewSchema, SerializedVideoSchema, SharedValConfig, Sketchpad, SketchpadSummary, VAL_ENABLE_COOKIE_NAME, VAL_GREEN_RAMP, VAL_SESSION_COOKIE, VAL_STATE_COOKIE, VAL_STUDIO_HEADER, ValCommit, ValDeployment, VideoOptions, VideoStreamOption, WARNING_FIXES, WASM_ENCODED_MIME_TYPES, accentRamp, buildDuplicatePatch, buildEmptyAtPathPatch, buildFileRefValue, buildImageGalleryPatch, buildRemoveImageGalleryEntryPatch, buildSearchIndex, chainHeadOf, checkCompatibility, checkSketch, childSource, chooseEncoded, concatModulePath, contrastRatio, createRegExpFromPattern, createSearchIndex, createValClient, declaredLocales, describeContainerAtPath, emptyOf, enumLocaleTag, explainIncompatible, fallbackMimeType, filterBlockingValidationErrors, filterRoutesByPatterns, findSimilar, fitWithin, flattenRichText, forEachRichTextImage, formatSketch, formatSketchBox, formatSketchText, getErrorMessageFromUnknownJson, getFilenameFromRef, getInlineImgInfo, getKeyOfRecordAt, getRefParts, getRoutesOf, getRoutesWithModulePaths, getSourceAt, getValDemo, hasLocaleRouteParam, indexModule, isInsidePatchSetPath, isJsonObject, isLocaleSchema, isMimeTypeAccepted, isRemoteSchema, isRepairedOnSave, isSchemaSourceFixError, isSkippedSource, isStudioFix, isValidationWarning, isWarningFix, joinSharedChanges, keyOfRecordPath, levenshtein, localeAt, localeMeantBy, localeOfModuleRoot, localeOfRouteKey, localeParamOfRouteKey, localeScopeAt, memoizePerRequest, newestCommitSha, parseSketch, partitionValidationErrors, performSearch, proposalCustomProperties, relativeLuminance, relocateForLocale, remirrorToRichTextSource, removeModule, resolveEncodeSettings, resolvePairGround, resolveSchemaSourceFixForError, resolveSchemaSourceFixes, resolveSerializedSchemaAtPath, richTextImageSchema, richTextToRemirror, safeParsePatch, schemaErrorsOf, schemaTypesOfPath, selectionClosure, selfCheck, shouldEncodeWithWasm, sideFiles, sideSource, sketchTitle, sourcePathOfChild, themeCustomProperties, toolNames, traverseSchemaSource, urlOf, validateRoutePatterns, withExtension };