@rohal12/spindle 0.62.9 → 0.64.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5895,118 +5895,144 @@ function propertyName(node, src) {
5895
5895
  * identifiers here are declared (a `let`, a parameter), where a sigil
5896
5896
  * variable can't be. `shorthand`: the node is a shorthand property's value.
5897
5897
  */
5898
- function walk(node, src, out, binding, shorthand, access = "read") {
5899
- if (Array.isArray(node)) {
5900
- for (const n of node) walk(n, src, out, binding, false, access);
5901
- return;
5902
- }
5903
- if (!isNode(node)) return;
5904
- const sub = (child, bind = false, short = false, role = "read") => walk(child, src, out, bind, short, role);
5905
- switch (node.type) {
5906
- case "Identifier": {
5907
- const sigil = sigilOf(node, src);
5908
- if (!sigil) return;
5909
- if (binding) throw new CodeSyntaxError(`"${node.name}" is a ${NAMESPACE_NAME[sigil[0]]} variable and can't be declared`, src, node.start);
5910
- out.refs.push({
5911
- sigil: sigil[0],
5912
- name: sigil[1],
5913
- start: node.start,
5914
- end: node.end,
5915
- shorthand,
5916
- read: access !== "write",
5917
- write: access !== "read"
5918
- });
5898
+ function walk(root, src, out, binding, shorthand, access = "read") {
5899
+ const pending = [[
5900
+ root,
5901
+ binding,
5902
+ shorthand,
5903
+ access
5904
+ ]];
5905
+ while (pending.length) {
5906
+ const [node, bind, short, role] = pending.pop();
5907
+ const children = [];
5908
+ visit(node, bind, short, role, children);
5909
+ for (let i = children.length - 1; i >= 0; i--) pending.push(children[i]);
5910
+ }
5911
+ function visit(node, binding, shorthand, access, children) {
5912
+ if (Array.isArray(node)) {
5913
+ for (const n of node) children.push([
5914
+ n,
5915
+ binding,
5916
+ false,
5917
+ access
5918
+ ]);
5919
5919
  return;
5920
5920
  }
5921
- case "Literal":
5922
- if (typeof node.value === "string") out.strings.push(src.slice(node.start + 1, node.end - 1));
5923
- return;
5924
- case "TemplateElement":
5925
- out.strings.push(node.value.raw);
5926
- return;
5927
- case "MemberExpression":
5928
- sub(node.object);
5929
- if (node.computed) sub(node.property);
5930
- else propertyName(node.property, src);
5931
- return;
5932
- case "Property":
5933
- if (node.computed) sub(node.key);
5934
- else if (!node.shorthand) propertyName(node.key, src);
5935
- if (node.shorthand) {
5936
- const value = node.value;
5937
- if (value.type === "AssignmentPattern") {
5938
- sub(value.left, binding, true, access);
5939
- sub(value.right);
5940
- } else sub(value, binding, true, access);
5941
- } else sub(node.value, binding, false, access);
5942
- return;
5943
- case "MethodDefinition":
5944
- case "PropertyDefinition":
5945
- if (node.computed) sub(node.key);
5946
- else propertyName(node.key, src);
5947
- sub(node.value);
5948
- return;
5949
- case "LabeledStatement":
5950
- sub(node.body);
5951
- return;
5952
- case "BreakStatement":
5953
- case "ContinueStatement":
5954
- case "MetaProperty":
5955
- case "PrivateIdentifier": return;
5956
- case "VariableDeclarator":
5957
- sub(node.id, true);
5958
- sub(node.init);
5959
- return;
5960
- case "FunctionDeclaration":
5961
- case "FunctionExpression":
5962
- case "ArrowFunctionExpression":
5963
- sub(node.id, true);
5964
- for (const p of node.params) sub(p, true);
5965
- sub(node.body);
5966
- return;
5967
- case "ClassDeclaration":
5968
- case "ClassExpression":
5969
- sub(node.id, true);
5970
- sub(node.superClass);
5971
- sub(node.body);
5972
- return;
5973
- case "CatchClause":
5974
- sub(node.param, true);
5975
- sub(node.body);
5976
- return;
5977
- case "AssignmentExpression":
5978
- sub(node.left, false, false, node.operator === "=" ? "write" : "readwrite");
5979
- sub(node.right);
5980
- return;
5981
- case "UnaryExpression":
5982
- sub(node.argument, false, false, node.operator === "delete" ? "write" : "read");
5983
- return;
5984
- case "UpdateExpression":
5985
- sub(node.argument, false, false, "readwrite");
5986
- return;
5987
- case "ForInStatement":
5988
- case "ForOfStatement":
5989
- sub(node.left, false, false, "write");
5990
- sub(node.right);
5991
- sub(node.body);
5992
- return;
5993
- case "AssignmentPattern":
5994
- sub(node.left, binding, false, access);
5995
- sub(node.right);
5996
- return;
5997
- case "ObjectPattern":
5998
- case "ArrayPattern":
5999
- case "RestElement":
6000
- for (const key of [
6001
- "properties",
6002
- "elements",
6003
- "argument"
6004
- ]) sub(node[key], binding, false, access);
6005
- return;
6006
- default: for (const key in node) {
6007
- if (key === "type" || key === "start" || key === "end") continue;
6008
- const v = node[key];
6009
- if (typeof v === "object" && v !== null) sub(v);
5921
+ if (!isNode(node)) return;
5922
+ const sub = (child, bind = false, short = false, role = "read") => {
5923
+ children.push([
5924
+ child,
5925
+ bind,
5926
+ short,
5927
+ role
5928
+ ]);
5929
+ };
5930
+ switch (node.type) {
5931
+ case "Identifier": {
5932
+ const sigil = sigilOf(node, src);
5933
+ if (!sigil) return;
5934
+ if (binding) throw new CodeSyntaxError(`"${node.name}" is a ${NAMESPACE_NAME[sigil[0]]} variable and can't be declared`, src, node.start);
5935
+ out.refs.push({
5936
+ sigil: sigil[0],
5937
+ name: sigil[1],
5938
+ start: node.start,
5939
+ end: node.end,
5940
+ shorthand,
5941
+ read: access !== "write",
5942
+ write: access !== "read"
5943
+ });
5944
+ return;
5945
+ }
5946
+ case "Literal":
5947
+ if (typeof node.value === "string") out.strings.push(src.slice(node.start + 1, node.end - 1));
5948
+ return;
5949
+ case "TemplateElement":
5950
+ out.strings.push(node.value.raw);
5951
+ return;
5952
+ case "MemberExpression":
5953
+ sub(node.object);
5954
+ if (node.computed) sub(node.property);
5955
+ else propertyName(node.property, src);
5956
+ return;
5957
+ case "Property":
5958
+ if (node.computed) sub(node.key);
5959
+ else if (!node.shorthand) propertyName(node.key, src);
5960
+ if (node.shorthand) {
5961
+ const value = node.value;
5962
+ if (value.type === "AssignmentPattern") {
5963
+ sub(value.left, binding, true, access);
5964
+ sub(value.right);
5965
+ } else sub(value, binding, true, access);
5966
+ } else sub(node.value, binding, false, access);
5967
+ return;
5968
+ case "MethodDefinition":
5969
+ case "PropertyDefinition":
5970
+ if (node.computed) sub(node.key);
5971
+ else propertyName(node.key, src);
5972
+ sub(node.value);
5973
+ return;
5974
+ case "LabeledStatement":
5975
+ sub(node.body);
5976
+ return;
5977
+ case "BreakStatement":
5978
+ case "ContinueStatement":
5979
+ case "MetaProperty":
5980
+ case "PrivateIdentifier": return;
5981
+ case "VariableDeclarator":
5982
+ sub(node.id, true);
5983
+ sub(node.init);
5984
+ return;
5985
+ case "FunctionDeclaration":
5986
+ case "FunctionExpression":
5987
+ case "ArrowFunctionExpression":
5988
+ sub(node.id, true);
5989
+ for (const p of node.params) sub(p, true);
5990
+ sub(node.body);
5991
+ return;
5992
+ case "ClassDeclaration":
5993
+ case "ClassExpression":
5994
+ sub(node.id, true);
5995
+ sub(node.superClass);
5996
+ sub(node.body);
5997
+ return;
5998
+ case "CatchClause":
5999
+ sub(node.param, true);
6000
+ sub(node.body);
6001
+ return;
6002
+ case "AssignmentExpression":
6003
+ sub(node.left, false, false, node.operator === "=" ? "write" : "readwrite");
6004
+ sub(node.right);
6005
+ return;
6006
+ case "UnaryExpression":
6007
+ sub(node.argument, false, false, node.operator === "delete" ? "write" : "read");
6008
+ return;
6009
+ case "UpdateExpression":
6010
+ sub(node.argument, false, false, "readwrite");
6011
+ return;
6012
+ case "ForInStatement":
6013
+ case "ForOfStatement":
6014
+ sub(node.left, false, false, "write");
6015
+ sub(node.right);
6016
+ sub(node.body);
6017
+ return;
6018
+ case "AssignmentPattern":
6019
+ sub(node.left, binding, false, access);
6020
+ sub(node.right);
6021
+ return;
6022
+ case "ObjectPattern":
6023
+ case "ArrayPattern":
6024
+ case "RestElement":
6025
+ for (const key of [
6026
+ "properties",
6027
+ "elements",
6028
+ "argument"
6029
+ ]) sub(node[key], binding, false, access);
6030
+ return;
6031
+ default: for (const key in node) {
6032
+ if (key === "type" || key === "start" || key === "end") continue;
6033
+ const v = node[key];
6034
+ if (typeof v === "object" && v !== null) sub(v);
6035
+ }
6010
6036
  }
6011
6037
  }
6012
6038
  }
@@ -13222,6 +13248,18 @@ var NameSet = class {
13222
13248
  }
13223
13249
  };
13224
13250
  //#endregion
13251
+ //#region src/components/macros/option-clauses.ts
13252
+ /** The direct value clauses read by the built-in choice controls. */
13253
+ var OPTION_CLAUSE = "option";
13254
+ function isOptionClause(name) {
13255
+ return name.toLowerCase() === OPTION_CLAUSE;
13256
+ }
13257
+ /** Replacements render their own children and do not inherit this contract. */
13258
+ function consumesOptionClauses(macro) {
13259
+ const name = macro.name.toLowerCase();
13260
+ return macro.source === "builtin" && !macro.widget && (name === "listbox" || name === "cycle");
13261
+ }
13262
+ //#endregion
13225
13263
  //#region src/registry.ts
13226
13264
  var registry = new NameMap();
13227
13265
  function registerMacro(name, component) {
@@ -13327,16 +13365,32 @@ function registerMacroMetadata(name, metadata) {
13327
13365
  if (parents?.size === 0) companionParents.delete(sub);
13328
13366
  }
13329
13367
  metadataRegistry.set(name, metadata);
13330
- for (const sub of metadata.subMacros) {
13331
- const parents = companionParents.get(sub) ?? /* @__PURE__ */ new Set();
13332
- parents.add(metadata.name.toLowerCase());
13333
- companionParents.set(sub, parents);
13368
+ indexCompanionParents(companionParents, metadata);
13369
+ }
13370
+ /** Share index construction between live registrations and stateless tooling. */
13371
+ function indexCompanionParents(index, macro) {
13372
+ const name = macro.name.toLowerCase();
13373
+ for (const sub of macro.subMacros) {
13374
+ const parents = index.get(sub) ?? /* @__PURE__ */ new Set();
13375
+ parents.add(name);
13376
+ index.set(sub, parents);
13334
13377
  }
13335
13378
  }
13336
13379
  /** The parents declaring a branching companion (input options are values). */
13337
13380
  function branchParents(name, macros) {
13338
- if (!macros) return [...companionParents.get(name) ?? []].filter((parent) => parent !== "listbox" && parent !== "cycle");
13339
- return effectiveNamedDefinitions(macros).filter((macro) => macro.name.toLowerCase() !== "listbox" && macro.name.toLowerCase() !== "cycle" && macro.subMacros.some((sub) => sub.toLowerCase() === name.toLowerCase())).map((macro) => macro.name.toLowerCase());
13381
+ if (!macros) return [...companionParents.get(name) ?? []].filter((parent) => !consumesOptionClauses(metadataRegistry.get(parent)));
13382
+ return [...branchParentLookup(macros)(name)];
13383
+ }
13384
+ /** Build once per effective metadata snapshot, then look up each token. */
13385
+ function branchParentLookup(macros) {
13386
+ const parents = new NameMap();
13387
+ for (const macro of effectiveNamedDefinitions(macros)) {
13388
+ if (consumesOptionClauses(macro)) continue;
13389
+ indexCompanionParents(parents, macro);
13390
+ }
13391
+ const index = new NameMap();
13392
+ for (const [sub, names] of parents) index.set(sub, [...names]);
13393
+ return (name) => index.get(name) ?? [];
13340
13394
  }
13341
13395
  /** The declared parameters of the macro `name`, if it declares any. */
13342
13396
  function getMacroParameters(name) {
@@ -13371,15 +13425,18 @@ var BLOCK_MACROS = new NameSet([
13371
13425
  ]);
13372
13426
  /**
13373
13427
  * The block widgets (those whose body renders `{@children}`), kept apart from
13374
- * BLOCK_MACROS: a widget is redefined, so it is a block only while its latest
13375
- * definition is, whereas the macros in BLOCK_MACROS stay blocks.
13428
+ * built-in defaults: a widget is a block only while its latest definition is.
13376
13429
  */
13377
13430
  var BLOCK_WIDGETS = new NameSet();
13378
13431
  /** All widgets, including inline ones, override built-in parsing semantics. */
13379
13432
  var WIDGETS = new NameSet();
13380
13433
  /** Classification owned by defineMacro, independent of explicit registrations. */
13381
13434
  var DEFINED_BLOCK_MACROS = new NameSet();
13435
+ var DEFINED_MACROS = new NameSet();
13436
+ /** Explicit registrations remain independent of macro/widget replacements. */
13437
+ var REGISTERED_BLOCK_MACROS = new NameSet();
13382
13438
  function setDefinedBlockMacro(name, isBlock) {
13439
+ DEFINED_MACROS.add(name);
13383
13440
  setClassification(DEFINED_BLOCK_MACROS, name, isBlock);
13384
13441
  }
13385
13442
  /** Update the classification owned by one registration source. */
@@ -13395,7 +13452,14 @@ function isRawMacro(name, widget = WIDGETS.has(name)) {
13395
13452
  }
13396
13453
  /** Whether a macro takes a body closed by `{/name}`. */
13397
13454
  function isBlockMacro(name) {
13398
- return BLOCK_MACROS.has(name) || DEFINED_BLOCK_MACROS.has(name) || BLOCK_WIDGETS.has(name);
13455
+ if (REGISTERED_BLOCK_MACROS.has(name)) return true;
13456
+ if (WIDGETS.has(name)) return BLOCK_WIDGETS.has(name);
13457
+ if (DEFINED_MACROS.has(name)) return DEFINED_BLOCK_MACROS.has(name);
13458
+ return isBuiltinBlockMacro(name);
13459
+ }
13460
+ /** Built-in defaults without any process-global registrations or widgets. */
13461
+ function isBuiltinBlockMacro(name) {
13462
+ return BLOCK_MACROS.has(name);
13399
13463
  }
13400
13464
  /**
13401
13465
  * Record whether the widget `name` takes a body, as its latest definition
@@ -13561,9 +13625,11 @@ function pairMarkup(tokens, options = {}) {
13561
13625
  const isBlock = options.isBlock ?? isBlockMacro;
13562
13626
  const isRaw = options.isRaw ?? isRawMacro;
13563
13627
  const parentsOf = (name) => {
13628
+ if (options.branchParents) return options.branchParents(name);
13629
+ const registered = branchParents(name);
13564
13630
  const lower = name.toLowerCase();
13565
13631
  const builtin = Object.prototype.hasOwnProperty.call(BRANCH_PARENT, lower) ? BRANCH_PARENT[lower] : void 0;
13566
- return builtin ? [builtin] : options.branchParents?.(name) ?? branchParents(name);
13632
+ return builtin && getMacroParameters.source(builtin) === void 0 ? [...registered, builtin] : registered;
13567
13633
  };
13568
13634
  const errors = [];
13569
13635
  const noticedAtEnd = (tokens[tokens.length - 1]?.end ?? 0) + 1;
@@ -14098,7 +14164,7 @@ function scanMarkupTolerant(source, options = {}, completion = false) {
14098
14164
  const rest = source.slice(base);
14099
14165
  const result = attempt(rest, base);
14100
14166
  if (Array.isArray(result)) {
14101
- tokens.push(...result);
14167
+ for (const token of result) tokens.push(token);
14102
14168
  break;
14103
14169
  }
14104
14170
  const at = base + result.offset;
@@ -14111,7 +14177,7 @@ function scanMarkupTolerant(source, options = {}, completion = false) {
14111
14177
  cut = prefix.offset;
14112
14178
  prefix = attempt(rest.slice(0, cut), base);
14113
14179
  }
14114
- tokens.push(...prefix);
14180
+ for (const token of prefix) tokens.push(token);
14115
14181
  damage.push(base + cut);
14116
14182
  if (cut < rest.length) {
14117
14183
  const start = base + cut;
@@ -14850,7 +14916,7 @@ var OPTION_PARAMETERS = [{
14850
14916
  required: true
14851
14917
  }];
14852
14918
  /** The parameters of the built-in sub-macros that take arguments. */
14853
- var SUB_MACRO_PARAMETERS = /* @__PURE__ */ new Map([["option", OPTION_PARAMETERS]]);
14919
+ var SUB_MACRO_PARAMETERS = /* @__PURE__ */ new Map([[OPTION_CLAUSE, OPTION_PARAMETERS]]);
14854
14920
  /** The parameters of the built-in sub-macro `name`, if it takes any. */
14855
14921
  function subMacroParameters(name) {
14856
14922
  return SUB_MACRO_PARAMETERS.get(name.toLowerCase());
@@ -14860,13 +14926,34 @@ function subMacroParameters(name) {
14860
14926
  */
14861
14927
  function extractOptions(children) {
14862
14928
  const options = [];
14863
- for (const node of children) if (node.type === "macro" && node.name === "option") {
14929
+ for (const node of children) if (node.type === "macro" && isOptionClause(node.name)) {
14864
14930
  const { value } = parseMacroArgs(node.rawArgs, OPTION_PARAMETERS);
14865
14931
  options.push(value ?? "");
14866
14932
  }
14867
14933
  return options;
14868
14934
  }
14869
14935
  //#endregion
14936
+ //#region src/markup/expansion-budget.ts
14937
+ /** Shared bounds for reparsing markup inside labels, selectors and attributes. */
14938
+ var MarkupExpansionBudget = class MarkupExpansionBudget {
14939
+ static {
14940
+ this.maxDepth = 64;
14941
+ }
14942
+ constructor(sourceLength) {
14943
+ this.depth = 0;
14944
+ this.remaining = Math.max(65536, sourceLength * 8);
14945
+ }
14946
+ enter(length) {
14947
+ if (this.depth >= MarkupExpansionBudget.maxDepth || length > this.remaining) return false;
14948
+ this.remaining -= length;
14949
+ this.depth++;
14950
+ return true;
14951
+ }
14952
+ leave() {
14953
+ this.depth--;
14954
+ }
14955
+ };
14956
+ //#endregion
14870
14957
  //#region src/code-check.ts
14871
14958
  /** While a pass runs: the code it parsed so far, by goal and source. */
14872
14959
  var parses = null;
@@ -14925,6 +15012,30 @@ function widgetParameters(params, holds = {}) {
14925
15012
  ...hasOwn(holds, name) ? { holds: holds[name] } : {}
14926
15013
  }));
14927
15014
  }
15015
+ /** A consumed branch uses its parent's argument contract, not standalone metadata. */
15016
+ function macroArgumentLookup(tokens, parametersOf) {
15017
+ let owners;
15018
+ const parentsOf = parametersOf.pairing?.branchParents ?? branchParents;
15019
+ return (token) => {
15020
+ const name = token.name.toLowerCase();
15021
+ if (parentsOf(name).length > 0 && !owners) {
15022
+ owners = /* @__PURE__ */ new Map();
15023
+ const pending = [...pairMarkup(tokens, parametersOf.pairing).nodes];
15024
+ while (pending.length) {
15025
+ const node = pending.pop();
15026
+ if (!node.body) continue;
15027
+ for (const branch of node.body.branches) {
15028
+ if (node.token.type === "macro") owners.set(branch.tag, node.token.name.toLowerCase());
15029
+ for (const child of branch.children) pending.push(child);
15030
+ }
15031
+ for (const child of node.body.children) pending.push(child);
15032
+ }
15033
+ }
15034
+ const owner = owners?.get(token);
15035
+ if (owner !== void 0) return CONDITION_MACROS.has(name) && owner === BRANCH_PARENT[name] && usesBuiltinSemantics(owner, parametersOf) ? "condition" : "branch";
15036
+ return CONDITION_MACROS.has(name) && usesBuiltinSemantics(name, parametersOf) ? "condition" : "invocation";
15037
+ };
15038
+ }
14928
15039
  /** Whether builtin-only interpretation still belongs to this implementation. */
14929
15040
  function usesBuiltinSemantics(name, parametersOf) {
14930
15041
  return parametersOf.widget?.(name) === void 0 && parametersOf.source?.(name) !== "user";
@@ -14958,10 +15069,11 @@ function withHolds(params, holds) {
14958
15069
  * A widget among `macros` says what its parameters hold (see ParametersOf).
14959
15070
  */
14960
15071
  function parameterLookup(macros) {
15072
+ const list = [...macros];
14961
15073
  const parameters = new NameMap();
14962
15074
  const widgets = new NameMap();
14963
15075
  const sources = new NameMap();
14964
- for (const { name, parameters: params, interpolate, widget, source } of macros) {
15076
+ for (const { name, parameters: params, interpolate, widget, source } of list) {
14965
15077
  sources.set(name, source ?? "user");
14966
15078
  if (params) parameters.set(name, withHolds(params, holdsByDefault(interpolate)));
14967
15079
  else parameters.delete(name);
@@ -14978,6 +15090,15 @@ function parameterLookup(macros) {
14978
15090
  };
14979
15091
  if (widgets.size > 0) lookup.widget = (name) => widgets.get(name);
14980
15092
  lookup.source = (name) => sources.get(name);
15093
+ const definitions = new NameMap(effectiveNamedDefinitions([...list.filter((macro) => !macro.widget), ...list.filter((macro) => macro.widget)]).map((macro) => [macro.name, macro]));
15094
+ lookup.pairing = {
15095
+ isBlock: (name) => definitions.get(name)?.block ?? isBuiltinBlockMacro(name),
15096
+ isRaw: (name) => isRawMacro(name, widgets.has(name)),
15097
+ branchParents: branchParentLookup([...definitions.values()].map((macro) => ({
15098
+ ...macro,
15099
+ subMacros: [...macro.subMacros ?? []]
15100
+ })))
15101
+ };
14981
15102
  return lookup;
14982
15103
  }
14983
15104
  /** What a `string` or `text` argument holds when its parameter doesn't say. */
@@ -15000,6 +15121,7 @@ function stringHolds(param) {
15000
15121
  * `parametersOf` gives the declared parameters of a macro, if it has any.
15001
15122
  */
15002
15123
  function* codeAndText(src, tokens, parametersOf) {
15124
+ const argumentRole = macroArgumentLookup(tokens, parametersOf);
15003
15125
  const closeOfTextBody = (t, name) => {
15004
15126
  for (let k = t + 1; k < tokens.length; k++) {
15005
15127
  const c = tokens[k];
@@ -15017,6 +15139,7 @@ function* codeAndText(src, tokens, parametersOf) {
15017
15139
  offset: token.targetStart,
15018
15140
  length: token.targetEnd - token.targetStart,
15019
15141
  macro: "link",
15142
+ ...usesBuiltinSemantics("link", parametersOf) && { navigation: true },
15020
15143
  label: src.slice(token.start, token.end)
15021
15144
  };
15022
15145
  if (token.display.includes("{")) yield textPiece(token.display, token.displayStart, "In the label of a link: ");
@@ -15042,6 +15165,8 @@ function* codeAndText(src, tokens, parametersOf) {
15042
15165
  }
15043
15166
  else if (token.type === "macro" && !token.isClose) {
15044
15167
  const name = token.name.toLowerCase();
15168
+ const role = argumentRole(token);
15169
+ if (role === "branch") continue;
15045
15170
  const widget = parametersOf.widget?.(name);
15046
15171
  if (executesRawBody(name, parametersOf)) {
15047
15172
  const close = closeOfTextBody(t, name);
@@ -15075,7 +15200,7 @@ function* codeAndText(src, tokens, parametersOf) {
15075
15200
  if (!args) continue;
15076
15201
  const label = `{${token.name} ${args}}`;
15077
15202
  const argsAt = token.argsStart;
15078
- if (CONDITION_MACROS.has(name) && usesBuiltinSemantics(name, parametersOf)) {
15203
+ if (role === "condition") {
15079
15204
  yield {
15080
15205
  kind: "code",
15081
15206
  code: args,
@@ -15086,7 +15211,10 @@ function* codeAndText(src, tokens, parametersOf) {
15086
15211
  continue;
15087
15212
  }
15088
15213
  const params = parametersOf(name);
15089
- if (params) yield* argPieces(args, argsAt, params, token.name, label);
15214
+ if (params) {
15215
+ const navigation = usesBuiltinSemantics(name, parametersOf) ? name === "goto" || name === "link" ? ["passage"] : name === "watch" ? ["goto"] : [] : [];
15216
+ yield* argPieces(args, argsAt, params, token.name, label, navigation);
15217
+ }
15090
15218
  if (widget) yield* widgetPieces(args, argsAt, widget, token.name, label);
15091
15219
  }
15092
15220
  }
@@ -15100,37 +15228,51 @@ function* codeAndText(src, tokens, parametersOf) {
15100
15228
  function* passagePiecesOf(src, tokens, parametersOf, options = {}) {
15101
15229
  let position;
15102
15230
  const locate = (offset) => (position ??= sourcePositions(src))(offset);
15103
- yield* expand(src, src, tokens, parametersOf, options, (i) => i, void 0, locate);
15231
+ yield* expand(src, src, tokens, parametersOf, options, (i) => i, void 0, locate, new MarkupExpansionBudget(src.length));
15104
15232
  }
15105
15233
  /**
15106
15234
  * The pieces of `tokens`, the tokens of `src`, which is the text described by
15107
15235
  * `where` (none for `root`, the markup of the whole passage), and whose
15108
15236
  * offsets `toRoot` turns into offsets in `root`.
15109
15237
  */
15110
- function* expand(root, src, tokens, parametersOf, options, toRoot, where, locate) {
15238
+ function* expand(root, src, tokens, parametersOf, options, toRoot, where, locate, budget) {
15111
15239
  for (const flat of codeAndText(src, tokens, parametersOf)) {
15112
15240
  const piece = where ? nestedPiece(flat, toRoot, where) : flat;
15113
15241
  if (flat.kind !== "text" || !flat.text.includes("{")) {
15114
15242
  yield piece;
15115
15243
  continue;
15116
15244
  }
15117
- const toText = (i) => toRoot(pieceOffset(flat, i));
15118
- const inner = analyzeMarkup(flat.text, {
15119
- text: true,
15120
- hooks: {
15121
- ...options.isBlock && { isBlock: options.isBlock },
15122
- isRaw: (name) => isRawMacro(name, parametersOf.widget?.(name) !== void 0)
15123
- }
15124
- });
15125
- yield {
15126
- ...piece,
15127
- tokens: inner.tokens.map((t) => mapOffsets(t, toText)),
15128
- errors: inner.errors.map((e) => {
15129
- const { line, column } = locate(toText(e.offset));
15130
- return new MarkupError(e.reason, toText(e.offset), line, column, e.code, toText(e.end), e.data);
15131
- })
15132
- };
15133
- yield* expand(root, flat.text, inner.tokens, parametersOf, options, toText, flat.where, locate);
15245
+ const toText = (i) => pieceOffset(piece, i);
15246
+ if (!budget.enter(flat.text.length)) {
15247
+ const at = toText(0);
15248
+ const { line, column } = locate(at);
15249
+ yield {
15250
+ ...piece,
15251
+ errors: [new MarkupError("Markup in labels and attributes exceeds the nesting or work limit", at, line, column, "nesting-limit", toText(flat.text.length), { limit: String(MarkupExpansionBudget.maxDepth) })]
15252
+ };
15253
+ continue;
15254
+ }
15255
+ try {
15256
+ const inner = analyzeMarkup(flat.text, {
15257
+ text: true,
15258
+ hooks: {
15259
+ ...parametersOf.pairing,
15260
+ ...options.isBlock && { isBlock: options.isBlock },
15261
+ isRaw: (name) => isRawMacro(name, parametersOf.widget?.(name) !== void 0)
15262
+ }
15263
+ });
15264
+ yield {
15265
+ ...piece,
15266
+ tokens: inner.tokens.map((t) => mapOffsets(t, toText)),
15267
+ errors: inner.errors.map((e) => {
15268
+ const { line, column } = locate(toText(e.offset));
15269
+ return new MarkupError(e.reason, toText(e.offset), line, column, e.code, toText(e.end), e.data);
15270
+ })
15271
+ };
15272
+ yield* expand(root, flat.text, inner.tokens, parametersOf, options, toText, flat.where, locate, budget);
15273
+ } finally {
15274
+ budget.leave();
15275
+ }
15134
15276
  }
15135
15277
  }
15136
15278
  /** `piece`, of a text in another, with its offsets turned by `toRoot`. */
@@ -15209,7 +15351,7 @@ function escapeOffsets(raw, at, value, escapes) {
15209
15351
  return escaped ? offsets : void 0;
15210
15352
  }
15211
15353
  /** The code and text in the arguments `args` (at `offset`) of `macro`. */
15212
- function* argPieces(args, offset, params, macro, label) {
15354
+ function* argPieces(args, offset, params, macro, label, navigation = []) {
15213
15355
  let values;
15214
15356
  const spans = /* @__PURE__ */ new Map();
15215
15357
  try {
@@ -15226,7 +15368,7 @@ function* argPieces(args, offset, params, macro, label) {
15226
15368
  };
15227
15369
  return;
15228
15370
  }
15229
- yield* valuePieces(args, offset, params, values, spans, macro, label, "quotes");
15371
+ yield* valuePieces(args, offset, params, values, spans, macro, label, "quotes", navigation);
15230
15372
  }
15231
15373
  /**
15232
15374
  * The code and text in the arguments `args` (at `offset`) of the widget
@@ -15259,7 +15401,7 @@ function* widgetPieces(args, offset, params, macro, label) {
15259
15401
  * (at `offset`), whose `spans` tell where each was written and whose strings
15260
15402
  * are unescaped as `escapes` says.
15261
15403
  */
15262
- function* valuePieces(args, offset, params, values, spans, macro, label, escapes) {
15404
+ function* valuePieces(args, offset, params, values, spans, macro, label, escapes, navigation = []) {
15263
15405
  const name = macro.toLowerCase();
15264
15406
  /** The pieces of the parameters `list`, with their values in `from`. */
15265
15407
  function* visit(list, from) {
@@ -15280,7 +15422,8 @@ function* valuePieces(args, offset, params, values, spans, macro, label, escapes
15280
15422
  offset: offset + start,
15281
15423
  length: end - start,
15282
15424
  macro: name,
15283
- label
15425
+ label,
15426
+ ...navigation.includes(param.name) && { navigation: true }
15284
15427
  });
15285
15428
  const goal = codeGoal(param);
15286
15429
  if (param.type === "passage") {
@@ -15409,18 +15552,19 @@ registeredParameters.source = getMacroParameters.source;
15409
15552
  * Whether the text of an attribute value or macro label renders a
15410
15553
  * `{@children}`: it is markup, parsed as the renderer parses it.
15411
15554
  */
15412
- function textContainsChildren(text, parametersOf, hooks) {
15555
+ function textContainsChildren(text, parametersOf, hooks, budget = new MarkupExpansionBudget(text.length)) {
15413
15556
  if (!text.includes("{")) return false;
15414
- let nodes;
15557
+ if (!budget.enter(text.length)) return false;
15415
15558
  try {
15416
- nodes = parseMarkup(text, {
15559
+ return astContainsChildren(parseMarkup(text, {
15417
15560
  text: true,
15418
15561
  hooks
15419
- });
15562
+ }), parametersOf, hooks, budget);
15420
15563
  } catch {
15421
15564
  return false;
15565
+ } finally {
15566
+ budget.leave();
15422
15567
  }
15423
- return astContainsChildren(nodes, parametersOf, hooks);
15424
15568
  }
15425
15569
  /**
15426
15570
  * Whether a tag renders a `{@children}` in an attribute value or a macro
@@ -15430,19 +15574,21 @@ function textContainsChildren(text, parametersOf, hooks) {
15430
15574
  * are read from it); a token made from an AST has none. Discovery hooks
15431
15575
  * also apply inside these texts, before widgets have been registered.
15432
15576
  */
15433
- function tokenTextContainsChildren(token, parametersOf = registeredParameters, src = "", hooks) {
15434
- for (const piece of codeAndText(src, [token], parametersOf)) if (piece.kind === "text" && textContainsChildren(piece.text, parametersOf, hooks)) return true;
15577
+ function tokenTextContainsChildren(token, parametersOf = registeredParameters, src = "", hooks, budget) {
15578
+ for (const piece of codeAndText(src, [token], parametersOf)) if (piece.kind === "text" && textContainsChildren(piece.text, parametersOf, hooks, budget)) return true;
15435
15579
  return false;
15436
15580
  }
15437
15581
  /**
15438
- * Recursively scan an AST node array for a VariableNode
15582
+ * Scan an AST node array for a VariableNode
15439
15583
  * with scope 'local' and name 'children' (@children), in the content and in
15440
15584
  * the attributes and labels that render markup. A nested `{widget}` is not
15441
15585
  * entered: its slot belongs to the innermost widget (as widgetDefinitions
15442
15586
  * reads it), and a definition renders nothing of its own.
15443
15587
  */
15444
- function astContainsChildren(nodes, parametersOf = registeredParameters, hooks) {
15445
- for (const node of nodes) {
15588
+ function astContainsChildren(nodes, parametersOf = registeredParameters, hooks, budget) {
15589
+ const pending = [...nodes];
15590
+ while (pending.length) {
15591
+ const node = pending.pop();
15446
15592
  if (node.type === "variable" && node.scope === "local" && node.name === "children") return true;
15447
15593
  if (node.type !== "html" && node.type !== "macro") continue;
15448
15594
  if (node.type === "macro" && node.name.toLowerCase() === "widget") continue;
@@ -15465,10 +15611,9 @@ function astContainsChildren(nodes, parametersOf = registeredParameters, hooks)
15465
15611
  nameEnd: 0,
15466
15612
  argsStart: 0,
15467
15613
  argsEnd: 0
15468
- }, parametersOf, "", hooks) || astContainsChildren(node.children, parametersOf, hooks)) return true;
15469
- if (node.type === "macro" && node.branches) {
15470
- for (const branch of node.branches) if (astContainsChildren(branch.children, parametersOf, hooks)) return true;
15471
- }
15614
+ }, parametersOf, "", hooks, budget)) return true;
15615
+ for (const child of node.children) pending.push(child);
15616
+ if (node.type === "macro" && node.branches) for (const branch of node.branches) for (const child of branch.children) pending.push(child);
15472
15617
  }
15473
15618
  return false;
15474
15619
  }
@@ -15555,6 +15700,7 @@ function widgetDefinitions(passages, parametersOf = registeredParameters) {
15555
15700
  const hooks = { isRaw: (name) => isRawMacro(name, replacesDo || parametersOf.widget?.(name) !== void 0) };
15556
15701
  for (const passage of list) {
15557
15702
  if (passage.name !== "StoryInit" && !passage.tags?.includes("widget")) continue;
15703
+ const budget = new MarkupExpansionBudget(passage.content.length);
15558
15704
  const open = [];
15559
15705
  const done = [];
15560
15706
  for (const token of tokenizeMarkupTolerant(passage.content, { hooks }).tokens) if (token.type === "macro" && token.name.toLowerCase() === "widget") {
@@ -15569,7 +15715,7 @@ function widgetDefinitions(passages, parametersOf = registeredParameters) {
15569
15715
  closeStart: token.start
15570
15716
  });
15571
15717
  }
15572
- } else if (open.length > 0 && (token.type === "variable" && token.scope === "local" && token.name === "children" || tokenTextContainsChildren(token, parametersOf, passage.content, hooks))) open[open.length - 1].isBlock = true;
15718
+ } else if (open.length > 0 && (token.type === "variable" && token.scope === "local" && token.name === "children" || tokenTextContainsChildren(token, parametersOf, passage.content, hooks, budget))) open[open.length - 1].isBlock = true;
15573
15719
  done.push(...open);
15574
15720
  const defs = [];
15575
15721
  for (const { token, isBlock, closeStart } of done) try {
@@ -16663,7 +16809,7 @@ function PlaceholderAttributes({ tag, attributes, placeholders, svg, children })
16663
16809
  return withAttributeErrors(errors, h(tag, ref ? {
16664
16810
  ...props,
16665
16811
  ref
16666
- } : props, ...children));
16812
+ } : props, children));
16667
16813
  }
16668
16814
  /** An element of markdown output with attributes to set directly. */
16669
16815
  function DirectAttributes({ tag, props, direct, children }) {
@@ -16671,7 +16817,7 @@ function DirectAttributes({ tag, props, direct, children }) {
16671
16817
  return h(tag, {
16672
16818
  ...props,
16673
16819
  ref
16674
- }, ...children);
16820
+ }, children);
16675
16821
  }
16676
16822
  /**
16677
16823
  * Show the errors met in an element's attributes in front of it, the way a
@@ -16712,10 +16858,9 @@ function parseHtmlInert(html) {
16712
16858
  */
16713
16859
  function htmlToPreact(html, ph, unwrapParagraphs = false) {
16714
16860
  const content = parseHtmlInert(html.trim());
16715
- if (unwrapParagraphs) {
16716
- for (const child of Array.from(content.childNodes)) if (child.nodeType === Node.ELEMENT_NODE && child.nodeName === "P") child.replaceWith(...Array.from(child.childNodes));
16717
- }
16718
- const children = Array.from(content.childNodes).map((child, i) => convertDomNode(child, i, ph));
16861
+ const children = [];
16862
+ for (const child of Array.from(content.childNodes)) if (unwrapParagraphs && child.nodeType === Node.ELEMENT_NODE && child.nodeName === "P") for (const node of Array.from(child.childNodes)) children.push(convertDomNode(node, children.length, ph));
16863
+ else children.push(convertDomNode(child, children.length, ph));
16719
16864
  return /* @__PURE__ */ jsx(Fragment$1, { children });
16720
16865
  }
16721
16866
  function convertDomNode(node, key, ph) {
@@ -16766,7 +16911,7 @@ function convertDomNode(node, key, ph) {
16766
16911
  return h(tag, {
16767
16912
  ...props,
16768
16913
  key
16769
- }, ...children);
16914
+ }, children);
16770
16915
  }
16771
16916
  return null;
16772
16917
  }
@@ -17252,7 +17397,7 @@ function trimLineEdges(text) {
17252
17397
  */
17253
17398
  function buildPlainTextVnodes(core, ph, unwrapParagraphs) {
17254
17399
  const children = expandPlaceholderText(trimLineEdges(core), ph).filter((part) => part !== "");
17255
- return unwrapParagraphs ? /* @__PURE__ */ jsx(Fragment$1, { children }) : h("p", null, ...children);
17400
+ return unwrapParagraphs ? /* @__PURE__ */ jsx(Fragment$1, { children }) : h("p", null, children);
17256
17401
  }
17257
17402
  /**
17258
17403
  * Render AST nodes with full CommonMark markdown support.
@@ -17279,19 +17424,23 @@ function renderNodes(nodes, options) {
17279
17424
  components,
17280
17425
  nodes: []
17281
17426
  };
17282
- let combined = "";
17427
+ const chunks = [];
17428
+ let trailingBackslash = false;
17283
17429
  for (let i = 0; i < nodes.length; i++) {
17284
17430
  const node = nodes[i];
17285
17431
  if (node.type === "text") {
17286
- combined += node.value;
17432
+ chunks.push(node.value);
17433
+ if (node.value) trailingBackslash = node.value.endsWith("\\");
17287
17434
  continue;
17288
17435
  }
17289
17436
  const phIdx = components.length;
17290
17437
  components.push(renderSingleNode(node));
17291
17438
  ph.nodes.push(node);
17292
- if (combined.endsWith("\\")) combined += ESCAPE_GUARD;
17293
- combined += placeholderHtml(ph.nonce, phIdx);
17439
+ if (trailingBackslash) chunks.push(ESCAPE_GUARD);
17440
+ chunks.push(placeholderHtml(ph.nonce, phIdx));
17441
+ trailingBackslash = false;
17294
17442
  }
17443
+ const combined = chunks.join("");
17295
17444
  const unwrapParagraphs = !!(options?.nobr || options?.inline);
17296
17445
  const lead = combined.slice(0, skipChars(combined, 0, 1, EDGE_WS));
17297
17446
  const trail = lead.length === combined.length ? "" : combined.slice(skipChars(combined, combined.length, -1, EDGE_WS));
@@ -19180,9 +19329,8 @@ function initializeStory(session) {
19180
19329
  if (!session) recordStoryInitState();
19181
19330
  }
19182
19331
  //#endregion
19183
- //#region src/store.ts
19184
- enablePatches();
19185
- enableMapSet();
19332
+ //#region src/passage-roles.ts
19333
+ /** Runtime-owned passage roles, shared with stateless authoring tools. */
19186
19334
  var SPECIAL_PASSAGES = /* @__PURE__ */ new Set([
19187
19335
  "StoryInit",
19188
19336
  "StoryInterface",
@@ -19200,6 +19348,10 @@ var SPECIAL_PASSAGES = /* @__PURE__ */ new Set([
19200
19348
  function isSpecialPassage(name) {
19201
19349
  return SPECIAL_PASSAGES.has(name);
19202
19350
  }
19351
+ //#endregion
19352
+ //#region src/store.ts
19353
+ enablePatches();
19354
+ enableMapSet();
19203
19355
  /** Full variable snapshot at history index 0. */
19204
19356
  var variableBase = createNamespace();
19205
19357
  /**
@@ -20108,13 +20260,13 @@ var useStoryStore = create()(storyStore((set, get) => ({
20108
20260
  setVariable: (name, value) => {
20109
20261
  set((state) => {
20110
20262
  checkVariableName(name, `$${name}`);
20111
- state.variables[name] = value;
20263
+ setByPath(state.variables, [name], value);
20112
20264
  });
20113
20265
  },
20114
20266
  setTemporary: (name, value) => {
20115
20267
  set((state) => {
20116
20268
  checkVariableName(name, `_${name}`);
20117
- state.temporary[name] = value;
20269
+ setByPath(state.temporary, [name], value);
20118
20270
  });
20119
20271
  },
20120
20272
  deleteVariable: (name) => {
@@ -20132,7 +20284,7 @@ var useStoryStore = create()(storyStore((set, get) => ({
20132
20284
  setTransient: (name, value) => {
20133
20285
  set((state) => {
20134
20286
  checkVariableName(name, `%${name}`);
20135
- state.transient[name] = value;
20287
+ setByPath(state.transient, [name], value);
20136
20288
  });
20137
20289
  },
20138
20290
  deleteTransient: (name) => {
@@ -21899,7 +22051,7 @@ function observe() {
21899
22051
  text: body ? observableText(body, DIALOG) : ""
21900
22052
  }));
21901
22053
  const errors = [
21902
- passageEl,
22054
+ document.getElementById("root") ?? passageEl,
21903
22055
  ...bodies.map((d) => d.body),
21904
22056
  contextEl
21905
22057
  ].flatMap((el) => el ? observableErrors(el, DIALOG, el === contextEl ? el : void 0) : []);
@@ -22400,6 +22552,13 @@ function validateMarkup(passages, options) {
22400
22552
  report(passage, at, at + piece.length, "argument-error", `${where}${piece.message} in ${piece.label}`, { macro: piece.macro });
22401
22553
  break;
22402
22554
  case "passage":
22555
+ if (piece.navigation && isSpecialPassage(piece.name)) {
22556
+ report(passage, at, at + piece.length, "special-passage", `${where}Cannot navigate to special passage ${JSON.stringify(piece.name)} in ${piece.label}.`, {
22557
+ name: piece.name,
22558
+ macro: piece.macro
22559
+ });
22560
+ break;
22561
+ }
22403
22562
  if (options.checkPassageNames !== false && !passageNames.has(piece.name)) {
22404
22563
  const best = closestName(piece.name, passageNames);
22405
22564
  report(passage, at, at + piece.length, "unknown-passage", `${where}No passage named ${JSON.stringify(piece.name)} in ${piece.label}.${didYouMean(best, JSON.stringify)}`, {
@@ -23149,7 +23308,15 @@ function scanSigilReferences(value, at, emit) {
23149
23308
  */
23150
23309
  function scanInterpolations(text, at, emit, options) {
23151
23310
  if (!text.includes("{")) return;
23152
- collectTokenRefs(text, tokensOf(text, true, options), at, emit, options);
23311
+ const budget = options.expansionBudget;
23312
+ if (!budget.enter(text.length)) return;
23313
+ try {
23314
+ const offset = at(0);
23315
+ const sourceOffsets = at(text.length) - offset === text.length ? void 0 : Array.from({ length: text.length + 1 }, (_, i) => at(i));
23316
+ collectTokenRefs(text, tokensOf(text, true, options), (i) => sourceOffsets?.[i] ?? offset + i, emit, options);
23317
+ } finally {
23318
+ budget.leave();
23319
+ }
23153
23320
  }
23154
23321
  /**
23155
23322
  * Report `$var` references in JavaScript code, lexed as the expression
@@ -23276,6 +23443,7 @@ function boundReference(token, at, all) {
23276
23443
  /** Report the `$var` references in the tokens of `content`. */
23277
23444
  function collectTokenRefs(content, tokens, at, emit, options) {
23278
23445
  const { storeVarMacros, parametersOf } = options;
23446
+ const argumentRole = macroArgumentLookup(tokens, parametersOf);
23279
23447
  for (let t = 0; t < tokens.length; t++) {
23280
23448
  const token = tokens[t];
23281
23449
  if (options.all && token.type !== "macro" && token.type !== "html" && token.type !== "text") scanSelectors(content, token, at, emit, options);
@@ -23301,13 +23469,15 @@ function collectTokenRefs(content, tokens, at, emit, options) {
23301
23469
  else scanInterpolations(value, valueIn, emit, options);
23302
23470
  }
23303
23471
  else if (token.type === "macro" && !token.isClose) {
23304
- const binding = storeVarMacros.has(token.name.toLowerCase()) && !parametersOf.widget?.(token.name) ? boundReference(token, at, options.all) : void 0;
23305
- scanArgs(token, parametersOf, at, (ref) => {
23472
+ const role = argumentRole(token);
23473
+ const binding = role === "invocation" && storeVarMacros.has(token.name.toLowerCase()) && !parametersOf.widget?.(token.name) ? boundReference(token, at, options.all) : void 0;
23474
+ if (role === "condition") scanCode(token.rawArgs, (i) => at(token.argsStart + i), emit);
23475
+ else if (role === "invocation") scanArgs(token, parametersOf, at, (ref) => {
23306
23476
  if (!binding || ref.start < binding.start || ref.start >= binding.end) emit(ref);
23307
23477
  }, options);
23308
23478
  scanSelectors(content, token, at, emit, options);
23309
23479
  if (binding) emit(binding);
23310
- if (executesRawBody(token.name, parametersOf)) {
23480
+ if (role === "invocation" && executesRawBody(token.name, parametersOf)) {
23311
23481
  let close = t + 1;
23312
23482
  while (close < tokens.length) {
23313
23483
  const c = tokens[close];
@@ -23331,7 +23501,10 @@ function collectTokenRefs(content, tokens, at, emit, options) {
23331
23501
  */
23332
23502
  function collectVariableReferences(content, options) {
23333
23503
  const found = [];
23334
- withParseCache(() => collectTokenRefs(content, tokensOf(content, false, options), (i) => i, (ref) => found.push(ref), options));
23504
+ withParseCache(() => collectTokenRefs(content, tokensOf(content, false, options), (i) => i, (ref) => found.push(ref), {
23505
+ ...options,
23506
+ expansionBudget: new MarkupExpansionBudget(content.length)
23507
+ }));
23335
23508
  return found.sort((a, b) => a.start - b.start);
23336
23509
  }
23337
23510
  /**
@@ -24445,6 +24618,7 @@ function selectIfBranch(branches, evaluate) {
24445
24618
  defineMacro({
24446
24619
  name: "if",
24447
24620
  block: true,
24621
+ subMacros: ["elseif", "else"],
24448
24622
  interpolate: true,
24449
24623
  merged: true,
24450
24624
  render({ branches = [] }, ctx) {
@@ -26002,7 +26176,7 @@ defineMacro({
26002
26176
  defineMacro({
26003
26177
  name: "listbox",
26004
26178
  interpolate: true,
26005
- subMacros: ["option"],
26179
+ subMacros: [OPTION_CLAUSE],
26006
26180
  storeVar: true,
26007
26181
  parameters: [VARIABLE_PARAMETER],
26008
26182
  render({ children = [] }, ctx) {
@@ -26031,7 +26205,7 @@ defineMacro({
26031
26205
  defineMacro({
26032
26206
  name: "cycle",
26033
26207
  block: true,
26034
- subMacros: ["option"],
26208
+ subMacros: [OPTION_CLAUSE],
26035
26209
  interpolate: true,
26036
26210
  storeVar: true,
26037
26211
  parameters: [VARIABLE_PARAMETER],