ember-source 6.4.0-alpha.2 → 6.4.0-alpha.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/build-metadata.json +3 -3
  2. package/dist/ember-template-compiler.js +907 -1527
  3. package/dist/ember-testing.js +1 -1
  4. package/dist/ember.debug.js +3574 -4029
  5. package/dist/ember.prod.js +3408 -3984
  6. package/dist/packages/@ember/-internals/glimmer/index.js +2 -2
  7. package/dist/packages/@ember/-internals/owner/index.js +1 -0
  8. package/dist/packages/@ember/application/index.js +2 -2
  9. package/dist/packages/@ember/application/instance.js +1 -1
  10. package/dist/packages/@ember/component/helper.js +1 -1
  11. package/dist/packages/@ember/component/index.js +1 -1
  12. package/dist/packages/@ember/debug/lib/capture-render-tree.js +5 -3
  13. package/dist/packages/@ember/engine/index.js +2 -2
  14. package/dist/packages/@ember/helper/index.js +1 -1
  15. package/dist/packages/@ember/modifier/index.js +1 -1
  16. package/dist/packages/@ember/renderer/index.js +1 -1
  17. package/dist/packages/@ember/routing/index.js +1 -1
  18. package/dist/packages/@ember/template/index.js +1 -1
  19. package/dist/packages/@ember/template-compiler/lib/plugins/index.js +1 -1
  20. package/dist/packages/@ember/template-compiler/lib/plugins/transform-resolutions.js +1 -1
  21. package/dist/packages/@ember/template-compiler/lib/template.js +73 -89
  22. package/dist/packages/@glimmer/destroyable/index.js +45 -16
  23. package/dist/packages/@glimmer/encoder/index.js +1 -2
  24. package/dist/packages/@glimmer/global-context/index.js +15 -27
  25. package/dist/packages/@glimmer/manager/index.js +137 -84
  26. package/dist/packages/@glimmer/node/index.js +7 -4
  27. package/dist/packages/@glimmer/opcode-compiler/index.js +564 -534
  28. package/dist/packages/@glimmer/owner/index.js +1 -0
  29. package/dist/packages/@glimmer/program/index.js +42 -109
  30. package/dist/packages/@glimmer/reference/index.js +18 -29
  31. package/dist/packages/@glimmer/runtime/index.js +3435 -3263
  32. package/dist/packages/@glimmer/util/index.js +32 -273
  33. package/dist/packages/@glimmer/validator/index.js +36 -43
  34. package/dist/packages/@glimmer/vm/index.js +2 -140
  35. package/dist/packages/@glimmer/wire-format/index.js +1 -2
  36. package/dist/packages/ember/barrel.js +1 -1
  37. package/dist/packages/ember/version.js +1 -1
  38. package/dist/packages/ember-testing/lib/initializers.js +1 -1
  39. package/dist/packages/shared-chunks/{index-CQygUgr9.js → index-y5ClupI2.js} +50 -45
  40. package/dist/packages/shared-chunks/{setup-registry-DXuvS1Rj.js → setup-registry-8yPevDL_.js} +1 -1
  41. package/dist/packages/shared-chunks/{transform-resolutions-O6uYv8DS.js → transform-resolutions-Dpc2ClA0.js} +298 -441
  42. package/docs/data.json +40 -22
  43. package/package.json +21 -22
  44. package/types/stable/@ember/-internals/glimmer/lib/component-managers/outlet.d.ts +1 -1
  45. package/types/stable/@ember/-internals/glimmer/lib/component-managers/unwrap-template.d.ts +7 -0
  46. package/types/stable/@ember/-internals/glimmer/lib/renderer.d.ts +7 -9
  47. package/types/stable/@ember/-internals/glimmer/lib/resolver.d.ts +2 -5
  48. package/types/stable/index.d.ts +1 -0
  49. package/dist/packages/@glimmer/debug/index.js +0 -168
@@ -5,7 +5,7 @@
5
5
  * Portions Copyright 2008-2011 Apple Inc. All rights reserved.
6
6
  * @license Licensed under MIT license
7
7
  * See https://raw.github.com/emberjs/ember.js/master/LICENSE
8
- * @version 6.4.0-alpha.2
8
+ * @version 6.4.0-alpha.3
9
9
  */
10
10
  /* eslint-disable no-var */
11
11
  /* globals global globalThis self */
@@ -424,7 +424,7 @@ var define, require;
424
424
  @private
425
425
  @function isObject
426
426
  */
427
- function isObject$1(value) {
427
+ function isObject(value) {
428
428
  return value !== null && (typeof value === 'object' || typeof value === 'function');
429
429
  }
430
430
 
@@ -499,7 +499,7 @@ var define, require;
499
499
  */
500
500
  function generateGuid(obj, prefix = GUID_PREFIX) {
501
501
  let guid = prefix + uuid().toString();
502
- if (isObject$1(obj)) {
502
+ if (isObject(obj)) {
503
503
  OBJECT_GUIDS.set(obj, guid);
504
504
  }
505
505
  return guid;
@@ -521,7 +521,7 @@ var define, require;
521
521
  */
522
522
  function guidFor(value) {
523
523
  let guid;
524
- if (isObject$1(value)) {
524
+ if (isObject(value)) {
525
525
  guid = OBJECT_GUIDS.get(value);
526
526
  if (guid === undefined) {
527
527
  guid = `${GUID_PREFIX}${uuid()}`;
@@ -753,7 +753,7 @@ var define, require;
753
753
 
754
754
  const NAMES = new WeakMap();
755
755
  function setName(obj, name) {
756
- if (isObject$1(obj)) NAMES.set(obj, name);
756
+ if (isObject(obj)) NAMES.set(obj, name);
757
757
  }
758
758
  function getName(obj) {
759
759
  return NAMES.get(obj);
@@ -796,13 +796,13 @@ var define, require;
796
796
 
797
797
  const PROXIES = new WeakSet();
798
798
  function isProxy(value) {
799
- if (isObject$1(value)) {
799
+ if (isObject(value)) {
800
800
  return PROXIES.has(value);
801
801
  }
802
802
  return false;
803
803
  }
804
804
  function setProxy(object) {
805
- if (isObject$1(object)) {
805
+ if (isObject(object)) {
806
806
  PROXIES.add(object);
807
807
  }
808
808
  }
@@ -964,7 +964,7 @@ var define, require;
964
964
  let missingOptionsDeprecation$1;
965
965
  let missingOptionsIdDeprecation$1;
966
966
  let missingOptionDeprecation = () => '';
967
- let deprecate$2 = () => {};
967
+ let deprecate$1 = () => {};
968
968
  {
969
969
  registerHandler$1 = function registerHandler(handler) {
970
970
  registerHandler$2('deprecate', handler);
@@ -1095,7 +1095,7 @@ var define, require;
1095
1095
  @public
1096
1096
  @since 1.0.0
1097
1097
  */
1098
- deprecate$2 = function deprecate(message, test, options) {
1098
+ deprecate$1 = function deprecate(message, test, options) {
1099
1099
  assert(missingOptionsDeprecation$1, Boolean(options && (options.id || options.until)));
1100
1100
  assert(missingOptionsIdDeprecation$1, Boolean(options.id));
1101
1101
  assert(missingOptionDeprecation(options.id, 'until'), Boolean(options.until));
@@ -1104,7 +1104,7 @@ var define, require;
1104
1104
  invoke('deprecate', message, test, options);
1105
1105
  };
1106
1106
  }
1107
- const defaultDeprecate = deprecate$2;
1107
+ const defaultDeprecate = deprecate$1;
1108
1108
 
1109
1109
  const emberDebugLibDeprecate = /*#__PURE__*/Object.defineProperty({
1110
1110
  __proto__: null,
@@ -1348,523 +1348,6 @@ var define, require;
1348
1348
  default: inspect
1349
1349
  }, Symbol.toStringTag, { value: 'Module' });
1350
1350
 
1351
- const EMPTY_ARRAY = Object.freeze([]);
1352
- function emptyArray() {
1353
- return EMPTY_ARRAY;
1354
- }
1355
- const EMPTY_STRING_ARRAY = emptyArray(),
1356
- EMPTY_NUMBER_ARRAY = emptyArray();
1357
-
1358
- /**
1359
- * This function returns `true` if the input array is the special empty array sentinel,
1360
- * which is sometimes used for optimizations.
1361
- */
1362
- function isEmptyArray(input) {
1363
- return input === EMPTY_ARRAY;
1364
- }
1365
- function* reverse(input) {
1366
- for (let i = input.length - 1; i >= 0; i--) yield input[i];
1367
- }
1368
- function* enumerate(input) {
1369
- let i = 0;
1370
- for (const item of input) yield [i++, item];
1371
- }
1372
-
1373
- // import Logger from './logger';
1374
- // let alreadyWarned = false;
1375
- function debugAssert(test, msg) {
1376
- // if (!alreadyWarned) {
1377
- // alreadyWarned = true;
1378
- // Logger.warn("Don't leave debug assertions on in public builds");
1379
- // }
1380
- if (!test) throw new Error(msg || "assertion failure");
1381
- }
1382
- function deprecate$1(desc) {
1383
- LOCAL_LOGGER.warn(`DEPRECATION: ${desc}`);
1384
- }
1385
- function keys(obj) {
1386
- return Object.keys(obj);
1387
- }
1388
- function unwrap(val) {
1389
- if (null == val) throw new Error("Expected value to be present");
1390
- return val;
1391
- }
1392
- function expect(val, message) {
1393
- if (null == val) throw new Error(message);
1394
- return val;
1395
- }
1396
- function unreachable(message = "unreachable") {
1397
- return new Error(message);
1398
- }
1399
- function exhausted(value) {
1400
- throw new Error(`Exhausted ${String(value)}`);
1401
- }
1402
- const tuple = (...args) => args;
1403
- function isPresent(value) {
1404
- return null != value;
1405
- }
1406
- function assertPresent(value, message) {
1407
- if (!isPresent(value)) throw new Error(`Expected present, got ${"string" == typeof value ? value : message}`);
1408
- }
1409
- function isPresentArray(list) {
1410
- return list.length > 0;
1411
- }
1412
- function ifPresent(list, ifPresent, otherwise) {
1413
- return isPresentArray(list) ? ifPresent(list) : otherwise();
1414
- }
1415
- function arrayToOption(list) {
1416
- return isPresentArray(list) ? list : null;
1417
- }
1418
- function assertPresentArray(list, message = "unexpected empty list") {
1419
- if (!isPresentArray(list)) throw new Error(message);
1420
- }
1421
- function asPresentArray(list, message = "unexpected empty list") {
1422
- return assertPresentArray(list, message), list;
1423
- }
1424
- function getLast(list) {
1425
- return 0 === list.length ? void 0 : list[list.length - 1];
1426
- }
1427
- function getFirst(list) {
1428
- return 0 === list.length ? void 0 : list[0];
1429
- }
1430
- function mapPresentArray(list, mapper) {
1431
- if (null === list) return null;
1432
- let out = [];
1433
- for (let item of list) out.push(mapper(item));
1434
- return out;
1435
- }
1436
- function dict() {
1437
- return Object.create(null);
1438
- }
1439
- function isDict(u) {
1440
- return null != u;
1441
- }
1442
- function isObject(u) {
1443
- return "function" == typeof u || "object" == typeof u && null !== u;
1444
- }
1445
- class StackImpl {
1446
- stack;
1447
- current = null;
1448
- constructor(values = []) {
1449
- this.stack = values;
1450
- }
1451
- get size() {
1452
- return this.stack.length;
1453
- }
1454
- push(item) {
1455
- this.current = item, this.stack.push(item);
1456
- }
1457
- pop() {
1458
- let item = this.stack.pop();
1459
- return this.current = getLast(this.stack) ?? null, void 0 === item ? null : item;
1460
- }
1461
- nth(from) {
1462
- let len = this.stack.length;
1463
- return len < from ? null : unwrap(this.stack[len - from]);
1464
- }
1465
- isEmpty() {
1466
- return 0 === this.stack.length;
1467
- }
1468
- toArray() {
1469
- return this.stack;
1470
- }
1471
- }
1472
-
1473
- /// <reference types="qunit" />
1474
- let beginTestSteps, endTestSteps, verifySteps, logStep, debugToString;
1475
- {
1476
- let getFunctionName = fn => {
1477
- let functionName = fn.name;
1478
- if (void 0 === functionName) {
1479
- let match = /function (\w+)\s*\(/u.exec(String(fn));
1480
- functionName = match && match[1] || "";
1481
- }
1482
- return functionName.replace(/^bound /u, "");
1483
- },
1484
- getObjectName = obj => {
1485
- let name, className;
1486
- // If the class has a decent looking name, and the `toString` is one of the
1487
- // default Ember toStrings, replace the constructor portion of the toString
1488
- // with the class name. We check the length of the class name to prevent doing
1489
- // this when the value is minified.
1490
- return obj.constructor && "function" == typeof obj.constructor && (className = getFunctionName(obj.constructor)), "toString" in obj && obj.toString !== Object.prototype.toString && obj.toString !== Function.prototype.toString && (name = obj.toString()), name && /<.*:ember\d+>/u.test(name) && className && "_" !== className[0] && className.length > 2 && "Class" !== className ? name.replace(/<.*:/u, `<${className}:`) : name || className;
1491
- },
1492
- getPrimitiveName = value => String(value);
1493
- debugToString = value => "function" == typeof value ? getFunctionName(value) || "(unknown function)" : "object" == typeof value && null !== value ? getObjectName(value) || "(unknown object)" : getPrimitiveName(value);
1494
- }
1495
- var debugToString$1 = debugToString;
1496
- function clearElement(parent) {
1497
- let current = parent.firstChild;
1498
- for (; current;) {
1499
- let next = current.nextSibling;
1500
- parent.removeChild(current), current = next;
1501
- }
1502
- }
1503
- const RAW_NODE = -1,
1504
- ELEMENT_NODE = 1,
1505
- TEXT_NODE = 3,
1506
- COMMENT_NODE = 8,
1507
- DOCUMENT_NODE = 9,
1508
- DOCUMENT_TYPE_NODE = 10,
1509
- DOCUMENT_FRAGMENT_NODE = 11,
1510
- NS_HTML = "http://www.w3.org/1999/xhtml",
1511
- NS_MATHML = "http://www.w3.org/1998/Math/MathML",
1512
- NS_SVG = "http://www.w3.org/2000/svg",
1513
- NS_XLINK = "http://www.w3.org/1999/xlink",
1514
- NS_XML = "http://www.w3.org/XML/1998/namespace",
1515
- NS_XMLNS = "http://www.w3.org/2000/xmlns/",
1516
- INSERT_BEFORE_BEGIN = "beforebegin",
1517
- INSERT_AFTER_BEGIN = "afterbegin",
1518
- INSERT_BEFORE_END = "beforeend",
1519
- INSERT_AFTER_END = "afterend";
1520
-
1521
- /*
1522
- Encoding notes
1523
-
1524
- We use 30 bit integers for encoding, so that we don't ever encode a non-SMI
1525
- integer to push on the stack.
1526
-
1527
- Handles are >= 0
1528
- Immediates are < 0
1529
-
1530
- True, False, Undefined and Null are pushed as handles into the symbol table,
1531
- with well known handles (0, 1, 2, 3)
1532
-
1533
- The negative space is divided into positives and negatives. Positives are
1534
- higher numbers (-1, -2, -3, etc), negatives are lower.
1535
-
1536
- We only encode immediates for two reasons:
1537
-
1538
- 1. To transfer over the wire, so they're smaller in general
1539
- 2. When pushing values onto the stack from the low level/inner VM, which may
1540
- be converted into WASM one day.
1541
-
1542
- This allows the low-level VM to always use SMIs, and to minimize using JS
1543
- values via handles for things like the stack pointer and frame pointer.
1544
- Externally, most code pushes values as JS values, except when being pulled
1545
- from the append byte code where it was already encoded.
1546
-
1547
- Logically, this is because the low level VM doesn't really care about these
1548
- higher level values. For instance, the result of a userland helper may be a
1549
- number, or a boolean, or undefined/null, but it's extra work to figure that
1550
- out and push it correctly, vs. just pushing the value as a JS value with a
1551
- handle.
1552
-
1553
- Note: The details could change here in the future, this is just the current
1554
- strategy.
1555
- */
1556
- let ImmediateConstants = function (ImmediateConstants) {
1557
- return ImmediateConstants[ImmediateConstants.MAX_SMI = 1073741823] = "MAX_SMI", ImmediateConstants[ImmediateConstants.MIN_SMI = -1073741824] = "MIN_SMI", ImmediateConstants[ImmediateConstants.SIGN_BIT = -536870913] = "SIGN_BIT", ImmediateConstants[ImmediateConstants.MAX_INT = 536870911] = "MAX_INT", ImmediateConstants[ImmediateConstants.MIN_INT = -536870912] = "MIN_INT", ImmediateConstants[ImmediateConstants.FALSE_HANDLE = 0] = "FALSE_HANDLE", ImmediateConstants[ImmediateConstants.TRUE_HANDLE = 1] = "TRUE_HANDLE", ImmediateConstants[ImmediateConstants.NULL_HANDLE = 2] = "NULL_HANDLE", ImmediateConstants[ImmediateConstants.UNDEFINED_HANDLE = 3] = "UNDEFINED_HANDLE", ImmediateConstants[ImmediateConstants.ENCODED_FALSE_HANDLE = 0] = "ENCODED_FALSE_HANDLE", ImmediateConstants[ImmediateConstants.ENCODED_TRUE_HANDLE = 1] = "ENCODED_TRUE_HANDLE", ImmediateConstants[ImmediateConstants.ENCODED_NULL_HANDLE = 2] = "ENCODED_NULL_HANDLE", ImmediateConstants[ImmediateConstants.ENCODED_UNDEFINED_HANDLE = 3] = "ENCODED_UNDEFINED_HANDLE", ImmediateConstants;
1558
- }({});
1559
- function isHandle(value) {
1560
- return value >= 0;
1561
- }
1562
- function isNonPrimitiveHandle(value) {
1563
- return value > ImmediateConstants.ENCODED_UNDEFINED_HANDLE;
1564
- }
1565
- function constants(...values) {
1566
- return [!1, !0, null, void 0, ...values];
1567
- }
1568
- function isSmallInt(value) {
1569
- return value % 1 == 0 && value <= ImmediateConstants.MAX_INT && value >= ImmediateConstants.MIN_INT;
1570
- }
1571
- function encodeNegative(num) {
1572
- return num & ImmediateConstants.SIGN_BIT;
1573
- }
1574
- function decodeNegative(num) {
1575
- return num | ~ImmediateConstants.SIGN_BIT;
1576
- }
1577
- function encodePositive(num) {
1578
- return ~num;
1579
- }
1580
- function decodePositive(num) {
1581
- return ~num;
1582
- }
1583
- function encodeHandle(num) {
1584
- return num;
1585
- }
1586
- function decodeHandle(num) {
1587
- return num;
1588
- }
1589
- function encodeImmediate(num) {
1590
- return (num |= 0) < 0 ? encodeNegative(num) : encodePositive(num);
1591
- }
1592
- function decodeImmediate(num) {
1593
- return (num |= 0) > ImmediateConstants.SIGN_BIT ? decodePositive(num) : decodeNegative(num);
1594
- }
1595
-
1596
- /**
1597
- Strongly hint runtimes to intern the provided string.
1598
-
1599
- When do I need to use this function?
1600
-
1601
- For the most part, never. Pre-mature optimization is bad, and often the
1602
- runtime does exactly what you need it to, and more often the trade-off isn't
1603
- worth it.
1604
-
1605
- Why?
1606
-
1607
- Runtimes store strings in at least 2 different representations:
1608
- Ropes and Symbols (interned strings). The Rope provides a memory efficient
1609
- data-structure for strings created from concatenation or some other string
1610
- manipulation like splitting.
1611
-
1612
- Unfortunately checking equality of different ropes can be quite costly as
1613
- runtimes must resort to clever string comparison algorithms. These
1614
- algorithms typically cost in proportion to the length of the string.
1615
- Luckily, this is where the Symbols (interned strings) shine. As Symbols are
1616
- unique by their string content, equality checks can be done by pointer
1617
- comparison.
1618
-
1619
- How do I know if my string is a rope or symbol?
1620
-
1621
- Typically (warning general sweeping statement, but truthy in runtimes at
1622
- present) static strings created as part of the JS source are interned.
1623
- Strings often used for comparisons can be interned at runtime if some
1624
- criteria are met. One of these criteria can be the size of the entire rope.
1625
- For example, in chrome 38 a rope longer then 12 characters will not
1626
- intern, nor will segments of that rope.
1627
-
1628
- Some numbers: http://jsperf.com/eval-vs-keys/8
1629
-
1630
- Known Trick™
1631
-
1632
- @private
1633
- @return {String} interned version of the provided string
1634
- */
1635
- function intern(str) {
1636
- let obj = {};
1637
- obj[str] = 1;
1638
- for (let key in obj) if (key === str) return key;
1639
- return str;
1640
- }
1641
- [1, -1].forEach(x => decodeImmediate(encodeImmediate(x)));
1642
- const SERIALIZATION_FIRST_NODE_STRING = "%+b:0%";
1643
- function isSerializationFirstNode(node) {
1644
- return "%+b:0%" === node.nodeValue;
1645
- }
1646
- let assign = Object.assign;
1647
- function values(obj) {
1648
- return Object.values(obj);
1649
- }
1650
- function entries(dict) {
1651
- return Object.entries(dict);
1652
- }
1653
- function castToSimple(node) {
1654
- return isDocument(node) || isSimpleElement(node), node;
1655
- }
1656
-
1657
- // If passed a document, verify we're in the browser and return it as a Document
1658
- // If we don't know what this is, but the check requires it to be an element,
1659
- // the cast will mandate that it's a browser element
1660
- // Finally, if it's a more generic check, the cast will mandate that it's a
1661
- // browser node and return a BrowserNodeUtils corresponding to the check
1662
- function castToBrowser(node, sugaryCheck) {
1663
- if (null == node) return null;
1664
- if (void 0 === typeof document) throw new Error("Attempted to cast to a browser node in a non-browser context");
1665
- if (isDocument(node)) return node;
1666
- if (node.ownerDocument !== document) throw new Error("Attempted to cast to a browser node with a node that was not created from this document");
1667
- return checkBrowserNode(node, sugaryCheck);
1668
- }
1669
- function isDocument(node) {
1670
- return node.nodeType === DOCUMENT_NODE;
1671
- }
1672
- function isSimpleElement(node) {
1673
- return node?.nodeType === ELEMENT_NODE;
1674
- }
1675
- function isElement(node) {
1676
- return node?.nodeType === ELEMENT_NODE && node instanceof Element;
1677
- }
1678
- function checkBrowserNode(node, check) {
1679
- let isMatch = !1;
1680
- if (null !== node) if ("string" == typeof check) isMatch = stringCheckNode(node, check);else {
1681
- if (!Array.isArray(check)) throw unreachable();
1682
- isMatch = check.some(c => stringCheckNode(node, c));
1683
- }
1684
- if (isMatch && node instanceof Node) return node;
1685
- throw function (from, check) {
1686
- return new Error(`cannot cast a ${from} into ${String(check)}`);
1687
- }(`SimpleElement(${node?.constructor?.name ?? "null"})`, check);
1688
- }
1689
- function stringCheckNode(node, check) {
1690
- switch (check) {
1691
- case "NODE":
1692
- return !0;
1693
- case "HTML":
1694
- return node instanceof HTMLElement;
1695
- case "SVG":
1696
- return node instanceof SVGElement;
1697
- case "ELEMENT":
1698
- return node instanceof Element;
1699
- default:
1700
- if (check.toUpperCase() === check) throw new Error("BUG: this code is missing handling for a generic node type");
1701
- return node instanceof Element && node.tagName.toLowerCase() === check;
1702
- }
1703
- }
1704
- function strip(strings, ...args) {
1705
- let out = "";
1706
- for (const [i, string] of enumerate(strings)) out += `${string}${void 0 !== args[i] ? String(args[i]) : ""}`;
1707
- let lines = out.split("\n");
1708
- for (; isPresentArray(lines) && /^\s*$/u.test(getFirst(lines));) lines.shift();
1709
- for (; isPresentArray(lines) && /^\s*$/u.test(getLast(lines));) lines.pop();
1710
- let min = 1 / 0;
1711
- for (let line of lines) {
1712
- let leading = /^\s*/u.exec(line)[0].length;
1713
- min = Math.min(min, leading);
1714
- }
1715
- let stripped = [];
1716
- for (let line of lines) stripped.push(line.slice(min));
1717
- return stripped.join("\n");
1718
- }
1719
- function unwrapHandle(handle) {
1720
- if ("number" == typeof handle) return handle;
1721
- {
1722
- let error = handle.errors[0];
1723
- throw new Error(`Compile Error: ${error.problem} @ ${error.span.start}..${error.span.end}`);
1724
- }
1725
- }
1726
- function unwrapTemplate(template) {
1727
- if ("error" === template.result) throw new Error(`Compile Error: ${template.problem} @ ${template.span.start}..${template.span.end}`);
1728
- return template;
1729
- }
1730
- function extractHandle(handle) {
1731
- return "number" == typeof handle ? handle : handle.handle;
1732
- }
1733
- function isOkHandle(handle) {
1734
- return "number" == typeof handle;
1735
- }
1736
- function isErrHandle(handle) {
1737
- return "number" == typeof handle;
1738
- }
1739
- function buildUntouchableThis(source) {
1740
- let context = null;
1741
- {
1742
- let assertOnProperty = property => {
1743
- let access = "symbol" == typeof property || "number" == typeof property ? `[${String(property)}]` : `.${property}`;
1744
- throw new Error(`You accessed \`this${access}\` from a function passed to the ${source}, but the function itself was not bound to a valid \`this\` context. Consider updating to use a bound function (for instance, use an arrow function, \`() => {}\`).`);
1745
- };
1746
- context = new Proxy({}, {
1747
- get(_target, property) {
1748
- assertOnProperty(property);
1749
- },
1750
- set: (_target, property) => (assertOnProperty(property), !1),
1751
- has: (_target, property) => (assertOnProperty(property), !1)
1752
- });
1753
- }
1754
- return context;
1755
- }
1756
-
1757
- /**
1758
- * This constant exists to make it easier to differentiate normal logs from
1759
- * errant console.logs. LOCAL_LOGGER should only be used inside a
1760
- * LOCAL_SHOULD_LOG check.
1761
- *
1762
- * It does not alleviate the need to check LOCAL_SHOULD_LOG, which is used
1763
- * for stripping.
1764
- */
1765
- const LOCAL_LOGGER = console,
1766
- LOGGER = console;
1767
-
1768
- /**
1769
- * This constant exists to make it easier to differentiate normal logs from
1770
- * errant console.logs. LOGGER can be used outside of LOCAL_SHOULD_LOG checks,
1771
- * and is meant to be used in the rare situation where a console.* call is
1772
- * actually appropriate.
1773
- */
1774
- function assertNever(value, desc = "unexpected unreachable branch") {
1775
- throw LOGGER.log("unreachable", value), LOGGER.log(`${desc} :: ${JSON.stringify(value)} (${value})`), new Error("code reached unreachable");
1776
- }
1777
-
1778
- const glimmerUtil = /*#__PURE__*/Object.defineProperty({
1779
- __proto__: null,
1780
- COMMENT_NODE,
1781
- DOCUMENT_FRAGMENT_NODE,
1782
- DOCUMENT_NODE,
1783
- DOCUMENT_TYPE_NODE,
1784
- ELEMENT_NODE,
1785
- EMPTY_ARRAY,
1786
- EMPTY_NUMBER_ARRAY,
1787
- EMPTY_STRING_ARRAY,
1788
- INSERT_AFTER_BEGIN,
1789
- INSERT_AFTER_END,
1790
- INSERT_BEFORE_BEGIN,
1791
- INSERT_BEFORE_END,
1792
- ImmediateConstants,
1793
- LOCAL_LOGGER,
1794
- LOGGER,
1795
- NS_HTML,
1796
- NS_MATHML,
1797
- NS_SVG,
1798
- NS_XLINK,
1799
- NS_XML,
1800
- NS_XMLNS,
1801
- RAW_NODE,
1802
- SERIALIZATION_FIRST_NODE_STRING,
1803
- Stack: StackImpl,
1804
- TEXT_NODE,
1805
- arrayToOption,
1806
- asPresentArray,
1807
- assert: debugAssert,
1808
- assertNever,
1809
- assertPresent,
1810
- assertPresentArray,
1811
- assign,
1812
- beginTestSteps,
1813
- buildUntouchableThis,
1814
- castToBrowser,
1815
- castToSimple,
1816
- checkNode: checkBrowserNode,
1817
- clearElement,
1818
- constants,
1819
- debugToString: debugToString$1,
1820
- decodeHandle,
1821
- decodeImmediate,
1822
- decodeNegative,
1823
- decodePositive,
1824
- deprecate: deprecate$1,
1825
- dict,
1826
- emptyArray,
1827
- encodeHandle,
1828
- encodeImmediate,
1829
- encodeNegative,
1830
- encodePositive,
1831
- endTestSteps,
1832
- entries,
1833
- enumerate,
1834
- exhausted,
1835
- expect,
1836
- extractHandle,
1837
- getFirst,
1838
- getLast,
1839
- ifPresent,
1840
- intern,
1841
- isDict,
1842
- isElement,
1843
- isEmptyArray,
1844
- isErrHandle,
1845
- isHandle,
1846
- isNonPrimitiveHandle,
1847
- isObject,
1848
- isOkHandle,
1849
- isPresent,
1850
- isPresentArray,
1851
- isSerializationFirstNode,
1852
- isSimpleElement,
1853
- isSmallInt,
1854
- keys,
1855
- logStep,
1856
- mapPresentArray,
1857
- reverse,
1858
- strip,
1859
- tuple,
1860
- unreachable,
1861
- unwrap,
1862
- unwrapHandle,
1863
- unwrapTemplate,
1864
- values,
1865
- verifySteps
1866
- }, Symbol.toStringTag, { value: 'Module' });
1867
-
1868
1351
  /**
1869
1352
  @module @ember/debug
1870
1353
  */
@@ -1882,9 +1365,13 @@ var define, require;
1882
1365
  @since 3.14.0
1883
1366
  */
1884
1367
  function captureRenderTree(app) {
1368
+ let domRenderer = app.lookup('renderer:-dom');
1369
+ if (!domRenderer) {
1370
+ throw new Error(`BUG: owner is missing renderer`);
1371
+ }
1885
1372
  // SAFETY: Ideally we'd assert here but that causes awkward circular requires since this is also in @ember/debug.
1886
1373
  // This is only for debug stuff so not very risky.
1887
- let renderer = expect(app.lookup('renderer:-dom'), `BUG: owner is missing renderer`);
1374
+ let renderer = domRenderer;
1888
1375
  return renderer.debugRenderTree.capture();
1889
1376
  }
1890
1377
 
@@ -2235,7 +1722,7 @@ var define, require;
2235
1722
  guidFor,
2236
1723
  intern: intern$1,
2237
1724
  isInternalSymbol,
2238
- isObject: isObject$1,
1725
+ isObject,
2239
1726
  isProxy,
2240
1727
  lookupDescriptor,
2241
1728
  observerListenerMetaFor,
@@ -2268,70 +1755,291 @@ var define, require;
2268
1755
  };
2269
1756
 
2270
1757
  /**
2271
- The hash of enabled Canary features. Add to this, any canary features
2272
- before creating your application.
1758
+ The hash of enabled Canary features. Add to this, any canary features
1759
+ before creating your application.
1760
+
1761
+ @class FEATURES
1762
+ @static
1763
+ @since 1.1.0
1764
+ @public
1765
+ */
1766
+ const FEATURES = Object.assign(DEFAULT_FEATURES, ENV.FEATURES);
1767
+
1768
+ /**
1769
+ Determine whether the specified `feature` is enabled. Used by Ember's
1770
+ build tools to exclude experimental features from beta/stable builds.
1771
+
1772
+ You can define the following configuration options:
1773
+
1774
+ * `EmberENV.ENABLE_OPTIONAL_FEATURES` - enable any features that have not been explicitly
1775
+ enabled/disabled.
1776
+
1777
+ @method isEnabled
1778
+ @param {String} feature The feature to check
1779
+ @return {Boolean}
1780
+ @since 1.1.0
1781
+ @public
1782
+ */
1783
+ function isEnabled(feature) {
1784
+ let value = FEATURES[feature];
1785
+ if (value === true || value === false) {
1786
+ return value;
1787
+ } else if (ENV.ENABLE_OPTIONAL_FEATURES) {
1788
+ return true;
1789
+ } else {
1790
+ return false;
1791
+ }
1792
+ }
1793
+
1794
+ // Uncomment the below when features are present:
1795
+
1796
+ // function featureValue(value: null | boolean) {
1797
+ // if (ENV.ENABLE_OPTIONAL_FEATURES && value === null) {
1798
+ // return true;
1799
+ // }
1800
+
1801
+ // return value;
1802
+ // }
1803
+ //
1804
+ // export const FLAG_NAME = featureValue(FEATURES.FLAG_NAME);
1805
+
1806
+ const emberCanaryFeaturesIndex = /*#__PURE__*/Object.defineProperty({
1807
+ __proto__: null,
1808
+ DEFAULT_FEATURES,
1809
+ FEATURES,
1810
+ isEnabled
1811
+ }, Symbol.toStringTag, { value: 'Module' });
1812
+
1813
+ // These versions should be the version that the deprecation was _introduced_,
1814
+ // not the version that the feature will be removed.
1815
+
1816
+ /** Introduced in 4.0.0-beta.1 */
1817
+ const ASSIGN = true;
1818
+
1819
+ const emberDeprecatedFeaturesIndex = /*#__PURE__*/Object.defineProperty({
1820
+ __proto__: null,
1821
+ ASSIGN
1822
+ }, Symbol.toStringTag, { value: 'Module' });
1823
+
1824
+ const EMPTY_ARRAY = Object.freeze([]);
1825
+ function emptyArray() {
1826
+ return EMPTY_ARRAY;
1827
+ }
1828
+ const EMPTY_STRING_ARRAY = emptyArray(),
1829
+ EMPTY_NUMBER_ARRAY = emptyArray();
1830
+
1831
+ /**
1832
+ * This function returns `true` if the input array is the special empty array sentinel,
1833
+ * which is sometimes used for optimizations.
1834
+ */
1835
+ function isEmptyArray(input) {
1836
+ return input === EMPTY_ARRAY;
1837
+ }
1838
+ function* reverse(input) {
1839
+ for (let i = input.length - 1; i >= 0; i--)
1840
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- @fixme
1841
+ yield input[i];
1842
+ }
1843
+ function* enumerate(input) {
1844
+ let i = 0;
1845
+ for (const item of input) yield [i++, item];
1846
+ }
1847
+
1848
+ /**
1849
+ * Zip two tuples with the same type and number of elements.
1850
+ */
1851
+ function* zipTuples(left, right) {
1852
+ for (let i = 0; i < left.length; i++) yield [i, left[i], right[i]];
1853
+ }
1854
+ function* zipArrays(left, right) {
1855
+ for (let i = 0; i < left.length; i++) {
1856
+ const perform = i < right.length ? "retain" : "pop";
1857
+ yield [perform, i, left[i], right[i]];
1858
+ }
1859
+ for (let i = left.length; i < right.length; i++) yield ["push", i, void 0, right[i]];
1860
+ }
1861
+ function isPresentArray$2(list) {
1862
+ return !!list && list.length > 0;
1863
+ }
1864
+ function getLast$1(list) {
1865
+ return 0 === list.length ? void 0 : list[list.length - 1];
1866
+ }
1867
+ function dict() {
1868
+ return Object.create(null);
1869
+ }
1870
+ function isDict(u) {
1871
+ return null != u;
1872
+ }
1873
+ function isIndexable(u) {
1874
+ return "function" == typeof u || "object" == typeof u && null !== u;
1875
+ }
1876
+ class StackImpl {
1877
+ constructor(values = []) {
1878
+ this.current = null, this.stack = values;
1879
+ }
1880
+ get size() {
1881
+ return this.stack.length;
1882
+ }
1883
+ push(item) {
1884
+ this.current = item, this.stack.push(item);
1885
+ }
1886
+ pop() {
1887
+ let item = this.stack.pop();
1888
+ return this.current = getLast$1(this.stack) ?? null, void 0 === item ? null : item;
1889
+ }
1890
+ nth(from) {
1891
+ let len = this.stack.length;
1892
+ return len < from ? null : this.stack[len - from];
1893
+ }
1894
+ isEmpty() {
1895
+ return 0 === this.stack.length;
1896
+ }
1897
+ snapshot() {
1898
+ return [...this.stack];
1899
+ }
1900
+ toArray() {
1901
+ return this.stack;
1902
+ }
1903
+ }
1904
+
1905
+ /// <reference types="qunit" />
1906
+ let beginTestSteps, endTestSteps, verifySteps, logStep;
1907
+ function clearElement(parent) {
1908
+ let current = parent.firstChild;
1909
+ for (; current;) {
1910
+ let next = current.nextSibling;
1911
+ parent.removeChild(current), current = next;
1912
+ }
1913
+ }
1914
+
1915
+ /**
1916
+ Strongly hint runtimes to intern the provided string.
2273
1917
 
2274
- @class FEATURES
2275
- @static
2276
- @since 1.1.0
2277
- @public
2278
- */
2279
- const FEATURES = Object.assign(DEFAULT_FEATURES, ENV.FEATURES);
1918
+ When do I need to use this function?
2280
1919
 
2281
- /**
2282
- Determine whether the specified `feature` is enabled. Used by Ember's
2283
- build tools to exclude experimental features from beta/stable builds.
1920
+ For the most part, never. Pre-mature optimization is bad, and often the
1921
+ runtime does exactly what you need it to, and more often the trade-off isn't
1922
+ worth it.
2284
1923
 
2285
- You can define the following configuration options:
1924
+ Why?
2286
1925
 
2287
- * `EmberENV.ENABLE_OPTIONAL_FEATURES` - enable any features that have not been explicitly
2288
- enabled/disabled.
1926
+ Runtimes store strings in at least 2 different representations:
1927
+ Ropes and Symbols (interned strings). The Rope provides a memory efficient
1928
+ data-structure for strings created from concatenation or some other string
1929
+ manipulation like splitting.
2289
1930
 
2290
- @method isEnabled
2291
- @param {String} feature The feature to check
2292
- @return {Boolean}
2293
- @since 1.1.0
2294
- @public
2295
- */
2296
- function isEnabled(feature) {
2297
- let value = FEATURES[feature];
2298
- if (value === true || value === false) {
2299
- return value;
2300
- } else if (ENV.ENABLE_OPTIONAL_FEATURES) {
2301
- return true;
2302
- } else {
2303
- return false;
2304
- }
2305
- }
1931
+ Unfortunately checking equality of different ropes can be quite costly as
1932
+ runtimes must resort to clever string comparison algorithms. These
1933
+ algorithms typically cost in proportion to the length of the string.
1934
+ Luckily, this is where the Symbols (interned strings) shine. As Symbols are
1935
+ unique by their string content, equality checks can be done by pointer
1936
+ comparison.
2306
1937
 
2307
- // Uncomment the below when features are present:
1938
+ How do I know if my string is a rope or symbol?
2308
1939
 
2309
- // function featureValue(value: null | boolean) {
2310
- // if (ENV.ENABLE_OPTIONAL_FEATURES && value === null) {
2311
- // return true;
2312
- // }
1940
+ Typically (warning general sweeping statement, but truthy in runtimes at
1941
+ present) static strings created as part of the JS source are interned.
1942
+ Strings often used for comparisons can be interned at runtime if some
1943
+ criteria are met. One of these criteria can be the size of the entire rope.
1944
+ For example, in chrome 38 a rope longer then 12 characters will not
1945
+ intern, nor will segments of that rope.
2313
1946
 
2314
- // return value;
2315
- // }
2316
- //
2317
- // export const FLAG_NAME = featureValue(FEATURES.FLAG_NAME);
1947
+ Some numbers: http://jsperf.com/eval-vs-keys/8
2318
1948
 
2319
- const emberCanaryFeaturesIndex = /*#__PURE__*/Object.defineProperty({
2320
- __proto__: null,
2321
- DEFAULT_FEATURES,
2322
- FEATURES,
2323
- isEnabled
2324
- }, Symbol.toStringTag, { value: 'Module' });
1949
+ Known Trick™
2325
1950
 
2326
- // These versions should be the version that the deprecation was _introduced_,
2327
- // not the version that the feature will be removed.
1951
+ @private
1952
+ @return {String} interned version of the provided string
1953
+ */
1954
+ function intern(str) {
1955
+ let obj = {};
1956
+ obj[str] = 1;
1957
+ for (let key in obj) if (key === str) return key;
1958
+ return str;
1959
+ }
1960
+ const SERIALIZATION_FIRST_NODE_STRING = "%+b:0%";
1961
+ function isSerializationFirstNode(node) {
1962
+ return "%+b:0%" === node.nodeValue;
1963
+ }
1964
+ const assign = Object.assign;
1965
+ function values(obj) {
1966
+ return Object.values(obj);
1967
+ }
1968
+ function entries(dict) {
1969
+ return Object.entries(dict);
1970
+ }
1971
+ function keys(obj) {
1972
+ return Object.keys(obj);
1973
+ }
1974
+ function strip(strings, ...args) {
1975
+ let out = "";
1976
+ for (const [i, string] of enumerate(strings)) out += `${string}${void 0 !== args[i] ? String(args[i]) : ""}`;
1977
+ let lines = out.split("\n");
1978
+ for (; isPresentArray$2(lines) && /^\s*$/u.test(0 === (list = lines).length ? void 0 : list[0]);) lines.shift();
1979
+ for (var list; isPresentArray$2(lines) && /^\s*$/u.test(getLast$1(lines));) lines.pop();
1980
+ let min = 1 / 0;
1981
+ for (let line of lines) {
1982
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- @fixme
1983
+ let leading = /^\s*/u.exec(line)[0].length;
1984
+ min = Math.min(min, leading);
1985
+ }
1986
+ let stripped = [];
1987
+ for (let line of lines) stripped.push(line.slice(min));
1988
+ return stripped.join("\n");
1989
+ }
2328
1990
 
2329
- /** Introduced in 4.0.0-beta.1 */
2330
- const ASSIGN = true;
1991
+ /**
1992
+ * This constant exists to make it easier to differentiate normal logs from
1993
+ * errant console.logs. LOCAL_LOGGER should only be used inside a
1994
+ * LOCAL_TRACE_LOGGING check.
1995
+ *
1996
+ * It does not alleviate the need to check LOCAL_TRACE_LOGGING, which is used
1997
+ * for stripping.
1998
+ */
1999
+ const LOCAL_LOGGER = console,
2000
+ LOGGER = console;
2331
2001
 
2332
- const emberDeprecatedFeaturesIndex = /*#__PURE__*/Object.defineProperty({
2002
+ /**
2003
+ * This constant exists to make it easier to differentiate normal logs from
2004
+ * errant console.logs. LOGGER can be used outside of LOCAL_TRACE_LOGGING checks,
2005
+ * and is meant to be used in the rare situation where a console.* call is
2006
+ * actually appropriate.
2007
+ */
2008
+ function assertNever(value, desc = "unexpected unreachable branch") {
2009
+ throw LOGGER.log("unreachable", value), LOGGER.log(`${desc} :: ${JSON.stringify(value)} (${value})`), new Error("code reached unreachable");
2010
+ }
2011
+
2012
+ const glimmerUtil = /*#__PURE__*/Object.defineProperty({
2333
2013
  __proto__: null,
2334
- ASSIGN
2014
+ EMPTY_ARRAY,
2015
+ EMPTY_NUMBER_ARRAY,
2016
+ EMPTY_STRING_ARRAY,
2017
+ LOCAL_LOGGER,
2018
+ LOGGER,
2019
+ SERIALIZATION_FIRST_NODE_STRING,
2020
+ Stack: StackImpl,
2021
+ assertNever,
2022
+ assign,
2023
+ beginTestSteps,
2024
+ clearElement,
2025
+ dict,
2026
+ emptyArray,
2027
+ endTestSteps,
2028
+ entries,
2029
+ enumerate,
2030
+ intern,
2031
+ isDict,
2032
+ isEmptyArray,
2033
+ isIndexable,
2034
+ isSerializationFirstNode,
2035
+ keys,
2036
+ logStep,
2037
+ reverse,
2038
+ strip,
2039
+ values,
2040
+ verifySteps,
2041
+ zipArrays,
2042
+ zipTuples
2335
2043
  }, Symbol.toStringTag, { value: 'Module' });
2336
2044
 
2337
2045
  const opcodes = {
@@ -2404,9 +2112,8 @@ var define, require;
2404
2112
  p: 2,
2405
2113
  a: 3
2406
2114
  };
2407
-
2408
- // eslint-disable-next-line @typescript-eslint/naming-convention
2409
2115
  function is(variant) {
2116
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
2410
2117
  return function (value) {
2411
2118
  return Array.isArray(value) && value[0] === variant;
2412
2119
  };
@@ -7692,20 +7399,19 @@ var define, require;
7692
7399
  tokenize
7693
7400
  }, Symbol.toStringTag, { value: 'Module' });
7694
7401
 
7695
- var Char = function (Char) {
7696
- return Char[Char.NBSP = 160] = "NBSP", Char[Char.QUOT = 34] = "QUOT", Char[Char.LT = 60] = "LT", Char[Char.GT = 62] = "GT", Char[Char.AMP = 38] = "AMP", Char;
7697
- }(Char || {});
7698
- const ATTR_VALUE_REGEX_TEST = /["&\xA0]/u,
7402
+ const ATTR_VALUE_REGEX_TEST = /["\x26\xa0]/u,
7699
7403
  ATTR_VALUE_REGEX_REPLACE = new RegExp(ATTR_VALUE_REGEX_TEST.source, "gu"),
7700
- TEXT_REGEX_TEST = /[&<>\xA0]/u,
7404
+ TEXT_REGEX_TEST = /[&<>\xa0]/u,
7701
7405
  TEXT_REGEX_REPLACE = new RegExp(TEXT_REGEX_TEST.source, "gu");
7406
+
7407
+ // \x26 is ampersand, \xa0 is non-breaking space
7702
7408
  function attrValueReplacer(char) {
7703
7409
  switch (char.charCodeAt(0)) {
7704
- case Char.NBSP:
7410
+ case 160:
7705
7411
  return "&nbsp;";
7706
- case Char.QUOT:
7412
+ case 34:
7707
7413
  return "&quot;";
7708
- case Char.AMP:
7414
+ case 38:
7709
7415
  return "&amp;";
7710
7416
  default:
7711
7417
  return char;
@@ -7713,13 +7419,13 @@ var define, require;
7713
7419
  }
7714
7420
  function textReplacer(char) {
7715
7421
  switch (char.charCodeAt(0)) {
7716
- case Char.NBSP:
7422
+ case 160:
7717
7423
  return "&nbsp;";
7718
- case Char.AMP:
7424
+ case 38:
7719
7425
  return "&amp;";
7720
- case Char.LT:
7426
+ case 60:
7721
7427
  return "&lt;";
7722
- case Char.GT:
7428
+ case 62:
7723
7429
  return "&gt;";
7724
7430
  default:
7725
7431
  return char;
@@ -7747,10 +7453,8 @@ var define, require;
7747
7453
  return voidMap.has(tag.toLowerCase()) && tag[0]?.toLowerCase() === tag[0];
7748
7454
  }
7749
7455
  class Printer {
7750
- buffer = "";
7751
- options;
7752
7456
  constructor(options) {
7753
- this.options = options;
7457
+ this.buffer = "", this.options = options;
7754
7458
  }
7755
7459
  /*
7756
7460
  This is used by _all_ methods on this Printer class that add to `this.buffer`,
@@ -7973,10 +7677,10 @@ var define, require;
7973
7677
  this.handledByOverride(str) || (this.buffer += JSON.stringify(str.value));
7974
7678
  }
7975
7679
  BooleanLiteral(bool) {
7976
- this.handledByOverride(bool) || (this.buffer += bool.value);
7680
+ this.handledByOverride(bool) || (this.buffer += String(bool.value));
7977
7681
  }
7978
7682
  NumberLiteral(number) {
7979
- this.handledByOverride(number) || (this.buffer += number.value);
7683
+ this.handledByOverride(number) || (this.buffer += String(number.value));
7980
7684
  }
7981
7685
  UndefinedLiteral(node) {
7982
7686
  this.handledByOverride(node) || (this.buffer += "undefined");
@@ -7998,6 +7702,7 @@ var define, require;
7998
7702
  function build(ast, options = {
7999
7703
  entityEncoding: "transformed"
8000
7704
  }) {
7705
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- JS users
8001
7706
  return ast ? new Printer(options).print(ast) : "";
8002
7707
  }
8003
7708
  function isKeyword(word, type) {
@@ -8009,28 +7714,39 @@ var define, require;
8009
7714
  * language, and where their valid usages are.
8010
7715
  */
8011
7716
  const KEYWORDS_TYPES = {
8012
- action: ["Call", "Modifier"],
8013
- component: ["Call", "Append", "Block"],
8014
- debugger: ["Append"],
8015
- "each-in": ["Block"],
8016
- each: ["Block"],
8017
- "has-block-params": ["Call", "Append"],
8018
- "has-block": ["Call", "Append"],
8019
- helper: ["Call", "Append"],
8020
- if: ["Call", "Append", "Block"],
8021
- "in-element": ["Block"],
8022
- let: ["Block"],
8023
- log: ["Call", "Append"],
8024
- modifier: ["Call", "Modifier"],
8025
- mount: ["Append"],
8026
- mut: ["Call", "Append"],
8027
- outlet: ["Append"],
8028
- readonly: ["Call", "Append"],
8029
- unbound: ["Call", "Append"],
8030
- unless: ["Call", "Append", "Block"],
8031
- yield: ["Append"]
8032
- },
8033
- UNKNOWN_POSITION = Object.freeze({
7717
+ action: ["Call", "Modifier"],
7718
+ component: ["Call", "Append", "Block"],
7719
+ debugger: ["Append"],
7720
+ "each-in": ["Block"],
7721
+ each: ["Block"],
7722
+ "has-block-params": ["Call", "Append"],
7723
+ "has-block": ["Call", "Append"],
7724
+ helper: ["Call", "Append"],
7725
+ if: ["Call", "Append", "Block"],
7726
+ "in-element": ["Block"],
7727
+ let: ["Block"],
7728
+ log: ["Call", "Append"],
7729
+ modifier: ["Call", "Modifier"],
7730
+ mount: ["Append"],
7731
+ mut: ["Call", "Append"],
7732
+ outlet: ["Append"],
7733
+ readonly: ["Call", "Append"],
7734
+ unbound: ["Call", "Append"],
7735
+ unless: ["Call", "Append", "Block"],
7736
+ yield: ["Append"]
7737
+ };
7738
+
7739
+ // import Logger from './logger';
7740
+ function isPresentArray$1(list) {
7741
+ return !!list && list.length > 0;
7742
+ }
7743
+ function getLast(list) {
7744
+ return 0 === list.length ? void 0 : list[list.length - 1];
7745
+ }
7746
+ function getFirst(list) {
7747
+ return 0 === list.length ? void 0 : list[0];
7748
+ }
7749
+ const UNKNOWN_POSITION = Object.freeze({
8034
7750
  line: 1,
8035
7751
  column: 0
8036
7752
  }),
@@ -8049,33 +7765,19 @@ var define, require;
8049
7765
  start: UNKNOWN_POSITION,
8050
7766
  end: UNKNOWN_POSITION
8051
7767
  });
8052
- let OffsetKind = function (OffsetKind) {
8053
- return OffsetKind.CharPosition = "CharPosition", OffsetKind.HbsPosition = "HbsPosition", OffsetKind.InternalsSynthetic = "InternalsSynthetic", OffsetKind.NonExistent = "NonExistent", OffsetKind.Broken = "Broken", OffsetKind;
8054
- }({});
8055
-
8056
- /**
8057
- * This file implements the DSL used by span and offset in places where they need to exhaustively
8058
- * consider all combinations of states (Handlebars offsets, character offsets and invisible/broken
8059
- * offsets).
8060
- *
8061
- * It's probably overkill, but it makes the code that uses it clear. It could be refactored or
8062
- * removed.
8063
- */
8064
7768
  class WhenList {
8065
- _whens;
8066
7769
  constructor(whens) {
8067
7770
  this._whens = whens;
8068
7771
  }
8069
7772
  first(kind) {
8070
7773
  for (const when of this._whens) {
8071
7774
  const value = when.match(kind);
8072
- if (isPresentArray(value)) return value[0];
7775
+ if (isPresentArray$1(value)) return value[0];
8073
7776
  }
8074
7777
  return null;
8075
7778
  }
8076
7779
  }
8077
7780
  class When {
8078
- _map = new Map();
8079
7781
  get(pattern, or) {
8080
7782
  let value = this._map.get(pattern);
8081
7783
  return value || (value = or(), this._map.set(pattern, value), value);
@@ -8086,9 +7788,9 @@ var define, require;
8086
7788
  match(kind) {
8087
7789
  const pattern = function (kind) {
8088
7790
  switch (kind) {
8089
- case OffsetKind.Broken:
8090
- case OffsetKind.InternalsSynthetic:
8091
- case OffsetKind.NonExistent:
7791
+ case "Broken":
7792
+ case "InternalsSynthetic":
7793
+ case "NonExistent":
8092
7794
  return "IS_INVISIBLE";
8093
7795
  default:
8094
7796
  return kind;
@@ -8099,30 +7801,32 @@ var define, require;
8099
7801
  fallback = this._map.get("MATCH_ANY");
8100
7802
  return exact && out.push(exact), fallback && out.push(fallback), out;
8101
7803
  }
7804
+ constructor() {
7805
+ this._map = new Map();
7806
+ }
8102
7807
  }
8103
7808
  function match(callback) {
8104
- return callback(new Matcher()).check();
7809
+ return callback(new Matcher()).validate();
8105
7810
  }
8106
7811
  class Matcher {
8107
- _whens = new When();
8108
7812
  /**
8109
7813
  * You didn't exhaustively match all possibilities.
8110
7814
  */
8111
- check() {
7815
+ validate() {
8112
7816
  return (left, right) => this.matchFor(left.kind, right.kind)(left, right);
8113
7817
  }
8114
7818
  matchFor(left, right) {
8115
7819
  const nesteds = this._whens.match(left);
8116
- debugAssert(isPresentArray(nesteds), `no match defined for (${left}, ${right}) and no AnyMatch defined either`);
8117
- const callback = new WhenList(nesteds).first(right);
8118
- return debugAssert(null !== callback, `no match defined for (${left}, ${right}) and no AnyMatch defined either`), callback;
8119
- }
8120
- // This big block is the bulk of the heavy lifting in this file. It facilitates exhaustiveness
8121
- // checking so that matchers can ensure they've actually covered all the cases (and TypeScript
8122
- // will treat it as an exhaustive match).
8123
- when(left, right, callback) {
7820
+ return isPresentArray$1(), new WhenList(nesteds).first(right);
7821
+ }
7822
+ when(left, right,
7823
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
7824
+ callback) {
8124
7825
  return this._whens.get(left, () => new When()).add(right, callback), this;
8125
7826
  }
7827
+ constructor() {
7828
+ this._whens = new When();
7829
+ }
8126
7830
  }
8127
7831
  class SourceSlice {
8128
7832
  static synthetic(chars) {
@@ -8138,8 +7842,6 @@ var define, require;
8138
7842
  chars: slice[0]
8139
7843
  });
8140
7844
  }
8141
- chars;
8142
- loc;
8143
7845
  constructor(options) {
8144
7846
  this.loc = options.loc, this.chars = options.chars;
8145
7847
  }
@@ -8151,9 +7853,6 @@ var define, require;
8151
7853
  }
8152
7854
  }
8153
7855
 
8154
- /**
8155
- * All spans have these details in common.
8156
- */
8157
7856
  /**
8158
7857
  * A `SourceSpan` object represents a span of characters inside of a template source.
8159
7858
  *
@@ -8190,10 +7889,10 @@ var define, require;
8190
7889
  */
8191
7890
  class SourceSpan {
8192
7891
  static get NON_EXISTENT() {
8193
- return new InvisibleSpan(OffsetKind.NonExistent, NON_EXISTENT_LOCATION).wrap();
7892
+ return new InvisibleSpan("NonExistent", NON_EXISTENT_LOCATION).wrap();
8194
7893
  }
8195
7894
  static load(source, serialized) {
8196
- return "number" == typeof serialized ? SourceSpan.forCharPositions(source, serialized, serialized) : "string" == typeof serialized ? SourceSpan.synthetic(serialized) : Array.isArray(serialized) ? SourceSpan.forCharPositions(source, serialized[0], serialized[1]) : serialized === OffsetKind.NonExistent ? SourceSpan.NON_EXISTENT : serialized === OffsetKind.Broken ? SourceSpan.broken(BROKEN_LOCATION) : void assertNever(serialized);
7895
+ return "number" == typeof serialized ? SourceSpan.forCharPositions(source, serialized, serialized) : "string" == typeof serialized ? SourceSpan.synthetic(serialized) : Array.isArray(serialized) ? SourceSpan.forCharPositions(source, serialized[0], serialized[1]) : "NonExistent" === serialized ? SourceSpan.NON_EXISTENT : "Broken" === serialized ? SourceSpan.broken(BROKEN_LOCATION) : void assertNever(serialized);
8197
7896
  }
8198
7897
  static forHbsLoc(source, loc) {
8199
7898
  const start = new HbsPosition(source, loc.start),
@@ -8212,14 +7911,22 @@ var define, require;
8212
7911
  }).wrap();
8213
7912
  }
8214
7913
  static synthetic(chars) {
8215
- return new InvisibleSpan(OffsetKind.InternalsSynthetic, NON_EXISTENT_LOCATION, chars).wrap();
7914
+ return new InvisibleSpan("InternalsSynthetic", NON_EXISTENT_LOCATION, chars).wrap();
8216
7915
  }
8217
7916
  static broken(pos = BROKEN_LOCATION) {
8218
- return new InvisibleSpan(OffsetKind.Broken, pos).wrap();
7917
+ return new InvisibleSpan("Broken", pos).wrap();
8219
7918
  }
8220
- isInvisible;
8221
7919
  constructor(data) {
8222
- this.data = data, this.isInvisible = data.kind !== OffsetKind.CharPosition && data.kind !== OffsetKind.HbsPosition;
7920
+ var kind;
7921
+ /**
7922
+ * This file implements the DSL used by span and offset in places where they need to exhaustively
7923
+ * consider all combinations of states (Handlebars offsets, character offsets and invisible/broken
7924
+ * offsets).
7925
+ *
7926
+ * It's probably overkill, but it makes the code that uses it clear. It could be refactored or
7927
+ * removed.
7928
+ */
7929
+ this.data = data, this.isInvisible = "CharPosition" !== (kind = data.kind) && "HbsPosition" !== kind;
8223
7930
  }
8224
7931
  getStart() {
8225
7932
  return this.data.getStart().wrap();
@@ -8359,10 +8066,9 @@ var define, require;
8359
8066
  }
8360
8067
  }
8361
8068
  class CharPositionSpan {
8362
- kind = OffsetKind.CharPosition;
8363
- _locPosSpan = null;
8069
+ #locPosSpan;
8364
8070
  constructor(source, charPositions) {
8365
- this.source = source, this.charPositions = charPositions;
8071
+ this.source = source, this.charPositions = charPositions, this.kind = "CharPosition", this.#locPosSpan = null;
8366
8072
  }
8367
8073
  wrap() {
8368
8074
  return new SourceSpan(this);
@@ -8381,11 +8087,11 @@ var define, require;
8381
8087
  }
8382
8088
  locDidUpdate() {}
8383
8089
  toHbsSpan() {
8384
- let locPosSpan = this._locPosSpan;
8090
+ let locPosSpan = this.#locPosSpan;
8385
8091
  if (null === locPosSpan) {
8386
8092
  const start = this.charPositions.start.toHbsPos(),
8387
8093
  end = this.charPositions.end.toHbsPos();
8388
- locPosSpan = this._locPosSpan = null === start || null === end ? BROKEN : new HbsSpan(this.source, {
8094
+ locPosSpan = this.#locPosSpan = null === start || null === end ? BROKEN : new HbsSpan(this.source, {
8389
8095
  start: start,
8390
8096
  end: end
8391
8097
  });
@@ -8408,24 +8114,23 @@ var define, require;
8408
8114
  }
8409
8115
  }
8410
8116
  class HbsSpan {
8411
- kind = OffsetKind.HbsPosition;
8412
- _charPosSpan = null;
8117
+ #charPosSpan;
8413
8118
  // the source location from Handlebars + AST Plugins -- could be wrong
8414
- _providedHbsLoc;
8119
+ #providedHbsLoc;
8415
8120
  constructor(source, hbsPositions, providedHbsLoc = null) {
8416
- this.source = source, this.hbsPositions = hbsPositions, this._providedHbsLoc = providedHbsLoc;
8121
+ this.source = source, this.hbsPositions = hbsPositions, this.kind = "HbsPosition", this.#charPosSpan = null, this.#providedHbsLoc = providedHbsLoc;
8417
8122
  }
8418
8123
  serialize() {
8419
8124
  const charPos = this.toCharPosSpan();
8420
- return null === charPos ? OffsetKind.Broken : charPos.wrap().serialize();
8125
+ return null === charPos ? "Broken" : charPos.wrap().serialize();
8421
8126
  }
8422
8127
  wrap() {
8423
8128
  return new SourceSpan(this);
8424
8129
  }
8425
8130
  updateProvided(pos, edge) {
8426
- this._providedHbsLoc && (this._providedHbsLoc[edge] = pos),
8131
+ this.#providedHbsLoc && (this.#providedHbsLoc[edge] = pos),
8427
8132
  // invalidate computed character offsets
8428
- this._charPosSpan = null, this._providedHbsLoc = {
8133
+ this.#charPosSpan = null, this.#providedHbsLoc = {
8429
8134
  start: pos,
8430
8135
  end: pos
8431
8136
  };
@@ -8459,12 +8164,12 @@ var define, require;
8459
8164
  return this;
8460
8165
  }
8461
8166
  toCharPosSpan() {
8462
- let charPosSpan = this._charPosSpan;
8167
+ let charPosSpan = this.#charPosSpan;
8463
8168
  if (null === charPosSpan) {
8464
8169
  const start = this.hbsPositions.start.toCharPos(),
8465
8170
  end = this.hbsPositions.end.toCharPos();
8466
- if (!start || !end) return charPosSpan = this._charPosSpan = BROKEN, null;
8467
- charPosSpan = this._charPosSpan = new CharPositionSpan(this.source, {
8171
+ if (!start || !end) return charPosSpan = this.#charPosSpan = BROKEN, null;
8172
+ charPosSpan = this.#charPosSpan = new CharPositionSpan(this.source, {
8468
8173
  start: start,
8469
8174
  end: end
8470
8175
  });
@@ -8482,10 +8187,10 @@ var define, require;
8482
8187
  }
8483
8188
  serialize() {
8484
8189
  switch (this.kind) {
8485
- case OffsetKind.Broken:
8486
- case OffsetKind.NonExistent:
8190
+ case "Broken":
8191
+ case "NonExistent":
8487
8192
  return this.kind;
8488
- case OffsetKind.InternalsSynthetic:
8193
+ case "InternalsSynthetic":
8489
8194
  return this.string || "";
8490
8195
  }
8491
8196
  }
@@ -8521,25 +8226,21 @@ var define, require;
8521
8226
  return BROKEN_LOCATION;
8522
8227
  }
8523
8228
  }
8524
- const span = match(m => m.when(OffsetKind.HbsPosition, OffsetKind.HbsPosition, (left, right) => new HbsSpan(left.source, {
8229
+ const span = match(m => m.when("HbsPosition", "HbsPosition", (left, right) => new HbsSpan(left.source, {
8525
8230
  start: left,
8526
8231
  end: right
8527
- }).wrap()).when(OffsetKind.CharPosition, OffsetKind.CharPosition, (left, right) => new CharPositionSpan(left.source, {
8232
+ }).wrap()).when("CharPosition", "CharPosition", (left, right) => new CharPositionSpan(left.source, {
8528
8233
  start: left,
8529
8234
  end: right
8530
- }).wrap()).when(OffsetKind.CharPosition, OffsetKind.HbsPosition, (left, right) => {
8235
+ }).wrap()).when("CharPosition", "HbsPosition", (left, right) => {
8531
8236
  const rightCharPos = right.toCharPos();
8532
- return null === rightCharPos ? new InvisibleSpan(OffsetKind.Broken, BROKEN_LOCATION).wrap() : span(left, rightCharPos);
8533
- }).when(OffsetKind.HbsPosition, OffsetKind.CharPosition, (left, right) => {
8237
+ return null === rightCharPos ? new InvisibleSpan("Broken", BROKEN_LOCATION).wrap() : span(left, rightCharPos);
8238
+ }).when("HbsPosition", "CharPosition", (left, right) => {
8534
8239
  const leftCharPos = left.toCharPos();
8535
- return null === leftCharPos ? new InvisibleSpan(OffsetKind.Broken, BROKEN_LOCATION).wrap() : span(leftCharPos, right);
8240
+ return null === leftCharPos ? new InvisibleSpan("Broken", BROKEN_LOCATION).wrap() : span(leftCharPos, right);
8536
8241
  }).when("IS_INVISIBLE", "MATCH_ANY", left => new InvisibleSpan(left.kind, BROKEN_LOCATION).wrap()).when("MATCH_ANY", "IS_INVISIBLE", (_, right) => new InvisibleSpan(right.kind, BROKEN_LOCATION).wrap())),
8537
8242
  BROKEN = "BROKEN";
8538
8243
 
8539
- /**
8540
- * All positions have these details in common. Most notably, all three kinds of positions can
8541
- * must be able to attempt to convert themselves into {@see CharPosition}.
8542
- */
8543
8244
  /**
8544
8245
  * Used to indicate that an attempt to convert a `SourcePosition` to a character offset failed. It
8545
8246
  * is separate from `null` so that `null` can be used to indicate that the computation wasn't yet
@@ -8570,7 +8271,7 @@ var define, require;
8570
8271
  * any part of the source.
8571
8272
  */
8572
8273
  static broken(pos = UNKNOWN_POSITION) {
8573
- return new InvisiblePosition(OffsetKind.Broken, pos).wrap();
8274
+ return new InvisiblePosition("Broken", pos).wrap();
8574
8275
  }
8575
8276
  constructor(data) {
8576
8277
  this.data = data;
@@ -8615,7 +8316,7 @@ var define, require;
8615
8316
  if (null === charPos) return SourceOffset.broken();
8616
8317
  {
8617
8318
  const result = charPos.offset + by;
8618
- return charPos.source.check(result) ? new CharPosition(charPos.source, result).wrap() : SourceOffset.broken();
8319
+ return charPos.source.validate(result) ? new CharPosition(charPos.source, result).wrap() : SourceOffset.broken();
8619
8320
  }
8620
8321
  }
8621
8322
  /**
@@ -8634,11 +8335,8 @@ var define, require;
8634
8335
  }
8635
8336
  }
8636
8337
  class CharPosition {
8637
- kind = OffsetKind.CharPosition;
8638
- /** Computed from char offset */
8639
- _locPos = null;
8640
8338
  constructor(source, charPos) {
8641
- this.source = source, this.charPos = charPos;
8339
+ this.source = source, this.charPos = charPos, this.kind = "CharPosition", this._locPos = null;
8642
8340
  }
8643
8341
  /**
8644
8342
  * This is already a `CharPosition`.
@@ -8681,10 +8379,8 @@ var define, require;
8681
8379
  }
8682
8380
  }
8683
8381
  class HbsPosition {
8684
- kind = OffsetKind.HbsPosition;
8685
- _charPos;
8686
8382
  constructor(source, hbsPos, charPos = null) {
8687
- this.source = source, this.hbsPos = hbsPos, this._charPos = null === charPos ? null : new CharPosition(source, charPos);
8383
+ this.source = source, this.hbsPos = hbsPos, this.kind = "HbsPosition", this._charPos = null === charPos ? null : new CharPosition(source, charPos);
8688
8384
  }
8689
8385
  /**
8690
8386
  * Lazily compute the character offset from the {@see SourcePosition}. Once an `HbsPosition` has
@@ -8754,17 +8450,17 @@ var define, require;
8754
8450
  *
8755
8451
  * @see {SourceOffset#eql}
8756
8452
  */
8757
- const eql = match(m => m.when(OffsetKind.HbsPosition, OffsetKind.HbsPosition, ({
8453
+ const eql = match(m => m.when("HbsPosition", "HbsPosition", ({
8758
8454
  hbsPos: left
8759
8455
  }, {
8760
8456
  hbsPos: right
8761
- }) => left.column === right.column && left.line === right.line).when(OffsetKind.CharPosition, OffsetKind.CharPosition, ({
8457
+ }) => left.column === right.column && left.line === right.line).when("CharPosition", "CharPosition", ({
8762
8458
  charPos: left
8763
8459
  }, {
8764
8460
  charPos: right
8765
- }) => left === right).when(OffsetKind.CharPosition, OffsetKind.HbsPosition, ({
8461
+ }) => left === right).when("CharPosition", "HbsPosition", ({
8766
8462
  offset: left
8767
- }, right) => left === right.toCharPos()?.offset).when(OffsetKind.HbsPosition, OffsetKind.CharPosition, (left, {
8463
+ }, right) => left === right.toCharPos()?.offset).when("HbsPosition", "CharPosition", (left, {
8768
8464
  offset: right
8769
8465
  }) => left.toCharPos()?.offset === right).when("MATCH_ANY", "MATCH_ANY", () => !1));
8770
8466
  class Source {
@@ -8777,7 +8473,7 @@ var define, require;
8777
8473
  /**
8778
8474
  * Validate that the character offset represents a position in the source string.
8779
8475
  */
8780
- check(offset) {
8476
+ validate(offset) {
8781
8477
  return offset >= 0 && offset <= this.source.length;
8782
8478
  }
8783
8479
  slice(start, end) {
@@ -8808,7 +8504,6 @@ var define, require;
8808
8504
  let seenLines = 0,
8809
8505
  seenChars = 0;
8810
8506
  if (offset > this.source.length) return null;
8811
- // eslint-disable-next-line no-constant-condition
8812
8507
  for (;;) {
8813
8508
  let nextLine = this.source.indexOf("\n", seenChars);
8814
8509
  if (offset <= nextLine || -1 === nextLine) return {
@@ -8832,7 +8527,7 @@ var define, require;
8832
8527
  if (seenChars + column > nextLine) return nextLine;
8833
8528
  {
8834
8529
  let roundTrip = this.hbsPosFor(seenChars + column);
8835
- debugAssert(null !== roundTrip, "the returned offset failed to round-trip"), debugAssert(roundTrip.line === line, "the round-tripped line didn't match the original line"), debugAssert(roundTrip.column === column, "the round-tripped column didn't match the original column");
8530
+ roundTrip.line, roundTrip.column;
8836
8531
  }
8837
8532
  return seenChars + column;
8838
8533
  }
@@ -8846,7 +8541,6 @@ var define, require;
8846
8541
  static range(span, fallback = SourceSpan.NON_EXISTENT) {
8847
8542
  return new SpanList(span.map(loc)).getRangeOffset(fallback);
8848
8543
  }
8849
- _span;
8850
8544
  constructor(span = []) {
8851
8545
  this._span = span;
8852
8546
  }
@@ -8854,7 +8548,7 @@ var define, require;
8854
8548
  this._span.push(offset);
8855
8549
  }
8856
8550
  getRangeOffset(fallback) {
8857
- if (isPresentArray(this._span)) {
8551
+ if (isPresentArray$1(this._span)) {
8858
8552
  let first = getFirst(this._span),
8859
8553
  last = getLast(this._span);
8860
8554
  return first.extend(last);
@@ -8876,7 +8570,7 @@ var define, require;
8876
8570
  function maybeLoc(location, fallback) {
8877
8571
  return hasSpan(location) ? loc(location) : fallback;
8878
8572
  }
8879
- var api$2 = Object.freeze({
8573
+ var api$1 = Object.freeze({
8880
8574
  __proto__: null,
8881
8575
  NON_EXISTENT_LOCATION: NON_EXISTENT_LOCATION,
8882
8576
  SYNTHETIC_LOCATION: SYNTHETIC_LOCATION,
@@ -8934,7 +8628,10 @@ var define, require;
8934
8628
  let error = Error.call(this, message);
8935
8629
  this.key = key, this.message = message, this.node = node, this.parent = parent, error.stack && (this.stack = error.stack);
8936
8630
  }
8937
- return TraversalError.prototype = Object.create(Error.prototype), TraversalError.prototype.constructor = TraversalError, TraversalError;
8631
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
8632
+ return TraversalError.prototype = Object.create(Error.prototype),
8633
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
8634
+ TraversalError.prototype.constructor = TraversalError, TraversalError;
8938
8635
  }();
8939
8636
  function cannotRemoveNode(node, parent, key) {
8940
8637
  return new TraversalError("Cannot remove a node unless it is part of an array", node, parent, key);
@@ -8946,9 +8643,6 @@ var define, require;
8946
8643
  return new TraversalError("Replacing and removing in key handlers is not yet supported.", node, null, key);
8947
8644
  }
8948
8645
  class WalkerPath {
8949
- node;
8950
- parent;
8951
- parentKey;
8952
8646
  constructor(node, parent = null, parentKey = null) {
8953
8647
  this.node = node, this.parent = parent, this.parentKey = parentKey;
8954
8648
  }
@@ -8962,7 +8656,6 @@ var define, require;
8962
8656
  }
8963
8657
  }
8964
8658
  class PathParentsIterator {
8965
- path;
8966
8659
  constructor(path) {
8967
8660
  this.path = path;
8968
8661
  }
@@ -8992,7 +8685,10 @@ var define, require;
8992
8685
  parentKey: parentKey
8993
8686
  } = path,
8994
8687
  handler = function (visitor, nodeType) {
8995
- if (visitor.Program && ("Template" === nodeType && !visitor.Template || "Block" === nodeType && !visitor.Block)) return deprecate$1(`The 'Program' visitor node is deprecated. Use 'Template' or 'Block' instead (node was '${nodeType}') `), visitor.Program;
8688
+ // eslint-disable-next-line @typescript-eslint/no-deprecated
8689
+ if (visitor.Program && ("Template" === nodeType && !visitor.Template || "Block" === nodeType && !visitor.Block))
8690
+ // eslint-disable-next-line @typescript-eslint/no-deprecated
8691
+ return visitor.Program;
8996
8692
  let handler = visitor[nodeType];
8997
8693
  return void 0 !== handler ? handler : visitor.All;
8998
8694
  }(visitor, node.type);
@@ -9037,9 +8733,11 @@ var define, require;
9037
8733
  void 0 !== result &&
9038
8734
  // TODO: dynamically check the results by having a table of
9039
8735
  // expected node types in value space, not just type space
8736
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-explicit-any
9040
8737
  function (node, key, value, result) {
9041
8738
  if (null === result) throw cannotRemoveNode(value, node, key);
9042
8739
  if (Array.isArray(result)) {
8740
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
9043
8741
  if (1 !== result.length) throw 0 === result.length ? cannotRemoveNode(value, node, key) : cannotReplaceNode(value, node, key);
9044
8742
  set(node, key, result[0]);
9045
8743
  } else set(node, key, result);
@@ -9050,7 +8748,7 @@ var define, require;
9050
8748
  }
9051
8749
  function visitArray(visitor, array, parent, parentKey) {
9052
8750
  for (let i = 0; i < array.length; i++) {
9053
- let node = unwrap(array[i]),
8751
+ let node = array[i],
9054
8752
  result = visitNode(visitor, new WalkerPath(node, parent, parentKey));
9055
8753
  void 0 !== result && (i += spliceArray(array, i, result) - 1);
9056
8754
  }
@@ -9062,9 +8760,8 @@ var define, require;
9062
8760
  visitNode(visitor, new WalkerPath(node));
9063
8761
  }
9064
8762
  class Walker {
9065
- stack = [];
9066
8763
  constructor(order) {
9067
- this.order = order;
8764
+ this.order = order, this.stack = [];
9068
8765
  }
9069
8766
  visit(node, visitor) {
9070
8767
  node && (this.stack.push(node), "post" === this.order ? (this.children(node, visitor), visitor(node, this)) : (visitor(node, this), this.children(node, visitor)), this.stack.pop());
@@ -9104,9 +8801,6 @@ var define, require;
9104
8801
  function SOURCE() {
9105
8802
  return _SOURCE || (_SOURCE = new Source("", "(synthetic)")), _SOURCE;
9106
8803
  }
9107
-
9108
- // const SOURCE = new Source('', '(tests)');
9109
- // Statements
9110
8804
  function buildVar$1(name, loc) {
9111
8805
  return b.var({
9112
8806
  name: name,
@@ -9118,7 +8812,7 @@ var define, require;
9118
8812
  if ("string" != typeof path) {
9119
8813
  if ("type" in path) return path;
9120
8814
  {
9121
- debugAssert(-1 === path.head.indexOf("."), "builder.path({ head, tail }) should not be called with a head with dots in it");
8815
+ path.head.indexOf(".");
9122
8816
  let {
9123
8817
  head: head,
9124
8818
  tail: tail
@@ -9139,7 +8833,7 @@ var define, require;
9139
8833
  head: head,
9140
8834
  tail: tail
9141
8835
  } = function (original, loc) {
9142
- let [head, ...tail] = asPresentArray(original.split(".")),
8836
+ let [head, ...tail] = original.split("."),
9143
8837
  headNode = b.head({
9144
8838
  original: head,
9145
8839
  loc: buildLoc(loc || null)
@@ -9226,11 +8920,11 @@ var define, require;
9226
8920
  block: function (path, params, hash, _defaultBlock, _elseBlock = null, loc, openStrip, inverseStrip, closeStrip) {
9227
8921
  let defaultBlock,
9228
8922
  elseBlock = null;
9229
- return "Template" === _defaultBlock.type ? (deprecate$1("b.program is deprecated. Use b.blockItself instead."), defaultBlock = b.blockItself({
8923
+ return defaultBlock = "Template" === _defaultBlock.type ? b.blockItself({
9230
8924
  params: buildBlockParams(_defaultBlock.blockParams),
9231
8925
  body: _defaultBlock.body,
9232
8926
  loc: _defaultBlock.loc
9233
- })) : defaultBlock = _defaultBlock, "Template" === _elseBlock?.type ? (deprecate$1("b.program is deprecated. Use b.blockItself instead."), debugAssert(0 === _elseBlock.blockParams.length, "{{else}} block cannot have block params"), elseBlock = b.blockItself({
8927
+ }) : _defaultBlock, "Template" === _elseBlock?.type ? (_elseBlock.blockParams.length, elseBlock = b.blockItself({
9234
8928
  params: [],
9235
8929
  body: _elseBlock.body,
9236
8930
  loc: _elseBlock.loc
@@ -9258,9 +8952,7 @@ var define, require;
9258
8952
  loc: buildLoc(loc || null)
9259
8953
  });
9260
8954
  },
9261
- element:
9262
- // Nodes
9263
- function (tag, options = {}) {
8955
+ element: function (tag, options = {}) {
9264
8956
  let path,
9265
8957
  selfClosing,
9266
8958
  {
@@ -9274,10 +8966,10 @@ var define, require;
9274
8966
  loc: loc
9275
8967
  } = options;
9276
8968
  // this is used for backwards compat, prior to `selfClosing` being part of the ElementNode AST
9277
- "string" == typeof tag ? tag.endsWith("/") ? (path = buildPath(tag.slice(0, -1)), selfClosing = !0) : path = buildPath(tag) : "type" in tag ? (debugAssert("PathExpression" === tag.type, `Invalid tag type ${tag.type}`), path = tag) : "path" in tag ? (debugAssert("PathExpression" === tag.path.type, `Invalid tag type ${tag.path.type}`), path = tag.path, selfClosing = tag.selfClosing) : (path = buildPath(tag.name), selfClosing = tag.selfClosing), selfClosing && debugAssert(null == _closeTag, "Cannot build a self-closing tag with a closeTag source location");
8969
+ "string" == typeof tag ? tag.endsWith("/") ? (path = buildPath(tag.slice(0, -1)), selfClosing = !0) : path = buildPath(tag) : "type" in tag ? (tag.type, tag.type, path = tag) : "path" in tag ? (tag.path.type, tag.path.type, path = tag.path, selfClosing = tag.selfClosing) : (path = buildPath(tag.name), selfClosing = tag.selfClosing);
9278
8970
  let params = blockParams?.map(param => "string" == typeof param ? buildVar$1(param) : param),
9279
8971
  closeTag = null;
9280
- return _closeTag ? closeTag = buildLoc(_closeTag || null) : void 0 === _closeTag && (closeTag = selfClosing || isVoidTag(path.original) ? null : buildLoc(null)), b.element({
8972
+ return _closeTag ? closeTag = buildLoc(_closeTag) : void 0 === _closeTag && (closeTag = selfClosing || isVoidTag(path.original) ? null : buildLoc(null)), b.element({
9281
8973
  path: path,
9282
8974
  selfClosing: selfClosing || !1,
9283
8975
  attributes: attrs || [],
@@ -9323,7 +9015,7 @@ var define, require;
9323
9015
  });
9324
9016
  },
9325
9017
  concat: function (parts, loc) {
9326
- if (!isPresentArray(parts)) throw new Error("b.concat requires at least one part");
9018
+ if (!isPresentArray$1(parts)) throw new Error("b.concat requires at least one part");
9327
9019
  return b.concat({
9328
9020
  parts: parts,
9329
9021
  loc: buildLoc(loc || null)
@@ -9339,7 +9031,7 @@ var define, require;
9339
9031
  },
9340
9032
  literal: buildLiteral,
9341
9033
  program: function (body, blockParams, loc) {
9342
- return deprecate$1("b.program is deprecated. Use b.template or b.blockItself instead."), blockParams && blockParams.length ? buildBlockItself(body, blockParams, !1, loc) : buildTemplate(body, [], loc);
9034
+ return blockParams && blockParams.length ? buildBlockItself(body, blockParams, !1, loc) : buildTemplate(body, [], loc);
9343
9035
  },
9344
9036
  blockItself: buildBlockItself,
9345
9037
  template: buildTemplate,
@@ -9410,21 +9102,21 @@ var define, require;
9410
9102
  }
9411
9103
  blockItself({
9412
9104
  body: body,
9413
- params: params,
9105
+ params: params1,
9414
9106
  chained = !1,
9415
9107
  loc: loc
9416
9108
  }) {
9417
9109
  return {
9418
9110
  type: "Block",
9419
9111
  body: body,
9420
- params: params,
9112
+ params: params1,
9421
9113
  get blockParams() {
9422
9114
  return this.params.map(p => p.name);
9423
9115
  },
9424
9116
  set blockParams(params) {
9425
- this.params = params.map(name => b.var({
9426
- name: name,
9427
- loc: SourceSpan.synthetic(name)
9117
+ this.params = params.map(name1 => b.var({
9118
+ name: name1,
9119
+ loc: SourceSpan.synthetic(name1)
9428
9120
  }));
9429
9121
  },
9430
9122
  chained: chained,
@@ -9445,7 +9137,7 @@ var define, require;
9445
9137
  }
9446
9138
  mustache({
9447
9139
  path: path,
9448
- params: params,
9140
+ params: params1,
9449
9141
  hash: hash,
9450
9142
  trusting: trusting,
9451
9143
  loc: loc,
@@ -9471,15 +9163,15 @@ var define, require;
9471
9163
  return Object.defineProperty(node, "escaped", {
9472
9164
  enumerable: !1,
9473
9165
  get() {
9474
- return deprecate$1("The escaped property on mustache nodes is deprecated, use trusting instead"), !this.trusting;
9166
+ return !this.trusting;
9475
9167
  },
9476
- set(value) {
9477
- deprecate$1("The escaped property on mustache nodes is deprecated, use trusting instead"), this.trusting = !value;
9168
+ set(value1) {
9169
+ this.trusting = !value1;
9478
9170
  }
9479
9171
  }), node;
9480
9172
  }({
9481
9173
  path: path,
9482
- params: params,
9174
+ params: params1,
9483
9175
  hash: hash,
9484
9176
  trusting: trusting,
9485
9177
  strip: strip,
@@ -9488,7 +9180,7 @@ var define, require;
9488
9180
  }
9489
9181
  block({
9490
9182
  path: path,
9491
- params: params,
9183
+ params: params1,
9492
9184
  hash: hash,
9493
9185
  defaultBlock: defaultBlock,
9494
9186
  elseBlock = null,
@@ -9500,7 +9192,7 @@ var define, require;
9500
9192
  return {
9501
9193
  type: "BlockStatement",
9502
9194
  path: path,
9503
- params: params,
9195
+ params: params1,
9504
9196
  hash: hash,
9505
9197
  program: defaultBlock,
9506
9198
  inverse: elseBlock,
@@ -9511,22 +9203,22 @@ var define, require;
9511
9203
  };
9512
9204
  }
9513
9205
  comment({
9514
- value: value,
9206
+ value: value1,
9515
9207
  loc: loc
9516
9208
  }) {
9517
9209
  return {
9518
9210
  type: "CommentStatement",
9519
- value: value,
9211
+ value: value1,
9520
9212
  loc: loc
9521
9213
  };
9522
9214
  }
9523
9215
  mustacheComment({
9524
- value: value,
9216
+ value: value1,
9525
9217
  loc: loc
9526
9218
  }) {
9527
9219
  return {
9528
9220
  type: "MustacheCommentStatement",
9529
- value: value,
9221
+ value: value1,
9530
9222
  loc: loc
9531
9223
  };
9532
9224
  }
@@ -9542,23 +9234,23 @@ var define, require;
9542
9234
  }
9543
9235
  element({
9544
9236
  path: path,
9545
- selfClosing: selfClosing,
9237
+ selfClosing: selfClosing1,
9546
9238
  attributes: attributes,
9547
9239
  modifiers: modifiers,
9548
- params: params,
9240
+ params: params1,
9549
9241
  comments: comments,
9550
9242
  children: children,
9551
9243
  openTag: openTag,
9552
9244
  closeTag: closeTag,
9553
9245
  loc: loc
9554
9246
  }) {
9555
- let _selfClosing = selfClosing;
9247
+ let _selfClosing = selfClosing1;
9556
9248
  return {
9557
9249
  type: "ElementNode",
9558
9250
  path: path,
9559
9251
  attributes: attributes,
9560
9252
  modifiers: modifiers,
9561
- params: params,
9253
+ params: params1,
9562
9254
  comments: comments,
9563
9255
  children: children,
9564
9256
  openTag: openTag,
@@ -9574,9 +9266,9 @@ var define, require;
9574
9266
  return this.params.map(p => p.name);
9575
9267
  },
9576
9268
  set blockParams(params) {
9577
- this.params = params.map(name => b.var({
9578
- name: name,
9579
- loc: SourceSpan.synthetic(name)
9269
+ this.params = params.map(name1 => b.var({
9270
+ name: name1,
9271
+ loc: SourceSpan.synthetic(name1)
9580
9272
  }));
9581
9273
  },
9582
9274
  get selfClosing() {
@@ -9589,27 +9281,27 @@ var define, require;
9589
9281
  }
9590
9282
  elementModifier({
9591
9283
  path: path,
9592
- params: params,
9284
+ params: params1,
9593
9285
  hash: hash,
9594
9286
  loc: loc
9595
9287
  }) {
9596
9288
  return {
9597
9289
  type: "ElementModifierStatement",
9598
9290
  path: path,
9599
- params: params,
9291
+ params: params1,
9600
9292
  hash: hash,
9601
9293
  loc: loc
9602
9294
  };
9603
9295
  }
9604
9296
  attr({
9605
- name: name,
9606
- value: value,
9297
+ name: name1,
9298
+ value: value1,
9607
9299
  loc: loc
9608
9300
  }) {
9609
9301
  return {
9610
9302
  type: "AttrNode",
9611
- name: name,
9612
- value: value,
9303
+ name: name1,
9304
+ value: value1,
9613
9305
  loc: loc
9614
9306
  };
9615
9307
  }
@@ -9625,14 +9317,14 @@ var define, require;
9625
9317
  }
9626
9318
  sexpr({
9627
9319
  path: path,
9628
- params: params,
9320
+ params: params1,
9629
9321
  hash: hash,
9630
9322
  loc: loc
9631
9323
  }) {
9632
9324
  return {
9633
9325
  type: "SubExpression",
9634
9326
  path: path,
9635
- params: params,
9327
+ params: params1,
9636
9328
  hash: hash,
9637
9329
  loc: loc
9638
9330
  };
@@ -9655,7 +9347,7 @@ var define, require;
9655
9347
  return [this.head.original, ...this.tail].join(".");
9656
9348
  },
9657
9349
  set original(value) {
9658
- let [head, ...tail] = asPresentArray(value.split("."));
9350
+ let [head, ...tail] = value.split(".");
9659
9351
  this.head = publicBuilder.head(head, this.head.loc), this.tail = tail;
9660
9352
  },
9661
9353
  loc: loc
@@ -9663,8 +9355,7 @@ var define, require;
9663
9355
  return Object.defineProperty(node, "parts", {
9664
9356
  enumerable: !1,
9665
9357
  get() {
9666
- deprecate$1("The parts property on path nodes is deprecated, use head and tail instead");
9667
- let parts = asPresentArray(this.original.split("."));
9358
+ let parts = this.original.split(".");
9668
9359
  return "this" === parts[0] ?
9669
9360
  // parts does not include `this`
9670
9361
  parts.shift() : parts[0].startsWith("@") && (
@@ -9672,7 +9363,6 @@ var define, require;
9672
9363
  parts[0] = parts[0].slice(1)), Object.freeze(parts);
9673
9364
  },
9674
9365
  set(values) {
9675
- deprecate$1("The parts property on mustache nodes is deprecated, use head and tail instead");
9676
9366
  let parts = [...values];
9677
9367
  // you are not supposed to already have `this` or `@` in the parts, but since this is
9678
9368
  // deprecated anyway, we will infer what you meant and allow it
@@ -9681,12 +9371,12 @@ var define, require;
9681
9371
  }), Object.defineProperty(node, "this", {
9682
9372
  enumerable: !1,
9683
9373
  get() {
9684
- return deprecate$1("The this property on path nodes is deprecated, use head.type instead"), "ThisHead" === this.head.type;
9374
+ return "ThisHead" === this.head.type;
9685
9375
  }
9686
9376
  }), Object.defineProperty(node, "data", {
9687
9377
  enumerable: !1,
9688
9378
  get() {
9689
- return deprecate$1("The data property on path nodes is deprecated, use head.type instead"), "AtHead" === this.head.type;
9379
+ return "AtHead" === this.head.type;
9690
9380
  }
9691
9381
  }), node;
9692
9382
  }({
@@ -9721,7 +9411,7 @@ var define, require;
9721
9411
  };
9722
9412
  }
9723
9413
  atName({
9724
- name: name,
9414
+ name: name1,
9725
9415
  loc: loc
9726
9416
  }) {
9727
9417
  let _name = "";
@@ -9731,7 +9421,7 @@ var define, require;
9731
9421
  return _name;
9732
9422
  },
9733
9423
  set name(value) {
9734
- debugAssert("@" === value[0], "call builders.at() with a string that starts with '@'"), debugAssert(-1 === value.indexOf("."), "builder.at() should not be called with a name with dots in it"), _name = value;
9424
+ value[0], value.indexOf("."), _name = value;
9735
9425
  },
9736
9426
  get original() {
9737
9427
  return this.name;
@@ -9742,10 +9432,10 @@ var define, require;
9742
9432
  loc: loc
9743
9433
  };
9744
9434
  // trigger the assertions
9745
- return node.name = name, node;
9435
+ return node.name = name1, node;
9746
9436
  }
9747
9437
  var({
9748
- name: name,
9438
+ name: name1,
9749
9439
  loc: loc
9750
9440
  }) {
9751
9441
  let _name = "";
@@ -9755,7 +9445,7 @@ var define, require;
9755
9445
  return _name;
9756
9446
  },
9757
9447
  set name(value) {
9758
- debugAssert("this" !== value, "You called builders.var() with 'this'. Call builders.this instead"), debugAssert("@" !== value[0], `You called builders.var() with '${name}'. Call builders.at('${name}') instead`), debugAssert(-1 === value.indexOf("."), "builder.var() should not be called with a name with dots in it"), _name = value;
9448
+ value[0], value.indexOf("."), _name = value;
9759
9449
  },
9760
9450
  get original() {
9761
9451
  return this.name;
@@ -9766,7 +9456,7 @@ var define, require;
9766
9456
  loc: loc
9767
9457
  };
9768
9458
  // trigger the assertions
9769
- return node.name = name, node;
9459
+ return node.name = name1, node;
9770
9460
  }
9771
9461
  hash({
9772
9462
  pairs: pairs,
@@ -9780,56 +9470,50 @@ var define, require;
9780
9470
  }
9781
9471
  pair({
9782
9472
  key: key,
9783
- value: value,
9473
+ value: value1,
9784
9474
  loc: loc
9785
9475
  }) {
9786
9476
  return {
9787
9477
  type: "HashPair",
9788
9478
  key: key,
9789
- value: value,
9479
+ value: value1,
9790
9480
  loc: loc
9791
9481
  };
9792
9482
  }
9793
9483
  literal({
9794
9484
  type: type,
9795
- value: value,
9485
+ value: value1,
9796
9486
  loc: loc
9797
9487
  }) {
9798
9488
  return function ({
9799
9489
  type: type,
9800
- value: value,
9490
+ value: value1,
9801
9491
  loc: loc
9802
9492
  }) {
9803
9493
  const node = {
9804
9494
  type: type,
9805
- value: value,
9495
+ value: value1,
9806
9496
  loc: loc
9807
9497
  };
9808
9498
  return Object.defineProperty(node, "original", {
9809
9499
  enumerable: !1,
9810
9500
  get() {
9811
- return deprecate$1("The original property on literal nodes is deprecated, use value instead"), this.value;
9501
+ return this.value;
9812
9502
  },
9813
- set(value) {
9814
- deprecate$1("The original property on literal nodes is deprecated, use value instead"), this.value = value;
9503
+ set(value1) {
9504
+ this.value = value1;
9815
9505
  }
9816
9506
  }), node;
9817
9507
  }({
9818
9508
  type: type,
9819
- value: value,
9509
+ value: value1,
9820
9510
  loc: loc
9821
9511
  });
9822
9512
  }
9823
9513
  }();
9824
9514
  class Parser {
9825
- elementStack = [];
9826
- lines;
9827
- source;
9828
- currentAttribute = null;
9829
- currentNode = null;
9830
- tokenizer;
9831
9515
  constructor(source, entityParser = new EntityParser(namedCharRefs), mode = "precompile") {
9832
- this.source = source, this.lines = source.source.split(/\r\n?|\n/u), this.tokenizer = new EventedTokenizer(this, entityParser, mode);
9516
+ this.elementStack = [], this.currentAttribute = null, this.currentNode = null, this.source = source, this.lines = source.source.split(/\r\n?|\n/u), this.tokenizer = new EventedTokenizer(this, entityParser, mode);
9833
9517
  }
9834
9518
  offset() {
9835
9519
  let {
@@ -9851,33 +9535,33 @@ var define, require;
9851
9535
  // node.loc = node.loc.withEnd(end);
9852
9536
  }
9853
9537
  get currentAttr() {
9854
- return expect(this.currentAttribute, "expected attribute");
9538
+ return this.currentAttribute;
9855
9539
  }
9856
9540
  get currentTag() {
9857
9541
  let node = this.currentNode;
9858
- return debugAssert(node && ("StartTag" === node.type || "EndTag" === node.type), "expected tag"), node;
9542
+ return node && ("StartTag" === node.type || node.type), node;
9859
9543
  }
9860
9544
  get currentStartTag() {
9861
9545
  let node = this.currentNode;
9862
- return debugAssert(node && "StartTag" === node.type, "expected start tag"), node;
9546
+ return node && node.type, node;
9863
9547
  }
9864
9548
  get currentEndTag() {
9865
9549
  let node = this.currentNode;
9866
- return debugAssert(node && "EndTag" === node.type, "expected end tag"), node;
9550
+ return node && node.type, node;
9867
9551
  }
9868
9552
  get currentComment() {
9869
9553
  let node = this.currentNode;
9870
- return debugAssert(node && "CommentStatement" === node.type, "expected a comment"), node;
9554
+ return node && node.type, node;
9871
9555
  }
9872
9556
  get currentData() {
9873
9557
  let node = this.currentNode;
9874
- return debugAssert(node && "TextNode" === node.type, "expected a text node"), node;
9558
+ return node && node.type, node;
9875
9559
  }
9876
9560
  acceptNode(node) {
9877
9561
  return this[node.type](node);
9878
9562
  }
9879
9563
  currentElement() {
9880
- return getLast(asPresentArray(this.elementStack));
9564
+ return getLast(this.elementStack);
9881
9565
  }
9882
9566
  sourceForNode(node, endNode) {
9883
9567
  let line,
@@ -9887,20 +9571,13 @@ var define, require;
9887
9571
  currentLine = firstLine - 1,
9888
9572
  firstColumn = node.loc.start.column,
9889
9573
  string = [];
9890
- for (endNode ? (lastLine = endNode.loc.end.line - 1, lastColumn = endNode.loc.end.column) : (lastLine = node.loc.end.line - 1, lastColumn = node.loc.end.column); currentLine < lastLine;) currentLine++, line = unwrap(this.lines[currentLine]), currentLine === firstLine ? firstLine === lastLine ? string.push(line.slice(firstColumn, lastColumn)) : string.push(line.slice(firstColumn)) : currentLine === lastLine ? string.push(line.slice(0, lastColumn)) : string.push(line);
9574
+ for (endNode ? (lastLine = endNode.loc.end.line - 1, lastColumn = endNode.loc.end.column) : (lastLine = node.loc.end.line - 1, lastColumn = node.loc.end.column); currentLine < lastLine;) currentLine++, line = this.lines[currentLine], currentLine === firstLine ? firstLine === lastLine ? string.push(line.slice(firstColumn, lastColumn)) : string.push(line.slice(firstColumn)) : currentLine === lastLine ? string.push(line.slice(0, lastColumn)) : string.push(line);
9891
9575
  return string.join("\n");
9892
9576
  }
9893
9577
  }
9894
9578
  class HandlebarsNodeVisitors extends Parser {
9895
- // Because we interleave the HTML and HBS parsing, sometimes the HTML
9896
- // tokenizer can run out of tokens when we switch into {{...}} or reached
9897
- // EOF. There are positions where neither of these are expected, and it would
9898
- // like to generate an error, but there is no span to attach the error to.
9899
- // This allows the HTML tokenization to stash an error message and the next
9900
- // mustache visitor will attach the message to the appropriate span and throw
9901
- // the error.
9902
- pendingError = null;
9903
9579
  parse(program, blockParams) {
9580
+ program.loc;
9904
9581
  let node = b.template({
9905
9582
  body: [],
9906
9583
  blockParams: blockParams,
@@ -9913,10 +9590,7 @@ var define, require;
9913
9590
  return this.pendingError?.eof(template.loc.getEnd()), template;
9914
9591
  }
9915
9592
  Program(program, blockParams) {
9916
- // The abstract signature doesn't have the blockParams argument, but in
9917
- // practice we can only come from this.BlockStatement() which adds the
9918
- // extra argument for us
9919
- debugAssert(Array.isArray(blockParams), "[BUG] Program in parser unexpectedly called without block params");
9593
+ program.loc;
9920
9594
  let node = b.blockItself({
9921
9595
  body: [],
9922
9596
  params: blockParams,
@@ -9937,14 +9611,12 @@ var define, require;
9937
9611
  // Ensure that that the element stack is balanced properly.
9938
9612
  if (node !== poppedNode) {
9939
9613
  if ("ElementNode" === poppedNode?.type) throw generateSyntaxError(`Unclosed element \`${poppedNode.tag}\``, poppedNode.loc);
9940
- // If the stack is not balanced, then it is likely our own bug, because
9941
- // any unclosed Handlebars blocks should already been caught by now
9942
- debugAssert(void 0 !== poppedNode, "[BUG] empty parser elementStack"), debugAssert(!1, `[BUG] mismatched parser elementStack node: ${node.type}`);
9614
+ node.type;
9943
9615
  }
9944
9616
  return node;
9945
9617
  }
9946
9618
  BlockStatement(block) {
9947
- if ("comment" === this.tokenizer.state) return void this.appendToCommentData(this.sourceForNode(block));
9619
+ if ("comment" === this.tokenizer.state) return block.loc, void this.appendToCommentData(this.sourceForNode(block));
9948
9620
  if ("data" !== this.tokenizer.state && "beforeData" !== this.tokenizer.state) throw generateSyntaxError("A block may only be used inside an HTML element or another block.", this.source.spanFor(block.loc));
9949
9621
  const {
9950
9622
  path: path,
@@ -9953,22 +9625,19 @@ var define, require;
9953
9625
  } = acceptCallNodes(this, block),
9954
9626
  loc = this.source.spanFor(block.loc);
9955
9627
  // Backfill block params loc for the default block
9956
- let blockParams = [];
9628
+ let repairedBlock,
9629
+ blockParams = [];
9957
9630
  if (block.program.blockParams?.length) {
9958
9631
  // Start from right after the hash
9959
9632
  let span = hash.loc.collapse("end");
9960
9633
  // Extend till the beginning of the block
9961
- span = block.program.loc ? span.withEnd(this.source.spanFor(block.program.loc).getStart()) : block.program.body[0] ? span.withEnd(this.source.spanFor(block.program.body[0].loc).getStart()) : span.withEnd(loc.getEnd());
9634
+ span = block.program.loc ? span.withEnd(this.source.spanFor(block.program.loc).getStart()) : block.program.body[0] ? span.withEnd(this.source.spanFor(block.program.body[0].loc).getStart()) : span.withEnd(loc.getEnd()), repairedBlock = repairBlock(this.source, block, span);
9962
9635
  // Now we have a span for something like this:
9963
-
9964
9636
  // {{#foo bar baz=bat as |wow wat|}}
9965
9637
  // ~~~~~~~~~~~~~~~
9966
-
9967
9638
  // Or, if we are unlucky:
9968
-
9969
9639
  // {{#foo bar baz=bat as |wow wat|}}{{/foo}}
9970
9640
  // ~~~~~~~~~~~~~~~~~~~~~~~
9971
-
9972
9641
  // Either way, within this span, there should be exactly two pipes
9973
9642
  // fencing our block params, neatly whitespace separated and with
9974
9643
  // legal identifiers only
@@ -9985,11 +9654,9 @@ var define, require;
9985
9654
  loc: loc
9986
9655
  }));
9987
9656
  }
9988
- }
9989
- // These are bugs in Handlebars upstream
9990
- block.program.loc || (block.program.loc = NON_EXISTENT_LOCATION), block.inverse && !block.inverse.loc && (block.inverse.loc = NON_EXISTENT_LOCATION);
9991
- const program = this.Program(block.program, blockParams),
9992
- inverse = block.inverse ? this.Program(block.inverse, []) : null,
9657
+ } else repairedBlock = repairBlock(this.source, block, loc);
9658
+ const program = this.Program(repairedBlock.program, blockParams),
9659
+ inverse = repairedBlock.inverse ? this.Program(repairedBlock.inverse, []) : null,
9993
9660
  node = b.block({
9994
9661
  path: path,
9995
9662
  params: params,
@@ -10105,7 +9772,7 @@ var define, require;
10105
9772
  lineCount = lines.length - 1;
10106
9773
  return {
10107
9774
  lines: lineCount,
10108
- columns: unwrap(lines[lineCount]).length
9775
+ columns: lines[lineCount].length
10109
9776
  };
10110
9777
  }(content.original, content.value);
10111
9778
  line += offsets.lines, offsets.lines ? column = offsets.columns : column += offsets.columns, tokenizer.line = line, tokenizer.column = column;
@@ -10276,6 +9943,17 @@ var define, require;
10276
9943
  loc: this.source.spanFor(nul.loc)
10277
9944
  });
10278
9945
  }
9946
+ constructor(...args) {
9947
+ super(...args),
9948
+ // Because we interleave the HTML and HBS parsing, sometimes the HTML
9949
+ // tokenizer can run out of tokens when we switch into {{...}} or reached
9950
+ // EOF. There are positions where neither of these are expected, and it would
9951
+ // like to generate an error, but there is no span to attach the error to.
9952
+ // This allows the HTML tokenization to stash an error message and the next
9953
+ // mustache visitor will attach the message to the appropriate span and throw
9954
+ // the error.
9955
+ this.pendingError = null;
9956
+ }
10279
9957
  }
10280
9958
  function acceptCallNodes(compiler, node) {
10281
9959
  let path;
@@ -10296,8 +9974,8 @@ var define, require;
10296
9974
  throw value = "BooleanLiteral" === node.path.type ? node.path.original.toString() : "StringLiteral" === node.path.type ? `"${node.path.original}"` : "NullLiteral" === node.path.type ? "null" : "NumberLiteral" === node.path.type ? node.path.value.toString() : "undefined", generateSyntaxError(`${node.path.type} "${"StringLiteral" === node.path.type ? node.path.original : value}" cannot be called as a sub-expression, replace (${value}) with ${value}`, compiler.source.spanFor(node.path.loc));
10297
9975
  }
10298
9976
  }
10299
- const params = node.params ? node.params.map(e => compiler.acceptNode(e)) : [],
10300
- end = isPresentArray(params) ? getLast(params).loc : path.loc;
9977
+ const params = node.params.map(e => compiler.acceptNode(e)),
9978
+ end = isPresentArray$1(params) ? getLast(params).loc : path.loc;
10301
9979
  // if there is no hash, position it as a collapsed node immediately after the last param (or the
10302
9980
  // path, if there are also no params)
10303
9981
  return {
@@ -10330,14 +10008,28 @@ var define, require;
10330
10008
  });
10331
10009
  element.modifiers.push(modifier);
10332
10010
  }
10011
+ function repairBlock(source, block, fallbackStart) {
10012
+ // Extend till the beginning of the block
10013
+ if (!block.program.loc) {
10014
+ const start = block.program.body.at(0),
10015
+ end = block.program.body.at(-1);
10016
+ if (start && end) block.program.loc = {
10017
+ ...start.loc,
10018
+ end: end.loc.end
10019
+ };else {
10020
+ const loc = source.spanFor(block.loc);
10021
+ block.program.loc = fallbackStart.withEnd(loc.getEnd());
10022
+ }
10023
+ }
10024
+ let endProgram = source.spanFor(block.program.loc).getEnd();
10025
+ return block.inverse && !block.inverse.loc && (block.inverse.loc = endProgram.collapsed()), block;
10026
+ }
10333
10027
 
10334
10028
  // vendored from simple-html-tokenizer because it's unexported
10335
10029
  function isSpace(char) {
10336
10030
  return /[\t\n\f ]/u.test(char);
10337
10031
  }
10338
10032
  class TokenizerEventHandlers extends HandlebarsNodeVisitors {
10339
- tagOpenLine = 0;
10340
- tagOpenColumn = 0;
10341
10033
  reset() {
10342
10034
  this.currentNode = null;
10343
10035
  }
@@ -10402,18 +10094,16 @@ var define, require;
10402
10094
  end: this.offset().toJSON()
10403
10095
  }));
10404
10096
  (voidMap.has(tag.name) || tag.selfClosing) && this.finishEndTag(!0);
10405
- } else "EndTag" === tag.type && this.finishEndTag(!1);
10097
+ } else tag.type, tag.type, this.finishEndTag(!1);
10406
10098
  }
10407
10099
  finishStartTag() {
10408
10100
  let {
10409
- name: name,
10410
- nameStart: nameStart,
10411
- nameEnd: nameEnd
10412
- } = this.currentStartTag;
10413
- // <> should probably be a syntax error, but s-h-t is currently broken for that case
10414
- debugAssert("" !== name, "tag name cannot be empty"), debugAssert(null !== nameStart, "nameStart unexpectedly null"), debugAssert(null !== nameEnd, "nameEnd unexpectedly null");
10415
- let nameLoc = nameStart.until(nameEnd),
10416
- [head, ...tail] = asPresentArray(name.split(".")),
10101
+ name: name,
10102
+ nameStart: nameStart,
10103
+ nameEnd: nameEnd
10104
+ } = this.currentStartTag,
10105
+ nameLoc = nameStart.until(nameEnd),
10106
+ [head, ...tail] = name.split("."),
10417
10107
  path = b.path({
10418
10108
  head: b.head({
10419
10109
  original: head,
@@ -10454,7 +10144,7 @@ var define, require;
10454
10144
  element = this.elementStack.pop();
10455
10145
  this.validateEndTag(tag, element, isVoid);
10456
10146
  let parent = this.currentElement();
10457
- isVoid ? element.closeTag = null : element.selfClosing ? debugAssert(null === element.closeTag, "element.closeTag unexpectedly present") : element.closeTag = closeTagStart.until(this.offset()), element.loc = element.loc.withEnd(this.offset()), appendChild(parent, b.element(element));
10147
+ isVoid ? element.closeTag = null : element.selfClosing ? element.closeTag : element.closeTag = closeTagStart.until(this.offset()), element.loc = element.loc.withEnd(this.offset()), appendChild(parent, b.element(element));
10458
10148
  }
10459
10149
  markTagAsSelfClosing() {
10460
10150
  let tag = this.currentTag;
@@ -10469,7 +10159,7 @@ var define, require;
10469
10159
  let tag = this.currentTag;
10470
10160
  if (tag.name += char, "StartTag" === tag.type) {
10471
10161
  let offset = this.offset();
10472
- null === tag.nameStart && (debugAssert(null === tag.nameEnd, "nameStart and nameEnd must both be null"),
10162
+ null === tag.nameStart && (tag.nameEnd,
10473
10163
  // Note that the tokenizer already consumed the token here
10474
10164
  tag.nameStart = offset.move(-1)), tag.nameEnd = offset;
10475
10165
  }
@@ -10543,7 +10233,7 @@ var define, require;
10543
10233
  parsePossibleBlockParams() {
10544
10234
  // const enums that we can't use directly
10545
10235
  const ID_INVERSE_PATTERN = /[!"#%&'()*+./;<=>@[\\\]^`{|}~]/u;
10546
- debugAssert("attributeName" === this.tokenizer.state, "must be in TokenizerState.attributeName");
10236
+ this.tokenizer.state;
10547
10237
  const element = this.currentStartTag,
10548
10238
  as = this.currentAttr;
10549
10239
  let state = {
@@ -10551,7 +10241,7 @@ var define, require;
10551
10241
  };
10552
10242
  const handlers = {
10553
10243
  PossibleAs: next => {
10554
- if (debugAssert("PossibleAs" === state.state, "bug in block params parser"), isSpace(next))
10244
+ if (state.state, isSpace(next))
10555
10245
  // " as ..."
10556
10246
  state = {
10557
10247
  state: "BeforeStartPipe"
@@ -10568,7 +10258,7 @@ var define, require;
10568
10258
  }
10569
10259
  },
10570
10260
  BeforeStartPipe: next => {
10571
- debugAssert("BeforeStartPipe" === state.state, "bug in block params parser"), isSpace(next) ? this.tokenizer.consume() : "|" === next ? (state = {
10261
+ state.state, isSpace(next) ? this.tokenizer.consume() : "|" === next ? (state = {
10572
10262
  state: "BeforeBlockParamName"
10573
10263
  }, this.tokenizer.transitionTo("beforeAttributeName"), this.tokenizer.consume()) :
10574
10264
  // " as {{...", " as bs...", " as =...", " as ...", " as/>..."
@@ -10578,7 +10268,7 @@ var define, require;
10578
10268
  };
10579
10269
  },
10580
10270
  BeforeBlockParamName: next => {
10581
- if (debugAssert("BeforeBlockParamName" === state.state, "bug in block params parser"), isSpace(next)) this.tokenizer.consume();else if ("" === next)
10271
+ if (state.state, isSpace(next)) this.tokenizer.consume();else if ("" === next)
10582
10272
  // The HTML tokenizer ran out of characters, so we are either
10583
10273
  // encountering mustache or <EOF>
10584
10274
  state = {
@@ -10608,7 +10298,7 @@ var define, require;
10608
10298
  }
10609
10299
  },
10610
10300
  BlockParamName: next => {
10611
- if (debugAssert("BlockParamName" === state.state, "bug in block params parser"), "" === next)
10301
+ if (state.state, "" === next)
10612
10302
  // The HTML tokenizer ran out of characters, so we are either
10613
10303
  // encountering mustache or <EOF>, HBS side will attach the error
10614
10304
  // to the next span
@@ -10639,7 +10329,7 @@ var define, require;
10639
10329
  }
10640
10330
  },
10641
10331
  AfterEndPipe: next => {
10642
- debugAssert("AfterEndPipe" === state.state, "bug in block params parser"), isSpace(next) ? this.tokenizer.consume() : "" === next ? (
10332
+ state.state, isSpace(next) ? this.tokenizer.consume() : "" === next ? (
10643
10333
  // The HTML tokenizer ran out of characters, so we are either
10644
10334
  // encountering mustache or <EOF>, HBS side will attach the error
10645
10335
  // to the next span
@@ -10665,26 +10355,22 @@ var define, require;
10665
10355
  }, this.tokenizer.consume());
10666
10356
  },
10667
10357
  Error: next => {
10668
- if (debugAssert("Error" === state.state, "bug in block params parser"), "" === next || "/" === next || ">" === next || isSpace(next)) throw generateSyntaxError(state.message, state.start.until(this.offset()));
10358
+ if (state.state, "" === next || "/" === next || ">" === next || isSpace(next)) throw generateSyntaxError(state.message, state.start.until(this.offset()));
10669
10359
  // Slurp up the next "token" for the error span
10670
10360
  this.tokenizer.consume();
10671
10361
  },
10672
- Done: () => {
10673
- debugAssert(!1, "This should never be called");
10674
- }
10362
+ Done: () => {}
10675
10363
  };
10676
10364
  let next;
10677
10365
  do {
10678
10366
  next = this.tokenizer.peek(), handlers[state.state](next);
10679
10367
  } while ("Done" !== state.state && "" !== next);
10680
- debugAssert("Done" === state.state, "bug in block params parser");
10368
+ state.state;
10681
10369
  }
10682
10370
  reportSyntaxError(message) {
10683
10371
  throw generateSyntaxError(message, this.offset().collapsed());
10684
10372
  }
10685
10373
  assembleConcatenatedValue(parts) {
10686
- for (const part of parts) if ("MustacheStatement" !== part.type && "TextNode" !== part.type) throw generateSyntaxError(`Unsupported node in quoted attribute value: ${part.type}`, part.loc);
10687
- assertPresentArray(parts, "the concatenation parts of an element should not be empty");
10688
10374
  let first = getFirst(parts),
10689
10375
  last = getLast(parts);
10690
10376
  return b.concat({
@@ -10698,30 +10384,27 @@ var define, require;
10698
10384
  // <input> or <br />, so we need to check for that here. Otherwise, we would
10699
10385
  // throw an error for those cases.
10700
10386
  throw generateSyntaxError(`<${tag.name}> elements do not need end tags. You should remove it`, tag.loc);
10701
- if (void 0 === element.tag) throw generateSyntaxError(`Closing tag </${tag.name}> without an open tag`, tag.loc);
10387
+ if ("ElementNode" !== element.type) throw generateSyntaxError(`Closing tag </${tag.name}> without an open tag`, tag.loc);
10702
10388
  if (element.tag !== tag.name) throw generateSyntaxError(`Closing tag </${tag.name}> did not match last open tag <${element.tag}> (on line ${element.loc.startPosition.line})`, tag.loc);
10703
10389
  }
10704
10390
  assembleAttributeValue(parts, isQuoted, isDynamic, span) {
10705
10391
  if (isDynamic) {
10706
10392
  if (isQuoted) return this.assembleConcatenatedValue(parts);
10707
10393
  {
10708
- assertPresentArray(parts);
10709
10394
  const [head, a] = parts;
10710
10395
  if (void 0 === a || "TextNode" === a.type && "/" === a.chars) return head;
10711
10396
  throw generateSyntaxError("An unquoted attribute value must be a string or a mustache, preceded by whitespace or a '=' character, and followed by whitespace, a '>' character, or '/>'", span);
10712
10397
  }
10713
10398
  }
10714
- return isPresentArray(parts) ? parts[0] : b.text({
10399
+ return isPresentArray$1(parts) ? parts[0] : b.text({
10715
10400
  chars: "",
10716
10401
  loc: span
10717
10402
  });
10718
10403
  }
10404
+ constructor(...args) {
10405
+ super(...args), this.tagOpenLine = 0, this.tagOpenColumn = 0;
10406
+ }
10719
10407
  }
10720
-
10721
- /**
10722
- ASTPlugins can make changes to the Glimmer template AST before
10723
- compilation begins.
10724
- */
10725
10408
  const syntax = {
10726
10409
  parse: preprocess,
10727
10410
  builders: publicBuilder,
@@ -10749,7 +10432,7 @@ var define, require;
10749
10432
  end: offsets.endPosition
10750
10433
  };
10751
10434
  let template = new TokenizerEventHandlers(source, entityParser, mode).parse(ast, options.locals ?? []);
10752
- if (options?.plugins?.ast) for (const transform of options.plugins.ast) traverse(template, transform(assign({}, options, {
10435
+ if (options.plugins?.ast) for (const transform of options.plugins.ast) traverse(template, transform(assign({}, options, {
10753
10436
  syntax: syntax
10754
10437
  }, {
10755
10438
  plugins: void 0
@@ -10764,7 +10447,7 @@ var define, require;
10764
10447
  * Adds tokens to the tokensSet based on their node.type
10765
10448
  */
10766
10449
  function addTokens(tokensSet, node, scopedTokens, options) {
10767
- const maybeTokens = function (node, scopedTokens, options) {
10450
+ const maybePathName = function (node, scopedTokens, options) {
10768
10451
  if ("PathExpression" === node.type) {
10769
10452
  if ("AtHead" === node.head.type || "ThisHead" === node.head.type) return;
10770
10453
  const possbleToken = node.head.name;
@@ -10776,6 +10459,7 @@ var define, require;
10776
10459
  char = tag.charAt(0);
10777
10460
  if (":" === char || "@" === char) return;
10778
10461
  if (!options.includeHtmlElements && -1 === tag.indexOf(".") && tag.toLowerCase() === tag) return;
10462
+ // eslint-disable-next-line @typescript-eslint/no-deprecated -- @fixme
10779
10463
  if ("this." === tag.substr(0, 5)) return;
10780
10464
  // the tag may be from a yielded object
10781
10465
  // example:
@@ -10790,12 +10474,10 @@ var define, require;
10790
10474
  return tag;
10791
10475
  }
10792
10476
  }(node, scopedTokens, options);
10793
- (Array.isArray(maybeTokens) ? maybeTokens : [maybeTokens]).forEach(maybeToken => {
10794
- if (void 0 !== maybeToken && "@" !== maybeToken[0]) {
10795
- const maybeTokenFirstSegment = maybeToken.split(".")[0];
10796
- scopedTokens.includes(maybeTokenFirstSegment) || tokensSet.add(maybeToken.split(".")[0]);
10797
- }
10798
- });
10477
+ if (void 0 !== maybePathName && "@" !== maybePathName[0]) {
10478
+ const maybeFirstPathSegment = maybePathName.split(".")[0];
10479
+ maybeFirstPathSegment && !scopedTokens.includes(maybeFirstPathSegment) && tokensSet.add(maybeFirstPathSegment);
10480
+ }
10799
10481
  }
10800
10482
 
10801
10483
  /**
@@ -10838,51 +10520,21 @@ var define, require;
10838
10520
  }) {
10839
10521
  blockParams.forEach(() => {
10840
10522
  scopedTokens.pop();
10841
- });
10842
- }
10843
- },
10844
- PathExpression(node) {
10845
- addTokens(tokensSet, node, scopedTokens, options);
10846
- }
10847
- });
10848
- let tokens = [];
10849
- return tokensSet.forEach(s => tokens.push(s)), options?.includeKeywords || (tokens = tokens.filter(token => !isKeyword(token))), tokens;
10850
- }
10851
-
10852
- /**
10853
- * This is a convenience function for creating ASTv2 nodes, with an optional name and the node's
10854
- * options.
10855
- *
10856
- * ```ts
10857
- * export class HtmlText extends node('HtmlText').fields<{ chars: string }>() {}
10858
- * ```
10859
- *
10860
- * This creates a new ASTv2 node with the name `'HtmlText'` and one field `chars: string` (in
10861
- * addition to a `loc: SourceOffsets` field, which all nodes have).
10862
- *
10863
- * ```ts
10864
- * export class Args extends node().fields<{
10865
- * positional: PositionalArguments;
10866
- * named: NamedArguments
10867
- * }>() {}
10868
- * ```
10869
- *
10870
- * This creates a new un-named ASTv2 node with two fields (`positional: Positional` and `named:
10871
- * Named`, in addition to the generic `loc: SourceOffsets` field).
10872
- *
10873
- * Once you create a node using `node`, it is instantiated with all of its fields (including `loc`):
10874
- *
10875
- * ```ts
10876
- * new HtmlText({ loc: offsets, chars: someString });
10877
- * ```
10878
- */
10523
+ });
10524
+ }
10525
+ },
10526
+ PathExpression(node) {
10527
+ addTokens(tokensSet, node, scopedTokens, options);
10528
+ }
10529
+ });
10530
+ let tokens = [];
10531
+ return tokensSet.forEach(s => tokens.push(s)), options.includeKeywords || (tokens = tokens.filter(token => !isKeyword(token))), tokens;
10532
+ }
10879
10533
  function node(name) {
10880
10534
  if (void 0 !== name) {
10881
10535
  const type = name;
10882
10536
  return {
10883
10537
  fields: () => class {
10884
- // SAFETY: initialized via `assign` in the constructor.
10885
- type;
10886
10538
  constructor(fields) {
10887
10539
  this.type = type, assign(this, fields);
10888
10540
  }
@@ -10891,7 +10543,6 @@ var define, require;
10891
10543
  }
10892
10544
  return {
10893
10545
  fields: () => class {
10894
- // SAFETY: initialized via `assign` in the constructor.
10895
10546
  constructor(fields) {
10896
10547
  assign(this, fields);
10897
10548
  }
@@ -10996,30 +10647,11 @@ var define, require;
10996
10647
  * ```
10997
10648
  */
10998
10649
  let NamedArgument$1 = class NamedArgument {
10999
- loc;
11000
- name;
11001
- value;
11002
10650
  constructor(options) {
11003
10651
  this.loc = options.name.loc.extend(options.value.loc), this.name = options.name, this.value = options.value;
11004
10652
  }
11005
10653
  };
11006
10654
 
11007
- /**
11008
- * Attr nodes look like HTML attributes, but are classified as:
11009
- *
11010
- * 1. `HtmlAttr`, which means a regular HTML attribute in Glimmer
11011
- * 2. `SplatAttr`, which means `...attributes`
11012
- * 3. `ComponentArg`, which means an attribute whose name begins with `@`, and it is therefore a
11013
- * component argument.
11014
- */
11015
- /**
11016
- * `HtmlAttr` and `SplatAttr` are grouped together because the order of the `SplatAttr` node,
11017
- * relative to other attributes, matters.
11018
- */
11019
- /**
11020
- * "Attr Block" nodes are allowed inside an open element tag in templates. They interact with the
11021
- * element (or component).
11022
- */
11023
10655
  /**
11024
10656
  * `HtmlAttr` nodes are valid HTML attributes, with or without a value.
11025
10657
  *
@@ -11050,13 +10682,6 @@ var define, require;
11050
10682
  * An `ElementModifier` is just a normal call node in modifier position.
11051
10683
  */
11052
10684
  class ElementModifier extends node("ElementModifier").fields() {}
11053
-
11054
- /**
11055
- * Content Nodes are allowed in content positions in templates. They correspond to behavior in the
11056
- * [Data][data] tokenization state in HTML.
11057
- *
11058
- * [data]: https://html.spec.whatwg.org/multipage/parsing.html#data-state
11059
- */
11060
10685
  class GlimmerComment extends node("GlimmerComment").fields() {}
11061
10686
  class HtmlText extends node("HtmlText").fields() {}
11062
10687
  class HtmlComment extends node("HtmlComment").fields() {}
@@ -11099,11 +10724,6 @@ var define, require;
11099
10724
  }
11100
10725
  };
11101
10726
 
11102
- /**
11103
- * A Handlebars literal.
11104
- *
11105
- * {@link https://handlebarsjs.com/guide/expressions.html#literal-segments}
11106
- */
11107
10727
  /**
11108
10728
  * Corresponds to a Handlebars literal.
11109
10729
  *
@@ -11179,9 +10799,6 @@ var define, require;
11179
10799
  * Corresponds to a collection of named blocks.
11180
10800
  */
11181
10801
  let NamedBlocks$1 = class NamedBlocks extends node().fields() {
11182
- /**
11183
- * Get the `NamedBlock` for a given name.
11184
- */
11185
10802
  get(name) {
11186
10803
  return this.blocks.filter(block => block.name.chars === name)[0] || null;
11187
10804
  }
@@ -11228,18 +10845,7 @@ var define, require;
11228
10845
  */
11229
10846
  class FreeVarReference extends node("Free").fields() {}
11230
10847
 
11231
- /**
11232
- * A free variable is resolved according to a resolution rule:
11233
- *
11234
- * 1. Strict resolution
11235
- * 2. Namespaced resolution
11236
- */
11237
- /**
11238
- * Strict resolution is used:
11239
- *
11240
- * 1. in a strict mode template
11241
- * 2. in an local variable invocation with dot paths
11242
- */
10848
+ /// FreeVarNamespace ///
11243
10849
  const STRICT_RESOLUTION = {
11244
10850
  resolution: () => opcodes.GetStrictKeyword,
11245
10851
  serialize: () => "Strict",
@@ -11283,7 +10889,7 @@ var define, require;
11283
10889
  * ^ In either case, `x` should be resolved in the `component` and `helper` namespaces.
11284
10890
  */
11285
10891
  static append() {
11286
- return new LooseModeResolution([FreeVarNamespace.Component, FreeVarNamespace.Helper]);
10892
+ return new LooseModeResolution(["Component", "Helper"]);
11287
10893
  }
11288
10894
  /**
11289
10895
  * Trusting append resolution is used when the variable should be resolved only in the
@@ -11300,7 +10906,7 @@ var define, require;
11300
10906
  * ^ In either case, `x` should be resolved in the `helper` namespace.
11301
10907
  */
11302
10908
  static trustingAppend() {
11303
- return this.namespaced(FreeVarNamespace.Helper);
10909
+ return this.namespaced("Helper");
11304
10910
  }
11305
10911
  constructor(namespaces, isAngleBracket = !1) {
11306
10912
  this.namespaces = namespaces, this.isAngleBracket = isAngleBracket;
@@ -11308,11 +10914,11 @@ var define, require;
11308
10914
  resolution() {
11309
10915
  if (1 !== this.namespaces.length) return opcodes.GetFreeAsComponentOrHelperHead;
11310
10916
  switch (this.namespaces[0]) {
11311
- case FreeVarNamespace.Helper:
10917
+ case "Helper":
11312
10918
  return opcodes.GetFreeAsHelperHead;
11313
- case FreeVarNamespace.Modifier:
10919
+ case "Modifier":
11314
10920
  return opcodes.GetFreeAsModifierHead;
11315
- case FreeVarNamespace.Component:
10921
+ case "Component":
11316
10922
  return opcodes.GetFreeAsComponentHead;
11317
10923
  }
11318
10924
  }
@@ -11320,26 +10926,19 @@ var define, require;
11320
10926
  return 1 === this.namespaces.length ? this.namespaces[0] : "ComponentOrHelper";
11321
10927
  }
11322
10928
  }
11323
- let FreeVarNamespace = function (FreeVarNamespace) {
11324
- return FreeVarNamespace.Helper = "Helper", FreeVarNamespace.Modifier = "Modifier", FreeVarNamespace.Component = "Component", FreeVarNamespace;
11325
- }({});
11326
- const HELPER_NAMESPACE = FreeVarNamespace.Helper,
11327
- MODIFIER_NAMESPACE = FreeVarNamespace.Modifier,
11328
- COMPONENT_NAMESPACE = FreeVarNamespace.Component;
11329
- var api$1 = Object.freeze({
10929
+ var api = Object.freeze({
11330
10930
  __proto__: null,
11331
10931
  AppendContent: AppendContent,
11332
10932
  ArgReference: ArgReference,
11333
10933
  Args: Args$1,
11334
10934
  Block: Block,
11335
- COMPONENT_NAMESPACE: COMPONENT_NAMESPACE,
10935
+ COMPONENT_NAMESPACE: "Component",
11336
10936
  CallExpression: CallExpression$1,
11337
10937
  ComponentArg: ComponentArg,
11338
10938
  ElementModifier: ElementModifier,
11339
- FreeVarNamespace: FreeVarNamespace,
11340
10939
  FreeVarReference: FreeVarReference,
11341
10940
  GlimmerComment: GlimmerComment,
11342
- HELPER_NAMESPACE: HELPER_NAMESPACE,
10941
+ HELPER_NAMESPACE: "Helper",
11343
10942
  HTML_RESOLUTION: HTML_RESOLUTION,
11344
10943
  HtmlAttr: HtmlAttr,
11345
10944
  HtmlComment: HtmlComment,
@@ -11351,7 +10950,7 @@ var define, require;
11351
10950
  LiteralExpression: LiteralExpression,
11352
10951
  LocalVarReference: LocalVarReference,
11353
10952
  LooseModeResolution: LooseModeResolution,
11354
- MODIFIER_NAMESPACE: MODIFIER_NAMESPACE,
10953
+ MODIFIER_NAMESPACE: "Modifier",
11355
10954
  NamedArgument: NamedArgument$1,
11356
10955
  NamedArguments: NamedArguments$1,
11357
10956
  NamedBlock: NamedBlock$1,
@@ -11369,30 +10968,7 @@ var define, require;
11369
10968
  isStrictResolution: function (value) {
11370
10969
  return value === STRICT_RESOLUTION;
11371
10970
  },
11372
- loadResolution:
11373
- /**
11374
- * A `Namespaced` must be resolved in one or more namespaces.
11375
- *
11376
- * ```hbs
11377
- * <X />
11378
- * ```
11379
- *
11380
- * ^ `X` is resolved in the `component` namespace
11381
- *
11382
- * ```hbs
11383
- * (x)
11384
- * ```
11385
- *
11386
- * ^ `x` is resolved in the `helper` namespace
11387
- *
11388
- * ```hbs
11389
- * <a {{x}} />
11390
- * ```
11391
- *
11392
- * ^ `x` is resolved in the `modifier` namespace
11393
- */
11394
- // Serialization
11395
- function (resolution) {
10971
+ loadResolution: function (resolution) {
11396
10972
  return "Strict" === resolution ? STRICT_RESOLUTION : "ComponentOrHelper" === resolution ? LooseModeResolution.append() : LooseModeResolution.namespaced(resolution);
11397
10973
  },
11398
10974
  node: node
@@ -11408,15 +10984,11 @@ var define, require;
11408
10984
  }
11409
10985
  class ProgramSymbolTable extends SymbolTable {
11410
10986
  constructor(templateLocals, keywords, options) {
11411
- super(), this.templateLocals = templateLocals, this.keywords = keywords, this.options = options;
11412
- }
11413
- symbols = [];
11414
- upvars = [];
11415
- size = 1;
11416
- named = dict();
11417
- blocks = dict();
11418
- usedTemplateLocals = [];
11419
- #hasDebugger = !1;
10987
+ super(), this.templateLocals = templateLocals, this.keywords = keywords, this.options = options, this.symbols = [], this.upvars = [], this.size = 1, this.named = dict(), this.blocks = dict(), this.usedTemplateLocals = [];
10988
+ }
10989
+ root() {
10990
+ return this;
10991
+ }
11420
10992
  hasLexical(name) {
11421
10993
  return this.options.lexicalScope(name);
11422
10994
  }
@@ -11429,12 +11001,6 @@ var define, require;
11429
11001
  getUsedTemplateLocals() {
11430
11002
  return this.usedTemplateLocals;
11431
11003
  }
11432
- setHasDebugger() {
11433
- this.#hasDebugger = !0;
11434
- }
11435
- get hasEval() {
11436
- return this.#hasDebugger;
11437
- }
11438
11004
  has(name) {
11439
11005
  return this.templateLocals.includes(name);
11440
11006
  }
@@ -11446,7 +11012,7 @@ var define, require;
11446
11012
  return dict();
11447
11013
  }
11448
11014
  getDebugInfo() {
11449
- return Object.values(this.getLocalsMap());
11015
+ return [this.getLocalsMap(), this.named];
11450
11016
  }
11451
11017
  allocateFree(name, resolution) {
11452
11018
  // If the name in question is an uppercase (i.e. angle-bracket) component invocation, run
@@ -11472,6 +11038,9 @@ var define, require;
11472
11038
  constructor(parent, symbols, slots) {
11473
11039
  super(), this.parent = parent, this.symbols = symbols, this.slots = slots;
11474
11040
  }
11041
+ root() {
11042
+ return this.parent.root();
11043
+ }
11475
11044
  get locals() {
11476
11045
  return this.symbols;
11477
11046
  }
@@ -11493,17 +11062,19 @@ var define, require;
11493
11062
  }
11494
11063
  #get(name) {
11495
11064
  let slot = this.symbols.indexOf(name);
11496
- return -1 === slot ? null : unwrap(this.slots[slot]);
11065
+ return -1 === slot ? null : this.slots[slot];
11497
11066
  }
11498
11067
  getLocalsMap() {
11499
11068
  let dict = this.parent.getLocalsMap();
11500
11069
  return this.symbols.forEach(symbol => dict[symbol] = this.get(symbol)[0]), dict;
11501
11070
  }
11502
11071
  getDebugInfo() {
11503
- return Object.values(this.getLocalsMap());
11504
- }
11505
- setHasDebugger() {
11506
- this.parent.setHasDebugger();
11072
+ const locals = this.getLocalsMap(),
11073
+ root = this.root();
11074
+ return [{
11075
+ ...locals,
11076
+ ...root.named
11077
+ }, Object.fromEntries(root.upvars.map((s, i) => [s, i]))];
11507
11078
  }
11508
11079
  allocateFree(name, resolution) {
11509
11080
  return this.parent.allocateFree(name, resolution);
@@ -11518,10 +11089,7 @@ var define, require;
11518
11089
  return this.parent.allocate(identifier);
11519
11090
  }
11520
11091
  }
11521
- var api = Object.freeze({
11522
- __proto__: null
11523
- });
11524
- let Builder$1 = class Builder {
11092
+ class Builder {
11525
11093
  // TEMPLATE //
11526
11094
  template(symbols, body, loc) {
11527
11095
  return new Template$1({
@@ -11639,8 +11207,7 @@ var define, require;
11639
11207
  });
11640
11208
  }
11641
11209
  at(name, symbol, loc) {
11642
- // the `@` should be included so we have a complete source range
11643
- return debugAssert("@" === name[0], "call builders.at() with a string that starts with '@'"), new ArgReference({
11210
+ return name[0], new ArgReference({
11644
11211
  loc: loc,
11645
11212
  name: new SourceSlice({
11646
11213
  loc: loc,
@@ -11655,7 +11222,7 @@ var define, require;
11655
11222
  symbol: symbol,
11656
11223
  loc: loc
11657
11224
  }) {
11658
- return debugAssert("this" !== name, "You called builders.freeVar() with 'this'. Call builders.this instead"), debugAssert("@" !== name[0], `You called builders.freeVar() with '${name}'. Call builders.at('${name}') instead`), new FreeVarReference({
11225
+ return name[0], new FreeVarReference({
11659
11226
  name: name,
11660
11227
  resolution: context,
11661
11228
  symbol: symbol,
@@ -11663,7 +11230,7 @@ var define, require;
11663
11230
  });
11664
11231
  }
11665
11232
  localVar(name, symbol, isTemplateLocal, loc) {
11666
- return debugAssert("this" !== name, "You called builders.var() with 'this'. Call builders.this instead"), debugAssert("@" !== name[0], `You called builders.var() with '${name}'. Call builders.at('${name}') instead`), new LocalVarReference({
11233
+ return name[0], new LocalVarReference({
11667
11234
  loc: loc,
11668
11235
  name: name,
11669
11236
  isTemplateLocal: isTemplateLocal,
@@ -11678,7 +11245,7 @@ var define, require;
11678
11245
  });
11679
11246
  }
11680
11247
  interpolate(parts, loc) {
11681
- return assertPresentArray(parts), new InterpolateExpression$1({
11248
+ return new InterpolateExpression$1({
11682
11249
  loc: loc,
11683
11250
  parts: parts
11684
11251
  });
@@ -11735,11 +11302,10 @@ var define, require;
11735
11302
  element(options) {
11736
11303
  return new BuildElement(options);
11737
11304
  }
11738
- };
11305
+ }
11739
11306
  class BuildElement {
11740
- builder;
11741
11307
  constructor(base) {
11742
- this.base = base, this.builder = new Builder$1();
11308
+ this.base = base, this.builder = new Builder();
11743
11309
  }
11744
11310
  simple(tag, body, loc) {
11745
11311
  return new SimpleElement$1(assign({
@@ -11790,16 +11356,16 @@ var define, require;
11790
11356
  }
11791
11357
  }
11792
11358
  function SexpSyntaxContext(node) {
11793
- return isSimpleCallee(node) ? LooseModeResolution.namespaced(HELPER_NAMESPACE) : null;
11359
+ return isSimpleCallee(node) ? LooseModeResolution.namespaced("Helper") : null;
11794
11360
  }
11795
11361
  function ModifierSyntaxContext(node) {
11796
- return isSimpleCallee(node) ? LooseModeResolution.namespaced(MODIFIER_NAMESPACE) : null;
11362
+ return isSimpleCallee(node) ? LooseModeResolution.namespaced("Modifier") : null;
11797
11363
  }
11798
11364
  function BlockSyntaxContext(node) {
11799
- return isSimpleCallee(node) ? LooseModeResolution.namespaced(COMPONENT_NAMESPACE) : null;
11365
+ return isSimpleCallee(node) ? LooseModeResolution.namespaced("Component") : null;
11800
11366
  }
11801
11367
  function ComponentSyntaxContext(node) {
11802
- return isSimplePath(node) ? LooseModeResolution.namespaced(COMPONENT_NAMESPACE, !0) : null;
11368
+ return isSimplePath(node) ? LooseModeResolution.namespaced("Component", !0) : null;
11803
11369
  }
11804
11370
 
11805
11371
  /**
@@ -11807,7 +11373,7 @@ var define, require;
11807
11373
  * In strict mode, this also corresponds to arg curlies.
11808
11374
  */
11809
11375
  function AttrValueSyntaxContext(node) {
11810
- return isSimpleCallee(node) ? LooseModeResolution.namespaced(HELPER_NAMESPACE) : null;
11376
+ return isSimpleCallee(node) ? LooseModeResolution.namespaced("Helper") : null;
11811
11377
  }
11812
11378
 
11813
11379
  /**
@@ -11883,9 +11449,8 @@ var define, require;
11883
11449
  * `BlockContext` is stateless.
11884
11450
  */
11885
11451
  class BlockContext {
11886
- builder;
11887
11452
  constructor(source, options, table) {
11888
- this.source = source, this.options = options, this.table = table, this.builder = new Builder$1();
11453
+ this.source = source, this.options = options, this.table = table, this.builder = new Builder();
11889
11454
  }
11890
11455
  get strict() {
11891
11456
  return this.options.strictMode || !1;
@@ -11940,12 +11505,6 @@ var define, require;
11940
11505
  constructor(block) {
11941
11506
  this.block = block;
11942
11507
  }
11943
- /**
11944
- * The `normalize` method takes an arbitrary expression and its original syntax context and
11945
- * normalizes it to an ASTv2 expression.
11946
- *
11947
- * @see {SyntaxContext}
11948
- */
11949
11508
  normalize(expr, resolution) {
11950
11509
  switch (expr.type) {
11951
11510
  case "NullLiteral":
@@ -11955,7 +11514,7 @@ var define, require;
11955
11514
  case "UndefinedLiteral":
11956
11515
  return this.block.builder.literal(expr.value, this.block.loc(expr.loc));
11957
11516
  case "PathExpression":
11958
- return debugAssert(resolution, "[BUG] resolution is required"), this.path(expr, resolution);
11517
+ return this.path(expr, resolution);
11959
11518
  case "SubExpression":
11960
11519
  {
11961
11520
  // expr.path used to incorrectly have the type ASTv1.Expression
@@ -12041,6 +11600,10 @@ var define, require;
12041
11600
  offsets = block.loc(head.loc);
12042
11601
  switch (head.type) {
12043
11602
  case "ThisHead":
11603
+ if (block.hasBinding("this")) {
11604
+ let [symbol, isRoot] = table.get("this");
11605
+ return block.builder.localVar("this", symbol, isRoot, offsets);
11606
+ }
12044
11607
  return builder.self(offsets);
12045
11608
  case "AtHead":
12046
11609
  {
@@ -12205,7 +11768,7 @@ var define, require;
12205
11768
  comments: comments
12206
11769
  } = element,
12207
11770
  loc = this.ctx.loc(element.loc),
12208
- [tagHead, ...rest] = asPresentArray(tag.split(".")),
11771
+ [tagHead, ...rest] = tag.split("."),
12209
11772
  path = this.classifyTag(tagHead, rest, element.loc),
12210
11773
  attrs = element.attributes.filter(a => "@" !== a.name[0]).map(a => this.attr(a)),
12211
11774
  args = element.attributes.filter(a => "@" === a.name[0]).map(a => this.arg(a)),
@@ -12298,7 +11861,7 @@ var define, require;
12298
11861
  return this.attrPart(part);
12299
11862
  }
12300
11863
  attr(m) {
12301
- if (debugAssert("@" !== m.name[0], "An attr name must not start with `@`"), "...attributes" === m.name) return this.ctx.builder.splatAttr(this.ctx.table.allocateBlock("attrs"), this.ctx.loc(m.loc));
11864
+ if (m.name[0], "...attributes" === m.name) return this.ctx.builder.splatAttr(this.ctx.table.allocateBlock("attrs"), this.ctx.loc(m.loc));
12302
11865
  let offsets = this.ctx.loc(m.loc),
12303
11866
  nameSlice = offsets.sliceStartChars({
12304
11867
  chars: m.name.length
@@ -12327,7 +11890,7 @@ var define, require;
12327
11890
  if ("error" === resolution.result && "has-block" !== resolution.path) throw generateSyntaxError(`You attempted to pass a path as argument (\`${arg.name}={{${resolution.path}}}\`) but ${resolution.head} was not in scope. Try:\n* \`${arg.name}={{this.${resolution.path}}}\` if this is meant to be a property lookup, or\n* \`${arg.name}={{(${resolution.path})}}\` if this is meant to invoke the resolved helper, or\n* \`${arg.name}={{helper "${resolution.path}"}}\` if this is meant to pass the resolved helper by value`, arg.loc);
12328
11891
  }
12329
11892
  arg(arg) {
12330
- debugAssert("@" === arg.name[0], "An arg name must start with `@`"), this.checkArgCall(arg);
11893
+ arg.name[0], this.checkArgCall(arg);
12331
11894
  let offsets = this.ctx.loc(arg.loc),
12332
11895
  nameSlice = offsets.sliceStartChars({
12333
11896
  chars: arg.name.length
@@ -12399,9 +11962,6 @@ var define, require;
12399
11962
  }
12400
11963
  }
12401
11964
  class Children {
12402
- namedBlocks;
12403
- hasSemanticContent;
12404
- nonBlockChildren;
12405
11965
  constructor(loc, children, block) {
12406
11966
  this.loc = loc, this.children = children, this.block = block, this.namedBlocks = children.filter(c => c instanceof NamedBlock$1), this.hasSemanticContent = Boolean(children.filter(c => {
12407
11967
  if (c instanceof NamedBlock$1) return !1;
@@ -12419,13 +11979,13 @@ var define, require;
12419
11979
  }
12420
11980
  class TemplateChildren extends Children {
12421
11981
  assertTemplate(table) {
12422
- if (isPresentArray(this.namedBlocks)) throw generateSyntaxError("Unexpected named block at the top-level of a template", this.loc);
11982
+ if (isPresentArray$1(this.namedBlocks)) throw generateSyntaxError("Unexpected named block at the top-level of a template", this.loc);
12423
11983
  return this.block.builder.template(table, this.nonBlockChildren, this.block.loc(this.loc));
12424
11984
  }
12425
11985
  }
12426
11986
  class BlockChildren extends Children {
12427
11987
  assertBlock(table) {
12428
- if (isPresentArray(this.namedBlocks)) throw generateSyntaxError("Unexpected named block nested in a normal block", this.loc);
11988
+ if (isPresentArray$1(this.namedBlocks)) throw generateSyntaxError("Unexpected named block nested in a normal block", this.loc);
12429
11989
  return this.block.builder.block(table, this.nonBlockChildren, this.loc);
12430
11990
  }
12431
11991
  }
@@ -12435,7 +11995,7 @@ var define, require;
12435
11995
  }
12436
11996
  assertNamedBlock(name, table) {
12437
11997
  if (this.el.base.selfClosing) throw generateSyntaxError(`<:${name.chars}/> is not a valid named block: named blocks cannot be self-closing`, this.loc);
12438
- if (isPresentArray(this.namedBlocks)) throw generateSyntaxError(`Unexpected named block inside <:${name.chars}> named block: named blocks cannot contain nested named blocks`, this.loc);
11998
+ if (isPresentArray$1(this.namedBlocks)) throw generateSyntaxError(`Unexpected named block inside <:${name.chars}> named block: named blocks cannot contain nested named blocks`, this.loc);
12439
11999
  if ((tag = name.chars)[0] !== tag[0]?.toLowerCase() || tag[0] === tag[0]?.toUpperCase()) throw generateSyntaxError(`<:${name.chars}> is not a valid named block, and named blocks must begin with a lowercase letter`, this.loc);
12440
12000
  var tag;
12441
12001
  if (this.el.base.attrs.length > 0 || this.el.base.componentArgs.length > 0 || this.el.base.modifiers.length > 0) throw generateSyntaxError(`named block <:${name.chars}> cannot have attributes, arguments, or modifiers`, this.loc);
@@ -12444,7 +12004,7 @@ var define, require;
12444
12004
  }
12445
12005
  assertElement(name, hasBlockParams) {
12446
12006
  if (hasBlockParams) throw generateSyntaxError(`Unexpected block params in <${name.chars}>: simple elements cannot have block params`, this.loc);
12447
- if (isPresentArray(this.namedBlocks)) {
12007
+ if (isPresentArray$1(this.namedBlocks)) {
12448
12008
  let names = this.namedBlocks.map(b => b.name);
12449
12009
  if (1 === names.length) throw generateSyntaxError(`Unexpected named block <:foo> inside <${name.chars}> HTML element`, this.loc);
12450
12010
  {
@@ -12455,8 +12015,8 @@ var define, require;
12455
12015
  return this.el.simple(name, this.nonBlockChildren, this.loc);
12456
12016
  }
12457
12017
  assertComponent(name, table, hasBlockParams) {
12458
- if (isPresentArray(this.namedBlocks) && this.hasSemanticContent) throw generateSyntaxError(`Unexpected content inside <${name}> component invocation: when using named blocks, the tag cannot contain other content`, this.loc);
12459
- if (isPresentArray(this.namedBlocks)) {
12018
+ if (isPresentArray$1(this.namedBlocks) && this.hasSemanticContent) throw generateSyntaxError(`Unexpected content inside <${name}> component invocation: when using named blocks, the tag cannot contain other content`, this.loc);
12019
+ if (isPresentArray$1(this.namedBlocks)) {
12460
12020
  if (hasBlockParams) throw generateSyntaxError(`Unexpected block params list on <${name}> component invocation: when passing named blocks, the invocation tag cannot take block params`, this.loc);
12461
12021
  let seenNames = new Set();
12462
12022
  for (let block of this.namedBlocks) {
@@ -12498,9 +12058,7 @@ var define, require;
12498
12058
 
12499
12059
  const glimmerSyntax = /*#__PURE__*/Object.defineProperty({
12500
12060
  __proto__: null,
12501
- AST: api,
12502
- ASTv1: api,
12503
- ASTv2: api$1,
12061
+ ASTv2: api,
12504
12062
  BlockSymbolTable,
12505
12063
  KEYWORDS_TYPES,
12506
12064
  Path: Walker,
@@ -12526,242 +12084,35 @@ var define, require;
12526
12084
  preprocess,
12527
12085
  print: build,
12528
12086
  sortByLoc,
12529
- src: api$2,
12087
+ src: api$1,
12530
12088
  traverse,
12531
12089
  visitorKeys
12532
12090
  }, Symbol.toStringTag, { value: 'Module' });
12533
12091
 
12534
- const ContentType = {
12535
- Component: 0,
12536
- Helper: 1,
12537
- String: 2,
12538
- Empty: 3,
12539
- SafeString: 4,
12540
- Fragment: 5,
12541
- Node: 6,
12542
- Other: 8
12543
- },
12544
- CurriedTypes = {
12545
- Component: 0,
12546
- Helper: 1,
12547
- Modifier: 2
12548
- },
12549
- InternalComponentCapabilities = {
12550
- Empty: 0,
12551
- dynamicLayout: 1,
12552
- dynamicTag: 2,
12553
- prepareArgs: 4,
12554
- createArgs: 8,
12555
- attributeHook: 16,
12556
- elementHook: 32,
12557
- dynamicScope: 64,
12558
- createCaller: 128,
12559
- updateHook: 256,
12560
- createInstance: 512,
12561
- wrapped: 1024,
12562
- willDestroy: 2048,
12563
- hasSubOwner: 4096
12564
- },
12565
- ARG_SHIFT = 8,
12566
- MAX_SIZE = 2147483647,
12567
- TYPE_SIZE = 255,
12568
- TYPE_MASK = 255,
12569
- OPERAND_LEN_MASK = 768,
12570
- MACHINE_MASK = 1024,
12571
- MachineOp = {
12572
- PushFrame: 0,
12573
- PopFrame: 1,
12574
- InvokeVirtual: 2,
12575
- InvokeStatic: 3,
12576
- Jump: 4,
12577
- Return: 5,
12578
- ReturnTo: 6,
12579
- Size: 7
12580
- },
12581
- Op = {
12582
- Helper: 16,
12583
- SetNamedVariables: 17,
12584
- SetBlocks: 18,
12585
- SetVariable: 19,
12586
- SetBlock: 20,
12587
- GetVariable: 21,
12588
- GetProperty: 22,
12589
- GetBlock: 23,
12590
- SpreadBlock: 24,
12591
- HasBlock: 25,
12592
- HasBlockParams: 26,
12593
- Concat: 27,
12594
- Constant: 28,
12595
- ConstantReference: 29,
12596
- Primitive: 30,
12597
- PrimitiveReference: 31,
12598
- ReifyU32: 32,
12599
- Dup: 33,
12600
- Pop: 34,
12601
- Load: 35,
12602
- Fetch: 36,
12603
- RootScope: 37,
12604
- VirtualRootScope: 38,
12605
- ChildScope: 39,
12606
- PopScope: 40,
12607
- Text: 41,
12608
- Comment: 42,
12609
- AppendHTML: 43,
12610
- AppendSafeHTML: 44,
12611
- AppendDocumentFragment: 45,
12612
- AppendNode: 46,
12613
- AppendText: 47,
12614
- OpenElement: 48,
12615
- OpenDynamicElement: 49,
12616
- PushRemoteElement: 50,
12617
- StaticAttr: 51,
12618
- DynamicAttr: 52,
12619
- ComponentAttr: 53,
12620
- FlushElement: 54,
12621
- CloseElement: 55,
12622
- PopRemoteElement: 56,
12623
- Modifier: 57,
12624
- BindDynamicScope: 58,
12625
- PushDynamicScope: 59,
12626
- PopDynamicScope: 60,
12627
- CompileBlock: 61,
12628
- PushBlockScope: 62,
12629
- PushSymbolTable: 63,
12630
- InvokeYield: 64,
12631
- JumpIf: 65,
12632
- JumpUnless: 66,
12633
- JumpEq: 67,
12634
- AssertSame: 68,
12635
- Enter: 69,
12636
- Exit: 70,
12637
- ToBoolean: 71,
12638
- EnterList: 72,
12639
- ExitList: 73,
12640
- Iterate: 74,
12641
- Main: 75,
12642
- ContentType: 76,
12643
- Curry: 77,
12644
- PushComponentDefinition: 78,
12645
- PushDynamicComponentInstance: 79,
12646
- ResolveDynamicComponent: 80,
12647
- ResolveCurriedComponent: 81,
12648
- PushArgs: 82,
12649
- PushEmptyArgs: 83,
12650
- PopArgs: 84,
12651
- PrepareArgs: 85,
12652
- CaptureArgs: 86,
12653
- CreateComponent: 87,
12654
- RegisterComponentDestructor: 88,
12655
- PutComponentOperations: 89,
12656
- GetComponentSelf: 90,
12657
- GetComponentTagName: 91,
12658
- GetComponentLayout: 92,
12659
- BindEvalScope: 93,
12660
- SetupForEval: 94,
12661
- PopulateLayout: 95,
12662
- InvokeComponentLayout: 96,
12663
- BeginComponentTransaction: 97,
12664
- CommitComponentTransaction: 98,
12665
- DidCreateElement: 99,
12666
- DidRenderLayout: 100,
12667
- ResolveMaybeLocal: 102,
12668
- Debugger: 103,
12669
- Size: 104,
12670
- StaticComponentAttr: 105,
12671
- DynamicContentType: 106,
12672
- DynamicHelper: 107,
12673
- DynamicModifier: 108,
12674
- IfInline: 109,
12675
- Not: 110,
12676
- GetDynamicVar: 111,
12677
- Log: 112
12678
- };
12679
- function isMachineOp(value) {
12680
- return value >= 0 && value <= 15;
12681
- }
12682
- function isOp(value) {
12683
- return value >= 16;
12092
+ /// Builder ///
12093
+ const CURRIED_COMPONENT = 0,
12094
+ CURRIED_HELPER = 1,
12095
+ CURRIED_MODIFIER = 2,
12096
+ NS_XMLNS = "http://www.w3.org/2000/xmlns/";
12097
+ function isPresentArray(list) {
12098
+ return !!list && list.length > 0;
12684
12099
  }
12685
-
12686
- /**
12687
- * Registers
12688
- *
12689
- * For the most part, these follows MIPS naming conventions, however the
12690
- * register numbers are different.
12691
- */
12692
- // $0 or $pc (program counter): pointer into `program` for the next insturction; -1 means exit
12693
- const $pc = 0,
12694
- $ra = 1,
12695
- $fp = 2,
12696
- $sp = 3,
12697
- $s0 = 4,
12698
- $s1 = 5,
12699
- $t0 = 6,
12700
- $t1 = 7,
12701
- $v0 = 8;
12702
-
12703
- // $1 or $ra (return address): pointer into `program` for the return
12704
- let MachineRegister = function (MachineRegister) {
12705
- return MachineRegister[MachineRegister.pc = 0] = "pc", MachineRegister[MachineRegister.ra = 1] = "ra", MachineRegister[MachineRegister.fp = 2] = "fp", MachineRegister[MachineRegister.sp = 3] = "sp", MachineRegister;
12706
- }({});
12707
- function isLowLevelRegister(register) {
12708
- return register <= 3;
12100
+ function mapPresentArray(list, mapper) {
12101
+ if (null === list) return null;
12102
+ let out = [];
12103
+ for (let item of list) out.push(mapper(item));
12104
+ return out;
12709
12105
  }
12710
- let SavedRegister = function (SavedRegister) {
12711
- return SavedRegister[SavedRegister.s0 = 4] = "s0", SavedRegister[SavedRegister.s1 = 5] = "s1", SavedRegister;
12712
- }({}),
12713
- TemporaryRegister = function (TemporaryRegister) {
12714
- return TemporaryRegister[TemporaryRegister.t0 = 6] = "t0", TemporaryRegister[TemporaryRegister.t1 = 7] = "t1", TemporaryRegister;
12715
- }({});
12716
-
12717
- const glimmerVm = /*#__PURE__*/Object.defineProperty({
12718
- __proto__: null,
12719
- $fp,
12720
- $pc,
12721
- $ra,
12722
- $s0,
12723
- $s1,
12724
- $sp,
12725
- $t0,
12726
- $t1,
12727
- $v0,
12728
- ARG_SHIFT,
12729
- ContentType,
12730
- CurriedType: CurriedTypes,
12731
- CurriedTypes,
12732
- InternalComponentCapabilities,
12733
- InternalComponentCapability: InternalComponentCapabilities,
12734
- MACHINE_MASK,
12735
- MAX_SIZE,
12736
- MachineOp,
12737
- MachineRegister,
12738
- OPERAND_LEN_MASK,
12739
- Op,
12740
- SavedRegister,
12741
- TYPE_MASK,
12742
- TYPE_SIZE,
12743
- TemporaryRegister,
12744
- isLowLevelRegister,
12745
- isMachineOp,
12746
- isOp
12747
- }, Symbol.toStringTag, { value: 'Module' });
12748
-
12749
- let HeadKind = function (HeadKind) {
12750
- return HeadKind.Block = "Block", HeadKind.Call = "Call", HeadKind.Element = "Element", HeadKind.AppendPath = "AppendPath", HeadKind.AppendExpr = "AppendExpr", HeadKind.Literal = "Literal", HeadKind.Modifier = "Modifier", HeadKind.DynamicComponent = "DynamicComponent", HeadKind.Comment = "Comment", HeadKind.Splat = "Splat", HeadKind.Keyword = "Keyword", HeadKind;
12751
- }({}),
12752
- VariableKind = function (VariableKind) {
12753
- return VariableKind.Local = "Local", VariableKind.Free = "Free", VariableKind.Arg = "Arg", VariableKind.Block = "Block", VariableKind.This = "This", VariableKind;
12754
- }({});
12755
12106
  function normalizeStatement(statement) {
12756
- if (Array.isArray(statement)) return function (statement) {
12107
+ return Array.isArray(statement) ? function (statement) {
12757
12108
  if (!Array.isArray(statement)) return !1;
12758
12109
  const name = statement[0];
12759
12110
  if ("number" == typeof name) switch (name) {
12760
- case Builder.Literal:
12761
- case Builder.Get:
12762
- case Builder.Concat:
12763
- case Builder.HasBlock:
12764
- case Builder.HasBlockParams:
12111
+ case 0:
12112
+ case 5:
12113
+ case 6:
12114
+ case 7:
12115
+ case 8:
12765
12116
  return !0;
12766
12117
  default:
12767
12118
  return !1;
@@ -12786,7 +12137,7 @@ var define, require;
12786
12137
  let params = null,
12787
12138
  hash = null;
12788
12139
  return 3 === statement.length ? (params = normalizeParams(statement[1]), hash = normalizeHash(statement[2])) : 2 === statement.length && (Array.isArray(statement[1]) ? params = normalizeParams(statement[1]) : hash = normalizeHash(statement[1])), {
12789
- kind: HeadKind.Call,
12140
+ kind: "Call",
12790
12141
  head: normalizeCallHead(name),
12791
12142
  params: params,
12792
12143
  hash: hash,
@@ -12803,7 +12154,7 @@ var define, require;
12803
12154
  blockParams: blockParams
12804
12155
  } = normalizeBuilderBlockStatement(statement);
12805
12156
  return {
12806
- kind: HeadKind.Block,
12157
+ kind: "Block",
12807
12158
  head: path,
12808
12159
  params: params,
12809
12160
  hash: hash,
@@ -12821,7 +12172,7 @@ var define, require;
12821
12172
  blockParams: blockParams
12822
12173
  } = normalizeBuilderBlockStatement(statement);
12823
12174
  return {
12824
- kind: HeadKind.Keyword,
12175
+ kind: "Keyword",
12825
12176
  name: name,
12826
12177
  params: params,
12827
12178
  hash: hash,
@@ -12834,8 +12185,8 @@ var define, require;
12834
12185
  let attrs = dict(),
12835
12186
  block = [];
12836
12187
  return 3 === statement.length ? (attrs = normalizeAttrs(statement[1]), block = normalizeBlock(statement[2])) : 2 === statement.length && (Array.isArray(statement[1]) ? block = normalizeBlock(statement[1]) : attrs = normalizeAttrs(statement[1])), {
12837
- kind: HeadKind.Element,
12838
- name: expect(extractElement(name), `BUG: expected ${name} to look like a tag name`),
12188
+ kind: "Element",
12189
+ name: extractElement(name),
12839
12190
  attrs: attrs,
12840
12191
  block: block
12841
12192
  };
@@ -12845,43 +12196,41 @@ var define, require;
12845
12196
  }
12846
12197
  }(statement) : function (statement) {
12847
12198
  switch (statement[0]) {
12848
- case Builder.Literal:
12199
+ case 0:
12849
12200
  return {
12850
- kind: HeadKind.Literal,
12201
+ kind: "Literal",
12851
12202
  value: statement[1]
12852
12203
  };
12853
- case Builder.Append:
12204
+ case 2:
12854
12205
  return normalizeAppendExpression(statement[1], statement[2]);
12855
- case Builder.Modifier:
12206
+ case 3:
12856
12207
  return {
12857
- kind: HeadKind.Modifier,
12208
+ kind: "Modifier",
12858
12209
  params: normalizeParams(statement[1]),
12859
12210
  hash: normalizeHash(statement[2])
12860
12211
  };
12861
- case Builder.DynamicComponent:
12212
+ case 4:
12862
12213
  return {
12863
- kind: HeadKind.DynamicComponent,
12214
+ kind: "DynamicComponent",
12864
12215
  expr: normalizeExpression(statement[1]),
12865
12216
  hash: normalizeHash(statement[2]),
12866
12217
  block: normalizeBlock(statement[3])
12867
12218
  };
12868
- case Builder.Comment:
12219
+ case 1:
12869
12220
  return {
12870
- kind: HeadKind.Comment,
12221
+ kind: "Comment",
12871
12222
  value: statement[1]
12872
12223
  };
12873
12224
  }
12874
- }(statement);
12875
- if ("string" == typeof statement) return normalizeAppendHead(normalizeDottedPath(statement), !1);
12876
- throw assertNever(statement);
12225
+ }(statement) : "string" == typeof statement ? normalizeAppendHead(normalizeDottedPath(statement), !1) : void assertNever(statement);
12877
12226
  }
12878
12227
  function normalizeAppendHead(head, trusted) {
12879
- return head.type === ExpressionKind.GetPath ? {
12880
- kind: HeadKind.AppendPath,
12228
+ return "GetPath" === head.type ? {
12229
+ kind: "AppendPath",
12881
12230
  path: head,
12882
12231
  trusted: trusted
12883
12232
  } : {
12884
- kind: HeadKind.AppendExpr,
12233
+ kind: "AppendExpr",
12885
12234
  expr: head,
12886
12235
  trusted: trusted
12887
12236
  };
@@ -12899,13 +12248,13 @@ var define, require;
12899
12248
  function normalizePath(head, tail = []) {
12900
12249
  const pathHead = normalizePathHead(head);
12901
12250
  return isPresentArray(tail) ? {
12902
- type: ExpressionKind.GetPath,
12251
+ type: "GetPath",
12903
12252
  path: {
12904
12253
  head: pathHead,
12905
12254
  tail: tail
12906
12255
  }
12907
12256
  } : {
12908
- type: ExpressionKind.GetVar,
12257
+ type: "GetVar",
12909
12258
  variable: pathHead
12910
12259
  };
12911
12260
  }
@@ -12921,35 +12270,35 @@ var define, require;
12921
12270
  mode: "loose"
12922
12271
  };
12923
12272
  return isPresentArray(tail) ? {
12924
- type: ExpressionKind.GetPath,
12273
+ type: "GetPath",
12925
12274
  path: {
12926
12275
  head: variable,
12927
12276
  tail: tail
12928
12277
  }
12929
12278
  } : {
12930
- type: ExpressionKind.GetVar,
12279
+ type: "GetVar",
12931
12280
  variable: variable
12932
12281
  };
12933
12282
  }
12934
12283
  function normalizePathHead(whole) {
12935
12284
  let kind, name;
12936
12285
  if (/^this(?:\.|$)/u.test(whole)) return {
12937
- kind: VariableKind.This,
12286
+ kind: "This",
12938
12287
  name: whole,
12939
12288
  mode: "loose"
12940
12289
  };
12941
12290
  switch (whole[0]) {
12942
12291
  case "^":
12943
- kind = VariableKind.Free, name = whole.slice(1);
12292
+ kind = "Free", name = whole.slice(1);
12944
12293
  break;
12945
12294
  case "@":
12946
- kind = VariableKind.Arg, name = whole.slice(1);
12295
+ kind = "Arg", name = whole.slice(1);
12947
12296
  break;
12948
12297
  case "&":
12949
- kind = VariableKind.Block, name = whole.slice(1);
12298
+ kind = "Block", name = whole.slice(1);
12950
12299
  break;
12951
12300
  default:
12952
- kind = VariableKind.Local, name = whole;
12301
+ kind = "Local", name = whole;
12953
12302
  }
12954
12303
  return {
12955
12304
  kind: kind,
@@ -12966,7 +12315,7 @@ var define, require;
12966
12315
  return 2 === statement.length ? blocks = normalizeBlocks(statement[1]) : 3 === statement.length ? (Array.isArray(statement[1]) ? params = normalizeParams(statement[1]) : ({
12967
12316
  hash: hash,
12968
12317
  blockParams: blockParams
12969
- } = normalizeBlockHash(statement[1])), blocks = normalizeBlocks(statement[2])) : 4 === statement.length && (params = normalizeParams(statement[1]), ({
12318
+ } = normalizeBlockHash(statement[1])), blocks = normalizeBlocks(statement[2])) : (params = normalizeParams(statement[1]), ({
12970
12319
  hash: hash,
12971
12320
  blockParams: blockParams
12972
12321
  } = normalizeBlockHash(statement[2])), blocks = normalizeBlocks(statement[3])), {
@@ -13007,7 +12356,7 @@ var define, require;
13007
12356
  function normalizeAttrs(attrs) {
13008
12357
  return mapObject(attrs, a => {
13009
12358
  return (attr = a, "splat" === attr ? {
13010
- expr: HeadKind.Splat,
12359
+ expr: "Splat",
13011
12360
  trusted: !1
13012
12361
  } : {
13013
12362
  expr: normalizeExpression(attr),
@@ -13026,135 +12375,121 @@ var define, require;
13026
12375
  const match = /^<([\d\-a-z][\d\-A-Za-z]*)>$/u.exec(input);
13027
12376
  return match?.[1] ?? null;
13028
12377
  }
13029
- let Builder = function (Builder) {
13030
- return Builder[Builder.Literal = 0] = "Literal", Builder[Builder.Comment = 1] = "Comment", Builder[Builder.Append = 2] = "Append", Builder[Builder.Modifier = 3] = "Modifier", Builder[Builder.DynamicComponent = 4] = "DynamicComponent", Builder[Builder.Get = 5] = "Get", Builder[Builder.Concat = 6] = "Concat", Builder[Builder.HasBlock = 7] = "HasBlock", Builder[Builder.HasBlockParams = 8] = "HasBlockParams", Builder;
13031
- }({}),
13032
- ExpressionKind = function (ExpressionKind) {
13033
- return ExpressionKind.Literal = "Literal", ExpressionKind.Call = "Call", ExpressionKind.GetPath = "GetPath", ExpressionKind.GetVar = "GetVar", ExpressionKind.Concat = "Concat", ExpressionKind.HasBlock = "HasBlock", ExpressionKind.HasBlockParams = "HasBlockParams", ExpressionKind;
13034
- }({});
13035
12378
  function normalizeAppendExpression(expression, forceTrusted = !1) {
13036
12379
  if (null == expression) return {
13037
12380
  expr: {
13038
- type: ExpressionKind.Literal,
12381
+ type: "Literal",
13039
12382
  value: expression
13040
12383
  },
13041
- kind: HeadKind.AppendExpr,
12384
+ kind: "AppendExpr",
13042
12385
  trusted: !1
13043
12386
  };
13044
12387
  if (Array.isArray(expression)) switch (expression[0]) {
13045
- case Builder.Literal:
12388
+ case 0:
13046
12389
  return {
13047
12390
  expr: {
13048
- type: ExpressionKind.Literal,
12391
+ type: "Literal",
13049
12392
  value: expression[1]
13050
12393
  },
13051
- kind: HeadKind.AppendExpr,
12394
+ kind: "AppendExpr",
13052
12395
  trusted: !1
13053
12396
  };
13054
- case Builder.Get:
12397
+ case 5:
13055
12398
  return normalizeAppendHead(normalizePath(expression[1], expression[2]), forceTrusted);
13056
- case Builder.Concat:
12399
+ case 6:
13057
12400
  return {
13058
12401
  expr: {
13059
- type: ExpressionKind.Concat,
12402
+ type: "Concat",
13060
12403
  params: normalizeParams(expression.slice(1))
13061
12404
  },
13062
- kind: HeadKind.AppendExpr,
12405
+ kind: "AppendExpr",
13063
12406
  trusted: forceTrusted
13064
12407
  };
13065
- case Builder.HasBlock:
12408
+ case 7:
13066
12409
  return {
13067
12410
  expr: {
13068
- type: ExpressionKind.HasBlock,
12411
+ type: "HasBlock",
13069
12412
  name: expression[1]
13070
12413
  },
13071
- kind: HeadKind.AppendExpr,
12414
+ kind: "AppendExpr",
13072
12415
  trusted: forceTrusted
13073
12416
  };
13074
- case Builder.HasBlockParams:
12417
+ case 8:
13075
12418
  return {
13076
12419
  expr: {
13077
- type: ExpressionKind.HasBlockParams,
12420
+ type: "HasBlockParams",
13078
12421
  name: expression[1]
13079
12422
  },
13080
- kind: HeadKind.AppendExpr,
12423
+ kind: "AppendExpr",
13081
12424
  trusted: forceTrusted
13082
12425
  };
13083
12426
  default:
13084
12427
  if (isBuilderCallExpression(expression)) return {
13085
12428
  expr: normalizeCallExpression(expression),
13086
- kind: HeadKind.AppendExpr,
12429
+ kind: "AppendExpr",
13087
12430
  trusted: forceTrusted
13088
12431
  };
13089
12432
  throw new Error(`Unexpected array in expression position (wasn't a tuple expression and ${expression[0]} isn't wrapped in parens, so it isn't a call): ${JSON.stringify(expression)}`);
13090
- // BuilderCallExpression
13091
- } else {
13092
- if ("object" == typeof expression) throw assertNever(expression);
13093
- switch (typeof expression) {
13094
- case "string":
13095
- return normalizeAppendHead(normalizeDottedPath(expression), forceTrusted);
13096
- case "boolean":
13097
- case "number":
13098
- return {
13099
- expr: {
13100
- type: ExpressionKind.Literal,
13101
- value: expression
13102
- },
13103
- kind: HeadKind.AppendExpr,
13104
- trusted: !0
13105
- };
13106
- default:
13107
- throw assertNever(expression);
13108
- }
13109
- }
12433
+ } else if ("object" != typeof expression) switch (typeof expression) {
12434
+ case "string":
12435
+ return normalizeAppendHead(normalizeDottedPath(expression), forceTrusted);
12436
+ case "boolean":
12437
+ case "number":
12438
+ return {
12439
+ expr: {
12440
+ type: "Literal",
12441
+ value: expression
12442
+ },
12443
+ kind: "AppendExpr",
12444
+ trusted: !0
12445
+ };
12446
+ default:
12447
+ assertNever(expression);
12448
+ } else assertNever(expression);
13110
12449
  }
13111
12450
  function normalizeExpression(expression) {
13112
12451
  if (null == expression) return {
13113
- type: ExpressionKind.Literal,
12452
+ type: "Literal",
13114
12453
  value: expression
13115
12454
  };
13116
12455
  if (Array.isArray(expression)) switch (expression[0]) {
13117
- case Builder.Literal:
12456
+ case 0:
13118
12457
  return {
13119
- type: ExpressionKind.Literal,
12458
+ type: "Literal",
13120
12459
  value: expression[1]
13121
12460
  };
13122
- case Builder.Get:
12461
+ case 5:
13123
12462
  return normalizePath(expression[1], expression[2]);
13124
- case Builder.Concat:
12463
+ case 6:
13125
12464
  return {
13126
- type: ExpressionKind.Concat,
12465
+ type: "Concat",
13127
12466
  params: normalizeParams(expression.slice(1))
13128
12467
  };
13129
- case Builder.HasBlock:
12468
+ case 7:
13130
12469
  return {
13131
- type: ExpressionKind.HasBlock,
12470
+ type: "HasBlock",
13132
12471
  name: expression[1]
13133
12472
  };
13134
- case Builder.HasBlockParams:
12473
+ case 8:
13135
12474
  return {
13136
- type: ExpressionKind.HasBlockParams,
12475
+ type: "HasBlockParams",
13137
12476
  name: expression[1]
13138
12477
  };
13139
12478
  default:
13140
12479
  if (isBuilderCallExpression(expression)) return normalizeCallExpression(expression);
13141
12480
  throw new Error(`Unexpected array in expression position (wasn't a tuple expression and ${expression[0]} isn't wrapped in parens, so it isn't a call): ${JSON.stringify(expression)}`);
13142
- // BuilderCallExpression
13143
- } else {
13144
- if ("object" == typeof expression) throw assertNever(expression);
13145
- switch (typeof expression) {
13146
- case "string":
13147
- return normalizeDottedPath(expression);
13148
- case "boolean":
13149
- case "number":
13150
- return {
13151
- type: ExpressionKind.Literal,
13152
- value: expression
13153
- };
13154
- default:
13155
- throw assertNever(expression);
13156
- }
13157
- }
12481
+ } else if ("object" != typeof expression) switch (typeof expression) {
12482
+ case "string":
12483
+ return normalizeDottedPath(expression);
12484
+ case "boolean":
12485
+ case "number":
12486
+ return {
12487
+ type: "Literal",
12488
+ value: expression
12489
+ };
12490
+ default:
12491
+ assertNever(expression);
12492
+ } else assertNever(expression);
13158
12493
  }
13159
12494
  function isBuilderCallExpression(value) {
13160
12495
  return "string" == typeof value[0] && "(" === value[0][0];
@@ -13169,26 +12504,26 @@ var define, require;
13169
12504
  switch (expr.length) {
13170
12505
  case 1:
13171
12506
  return {
13172
- type: ExpressionKind.Call,
12507
+ type: "Call",
13173
12508
  head: normalizeCallHead(expr[0]),
13174
12509
  params: null,
13175
12510
  hash: null
13176
12511
  };
13177
12512
  case 2:
13178
12513
  return Array.isArray(expr[1]) ? {
13179
- type: ExpressionKind.Call,
12514
+ type: "Call",
13180
12515
  head: normalizeCallHead(expr[0]),
13181
12516
  params: normalizeParams(expr[1]),
13182
12517
  hash: null
13183
12518
  } : {
13184
- type: ExpressionKind.Call,
12519
+ type: "Call",
13185
12520
  head: normalizeCallHead(expr[0]),
13186
12521
  params: null,
13187
12522
  hash: normalizeHash(expr[1])
13188
12523
  };
13189
12524
  case 3:
13190
12525
  return {
13191
- type: ExpressionKind.Call,
12526
+ type: "Call",
13192
12527
  head: normalizeCallHead(expr[0]),
13193
12528
  params: normalizeParams(expr[1]),
13194
12529
  hash: normalizeHash(expr[2])
@@ -13196,9 +12531,6 @@ var define, require;
13196
12531
  }
13197
12532
  }
13198
12533
  class ProgramSymbols {
13199
- _freeVariables = [];
13200
- _symbols = ["this"];
13201
- top = this;
13202
12534
  toSymbols() {
13203
12535
  return this._symbols.slice(1);
13204
12536
  }
@@ -13230,11 +12562,13 @@ var define, require;
13230
12562
  child(locals) {
13231
12563
  return new LocalSymbols(this, locals);
13232
12564
  }
12565
+ constructor() {
12566
+ this._freeVariables = [], this._symbols = ["this"], this.top = this;
12567
+ }
13233
12568
  }
13234
12569
  class LocalSymbols {
13235
- locals = dict();
13236
12570
  constructor(parent, locals) {
13237
- this.parent = parent;
12571
+ this.parent = parent, this.locals = dict();
13238
12572
  for (let local of locals) this.locals[local] = parent.top.symbol(local);
13239
12573
  }
13240
12574
  get paramSymbols() {
@@ -13282,11 +12616,11 @@ var define, require;
13282
12616
  }
13283
12617
  function buildStatement(normalized, symbols = new ProgramSymbols()) {
13284
12618
  switch (normalized.kind) {
13285
- case HeadKind.AppendPath:
12619
+ case "AppendPath":
13286
12620
  return [[normalized.trusted ? opcodes.TrustingAppend : opcodes.Append, buildGetPath(normalized.path, symbols)]];
13287
- case HeadKind.AppendExpr:
12621
+ case "AppendExpr":
13288
12622
  return [[normalized.trusted ? opcodes.TrustingAppend : opcodes.Append, buildExpression(normalized.expr, normalized.trusted ? "TrustedAppend" : "Append", symbols)]];
13289
- case HeadKind.Call:
12623
+ case "Call":
13290
12624
  {
13291
12625
  let {
13292
12626
  head: path,
@@ -13299,11 +12633,11 @@ var define, require;
13299
12633
  builtExpr = buildCallHead(path, trusted ? resolution.ResolveAsHelperHead : resolution.ResolveAsComponentOrHelperHead, symbols);
13300
12634
  return [[trusted ? opcodes.TrustingAppend : opcodes.Append, [opcodes.Call, builtExpr, builtParams, builtHash]]];
13301
12635
  }
13302
- case HeadKind.Literal:
12636
+ case "Literal":
13303
12637
  return [[opcodes.Append, normalized.value]];
13304
- case HeadKind.Comment:
12638
+ case "Comment":
13305
12639
  return [[opcodes.Comment, normalized.value]];
13306
- case HeadKind.Block:
12640
+ case "Block":
13307
12641
  {
13308
12642
  let blocks = function (blocks, blockParams, parent) {
13309
12643
  let keys = [],
@@ -13319,9 +12653,9 @@ var define, require;
13319
12653
  path = buildCallHead(normalized.head, resolution.ResolveAsComponentHead, symbols);
13320
12654
  return [[opcodes.Block, path, params, hash, blocks]];
13321
12655
  }
13322
- case HeadKind.Keyword:
12656
+ case "Keyword":
13323
12657
  return [buildKeyword(normalized, symbols)];
13324
- case HeadKind.Element:
12658
+ case "Element":
13325
12659
  return function ({
13326
12660
  name: name,
13327
12661
  attrs: attrs,
@@ -13330,13 +12664,12 @@ var define, require;
13330
12664
  let out = [hasSplat(attrs) ? [opcodes.OpenElementWithSplat, name] : [opcodes.OpenElement, name]];
13331
12665
  if (attrs) {
13332
12666
  let {
13333
- params: params,
13334
- args: args
12667
+ params: params
13335
12668
  } = function (attrs, symbols) {
13336
12669
  let params = [],
13337
12670
  keys = [],
13338
12671
  values = [];
13339
- for (const [key, value] of Object.entries(attrs)) value === HeadKind.Splat ? params.push([opcodes.AttrSplat, symbols.block("&attrs")]) : "@" === key[0] ? (keys.push(key), values.push(buildExpression(value, "Strict", symbols))) : params.push(...buildAttributeValue(key, value,
12672
+ for (const [key, value] of Object.entries(attrs)) "Splat" === value ? params.push([opcodes.AttrSplat, symbols.block("&attrs")]) : "@" === key[0] ? (keys.push(key), values.push(buildExpression(value, "Strict", symbols))) : params.push(...buildAttributeValue(key, value,
13340
12673
  // TODO: extract namespace from key
13341
12674
  extractNamespace(key), symbols));
13342
12675
  return {
@@ -13344,26 +12677,27 @@ var define, require;
13344
12677
  args: isPresentArray(keys) && isPresentArray(values) ? [keys, values] : null
13345
12678
  };
13346
12679
  }(attrs, symbols);
13347
- out.push(...params), debugAssert(null === args, "Can't pass args to a simple element");
12680
+ out.push(...params);
13348
12681
  }
13349
- if (out.push([opcodes.FlushElement]), Array.isArray(block)) block.forEach(s => out.push(...buildStatement(s, symbols)));else if (null !== block) throw assertNever(block);
13350
- return out.push([opcodes.CloseElement]), out;
12682
+ return out.push([opcodes.FlushElement]), Array.isArray(block) && block.forEach(s => out.push(...buildStatement(s, symbols))), out.push([opcodes.CloseElement]), out;
13351
12683
  }(normalized, symbols);
13352
- case HeadKind.Modifier:
12684
+ case "Modifier":
13353
12685
  throw unimpl("modifier");
13354
- case HeadKind.DynamicComponent:
12686
+ case "DynamicComponent":
13355
12687
  throw unimpl("dynamic component");
13356
12688
  default:
13357
- throw assertNever(normalized);
12689
+ assertNever(normalized);
13358
12690
  }
13359
12691
  }
13360
12692
  function s(arr, ...interpolated) {
13361
- let result = arr.reduce((result, string, i) => result + `${string}${interpolated[i] ? String(interpolated[i]) : ""}`, "");
13362
- return [Builder.Literal, result];
12693
+ return [0, arr.reduce(
12694
+ // eslint-disable-next-line @typescript-eslint/no-base-to-string -- @fixme
12695
+ (result, string, i) => result + `${string}${interpolated[i] ? String(interpolated[i]) : ""}`, "")];
13363
12696
  }
13364
12697
  function c(arr, ...interpolated) {
13365
- let result = arr.reduce((result, string, i) => result + `${string}${interpolated[i] ? String(interpolated[i]) : ""}`, "");
13366
- return [Builder.Comment, result];
12698
+ return [1, arr.reduce(
12699
+ // eslint-disable-next-line @typescript-eslint/no-base-to-string -- @fixme
12700
+ (result, string, i) => result + `${string}${interpolated[i] ? String(interpolated[i]) : ""}`, "")];
13367
12701
  }
13368
12702
  function unicode(charCode) {
13369
12703
  return String.fromCharCode(parseInt(charCode, 16));
@@ -13379,21 +12713,21 @@ var define, require;
13379
12713
  inverse = normalized.blocks.else ? buildBlock(normalized.blocks.else, symbols, []) : null;
13380
12714
  switch (name) {
13381
12715
  case "let":
13382
- return [opcodes.Let, expect(params, "let requires params"), block];
12716
+ return [opcodes.Let, params, block];
13383
12717
  case "if":
13384
- return [opcodes.If, expect(params, "if requires params")[0], block, inverse];
12718
+ return [opcodes.If, params[0], block, inverse];
13385
12719
  case "each":
13386
12720
  {
13387
12721
  let keyExpr = normalized.hash ? normalized.hash.key : null,
13388
12722
  key = keyExpr ? buildExpression(keyExpr, "Strict", symbols) : null;
13389
- return [opcodes.Each, expect(params, "if requires params")[0], key, block, inverse];
12723
+ return [opcodes.Each, params[0], key, block, inverse];
13390
12724
  }
13391
12725
  default:
13392
12726
  throw new Error("unimplemented keyword");
13393
12727
  }
13394
12728
  }
13395
12729
  function hasSplat(attrs) {
13396
- return null !== attrs && Object.keys(attrs).some(a => attrs[a] === HeadKind.Splat);
12730
+ return null !== attrs && Object.keys(attrs).some(a => "Splat" === attrs[a]);
13397
12731
  }
13398
12732
  function extractNamespace(name) {
13399
12733
  if ("xmlns" === name) return NS_XMLNS;
@@ -13401,16 +12735,16 @@ var define, require;
13401
12735
  if (null === match) return null;
13402
12736
  switch (match[1]) {
13403
12737
  case "xlink":
13404
- return NS_XLINK;
12738
+ return "http://www.w3.org/1999/xlink";
13405
12739
  case "xml":
13406
- return NS_XML;
12740
+ return "http://www.w3.org/XML/1998/namespace";
13407
12741
  case "xmlns":
13408
12742
  return NS_XMLNS;
13409
12743
  }
13410
12744
  return null;
13411
12745
  }
13412
12746
  function buildAttributeValue(name, value, namespace, symbols) {
13413
- if (value.type === ExpressionKind.Literal) {
12747
+ if ("Literal" === value.type) {
13414
12748
  let val = value.value;
13415
12749
  if (!1 === val) return [];
13416
12750
  if (!0 === val) return [[opcodes.StaticAttr, name, "", namespace ?? void 0]];
@@ -13433,39 +12767,37 @@ var define, require;
13433
12767
  }
13434
12768
  function buildExpression(expr, context, symbols) {
13435
12769
  switch (expr.type) {
13436
- case ExpressionKind.GetPath:
12770
+ case "GetPath":
13437
12771
  return buildGetPath(expr, symbols);
13438
- case ExpressionKind.GetVar:
12772
+ case "GetVar":
13439
12773
  return buildVar(expr.variable, varContext(context, !0), symbols);
13440
- case ExpressionKind.Concat:
12774
+ case "Concat":
13441
12775
  return [opcodes.Concat, buildConcat(expr.params, symbols)];
13442
- case ExpressionKind.Call:
12776
+ case "Call":
13443
12777
  {
13444
12778
  let builtParams = buildParams(expr.params, symbols),
13445
12779
  builtHash = buildHash(expr.hash, symbols),
13446
12780
  builtExpr = buildCallHead(expr.head, "Strict" === context ? "SubExpression" : varContext(context, !1), symbols);
13447
12781
  return [opcodes.Call, builtExpr, builtParams, builtHash];
13448
12782
  }
13449
- case ExpressionKind.HasBlock:
12783
+ case "HasBlock":
13450
12784
  return [opcodes.HasBlock, buildVar({
13451
- kind: VariableKind.Block,
13452
- name: expr.name,
13453
- mode: "loose"
12785
+ kind: "Block",
12786
+ name: expr.name
13454
12787
  }, resolution.Strict, symbols)];
13455
- case ExpressionKind.HasBlockParams:
12788
+ case "HasBlockParams":
13456
12789
  return [opcodes.HasBlockParams, buildVar({
13457
- kind: VariableKind.Block,
13458
- name: expr.name,
13459
- mode: "loose"
12790
+ kind: "Block",
12791
+ name: expr.name
13460
12792
  }, resolution.Strict, symbols)];
13461
- case ExpressionKind.Literal:
12793
+ case "Literal":
13462
12794
  return void 0 === expr.value ? [opcodes.Undefined] : expr.value;
13463
12795
  default:
13464
12796
  assertNever(expr);
13465
12797
  }
13466
12798
  }
13467
12799
  function buildCallHead(callHead, context, symbols) {
13468
- return callHead.type === ExpressionKind.GetVar ? buildVar(callHead.variable, context, symbols) : buildGetPath(callHead, symbols);
12800
+ return "GetVar" === callHead.type ? buildVar(callHead.variable, context, symbols) : buildGetPath(callHead, symbols);
13469
12801
  }
13470
12802
  function buildGetPath(head, symbols) {
13471
12803
  return buildVar(head.path.head, resolution.Strict, symbols, head.path.tail);
@@ -13473,7 +12805,7 @@ var define, require;
13473
12805
  function buildVar(head, context, symbols, path) {
13474
12806
  let sym,
13475
12807
  op = opcodes.GetSymbol;
13476
- return head.kind === VariableKind.Free ? (op = "Strict" === context ? opcodes.GetStrictKeyword : "AppendBare" === context || "AppendInvoke" === context ? opcodes.GetFreeAsComponentOrHelperHead : "TrustedAppendBare" === context || "TrustedAppendInvoke" === context || "AttrValueBare" === context || "AttrValueInvoke" === context || "SubExpression" === context ? opcodes.GetFreeAsHelperHead : function (context) {
12808
+ return "Free" === head.kind ? (op = "Strict" === context ? opcodes.GetStrictKeyword : "AppendBare" === context || "AppendInvoke" === context ? opcodes.GetFreeAsComponentOrHelperHead : "TrustedAppendBare" === context || "TrustedAppendInvoke" === context || "AttrValueBare" === context || "AttrValueInvoke" === context || "SubExpression" === context ? opcodes.GetFreeAsHelperHead : function (context) {
13477
12809
  switch (context) {
13478
12810
  case resolution.Strict:
13479
12811
  return opcodes.GetStrictKeyword;
@@ -13486,22 +12818,22 @@ var define, require;
13486
12818
  case resolution.ResolveAsComponentHead:
13487
12819
  return opcodes.GetFreeAsComponentHead;
13488
12820
  default:
13489
- return exhausted(context);
12821
+ return;
13490
12822
  }
13491
12823
  }(context), sym = symbols.freeVar(head.name)) : (op = opcodes.GetSymbol, sym = function (kind, symbols, name) {
13492
12824
  switch (kind) {
13493
- case VariableKind.Arg:
12825
+ case "Arg":
13494
12826
  return symbols.arg(name);
13495
- case VariableKind.Block:
12827
+ case "Block":
13496
12828
  return symbols.block(name);
13497
- case VariableKind.Local:
12829
+ case "Local":
13498
12830
  return symbols.local(name);
13499
- case VariableKind.This:
12831
+ case "This":
13500
12832
  return symbols.this();
13501
12833
  default:
13502
- return exhausted(kind);
12834
+ return;
13503
12835
  }
13504
- }(head.kind, symbols, head.name)), void 0 === path || 0 === path.length ? [op, sym] : (debugAssert(op !== opcodes.GetStrictKeyword, "[BUG] keyword with a path"), [op, sym, path]);
12836
+ }(head.kind, symbols, head.name)), void 0 === path || 0 === path.length ? [op, sym] : (opcodes.GetStrictKeyword, [op, sym, path]);
13505
12837
  }
13506
12838
  function buildParams(exprs, symbols) {
13507
12839
  return null !== exprs && isPresentArray(exprs) ? exprs.map(e => buildExpression(e, "Strict", symbols)) : null;
@@ -13582,7 +12914,6 @@ var define, require;
13582
12914
  }
13583
12915
  }
13584
12916
  class EmptyList {
13585
- list = [];
13586
12917
  map(_callback) {
13587
12918
  return new EmptyList();
13588
12919
  }
@@ -13600,6 +12931,9 @@ var define, require;
13600
12931
  }) {
13601
12932
  return ifEmpty();
13602
12933
  }
12934
+ constructor() {
12935
+ this.list = [];
12936
+ }
13603
12937
  }
13604
12938
 
13605
12939
  // export type OptionalList<T> = PresentList<T> | EmptyList<T>;
@@ -13618,10 +12952,8 @@ var define, require;
13618
12952
  }
13619
12953
  const Result = ResultImpl;
13620
12954
  class OkImpl extends ResultImpl {
13621
- isOk = !0;
13622
- isErr = !1;
13623
12955
  constructor(value) {
13624
- super(), this.value = value;
12956
+ super(), this.value = value, this.isOk = !0, this.isErr = !1;
13625
12957
  }
13626
12958
  expect(_message) {
13627
12959
  return this.value;
@@ -13643,10 +12975,8 @@ var define, require;
13643
12975
  }
13644
12976
  }
13645
12977
  class ErrImpl extends ResultImpl {
13646
- isOk = !1;
13647
- isErr = !0;
13648
12978
  constructor(reason) {
13649
- super(), this.reason = reason;
12979
+ super(), this.reason = reason, this.isOk = !1, this.isErr = !0;
13650
12980
  }
13651
12981
  expect(message) {
13652
12982
  throw new Error(message || "expected an Ok, got Err");
@@ -13692,9 +13022,9 @@ var define, require;
13692
13022
  }
13693
13023
  }
13694
13024
  function convertPathToCallIfKeyword(path) {
13695
- return "Path" === path.type && "Free" === path.ref.type && path.ref.name in KEYWORDS_TYPES ? new api$1.CallExpression({
13025
+ return "Path" === path.type && "Free" === path.ref.type && path.ref.name in KEYWORDS_TYPES ? new api.CallExpression({
13696
13026
  callee: path,
13697
- args: api$1.Args.empty(path.loc),
13027
+ args: api.Args.empty(path.loc),
13698
13028
  loc: path.loc
13699
13029
  }) : path;
13700
13030
  }
@@ -13731,7 +13061,7 @@ var define, require;
13731
13061
  tail: tail
13732
13062
  } = path;
13733
13063
  if (isPresentArray(tail)) {
13734
- let tailLoc = tail[0].loc.extend(getLast(tail).loc);
13064
+ let tailLoc = tail[0].loc.extend((list = tail, 0 === list.length ? void 0 : list[list.length - 1]).loc);
13735
13065
  return Ok(new PathExpression({
13736
13066
  loc: path.loc,
13737
13067
  head: ref,
@@ -13742,6 +13072,7 @@ var define, require;
13742
13072
  }));
13743
13073
  }
13744
13074
  return Ok(ref);
13075
+ var list;
13745
13076
  }
13746
13077
  VariableReference(ref) {
13747
13078
  return ref;
@@ -13800,7 +13131,6 @@ var define, require;
13800
13131
  }
13801
13132
  }();
13802
13133
  class KeywordImpl {
13803
- types;
13804
13134
  constructor(keyword, type, delegate) {
13805
13135
  this.keyword = keyword, this.delegate = delegate;
13806
13136
  let nodes = new Set();
@@ -13829,11 +13159,6 @@ var define, require;
13829
13159
  Append: ["AppendContent"],
13830
13160
  Modifier: ["ElementModifier"]
13831
13161
  };
13832
-
13833
- /**
13834
- * A "generic" keyword is something like `has-block`, which makes sense in the context
13835
- * of sub-expression or append
13836
- */
13837
13162
  function getCalleeExpression(node) {
13838
13163
  switch (node.type) {
13839
13164
  // This covers the inside of attributes and expressions, as well as the callee
@@ -13851,15 +13176,11 @@ var define, require;
13851
13176
  }
13852
13177
  }
13853
13178
  class Keywords {
13854
- _keywords = [];
13855
- _type;
13856
13179
  constructor(type) {
13857
- this._type = type;
13180
+ this._keywords = [], this._type = type;
13858
13181
  }
13859
13182
  kw(name, delegate) {
13860
- return this._keywords.push(function (keyword, type, delegate) {
13861
- return new KeywordImpl(keyword, type, delegate);
13862
- }(name, this._type, delegate)), this;
13183
+ return this._keywords.push(new KeywordImpl(name, this._type, delegate)), this;
13863
13184
  }
13864
13185
  translate(node, state) {
13865
13186
  for (let keyword of this._keywords) {
@@ -13885,7 +13206,7 @@ var define, require;
13885
13206
  case "Modifier":
13886
13207
  return `- As a modifier, as in: <div {{${name}}}></div>`;
13887
13208
  default:
13888
- return exhausted(type);
13209
+ return;
13889
13210
  }
13890
13211
  }).join("\n\n");
13891
13212
  }
@@ -14002,14 +13323,14 @@ var define, require;
14002
13323
  };
14003
13324
  }
14004
13325
  const CurriedTypeToReadableType = {
14005
- [CurriedTypes.Component]: "component",
14006
- [CurriedTypes.Helper]: "helper",
14007
- [CurriedTypes.Modifier]: "modifier"
13326
+ [CURRIED_COMPONENT]: "component",
13327
+ [CURRIED_HELPER]: "helper",
13328
+ [CURRIED_MODIFIER]: "modifier"
14008
13329
  };
14009
13330
  function assertCurryKeyword(curriedType) {
14010
13331
  return (node, state) => {
14011
13332
  let readableType = CurriedTypeToReadableType[curriedType],
14012
- stringsAllowed = curriedType === CurriedTypes.Component,
13333
+ stringsAllowed = 0 === curriedType,
14013
13334
  {
14014
13335
  args: args
14015
13336
  } = node,
@@ -14019,8 +13340,8 @@ var define, require;
14019
13340
  if (stringsAllowed && state.isStrict) return Err(generateSyntaxError(`(${readableType}) cannot resolve string values in strict mode templates`, node.loc));
14020
13341
  if (!stringsAllowed) return Err(generateSyntaxError(`(${readableType}) cannot resolve string values, you must pass a ${readableType} definition directly`, node.loc));
14021
13342
  }
14022
- return args = new api$1.Args({
14023
- positional: new api$1.PositionalArguments({
13343
+ return args = new api.Args({
13344
+ positional: new api.PositionalArguments({
14024
13345
  exprs: args.positional.exprs.slice(1),
14025
13346
  loc: args.positional.loc
14026
13347
  }),
@@ -14084,7 +13405,7 @@ var define, require;
14084
13405
  if (!positionals || positionals.isEmpty()) return Ok(SourceSlice.synthetic("default"));
14085
13406
  if (1 === positionals.exprs.length) {
14086
13407
  let positional = positionals.exprs[0];
14087
- return api$1.isLiteral(positional, "string") ? Ok(positional.toSlice()) : Err(generateSyntaxError(`(${type}) can only receive a string literal as its first argument`, call.loc));
13408
+ return api.isLiteral(positional, "string") ? Ok(positional.toSlice()) : Err(generateSyntaxError(`(${type}) can only receive a string literal as its first argument`, call.loc));
14088
13409
  }
14089
13410
  return Err(generateSyntaxError(`(${type}) only takes a single positional argument`, call.loc));
14090
13411
  };
@@ -14122,7 +13443,7 @@ var define, require;
14122
13443
  if (!positional || !condition) return Err(generateSyntaxError(`When used inline, (${type}) requires at least two parameters 1. the condition that determines the state of the (${type}), and 2. the value to return if the condition is ${inverted ? "false" : "true"}. Did not receive any parameters`, originalNode.loc));
14123
13444
  let truthy = positional.nth(1),
14124
13445
  falsy = positional.nth(2);
14125
- return null === truthy ? Err(generateSyntaxError(`When used inline, (${type}) requires at least two parameters 1. the condition that determines the state of the (${type}), and 2. the value to return if the condition is ${inverted ? "false" : "true"}. Received only one parameter, the condition`, originalNode.loc)) : positional.size > 3 ? Err(generateSyntaxError(`When used inline, (${type}) can receive a maximum of three positional parameters 1. the condition that determines the state of the (${type}), 2. the value to return if the condition is ${inverted ? "false" : "true"}, and 3. the value to return if the condition is ${inverted ? "true" : "false"}. Received ${positional?.size ?? 0} parameters`, originalNode.loc)) : Ok({
13446
+ return null === truthy ? Err(generateSyntaxError(`When used inline, (${type}) requires at least two parameters 1. the condition that determines the state of the (${type}), and 2. the value to return if the condition is ${inverted ? "false" : "true"}. Received only one parameter, the condition`, originalNode.loc)) : positional.size > 3 ? Err(generateSyntaxError(`When used inline, (${type}) can receive a maximum of three positional parameters 1. the condition that determines the state of the (${type}), 2. the value to return if the condition is ${inverted ? "false" : "true"}, and 3. the value to return if the condition is ${inverted ? "true" : "false"}. Received ${positional.size} parameters`, originalNode.loc)) : Ok({
14126
13447
  condition: condition,
14127
13448
  truthy: truthy,
14128
13449
  falsy: falsy
@@ -14167,7 +13488,7 @@ var define, require;
14167
13488
  positional: positional
14168
13489
  }
14169
13490
  } = node;
14170
- return named && !named.isEmpty() ? Err(generateSyntaxError("(log) does not take any named arguments", node.loc)) : Ok(positional);
13491
+ return named.isEmpty() ? Ok(positional) : Err(generateSyntaxError("(log) does not take any named arguments", node.loc));
14171
13492
  },
14172
13493
  translate: function ({
14173
13494
  node: node,
@@ -14185,12 +13506,12 @@ var define, require;
14185
13506
  args: args
14186
13507
  } = node;
14187
13508
  if (args.named.isEmpty()) return Ok({
14188
- target: api$2.SourceSpan.synthetic("default").toSlice(),
13509
+ target: api$1.SourceSpan.synthetic("default").toSlice(),
14189
13510
  positional: args.positional
14190
13511
  });
14191
13512
  {
14192
13513
  let target = args.named.get("to");
14193
- return args.named.size > 1 || null === target ? Err(generateSyntaxError("yield only takes a single named argument: 'to'", args.named.loc)) : api$1.isLiteral(target, "string") ? Ok({
13514
+ return args.named.size > 1 || null === target ? Err(generateSyntaxError("yield only takes a single named argument: 'to'", args.named.loc)) : api.isLiteral(target, "string") ? Ok({
14194
13515
  target: target.toSlice(),
14195
13516
  positional: args.positional
14196
13517
  }) : Err(generateSyntaxError("you can only yield to a literal string value", target.loc));
@@ -14223,12 +13544,12 @@ var define, require;
14223
13544
  state: {
14224
13545
  scope: scope
14225
13546
  }
14226
- }) => (scope.setHasDebugger(), Ok(new Debugger({
13547
+ }) => Ok(new Debugger({
14227
13548
  loc: node.loc,
14228
13549
  scope: scope
14229
- })))
13550
+ }))
14230
13551
  }).kw("component", {
14231
- assert: assertCurryKeyword(CurriedTypes.Component),
13552
+ assert: assertCurryKeyword(0),
14232
13553
  translate({
14233
13554
  node: node,
14234
13555
  state: state
@@ -14246,7 +13567,7 @@ var define, require;
14246
13567
  }));
14247
13568
  }
14248
13569
  }).kw("helper", {
14249
- assert: assertCurryKeyword(CurriedTypes.Helper),
13570
+ assert: assertCurryKeyword(1),
14250
13571
  translate({
14251
13572
  node: node,
14252
13573
  state: state
@@ -14458,7 +13779,7 @@ var define, require;
14458
13779
  }));
14459
13780
  }
14460
13781
  }).kw("component", {
14461
- assert: assertCurryKeyword(CurriedTypes.Component),
13782
+ assert: assertCurryKeyword(0),
14462
13783
  translate({
14463
13784
  node: node,
14464
13785
  state: state
@@ -14477,7 +13798,7 @@ var define, require;
14477
13798
  }));
14478
13799
  }
14479
13800
  }),
14480
- CALL_KEYWORDS = keywords("Call").kw("has-block", hasBlockKeyword("has-block")).kw("has-block-params", hasBlockKeyword("has-block-params")).kw("-get-dynamic-var", getDynamicVarKeyword).kw("log", logKeyword).kw("if", ifUnlessInlineKeyword("if")).kw("unless", ifUnlessInlineKeyword("unless")).kw("component", curryKeyword(CurriedTypes.Component)).kw("helper", curryKeyword(CurriedTypes.Helper)).kw("modifier", curryKeyword(CurriedTypes.Modifier)),
13801
+ CALL_KEYWORDS = keywords("Call").kw("has-block", hasBlockKeyword("has-block")).kw("has-block-params", hasBlockKeyword("has-block-params")).kw("-get-dynamic-var", getDynamicVarKeyword).kw("log", logKeyword).kw("if", ifUnlessInlineKeyword("if")).kw("unless", ifUnlessInlineKeyword("unless")).kw("component", curryKeyword(0)).kw("helper", curryKeyword(1)).kw("modifier", curryKeyword(2)),
14481
13802
  MODIFIER_KEYWORDS = keywords("Modifier"),
14482
13803
  XLINK = "http://www.w3.org/1999/xlink",
14483
13804
  XML = "http://www.w3.org/XML/1998/namespace",
@@ -14523,7 +13844,6 @@ var define, require;
14523
13844
  return "string" == typeof attrName ? attrName : INFLATE_ATTR_TABLE[attrName];
14524
13845
  }
14525
13846
  class ClassifiedElement {
14526
- delegate;
14527
13847
  constructor(element, delegate, state) {
14528
13848
  this.element = element, this.state = state, this.delegate = delegate;
14529
13849
  }
@@ -14535,7 +13855,7 @@ var define, require;
14535
13855
  rawValue = attr.value,
14536
13856
  namespace = (attrName = name.chars, WHITELIST[attrName] || void 0);
14537
13857
  var attrName;
14538
- return api$1.isLiteral(rawValue, "string") ? Ok(new StaticAttr({
13858
+ return api.isLiteral(rawValue, "string") ? Ok(new StaticAttr({
14539
13859
  loc: attr.loc,
14540
13860
  name: name,
14541
13861
  value: rawValue.toSlice(),
@@ -14581,7 +13901,7 @@ var define, require;
14581
13901
  return typeAttr && attrs.add(this.attr(typeAttr)), Result.all(args.toArray(), attrs.toArray()).mapOk(([args, attrs]) => ({
14582
13902
  attrs: attrs,
14583
13903
  args: new NamedArguments({
14584
- loc: maybeLoc(args, api$2.SourceSpan.NON_EXISTENT),
13904
+ loc: maybeLoc(args, api$1.SourceSpan.NON_EXISTENT),
14585
13905
  entries: OptionalList(args)
14586
13906
  })
14587
13907
  }));
@@ -14598,7 +13918,7 @@ var define, require;
14598
13918
  return {
14599
13919
  args: args,
14600
13920
  params: new ElementParameters({
14601
- loc: maybeLoc(elementParams, api$2.SourceSpan.NON_EXISTENT),
13921
+ loc: maybeLoc(elementParams, api$1.SourceSpan.NON_EXISTENT),
14602
13922
  body: OptionalList(elementParams)
14603
13923
  })
14604
13924
  };
@@ -14606,9 +13926,8 @@ var define, require;
14606
13926
  }
14607
13927
  }
14608
13928
  class ClassifiedComponent {
14609
- dynamicFeatures = !0;
14610
13929
  constructor(tag, element) {
14611
- this.tag = tag, this.element = element;
13930
+ this.tag = tag, this.element = element, this.dynamicFeatures = !0;
14612
13931
  }
14613
13932
  arg(attr, {
14614
13933
  state: state
@@ -14642,9 +13961,8 @@ var define, require;
14642
13961
  }
14643
13962
  class ClassifiedSimpleElement {
14644
13963
  constructor(tag, element, dynamicFeatures) {
14645
- this.tag = tag, this.element = element, this.dynamicFeatures = dynamicFeatures;
13964
+ this.tag = tag, this.element = element, this.dynamicFeatures = dynamicFeatures, this.isComponent = !1;
14646
13965
  }
14647
- isComponent = !1;
14648
13966
  arg(attr) {
14649
13967
  return Err(generateSyntaxError(`${attr.name.chars} is not a valid attribute name. @arguments are only allowed on components, but the tag for this element (\`${this.tag.chars}\`) is a regular, non-component HTML element.`, attr.loc));
14650
13968
  }
@@ -14738,7 +14056,7 @@ var define, require;
14738
14056
  TextNode(text) {
14739
14057
  return new AppendTextNode({
14740
14058
  loc: text.loc,
14741
- text: new api$1.LiteralExpression({
14059
+ text: new api.LiteralExpression({
14742
14060
  loc: text.loc,
14743
14061
  value: text.chars
14744
14062
  })
@@ -14756,10 +14074,8 @@ var define, require;
14756
14074
  * This is the mutable state for this compiler pass.
14757
14075
  */
14758
14076
  class NormalizationState {
14759
- _currentScope;
14760
- _cursorCount = 0;
14761
14077
  constructor(block, isStrict) {
14762
- this.isStrict = isStrict, this._currentScope = block;
14078
+ this.isStrict = isStrict, this._cursorCount = 0, this._currentScope = block;
14763
14079
  }
14764
14080
  generateUniqueCursor() {
14765
14081
  return `%cursor:${this._cursorCount++}%`;
@@ -14777,9 +14093,8 @@ var define, require;
14777
14093
  }
14778
14094
  }
14779
14095
  }
14780
- var ResolutionType = function (ResolutionType) {
14781
- return ResolutionType.Value = "value", ResolutionType.Component = "component", ResolutionType.Helper = "helper", ResolutionType.Modifier = "modifier", ResolutionType.ComponentOrHelper = "component or helper", ResolutionType;
14782
- }(ResolutionType || {});
14096
+
14097
+ /// ResolutionType ///
14783
14098
  class StrictModeValidationPass {
14784
14099
  // This is done at the end of all the keyword normalizations
14785
14100
  // At this point any free variables that isn't a valid keyword
@@ -14867,7 +14182,7 @@ var define, require;
14867
14182
  case "InterpolateExpression":
14868
14183
  return this.InterpolateExpression(expression, span, resolution);
14869
14184
  case "CallExpression":
14870
- return this.CallExpression(expression, span, resolution ?? ResolutionType.Helper);
14185
+ return this.CallExpression(expression, span, resolution ?? "helper");
14871
14186
  case "Not":
14872
14187
  return this.Expression(expression.value, span, resolution);
14873
14188
  case "IfInline":
@@ -14887,6 +14202,7 @@ var define, require;
14887
14202
  // For cases like {{yield foo}}, when there is only a single argument, it
14888
14203
  // makes for a slightly better error to report that entire span. However,
14889
14204
  // when there are more than one, we need to be specific.
14205
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- @fixme PresentArray
14890
14206
  return result = 1 === expressions.length ? this.Expression(expressions[0], span) : this.Expressions(expressions), result;
14891
14207
  }
14892
14208
  NamedArguments({
@@ -14897,7 +14213,7 @@ var define, require;
14897
14213
  return result;
14898
14214
  }
14899
14215
  NamedArgument(arg) {
14900
- return "CallExpression" === arg.value.type ? this.Expression(arg.value, arg, ResolutionType.Helper) : this.Expression(arg.value, arg);
14216
+ return "CallExpression" === arg.value.type ? this.Expression(arg.value, arg, "helper") : this.Expression(arg.value, arg);
14901
14217
  }
14902
14218
  ElementParameters({
14903
14219
  body: body
@@ -14918,10 +14234,10 @@ var define, require;
14918
14234
  }
14919
14235
  }
14920
14236
  DynamicAttr(attr) {
14921
- return "CallExpression" === attr.value.type ? this.Expression(attr.value, attr, ResolutionType.Helper) : this.Expression(attr.value, attr);
14237
+ return "CallExpression" === attr.value.type ? this.Expression(attr.value, attr, "helper") : this.Expression(attr.value, attr);
14922
14238
  }
14923
14239
  Modifier(modifier) {
14924
- return this.Expression(modifier.callee, modifier, ResolutionType.Modifier).andThen(() => this.Args(modifier.args));
14240
+ return this.Expression(modifier.callee, modifier, "modifier").andThen(() => this.Args(modifier.args));
14925
14241
  }
14926
14242
  InElement(inElement) {
14927
14243
  return this.Expression(inElement.destination).andThen(() => this.Expression(inElement.insertBefore)).andThen(() => this.NamedBlock(inElement.block));
@@ -14933,16 +14249,16 @@ var define, require;
14933
14249
  return this.Expression(statement.html, statement);
14934
14250
  }
14935
14251
  AppendTextNode(statement) {
14936
- return "CallExpression" === statement.text.type ? this.Expression(statement.text, statement, ResolutionType.ComponentOrHelper) : this.Expression(statement.text, statement);
14252
+ return "CallExpression" === statement.text.type ? this.Expression(statement.text, statement, "component or helper") : this.Expression(statement.text, statement);
14937
14253
  }
14938
14254
  Component(statement) {
14939
- return this.Expression(statement.tag, statement, ResolutionType.Component).andThen(() => this.ElementParameters(statement.params)).andThen(() => this.NamedArguments(statement.args)).andThen(() => this.NamedBlocks(statement.blocks));
14255
+ return this.Expression(statement.tag, statement, "component").andThen(() => this.ElementParameters(statement.params)).andThen(() => this.NamedArguments(statement.args)).andThen(() => this.NamedBlocks(statement.blocks));
14940
14256
  }
14941
14257
  SimpleElement(statement) {
14942
14258
  return this.ElementParameters(statement.params).andThen(() => this.Statements(statement.body));
14943
14259
  }
14944
14260
  InvokeBlock(statement) {
14945
- return this.Expression(statement.head, statement.head, ResolutionType.Component).andThen(() => this.Args(statement.args)).andThen(() => this.NamedBlocks(statement.blocks));
14261
+ return this.Expression(statement.head, statement.head, "component").andThen(() => this.Args(statement.args)).andThen(() => this.NamedBlocks(statement.blocks));
14946
14262
  }
14947
14263
  If(statement) {
14948
14264
  return this.Expression(statement.condition, statement).andThen(() => this.NamedBlock(statement.block)).andThen(() => statement.inverse ? this.NamedBlock(statement.inverse) : Ok(null));
@@ -14957,7 +14273,7 @@ var define, require;
14957
14273
  return this.NamedArguments(statement.named).andThen(() => this.NamedBlock(statement.block));
14958
14274
  }
14959
14275
  InvokeComponent(statement) {
14960
- return this.Expression(statement.definition, statement, ResolutionType.Component).andThen(() => this.Args(statement.args)).andThen(() => statement.blocks ? this.NamedBlocks(statement.blocks) : Ok(null));
14276
+ return this.Expression(statement.definition, statement, "component").andThen(() => this.Args(statement.args)).andThen(() => statement.blocks ? this.NamedBlocks(statement.blocks) : Ok(null));
14961
14277
  }
14962
14278
  InterpolateExpression(expression, span, resolution) {
14963
14279
  let expressions = expression.parts.toArray();
@@ -14971,12 +14287,12 @@ var define, require;
14971
14287
  }
14972
14288
  Curry(expression) {
14973
14289
  let resolution;
14974
- return resolution = expression.curriedType === CurriedTypes.Component ? ResolutionType.Component : expression.curriedType === CurriedTypes.Helper ? ResolutionType.Helper : ResolutionType.Modifier, this.Expression(expression.definition, expression, resolution).andThen(() => this.Args(expression.args));
14290
+ return resolution = 0 === expression.curriedType ? "component" : 1 === expression.curriedType ? "helper" : "modifier", this.Expression(expression.definition, expression, resolution).andThen(() => this.Args(expression.args));
14975
14291
  }
14976
14292
  Log(expression) {
14977
14293
  return this.Positional(expression.positional, expression);
14978
14294
  }
14979
- errorFor(name, span, type = ResolutionType.Value) {
14295
+ errorFor(name, span, type = "value") {
14980
14296
  return Err(generateSyntaxError(`Attempted to resolve a ${type} in a strict mode template, but that value was not in scope: ${name}`, loc(span)));
14981
14297
  }
14982
14298
  }
@@ -15020,9 +14336,7 @@ var define, require;
15020
14336
  * ```
15021
14337
  */
15022
14338
  class WireFormatDebugger {
15023
- upvars;
15024
- symbols;
15025
- constructor([_statements, symbols, _hasEval, upvars]) {
14339
+ constructor([_statements, symbols, upvars]) {
15026
14340
  this.upvars = upvars, this.symbols = symbols;
15027
14341
  }
15028
14342
  format(program) {
@@ -15125,14 +14439,12 @@ var define, require;
15125
14439
  }
15126
14440
  formatCurryType(value) {
15127
14441
  switch (value) {
15128
- case CurriedTypes.Component:
14442
+ case 0:
15129
14443
  return "component";
15130
- case CurriedTypes.Helper:
14444
+ case 1:
15131
14445
  return "helper";
15132
- case CurriedTypes.Modifier:
14446
+ case 2:
15133
14447
  return "modifier";
15134
- default:
15135
- throw exhausted(value);
15136
14448
  }
15137
14449
  }
15138
14450
  formatElementParams(opcodes) {
@@ -15232,7 +14544,7 @@ var define, require;
15232
14544
  tail: tail
15233
14545
  }) {
15234
14546
  let getOp = EXPR.expr(head);
15235
- return debugAssert(getOp[0] !== opcodes.GetStrictKeyword, "[BUG] keyword in a PathExpression"), [...getOp, EXPR.Tail(tail)];
14547
+ return getOp[0], opcodes.GetStrictKeyword, [...getOp, EXPR.Tail(tail)];
15236
14548
  }
15237
14549
  InterpolateExpression({
15238
14550
  parts: parts
@@ -15278,7 +14590,7 @@ var define, require;
15278
14590
  let [name, value] = EXPR.NamedArgument(pair);
15279
14591
  names.push(name), values.push(value);
15280
14592
  }
15281
- return assertPresentArray(names), assertPresentArray(values), [names, values];
14593
+ return [names, values];
15282
14594
  }
15283
14595
  return null;
15284
14596
  }
@@ -15319,7 +14631,7 @@ var define, require;
15319
14631
  let out = [];
15320
14632
  for (let statement of statements) {
15321
14633
  let result = CONTENT.content(statement);
15322
- result && result instanceof WireStatements ? out.push(...result.toArray()) : out.push(result);
14634
+ result instanceof WireStatements ? out.push(...result.toArray()) : out.push(result);
15323
14635
  }
15324
14636
  return out;
15325
14637
  }
@@ -15329,7 +14641,7 @@ var define, require;
15329
14641
  visitContent(stmt) {
15330
14642
  switch (stmt.type) {
15331
14643
  case "Debugger":
15332
- return [opcodes.Debugger, stmt.scope.getDebugInfo()];
14644
+ return [opcodes.Debugger, ...stmt.scope.getDebugInfo(), {}];
15333
14645
  case "AppendComment":
15334
14646
  return this.AppendComment(stmt);
15335
14647
  case "AppendTextNode":
@@ -15357,7 +14669,7 @@ var define, require;
15357
14669
  case "InvokeComponent":
15358
14670
  return this.InvokeComponent(stmt);
15359
14671
  default:
15360
- return exhausted(stmt);
14672
+ return;
15361
14673
  }
15362
14674
  }
15363
14675
  Yield({
@@ -15549,7 +14861,7 @@ var define, require;
15549
14861
  * @return {string} a template javascript string
15550
14862
  */
15551
14863
  function precompileJSON(string, options = defaultOptions) {
15552
- const source = new api$2.Source(string ?? "", options.meta?.moduleName),
14864
+ const source = new api$1.Source(string ?? "", options.meta?.moduleName),
15553
14865
  [ast, locals] = normalize(source, {
15554
14866
  lexicalScope: () => !1,
15555
14867
  ...options
@@ -15566,7 +14878,7 @@ var define, require;
15566
14878
  }(0, ast, options.strictMode ?? !1).mapOk(pass2In => function (template) {
15567
14879
  let statements = CONTENT.list(template.body),
15568
14880
  scope = template.scope;
15569
- return [statements, scope.symbols, scope.hasEval, scope.upvars];
14881
+ return [statements, scope.symbols, scope.upvars];
15570
14882
  }(pass2In));
15571
14883
  if (block.isOk) return [block.value, locals];
15572
14884
  throw block.reason;
@@ -15589,8 +14901,9 @@ var define, require;
15589
14901
  * @return {string} a template javascript string
15590
14902
  */
15591
14903
  function precompile$1(source, options = defaultOptions) {
15592
- const [block, usedLocals] = precompileJSON(source, options),
15593
- moduleName = options.meta?.moduleName,
14904
+ const [block, usedLocals] = precompileJSON(source, options);
14905
+ "emit" in options && options.emit?.debugSymbols && usedLocals.length > 0 && block.push(usedLocals);
14906
+ const moduleName = options.meta?.moduleName,
15594
14907
  idFn = options.id || defaultId,
15595
14908
  blockJSON = JSON.stringify(block),
15596
14909
  templateJSONObject = {
@@ -15614,7 +14927,6 @@ var define, require;
15614
14927
 
15615
14928
  const glimmerCompiler = /*#__PURE__*/Object.defineProperty({
15616
14929
  __proto__: null,
15617
- Builder,
15618
14930
  NEWLINE,
15619
14931
  ProgramSymbols,
15620
14932
  WireFormatDebugger,
@@ -15637,8 +14949,76 @@ var define, require;
15637
14949
  DEBUG
15638
14950
  }, Symbol.toStringTag, { value: 'Module' });
15639
14951
 
14952
+ const ContentType = {
14953
+ Component: 0,
14954
+ Helper: 1,
14955
+ String: 2,
14956
+ Empty: 3,
14957
+ SafeString: 4,
14958
+ Fragment: 5,
14959
+ Node: 6,
14960
+ Other: 8
14961
+ },
14962
+ InternalComponentCapabilities = {
14963
+ Empty: 0,
14964
+ dynamicLayout: 1,
14965
+ dynamicTag: 2,
14966
+ prepareArgs: 4,
14967
+ createArgs: 8,
14968
+ attributeHook: 16,
14969
+ elementHook: 32,
14970
+ dynamicScope: 64,
14971
+ createCaller: 128,
14972
+ updateHook: 256,
14973
+ createInstance: 512,
14974
+ wrapped: 1024,
14975
+ willDestroy: 2048,
14976
+ hasSubOwner: 4096
14977
+ },
14978
+ ARG_SHIFT = 8,
14979
+ MAX_SIZE = 2147483647,
14980
+ TYPE_SIZE = 255,
14981
+ TYPE_MASK = 255,
14982
+ OPERAND_LEN_MASK = 768,
14983
+ MACHINE_MASK = 1024,
14984
+ $pc = 0,
14985
+ $ra = 1,
14986
+ $fp = 2,
14987
+ $sp = 3,
14988
+ $s0 = 4,
14989
+ $s1 = 5,
14990
+ $t0 = 6,
14991
+ $t1 = 7,
14992
+ $v0 = 8;
14993
+ function isLowLevelRegister(register) {
14994
+ return register <= 3;
14995
+ }
14996
+
14997
+ const glimmerVm = /*#__PURE__*/Object.defineProperty({
14998
+ __proto__: null,
14999
+ $fp,
15000
+ $pc,
15001
+ $ra,
15002
+ $s0,
15003
+ $s1,
15004
+ $sp,
15005
+ $t0,
15006
+ $t1,
15007
+ $v0,
15008
+ ARG_SHIFT,
15009
+ ContentType,
15010
+ InternalComponentCapabilities,
15011
+ InternalComponentCapability: InternalComponentCapabilities,
15012
+ MACHINE_MASK,
15013
+ MAX_SIZE,
15014
+ OPERAND_LEN_MASK,
15015
+ TYPE_MASK,
15016
+ TYPE_SIZE,
15017
+ isLowLevelRegister
15018
+ }, Symbol.toStringTag, { value: 'Module' });
15019
+
15640
15020
  // this file gets replaced with the real value during the build
15641
- const version = '6.4.0-alpha.2';
15021
+ const version = '6.4.0-alpha.3';
15642
15022
 
15643
15023
  const emberVersion = /*#__PURE__*/Object.defineProperty({
15644
15024
  __proto__: null,