marko 6.0.8 → 6.0.9

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.
package/dist/debug/dom.js CHANGED
@@ -246,6 +246,10 @@ var DEFAULT_RENDER_ID = "_";
246
246
 
247
247
  // src/dom/resume.ts
248
248
  var registeredValues = {};
249
+ var branchesEnabled;
250
+ function enableBranches() {
251
+ branchesEnabled = 1;
252
+ }
249
253
  function init(runtimeId = DEFAULT_RUNTIME_ID) {
250
254
  if (true) {
251
255
  if (!runtimeId.match(/^[_$a-z][_$a-z0-9]*$/i)) {
@@ -312,41 +316,43 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
312
316
  if (token === "*" /* Node */) {
313
317
  const node = scope[data2] = visit.previousSibling;
314
318
  scope["Getter:" /* Getter */ + data2] = () => node;
315
- } else if (token === "[" /* BranchStart */) {
316
- if (currentBranchId && dataIndex) {
317
- branchEnd(currentBranchId, visit);
319
+ } else if (branchesEnabled) {
320
+ if (token === "[" /* BranchStart */) {
321
+ if (currentBranchId && dataIndex) {
322
+ branchEnd(currentBranchId, visit);
323
+ currentBranchId = branchStack.pop();
324
+ }
325
+ if (currentBranchId) {
326
+ branchStack.push(currentBranchId);
327
+ parentBranchIds.set(scopeId, currentBranchId);
328
+ }
329
+ currentBranchId = scopeId;
330
+ scope.___startNode = visit;
331
+ } else if (token === "]" /* BranchEnd */) {
332
+ scope[data2] = visit;
333
+ const curParent = visit.parentNode;
334
+ const startNode = branchEnd(
335
+ currentBranchId,
336
+ visit
337
+ ).___startNode;
338
+ if (curParent !== startNode.parentNode) {
339
+ curParent.prepend(startNode);
340
+ }
318
341
  currentBranchId = branchStack.pop();
319
- }
320
- if (currentBranchId) {
321
- branchStack.push(currentBranchId);
322
- parentBranchIds.set(scopeId, currentBranchId);
323
- }
324
- currentBranchId = scopeId;
325
- scope.___startNode = visit;
326
- } else if (token === "]" /* BranchEnd */) {
327
- scope[data2] = visit;
328
- const curParent = visit.parentNode;
329
- const startNode = branchEnd(
330
- currentBranchId,
331
- visit
332
- ).___startNode;
333
- if (curParent !== startNode.parentNode) {
334
- curParent.prepend(startNode);
335
- }
336
- currentBranchId = branchStack.pop();
337
- } else if (token === "|" /* BranchSingleNode */ || token === "=" /* BranchSingleNodeOnlyChildInParent */) {
338
- let next = data2.indexOf(" ");
339
- let curNode = visit;
340
- scope[~next ? data2.slice(0, next) : data2] = token === "=" /* BranchSingleNodeOnlyChildInParent */ ? visit.parentNode : visit;
341
- while (~next) {
342
- const start = next + 1;
343
- next = data2.indexOf(" ", start);
344
- const childScopeId = +data2.slice(
345
- start,
346
- ~next ? next : data2.length
347
- );
348
- curNode = branchEnd(childScopeId, curNode).___endNode;
349
- parentBranchIds.set(childScopeId, scopeId);
342
+ } else if (token === "|" /* BranchSingleNode */ || token === "=" /* BranchSingleNodeOnlyChildInParent */) {
343
+ let next = data2.indexOf(" ");
344
+ let curNode = visit;
345
+ scope[~next ? data2.slice(0, next) : data2] = token === "=" /* BranchSingleNodeOnlyChildInParent */ ? visit.parentNode : visit;
346
+ while (~next) {
347
+ const start = next + 1;
348
+ next = data2.indexOf(" ", start);
349
+ const childScopeId = +data2.slice(
350
+ start,
351
+ ~next ? next : data2.length
352
+ );
353
+ curNode = branchEnd(childScopeId, curNode).___endNode;
354
+ parentBranchIds.set(childScopeId, scopeId);
355
+ }
350
356
  }
351
357
  }
352
358
  }
@@ -378,19 +384,21 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
378
384
  prevScope
379
385
  );
380
386
  }
381
- const parentBranchId = scope["#ClosestBranchId" /* ClosestBranchId */] || parentBranchIds.get(scopeId);
382
- if (parentBranchId) {
383
- scope.___closestBranch = scopeLookup[parentBranchId];
384
- }
385
- if (branchIds.has(scopeId)) {
386
- const branch = scope;
387
- const parentBranch = branch.___closestBranch;
388
- scope.___closestBranch = branch;
389
- if (parentBranch) {
390
- branch.___parentBranch = parentBranch;
391
- (parentBranch.___branchScopes ||= /* @__PURE__ */ new Set()).add(
392
- branch
393
- );
387
+ if (branchesEnabled) {
388
+ const parentBranchId = scope["#ClosestBranchId" /* ClosestBranchId */] || parentBranchIds.get(scopeId);
389
+ if (parentBranchId) {
390
+ scope.___closestBranch = scopeLookup[parentBranchId];
391
+ }
392
+ if (branchIds.has(scopeId)) {
393
+ const branch = scope;
394
+ const parentBranch = branch.___closestBranch;
395
+ scope.___closestBranch = branch;
396
+ if (parentBranch) {
397
+ branch.___parentBranch = parentBranch;
398
+ (parentBranch.___branchScopes ||= /* @__PURE__ */ new Set()).add(
399
+ branch
400
+ );
401
+ }
394
402
  }
395
403
  }
396
404
  if (true) {
@@ -1767,6 +1775,7 @@ function renderCatch(scope, error) {
1767
1775
  }
1768
1776
  function conditional(nodeAccessor, ...branches) {
1769
1777
  const branchAccessor = "ConditionalRenderer:" /* ConditionalRenderer */ + nodeAccessor;
1778
+ enableBranches();
1770
1779
  return (scope, newBranch) => {
1771
1780
  if (newBranch !== scope[branchAccessor]) {
1772
1781
  setConditionalRenderer(
@@ -1784,6 +1793,7 @@ function patchDynamicTag(fn) {
1784
1793
  var dynamicTag = function dynamicTag2(nodeAccessor, getContent, getTagVar, inputIsArgs) {
1785
1794
  const childScopeAccessor = "ConditionalScope:" /* ConditionalScope */ + nodeAccessor;
1786
1795
  const rendererAccessor = "ConditionalRenderer:" /* ConditionalRenderer */ + nodeAccessor;
1796
+ enableBranches();
1787
1797
  return (scope, newRenderer, getInput) => {
1788
1798
  const normalizedRenderer = normalizeDynamicRenderer(newRenderer);
1789
1799
  if (scope[rendererAccessor] !== (scope[rendererAccessor] = normalizedRenderer?.___id || normalizedRenderer) || getContent && !(normalizedRenderer || scope[childScopeAccessor])) {
@@ -1903,6 +1913,7 @@ function loopTo(nodeAccessor, renderer) {
1903
1913
  }
1904
1914
  function loop(nodeAccessor, renderer, forEach) {
1905
1915
  const params = renderer.___params;
1916
+ enableBranches();
1906
1917
  return (scope, value2) => {
1907
1918
  const referenceNode = scope[nodeAccessor];
1908
1919
  const oldMap = scope["LoopScopeMap:" /* LoopScopeMap */ + nodeAccessor];
@@ -2069,6 +2080,7 @@ var runRender = (render) => render.___signal(render.___scope, render.___value);
2069
2080
  var enableCatch = () => {
2070
2081
  enableCatch = () => {
2071
2082
  };
2083
+ enableBranches();
2072
2084
  const handlePendingTry = (fn, scope, branch) => {
2073
2085
  while (branch) {
2074
2086
  if (branch.___pendingAsyncCount) {
@@ -154,6 +154,10 @@ var DEFAULT_RENDER_ID = "_";
154
154
 
155
155
  // src/dom/resume.ts
156
156
  var registeredValues = {};
157
+ var branchesEnabled;
158
+ function enableBranches() {
159
+ branchesEnabled = 1;
160
+ }
157
161
  function init(runtimeId = DEFAULT_RUNTIME_ID) {
158
162
  if (true) {
159
163
  if (!runtimeId.match(/^[_$a-z][_$a-z0-9]*$/i)) {
@@ -220,41 +224,43 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
220
224
  if (token === "*" /* Node */) {
221
225
  const node = scope[data2] = visit.previousSibling;
222
226
  scope["Getter:" /* Getter */ + data2] = () => node;
223
- } else if (token === "[" /* BranchStart */) {
224
- if (currentBranchId && dataIndex) {
225
- branchEnd(currentBranchId, visit);
227
+ } else if (branchesEnabled) {
228
+ if (token === "[" /* BranchStart */) {
229
+ if (currentBranchId && dataIndex) {
230
+ branchEnd(currentBranchId, visit);
231
+ currentBranchId = branchStack.pop();
232
+ }
233
+ if (currentBranchId) {
234
+ branchStack.push(currentBranchId);
235
+ parentBranchIds.set(scopeId, currentBranchId);
236
+ }
237
+ currentBranchId = scopeId;
238
+ scope.___startNode = visit;
239
+ } else if (token === "]" /* BranchEnd */) {
240
+ scope[data2] = visit;
241
+ const curParent = visit.parentNode;
242
+ const startNode = branchEnd(
243
+ currentBranchId,
244
+ visit
245
+ ).___startNode;
246
+ if (curParent !== startNode.parentNode) {
247
+ curParent.prepend(startNode);
248
+ }
226
249
  currentBranchId = branchStack.pop();
227
- }
228
- if (currentBranchId) {
229
- branchStack.push(currentBranchId);
230
- parentBranchIds.set(scopeId, currentBranchId);
231
- }
232
- currentBranchId = scopeId;
233
- scope.___startNode = visit;
234
- } else if (token === "]" /* BranchEnd */) {
235
- scope[data2] = visit;
236
- const curParent = visit.parentNode;
237
- const startNode = branchEnd(
238
- currentBranchId,
239
- visit
240
- ).___startNode;
241
- if (curParent !== startNode.parentNode) {
242
- curParent.prepend(startNode);
243
- }
244
- currentBranchId = branchStack.pop();
245
- } else if (token === "|" /* BranchSingleNode */ || token === "=" /* BranchSingleNodeOnlyChildInParent */) {
246
- let next = data2.indexOf(" ");
247
- let curNode = visit;
248
- scope[~next ? data2.slice(0, next) : data2] = token === "=" /* BranchSingleNodeOnlyChildInParent */ ? visit.parentNode : visit;
249
- while (~next) {
250
- const start = next + 1;
251
- next = data2.indexOf(" ", start);
252
- const childScopeId = +data2.slice(
253
- start,
254
- ~next ? next : data2.length
255
- );
256
- curNode = branchEnd(childScopeId, curNode).___endNode;
257
- parentBranchIds.set(childScopeId, scopeId);
250
+ } else if (token === "|" /* BranchSingleNode */ || token === "=" /* BranchSingleNodeOnlyChildInParent */) {
251
+ let next = data2.indexOf(" ");
252
+ let curNode = visit;
253
+ scope[~next ? data2.slice(0, next) : data2] = token === "=" /* BranchSingleNodeOnlyChildInParent */ ? visit.parentNode : visit;
254
+ while (~next) {
255
+ const start = next + 1;
256
+ next = data2.indexOf(" ", start);
257
+ const childScopeId = +data2.slice(
258
+ start,
259
+ ~next ? next : data2.length
260
+ );
261
+ curNode = branchEnd(childScopeId, curNode).___endNode;
262
+ parentBranchIds.set(childScopeId, scopeId);
263
+ }
258
264
  }
259
265
  }
260
266
  }
@@ -286,19 +292,21 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
286
292
  prevScope
287
293
  );
288
294
  }
289
- const parentBranchId = scope["#ClosestBranchId" /* ClosestBranchId */] || parentBranchIds.get(scopeId);
290
- if (parentBranchId) {
291
- scope.___closestBranch = scopeLookup[parentBranchId];
292
- }
293
- if (branchIds.has(scopeId)) {
294
- const branch = scope;
295
- const parentBranch = branch.___closestBranch;
296
- scope.___closestBranch = branch;
297
- if (parentBranch) {
298
- branch.___parentBranch = parentBranch;
299
- (parentBranch.___branchScopes ||= /* @__PURE__ */ new Set()).add(
300
- branch
301
- );
295
+ if (branchesEnabled) {
296
+ const parentBranchId = scope["#ClosestBranchId" /* ClosestBranchId */] || parentBranchIds.get(scopeId);
297
+ if (parentBranchId) {
298
+ scope.___closestBranch = scopeLookup[parentBranchId];
299
+ }
300
+ if (branchIds.has(scopeId)) {
301
+ const branch = scope;
302
+ const parentBranch = branch.___closestBranch;
303
+ scope.___closestBranch = branch;
304
+ if (parentBranch) {
305
+ branch.___parentBranch = parentBranch;
306
+ (parentBranch.___branchScopes ||= /* @__PURE__ */ new Set()).add(
307
+ branch
308
+ );
309
+ }
302
310
  }
303
311
  }
304
312
  if (true) {
@@ -1675,6 +1683,7 @@ function renderCatch(scope, error) {
1675
1683
  }
1676
1684
  function conditional(nodeAccessor, ...branches) {
1677
1685
  const branchAccessor = "ConditionalRenderer:" /* ConditionalRenderer */ + nodeAccessor;
1686
+ enableBranches();
1678
1687
  return (scope, newBranch) => {
1679
1688
  if (newBranch !== scope[branchAccessor]) {
1680
1689
  setConditionalRenderer(
@@ -1692,6 +1701,7 @@ function patchDynamicTag(fn) {
1692
1701
  var dynamicTag = function dynamicTag2(nodeAccessor, getContent, getTagVar, inputIsArgs) {
1693
1702
  const childScopeAccessor = "ConditionalScope:" /* ConditionalScope */ + nodeAccessor;
1694
1703
  const rendererAccessor = "ConditionalRenderer:" /* ConditionalRenderer */ + nodeAccessor;
1704
+ enableBranches();
1695
1705
  return (scope, newRenderer, getInput) => {
1696
1706
  const normalizedRenderer = normalizeDynamicRenderer(newRenderer);
1697
1707
  if (scope[rendererAccessor] !== (scope[rendererAccessor] = normalizedRenderer?.___id || normalizedRenderer) || getContent && !(normalizedRenderer || scope[childScopeAccessor])) {
@@ -1811,6 +1821,7 @@ function loopTo(nodeAccessor, renderer) {
1811
1821
  }
1812
1822
  function loop(nodeAccessor, renderer, forEach) {
1813
1823
  const params = renderer.___params;
1824
+ enableBranches();
1814
1825
  return (scope, value2) => {
1815
1826
  const referenceNode = scope[nodeAccessor];
1816
1827
  const oldMap = scope["LoopScopeMap:" /* LoopScopeMap */ + nodeAccessor];
@@ -1977,6 +1988,7 @@ var runRender = (render) => render.___signal(render.___scope, render.___value);
1977
1988
  var enableCatch = () => {
1978
1989
  enableCatch = () => {
1979
1990
  };
1991
+ enableBranches();
1980
1992
  const handlePendingTry = (fn, scope, branch) => {
1981
1993
  while (branch) {
1982
1994
  if (branch.___pendingAsyncCount) {
@@ -1,5 +1,7 @@
1
1
  import { type Scope } from "../common/types";
2
2
  import type { Signal } from "./signals";
3
+ export declare let branchesEnabled: undefined | 1;
4
+ export declare function enableBranches(): void;
3
5
  export declare function init(runtimeId?: string): void;
4
6
  export declare let isResuming: undefined | 0 | 1;
5
7
  export declare function register<T>(id: string, obj: T): T;
package/dist/dom.js CHANGED
@@ -201,7 +201,10 @@ function stripSpacesAndPunctuation(str) {
201
201
  var DEFAULT_RUNTIME_ID = "M", DEFAULT_RENDER_ID = "_";
202
202
 
203
203
  // src/dom/resume.ts
204
- var registeredValues = {};
204
+ var registeredValues = {}, branchesEnabled;
205
+ function enableBranches() {
206
+ branchesEnabled = 1;
207
+ }
205
208
  function init(runtimeId = DEFAULT_RUNTIME_ID) {
206
209
  let renders = self[runtimeId], defineRuntime = (desc) => Object.defineProperty(self, runtimeId, desc), resumeRender, initRuntime = (renders2) => {
207
210
  defineRuntime({
@@ -226,25 +229,27 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
226
229
  if (token === "*" /* Node */) {
227
230
  let node = scope[data2] = visit.previousSibling;
228
231
  scope["j" /* Getter */ + data2] = () => node;
229
- } else if (token === "[" /* BranchStart */)
230
- currentBranchId && dataIndex && (branchEnd(currentBranchId, visit), currentBranchId = branchStack.pop()), currentBranchId && (branchStack.push(currentBranchId), parentBranchIds.set(scopeId, currentBranchId)), currentBranchId = scopeId, scope.h = visit;
231
- else if (token === "]" /* BranchEnd */) {
232
- scope[data2] = visit;
233
- let curParent = visit.parentNode, startNode = branchEnd(
234
- currentBranchId,
235
- visit
236
- ).h;
237
- curParent !== startNode.parentNode && curParent.prepend(startNode), currentBranchId = branchStack.pop();
238
- } else if (token === "|" /* BranchSingleNode */ || token === "=" /* BranchSingleNodeOnlyChildInParent */) {
239
- let next = data2.indexOf(" "), curNode = visit;
240
- for (scope[~next ? data2.slice(0, next) : data2] = token === "=" /* BranchSingleNodeOnlyChildInParent */ ? visit.parentNode : visit; ~next; ) {
241
- let start = next + 1;
242
- next = data2.indexOf(" ", start);
243
- let childScopeId = +data2.slice(
244
- start,
245
- ~next ? next : data2.length
246
- );
247
- curNode = branchEnd(childScopeId, curNode).j, parentBranchIds.set(childScopeId, scopeId);
232
+ } else if (branchesEnabled) {
233
+ if (token === "[" /* BranchStart */)
234
+ currentBranchId && dataIndex && (branchEnd(currentBranchId, visit), currentBranchId = branchStack.pop()), currentBranchId && (branchStack.push(currentBranchId), parentBranchIds.set(scopeId, currentBranchId)), currentBranchId = scopeId, scope.h = visit;
235
+ else if (token === "]" /* BranchEnd */) {
236
+ scope[data2] = visit;
237
+ let curParent = visit.parentNode, startNode = branchEnd(
238
+ currentBranchId,
239
+ visit
240
+ ).h;
241
+ curParent !== startNode.parentNode && curParent.prepend(startNode), currentBranchId = branchStack.pop();
242
+ } else if (token === "|" /* BranchSingleNode */ || token === "=" /* BranchSingleNodeOnlyChildInParent */) {
243
+ let next = data2.indexOf(" "), curNode = visit;
244
+ for (scope[~next ? data2.slice(0, next) : data2] = token === "=" /* BranchSingleNodeOnlyChildInParent */ ? visit.parentNode : visit; ~next; ) {
245
+ let start = next + 1;
246
+ next = data2.indexOf(" ", start);
247
+ let childScopeId = +data2.slice(
248
+ start,
249
+ ~next ? next : data2.length
250
+ );
251
+ curNode = branchEnd(childScopeId, curNode).j, parentBranchIds.set(childScopeId, scopeId);
252
+ }
248
253
  }
249
254
  }
250
255
  }
@@ -264,16 +269,17 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
264
269
  lastScopeId += scope;
265
270
  else {
266
271
  let scopeId = ++lastScopeId, prevScope = scopeLookup[scopeId];
267
- scope.$global = $global, scope.m = scopeId, prevScope !== scope && (scopeLookup[scopeId] = Object.assign(
272
+ if (scope.$global = $global, scope.m = scopeId, prevScope !== scope && (scopeLookup[scopeId] = Object.assign(
268
273
  scope,
269
274
  prevScope
270
- ));
271
- let parentBranchId = scope.g || parentBranchIds.get(scopeId);
272
- if (parentBranchId && (scope.k = scopeLookup[parentBranchId]), branchIds.has(scopeId)) {
273
- let branch = scope, parentBranch = branch.k;
274
- scope.k = branch, parentBranch && (branch.t = parentBranch, (parentBranch.z ||= /* @__PURE__ */ new Set()).add(
275
- branch
276
- ));
275
+ )), branchesEnabled) {
276
+ let parentBranchId = scope.g || parentBranchIds.get(scopeId);
277
+ if (parentBranchId && (scope.k = scopeLookup[parentBranchId]), branchIds.has(scopeId)) {
278
+ let branch = scope, parentBranch = branch.k;
279
+ scope.k = branch, parentBranch && (branch.t = parentBranch, (parentBranch.z ||= /* @__PURE__ */ new Set()).add(
280
+ branch
281
+ ));
282
+ }
277
283
  }
278
284
  }
279
285
  } finally {
@@ -1173,7 +1179,7 @@ function renderCatch(scope, error) {
1173
1179
  }
1174
1180
  function conditional(nodeAccessor, ...branches) {
1175
1181
  let branchAccessor = "c" /* ConditionalRenderer */ + nodeAccessor;
1176
- return (scope, newBranch) => {
1182
+ return enableBranches(), (scope, newBranch) => {
1177
1183
  newBranch !== scope[branchAccessor] && setConditionalRenderer(
1178
1184
  scope,
1179
1185
  nodeAccessor,
@@ -1187,7 +1193,7 @@ function patchDynamicTag(fn) {
1187
1193
  }
1188
1194
  var dynamicTag = function(nodeAccessor, getContent, getTagVar, inputIsArgs) {
1189
1195
  let childScopeAccessor = "d" /* ConditionalScope */ + nodeAccessor, rendererAccessor = "c" /* ConditionalRenderer */ + nodeAccessor;
1190
- return (scope, newRenderer, getInput) => {
1196
+ return enableBranches(), (scope, newRenderer, getInput) => {
1191
1197
  let normalizedRenderer = normalizeDynamicRenderer(newRenderer);
1192
1198
  if (scope[rendererAccessor] !== (scope[rendererAccessor] = normalizedRenderer?.m || normalizedRenderer) || getContent && !(normalizedRenderer || scope[childScopeAccessor]))
1193
1199
  if (setConditionalRenderer(
@@ -1270,7 +1276,7 @@ function loopTo(nodeAccessor, renderer) {
1270
1276
  }
1271
1277
  function loop(nodeAccessor, renderer, forEach) {
1272
1278
  let params = renderer.l;
1273
- return (scope, value2) => {
1279
+ return enableBranches(), (scope, value2) => {
1274
1280
  let referenceNode = scope[nodeAccessor], oldMap = scope["m" /* LoopScopeMap */ + nodeAccessor], oldArray = oldMap ? scope["l" /* LoopScopeArray */ + nodeAccessor] || [
1275
1281
  ...oldMap.values()
1276
1282
  ] : [], parentNode = referenceNode.nodeType > 1 /* Element */ ? referenceNode.parentNode || oldArray[0].h.parentNode : referenceNode, newMap = scope["m" /* LoopScopeMap */ + nodeAccessor] = /* @__PURE__ */ new Map(), newArray = scope["l" /* LoopScopeArray */ + nodeAccessor] = [];
@@ -1372,7 +1378,7 @@ function runRenders() {
1372
1378
  }
1373
1379
  var runRender = (render) => render.L(render.D, render.I), enableCatch = () => {
1374
1380
  enableCatch = () => {
1375
- };
1381
+ }, enableBranches();
1376
1382
  let handlePendingTry = (fn, scope, branch) => {
1377
1383
  for (; branch; ) {
1378
1384
  if (branch.n)
package/dist/dom.mjs CHANGED
@@ -112,7 +112,10 @@ function stripSpacesAndPunctuation(str) {
112
112
  var DEFAULT_RUNTIME_ID = "M", DEFAULT_RENDER_ID = "_";
113
113
 
114
114
  // src/dom/resume.ts
115
- var registeredValues = {};
115
+ var registeredValues = {}, branchesEnabled;
116
+ function enableBranches() {
117
+ branchesEnabled = 1;
118
+ }
116
119
  function init(runtimeId = DEFAULT_RUNTIME_ID) {
117
120
  let renders = self[runtimeId], defineRuntime = (desc) => Object.defineProperty(self, runtimeId, desc), resumeRender, initRuntime = (renders2) => {
118
121
  defineRuntime({
@@ -137,25 +140,27 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
137
140
  if (token === "*" /* Node */) {
138
141
  let node = scope[data2] = visit.previousSibling;
139
142
  scope["j" /* Getter */ + data2] = () => node;
140
- } else if (token === "[" /* BranchStart */)
141
- currentBranchId && dataIndex && (branchEnd(currentBranchId, visit), currentBranchId = branchStack.pop()), currentBranchId && (branchStack.push(currentBranchId), parentBranchIds.set(scopeId, currentBranchId)), currentBranchId = scopeId, scope.h = visit;
142
- else if (token === "]" /* BranchEnd */) {
143
- scope[data2] = visit;
144
- let curParent = visit.parentNode, startNode = branchEnd(
145
- currentBranchId,
146
- visit
147
- ).h;
148
- curParent !== startNode.parentNode && curParent.prepend(startNode), currentBranchId = branchStack.pop();
149
- } else if (token === "|" /* BranchSingleNode */ || token === "=" /* BranchSingleNodeOnlyChildInParent */) {
150
- let next = data2.indexOf(" "), curNode = visit;
151
- for (scope[~next ? data2.slice(0, next) : data2] = token === "=" /* BranchSingleNodeOnlyChildInParent */ ? visit.parentNode : visit; ~next; ) {
152
- let start = next + 1;
153
- next = data2.indexOf(" ", start);
154
- let childScopeId = +data2.slice(
155
- start,
156
- ~next ? next : data2.length
157
- );
158
- curNode = branchEnd(childScopeId, curNode).j, parentBranchIds.set(childScopeId, scopeId);
143
+ } else if (branchesEnabled) {
144
+ if (token === "[" /* BranchStart */)
145
+ currentBranchId && dataIndex && (branchEnd(currentBranchId, visit), currentBranchId = branchStack.pop()), currentBranchId && (branchStack.push(currentBranchId), parentBranchIds.set(scopeId, currentBranchId)), currentBranchId = scopeId, scope.h = visit;
146
+ else if (token === "]" /* BranchEnd */) {
147
+ scope[data2] = visit;
148
+ let curParent = visit.parentNode, startNode = branchEnd(
149
+ currentBranchId,
150
+ visit
151
+ ).h;
152
+ curParent !== startNode.parentNode && curParent.prepend(startNode), currentBranchId = branchStack.pop();
153
+ } else if (token === "|" /* BranchSingleNode */ || token === "=" /* BranchSingleNodeOnlyChildInParent */) {
154
+ let next = data2.indexOf(" "), curNode = visit;
155
+ for (scope[~next ? data2.slice(0, next) : data2] = token === "=" /* BranchSingleNodeOnlyChildInParent */ ? visit.parentNode : visit; ~next; ) {
156
+ let start = next + 1;
157
+ next = data2.indexOf(" ", start);
158
+ let childScopeId = +data2.slice(
159
+ start,
160
+ ~next ? next : data2.length
161
+ );
162
+ curNode = branchEnd(childScopeId, curNode).j, parentBranchIds.set(childScopeId, scopeId);
163
+ }
159
164
  }
160
165
  }
161
166
  }
@@ -175,16 +180,17 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
175
180
  lastScopeId += scope;
176
181
  else {
177
182
  let scopeId = ++lastScopeId, prevScope = scopeLookup[scopeId];
178
- scope.$global = $global, scope.m = scopeId, prevScope !== scope && (scopeLookup[scopeId] = Object.assign(
183
+ if (scope.$global = $global, scope.m = scopeId, prevScope !== scope && (scopeLookup[scopeId] = Object.assign(
179
184
  scope,
180
185
  prevScope
181
- ));
182
- let parentBranchId = scope.g || parentBranchIds.get(scopeId);
183
- if (parentBranchId && (scope.k = scopeLookup[parentBranchId]), branchIds.has(scopeId)) {
184
- let branch = scope, parentBranch = branch.k;
185
- scope.k = branch, parentBranch && (branch.t = parentBranch, (parentBranch.z ||= /* @__PURE__ */ new Set()).add(
186
- branch
187
- ));
186
+ )), branchesEnabled) {
187
+ let parentBranchId = scope.g || parentBranchIds.get(scopeId);
188
+ if (parentBranchId && (scope.k = scopeLookup[parentBranchId]), branchIds.has(scopeId)) {
189
+ let branch = scope, parentBranch = branch.k;
190
+ scope.k = branch, parentBranch && (branch.t = parentBranch, (parentBranch.z ||= /* @__PURE__ */ new Set()).add(
191
+ branch
192
+ ));
193
+ }
188
194
  }
189
195
  }
190
196
  } finally {
@@ -1084,7 +1090,7 @@ function renderCatch(scope, error) {
1084
1090
  }
1085
1091
  function conditional(nodeAccessor, ...branches) {
1086
1092
  let branchAccessor = "c" /* ConditionalRenderer */ + nodeAccessor;
1087
- return (scope, newBranch) => {
1093
+ return enableBranches(), (scope, newBranch) => {
1088
1094
  newBranch !== scope[branchAccessor] && setConditionalRenderer(
1089
1095
  scope,
1090
1096
  nodeAccessor,
@@ -1098,7 +1104,7 @@ function patchDynamicTag(fn) {
1098
1104
  }
1099
1105
  var dynamicTag = function(nodeAccessor, getContent, getTagVar, inputIsArgs) {
1100
1106
  let childScopeAccessor = "d" /* ConditionalScope */ + nodeAccessor, rendererAccessor = "c" /* ConditionalRenderer */ + nodeAccessor;
1101
- return (scope, newRenderer, getInput) => {
1107
+ return enableBranches(), (scope, newRenderer, getInput) => {
1102
1108
  let normalizedRenderer = normalizeDynamicRenderer(newRenderer);
1103
1109
  if (scope[rendererAccessor] !== (scope[rendererAccessor] = normalizedRenderer?.m || normalizedRenderer) || getContent && !(normalizedRenderer || scope[childScopeAccessor]))
1104
1110
  if (setConditionalRenderer(
@@ -1181,7 +1187,7 @@ function loopTo(nodeAccessor, renderer) {
1181
1187
  }
1182
1188
  function loop(nodeAccessor, renderer, forEach) {
1183
1189
  let params = renderer.l;
1184
- return (scope, value2) => {
1190
+ return enableBranches(), (scope, value2) => {
1185
1191
  let referenceNode = scope[nodeAccessor], oldMap = scope["m" /* LoopScopeMap */ + nodeAccessor], oldArray = oldMap ? scope["l" /* LoopScopeArray */ + nodeAccessor] || [
1186
1192
  ...oldMap.values()
1187
1193
  ] : [], parentNode = referenceNode.nodeType > 1 /* Element */ ? referenceNode.parentNode || oldArray[0].h.parentNode : referenceNode, newMap = scope["m" /* LoopScopeMap */ + nodeAccessor] = /* @__PURE__ */ new Map(), newArray = scope["l" /* LoopScopeArray */ + nodeAccessor] = [];
@@ -1283,7 +1289,7 @@ function runRenders() {
1283
1289
  }
1284
1290
  var runRender = (render) => render.L(render.D, render.I), enableCatch = () => {
1285
1291
  enableCatch = () => {
1286
- };
1292
+ }, enableBranches();
1287
1293
  let handlePendingTry = (fn, scope, branch) => {
1288
1294
  for (; branch; ) {
1289
1295
  if (branch.n)